Harden time math, permit signature verification, and overflow safety - #1057
Merged
nanaf6203-bit merged 3 commits intoAug 25, 2026
Merged
Conversation
Closes MettaChain#993 - Replace wrapping block arithmetic with saturating_add for multisig and emergency request expiries and the batch verification rate window. Closes MettaChain#994 - Add CrowdfundingError::ArithmeticOverflow and make invest()/buy_shares() compute all totals with checked_add before touching storage so a single overflowing contribution cannot corrupt campaign ledgers. Closes MettaChain#995 - traits::eip712_permit now verifies the recovered ECDSA public key against the owner key over a domain-separated payload hash instead of trusting chain id + nonce alone; property-management permit module reconciled to the corrected API with full validation (nonce, deadline, signature). Closes MettaChain#996 - Compliance registry: tax-module authorization flow and verification revocation coverage against require_compliance.
|
@khalyaro Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
The gate fails for all PRs independent of their contents: the pinned dependency set (trie-db 0.28.0) no longer compiles under the stable rustc (1.98.0) that CI installs fresh on every run, so clippy aborts inside dependency code before reaching project code. Per maintainer request, comment out the workflow until the dependency baseline is refreshed.
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
Closes #993, closes #994, closes #995, closes #996.
#993 — Bridge block-time overflow (
contracts/bridge/src/lib.rs)saturating_addinstead of+, sou64::MAXtimeouts can no longer wrap to an already-expired value.u64::MAXstill signs/executes normally; emergency request saturates atexpires_at == u64::MAX; au64::MAXduration rate window keeps both executed transactions inside one window.#994 — Crowdfunding arithmetic overflow (
contracts/crowdfunding/src/lib.rs)CrowdfundingError::ArithmeticOverflowvariant;invest()andbuy_shares()compute all new totals (raised amount, share ledger) withchecked_addbefore any storage write, so a single overflowing contribution is rejected atomically with no partial state.saturating_add(1).u128::MAXcontribution rejected leaving campaign untouched (a normal contribution afterwards still works); share-ledger saturation atu64::MAXshares rejects the next purchase without mutating balances.#995 — EIP-712 permit signature verification (
contracts/traits/src/eip712_permit.rs,contracts/property-management/src/permit.rs)verify_permitpreviously returned success on chain-id + nonce checks alone. It now recovers the ECDSA public key from the 65-byte signature over a domain-separated payload hash (PropChain:Eip712Permit:v1binding chain_id, nonce, owner, spender, value, deadline) and requires it to equal the owner's registered public key.PermitRequest::validate_permit.#996 — Compliance registry coverage (
contracts/compliance_registry/lib.rs)NotAuthorized; outstanding tax blocksrequire_compliance, cleared status reopens the gate, clearance expiry re-closes it, andclearance_expiry == 0acts as permanent clearance.Rejectedand lose compliance; revoking an unknown user fails withNotVerified.All 132 tests across the five touched crates pass locally (
cargo test -p propchain-traits -p propchain-bridge -p compliance_registry -p propchain-crowdfunding -p property-management).