Skip to content

Commit dff4fe2

Browse files
authored
Fix 0x prefix (#119)
* internally use 0x instead of xdc (#118) * completely remove xdc prefix from subnet * test cicd * remove further xdc prefix code * fix test * rm comment
1 parent bd93ef6 commit dff4fe2

File tree

18 files changed

+72
-90
lines changed

18 files changed

+72
-90
lines changed

accounts/keystore/testdata/keystore/README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ The passphrase that unlocks them is "foobar".
44
The "good" key files which are supposed to be loadable are:
55

66
- File: UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
7-
Address: xdc7ef5a6135f1fd6a02593eedc869c6d41d934aef8
7+
Address: 0x7ef5a6135f1fd6a02593eedc869c6d41d934aef8
88
- File: aaa
9-
Address: xdcf466859ead1932d743d622cb74fc058882e8648a
9+
Address: 0xf466859ead1932d743d622cb74fc058882e8648a
1010
- File: zzz
11-
Address: xdc289d485d9771714cce91d3393d764e1311907acc
11+
Address: 0x289d485d9771714cce91d3393d764e1311907acc
1212

1313
The other files (including this README) are broken in various ways
1414
and should not be picked up by package accounts:

cmd/XDC/accountcmd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func accountCreate(ctx *cli.Context) error {
312312
if err != nil {
313313
utils.Fatalf("Failed to create account: %v", err)
314314
}
315-
fmt.Printf("Address: {xdc%x}\n", address)
315+
fmt.Printf("Address: {0x%x}\n", address)
316316
return nil
317317
}
318318

@@ -353,7 +353,7 @@ func importWallet(ctx *cli.Context) error {
353353
if err != nil {
354354
utils.Fatalf("%v", err)
355355
}
356-
fmt.Printf("Address: {xdc%x}\n", acct.Address)
356+
fmt.Printf("Address: {0x%x}\n", acct.Address)
357357
return nil
358358
}
359359

@@ -374,6 +374,6 @@ func accountImport(ctx *cli.Context) error {
374374
if err != nil {
375375
utils.Fatalf("Could not create the account: %v", err)
376376
}
377-
fmt.Printf("Address: {xdc%x}\n", acct.Address)
377+
fmt.Printf("Address: {0x%x}\n", acct.Address)
378378
return nil
379379
}

cmd/XDC/accountcmd_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Your new account is locked with a password. Please give a password. Do not forge
7575
Passphrase: {{.InputLine "foobar"}}
7676
Repeat passphrase: {{.InputLine "foobar"}}
7777
`)
78-
XDC.ExpectRegexp(`Address: \{xdc[0-9a-f]{40}\}\n`)
78+
XDC.ExpectRegexp(`Address: \{0x[0-9a-f]{40}\}\n`)
7979
}
8080

8181
func TestAccountNewBadRepeat(t *testing.T) {
@@ -112,7 +112,7 @@ func TestWalletImport(t *testing.T) {
112112
XDC.Expect(`
113113
!! Unsupported terminal, password will be echoed.
114114
Passphrase: {{.InputLine "foo"}}
115-
Address: {xdcd4584b5f6229b7be90727b0fc8c6b91bb427821f}
115+
Address: {0xd4584b5f6229b7be90727b0fc8c6b91bb427821f}
116116
`)
117117

118118
files, err := ioutil.ReadDir(filepath.Join(XDC.Datadir, "keystore"))
@@ -146,7 +146,7 @@ Passphrase: {{.InputLine "foobar"}}
146146

147147
wantMessages := []string{
148148
"Unlocked account",
149-
"=xdcf466859eAD1932D743d622CB74FC058882E8648A",
149+
"=0xf466859eAD1932D743d622CB74FC058882E8648A",
150150
}
151151
for _, m := range wantMessages {
152152
if !strings.Contains(XDC.StderrText(), m) {
@@ -191,8 +191,8 @@ Passphrase: {{.InputLine "foobar"}}
191191

192192
wantMessages := []string{
193193
"Unlocked account",
194-
"=xdc7EF5A6135f1FD6a02593eEdC869c6D41D934aef8",
195-
"=xdc289d485D9771714CCe91D3393D764E1311907ACc",
194+
"=0x7EF5A6135f1FD6a02593eEdC869c6D41D934aef8",
195+
"=0x289d485D9771714CCe91D3393D764E1311907ACc",
196196
}
197197
for _, m := range wantMessages {
198198
if !strings.Contains(XDC.StderrText(), m) {
@@ -211,8 +211,8 @@ func TestUnlockFlagPasswordFile(t *testing.T) {
211211

212212
wantMessages := []string{
213213
"Unlocked account",
214-
"=xdc7EF5A6135f1FD6a02593eEdC869c6D41D934aef8",
215-
"=xdc289d485D9771714CCe91D3393D764E1311907ACc",
214+
"=0x7EF5A6135f1FD6a02593eEdC869c6D41D934aef8",
215+
"=0x289d485D9771714CCe91D3393D764E1311907ACc",
216216
}
217217
for _, m := range wantMessages {
218218
if !strings.Contains(XDC.StderrText(), m) {
@@ -261,7 +261,7 @@ In order to avoid this warning, you need to remove the following duplicate key f
261261

262262
wantMessages := []string{
263263
"Unlocked account",
264-
"=xdcf466859eAD1932D743d622CB74FC058882E8648A",
264+
"=0xf466859eAD1932D743d622CB74FC058882E8648A",
265265
}
266266
for _, m := range wantMessages {
267267
if !strings.Contains(XDC.StderrText(), m) {

cmd/XDC/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
165165
common.TIPXDCXCancellationFee = common.TIPXDCXCancellationFeeTestnet
166166
}
167167

168-
if ctx.GlobalBool(utils.Enable0xPrefixFlag.Name) {
169-
common.Enable0xPrefix = true
170-
}
171-
172168
// Rewound
173169
if rewound := ctx.GlobalInt(utils.RewoundFlag.Name); rewound != 0 {
174170
common.Rewound = uint64(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,
@@ -73,7 +73,7 @@ at block: 0 ({{niltime}})
7373
// Tests that a console can be attached to a running node via various means.
7474
func TestIPCAttachWelcome(t *testing.T) {
7575
// Configure the instance for IPC attachement
76-
coinbase := "xdc8605cdbbdb6d264aa742e77020dcbc58fcdce182"
76+
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
7777
var ipc string
7878
if runtime.GOOS == "windows" {
7979
ipc = `\\.\pipe\XDC` + strconv.Itoa(trulyRandInt(100000, 999999))
@@ -95,7 +95,7 @@ func TestIPCAttachWelcome(t *testing.T) {
9595
}
9696

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

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

116116
XDC := runXDC(t,

cmd/XDC/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ var (
112112
//utils.TestnetFlag,
113113
//utils.VMEnableDebugFlag,
114114
utils.XDCTestnetFlag,
115-
utils.Enable0xPrefixFlag,
116115
utils.RewoundFlag,
117116
utils.NetworkIdFlag,
118117
utils.RPCCORSDomainFlag,

cmd/ethkey/message_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestMessageSignVerify(t *testing.T) {
4040
Passphrase: {{.InputLine "foobar"}}
4141
Repeat passphrase: {{.InputLine "foobar"}}
4242
`)
43-
_, matches := generate.ExpectRegexp(`Address: (xdc[0-9a-fA-F]{40})\n`)
43+
_, matches := generate.ExpectRegexp(`Address: (0x[0-9a-fA-F]{40})\n`)
4444
address := matches[1]
4545
generate.ExpectExit()
4646

@@ -59,7 +59,7 @@ Passphrase: {{.InputLine "foobar"}}
5959
_, matches = verify.ExpectRegexp(`
6060
Signature verification successful!
6161
Recovered public key: [0-9a-f]+
62-
Recovered address: (xdc[0-9a-fA-F]{40})
62+
Recovered address: (0x[0-9a-fA-F]{40})
6363
`)
6464
recovered := matches[1]
6565
verify.ExpectExit()

cmd/puppeth/wizard.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func (w *wizard) readPassword() string {
246246
func (w *wizard) readAddress() *common.Address {
247247
for {
248248
// Read the address from the user
249-
fmt.Printf("> xdc")
249+
fmt.Printf("> 0x")
250250
text, err := w.in.ReadString('\n')
251251
if err != nil {
252252
log.Crit("Failed to read user input", "err", err)
@@ -271,7 +271,7 @@ func (w *wizard) readAddress() *common.Address {
271271
func (w *wizard) readDefaultAddress(def common.Address) common.Address {
272272
for {
273273
// Read the address from the user
274-
fmt.Printf("> xdc")
274+
fmt.Printf("> 0x")
275275
text, err := w.in.ReadString('\n')
276276
if err != nil {
277277
log.Crit("Failed to read user input", "err", err)

cmd/utils/flags.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ var (
116116
Usage: "Rollback chain at hash",
117117
Value: "",
118118
}
119-
Enable0xPrefixFlag = cli.BoolFlag{
120-
Name: "enable-0x-prefix",
121-
Usage: "Addres use 0x-prefix (default = false)",
122-
}
123119
// General settings
124120
AnnounceTxsFlag = cli.BoolFlag{
125121
Name: "announce-txs",

common/constants.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ var TIPXDCXCancellationFeeTestnet = big.NewInt(0)
4343

4444
var TIPXDCXTestnet = big.NewInt(0)
4545
var IsTestnet bool = false
46-
var Enable0xPrefix bool = false
4746
var StoreRewardFolder string
4847
var RollbackHash Hash
4948
var BasePrice = big.NewInt(1000000000000000000) // 1

0 commit comments

Comments
 (0)