Skip to content

Commit 3281766

Browse files
authored
use 0x address scheme by default and add new enable xdc prefix flag (#518)
1 parent 5d4ea76 commit 3281766

File tree

10 files changed

+23
-13
lines changed

10 files changed

+23
-13
lines changed

cicd/devnet/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ XDC --ethstats ${netstats} --gcmode archive \
8181
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
8282
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
8383
--debugdatadir /work/xdcchain \
84-
--enable-0x-prefix --ws --wsaddr=0.0.0.0 --wsport $ws_port \
84+
--ws --wsaddr=0.0.0.0 --wsport $ws_port \
8585
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log

cicd/mainnet/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ XDC --ethstats ${netstats} --gcmode archive \
8080
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
8181
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
8282
--debugdatadir /work/xdcchain \
83-
--enable-0x-prefix --ws --wsaddr=0.0.0.0 --wsport $ws_port \
83+
--ws --wsaddr=0.0.0.0 --wsport $ws_port \
8484
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log

cicd/testnet/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@ XDC --ethstats ${netstats} --gcmode archive \
8282
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
8383
--gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \
8484
--debugdatadir /work/xdcchain \
85-
--enable-0x-prefix --ws --wsaddr=0.0.0.0 --wsport $ws_port \
85+
--ws --wsaddr=0.0.0.0 --wsport $ws_port \
8686
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log

cmd/XDC/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
164164
common.TIPXDCXCancellationFee = common.TIPXDCXCancellationFeeTestnet
165165
}
166166

167-
if ctx.GlobalBool(utils.Enable0xPrefixFlag.Name) {
168-
common.Enable0xPrefix = true
167+
if ctx.GlobalBool(utils.EnableXDCPrefixFlag.Name) {
168+
common.Enable0xPrefix = false
169169
}
170170

171171
// Rewound

cmd/XDC/consolecmd_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const (
3838
// Tests that a node embedded within a console can be started up properly and
3939
// then terminated by closing the input stream.
4040
func TestConsoleWelcome(t *testing.T) {
41-
coinbase := "xdc8605cdbbdb6d264aa742e77020dcbc58fcdce182"
41+
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
4242

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

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

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

118118
XDC := runXDC(t,

cmd/XDC/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ var (
114114
//utils.VMEnableDebugFlag,
115115
utils.XDCTestnetFlag,
116116
utils.Enable0xPrefixFlag,
117+
utils.EnableXDCPrefixFlag,
117118
utils.RewoundFlag,
118119
utils.NetworkIdFlag,
119120
utils.RPCCORSDomainFlag,

cmd/utils/flags.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ var (
117117
}
118118
Enable0xPrefixFlag = cli.BoolFlag{
119119
Name: "enable-0x-prefix",
120-
Usage: "Addres use 0x-prefix (default = false)",
120+
Usage: "Addres use 0x-prefix (Deprecated: this is on by default, to use xdc prefix use --enable-xdc-prefix)",
121+
}
122+
EnableXDCPrefixFlag = cli.BoolFlag{
123+
Name: "enable-xdc-prefix",
124+
Usage: "Addres use xdc-prefix (default = false)",
121125
}
122126
// General settings
123127
AnnounceTxsFlag = cli.BoolFlag{
@@ -786,6 +790,10 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
786790
}
787791
}
788792

793+
func setPrefix(ctx *cli.Context, cfg *node.Config) {
794+
checkExclusive(ctx, Enable0xPrefixFlag, EnableXDCPrefixFlag)
795+
}
796+
789797
// MakeDatabaseHandles raises out the number of allowed file handles per process
790798
// for XDC and returns half of the allowance to assign to the database.
791799
func MakeDatabaseHandles() int {
@@ -933,6 +941,7 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
933941
setHTTP(ctx, cfg)
934942
setWS(ctx, cfg)
935943
setNodeUserIdent(ctx, cfg)
944+
setPrefix(ctx, cfg)
936945

937946
switch {
938947
case ctx.GlobalIsSet(DataDirFlag.Name):

common/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var ShanghaiBlock = big.NewInt(9999999999)
5353

5454
var TIPXDCXTestnet = big.NewInt(38383838)
5555
var IsTestnet bool = false
56-
var Enable0xPrefix bool = false
56+
var Enable0xPrefix bool = true
5757
var StoreRewardFolder string
5858
var RollbackHash Hash
5959
var BasePrice = big.NewInt(1000000000000000000) // 1

common/constants/constants.go.devnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var ShanghaiBlock = big.NewInt(16832700)
5353

5454
var TIPXDCXTestnet = big.NewInt(0)
5555
var IsTestnet bool = false
56-
var Enable0xPrefix bool = false
56+
var Enable0xPrefix bool = true
5757
var StoreRewardFolder string
5858
var RollbackHash Hash
5959
var BasePrice = big.NewInt(1000000000000000000) // 1

common/constants/constants.go.testnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var ShanghaiBlock = big.NewInt(61290000) // Target 31st March 2024
5353

5454
var TIPXDCXTestnet = big.NewInt(23779191)
5555
var IsTestnet bool = false
56-
var Enable0xPrefix bool = false
56+
var Enable0xPrefix bool = true
5757
var StoreRewardFolder string
5858
var RollbackHash Hash
5959
var BasePrice = big.NewInt(1000000000000000000) // 1

0 commit comments

Comments
 (0)