Fix t8n regression: Legacy Tx should not validate chainId (#2858)
This commit is contained in:
parent
453cb2f33e
commit
a57a887269
|
@ -13,7 +13,7 @@
|
||||||
import
|
import
|
||||||
eth/common,
|
eth/common,
|
||||||
results,
|
results,
|
||||||
".."/[aristo_desc, aristo_get, aristo_utils, aristo_compute, aristo_serialise]
|
".."/[aristo_desc, aristo_get, aristo_utils, aristo_serialise]
|
||||||
|
|
||||||
const
|
const
|
||||||
ChainRlpNodesNoEntry* = {
|
ChainRlpNodesNoEntry* = {
|
||||||
|
|
|
@ -264,7 +264,8 @@ proc parseTxJson(txo: TxObject, chainId: ChainId): Result[Transaction, string] =
|
||||||
optional(accessList)
|
optional(accessList)
|
||||||
required(authorizationList)
|
required(authorizationList)
|
||||||
|
|
||||||
if tx.chainId != chainId:
|
# Ignore chainId if txType == TxLegacy
|
||||||
|
if tx.txType > TxLegacy and tx.chainId != chainId:
|
||||||
return err("invalid chain id: have " & $tx.chainId & " want " & $chainId)
|
return err("invalid chain id: have " & $tx.chainId & " want " & $chainId)
|
||||||
|
|
||||||
let eip155 = txo.protected.get(true)
|
let eip155 = txo.protected.get(true)
|
||||||
|
@ -285,10 +286,10 @@ proc readNestedTx(rlp: var Rlp, chainId: ChainId): Result[Transaction, string] =
|
||||||
else:
|
else:
|
||||||
var rr = rlpFromBytes(rlp.read(seq[byte]))
|
var rr = rlpFromBytes(rlp.read(seq[byte]))
|
||||||
rr.read(Transaction)
|
rr.read(Transaction)
|
||||||
if tx.chainId == chainId:
|
# Ignore chainId if txType == TxLegacy
|
||||||
ok(tx)
|
if tx.txType > TxLegacy and tx.chainId != chainId:
|
||||||
else:
|
return err("invalid chain id: have " & $tx.chainId & " want " & $chainId)
|
||||||
err("invalid chain id: have " & $tx.chainId & " want " & $chainId)
|
ok(tx)
|
||||||
except RlpError as exc:
|
except RlpError as exc:
|
||||||
err(exc.msg)
|
err(exc.msg)
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ proc runTest(appDir: string, spec: TestSpec): bool =
|
||||||
|
|
||||||
if spec.expOut.len > 0:
|
if spec.expOut.len > 0:
|
||||||
if spec.expOut.endsWith(".json"):
|
if spec.expOut.endsWith(".json"):
|
||||||
let path = base / spec.expOut
|
let path = base / spec.expOut
|
||||||
try:
|
try:
|
||||||
let want = json.parseFile(path)
|
let want = json.parseFile(path)
|
||||||
let have = json.parseJson(res)
|
let have = json.parseJson(res)
|
||||||
|
@ -470,7 +470,7 @@ const
|
||||||
name : "Revert In Create In Init Create2",
|
name : "Revert In Create In Init Create2",
|
||||||
base : "testdata/00-512",
|
base : "testdata/00-512",
|
||||||
input : t8nInput(
|
input : t8nInput(
|
||||||
"alloc.json", "txs.rlp", "env.json", "Berlin", "0", "0"
|
"alloc.json", "txs.rlp", "env.json", "Berlin", "0"
|
||||||
),
|
),
|
||||||
output: T8nOutput(alloc: true, result: true),
|
output: T8nOutput(alloc: true, result: true),
|
||||||
expOut: "exp.json",
|
expOut: "exp.json",
|
||||||
|
@ -479,7 +479,7 @@ const
|
||||||
name : "Revert In Create In Init",
|
name : "Revert In Create In Init",
|
||||||
base : "testdata/00-513",
|
base : "testdata/00-513",
|
||||||
input : t8nInput(
|
input : t8nInput(
|
||||||
"alloc.json", "txs.rlp", "env.json", "Berlin", "0", "0"
|
"alloc.json", "txs.rlp", "env.json", "Berlin", "0"
|
||||||
),
|
),
|
||||||
output: T8nOutput(alloc: true, result: true),
|
output: T8nOutput(alloc: true, result: true),
|
||||||
expOut: "exp.json",
|
expOut: "exp.json",
|
||||||
|
@ -488,7 +488,7 @@ const
|
||||||
name : "Init collision 3",
|
name : "Init collision 3",
|
||||||
base : "testdata/00-514",
|
base : "testdata/00-514",
|
||||||
input : t8nInput(
|
input : t8nInput(
|
||||||
"alloc.json", "txs.rlp", "env.json", "Berlin", "0", "0"
|
"alloc.json", "txs.rlp", "env.json", "Berlin", "0"
|
||||||
),
|
),
|
||||||
output: T8nOutput(alloc: true, result: true),
|
output: T8nOutput(alloc: true, result: true),
|
||||||
expOut: "exp.json",
|
expOut: "exp.json",
|
||||||
|
@ -506,7 +506,7 @@ const
|
||||||
name : "GasUsedHigherThanBlockGasLimitButNotWithRefundsSuicideLast_Frontier",
|
name : "GasUsedHigherThanBlockGasLimitButNotWithRefundsSuicideLast_Frontier",
|
||||||
base : "testdata/00-516",
|
base : "testdata/00-516",
|
||||||
input : t8nInput(
|
input : t8nInput(
|
||||||
"alloc.json", "txs.rlp", "env.json", "Frontier", "5000000000000000000", "0"
|
"alloc.json", "txs.rlp", "env.json", "Frontier", "5000000000000000000"
|
||||||
),
|
),
|
||||||
output: T8nOutput(alloc: true, result: true),
|
output: T8nOutput(alloc: true, result: true),
|
||||||
expOut: "exp.json",
|
expOut: "exp.json",
|
||||||
|
|
Loading…
Reference in New Issue