Page MenuHomePhabricator

[Chronik] Add `Opcode` struct
ClosedPublic

Authored by tobias_ruck on Mar 30 2023, 08:56.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCf73ceaea0ccd: [Chronik] Add `Opcode` struct
Summary

This helps us build/match scripts as needed. Instead of using a plain u8, we wrap it in an Opcode struct, which helps us adding useful opcode-specific functions.

This is also useful for the explorer, which eventually should have all its required functionality moved into bitcoinsuite-core.

We use a macro, so we don't have to re-define each opcode when displaying/parsing etc. We also have access to the doc text in the $doc macro variable, which might be useful if the explorer wants to e.g. show a helpful explanation of each opcode.

We currently only define the opcodes we need for Chronik, but we can add the remaining ones once we need (due to the missing_docs lint we'd have to write a doc comment for each of them, ugh).

Test Plan

ninja check-crates

Diff Detail

Repository
rABC Bitcoin ABC
Branch
chronik-opcode
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22825
Build 45270: Build Diffbuild-chronik
Build 45269: arc lint + arc unit