Skip to content

Commit 50a4f4f

Browse files
committed
Test more overrides
1 parent 110943d commit 50a4f4f

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

category/rpc/eth_call_test.cpp

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,13 +1553,6 @@ TEST_F(EthCallFixture, contract_deployment_success_with_state_trace)
15531553
auto executor = create_executor(dbname.string());
15541554
auto state_override = monad_state_override_create();
15551555

1556-
byte_string deployed_code_bytes =
1557-
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3_bytes;
1558-
1559-
std::vector<uint8_t> deployed_code_vec = {
1560-
deployed_code_bytes.data(),
1561-
deployed_code_bytes.data() + deployed_code_bytes.size()};
1562-
15631556
struct callback_context prestate_ctx;
15641557
struct callback_context statediff_ctx;
15651558

@@ -1689,16 +1682,10 @@ TEST_F(EthCallFixture, prestate_state_overrides)
16891682
sizeof(Address),
16901683
(0xFFFF_bytes32).bytes,
16911684
sizeof(bytes32_t));
1692-
1693-
std::string deployed_code =
1694-
"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe036"
1695-
"01600081602082378035828234f58015156039578182fd5b8082525050506014600cf"
1696-
"3";
1697-
byte_string deployed_code_bytes = from_hex(deployed_code);
1698-
1699-
std::vector<uint8_t> deployed_code_vec = {
1700-
deployed_code_bytes.data(),
1701-
deployed_code_bytes.data() + deployed_code_bytes.size()};
1685+
set_override_nonce(state_override, from.bytes, sizeof(Address), 1024);
1686+
uint8_t code[] = {0x00, 0x01, 0x02, 0x03, 0x04};
1687+
set_override_code(
1688+
state_override, from.bytes, sizeof(Address), code, sizeof(code));
17021689

17031690
struct callback_context prestate_ctx;
17041691
struct callback_context statediff_ctx;
@@ -1733,8 +1720,14 @@ TEST_F(EthCallFixture, prestate_state_overrides)
17331720
prestate_ctx.result->encoded_trace_len);
17341721

17351722
auto const expected = R"({
1736-
"0x0000000000000000000000000000000000000000":{"balance":"0xffff"},
1737-
"0xbd770416a3345f91e4b34576cb804a576fa48eb1":{"balance":"0x0"}
1723+
"0x0000000000000000000000000000000000000000": {
1724+
"balance": "0xffff",
1725+
"code": "0x0001020304",
1726+
"nonce": 1024
1727+
},
1728+
"0x8f40531f4fd16955712e2a83bdc817515853b9ea": {
1729+
"balance": "0x0"
1730+
}
17381731
})";
17391732
EXPECT_EQ(
17401733
nlohmann::json::parse(expected),
@@ -1773,17 +1766,19 @@ TEST_F(EthCallFixture, prestate_state_overrides)
17731766
auto const expected = R"({
17741767
"post":{
17751768
"0x0000000000000000000000000000000000000000":{
1776-
"nonce": 1
1769+
"nonce": 1025
17771770
},
1778-
"0xbd770416a3345f91e4b34576cb804a576fa48eb1":{
1771+
"0x8f40531f4fd16955712e2a83bdc817515853b9ea":{
17791772
"balance": "0x0",
17801773
"code": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3",
17811774
"nonce": 1
17821775
}
17831776
},
17841777
"pre":{
17851778
"0x0000000000000000000000000000000000000000":{
1786-
"balance": "0xffff"
1779+
"balance": "0xffff",
1780+
"code": "0x0001020304",
1781+
"nonce": 1024
17871782
}
17881783
}
17891784
})";

0 commit comments

Comments
 (0)