Skip to content

Commit 7dda01c

Browse files
author
wit
committed
all: rename ChainId to ChainID ethereum#16853
1 parent 241ad1d commit 7dda01c

28 files changed

+69
-69
lines changed

cmd/XDC/chaincmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ func initGenesis(ctx *cli.Context) error {
181181
utils.Fatalf("invalid genesis json: %v", err)
182182
}
183183

184-
if genesis.Config.ChainId != nil {
185-
common.CopyConstants(genesis.Config.ChainId.Uint64())
184+
if genesis.Config.ChainID != nil {
185+
common.CopyConstants(genesis.Config.ChainID.Uint64())
186186
}
187187

188188
// Open and initialise both full and light databases

cmd/puppeth/genesis.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ func newCppEthereumGenesisSpec(network string, genesis *core.Genesis) (*cppEther
104104
spec.Params.ByzantiumForkBlock = (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64())
105105
spec.Params.ConstantinopleForkBlock = (hexutil.Uint64)(math.MaxUint64)
106106

107-
spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainId.Uint64())
108-
spec.Params.ChainID = (hexutil.Uint64)(genesis.Config.ChainId.Uint64())
107+
spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
108+
spec.Params.ChainID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
109109

110110
spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize)
111111
spec.Params.MinGasLimit = (hexutil.Uint64)(params.MinGasLimit)
@@ -285,7 +285,7 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
285285
spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize)
286286
spec.Params.MinGasLimit = (hexutil.Uint64)(params.MinGasLimit)
287287
spec.Params.GasLimitBoundDivisor = (hexutil.Uint64)(params.GasLimitBoundDivisor)
288-
spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainId.Uint64())
288+
spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
289289
spec.Params.MaxCodeSize = params.MaxCodeSize
290290
spec.Params.EIP155Transition = genesis.Config.EIP155Block.Uint64()
291291
spec.Params.EIP98Transition = math.MaxUint64

cmd/puppeth/wizard_faucet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (w *wizard) deployFaucet() {
4949
existed := err == nil
5050

5151
infos.node.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ")
52-
infos.node.network = w.conf.Genesis.Config.ChainId.Int64()
52+
infos.node.network = w.conf.Genesis.Config.ChainID.Int64()
5353

5454
// Figure out which port to listen on
5555
fmt.Println()

cmd/puppeth/wizard_genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ func (w *wizard) makeGenesis() {
370370
// Query the user for some custom extras
371371
fmt.Println()
372372
fmt.Println("Specify your chain/network ID if you want an explicit one (default = random)")
373-
genesis.Config.ChainId = new(big.Int).SetUint64(uint64(w.readDefaultInt(rand.Intn(65536))))
373+
genesis.Config.ChainID = new(big.Int).SetUint64(uint64(w.readDefaultInt(rand.Intn(65536))))
374374

375375
// All done, store the genesis and flush to disk
376376
log.Info("Configured new genesis block")

cmd/puppeth/wizard_node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (w *wizard) deployNode(boot bool) {
5656
existed := err == nil
5757

5858
infos.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ")
59-
infos.network = w.conf.Genesis.Config.ChainId.Int64()
59+
infos.network = w.conf.Genesis.Config.ChainID.Int64()
6060

6161
// Figure out where the user wants to store the persistent data
6262
fmt.Println()

cmd/puppeth/wizard_wallet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (w *wizard) deployWallet() {
5252
existed := err == nil
5353

5454
infos.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ")
55-
infos.network = w.conf.Genesis.Config.ChainId.Int64()
55+
infos.network = w.conf.Genesis.Config.ChainID.Int64()
5656

5757
// Figure out which port to listen on
5858
fmt.Println()

consensus/XDPoS/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func (api *API) GetV2BlockByHash(blockHash common.Hash) *V2BlockInfo {
338338

339339
func (api *API) NetworkInformation() NetworkInformation {
340340
info := NetworkInformation{}
341-
info.NetworkId = api.chain.Config().ChainId
341+
info.NetworkId = api.chain.Config().ChainID
342342
info.XDCValidatorAddress = common.MasternodeVotingSMCBinary
343343
info.LendingAddress = common.LendingRegistrationSMC
344344
info.RelayerRegistrationAddress = common.RelayerRegistrationSMC

contracts/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool,
8787
// Create and send tx to smart contract for sign validate block.
8888
nonce := pool.Nonce(account.Address)
8989
tx := CreateTxSign(block.Number(), block.Hash(), nonce, common.BlockSignersBinary)
90-
txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId)
90+
txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainID)
9191
if err != nil {
9292
log.Error("Fail to create tx sign", "error", err)
9393
return err
@@ -116,7 +116,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool,
116116
log.Error("Fail to get tx opening for randomize", "error", err)
117117
return err
118118
}
119-
txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId)
119+
txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainID)
120120
if err != nil {
121121
log.Error("Fail to create tx secret", "error", err)
122122
return err
@@ -145,7 +145,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool,
145145
log.Error("Fail to get tx opening for randomize", "error", err)
146146
return err
147147
}
148-
txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId)
148+
txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainID)
149149
if err != nil {
150150
log.Error("Fail to create tx opening", "error", err)
151151
return err

core/blockchain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par
286286
bc.currentFastBlock.Store(nilBlock)
287287

288288
// Update chain info data metrics
289-
chainInfoGauge.Update(metrics.GaugeInfoValue{"chain_id": bc.chainConfig.ChainId.String()})
289+
chainInfoGauge.Update(metrics.GaugeInfoValue{"chain_id": bc.chainConfig.ChainID.String()})
290290

291291
if err := bc.loadLastState(); err != nil {
292292
return nil, err

core/blockchain_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ func TestEIP155Transition(t *testing.T) {
10581058
funds = big.NewInt(1000000000)
10591059
deleteAddr = common.Address{1}
10601060
gspec = &Genesis{
1061-
Config: &params.ChainConfig{ChainId: big.NewInt(1), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)},
1061+
Config: &params.ChainConfig{ChainID: big.NewInt(1), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)},
10621062
Alloc: types.GenesisAlloc{address: {Balance: funds}, deleteAddr: {Balance: new(big.Int)}},
10631063
}
10641064
genesis = gspec.MustCommit(db)
@@ -1129,7 +1129,7 @@ func TestEIP155Transition(t *testing.T) {
11291129
}
11301130

11311131
// generate an invalid chain id transaction
1132-
config := &params.ChainConfig{ChainId: big.NewInt(2), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)}
1132+
config := &params.ChainConfig{ChainID: big.NewInt(2), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)}
11331133
blocks, _ = GenerateChain(config, blocks[len(blocks)-1], ethash.NewFaker(), db, 4, func(i int, block *BlockGen) {
11341134
var (
11351135
tx *types.Transaction
@@ -1162,7 +1162,7 @@ func TestEIP161AccountRemoval(t *testing.T) {
11621162
theAddr = common.Address{1}
11631163
gspec = &Genesis{
11641164
Config: &params.ChainConfig{
1165-
ChainId: big.NewInt(1),
1165+
ChainID: big.NewInt(1),
11661166
HomesteadBlock: new(big.Int),
11671167
EIP155Block: new(big.Int),
11681168
EIP158Block: big.NewInt(2),
@@ -1600,7 +1600,7 @@ func TestEIP2718Transition(t *testing.T) {
16001600
funds = big.NewInt(1000000000000000)
16011601
gspec = &Genesis{
16021602
Config: &params.ChainConfig{
1603-
ChainId: new(big.Int).SetBytes([]byte("eip1559")),
1603+
ChainID: new(big.Int).SetBytes([]byte("eip1559")),
16041604
HomesteadBlock: big.NewInt(0),
16051605
DAOForkBlock: nil,
16061606
DAOForkSupport: true,
@@ -1637,7 +1637,7 @@ func TestEIP2718Transition(t *testing.T) {
16371637
// One transaction to 0xAAAA
16381638
signer := types.LatestSigner(gspec.Config)
16391639
tx, _ := types.SignNewTx(key, signer, &types.AccessListTx{
1640-
ChainID: gspec.Config.ChainId,
1640+
ChainID: gspec.Config.ChainID,
16411641
Nonce: 0,
16421642
To: &aa,
16431643
Gas: 30000,
@@ -1826,7 +1826,7 @@ func TestEIP3651(t *testing.T) {
18261826
b.SetCoinbase(aa)
18271827
// One transaction to Coinbase
18281828
txdata := &types.DynamicFeeTx{
1829-
ChainID: gspec.Config.ChainId,
1829+
ChainID: gspec.Config.ChainID,
18301830
Nonce: 0,
18311831
To: &bb,
18321832
Gas: 500000,

0 commit comments

Comments
 (0)