Skip to content

remove the random state test using BLOCKHASH#15

Open
chfast wants to merge 1 commit into
ethereum:masterfrom
ipsilon:rm_blockhash_usage
Open

remove the random state test using BLOCKHASH#15
chfast wants to merge 1 commit into
ethereum:masterfrom
ipsilon:rm_blockhash_usage

Conversation

@chfast

@chfast chfast commented May 22, 2025

Copy link
Copy Markdown
Member

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

chfast commented May 22, 2025

Copy link
Copy Markdown
Member Author

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 force-pushed the rm_blockhash_usage branch from 83cd119 to b718226 Compare February 9, 2026 15:23
Copilot AI review requested due to automatic review settings February 9, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes a flaky/invalid legacy state test that uses BLOCKHASH but fails due to stack underflow (so BLOCKHASH output never meaningfully affects post-state).

Changes:

  • Deleted the legacy filler test definition for randomStatetest101.
  • Deleted the corresponding generated/filled test artifact randomStatetest101.json.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/LegacyTests/Constantinople/GeneralStateTestsFiller/stRandom/randomStatetest101Filler.json Removes the filler source for the invalid BLOCKHASH-using random state test.
Constantinople/GeneralStateTests/stRandom/randomStatetest101.json Removes the generated test vector corresponding to the deleted filler, aligning the suite with valid/non-flaky tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants