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

未关闭
#219 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

  • #220 来自 @ardislu —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
typescript

调研方向

在 Merge playground URL 复现该行为,然后阅读 ethereumContext.tsx,尤其是 loadInstructions 和现有的 extractDocFromOpcode 检查。验证在 Bytecode 和 Mnemonic 模式之间切换时如何加载 opcode 0x44。完成的标准是 Merge fork 显示 PREVRANDAO,并将其转换回 44,且不会产生 undefined。

由索引模型根据 Issue 内容生成。

描述

bug

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.

主要语言
TypeScript
星标
833
派生
197
平均合并
5 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

duneanalytics/evm.codes 的其他 Issue

查看 duneanalytics/evm.codes 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。