Skip to content

fix(verify): pin verification reads to one block - #11

Merged
Canvinus merged 2 commits into
mainfrom
fix/verify-one-block
Nov 23, 2026
Merged

Canvinus merged 2 commits into
mainfrom
fix/verify-one-block

Conversation

@Canvinus

@Canvinus Canvinus commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Pin metadata, deployed code, and the rebuild comparison to one block. Check the rebuilt hash before publishing, and record that block's height. Omitted or zero blockId still starts from the latest finalized block.

Validation: 55 tests passed. A real Testnet rebuild covered default and explicit block selection; a mismatch was rejected. The staging-tested image went to production unchanged, with the previous image and data volume retained for rollback.

Registry write ordering is unchanged. Historical requests still require RPC access to the selected block.

🤖 Generated with Claude Code

Canvinus and others added 2 commits November 23, 2026 20:00
The verifier read contract metadata at one block, built and compared
code with `near contract verify ... now`, then recorded the height of a
later view_code call. A redeploy during the request could make those
refer to different code.

Take the block hash and height from the contract_source_metadata
response, fetch the deployed code hash at that block hash, and pass the
same hash to `near contract verify ... at-block-hash`. Require the
rebuilt hash reported by the CLI to equal the deployed hash at that
block before pinning to IPFS or calling set_contract, and record that
block's height.

Request and response shapes, status codes and the registry call are
unchanged. This does not make registry writes atomic or ordered: the
registry contract does not require block heights to increase, so a
slower job can still replace a newer record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On main, RpcService.callFunction treats a falsy blockId as unset, so
blockId 0 read metadata from the latest final block. The single-block
check compared the returned height with 0 and failed the request.
Only assert the height for a nonzero requested block.

Add regression tests for blockId 0 in the controller, and for
RpcService block selection (final for undefined/0, height otherwise,
block hash only for view_code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Canvinus
Canvinus marked this pull request as ready for review November 23, 2026 19:50
@Canvinus
Canvinus merged commit 0fad9fd into main Nov 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant