Some quick fixes for Shanghai support in Fluffy (#1541)
- Remove failing on withdrawalsRoot to allow Shanghai BlockHeader. Still need to add real checks in block header / body validation. - Add withdrawals array to Block object for JSON-RPC API
This commit is contained in:
parent
034d0e6305
commit
52d8308821
|
@ -159,8 +159,8 @@ func validateBlockHeaderBytes*(
|
|||
if header.excessDataGas.isSome:
|
||||
return err("EIP-4844 not yet implemented")
|
||||
|
||||
if header.withdrawalsRoot.isSome:
|
||||
return err("Withdrawals not yet implemented")
|
||||
# TODO: Verify timestamp with Shanghai timestamp to if isSome()
|
||||
# TODO 2: Verify block number with merge block to check ommerhash
|
||||
|
||||
if not (header.blockHash() == hash):
|
||||
err("Block header hash does not match")
|
||||
|
@ -171,6 +171,7 @@ proc validateBlockBody(
|
|||
body: BlockBodySSZ, txsRoot, ommersHash: KeccakHash):
|
||||
Result[void, string] =
|
||||
## Validate the block body against the txRoot amd ommersHash from the header.
|
||||
# TODO: should be checked for hash for empty uncles after merge block
|
||||
let calculatedOmmersHash = keccakHash(body.uncles.asSeq())
|
||||
if calculatedOmmersHash != ommersHash:
|
||||
return err("Invalid ommers hash")
|
||||
|
@ -179,6 +180,8 @@ proc validateBlockBody(
|
|||
if calculatedTxsRoot != txsRoot:
|
||||
return err("Invalid transactions root")
|
||||
|
||||
# TODO: Add root check for withdrawals after Shanghai
|
||||
|
||||
ok()
|
||||
|
||||
proc validateBlockBodyBytes*(
|
||||
|
|
|
@ -74,6 +74,7 @@ type
|
|||
baseFeePerGas*: Option[HexQuantityStr]
|
||||
transactions*: seq[JsonNode] # list of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
|
||||
uncles*: seq[Hash256] # list of uncle hashes.
|
||||
withdrawals*: seq[WithdrawalObject] # list of validator withdrawals
|
||||
|
||||
TransactionObject* = object # A transaction object, or null when no transaction was found:
|
||||
# Returned to user
|
||||
|
@ -92,6 +93,12 @@ type
|
|||
r*: HexQuantityStr # 32 Bytes - ECDSA signature r
|
||||
s*: HexQuantityStr # 32 Bytes - ECDSA signature s
|
||||
|
||||
WithdrawalObject* = object
|
||||
index*: HexQuantityStr
|
||||
validatorIndex*: HexQuantityStr
|
||||
address*: EthAddress
|
||||
amount*: HexQuantityStr
|
||||
|
||||
FilterLog* = object
|
||||
# Returned to user
|
||||
removed*: bool # true when the log was removed, due to a chain reorganization. false if its a valid log.
|
||||
|
|
Loading…
Reference in New Issue