Add Mesh API compatibility tests - #11
Conversation
Register the native RosettaBlockTracer, return its typed result, and preserve EVM revert semantics for synthetic balance logs.
Run pinned Coinbase Mesh CLI Data and Construction checks against both Harmony shards locally and in GitHub Actions while preserving Rosetta target aliases.
Greptile SummaryThe PR adds pinned Mesh CLI localnet integration coverage and restores a native Rosetta tracer for contract and staking balance operations.
Confidence Score: 4/5The PR should not merge until synthetic Rosetta log tracking correctly handles nested CREATE and CREATE2 frames. Nested contract creation can misalign the new frame stack, allowing a staking balance movement rolled back by a caught call revert to be reported as successful. Files Needing Attention: hmy/tracers/native/rosetta.go
|
| Filename | Overview |
|---|---|
| hmy/tracers/native/rosetta.go | Introduces the native Rosetta tracer, but its synthetic-log frame stack becomes misaligned after nested contract creation. |
| hmy/tracer.go | Returns the tracer's typed Rosetta result to internal service callers. |
| test/localnet.Dockerfile | Pins Mesh CLI v0.10.4 and safely rewrites checker logging while retaining pipeline failures. |
| test/localnet.sh | Adds Mesh mode while retaining Rosetta as a compatibility alias. |
| .github/workflows/ci-pr.yaml | Adds a dedicated amd64 Mesh API integration job using pinned test inputs. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Contract CALL begins] --> B[Staking precompile adds synthetic log]
B --> C[Nested CREATE pushes frame boundary]
C --> D[CREATE returns without CaptureExit]
D --> E[Contract CALL reverts]
E --> F[CALL exit pops CREATE boundary]
F --> G[Ancestor catches revert and transaction succeeds]
G --> H[Synthetic log remains successful]
H --> I[Incorrect Rosetta operation emitted]
Reviews (1): Last reviewed commit: "test: add Mesh API compatibility checks" | Re-trigger Greptile
| func (rbt *RosettaBlockTracer) CaptureEnter(_ vm.OpCode, _ common.Address, _ common.Address, _ []byte, _ uint64, _ *big.Int) { | ||
| rbt.frameStart = append(rbt.frameStart, len(rbt.logs)) | ||
| } | ||
|
|
||
| func (rbt *RosettaBlockTracer) CaptureExit(_ []byte, _ uint64, err error) { | ||
| rbt.markCurrentFrame(err) | ||
| } |
There was a problem hiding this comment.
Nested CREATE corrupts frame tracking
When a contract calls a staking precompile, subsequently executes CREATE or CREATE2, and then reverts while an ancestor catches the failure, the unmatched creation frame causes CaptureExit to pop the wrong synthetic-log boundary. The reverted staking movement remains marked successful and is emitted as a successful Rosetta operation, producing incorrect transaction data and potential reconciliation failures.
Summary
test-meshtargets and a dedicated GitHub Actions integration job while preserving the existing Rosetta targets as compatibility aliasesRosettaBlockTracerrequired by/block/transaction, including revert-aware synthetic staking balance logsharmony-testcheckout pinned and preserve checker failures throughteewithpipefailCoinbase renamed the project to Mesh CLI, but its latest official release,
v0.10.4, still installs the command asrosetta-cli. The Docker build uses that stable release rather than the unreleased binary rename from coinbase/mesh-cli#426.[Test]
make testgo test ./hmy/tracers/native ./hmy ./rosetta/servicesgo vet ./hmy/tracers/native ./hmy ./rosetta/servicesbash test/localnet_runner_test.shshellcheck test/localnet.sh test/mesh.sh test/localnet_runner_test.sh test/all.shactionlint .github/workflows/ci-pr.yamlv0.10.4smoke checks