@@ -171,26 +171,28 @@ TEST_F(evm_state, sstore_cost)
171
171
172
172
TEST_F (evm_state, tx_context)
173
173
{
174
+ rev = EVMC_ISTANBUL;
175
+
174
176
host.tx_context .block_timestamp = 0xdd ;
175
- host.tx_context .block_coinbase .bytes [1 ] = 0xcc ;
176
177
host.tx_context .block_number = 0x1100 ;
177
- host.tx_context .block_difficulty .bytes [1 ] = 0xdd ;
178
178
host.tx_context .block_gas_limit = 0x990000 ;
179
- host.tx_context .tx_gas_price .bytes [2 ] = 0x66 ;
179
+ host.tx_context .chain_id .bytes [28 ] = 0xaa ;
180
+ host.tx_context .block_coinbase .bytes [1 ] = 0xcc ;
180
181
host.tx_context .tx_origin .bytes [2 ] = 0x55 ;
182
+ host.tx_context .block_difficulty .bytes [1 ] = 0xdd ;
183
+ host.tx_context .tx_gas_price .bytes [2 ] = 0x66 ;
181
184
182
- std::string s;
183
- s += " 4241173a17" ; // TIMESTAMP COINBASE OR GASPRICE OR
184
- s += " 4317441745173217" ; // NUMBER OR DIFFICULTY OR GASLIMIT OR ORIGIN OR
185
- s += " 600052" ; // m[0..] =
186
- s += " 60206000f3" ; // RETURN(0,32)
187
- execute (47 , s);
185
+ auto const code = bytecode{} + OP_TIMESTAMP + OP_COINBASE + OP_OR + OP_GASPRICE + OP_OR +
186
+ OP_NUMBER + OP_OR + OP_DIFFICULTY + OP_OR + OP_GASLIMIT + OP_OR + OP_ORIGIN +
187
+ OP_OR + OP_CHAINID + OP_OR + ret_top ();
188
+ execute (52 , code);
188
189
EXPECT_EQ (result.status_code , EVMC_SUCCESS);
189
190
EXPECT_EQ (result.gas_left , 0 );
190
191
ASSERT_EQ (result.output_size , 32 );
191
192
EXPECT_EQ (result.output_data [31 ], 0xdd );
192
193
EXPECT_EQ (result.output_data [30 ], 0x11 );
193
194
EXPECT_EQ (result.output_data [29 ], 0x99 );
195
+ EXPECT_EQ (result.output_data [28 ], 0xaa );
194
196
EXPECT_EQ (result.output_data [14 ], 0x55 );
195
197
EXPECT_EQ (result.output_data [13 ], 0xcc );
196
198
EXPECT_EQ (result.output_data [2 ], 0x66 );
0 commit comments