@@ -18,63 +18,42 @@ inline constexpr bytes32 salts[] = {
18
18
19
19
TEST (state_new_account_address, create)
20
20
{
21
- evmc_message msg{};
22
- msg.kind = EVMC_CREATE;
23
-
24
21
for (const auto & ic : init_codes) // Init-code doesn't affect CREATE.
25
22
{
26
- msg.input_data = ic.data ();
27
- msg.input_size = ic.size ();
28
-
29
- msg.sender = senders[0 ];
30
- EXPECT_EQ (addr (msg, nonces[0 ]), 0xbd770416a3345f91e4b34576cb804a576fa48eb1_address);
31
- EXPECT_EQ (addr (msg, nonces[3 ]), 0x1262d73ea59d3a661bf8751d16cf1a5377149e75_address);
32
-
33
- msg.sender = senders[1 ];
34
- EXPECT_EQ (addr (msg, nonces[0 ]), 0x522b3294e6d06aa25ad0f1b8891242e335d3b459_address);
35
- EXPECT_EQ (addr (msg, nonces[1 ]), 0x535b3d7a252fa034ed71f0c53ec0c6f784cb64e1_address);
36
- EXPECT_EQ (addr (msg, nonces[2 ]), 0x09c1ef8f55c61b94e8b92a55d0891d408a991e18_address);
37
- EXPECT_EQ (addr (msg, nonces[3 ]), 0x001567239734aeadea21023c2a7c0d9bb9ae4af9_address);
38
-
39
- msg.sender = senders[2 ];
40
- EXPECT_EQ (addr (msg, nonces[0 ]), 0x3cb1045aee4a06f522ea2b69e4f3d21ed3c135d1_address);
41
- EXPECT_EQ (addr (msg, nonces[3 ]), 0xe1aa03e4a7b6991d69aff8ece53ceafdf347082e_address);
42
-
43
- msg.sender = 0xb20a608c624Ca5003905aA834De7156C68b2E1d0_address;
44
- const auto beacon_deposit_address = addr (msg, 0 );
23
+ auto s = senders[0 ];
24
+ EXPECT_EQ (addr (s, nonces[0 ], {}, ic), 0xbd770416a3345f91e4b34576cb804a576fa48eb1_address);
25
+ EXPECT_EQ (addr (s, nonces[3 ], {}, ic), 0x1262d73ea59d3a661bf8751d16cf1a5377149e75_address);
26
+
27
+ s = senders[1 ];
28
+ EXPECT_EQ (addr (s, nonces[0 ], {}, ic), 0x522b3294e6d06aa25ad0f1b8891242e335d3b459_address);
29
+ EXPECT_EQ (addr (s, nonces[1 ], {}, ic), 0x535b3d7a252fa034ed71f0c53ec0c6f784cb64e1_address);
30
+ EXPECT_EQ (addr (s, nonces[2 ], {}, ic), 0x09c1ef8f55c61b94e8b92a55d0891d408a991e18_address);
31
+ EXPECT_EQ (addr (s, nonces[3 ], {}, ic), 0x001567239734aeadea21023c2a7c0d9bb9ae4af9_address);
32
+
33
+ s = senders[2 ];
34
+ EXPECT_EQ (addr (s, nonces[0 ], {}, ic), 0x3cb1045aee4a06f522ea2b69e4f3d21ed3c135d1_address);
35
+ EXPECT_EQ (addr (s, nonces[3 ], {}, ic), 0xe1aa03e4a7b6991d69aff8ece53ceafdf347082e_address);
36
+
37
+ const auto beacon_deposit_address =
38
+ addr (0xb20a608c624Ca5003905aA834De7156C68b2E1d0_address, 0 , {}, ic);
45
39
EXPECT_EQ (beacon_deposit_address, 0x00000000219ab540356cbb839cbe05303d7705fa_address);
46
40
}
47
41
}
48
42
49
43
TEST (state_new_account_address, create2)
50
44
{
51
- evmc_message msg{};
52
- msg.kind = EVMC_CREATE2;
53
-
54
45
for (const auto n : nonces) // Nonce doesn't affect CREATE2.
55
46
{
56
- msg.sender = senders[0 ];
57
- msg.input_data = init_codes[0 ].data ();
58
- msg.input_size = init_codes[0 ].size ();
59
- msg.create2_salt = salts[0 ];
60
- EXPECT_EQ (addr (msg, n), 0xe33c0c7f7df4809055c3eba6c09cfe4baf1bd9e0_address);
47
+ EXPECT_EQ (addr (senders[0 ], n, salts[0 ], init_codes[0 ]),
48
+ 0xe33c0c7f7df4809055c3eba6c09cfe4baf1bd9e0_address);
61
49
62
- msg.sender = senders[2 ];
63
- msg.input_data = init_codes[1 ].data ();
64
- msg.input_size = init_codes[1 ].size ();
65
- msg.create2_salt = salts[0 ];
66
- EXPECT_EQ (addr (msg, n), 0x3517dea701ed18fc4a99dc111c5946e1f1541dad_address);
50
+ EXPECT_EQ (addr (senders[2 ], n, salts[0 ], init_codes[1 ]),
51
+ 0x3517dea701ed18fc4a99dc111c5946e1f1541dad_address);
67
52
68
- msg.sender = senders[1 ];
69
- msg.input_data = init_codes[0 ].data ();
70
- msg.input_size = init_codes[0 ].size ();
71
- msg.create2_salt = salts[1 ];
72
- EXPECT_EQ (addr (msg, n), 0x7be1c1cb3b8298f21c56add66defce03e2d32604_address);
53
+ EXPECT_EQ (addr (senders[1 ], n, salts[1 ], init_codes[0 ]),
54
+ 0x7be1c1cb3b8298f21c56add66defce03e2d32604_address);
73
55
74
- msg.sender = senders[2 ];
75
- msg.input_data = init_codes[1 ].data ();
76
- msg.input_size = init_codes[1 ].size ();
77
- msg.create2_salt = salts[1 ];
78
- EXPECT_EQ (addr (msg, n), 0x8f459e65c8f00a9c0c0493de7b0c61c3c27f7384_address);
56
+ EXPECT_EQ (addr (senders[2 ], n, salts[1 ], init_codes[1 ]),
57
+ 0x8f459e65c8f00a9c0c0493de7b0c61c3c27f7384_address);
79
58
}
80
59
}
0 commit comments