diff --git a/cmd/XDC/chaincmd.go b/cmd/XDC/chaincmd.go index 9d8a795e4b7b..bd4d49752c70 100644 --- a/cmd/XDC/chaincmd.go +++ b/cmd/XDC/chaincmd.go @@ -183,8 +183,8 @@ func initGenesis(ctx *cli.Context) error { utils.Fatalf("invalid genesis json: %v", err) } - if genesis.Config.ChainId != nil { - common.CopyConstants(genesis.Config.ChainId.Uint64()) + if genesis.Config.ChainID != nil { + common.CopyConstants(genesis.Config.ChainID.Uint64()) } // Open and initialise both full and light databases diff --git a/cmd/puppeth/genesis.go b/cmd/puppeth/genesis.go index a27891ced0e9..79d091b828cf 100644 --- a/cmd/puppeth/genesis.go +++ b/cmd/puppeth/genesis.go @@ -104,8 +104,8 @@ func newCppEthereumGenesisSpec(network string, genesis *core.Genesis) (*cppEther spec.Params.ByzantiumForkBlock = (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()) spec.Params.ConstantinopleForkBlock = (hexutil.Uint64)(math.MaxUint64) - spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainId.Uint64()) - spec.Params.ChainID = (hexutil.Uint64)(genesis.Config.ChainId.Uint64()) + spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64()) + spec.Params.ChainID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64()) spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize) spec.Params.MinGasLimit = (hexutil.Uint64)(params.MinGasLimit) @@ -285,7 +285,7 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize) spec.Params.MinGasLimit = (hexutil.Uint64)(params.MinGasLimit) spec.Params.GasLimitBoundDivisor = (hexutil.Uint64)(params.GasLimitBoundDivisor) - spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainId.Uint64()) + spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64()) spec.Params.MaxCodeSize = params.MaxCodeSize spec.Params.EIP155Transition = genesis.Config.EIP155Block.Uint64() spec.Params.EIP98Transition = math.MaxUint64 diff --git a/cmd/puppeth/wizard_faucet.go b/cmd/puppeth/wizard_faucet.go index e449067e49aa..7813f13fe2ce 100644 --- a/cmd/puppeth/wizard_faucet.go +++ b/cmd/puppeth/wizard_faucet.go @@ -49,7 +49,7 @@ func (w *wizard) deployFaucet() { existed := err == nil infos.node.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ") - infos.node.network = w.conf.Genesis.Config.ChainId.Int64() + infos.node.network = w.conf.Genesis.Config.ChainID.Int64() // Figure out which port to listen on fmt.Println() diff --git a/cmd/puppeth/wizard_genesis.go b/cmd/puppeth/wizard_genesis.go index e2dbdbc62335..1fa7c2fafe78 100644 --- a/cmd/puppeth/wizard_genesis.go +++ b/cmd/puppeth/wizard_genesis.go @@ -370,7 +370,7 @@ func (w *wizard) makeGenesis() { // Query the user for some custom extras fmt.Println() fmt.Println("Specify your chain/network ID if you want an explicit one (default = random)") - genesis.Config.ChainId = new(big.Int).SetUint64(uint64(w.readDefaultInt(rand.Intn(65536)))) + genesis.Config.ChainID = new(big.Int).SetUint64(uint64(w.readDefaultInt(rand.Intn(65536)))) // All done, store the genesis and flush to disk log.Info("Configured new genesis block") diff --git a/cmd/puppeth/wizard_node.go b/cmd/puppeth/wizard_node.go index a1d4d12722d0..cd2c0605dc03 100644 --- a/cmd/puppeth/wizard_node.go +++ b/cmd/puppeth/wizard_node.go @@ -56,7 +56,7 @@ func (w *wizard) deployNode(boot bool) { existed := err == nil infos.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ") - infos.network = w.conf.Genesis.Config.ChainId.Int64() + infos.network = w.conf.Genesis.Config.ChainID.Int64() // Figure out where the user wants to store the persistent data fmt.Println() diff --git a/cmd/puppeth/wizard_wallet.go b/cmd/puppeth/wizard_wallet.go index fa634945a07d..934f79630110 100644 --- a/cmd/puppeth/wizard_wallet.go +++ b/cmd/puppeth/wizard_wallet.go @@ -52,7 +52,7 @@ func (w *wizard) deployWallet() { existed := err == nil infos.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ") - infos.network = w.conf.Genesis.Config.ChainId.Int64() + infos.network = w.conf.Genesis.Config.ChainID.Int64() // Figure out which port to listen on fmt.Println() diff --git a/consensus/XDPoS/api.go b/consensus/XDPoS/api.go index b951f35f2692..59232fae8ce7 100644 --- a/consensus/XDPoS/api.go +++ b/consensus/XDPoS/api.go @@ -338,7 +338,7 @@ func (api *API) GetV2BlockByHash(blockHash common.Hash) *V2BlockInfo { func (api *API) NetworkInformation() NetworkInformation { info := NetworkInformation{} - info.NetworkId = api.chain.Config().ChainId + info.NetworkId = api.chain.Config().ChainID info.XDCValidatorAddress = common.MasternodeVotingSMCBinary info.LendingAddress = common.LendingRegistrationSMC info.RelayerRegistrationAddress = common.RelayerRegistrationSMC diff --git a/contracts/utils.go b/contracts/utils.go index 75c37e59e596..2f6f718bfdbc 100644 --- a/contracts/utils.go +++ b/contracts/utils.go @@ -87,7 +87,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool, // Create and send tx to smart contract for sign validate block. nonce := pool.Nonce(account.Address) tx := CreateTxSign(block.Number(), block.Hash(), nonce, common.BlockSignersBinary) - txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId) + txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainID) if err != nil { log.Error("Fail to create tx sign", "error", err) return err @@ -116,7 +116,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool, log.Error("Fail to get tx opening for randomize", "error", err) return err } - txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId) + txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainID) if err != nil { log.Error("Fail to create tx secret", "error", err) return err @@ -145,7 +145,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool, log.Error("Fail to get tx opening for randomize", "error", err) return err } - txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainId) + txSigned, err := wallet.SignTx(account, tx, chainConfig.ChainID) if err != nil { log.Error("Fail to create tx opening", "error", err) return err diff --git a/core/blockchain.go b/core/blockchain.go index b0c67291cd5c..145f49583bdd 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -289,7 +289,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par bc.currentFastBlock.Store(nilBlock) // Update chain info data metrics - chainInfoGauge.Update(metrics.GaugeInfoValue{"chain_id": bc.chainConfig.ChainId.String()}) + chainInfoGauge.Update(metrics.GaugeInfoValue{"chain_id": bc.chainConfig.ChainID.String()}) if err := bc.loadLastState(); err != nil { return nil, err diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 319394124a5c..a0d39d8d7a38 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -1058,7 +1058,7 @@ func TestEIP155Transition(t *testing.T) { funds = big.NewInt(1000000000) deleteAddr = common.Address{1} gspec = &Genesis{ - Config: ¶ms.ChainConfig{ChainId: big.NewInt(1), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)}, + Config: ¶ms.ChainConfig{ChainID: big.NewInt(1), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)}, Alloc: types.GenesisAlloc{address: {Balance: funds}, deleteAddr: {Balance: new(big.Int)}}, } genesis = gspec.MustCommit(db) @@ -1129,7 +1129,7 @@ func TestEIP155Transition(t *testing.T) { } // generate an invalid chain id transaction - config := ¶ms.ChainConfig{ChainId: big.NewInt(2), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)} + config := ¶ms.ChainConfig{ChainID: big.NewInt(2), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)} blocks, _ = GenerateChain(config, blocks[len(blocks)-1], ethash.NewFaker(), db, 4, func(i int, block *BlockGen) { var ( tx *types.Transaction @@ -1162,7 +1162,7 @@ func TestEIP161AccountRemoval(t *testing.T) { theAddr = common.Address{1} gspec = &Genesis{ Config: ¶ms.ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: new(big.Int), EIP155Block: new(big.Int), EIP158Block: big.NewInt(2), @@ -1600,7 +1600,7 @@ func TestEIP2718Transition(t *testing.T) { funds = big.NewInt(1000000000000000) gspec = &Genesis{ Config: ¶ms.ChainConfig{ - ChainId: new(big.Int).SetBytes([]byte("eip1559")), + ChainID: new(big.Int).SetBytes([]byte("eip1559")), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: true, @@ -1637,7 +1637,7 @@ func TestEIP2718Transition(t *testing.T) { // One transaction to 0xAAAA signer := types.LatestSigner(gspec.Config) tx, _ := types.SignNewTx(key, signer, &types.AccessListTx{ - ChainID: gspec.Config.ChainId, + ChainID: gspec.Config.ChainID, Nonce: 0, To: &aa, Gas: 30000, @@ -1826,7 +1826,7 @@ func TestEIP3651(t *testing.T) { b.SetCoinbase(aa) // One transaction to Coinbase txdata := &types.DynamicFeeTx{ - ChainID: gspec.Config.ChainId, + ChainID: gspec.Config.ChainID, Nonce: 0, To: &bb, Gas: 500000, diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 061b4dc9a21c..7e43791c3042 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -39,7 +39,7 @@ import ( func TestStateProcessorErrors(t *testing.T) { var ( config = ¶ms.ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), @@ -204,7 +204,7 @@ func TestStateProcessorErrors(t *testing.T) { db = rawdb.NewMemoryDatabase() gspec = &Genesis{ Config: ¶ms.ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), diff --git a/core/txpool/txpool_test.go b/core/txpool/txpool_test.go index 373888c780aa..e0d9d89a4ee5 100644 --- a/core/txpool/txpool_test.go +++ b/core/txpool/txpool_test.go @@ -117,8 +117,8 @@ func pricedDataTransaction(nonce uint64, gaslimit uint64, gasprice *big.Int, key } func dynamicFeeTx(nonce uint64, gaslimit uint64, gasFee *big.Int, tip *big.Int, key *ecdsa.PrivateKey) *types.Transaction { - tx, _ := types.SignNewTx(key, types.LatestSignerForChainID(params.TestChainConfig.ChainId), &types.DynamicFeeTx{ - ChainID: params.TestChainConfig.ChainId, + tx, _ := types.SignNewTx(key, types.LatestSignerForChainID(params.TestChainConfig.ChainID), &types.DynamicFeeTx{ + ChainID: params.TestChainConfig.ChainID, Nonce: nonce, GasTipCap: tip, GasFeeCap: gasFee, diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index ff8c4b530ada..236bf77f8566 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -42,9 +42,9 @@ func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer { var signer Signer switch { case config.IsEIP1559(blockNumber): - signer = NewLondonSigner(config.ChainId) + signer = NewLondonSigner(config.ChainID) case config.IsEIP155(blockNumber): - signer = NewEIP155Signer(config.ChainId) + signer = NewEIP155Signer(config.ChainID) case config.IsHomestead(blockNumber): signer = HomesteadSigner{} default: @@ -61,12 +61,12 @@ func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer { // Use this in transaction-handling code where the current block number is unknown. If you // have the current block number available, use MakeSigner instead. func LatestSigner(config *params.ChainConfig) Signer { - if config.ChainId != nil { + if config.ChainID != nil { if common.Eip1559Block.Uint64() != 9999999999 || config.Eip1559Block != nil { - return NewLondonSigner(config.ChainId) + return NewLondonSigner(config.ChainID) } if config.EIP155Block != nil { - return NewEIP155Signer(config.ChainId) + return NewEIP155Signer(config.ChainID) } } return HomesteadSigner{} diff --git a/core/vm/eips.go b/core/vm/eips.go index afa8c37b0635..5715ba4a59ef 100644 --- a/core/vm/eips.go +++ b/core/vm/eips.go @@ -90,7 +90,7 @@ func enable1344(jt *JumpTable) { // opChainID implements CHAINID opcode func opChainID(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { - chainId, _ := uint256.FromBig(interpreter.evm.chainConfig.ChainId) + chainId, _ := uint256.FromBig(interpreter.evm.chainConfig.ChainID) scope.Stack.push(chainId) return nil, nil } diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index e816c0b57c79..5c98c3048f27 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -54,7 +54,7 @@ type Config struct { func setDefaults(cfg *Config) { if cfg.ChainConfig == nil { cfg.ChainConfig = ¶ms.ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: new(big.Int), DAOForkBlock: new(big.Int), DAOForkSupport: false, diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go index f1710ec0ef52..80639f87a3b5 100644 --- a/core/vm/runtime/runtime_test.go +++ b/core/vm/runtime/runtime_test.go @@ -177,7 +177,7 @@ func benchmarkEVM_Create(bench *testing.B, code string) { Coinbase: common.Address{}, BlockNumber: new(big.Int).SetUint64(1), ChainConfig: ¶ms.ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: new(big.Int), ByzantiumBlock: new(big.Int), ConstantinopleBlock: new(big.Int), diff --git a/eth/api.go b/eth/api.go index d6515c945b45..bbe038a8505d 100644 --- a/eth/api.go +++ b/eth/api.go @@ -530,7 +530,7 @@ func (api *DebugAPI) getModifiedAccounts(startBlock, endBlock *types.Block) ([]c func (api *EthereumAPI) ChainId() hexutil.Uint64 { chainID := new(big.Int) if config := api.e.chainConfig; config.IsEIP155(api.e.blockchain.CurrentBlock().Number()) { - chainID = config.ChainId + chainID = config.ChainID } return (hexutil.Uint64)(chainID.Uint64()) } diff --git a/eth/backend.go b/eth/backend.go index 7b48e0c8dcd7..cbe025d7e90c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -124,7 +124,7 @@ func New(stack *node.Node, config *ethconfig.Config, XDCXServ *XDCx.XDCX, lendin networkID := config.NetworkId if networkID == 0 { - networkID = chainConfig.ChainId.Uint64() + networkID = chainConfig.ChainID.Uint64() } common.CopyConstants(networkID) diff --git a/eth/gasprice/gasprice_test.go b/eth/gasprice/gasprice_test.go index e6ac77a07681..69a2b9a0ac17 100644 --- a/eth/gasprice/gasprice_test.go +++ b/eth/gasprice/gasprice_test.go @@ -131,7 +131,7 @@ func newTestBackend(t *testing.T, eip1559Block *big.Int, pending bool) *testBack var txdata types.TxData if eip1559Block != nil && b.Number().Cmp(eip1559Block) >= 0 { txdata = &types.DynamicFeeTx{ - ChainID: gspec.Config.ChainId, + ChainID: gspec.Config.ChainID, Nonce: b.TxNonce(addr), To: &common.Address{}, Gas: 30000, diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 792b86d45994..59a893f01ffb 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -820,7 +820,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc config.BlockOverrides.Apply(&vmctx) } // Execute the trace - if err := args.CallDefaults(api.backend.RPCGasCap(), vmctx.BaseFee, api.backend.ChainConfig().ChainId); err != nil { + if err := args.CallDefaults(api.backend.RPCGasCap(), vmctx.BaseFee, api.backend.ChainConfig().ChainID); err != nil { return nil, err } var ( diff --git a/eth/tracers/js/tracer_test.go b/eth/tracers/js/tracer_test.go index 6c57557dbd65..feb67c933da5 100644 --- a/eth/tracers/js/tracer_test.go +++ b/eth/tracers/js/tracer_test.go @@ -233,7 +233,7 @@ func TestNoStepExec(t *testing.T) { func TestIsPrecompile(t *testing.T) { chaincfg := ¶ms.ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: false, diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 0f001e24a722..72301b5e2f1b 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -309,7 +309,7 @@ func NewBlockChainAPI(b Backend, chainReader consensus.ChainReader) *BlockChainA // ChainId returns the chainID value for transaction replay protection. func (s *BlockChainAPI) ChainId() *hexutil.Big { - return (*hexutil.Big)(s.b.ChainConfig().ChainId) + return (*hexutil.Big)(s.b.ChainConfig().ChainID) } // BlockNumber returns the block number of the chain head. @@ -1159,7 +1159,7 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash if blockOverrides != nil { blockOverrides.Apply(&blockCtx) } - if err := args.CallDefaults(globalGasCap, blockCtx.BaseFee, b.ChainConfig().ChainId); err != nil { + if err := args.CallDefaults(globalGasCap, blockCtx.BaseFee, b.ChainConfig().ChainID); err != nil { return nil, err } msg := args.ToMessage(b, blockCtx.BaseFee) @@ -2029,7 +2029,7 @@ func (s *TransactionAPI) sign(addr common.Address, tx *types.Transaction) (*type // Request the wallet to sign the transaction var chainID *big.Int if config := s.b.ChainConfig(); config.IsEIP155(s.b.CurrentBlock().Number()) { - chainID = config.ChainId + chainID = config.ChainID } return wallet.SignTx(account, tx, chainID) } @@ -2115,7 +2115,7 @@ func (s *TransactionAPI) SendTransaction(ctx context.Context, args TransactionAr var chainID *big.Int if config := s.b.ChainConfig(); config.IsEIP155(s.b.CurrentBlock().Number()) { - chainID = config.ChainId + chainID = config.ChainID } signed, err := wallet.SignTx(account, tx, chainID) if err != nil { diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index 1cb901740d87..b62574fd1f7b 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -130,7 +130,7 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend, skipGas // If chain id is provided, ensure it matches the local chain id. Otherwise, set the local // chain id as the default. - want := b.ChainConfig().ChainId + want := b.ChainConfig().ChainID if args.ChainID != nil { if have := (*big.Int)(args.ChainID); have.Cmp(want) != 0 { return fmt.Errorf("chainId does not match node's (have=%v, want=%v)", have, want) diff --git a/internal/ethapi/transaction_args_test.go b/internal/ethapi/transaction_args_test.go index edb22b69a859..56e6cd2df4c1 100644 --- a/internal/ethapi/transaction_args_test.go +++ b/internal/ethapi/transaction_args_test.go @@ -241,7 +241,7 @@ type backendMock struct { func newBackendMock() *backendMock { config := ¶ms.ChainConfig{ - ChainId: big.NewInt(42), + ChainID: big.NewInt(42), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: true, diff --git a/miner/worker.go b/miner/worker.go index 8b6ca93d4d15..99114f042530 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -780,7 +780,7 @@ func (w *worker) commitNewWork() { } nonce := work.state.GetNonce(w.coinbase) tx := types.NewTransaction(nonce, common.XDCXAddrBinary, big.NewInt(0), txMatchGasLimit, big.NewInt(0), txMatchBytes) - txM, err := wallet.SignTx(accounts.Account{Address: w.coinbase}, tx, w.config.ChainId) + txM, err := wallet.SignTx(accounts.Account{Address: w.coinbase}, tx, w.config.ChainID) if err != nil { log.Error("Fail to create tx matches", "error", err) return @@ -810,7 +810,7 @@ func (w *worker) commitNewWork() { } nonce := work.state.GetNonce(w.coinbase) lendingTx := types.NewTransaction(nonce, common.XDCXLendingAddressBinary, big.NewInt(0), txMatchGasLimit, big.NewInt(0), lendingDataBytes) - signedLendingTx, err := wallet.SignTx(accounts.Account{Address: w.coinbase}, lendingTx, w.config.ChainId) + signedLendingTx, err := wallet.SignTx(accounts.Account{Address: w.coinbase}, lendingTx, w.config.ChainID) if err != nil { log.Error("Fail to create lending tx", "error", err) return @@ -834,7 +834,7 @@ func (w *worker) commitNewWork() { } nonce := work.state.GetNonce(w.coinbase) finalizedTx := types.NewTransaction(nonce, common.XDCXLendingFinalizedTradeAddressBinary, big.NewInt(0), txMatchGasLimit, big.NewInt(0), finalizedTradeData) - signedFinalizedTx, err := wallet.SignTx(accounts.Account{Address: w.coinbase}, finalizedTx, w.config.ChainId) + signedFinalizedTx, err := wallet.SignTx(accounts.Account{Address: w.coinbase}, finalizedTx, w.config.ChainID) if err != nil { log.Error("Fail to create lending tx", "error", err) return @@ -853,7 +853,7 @@ func (w *worker) commitNewWork() { LendingStateRoot := work.lendingState.IntermediateRoot() txData := append(XDCxStateRoot.Bytes(), LendingStateRoot.Bytes()...) tx := types.NewTransaction(work.state.GetNonce(w.coinbase), common.TradingStateAddrBinary, big.NewInt(0), txMatchGasLimit, big.NewInt(0), txData) - txStateRoot, err := wallet.SignTx(accounts.Account{Address: w.coinbase}, tx, w.config.ChainId) + txStateRoot, err := wallet.SignTx(accounts.Account{Address: w.coinbase}, tx, w.config.ChainID) if err != nil { log.Error("Fail to create tx state root", "error", err) return diff --git a/params/config.go b/params/config.go index a43db22748d4..af924d9ab8eb 100644 --- a/params/config.go +++ b/params/config.go @@ -224,7 +224,7 @@ var ( // XDPoSChain mainnet config XDCMainnetChainConfig = &ChainConfig{ - ChainId: big.NewInt(50), + ChainID: big.NewInt(50), HomesteadBlock: big.NewInt(1), EIP150Block: big.NewInt(2), EIP155Block: big.NewInt(3), @@ -248,7 +248,7 @@ var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(1150000), DAOForkBlock: big.NewInt(1920000), DAOForkSupport: true, @@ -262,7 +262,7 @@ var ( // TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network. TestnetChainConfig = &ChainConfig{ - ChainId: big.NewInt(51), + ChainID: big.NewInt(51), HomesteadBlock: big.NewInt(1), DAOForkBlock: nil, DAOForkSupport: false, @@ -289,7 +289,7 @@ var ( // DevnetChainConfig contains the chain parameters to run a node on the Ropsten test network. DevnetChainConfig = &ChainConfig{ - ChainId: big.NewInt(551), + ChainID: big.NewInt(551), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), @@ -317,7 +317,7 @@ var ( // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. AllEthashProtocolChanges = &ChainConfig{ - ChainId: big.NewInt(1337), + ChainID: big.NewInt(1337), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: false, @@ -337,7 +337,7 @@ var ( // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. AllXDPoSProtocolChanges = &ChainConfig{ - ChainId: big.NewInt(89), + ChainID: big.NewInt(89), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: false, @@ -352,7 +352,7 @@ var ( } AllCliqueProtocolChanges = &ChainConfig{ - ChainId: big.NewInt(1337), + ChainID: big.NewInt(1337), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: false, @@ -368,7 +368,7 @@ var ( // XDPoS config with v2 engine after block 901 TestXDPoSMockChainConfig = &ChainConfig{ - ChainId: big.NewInt(1337), + ChainID: big.NewInt(1337), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: false, @@ -395,7 +395,7 @@ var ( } TestChainConfig = &ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: false, @@ -417,7 +417,7 @@ var ( // that any network, identified by its genesis block, can have its own // set of configuration options. type ChainConfig struct { - ChainId *big.Int `json:"chainId"` // Chain id identifies the current chain and is used for replay protection + ChainID *big.Int `json:"chainId"` // Chain id identifies the current chain and is used for replay protection HomesteadBlock *big.Int `json:"homesteadBlock,omitempty"` // Homestead switch block (nil = no fork, 0 = already homestead) @@ -676,7 +676,7 @@ func (c *ChainConfig) Description() string { } var banner = "Chain configuration:\n" - banner += fmt.Sprintf(" - ChainID: %-8v\n", c.ChainId) + banner += fmt.Sprintf(" - ChainID: %-8v\n", c.ChainID) banner += fmt.Sprintf(" - Homestead: %-8v\n", c.HomesteadBlock) banner += fmt.Sprintf(" - DAO Fork: %-8v\n", c.DAOForkBlock) banner += fmt.Sprintf(" - DAO Support: %-8v\n", c.DAOForkSupport) @@ -880,7 +880,7 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi if isForkIncompatible(c.EIP158Block, newcfg.EIP158Block, head) { return newCompatError("EIP158 fork block", c.EIP158Block, newcfg.EIP158Block) } - if c.IsEIP158(head) && !configNumEqual(c.ChainId, newcfg.ChainId) { + if c.IsEIP158(head) && !configNumEqual(c.ChainID, newcfg.ChainID) { return newCompatError("EIP158 chain ID", c.EIP158Block, newcfg.EIP158Block) } if isForkIncompatible(c.ByzantiumBlock, newcfg.ByzantiumBlock, head) { @@ -986,7 +986,7 @@ type Rules struct { } func (c *ChainConfig) Rules(num *big.Int) Rules { - chainId := c.ChainId + chainId := c.ChainID if chainId == nil { chainId = new(big.Int) } diff --git a/tests/difficulty_test.go b/tests/difficulty_test.go index ee652ffe7239..f2b062d48c06 100644 --- a/tests/difficulty_test.go +++ b/tests/difficulty_test.go @@ -25,7 +25,7 @@ import ( var ( mainnetChainConfig = params.ChainConfig{ - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(1150000), DAOForkBlock: big.NewInt(1920000), DAOForkSupport: true, diff --git a/tests/init.go b/tests/init.go index 058d6a128485..8177772aff38 100644 --- a/tests/init.go +++ b/tests/init.go @@ -26,26 +26,26 @@ import ( // This table defines supported forks and their chain config. var Forks = map[string]*params.ChainConfig{ "Frontier": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), }, "Homestead": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), }, "EIP150": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), }, "EIP158": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), }, "Byzantium": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), @@ -54,22 +54,22 @@ var Forks = map[string]*params.ChainConfig{ ByzantiumBlock: big.NewInt(0), }, "FrontierToHomesteadAt5": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(5), }, "HomesteadToEIP150At5": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(5), }, "HomesteadToDaoAt5": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), DAOForkBlock: big.NewInt(5), DAOForkSupport: true, }, "EIP158ToByzantiumAt5": { - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), diff --git a/tests/transaction_test.go b/tests/transaction_test.go index 7007944cf6f2..494181c0ddf2 100644 --- a/tests/transaction_test.go +++ b/tests/transaction_test.go @@ -35,7 +35,7 @@ func TestTransaction(t *testing.T) { EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), - ChainId: big.NewInt(1), + ChainID: big.NewInt(1), }) txt.config(`^Byzantium/`, params.ChainConfig{ HomesteadBlock: big.NewInt(0),