Sync ContractError bindings with contract errors and add error-code parity guard#95
Open
Josue19-08 wants to merge 2 commits into
Open
Conversation
… guard Add FutureOracleData (24) and PayoutOverflow (25) to the ContractError map in bindings/src/index.ts, completing coverage of all 25 on-chain error codes. Extend parity.js to parse and compare the errors.rs enum against the ContractError map, failing CI whenever a new contract error is added without a matching bindings entry.
Add the assert_no_active_round private helper that was called in create_round but never defined, returning RoundAlreadyActive when a round is already live. Remove the redundant checked_add assignment immediately shadowed by payout_add on the same binding. Fix inconsistent digit grouping flagged by clippy in overflow_tests.
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.
Summary
FutureOracleData(24) andPayoutOverflow(25) to theContractErrormap inbindings/src/index.ts, bringing bindings fully in sync with all 25 on-chain error codes defined inerrors.rs.parity.jsto parse theContractErrorenum fromerrors.rsand compare it against the bindings map, so CI fails whenever a new contract error is added without a matching bindings entry — preventing future drift.bindings/CHANGELOG.mdwith a[1.2.0]entry documenting both changes.Linked issues
Validation
cargo test --workspace— pre-existing compile error incontract.rs:116(assert_no_active_round→ unrelated to this PR, present onmainbefore this branch)cargo clippy --workspace --all-targets -- -D warningscargo fmt --all -- --checkcd bindings && npm ci && npm run buildcd bindings && node src/parity.js— ✅ passes with all 25 error codes syncedGovernance checklist
CONTRIBUTING.mdfor workflow expectationsCODEOWNERSimpact for touched pathsSUPPORT.mddisclosure guidance for any security-sensitive change