diff --git a/cmd/state/exec3/historical_trace_worker.go b/cmd/state/exec3/historical_trace_worker.go index eb6775b2992..fbcb14d7653 100644 --- a/cmd/state/exec3/historical_trace_worker.go +++ b/cmd/state/exec3/historical_trace_worker.go @@ -19,11 +19,12 @@ package exec3 import ( "context" "fmt" - "github.com/erigontech/erigon/core/systemcontracts" "sync" "sync/atomic" "time" + "github.com/erigontech/erigon/core/systemcontracts" + "golang.org/x/sync/errgroup" "github.com/erigontech/erigon-lib/chain" @@ -169,8 +170,8 @@ func (rw *HistoricalTraceWorker) RunTxTask(txTask *state.TxTask) { syscall := func(contract common.Address, data []byte, ibs *state.IntraBlockState, header *types.Header, constCall bool) ([]byte, error) { return core.SysCallContract(contract, data, rw.execArgs.ChainConfig, ibs, header, rw.execArgs.Engine, constCall /* constCall */) } - if isPoSA && !rw.execArgs.ChainConfig.IsFeynman(header.Number.Uint64(), header.Time) { - systemcontracts.UpgradeBuildInSystemContract(rw.execArgs.ChainConfig, header.Number, lastBlockTime, header.Time, ibs, rw.logger) + if isPoSA { + systemcontracts.BeginBlockUpgradeBuildInSystemContract(rw.execArgs.ChainConfig, header.Number, lastBlockTime, header.Time, ibs, rw.logger) } if err := rw.execArgs.Engine.Initialize(rw.execArgs.ChainConfig, rw.chain, header, ibs, syscall, rw.logger, nil); err != nil { txTask.Error = err @@ -184,8 +185,8 @@ func (rw *HistoricalTraceWorker) RunTxTask(txTask *state.TxTask) { if _, isPoSa := rw.execArgs.Engine.(consensus.PoSA); isPoSa { // Is an empty block - if rw.execArgs.ChainConfig.IsFeynman(header.Number.Uint64(), header.Time) && txTask.TxIndex == 0 { - systemcontracts.UpgradeBuildInSystemContract(rw.execArgs.ChainConfig, header.Number, lastBlockTime, header.Time, ibs, rw.logger) + if txTask.TxIndex == 0 { + systemcontracts.EndBlockUpgradeBuildInSystemContract(rw.execArgs.ChainConfig, header.Number, lastBlockTime, header.Time, ibs, rw.logger) } break } diff --git a/cmd/state/exec3/state.go b/cmd/state/exec3/state.go index 08c422df037..8d29ec13dc7 100644 --- a/cmd/state/exec3/state.go +++ b/cmd/state/exec3/state.go @@ -18,9 +18,10 @@ package exec3 import ( "context" - "github.com/erigontech/erigon/core/systemcontracts" "sync" + "github.com/erigontech/erigon/core/systemcontracts" + "golang.org/x/sync/errgroup" "github.com/erigontech/erigon-lib/log/v3" @@ -229,8 +230,8 @@ func (rw *Worker) RunTxTaskNoLock(txTask *state.TxTask, isMining bool) { syscall := func(contract libcommon.Address, data []byte, ibs *state.IntraBlockState, header *types.Header, constCall bool) ([]byte, error) { return core.SysCallContract(contract, data, rw.chainConfig, ibs, header, rw.engine, constCall /* constCall */) } - if rw.isPoSA && !rw.chainConfig.IsFeynman(header.Number.Uint64(), header.Time) { - systemcontracts.UpgradeBuildInSystemContract(rw.chainConfig, header.Number, lastBlockTime, header.Time, ibs, rw.logger) + if rw.isPoSA { + systemcontracts.BeginBlockUpgradeBuildInSystemContract(rw.chainConfig, header.Number, lastBlockTime, header.Time, ibs, rw.logger) } if err := rw.engine.Initialize(rw.chainConfig, rw.chain, header, ibs, syscall, rw.logger, nil); err != nil { txTask.Error = err @@ -244,8 +245,8 @@ func (rw *Worker) RunTxTaskNoLock(txTask *state.TxTask, isMining bool) { if _, isPoSa := rw.engine.(consensus.PoSA); isPoSa { // Is an empty block - if rw.chainConfig.IsFeynman(header.Number.Uint64(), header.Time) && txTask.TxIndex == 0 { - systemcontracts.UpgradeBuildInSystemContract(rw.chainConfig, header.Number, lastBlockTime, header.Time, ibs, rw.logger) + if txTask.TxIndex == 0 { + systemcontracts.EndBlockUpgradeBuildInSystemContract(rw.chainConfig, header.Number, lastBlockTime, header.Time, ibs, rw.logger) } break } diff --git a/consensus/misc/eip2935.go b/consensus/misc/eip2935.go index 950b7e10b4d..5c606539129 100644 --- a/consensus/misc/eip2935.go +++ b/consensus/misc/eip2935.go @@ -45,3 +45,11 @@ func storeHash(num uint64, hash libcommon.Hash, state *state.IntraBlockState) { parentHashInt := uint256.NewInt(0).SetBytes32(hash.Bytes()) state.SetState(params.HistoryStorageAddress, &storageSlot, *parentHashInt) } + +func InitializeBlockHashesEip2935(state *state.IntraBlockState) { + if state.GetCodeSize(params.HistoryStorageAddress) != 0 { + return + } + state.SetCode(params.HistoryStorageAddress, params.HistoryStorageCode) + state.SetNonce(params.HistoryStorageAddress, 1) +} diff --git a/consensus/parlia/parlia.go b/consensus/parlia/parlia.go index c0b6a18cb06..ef969dd8c15 100644 --- a/consensus/parlia/parlia.go +++ b/consensus/parlia/parlia.go @@ -977,9 +977,7 @@ func (p *Parlia) finalize(header *types.Header, ibs *state.IntraBlockState, txs }() if curIndex == txIndex { - if p.chainConfig.IsFeynman(header.Number.Uint64(), header.Time) { - systemcontracts.UpgradeBuildInSystemContract(p.chainConfig, header.Number, parentHeader.Time, header.Time, ibs, logger) - } + systemcontracts.EndBlockUpgradeBuildInSystemContract(p.chainConfig, header.Number, parentHeader.Time, header.Time, ibs, logger) } if p.chainConfig.IsOnFeynman(header.Number, parentHeader.Time, header.Time) { diff --git a/core/systemcontracts/upgrade.go b/core/systemcontracts/upgrade.go index 16051b9a437..8652858b9cd 100644 --- a/core/systemcontracts/upgrade.go +++ b/core/systemcontracts/upgrade.go @@ -24,25 +24,11 @@ import ( "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" + "github.com/erigontech/erigon/consensus/misc" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types" ) -type UpgradeConfig struct { - BeforeUpgrade upgradeHook - AfterUpgrade upgradeHook - ContractAddr libcommon.Address - CommitUrl string - Code string -} - -type Upgrade struct { - UpgradeName string - Configs []*UpgradeConfig -} - -type upgradeHook func(blockNumber *big.Int, contractAddr libcommon.Address, statedb *state.IntraBlockState) error - var ( // SystemContractCodeLookup is used to address a flaw in the upgrade logic of the system contracts. Since they are updated directly, without first being self-destructed // and then re-created, the usual incarnation logic does not get activated, and all historical records of the code of these contracts are retrieved as the most @@ -52,7 +38,15 @@ var ( SystemContractCodeLookup = map[string]map[libcommon.Address][]libcommon.CodeRecord{} ) -func UpgradeBuildInSystemContract(config *chain.Config, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, state *state.IntraBlockState, logger log.Logger) { +func BeginBlockUpgradeBuildInSystemContract(config *chain.Config, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, state *state.IntraBlockState, logger log.Logger) { + TryUpgradeBuildInSystemContract(config, blockNumber, lastBlockTime, blockTime, state, logger, false) +} + +func EndBlockUpgradeBuildInSystemContract(config *chain.Config, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, state *state.IntraBlockState, logger log.Logger) { + TryUpgradeBuildInSystemContract(config, blockNumber, lastBlockTime, blockTime, state, logger, true) +} + +func TryUpgradeBuildInSystemContract(config *chain.Config, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, state *state.IntraBlockState, logger log.Logger, endBlock bool) { if config == nil || blockNumber == nil || state == nil { return } @@ -61,6 +55,29 @@ func UpgradeBuildInSystemContract(config *chain.Config, blockNumber *big.Int, la return } + // Everything after Faynman is initialized in the end block + if endBlock { + if config.IsFeynman(blockNumber.Uint64(), lastBlockTime) { + upgradeBuildInSystemContract(config, blockNumber, lastBlockTime, blockTime, state, logger) + } + return + } + + // this will execute in the begin block + + // Everything before Feynman is initialized in the begin block + if !config.IsFeynman(blockNumber.Uint64(), lastBlockTime) { + upgradeBuildInSystemContract(config, blockNumber, lastBlockTime, blockTime, state, logger) + } + + // HistoryStorageAddress is a special system contract in bsc, which can't be upgraded + if config.IsOnPrague(blockNumber, lastBlockTime, blockTime) { + misc.InitializeBlockHashesEip2935(state) + log.Info("Set code for HistoryStorageAddress", "blockNumber", blockNumber.Int64(), "blockTime", blockTime) + } +} + +func upgradeBuildInSystemContract(config *chain.Config, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, state *state.IntraBlockState, logger log.Logger) { for blockNumberOrTime, genesisAlloc := range config.Parlia.BlockAlloc { numOrTime, err := strconv.ParseUint(blockNumberOrTime, 10, 64) if err != nil { diff --git a/erigon-lib/chain/chain_config.go b/erigon-lib/chain/chain_config.go index a69d8d24730..4a39b33cb0d 100644 --- a/erigon-lib/chain/chain_config.go +++ b/erigon-lib/chain/chain_config.go @@ -295,6 +295,15 @@ func (c *Config) IsPrague(time uint64) bool { return isForked(c.PragueTime, time) } +// IsOnPrague returns whether currentBlockTime is either equal to the Prague fork time or greater firstly. +func (c *Config) IsOnPrague(currentBlockNumber *big.Int, lastBlockTime uint64, currentBlockTime uint64) bool { + lastBlockNumber := new(big.Int) + if currentBlockNumber.Cmp(big.NewInt(1)) >= 0 { + lastBlockNumber.Sub(currentBlockNumber, big.NewInt(1)) + } + return !c.IsPrague(lastBlockTime) && c.IsPrague(currentBlockTime) +} + // IsOsaka returns whether time is either equal to the Osaka fork time or greater. func (c *Config) IsOsaka(time uint64) bool { return isForked(c.OsakaTime, time) diff --git a/params/chainspecs/bsc.json b/params/chainspecs/bsc.json index 7e8c8275d60..5288071d116 100644 --- a/params/chainspecs/bsc.json +++ b/params/chainspecs/bsc.json @@ -294,12 +294,6 @@ "balance": "0x0", "code": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80638129fc1c11610097578063b187bd2611610066578063b187bd26146101fc578063bfb5a6a114610207578063e33f8d321461021a578063e842426a1461023d57600080fd5b80638129fc1c146101cc5780638456cb59146101d45780639fcb5012146101dc578063ac431751146101e957600080fd5b80634838d165116100d35780634838d165146101335780634a49ac4c14610166578063572c99801461017957806374be21501461018c57600080fd5b8063046f7da2146100fa5780632eb4a7ab14610104578063417c73a714610120575b600080fd5b610102610268565b005b61010d60685481565b6040519081526020015b60405180910390f35b61010261012e366004611670565b6102f0565b610156610141366004611670565b60346020526000908152604090205460ff1681565b6040519015158152602001610117565b610102610174366004611670565b61036c565b61010261018736600461168b565b6103e5565b6101bf6040518060400160405280601481526020017342696e616e63652d436861696e2d54696772697360601b81525081565b6040516101179190611707565b61010261047b565b6101026105ed565b6069546101569060ff1681565b6101026101f7366004611763565b610679565b60335460ff16610156565b610102610215366004611814565b610a98565b6101566102283660046118ee565b6000908152606a602052604090205460ff1690565b606754610250906001600160a01b031681565b6040516001600160a01b039091168152602001610117565b60335461010090046001600160a01b03163314610298576040516306fbb1e360e01b815260040160405180910390fd5b60335460ff166102bb57604051636cd6020160e01b815260040160405180910390fd5b6033805460ff191690556040517f62451d457bc659158be6e6247f56ec1df424a5c7597f71c20c2bc44e0965c8f990600090a1565b60335461010090046001600160a01b03163314610320576040516306fbb1e360e01b815260040160405180910390fd5b6001600160a01b038116600081815260346020526040808220805460ff19166001179055517f7fd26be6fc92aff63f1f4409b2b2ddeb272a888031d7f55ec830485ec61941869190a250565b60335461010090046001600160a01b0316331461039c576040516306fbb1e360e01b815260040160405180910390fd5b6001600160a01b038116600081815260346020526040808220805460ff19169055517fe0db3499b7fdc3da4cddff5f45d694549c19835e7f719fb5606d3ad1a5de40119190a250565b60335461010090046001600160a01b03163314610415576040516306fbb1e360e01b815260040160405180910390fd5b604051638525db0360e01b8152600481018390526001600160a01b038216602482015261100490638525db0390604401600060405180830381600087803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b505050505050565b600054610100900460ff161580801561049b5750600054600160ff909116105b806104b55750303b1580156104b5575060005460ff166001145b61051d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610540576000805461ff0019166101001790555b3341146105605760405163022d8c9560e31b815260040160405180910390fd5b3a1561057f576040516383f1b1d360e01b815260040160405180910390fd5b610587610df8565b6105a47308e68ec70fa3b629784fdb28887e206ce8561e08610e25565b80156105ea576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b60335461010090046001600160a01b0316331461061d576040516306fbb1e360e01b815260040160405180910390fd5b60335460ff161561064157604051631785c68160e01b815260040160405180910390fd5b6033805460ff191660011790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b336110071461069f57604051630f22c43960e41b81526110076004820152602401610514565b6107096040518060400160405280600f81526020016e617070726f76616c4164647265737360881b81525085858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610e749050565b156107d357601481146107375783838383604051630a5a604160e01b81526004016105149493929190611930565b600061077d601484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610ece9050565b90506001600160a01b0381166107ae5784848484604051630a5a604160e01b81526004016105149493929190611930565b606780546001600160a01b0319166001600160a01b0392909216919091179055610a55565b6108386040518060400160405280600a8152602001691b595c9adb19549bdbdd60b21b81525085858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610e749050565b156109085760695460ff1615610861576040516379b3306f60e11b815260040160405180910390fd5b6020811461088a5783838383604051630a5a604160e01b81526004016105149493929190611930565b604080516020601f84018190048102820181019092528281526000916108cb918585808385018382808284376000920191909152509293925050610ece9050565b9050806108f35784848484604051630a5a604160e01b81526004016105149493929190611930565b6068556069805460ff19166001179055610a55565b6109806040518060400160405280601b81526020017f746f6b656e5265636f766572506f7274616c50726f746563746f72000000000081525085858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610e749050565b15610a3457601481146109ae5783838383604051630a5a604160e01b81526004016105149493929190611930565b60006109f4601484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610ece9050565b90506001600160a01b038116610a255784848484604051630a5a604160e01b81526004016105149493929190611930565b610a2e81610ed3565b50610a55565b838383836040516325ee20d560e21b81526004016105149493929190611930565b7ff1ce9b2cbf50eeb05769a29e2543fd350cab46894a7dd9978a12d534bb20e63384848484604051610a8a9493929190611930565b60405180910390a150505050565b60695460ff16610abb5760405163678f619760e11b815260040160405180910390fd5b606854610adb5760405163678f619760e11b815260040160405180910390fd5b6067546001600160a01b0316610b0457604051631a1b977b60e31b815260040160405180910390fd5b60335460ff1615610b2857604051631785c68160e01b815260040160405180910390fd5b610b30610f3a565b6000610bbe89898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a9081908401838280828437600081840152601f19601f82011690508083019250505050505050610bb98e8e33610f93565b6110b4565b90506000818c8c604051602001610bd793929190611962565b604051602081830303815290604052805190602001209050610c08816000908152606a602052604090205460ff1690565b15610c2557604051623e493160e81b815260040160405180910390fd5b610ccd3389898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a908190840183828082843760009201919091525050604080516020808c0282810182019093528b82528994509092508b918b9182919085019084908082843760009201919091525061118c92505050565b610d0e848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506068549150849050611297565b610d2b576040516309bde33960e01b815260040160405180910390fd5b6000818152606a602052604090819020805460ff191660011790555163799758b960e01b8152600481018d9052336024820152604481018c90526110049063799758b990606401600060405180830381600087803b158015610d8c57600080fd5b505af1158015610da0573d6000803e3d6000fd5b505050507f39cc0b7297a0ef9102d75ebc4919ffec0347d50008c2b865eda4125d5812cb64828d338e604051610dd99493929190611989565b60405180910390a15050610dec60018055565b50505050505050505050565b600054610100900460ff16610e1f5760405162461bcd60e51b8152600401610514906119c1565b60018055565b600054610100900460ff16610e4c5760405162461bcd60e51b8152600401610514906119c1565b603380546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600081604051602001610e879190611a0c565b6040516020818303038152906040528051906020012083604051602001610eae9190611a0c565b604051602081830303815290604052805190602001201490505b92915050565b015190565b6033546040516001600160a01b0380841692610100900416907f44fc1b38a4abaa91ebd1b628a5b259a698f86238c8217d68f516e87769c60c0b90600090a3603380546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600260015403610f8c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610514565b6002600155565b600060026040518060400160405280601481526020017342696e616e63652d436861696e2d54696772697360601b815250610ff085604051602001610fda91815260200190565b60405160208183030381529060405260006112ad565b6040516bffffffffffffffffffffffff19606087901b1660208201526110299060340160405160208183030381529060405260016112ad565b61103f88604051602001610fda91815260200190565b6040516020016110529493929190611a28565b60408051601f198184030181529082905261106c91611a0c565b602060405180830381855afa158015611089573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906110ac9190611b57565b949350505050565b606083516021146110d857604051638152ea1b60e01b815260040160405180910390fd5b82516040146110fa57604051635e4bd79760e11b815260040160405180910390fd5b604080516020808252818301909252600091602082018180368337019050509050826020820152600085858360405160200161113893929190611b86565b60408051808303601f190181526014808452838301909252925060009190602082018180368337019050509050815160146020830182602086016069600019fa61118157600080fd5b509695505050505050565b606060005b82518110156111ea57818382815181106111ad576111ad611bc9565b60200260200101516040516020016111c6929190611bdf565b604051602081830303815290604052915080806111e290611c17565b915050611191565b5060006040518060400160405280601481526020017342696e616e63652d436861696e2d54696772697360601b8152508787866068548660405160200161123696959493929190611c30565b60408051601f1981840301815291905280516020909101206067549091506001600160a01b0316611267868361147f565b6001600160a01b03161461128e576040516356b00a4f60e11b815260040160405180910390fd5b50505050505050565b6000826112a48584611519565b14949350505050565b60606000835160026112bf9190611ca1565b67ffffffffffffffff8111156112d7576112d7611b70565b6040519080825280601f01601f191660200182016040528015611301576020820181803683370190505b5060408051808201909152601081526f181899199a1a9b1b9c1cb0b131b232b360811b602082015290915060005b85518110156114475781825187838151811061134d5761134d611bc9565b016020015161135f919060f81c611cce565b8151811061136f5761136f611bc9565b01602001516001600160f81b0319168361138a836002611ca1565b8151811061139a5761139a611bc9565b60200101906001600160f81b031916908160001a9053508182518783815181106113c6576113c6611bc9565b01602001516113d8919060f81c611ce2565b815181106113e8576113e8611bc9565b01602001516001600160f81b03191683611403836002611ca1565b61140e906001611cf6565b8151811061141e5761141e611bc9565b60200101906001600160f81b031916908160001a9053508061143f81611c17565b91505061132f565b508315611477578160405160200161145f9190611d09565b60405160208183030381529060405292505050610ec8565b509392505050565b600082516041146114a3576040516356b00a4f60e11b815260040160405180910390fd5b60208301516040840151606085015160001a601b8110156114cc576114c9601b82611d33565b90505b601b8160ff1610806114e15750601c8160ff16115b156114ff576040516356b00a4f60e11b815260040160405180910390fd5b600061150d8683868661155e565b50979650505050505050565b600081815b84518110156114775761154a8286838151811061153d5761153d611bc9565b6020026020010151611622565b91508061155681611c17565b91505061151e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156115955750600090506003611619565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156115e9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661161257600060019250925050611619565b9150600090505b94509492505050565b600081831061163e57600082815260208490526040902061164d565b60008381526020839052604090205b9392505050565b80356001600160a01b038116811461166b57600080fd5b919050565b60006020828403121561168257600080fd5b61164d82611654565b6000806040838503121561169e57600080fd5b823591506116ae60208401611654565b90509250929050565b60005b838110156116d25781810151838201526020016116ba565b50506000910152565b600081518084526116f38160208601602086016116b7565b601f01601f19169290920160200192915050565b60208152600061164d60208301846116db565b60008083601f84011261172c57600080fd5b50813567ffffffffffffffff81111561174457600080fd5b60208301915083602082850101111561175c57600080fd5b9250929050565b6000806000806040858703121561177957600080fd5b843567ffffffffffffffff8082111561179157600080fd5b61179d8883890161171a565b909650945060208701359150808211156117b657600080fd5b506117c38782880161171a565b95989497509550505050565b60008083601f8401126117e157600080fd5b50813567ffffffffffffffff8111156117f957600080fd5b6020830191508360208260051b850101111561175c57600080fd5b60008060008060008060008060008060c08b8d03121561183357600080fd5b8a35995060208b0135985060408b013567ffffffffffffffff8082111561185957600080fd5b6118658e838f0161171a565b909a50985060608d013591508082111561187e57600080fd5b61188a8e838f0161171a565b909850965060808d01359150808211156118a357600080fd5b6118af8e838f0161171a565b909650945060a08d01359150808211156118c857600080fd5b506118d58d828e016117cf565b915080935050809150509295989b9194979a5092959850565b60006020828403121561190057600080fd5b5035919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000611944604083018688611907565b8281036020840152611957818587611907565b979650505050505050565b600084516119748184602089016116b7565b91909101928352506020820152604001919050565b60808152600061199c60808301876116db565b6020830195909552506001600160a01b03929092166040830152606090910152919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251611a1e8184602087016116b7565b9190910192915050565b7f7b226163636f756e745f6e756d626572223a2230222c22636861696e5f6964228152611d1160f11b602082015260008551611a6b816022850160208a016116b7565b7f222c2264617461223a6e756c6c2c226d656d6f223a22222c226d736773223a5b6022918401918201526a3d9130b6b7bab73a111d1160a91b60428201528551611abc81604d840160208a016116b7565b6e1116113932b1b4b834b2b73a111d1160891b604d92909101918201528451611aec81605c8401602089016116b7565b711116113a37b5b2b72fb9bcb6b137b6111d1160711b605c92909101918201528351611b1f81606e8401602088016116b7565b7f227d5d2c2273657175656e6365223a2230222c22736f75726365223a2230227d606e9290910191820152608e019695505050505050565b600060208284031215611b6957600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b60008451611b988184602089016116b7565b845190830190611bac8183602089016116b7565b8451910190611bbf8183602088016116b7565b0195945050505050565b634e487b7160e01b600052603260045260246000fd5b60008351611bf18184602088016116b7565b9190910191825250602001919050565b634e487b7160e01b600052601160045260246000fd5b600060018201611c2957611c29611c01565b5060010190565b60008751611c42818460208c016116b7565b606088901b6bffffffffffffffffffffffff19169083019081528651611c6f816014840160208b016116b7565b0160148101869052603481018590528351611c918160548401602088016116b7565b0160540198975050505050505050565b8082028115828204841417610ec857610ec8611c01565b634e487b7160e01b600052601260045260246000fd5b600082611cdd57611cdd611cb8565b500490565b600082611cf157611cf1611cb8565b500690565b80820180821115610ec857610ec8611c01565b61060f60f31b815260008251611d268160028501602087016116b7565b9190910160020192915050565b60ff8181168382160190811115610ec857610ec8611c0156fea164736f6c6343000811000a" } - }, - "-1": { // Prague - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { - "balance": "0x0", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500" - } } } } diff --git a/params/chainspecs/chapel.json b/params/chainspecs/chapel.json index dc2c0880d0d..68c200e0259 100644 --- a/params/chainspecs/chapel.json +++ b/params/chainspecs/chapel.json @@ -392,13 +392,7 @@ "balance": "0x0", "code": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80638129fc1c11610097578063b187bd2611610066578063b187bd26146101fc578063bfb5a6a114610207578063e33f8d321461021a578063e842426a1461023d57600080fd5b80638129fc1c146101cc5780638456cb59146101d45780639fcb5012146101dc578063ac431751146101e957600080fd5b80634838d165116100d35780634838d165146101335780634a49ac4c14610166578063572c99801461017957806374be21501461018c57600080fd5b8063046f7da2146100fa5780632eb4a7ab14610104578063417c73a714610120575b600080fd5b610102610268565b005b61010d60685481565b6040519081526020015b60405180910390f35b61010261012e366004611670565b6102f0565b610156610141366004611670565b60346020526000908152604090205460ff1681565b6040519015158152602001610117565b610102610174366004611670565b61036c565b61010261018736600461168b565b6103e5565b6101bf6040518060400160405280601481526020017342696e616e63652d436861696e2d47616e67657360601b81525081565b6040516101179190611707565b61010261047b565b6101026105ed565b6069546101569060ff1681565b6101026101f7366004611763565b610679565b60335460ff16610156565b610102610215366004611814565b610a98565b6101566102283660046118ee565b6000908152606a602052604090205460ff1690565b606754610250906001600160a01b031681565b6040516001600160a01b039091168152602001610117565b60335461010090046001600160a01b03163314610298576040516306fbb1e360e01b815260040160405180910390fd5b60335460ff166102bb57604051636cd6020160e01b815260040160405180910390fd5b6033805460ff191690556040517f62451d457bc659158be6e6247f56ec1df424a5c7597f71c20c2bc44e0965c8f990600090a1565b60335461010090046001600160a01b03163314610320576040516306fbb1e360e01b815260040160405180910390fd5b6001600160a01b038116600081815260346020526040808220805460ff19166001179055517f7fd26be6fc92aff63f1f4409b2b2ddeb272a888031d7f55ec830485ec61941869190a250565b60335461010090046001600160a01b0316331461039c576040516306fbb1e360e01b815260040160405180910390fd5b6001600160a01b038116600081815260346020526040808220805460ff19169055517fe0db3499b7fdc3da4cddff5f45d694549c19835e7f719fb5606d3ad1a5de40119190a250565b60335461010090046001600160a01b03163314610415576040516306fbb1e360e01b815260040160405180910390fd5b604051638525db0360e01b8152600481018390526001600160a01b038216602482015261100490638525db0390604401600060405180830381600087803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b505050505050565b600054610100900460ff161580801561049b5750600054600160ff909116105b806104b55750303b1580156104b5575060005460ff166001145b61051d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610540576000805461ff0019166101001790555b3341146105605760405163022d8c9560e31b815260040160405180910390fd5b3a1561057f576040516383f1b1d360e01b815260040160405180910390fd5b610587610df8565b6105a47330151da466ec8ab345bef3d6983023e050fb0673610e25565b80156105ea576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b60335461010090046001600160a01b0316331461061d576040516306fbb1e360e01b815260040160405180910390fd5b60335460ff161561064157604051631785c68160e01b815260040160405180910390fd5b6033805460ff191660011790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b336110071461069f57604051630f22c43960e41b81526110076004820152602401610514565b6107096040518060400160405280600f81526020016e617070726f76616c4164647265737360881b81525085858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610e749050565b156107d357601481146107375783838383604051630a5a604160e01b81526004016105149493929190611930565b600061077d601484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610ece9050565b90506001600160a01b0381166107ae5784848484604051630a5a604160e01b81526004016105149493929190611930565b606780546001600160a01b0319166001600160a01b0392909216919091179055610a55565b6108386040518060400160405280600a8152602001691b595c9adb19549bdbdd60b21b81525085858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610e749050565b156109085760695460ff1615610861576040516379b3306f60e11b815260040160405180910390fd5b6020811461088a5783838383604051630a5a604160e01b81526004016105149493929190611930565b604080516020601f84018190048102820181019092528281526000916108cb918585808385018382808284376000920191909152509293925050610ece9050565b9050806108f35784848484604051630a5a604160e01b81526004016105149493929190611930565b6068556069805460ff19166001179055610a55565b6109806040518060400160405280601b81526020017f746f6b656e5265636f766572506f7274616c50726f746563746f72000000000081525085858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610e749050565b15610a3457601481146109ae5783838383604051630a5a604160e01b81526004016105149493929190611930565b60006109f4601484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050610ece9050565b90506001600160a01b038116610a255784848484604051630a5a604160e01b81526004016105149493929190611930565b610a2e81610ed3565b50610a55565b838383836040516325ee20d560e21b81526004016105149493929190611930565b7ff1ce9b2cbf50eeb05769a29e2543fd350cab46894a7dd9978a12d534bb20e63384848484604051610a8a9493929190611930565b60405180910390a150505050565b60695460ff16610abb5760405163678f619760e11b815260040160405180910390fd5b606854610adb5760405163678f619760e11b815260040160405180910390fd5b6067546001600160a01b0316610b0457604051631a1b977b60e31b815260040160405180910390fd5b60335460ff1615610b2857604051631785c68160e01b815260040160405180910390fd5b610b30610f3a565b6000610bbe89898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a9081908401838280828437600081840152601f19601f82011690508083019250505050505050610bb98e8e33610f93565b6110b4565b90506000818c8c604051602001610bd793929190611962565b604051602081830303815290604052805190602001209050610c08816000908152606a602052604090205460ff1690565b15610c2557604051623e493160e81b815260040160405180910390fd5b610ccd3389898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a908190840183828082843760009201919091525050604080516020808c0282810182019093528b82528994509092508b918b9182919085019084908082843760009201919091525061118c92505050565b610d0e848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506068549150849050611297565b610d2b576040516309bde33960e01b815260040160405180910390fd5b6000818152606a602052604090819020805460ff191660011790555163799758b960e01b8152600481018d9052336024820152604481018c90526110049063799758b990606401600060405180830381600087803b158015610d8c57600080fd5b505af1158015610da0573d6000803e3d6000fd5b505050507f39cc0b7297a0ef9102d75ebc4919ffec0347d50008c2b865eda4125d5812cb64828d338e604051610dd99493929190611989565b60405180910390a15050610dec60018055565b50505050505050505050565b600054610100900460ff16610e1f5760405162461bcd60e51b8152600401610514906119c1565b60018055565b600054610100900460ff16610e4c5760405162461bcd60e51b8152600401610514906119c1565b603380546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600081604051602001610e879190611a0c565b6040516020818303038152906040528051906020012083604051602001610eae9190611a0c565b604051602081830303815290604052805190602001201490505b92915050565b015190565b6033546040516001600160a01b0380841692610100900416907f44fc1b38a4abaa91ebd1b628a5b259a698f86238c8217d68f516e87769c60c0b90600090a3603380546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600260015403610f8c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610514565b6002600155565b600060026040518060400160405280601481526020017342696e616e63652d436861696e2d47616e67657360601b815250610ff085604051602001610fda91815260200190565b60405160208183030381529060405260006112ad565b6040516bffffffffffffffffffffffff19606087901b1660208201526110299060340160405160208183030381529060405260016112ad565b61103f88604051602001610fda91815260200190565b6040516020016110529493929190611a28565b60408051601f198184030181529082905261106c91611a0c565b602060405180830381855afa158015611089573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906110ac9190611b57565b949350505050565b606083516021146110d857604051638152ea1b60e01b815260040160405180910390fd5b82516040146110fa57604051635e4bd79760e11b815260040160405180910390fd5b604080516020808252818301909252600091602082018180368337019050509050826020820152600085858360405160200161113893929190611b86565b60408051808303601f190181526014808452838301909252925060009190602082018180368337019050509050815160146020830182602086016069600019fa61118157600080fd5b509695505050505050565b606060005b82518110156111ea57818382815181106111ad576111ad611bc9565b60200260200101516040516020016111c6929190611bdf565b604051602081830303815290604052915080806111e290611c17565b915050611191565b5060006040518060400160405280601481526020017342696e616e63652d436861696e2d47616e67657360601b8152508787866068548660405160200161123696959493929190611c30565b60408051601f1981840301815291905280516020909101206067549091506001600160a01b0316611267868361147f565b6001600160a01b03161461128e576040516356b00a4f60e11b815260040160405180910390fd5b50505050505050565b6000826112a48584611519565b14949350505050565b60606000835160026112bf9190611ca1565b67ffffffffffffffff8111156112d7576112d7611b70565b6040519080825280601f01601f191660200182016040528015611301576020820181803683370190505b5060408051808201909152601081526f181899199a1a9b1b9c1cb0b131b232b360811b602082015290915060005b85518110156114475781825187838151811061134d5761134d611bc9565b016020015161135f919060f81c611cce565b8151811061136f5761136f611bc9565b01602001516001600160f81b0319168361138a836002611ca1565b8151811061139a5761139a611bc9565b60200101906001600160f81b031916908160001a9053508182518783815181106113c6576113c6611bc9565b01602001516113d8919060f81c611ce2565b815181106113e8576113e8611bc9565b01602001516001600160f81b03191683611403836002611ca1565b61140e906001611cf6565b8151811061141e5761141e611bc9565b60200101906001600160f81b031916908160001a9053508061143f81611c17565b91505061132f565b508315611477578160405160200161145f9190611d09565b60405160208183030381529060405292505050610ec8565b509392505050565b600082516041146114a3576040516356b00a4f60e11b815260040160405180910390fd5b60208301516040840151606085015160001a601b8110156114cc576114c9601b82611d33565b90505b601b8160ff1610806114e15750601c8160ff16115b156114ff576040516356b00a4f60e11b815260040160405180910390fd5b600061150d8683868661155e565b50979650505050505050565b600081815b84518110156114775761154a8286838151811061153d5761153d611bc9565b6020026020010151611622565b91508061155681611c17565b91505061151e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156115955750600090506003611619565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156115e9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661161257600060019250925050611619565b9150600090505b94509492505050565b600081831061163e57600082815260208490526040902061164d565b60008381526020839052604090205b9392505050565b80356001600160a01b038116811461166b57600080fd5b919050565b60006020828403121561168257600080fd5b61164d82611654565b6000806040838503121561169e57600080fd5b823591506116ae60208401611654565b90509250929050565b60005b838110156116d25781810151838201526020016116ba565b50506000910152565b600081518084526116f38160208601602086016116b7565b601f01601f19169290920160200192915050565b60208152600061164d60208301846116db565b60008083601f84011261172c57600080fd5b50813567ffffffffffffffff81111561174457600080fd5b60208301915083602082850101111561175c57600080fd5b9250929050565b6000806000806040858703121561177957600080fd5b843567ffffffffffffffff8082111561179157600080fd5b61179d8883890161171a565b909650945060208701359150808211156117b657600080fd5b506117c38782880161171a565b95989497509550505050565b60008083601f8401126117e157600080fd5b50813567ffffffffffffffff8111156117f957600080fd5b6020830191508360208260051b850101111561175c57600080fd5b60008060008060008060008060008060c08b8d03121561183357600080fd5b8a35995060208b0135985060408b013567ffffffffffffffff8082111561185957600080fd5b6118658e838f0161171a565b909a50985060608d013591508082111561187e57600080fd5b61188a8e838f0161171a565b909850965060808d01359150808211156118a357600080fd5b6118af8e838f0161171a565b909650945060a08d01359150808211156118c857600080fd5b506118d58d828e016117cf565b915080935050809150509295989b9194979a5092959850565b60006020828403121561190057600080fd5b5035919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000611944604083018688611907565b8281036020840152611957818587611907565b979650505050505050565b600084516119748184602089016116b7565b91909101928352506020820152604001919050565b60808152600061199c60808301876116db565b6020830195909552506001600160a01b03929092166040830152606090910152919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251611a1e8184602087016116b7565b9190910192915050565b7f7b226163636f756e745f6e756d626572223a2230222c22636861696e5f6964228152611d1160f11b602082015260008551611a6b816022850160208a016116b7565b7f222c2264617461223a6e756c6c2c226d656d6f223a22222c226d736773223a5b6022918401918201526a3d9130b6b7bab73a111d1160a91b60428201528551611abc81604d840160208a016116b7565b6e1116113932b1b4b834b2b73a111d1160891b604d92909101918201528451611aec81605c8401602089016116b7565b711116113a37b5b2b72fb9bcb6b137b6111d1160711b605c92909101918201528351611b1f81606e8401602088016116b7565b7f227d5d2c2273657175656e6365223a2230222c22736f75726365223a2230227d606e9290910191820152608e019695505050505050565b600060208284031215611b6957600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b60008451611b988184602089016116b7565b845190830190611bac8183602089016116b7565b8451910190611bbf8183602088016116b7565b0195945050505050565b634e487b7160e01b600052603260045260246000fd5b60008351611bf18184602088016116b7565b9190910191825250602001919050565b634e487b7160e01b600052601160045260246000fd5b600060018201611c2957611c29611c01565b5060010190565b60008751611c42818460208c016116b7565b606088901b6bffffffffffffffffffffffff19169083019081528651611c6f816014840160208b016116b7565b0160148101869052603481018590528351611c918160548401602088016116b7565b0160540198975050505050505050565b8082028115828204841417610ec857610ec8611c01565b634e487b7160e01b600052601260045260246000fd5b600082611cdd57611cdd611cb8565b500490565b600082611cf157611cf1611cb8565b500690565b80820180821115610ec857610ec8611c01565b61060f60f31b815260008251611d268160028501602087016116b7565b9190910160020192915050565b60ff8181168382160190811115610ec857610ec8611c0156fea164736f6c6343000811000a" } - }, - "-1": { // Prague - "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e": { - "balance": "0x0", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500" } } - } } } \ No newline at end of file diff --git a/params/protocol_params.go b/params/protocol_params.go index 4ad420973ce..57a80813ec5 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -221,6 +221,9 @@ var BeaconRootsAddress = common.HexToAddress("0x000F3df6D732807Ef1319fB7B8bB8522 // EIP-2935: Historical block hashes in state var HistoryStorageAddress = common.HexToAddress("0x0aae40965e6800cd9b1f4b05ff21581047e3f91e") +// HistoryStorageCode is the code with getters for historical block hashes. +var HistoryStorageCode = common.FromHex("3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500") + // EIP-7002: Execution layer triggerable withdrawals var WithdrawalRequestAddress = common.HexToAddress("0x09Fc772D0857550724b07B850a4323f39112aAaA")