diff --git a/tools/t8n/t8n_test.nim b/tools/t8n/t8n_test.nim index 46b365cc99..77aa9588da 100644 --- a/tools/t8n/t8n_test.nim +++ b/tools/t8n/t8n_test.nim @@ -112,6 +112,8 @@ proc cmp(jsc: var JsonComparator; a, b: JsonNode, path: string): bool = of JNull: result = true of JArray: + if a.len != b.len: + jsc.exit("ARRAY A.len($1) != B.len($2)" % [$a.len, $b.len]) for i, x in a.elems: if not jsc.cmp(x, b.elems[i], path & "/" & $i): return false @@ -690,7 +692,7 @@ const ), output: T8nOutput(alloc: true, result: true), expOut: "exp.json", - ), + ), ] proc main() = diff --git a/tools/t8n/testdata/00-525/exp1.json b/tools/t8n/testdata/00-525/exp1.json index 1f078d2d62..72cedebee2 100644 --- a/tools/t8n/testdata/00-525/exp1.json +++ b/tools/t8n/testdata/00-525/exp1.json @@ -19,10 +19,6 @@ "currentExcessBlobGas": "0x2b80000", "blobGasUsed": "0x0", "requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "requests": [ - "0x", - "0x", - "0x" - ] + "requests": [] } } diff --git a/tools/t8n/testdata/00-525/exp2.json b/tools/t8n/testdata/00-525/exp2.json index aee740be93..e37edad602 100644 --- a/tools/t8n/testdata/00-525/exp2.json +++ b/tools/t8n/testdata/00-525/exp2.json @@ -35,10 +35,6 @@ "currentExcessBlobGas": "0x2b80000", "blobGasUsed": "0x0", "requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "requests": [ - "0x", - "0x", - "0x" - ] + "requests": [] } } diff --git a/tools/t8n/testdata/00-525/exp3.json b/tools/t8n/testdata/00-525/exp3.json index 99ea26c342..2144659087 100644 --- a/tools/t8n/testdata/00-525/exp3.json +++ b/tools/t8n/testdata/00-525/exp3.json @@ -36,9 +36,7 @@ "blobGasUsed": "0x0", "requestsHash": "0xf34c7b46f404c6c6f91b540c098b6dfe3f59b7e50ad155807c8c7d2221e52241", "requests": [ - "0x81521c60874daf5b425c21e44caf045c4d475e8b33a557a28cee3c46ef9cf9bd95b4c75a0bb629981b40d0102452dd4c020000000000000000000000332e43696a505ef45b9319973785f837ce5267b9000065cd1d0000008c8f2647f342d2c3e8fd07c6b3b9b16383ac11c4be6a6962c7fc18a789daee5fac20ee0bbe4a10383759aaffacacb72b0d67f998730cdf4995fe73afe434dfce2803b343606f67fc4995597c0af9e0fe9ed00006e5889bec29171f670e7d9be20000000000000000", - "0x", - "0x" + "0x0081521c60874daf5b425c21e44caf045c4d475e8b33a557a28cee3c46ef9cf9bd95b4c75a0bb629981b40d0102452dd4c020000000000000000000000332e43696a505ef45b9319973785f837ce5267b9000065cd1d0000008c8f2647f342d2c3e8fd07c6b3b9b16383ac11c4be6a6962c7fc18a789daee5fac20ee0bbe4a10383759aaffacacb72b0d67f998730cdf4995fe73afe434dfce2803b343606f67fc4995597c0af9e0fe9ed00006e5889bec29171f670e7d9be20000000000000000", ] } } diff --git a/tools/t8n/testdata/00-526/exp.json b/tools/t8n/testdata/00-526/exp.json index d60fa9d0d0..dd9464aa1d 100644 --- a/tools/t8n/testdata/00-526/exp.json +++ b/tools/t8n/testdata/00-526/exp.json @@ -51,10 +51,6 @@ "currentBaseFee": "0x7", "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "requests": [ - "0x", - "0x", - "0x" - ] + "requests": [] } } diff --git a/tools/t8n/testdata/00-527/exp.json b/tools/t8n/testdata/00-527/exp.json index 67df6b1736..d3d8c34042 100644 --- a/tools/t8n/testdata/00-527/exp.json +++ b/tools/t8n/testdata/00-527/exp.json @@ -49,10 +49,6 @@ "currentBaseFee": "0x7", "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "requests": [ - "0x", - "0x", - "0x" - ] + "requests": [] } } diff --git a/tools/t8n/testdata/33/exp.json b/tools/t8n/testdata/33/exp.json index 759b59d8dc..96efb004c9 100644 --- a/tools/t8n/testdata/33/exp.json +++ b/tools/t8n/testdata/33/exp.json @@ -61,10 +61,6 @@ "currentBaseFee": "0x7", "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "requests": [ - "0x", - "0x", - "0x" - ] + "requests": [] } } diff --git a/tools/t8n/transition.nim b/tools/t8n/transition.nim index 0ad6cd3ec3..59db240ef9 100644 --- a/tools/t8n/transition.nim +++ b/tools/t8n/transition.nim @@ -358,16 +358,23 @@ proc exec(ctx: TransContext, var allLogs: seq[Log] for rec in result.result.receipts: allLogs.add rec.logs - let + var depositReqs = parseDepositLogs(allLogs, vmState.com.depositContractAddress).valueOr: raise newError(ErrorEVM, error) - requestsHash = calcRequestsHash([ - (DEPOSIT_REQUEST_TYPE, depositReqs), - (WITHDRAWAL_REQUEST_TYPE, withdrawalReqs), - (CONSOLIDATION_REQUEST_TYPE, consolidationReqs) - ]) + executionRequests: seq[seq[byte]] + + template append(dst, reqType, reqData) = + if reqData.len > 0: + reqData.insert(reqType) + dst.add(move(reqData)) + + executionRequests.append(DEPOSIT_REQUEST_TYPE, depositReqs) + executionRequests.append(WITHDRAWAL_REQUEST_TYPE, withdrawalReqs) + executionRequests.append(CONSOLIDATION_REQUEST_TYPE, consolidationReqs) + + let requestsHash = calcRequestsHash(executionRequests) result.result.requestsHash = Opt.some(requestsHash) - result.result.requests = Opt.some([depositReqs, withdrawalReqs, consolidationReqs]) + result.result.requests = Opt.some(executionRequests) template wrapException(body: untyped) = when wrapExceptionEnabled: diff --git a/tools/t8n/types.nim b/tools/t8n/types.nim index eb8eba6c1d..e92f3de489 100644 --- a/tools/t8n/types.nim +++ b/tools/t8n/types.nim @@ -118,7 +118,7 @@ type blobGasUsed*: Opt[uint64] currentExcessBlobGas*: Opt[uint64] requestsHash*: Opt[Hash32] - requests*: Opt[array[3, seq[byte]]] + requests*: Opt[seq[seq[byte]]] const ErrorEVM* = 2.T8NExitCode