Skip to content

Commit a57a887

Browse files
authored
Fix t8n regression: Legacy Tx should not validate chainId (#2858)
1 parent 453cb2f commit a57a887

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

nimbus/db/aristo/aristo_part/part_chain_rlp.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import
1414
eth/common,
1515
results,
16-
".."/[aristo_desc, aristo_get, aristo_utils, aristo_compute, aristo_serialise]
16+
".."/[aristo_desc, aristo_get, aristo_utils, aristo_serialise]
1717

1818
const
1919
ChainRlpNodesNoEntry* = {

tools/t8n/helpers.nim

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ proc parseTxJson(txo: TxObject, chainId: ChainId): Result[Transaction, string] =
264264
optional(accessList)
265265
required(authorizationList)
266266

267-
if tx.chainId != chainId:
267+
# Ignore chainId if txType == TxLegacy
268+
if tx.txType > TxLegacy and tx.chainId != chainId:
268269
return err("invalid chain id: have " & $tx.chainId & " want " & $chainId)
269270

270271
let eip155 = txo.protected.get(true)
@@ -285,10 +286,10 @@ proc readNestedTx(rlp: var Rlp, chainId: ChainId): Result[Transaction, string] =
285286
else:
286287
var rr = rlpFromBytes(rlp.read(seq[byte]))
287288
rr.read(Transaction)
288-
if tx.chainId == chainId:
289-
ok(tx)
290-
else:
291-
err("invalid chain id: have " & $tx.chainId & " want " & $chainId)
289+
# Ignore chainId if txType == TxLegacy
290+
if tx.txType > TxLegacy and tx.chainId != chainId:
291+
return err("invalid chain id: have " & $tx.chainId & " want " & $chainId)
292+
ok(tx)
292293
except RlpError as exc:
293294
err(exc.msg)
294295

tools/t8n/t8n_test.nim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ proc runTest(appDir: string, spec: TestSpec): bool =
169169

170170
if spec.expOut.len > 0:
171171
if spec.expOut.endsWith(".json"):
172-
let path = base / spec.expOut
172+
let path = base / spec.expOut
173173
try:
174174
let want = json.parseFile(path)
175175
let have = json.parseJson(res)
@@ -470,7 +470,7 @@ const
470470
name : "Revert In Create In Init Create2",
471471
base : "testdata/00-512",
472472
input : t8nInput(
473-
"alloc.json", "txs.rlp", "env.json", "Berlin", "0", "0"
473+
"alloc.json", "txs.rlp", "env.json", "Berlin", "0"
474474
),
475475
output: T8nOutput(alloc: true, result: true),
476476
expOut: "exp.json",
@@ -479,7 +479,7 @@ const
479479
name : "Revert In Create In Init",
480480
base : "testdata/00-513",
481481
input : t8nInput(
482-
"alloc.json", "txs.rlp", "env.json", "Berlin", "0", "0"
482+
"alloc.json", "txs.rlp", "env.json", "Berlin", "0"
483483
),
484484
output: T8nOutput(alloc: true, result: true),
485485
expOut: "exp.json",
@@ -488,7 +488,7 @@ const
488488
name : "Init collision 3",
489489
base : "testdata/00-514",
490490
input : t8nInput(
491-
"alloc.json", "txs.rlp", "env.json", "Berlin", "0", "0"
491+
"alloc.json", "txs.rlp", "env.json", "Berlin", "0"
492492
),
493493
output: T8nOutput(alloc: true, result: true),
494494
expOut: "exp.json",
@@ -506,7 +506,7 @@ const
506506
name : "GasUsedHigherThanBlockGasLimitButNotWithRefundsSuicideLast_Frontier",
507507
base : "testdata/00-516",
508508
input : t8nInput(
509-
"alloc.json", "txs.rlp", "env.json", "Frontier", "5000000000000000000", "0"
509+
"alloc.json", "txs.rlp", "env.json", "Frontier", "5000000000000000000"
510510
),
511511
output: T8nOutput(alloc: true, result: true),
512512
expOut: "exp.json",

0 commit comments

Comments
 (0)