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

Đang mở
#219 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

  • #220 của @ardislu — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
blockchain, frontend

Hướng nghiên cứu

Tái hiện hành vi tại URL playground của Merge, sau đó đọc ethereumContext.tsx, đặc biệt là loadInstructions và kiểm tra extractDocFromOpcode hiện có. Xác minh cách opcode 0x44 được tải khi chuyển đổi giữa các chế độ Bytecode và Mnemonic. Được xem là hoàn tất khi Merge fork hiển thị PREVRANDAO và chuyển đổi nó trở lại thành 44 mà không tạo ra undefined.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
833
Fork
197
Merge trung bình
5 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của duneanalytics/evm.codes

Tất cả issue của duneanalytics/evm.codes

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.