Add Dusk contract standards and Forge reference contracts#24
Open
Add Dusk contract standards and Forge reference contracts#24
Conversation
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.
Adds a Dusk-native standards layer inspired by OpenZeppelin, but shaped around Dusk contract semantics instead of EVM compatibility.
This includes:
Security Model
The standards layer explicitly distinguishes between:
msg.senderand therefore use explicit signed authorizationsSigned actions bind:
The higher-level authorization helpers verify the full action envelope before consuming nonces, so failed authorization paths should not advance replay state.
Validation
The PR includes a large number of invariant tests, as well as fuzz/smoke tests for data-drivers and VM deploy/query tests.
Passed locally:
cargo fmt --checkgit diff --checkbash -n scripts/dusk-contract-standards-local-smoke.sh scripts/dusk-contract-standards-audit-grade.shcargo clippy -p dusk-contract-standards --all-targets -- -D warningscargo test -p dusk-contract-standardsAdditional validation done outside of the test suite:
https://testnet.nodes.dusk.networkThe testnet smoke covered deploys plus positive and negative action flows for Phoenix auth, Moonlight auth, DRC20, DRC721, proxy admin and 2-of-3 multisig-governed proxy execution.
Prerelease Dependency Note
This is an early review PR before all supporting Aegis/Forge packages are published.
The branch currently depends on local prerelease checkouts:
../rusk-privatedusk-coredusk-data-driverdusk-vmdusk-wallet-corerusk-profilerusk-prover../forge-explicit-emits#[contract(emits = ...)]Once those packages are released, this PR should be updated to published versions before final merge/release.
Review Focus
Please review especially:
Auditor facing documentation can be found here to help in the process of conducting a full security review: https://github.com/dusk-network/contracts/blob/d2ca6e48e3af233d6610437dc89216b5ecf9ae3b/docs/dusk-contract-standards-audit.md