-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supplant DIFFICULTY opcode with PREVRANDAO #2321
Conversation
Reference: https://eips.ethereum.org/EIPS/eip-4399 Since the Merge, opcode 0x44 returns the output of the randomness beacon provided by the beacon chain
I am a bit cautious here, no total EVM expert, @jochem-brouwer what do you think, can we merge this without side effects? 🤔 |
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
I have to check but I think we can merge this without side effects. However, I do not think we should merge this as-is. The probem is that if you listen to |
Ah, ok, yes, that makes sense, thanks. We do not have Common in this code part available (and very likely don't want to rework towards this). So I guess what we can do here is to add a new section to {
hardfork: Hardfork.Merge,
opcodes: {
0x44: { name: 'PREVRANDAO', isAsync: true, dynamicGas: false },
},
}, And then we would move the change here back to Right? This is then getting so complex that I would like to have at least one test case for this. @ethosdev can you do these additional updates/changes? |
Update: ah, and interestingly CI is failing for EVM when run with the current change. This should be investigated before we do the proposed update, otherwise it might not be repeatable any more and this might hint and some overall problems with the PR. Ah, just seeing, it's a ethereum/tests state test called blockInfo: # file: VMTests/vmTests/blockInfo.json test: blockInfo
ok 498 [ 0.015 secs ] the state roots should match (successful tx run)
not ok 499 [ 0.015 secs ] the state roots should match (successful tx run)
---
operator: ok
expected: true
actual: false
at: runTestCase (/home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/packages/vm/tests/tester/runners/GeneralStateTestsRunner.ts:149:5)
stack: |-
Error: [ 0.015 secs ] the state roots should match (successful tx run)
at Test.assert [as _assert] (/home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/node_modules/tape/lib/test.js:314:54)
at Test.bound [as _assert] (/home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/node_modules/tape/lib/test.js:99:32)
at Test.assert (/home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/node_modules/tape/lib/test.js:433:10)
at Test.bound [as ok] (/home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/node_modules/tape/lib/test.js:99:32)
at runTestCase (/home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/packages/vm/tests/tester/runners/GeneralStateTestsRunner.ts:149:5)
at async runStateTest (/home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/packages/vm/tests/tester/runners/GeneralStateTestsRunner.ts:174:9)
at async /home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/packages/vm/tests/tester/index.ts:234:17
at async fileCallback (/home/runner/work/ethereumjs-monorepo/ethereumjs-monorepo/packages/vm/tests/tester/testLoader.ts:54:11)
... Then I would very much assume that |
We should definitely investigate this, I do not see how changing the opcode name changes the outcome of the state roots. I thought it was just a semantic thing..? Anyways, in |
I actually find the proposed solution a lot cleaner even if we have access to common, why to add various logic parts if this can remain plainly descriptive? I would very much assume that the blockInfo ethereum/tests test is doing some weird contract stuff to simulate testing the opcode names (so: setting in the contract, comparing with |
Change sha3 in common to keccak256 and it will/should work :) |
Have added to #2706, will close here |
Reference: https://eips.ethereum.org/EIPS/eip-4399
Since the Merge, opcode 0x44 returns the output of the randomness beacon provided by the beacon chain