trigger rlp bug

This commit is contained in:
Etan Kissling 2024-08-23 11:17:22 +02:00
parent e4f18cba09
commit 586a8f19d9
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
3 changed files with 7 additions and 15 deletions

2
.gitmodules vendored
View File

@ -89,7 +89,7 @@
path = vendor/nim-eth
url = https://github.com/status-im/nim-eth.git
ignore = untracked
branch = master
branch = dev/etan/zz-rlpbug
[submodule "vendor/nim-stint"]
path = vendor/nim-stint
url = https://github.com/status-im/nim-stint.git

View File

@ -12,18 +12,6 @@ import
eth/common/eth_types_rlp,
"."/[helpers, state_transition_block]
func readExecutionTransaction(
txBytes: bellatrix.Transaction): Result[ExecutionTransaction, string] =
# Nim 2.0.8: `rlp.decode(distinctBase(txBytes), ExecutionTransaction)`
# uses the generic `read` from `rlp.nim` instead of the specific `read`
# from `eth_types_rlp.nim`, leading to compilation error.
# Doing this in two steps works around this resolution order issue.
var rlp = rlpFromBytes(distinctBase(txBytes))
try:
ok rlp.read(ExecutionTransaction)
except RlpError as exc:
err("Invalid transaction: " & exc.msg)
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.4/specs/deneb/beacon-chain.md#is_valid_versioned_hashes
func is_valid_versioned_hashes*(blck: ForkyBeaconBlock): Result[void, string] =
static: doAssert typeof(blck).kind >= ConsensusFork.Deneb
@ -34,7 +22,11 @@ func is_valid_versioned_hashes*(blck: ForkyBeaconBlock): Result[void, string] =
for txBytes in transactions:
if txBytes.len == 0 or txBytes[0] != TxEip4844.byte:
continue # Only blob transactions may have blobs
let tx = ? txBytes.readExecutionTransaction()
let tx =
try:
rlp.decode(distinctBase(txBytes), ExecutionTransaction)
except RlpError as exc:
return err("Invalid transaction: " & exc.msg)
for vHash in tx.versionedHashes:
if commitments.len <= i:
return err("Extra blobs without matching `blob_kzg_commitments`")

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit cc6d88962e4a22170361b576534246bd57974d80
Subproject commit b8e50ad60c380d3d8533b14292d84dcec5d8bd76