Skip to content
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

Playground editor does not rename opcode 0x44 from DIFFICULTY to PREVRANDAO post-merge #219

Open
ardislu opened this issue Mar 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ardislu
Copy link
Contributor

ardislu commented Mar 26, 2023

Steps to reproduce the issue:

  1. Go to https://www.evm.codes/playground?fork=merge
  2. Set the editor language to "Bytecode"
  3. Enter "44" into the editor
  4. Change the editor language to "Mnemonic"
  5. Change the editor language back to "Bytecode"

Expected result: the "44" opcode is recognized as "PREVRANDAO" in the "Mnemonic" setting, and the value "PREVRANDAO" is converted to "44" when switched back to bytecode.

Actual result: the "44" opcode is recognized as "DIFFICULTY" in the "Mnemonic" setting, and the value "DIFFICULTY" is converted to "undefined" when switched back to bytecode.


I see there was the prior issue #172 and PR #180 to address this, additionally in ethereumContext.tsx there's already this logic in extractDocFromOpcode to account for this change:

// TODO: need to implement proper selection of doc according to selected fork (maybe similar to dynamic gas fee)
// Hack for "difficulty" -> "prevrandao" replacement for "merge" HF
if (selectedFork?.name === mergeHardforkName && toHex(op.code) == '44') {
  return {
    ...meta[prevrandaoDocName],
    ...{
      opcodeOrAddress: toHex(op.code),
      staticFee: op.fee,
      minimumFee: 0,
      name: 'PREVRANDAO',
    },
  }
}

So I think this issue was a small oversight in the larger PR. I believe the specific issue I described can be fixed by adding a check in the loadInstructions function in ethereumContext.tsx, similar to the check in extractDocFromOpcode.

@sambacha
Copy link

sambacha commented Jul 6, 2024

this is still incorrect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants