Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulators/ethereum/engine: Remove PoW config from withdrawals #691

Merged
merged 1 commit into from
Jan 25, 2023
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
24 changes: 16 additions & 8 deletions simulators/ethereum/engine/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,24 @@ func addTestsToSuite(sim *hivesim.Simulation, suite *hivesim.Suite, tests []test
}

testFiles := hivesim.Params{}
if currentTest.GetChainFile() != "" {
// We are using a Proof of Work chain file, remove all clique-related settings
// TODO: Nethermind still requires HIVE_MINER for the Engine API
// delete(newParams, "HIVE_MINER")
if genesis.Difficulty.Cmp(big.NewInt(ttd)) < 0 {

if currentTest.GetChainFile() != "" {
// We are using a Proof of Work chain file, remove all clique-related settings
// TODO: Nethermind still requires HIVE_MINER for the Engine API
// delete(newParams, "HIVE_MINER")
delete(newParams, "HIVE_CLIQUE_PRIVATEKEY")
delete(newParams, "HIVE_CLIQUE_PERIOD")
// Add the new file to be loaded as chain.rlp
testFiles = testFiles.Set("/chain.rlp", "./chains/"+currentTest.GetChainFile())
}
if currentTest.IsMiningDisabled() {
delete(newParams, "HIVE_MINER")
}
} else {
// This is a post-merge test
delete(newParams, "HIVE_CLIQUE_PRIVATEKEY")
delete(newParams, "HIVE_CLIQUE_PERIOD")
// Add the new file to be loaded as chain.rlp
testFiles = testFiles.Set("/chain.rlp", "./chains/"+currentTest.GetChainFile())
}
if currentTest.IsMiningDisabled() {
delete(newParams, "HIVE_MINER")
}

Expand Down
7 changes: 7 additions & 0 deletions simulators/ethereum/engine/suites/withdrawals/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,13 @@ func AddUnconditionalBytecode(g *core.Genesis, start *big.Int, end *big.Int) {
// bytecode for testing purposes.
func (ws *WithdrawalsBaseSpec) GetGenesis() *core.Genesis {
genesis := ws.Spec.GetGenesis()

// Remove PoW altogether
genesis.Difficulty = common.Big0
genesis.Config.TerminalTotalDifficulty = common.Big0
genesis.Config.Clique = nil
genesis.ExtraData = []byte{}

startAccount := big.NewInt(0x1000)
endAccount := big.NewInt(0x1000 + int64(ws.GetWithdrawableAccountCount()) - 1)
AddUnconditionalBytecode(genesis, startAccount, endAccount)
Expand Down