Repository navigation
fix(verify): pin verification reads to one block - #11
Merged
Merged
Conversation
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
marked this pull request as ready for review
November 23, 2026 19:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
blockIdstill 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