Skip to content

Conversation

@chfast
Copy link
Member

@chfast chfast commented May 22, 2025

Remove the only state test which uses the BLOCKHASH instruction. This is a random test which actually fails because of the stack underflow so the result of the BLOCKHASH instruction doesn't affect the post state at all. Any other test for BLOCKHASH has been converted to the blockchain test format where the block hashes are properly defined.

This is the disassembled code of the test. It fails at DUP11 because of the stack underflow.

	// Inputs[5]
	// {
	//     @0063  block.blockHash(0x0000000000000000000000000000000000000000000000000000000000000000)
	//     @0085  msg.data[0x01:0x21]
	//     @00A8  stack[-7]
	//     @00A9  stack[-11]
	//     @00AF  memory[0x00:0x20]
	// }
	0000    7F  PUSH32 0x000000000000000000000000000000000000000000000000000000000000c350
	0021    7F  PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001
	0042    7F  PUSH32 0x0000000000000000000000000000000000000000000000000000000000000000
	0063    40  BLOCKHASH
	0064    7F  PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001
	0085    35  CALLDATALOAD
	0086    7F  PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001
	00A7    0B  SIGNEXTEND
	00A8    8A  DUP11
	00A9    9E  SWAP15
	00AA    12  SLT
	00AB    01  ADD
	00AC    05  SDIV
	00AD    60  PUSH1 0x00
	00AF    51  MLOAD
	00B0    55  SSTORE
	// Stack delta = +1
	// Outputs[3]
	// {
	//     @0000  stack[0] = 0x000000000000000000000000000000000000000000000000000000000000c350
	//     @00A9  stack[-11] = stack[-7]
	//     @00B0  storage[memory[0x00:0x20]] = ((stack[-11] i< signextend(0x0000000000000000000000000000000000000000000000000000000000000001, msg.data[0x01:0x21])) + block.blockHash(0x0000000000000000000000000000000000000000000000000000000000000000)) i/ 0x0000000000000000000000000000000000000000000000000000000000000001
	// }

Remove the only state test which uses the `BLOCKHASH` instruction.
This is a random test which actually fails because of the stack
underflow so the result of the `BLOCKHASH` instruction doesn't affect
the post state at all. Any other test for `BLOCKHASH` has been
converted to the blockchain test format where the block hashes are
properly defined.

This is the disassembled code of the test. It fails at DUP11 because of
the stack underflow.

```
	// Inputs[5]
	// {
	//     @0063  block.blockHash(0x0000000000000000000000000000000000000000000000000000000000000000)
	//     @0085  msg.data[0x01:0x21]
	//     @00A8  stack[-7]
	//     @00A9  stack[-11]
	//     @00af  memory[0x00:0x20]
	// }
	0000    7F  PUSH32 0x000000000000000000000000000000000000000000000000000000000000c350
	0021    7F  PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001
	0042    7F  PUSH32 0x0000000000000000000000000000000000000000000000000000000000000000
	0063    40  BLOCKHASH
	0064    7F  PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001
	0085    35  CALLDATALOAD
	0086    7F  PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001
	00A7    0B  SIGNEXTEND
	00A8    8A  DUP11
	00A9    9E  SWAP15
	00AA    12  SLT
	00AB    01  ADD
	00AC    05  SDIV
	00AD    60  PUSH1 0x00
	00AF    51  MLOAD
	00B0    55  SSTORE
	// Stack delta = +1
	// Outputs[3]
	// {
	//     @0000  stack[0] = 0x000000000000000000000000000000000000000000000000000000000000c350
	//     @00A9  stack[-11] = stack[-7]
	//     @00b0  storage[memory[0x00:0x20]] = ((stack[-11] i< signextend(0x0000000000000000000000000000000000000000000000000000000000000001, msg.data[0x01:0x21])) + block.blockHash(0x0000000000000000000000000000000000000000000000000000000000000000)) i/ 0x0000000000000000000000000000000000000000000000000000000000000001
	// }
```
@chfast chfast changed the title remove the random state tests using BLOCKHASH remove the random state test using BLOCKHASH May 22, 2025
@chfast
Copy link
Member Author

chfast commented May 22, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant