bump `nim-eth` for `eip4844` support
The `BlockHeader` structure in `nim-eth` was updated with support for EIP-4844 (danksharding). To enable the `nim-eth` bump, the ingress of `BlockHeader` structures has been hardened to reject headers that have the new `excessDataGas` field until proper EIP4844 support exists. https://github.com/status-im/nim-eth/pull/570
This commit is contained in:
parent
c962bafd5a
commit
22338b7870
|
@ -132,6 +132,9 @@ func validateBlockHeaderBytes*(
|
||||||
|
|
||||||
let header = ? decodeRlp(bytes, BlockHeader)
|
let header = ? decodeRlp(bytes, BlockHeader)
|
||||||
|
|
||||||
|
if header.excessDataGas.isSome:
|
||||||
|
return err("EIP-4844 not yet implemented")
|
||||||
|
|
||||||
if header.withdrawalsRoot.isSome:
|
if header.withdrawalsRoot.isSome:
|
||||||
return err("Withdrawals not yet implemented")
|
return err("Withdrawals not yet implemented")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Nimbus
|
||||||
|
# Copyright (c) 2022 Status Research & Development GmbH
|
||||||
|
# Licensed under either of
|
||||||
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
||||||
|
# http://opensource.org/licenses/MIT)
|
||||||
|
# at your option. This file may not be copied, modified, or distributed except
|
||||||
|
# according to those terms.
|
||||||
|
|
||||||
|
import
|
||||||
|
stew/results,
|
||||||
|
../common/common
|
||||||
|
|
||||||
|
# https://eips.ethereum.org/EIPS/eip-4844
|
||||||
|
func validateEip4844Header*(
|
||||||
|
com: CommonRef, header: BlockHeader
|
||||||
|
): Result[void, string] {.raises: [Defect].} =
|
||||||
|
if header.excessDataGas.isSome:
|
||||||
|
return err("EIP-4844 not yet implemented")
|
||||||
|
return ok()
|
|
@ -13,7 +13,7 @@ import
|
||||||
../db/accounts_cache,
|
../db/accounts_cache,
|
||||||
".."/[transaction, common/common],
|
".."/[transaction, common/common],
|
||||||
".."/[vm_state, vm_types, errors],
|
".."/[vm_state, vm_types, errors],
|
||||||
"."/[dao, gaslimit, withdrawals],
|
"."/[dao, eip4844, gaslimit, withdrawals],
|
||||||
./pow/[difficulty, header],
|
./pow/[difficulty, header],
|
||||||
./pow,
|
./pow,
|
||||||
chronicles,
|
chronicles,
|
||||||
|
@ -129,7 +129,10 @@ proc validateHeader(com: CommonRef; header, parentHeader: BlockHeader;
|
||||||
if checkSealOK:
|
if checkSealOK:
|
||||||
return pow.validateSeal(header)
|
return pow.validateSeal(header)
|
||||||
|
|
||||||
com.validateWithdrawals(header)
|
? com.validateWithdrawals(header)
|
||||||
|
? com.validateEip4844Header(header)
|
||||||
|
|
||||||
|
ok()
|
||||||
|
|
||||||
func validateUncle(currBlock, uncle, uncleParent: BlockHeader):
|
func validateUncle(currBlock, uncle, uncleParent: BlockHeader):
|
||||||
Result[void,string] =
|
Result[void,string] =
|
||||||
|
|
|
@ -17,7 +17,7 @@ import
|
||||||
eth/p2p/[private/p2p_types, peer_pool],
|
eth/p2p/[private/p2p_types, peer_pool],
|
||||||
stew/byteutils,
|
stew/byteutils,
|
||||||
"."/[protocol, types],
|
"."/[protocol, types],
|
||||||
../core/[chain, clique/clique_sealer, gaslimit, withdrawals],
|
../core/[chain, clique/clique_sealer, eip4844, gaslimit, withdrawals],
|
||||||
../core/pow/difficulty,
|
../core/pow/difficulty,
|
||||||
../constants,
|
../constants,
|
||||||
../utils/utils,
|
../utils/utils,
|
||||||
|
@ -239,6 +239,12 @@ proc validateHeader(ctx: LegacySyncRef, header: BlockHeader,
|
||||||
msg=res.error
|
msg=res.error
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
res = com.validateEip4844Header(header)
|
||||||
|
if res.isErr:
|
||||||
|
trace "validate eip4844 error",
|
||||||
|
msg=res.error
|
||||||
|
return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -49,6 +49,8 @@ proc debug*(h: BlockHeader): string =
|
||||||
result.add "fee : " & $h.fee.get() & "\n"
|
result.add "fee : " & $h.fee.get() & "\n"
|
||||||
if h.withdrawalsRoot.isSome:
|
if h.withdrawalsRoot.isSome:
|
||||||
result.add "withdrawalsRoot: " & $h.withdrawalsRoot.get() & "\n"
|
result.add "withdrawalsRoot: " & $h.withdrawalsRoot.get() & "\n"
|
||||||
|
if h.excessDataGas.isSome:
|
||||||
|
result.add "excessDataGas: " & $h.excessDataGas.get() & "\n"
|
||||||
result.add "blockHash : " & $blockHash(h) & "\n"
|
result.add "blockHash : " & $blockHash(h) & "\n"
|
||||||
|
|
||||||
proc dumpAccount(stateDB: AccountsCache, address: EthAddress): JsonNode =
|
proc dumpAccount(stateDB: AccountsCache, address: EthAddress): JsonNode =
|
||||||
|
|
|
@ -55,7 +55,8 @@ proc pp*(h: BlockHeader; sep = " "): string =
|
||||||
&"receiptRoot={h.receiptRoot.pp}{sep}" &
|
&"receiptRoot={h.receiptRoot.pp}{sep}" &
|
||||||
&"stateRoot={h.stateRoot.pp}{sep}" &
|
&"stateRoot={h.stateRoot.pp}{sep}" &
|
||||||
&"baseFee={h.baseFee}{sep}" &
|
&"baseFee={h.baseFee}{sep}" &
|
||||||
&"withdrawalsRoot={h.withdrawalsRoot.get(EMPTY_ROOT_HASH)}"
|
&"withdrawalsRoot={h.withdrawalsRoot.get(EMPTY_ROOT_HASH)}{sep}" &
|
||||||
|
&"excessDataGas={h.excessDataGas.get(GasInt(0))}"
|
||||||
|
|
||||||
proc pp*(g: Genesis; sep = " "): string =
|
proc pp*(g: Genesis; sep = " "): string =
|
||||||
"" &
|
"" &
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 22d0ac81e1495960e61df65d80d8a9c6f31d0726
|
Subproject commit 2b5f2a27e303b13127bb525b0c7a309eaa7fbed9
|
Loading…
Reference in New Issue