Skip to content

Commit

Permalink
t8n: Add test for empty requests
Browse files Browse the repository at this point in the history
  • Loading branch information
pdobacz committed Oct 31, 2024
1 parent 45e1baa commit f4c4529
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/integration/t8n/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,38 @@ set_tests_properties(
FIXTURES_CLEANUP ${TEST_CASE}
PASS_REGULAR_EXPRESSION ${EXPECTED_OUT_ALLOC}
)

set(TEST_CASE osaka_empty_requests)

add_test(
NAME ${PREFIX}/${TEST_CASE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_CASE}
COMMAND
evmone-t8n
--state.fork Osaka
--state.reward 0
--state.chainid 1
--input.alloc alloc.json
--input.txs txs.json
--input.env env.json
--output.basedir ${CMAKE_CURRENT_BINARY_DIR}/${TEST_CASE}
--output.result out.json
)
set_tests_properties(${PREFIX}/${TEST_CASE} PROPERTIES FIXTURES_REQUIRED ${TEST_CASE})

add_test(
NAME ${PREFIX}/${TEST_CASE}/out.json
COMMAND ${CMAKE_COMMAND} -E cat ${CMAKE_CURRENT_BINARY_DIR}/${TEST_CASE}/out.json
)
string(
JOIN ".*" EXPECTED_OUT
# empty requests list of exactly 3 elements (withdrawals, deposits, consolidations)
[=["requests": \[[^],]*"0x",[^],]*"0x",[^],]*"0x"[^,]*\]]=]
# requests hash should be present
[=["requestsHash": "0x6036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5f"]=]
)
set_tests_properties(
${PREFIX}/${TEST_CASE}/out.json PROPERTIES
FIXTURES_CLEANUP ${TEST_CASE}
PASS_REGULAR_EXPRESSION ${EXPECTED_OUT}
)
7 changes: 7 additions & 0 deletions test/integration/t8n/osaka_empty_requests/alloc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"code": "",
"nonce": "0x00",
"balance": "0x02540be400"
}
}
6 changes: 6 additions & 0 deletions test/integration/t8n/osaka_empty_requests/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"currentCoinbase": "0x8888f1f195afa192cfee860698584c030f4c9db1",
"currentNumber": "0x01",
"currentTimestamp": "0x54c99069",
"currentGasLimit": "0x2fefd8"
}
15 changes: 15 additions & 0 deletions test/integration/t8n/osaka_empty_requests/txs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"to": null,
"input": "0x",
"gas": "0x186a0",
"nonce": "0x0",
"value": "0x0",
"gasPrice": "0x32",
"chainId": "0x1",
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"v": "0x1b",
"r": "0x468a915f087692bb9be503831a3dfef2cf9c8dee26deb40ff2ec99e8d22665ae",
"s": "0x5cedae0810c3851ecd1004bfdbfe6ddc7753c2d665993bb01ce75af7857b13dc"
}
]

0 comments on commit f4c4529

Please sign in to comment.