add totalTerminalDifficulty to MainNet and Goerli chain config

This commit is contained in:
jangko 2022-11-12 11:12:17 +07:00
parent 9dd256cae7
commit 342dbdea42
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
4 changed files with 20 additions and 8 deletions

View File

@ -371,6 +371,7 @@ proc chainConfigForNetwork*(id: NetworkId): ChainConfig =
result = case id
of MainNet:
const mainNetTTD = UInt256.fromHex("58750000000000000000000")
ChainConfig(
poaEngine: false,
chainId: MainNet.ChainId,
@ -395,6 +396,7 @@ proc chainConfigForNetwork*(id: NetworkId): ChainConfig =
mergeForkBlock: high(BlockNumber),
shanghaiBlock: high(BlockNumber),
cancunBlock: high(BlockNumber),
terminalTotalDifficulty: some(mainNetTTD)
)
of RopstenNet:
ChainConfig(
@ -467,6 +469,7 @@ proc chainConfigForNetwork*(id: NetworkId): ChainConfig =
mergeForkBlock: high(BlockNumber),
shanghaiBlock: high(BlockNumber),
cancunBlock: high(BlockNumber),
terminalTotalDifficulty: some(10790000.u256)
)
of SepoliaNet:
ChainConfig(

View File

@ -15,6 +15,7 @@ import
vm_types,
forks,
constants,
chain_config,
vm_precompiles,
transaction,
db/db_chain,
@ -67,7 +68,8 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
vmState = BaseVMState.new(
BlockHeader(blockNumber: 1.u256),
BlockHeader(),
newBaseChainDB(newMemoryDB()))
newBaseChainDB(newMemoryDB(), config = ChainConfig())
)
case toLowerAscii(label)
of "ecrecover": data.doTest(vmState, fork, paEcRecover)

View File

@ -147,6 +147,9 @@ proc rpcMain*() =
ks2: EthAddress = hexToByteArray[20]("0xa3b2222afa5c987da6ef773fde8d01b9f23d481f")
ks3: EthAddress = hexToByteArray[20]("0x597176e9a64aad0845d83afdaf698fbeff77703b")
# disable POS/post Merge feature
chain.config.terminalTotalDifficulty = none(DifficultyInt)
let keyStore = "tests" / "keystore"
let res = ctx.am.loadKeystores(keyStore)
if res.isErr:

View File

@ -8,7 +8,8 @@
import
unittest2, json, os, tables, strutils,
eth/common, stew/byteutils, eth/trie/db,
./test_helpers, ../nimbus/db/db_chain, ../nimbus/[tracer, vm_types]
./test_helpers, ../nimbus/db/db_chain,
../nimbus/[tracer, vm_types, chain_config]
proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus)
@ -21,10 +22,13 @@ proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus) =
var
blockNumber = UInt256.fromHex(node["blockNumber"].getStr())
memoryDB = newMemoryDB()
chainDB = newBaseChainDB(memoryDB, false)
chainDB = newBaseChainDB(memoryDB, chainConfigForNetwork(MainNet))
state = node["state"]
receipts = node["receipts"]
# disable POS/post Merge feature
chainDB.config.terminalTotalDifficulty = none(DifficultyInt)
for k, v in state:
let key = hexToSeqByte(k)
let value = hexToSeqByte(v.getStr())