Skip to content

Commit

Permalink
use 0x address scheme by default and add new enable xdc prefix flag (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 authored Apr 12, 2024
1 parent 5d4ea76 commit 3281766
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cicd/devnet/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ XDC --ethstats ${netstats} --gcmode archive \
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
--debugdatadir /work/xdcchain \
--enable-0x-prefix --ws --wsaddr=0.0.0.0 --wsport $ws_port \
--ws --wsaddr=0.0.0.0 --wsport $ws_port \
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log
2 changes: 1 addition & 1 deletion cicd/mainnet/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ XDC --ethstats ${netstats} --gcmode archive \
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
--debugdatadir /work/xdcchain \
--enable-0x-prefix --ws --wsaddr=0.0.0.0 --wsport $ws_port \
--ws --wsaddr=0.0.0.0 --wsport $ws_port \
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log
2 changes: 1 addition & 1 deletion cicd/testnet/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ XDC --ethstats ${netstats} --gcmode archive \
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
--debugdatadir /work/xdcchain \
--enable-0x-prefix --ws --wsaddr=0.0.0.0 --wsport $ws_port \
--ws --wsaddr=0.0.0.0 --wsport $ws_port \
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log
4 changes: 2 additions & 2 deletions cmd/XDC/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
common.TIPXDCXCancellationFee = common.TIPXDCXCancellationFeeTestnet
}

if ctx.GlobalBool(utils.Enable0xPrefixFlag.Name) {
common.Enable0xPrefix = true
if ctx.GlobalBool(utils.EnableXDCPrefixFlag.Name) {
common.Enable0xPrefix = false
}

// Rewound
Expand Down
8 changes: 4 additions & 4 deletions cmd/XDC/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
// Tests that a node embedded within a console can be started up properly and
// then terminated by closing the input stream.
func TestConsoleWelcome(t *testing.T) {
coinbase := "xdc8605cdbbdb6d264aa742e77020dcbc58fcdce182"
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"

// Start a XDC console, make sure it's cleaned up and terminate the console
XDC := runXDC(t,
Expand Down Expand Up @@ -75,7 +75,7 @@ at block: 0 ({{niltime}})
// Tests that a console can be attached to a running node via various means.
func TestIPCAttachWelcome(t *testing.T) {
// Configure the instance for IPC attachement
coinbase := "xdc8605cdbbdb6d264aa742e77020dcbc58fcdce182"
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
var ipc string
if runtime.GOOS == "windows" {
ipc = `\\.\pipe\XDC` + strconv.Itoa(trulyRandInt(100000, 999999))
Expand All @@ -97,7 +97,7 @@ func TestIPCAttachWelcome(t *testing.T) {
}

func TestHTTPAttachWelcome(t *testing.T) {
coinbase := "xdc8605cdbbdb6d264aa742e77020dcbc58fcdce182"
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P
XDC := runXDC(t,
"--XDCx.datadir", tmpdir(t)+"XDCx/"+time.Now().String(),
Expand All @@ -112,7 +112,7 @@ func TestHTTPAttachWelcome(t *testing.T) {
}

func TestWSAttachWelcome(t *testing.T) {
coinbase := "xdc8605cdbbdb6d264aa742e77020dcbc58fcdce182"
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P

XDC := runXDC(t,
Expand Down
1 change: 1 addition & 0 deletions cmd/XDC/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ var (
//utils.VMEnableDebugFlag,
utils.XDCTestnetFlag,
utils.Enable0xPrefixFlag,
utils.EnableXDCPrefixFlag,
utils.RewoundFlag,
utils.NetworkIdFlag,
utils.RPCCORSDomainFlag,
Expand Down
11 changes: 10 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ var (
}
Enable0xPrefixFlag = cli.BoolFlag{
Name: "enable-0x-prefix",
Usage: "Addres use 0x-prefix (default = false)",
Usage: "Addres use 0x-prefix (Deprecated: this is on by default, to use xdc prefix use --enable-xdc-prefix)",
}
EnableXDCPrefixFlag = cli.BoolFlag{
Name: "enable-xdc-prefix",
Usage: "Addres use xdc-prefix (default = false)",
}
// General settings
AnnounceTxsFlag = cli.BoolFlag{
Expand Down Expand Up @@ -786,6 +790,10 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
}
}

func setPrefix(ctx *cli.Context, cfg *node.Config) {
checkExclusive(ctx, Enable0xPrefixFlag, EnableXDCPrefixFlag)
}

// MakeDatabaseHandles raises out the number of allowed file handles per process
// for XDC and returns half of the allowance to assign to the database.
func MakeDatabaseHandles() int {
Expand Down Expand Up @@ -933,6 +941,7 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
setHTTP(ctx, cfg)
setWS(ctx, cfg)
setNodeUserIdent(ctx, cfg)
setPrefix(ctx, cfg)

switch {
case ctx.GlobalIsSet(DataDirFlag.Name):
Expand Down
2 changes: 1 addition & 1 deletion common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var ShanghaiBlock = big.NewInt(9999999999)

var TIPXDCXTestnet = big.NewInt(38383838)
var IsTestnet bool = false
var Enable0xPrefix bool = false
var Enable0xPrefix bool = true
var StoreRewardFolder string
var RollbackHash Hash
var BasePrice = big.NewInt(1000000000000000000) // 1
Expand Down
2 changes: 1 addition & 1 deletion common/constants/constants.go.devnet
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var ShanghaiBlock = big.NewInt(16832700)

var TIPXDCXTestnet = big.NewInt(0)
var IsTestnet bool = false
var Enable0xPrefix bool = false
var Enable0xPrefix bool = true
var StoreRewardFolder string
var RollbackHash Hash
var BasePrice = big.NewInt(1000000000000000000) // 1
Expand Down
2 changes: 1 addition & 1 deletion common/constants/constants.go.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var ShanghaiBlock = big.NewInt(61290000) // Target 31st March 2024

var TIPXDCXTestnet = big.NewInt(23779191)
var IsTestnet bool = false
var Enable0xPrefix bool = false
var Enable0xPrefix bool = true
var StoreRewardFolder string
var RollbackHash Hash
var BasePrice = big.NewInt(1000000000000000000) // 1
Expand Down

0 comments on commit 3281766

Please sign in to comment.