all: rename ChainId to ChainID #16853 (#1456)

Co-authored-by: wit <wit765765346@gmail>
This commit is contained in:
wit765 2025-09-09 22:54:34 +08:00 committed by GitHub
parent 4e234f231a
commit 12eab8e785
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 71 additions and 71 deletions

View file

@ -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

View file

@ -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

View file

@ -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()

View file

@ -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")

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)
@ -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
@ -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),
@ -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,
@ -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,

View file

@ -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),
@ -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),

View file

@ -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,

View file

@ -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{}

View file

@ -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
}

View file

@ -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,

View file

@ -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),

View file

@ -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())
}

View file

@ -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)

View file

@ -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,

View file

@ -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 (

View file

@ -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,

View file

@ -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 {

View file

@ -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)

View file

@ -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,

View file

@ -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

View file

@ -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)
}

View file

@ -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,

View file

@ -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),

View file

@ -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),