Repository navigation
fix(contracts): add shared ABI fixture, sync error tables, and validate client signatures - #2072
Open
DeepDev69x3 wants to merge 1 commit into
Open
DeepDev69x3 wants to merge 1 commit into
DeepDev69x3 wants to merge 1 commit into
Conversation
…te client signatures
|
@DeepDev69x3 is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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
This PR resolves #2025 by introducing a canonical, committed JSON ABI fixture (
contracts/shared/payment_escrow.abi.json), synchronizing the TypeScriptContractErrortable with all contract error codes, adding automated ABI conformance tests in both Rust and the backend client, and validating parameter signatures.Closes #2025
Key Changes
Canonical Interface & ABI Fixture (
contracts/shared/payment_escrow.abi.json& backend fixture):payment_escrow(version 1).create,release,refund,release_partial,refund_remaining,get_status,get_escrow,initialize,version,upgrade,propose_admin,accept_admin,pause,unpause,is_paused) along with their input parameter names, types, and return types.TypeScript Error Enum & Table Synchronization (
contracts/shared/error-codes.ts&escrow-contract.client.ts):ContractErrorenum to cover all 14 contract error codes (includingAlreadyReleased = 6,AlreadyRefunded = 7,AlreadyInitialized = 10,NotInitialized = 11,Unauthorized = 12,Paused = 13,NoPendingAdmin = 14,AmountExceedsEscrow = 20,NothingToRefund = 21).CONTRACT_ERROR_NAMEStable for reliable client-side and backend mapping.buildCreateTxto optionally accept the 5thtokenAddressargument while retaining backward compatibility.Backend Client ABI Conformance Suite (
backend/src/payments/soroban/abi-fixture.spec.ts):EscrowContractClienttransaction builders (buildCreateTx,buildReleaseTx,buildRefundTx) generate invocations matching the fixture functions and argument counts.ContractErrorenum and the contract ABI fixture.Rust Contract ABI Synchronization Test (
contracts/payment_escrow/tests/abi_fixture_test.rs):VERSION,Errorenum variant codes, andEscrowStatevalues match the shared fixture.Verification & CI Proof
cargo test --workspace: 32/32 tests passing (100% green).cargo clippy --workspace --all-targets -- -D warnings: 0 warnings / 0 errors.cargo fmt --all -- --check: Passed.bash scripts/audit_require_auth.sh: All entrypoints passed auth check.npm test -- src/payments/soroban/: 10 test suites passed (86 tests passing, 0 errors).npm run lint&npm run build: 0 lint errors, build succeeded cleanly.