Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/XDC/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cmd/puppeth/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/puppeth/wizard_faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cmd/puppeth/wizard_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion cmd/puppeth/wizard_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cmd/puppeth/wizard_wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion consensus/XDPoS/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions contracts/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions core/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ func TestEIP155Transition(t *testing.T) {
funds = big.NewInt(1000000000)
deleteAddr = common.Address{1}
gspec = &Genesis{
Config: &params.ChainConfig{ChainId: big.NewInt(1), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)},
Config: &params.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)
Expand Down Expand Up @@ -1129,7 +1129,7 @@ func TestEIP155Transition(t *testing.T) {
}

// generate an invalid chain id transaction
config := &params.ChainConfig{ChainId: big.NewInt(2), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)}
config := &params.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
Expand Down Expand Up @@ -1162,7 +1162,7 @@ func TestEIP161AccountRemoval(t *testing.T) {
theAddr = common.Address{1}
gspec = &Genesis{
Config: &params.ChainConfig{
ChainId: big.NewInt(1),
ChainID: big.NewInt(1),
HomesteadBlock: new(big.Int),
EIP155Block: new(big.Int),
EIP158Block: big.NewInt(2),
Expand Down Expand Up @@ -1600,7 +1600,7 @@ func TestEIP2718Transition(t *testing.T) {
funds = big.NewInt(1000000000000000)
gspec = &Genesis{
Config: &params.ChainConfig{
ChainId: new(big.Int).SetBytes([]byte("eip1559")),
ChainID: new(big.Int).SetBytes([]byte("eip1559")),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions core/state_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
func TestStateProcessorErrors(t *testing.T) {
var (
config = &params.ChainConfig{
ChainId: big.NewInt(1),
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestStateProcessorErrors(t *testing.T) {
db = rawdb.NewMemoryDatabase()
gspec = &Genesis{
Config: &params.ChainConfig{
ChainId: big.NewInt(1),
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
Expand Down
4 changes: 2 additions & 2 deletions core/txpool/txpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions core/types/transaction_signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion core/vm/eips.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion core/vm/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Config struct {
func setDefaults(cfg *Config) {
if cfg.ChainConfig == nil {
cfg.ChainConfig = &params.ChainConfig{
ChainId: big.NewInt(1),
ChainID: big.NewInt(1),
HomesteadBlock: new(big.Int),
DAOForkBlock: new(big.Int),
DAOForkSupport: false,
Expand Down
2 changes: 1 addition & 1 deletion core/vm/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func benchmarkEVM_Create(bench *testing.B, code string) {
Coinbase: common.Address{},
BlockNumber: new(big.Int).SetUint64(1),
ChainConfig: &params.ChainConfig{
ChainId: big.NewInt(1),
ChainID: big.NewInt(1),
HomesteadBlock: new(big.Int),
ByzantiumBlock: new(big.Int),
ConstantinopleBlock: new(big.Int),
Expand Down
2 changes: 1 addition & 1 deletion eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion eth/gasprice/gasprice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion eth/tracers/js/tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestNoStepExec(t *testing.T) {

func TestIsPrecompile(t *testing.T) {
chaincfg := &params.ChainConfig{
ChainId: big.NewInt(1),
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
Expand Down
8 changes: 4 additions & 4 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/ethapi/transaction_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/ethapi/transaction_args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ type backendMock struct {

func newBackendMock() *backendMock {
config := &params.ChainConfig{
ChainId: big.NewInt(42),
ChainID: big.NewInt(42),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
Expand Down
8 changes: 4 additions & 4 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading