Skip to content

Commit

Permalink
move new code to blockallocs
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Dec 4, 2024
1 parent 9df22c5 commit e01b15d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.
7 changes: 0 additions & 7 deletions consensus/misc/eip2935.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,3 @@ 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)
}
5 changes: 0 additions & 5 deletions core/systemcontracts/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ 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"
)
Expand Down Expand Up @@ -62,10 +61,6 @@ func UpgradeBuildInSystemContract(config *chain.Config, blockNumber *big.Int, la
return
}

if config.IsOnPrague(blockNumber, lastBlockTime, blockTime) {
misc.InitializeBlockHashesEip2935(state)
}

for blockNumberOrTime, genesisAlloc := range config.Parlia.BlockAlloc {
numOrTime, err := strconv.ParseUint(blockNumberOrTime, 10, 64)
if err != nil {
Expand Down
9 changes: 0 additions & 9 deletions erigon-lib/chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,6 @@ 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)
Expand Down
8 changes: 7 additions & 1 deletion params/chainspecs/bsc.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion params/chainspecs/chapel.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ 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")

Expand Down

0 comments on commit e01b15d

Please sign in to comment.