Skip to content

Commit 03a4692

Browse files
committed
Test more overrides
1 parent 1c381c9 commit 03a4692

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

category/rpc/eth_call_test.cpp

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,16 +1574,6 @@ TEST_F(EthCallFixture, contract_deployment_success_with_state_trace)
15741574
auto executor = create_executor(dbname.string());
15751575
auto state_override = monad_state_override_create();
15761576

1577-
std::string deployed_code =
1578-
"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe036"
1579-
"01600081602082378035828234f58015156039578182fd5b8082525050506014600cf"
1580-
"3";
1581-
byte_string deployed_code_bytes = from_hex(deployed_code);
1582-
1583-
std::vector<uint8_t> deployed_code_vec = {
1584-
deployed_code_bytes.data(),
1585-
deployed_code_bytes.data() + deployed_code_bytes.size()};
1586-
15871577
struct callback_context prestate_ctx;
15881578
struct callback_context statediff_ctx;
15891579

@@ -1713,16 +1703,10 @@ TEST_F(EthCallFixture, prestate_state_overrides)
17131703
sizeof(Address),
17141704
(0xFFFF_bytes32).bytes,
17151705
sizeof(bytes32_t));
1716-
1717-
std::string deployed_code =
1718-
"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe036"
1719-
"01600081602082378035828234f58015156039578182fd5b8082525050506014600cf"
1720-
"3";
1721-
byte_string deployed_code_bytes = from_hex(deployed_code);
1722-
1723-
std::vector<uint8_t> deployed_code_vec = {
1724-
deployed_code_bytes.data(),
1725-
deployed_code_bytes.data() + deployed_code_bytes.size()};
1706+
set_override_nonce(state_override, from.bytes, sizeof(Address), 1024);
1707+
uint8_t code[] = {0x00, 0x01, 0x02, 0x03, 0x04};
1708+
set_override_code(
1709+
state_override, from.bytes, sizeof(Address), code, sizeof(code));
17261710

17271711
struct callback_context prestate_ctx;
17281712
struct callback_context statediff_ctx;
@@ -1757,8 +1741,14 @@ TEST_F(EthCallFixture, prestate_state_overrides)
17571741
prestate_ctx.result->encoded_trace_len);
17581742

17591743
auto const expected = R"({
1760-
"0x0000000000000000000000000000000000000000":{"balance":"0xffff"},
1761-
"0xbd770416a3345f91e4b34576cb804a576fa48eb1":{"balance":"0x0"}
1744+
"0x0000000000000000000000000000000000000000": {
1745+
"balance": "0xffff",
1746+
"code": "0x0001020304",
1747+
"nonce": 1024
1748+
},
1749+
"0x8f40531f4fd16955712e2a83bdc817515853b9ea": {
1750+
"balance": "0x0"
1751+
}
17621752
})";
17631753
EXPECT_EQ(
17641754
nlohmann::json::parse(expected),
@@ -1797,17 +1787,19 @@ TEST_F(EthCallFixture, prestate_state_overrides)
17971787
auto const expected = R"({
17981788
"post":{
17991789
"0x0000000000000000000000000000000000000000":{
1800-
"nonce": 1
1790+
"nonce": 1025
18011791
},
1802-
"0xbd770416a3345f91e4b34576cb804a576fa48eb1":{
1792+
"0x8f40531f4fd16955712e2a83bdc817515853b9ea":{
18031793
"balance": "0x0",
18041794
"code": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3",
18051795
"nonce": 1
18061796
}
18071797
},
18081798
"pre":{
18091799
"0x0000000000000000000000000000000000000000":{
1810-
"balance": "0xffff"
1800+
"balance": "0xffff",
1801+
"code": "0x0001020304",
1802+
"nonce": 1024
18111803
}
18121804
}
18131805
})";

0 commit comments

Comments
 (0)