feat(token-mint-authority): add testnet faucet mint-authority program - #331
Merged
Conversation
0x-r4bbit
force-pushed
the
feat/token-minter
branch
3 times, most recently
from
August 27, 2026 07:35
66983e1 to
a813456
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The faucet currently lacks a critical ownership-consistency check before delegating the chained mint and also over-requests write access for the mint-authority PDA, both of which widen the attack surface.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new token_mint_authority program to the LEZ workspace: a permissionless, rate-limited testnet faucet that delegates a fixed mint to the Token Program using a mint-authority PDA seed, with both unit and zkVM integration test coverage.
Changes:
- Introduces
token_mint_authority_{core,program,methods,guest}crates implementingFaucetMint+ PDA-based cooldown tracking. - Adds unit + integration tests covering PDA derivation, chained mint behavior, and cooldown enforcement.
- Wires the new program into guest build scripts, workspace manifests/locks, IDL artifacts, and README docs.
File summaries
| File | Description |
|---|---|
| scripts/build-guests.sh | Include token_mint_authority in guest binary packaging. |
| scripts/build-guests.Dockerfile | Include token_mint_authority in Docker guest build loop. |
| README.md | Document the new program and update test/build/IDL examples. |
| Cargo.toml | Add new crates to workspace members and shared deps. |
| Cargo.lock | Lockfile updates for new crates/deps. |
| programs/token_mint_authority/src/lib.rs | New host crate entry module. |
| programs/token_mint_authority/src/faucet_mint.rs | Implements faucet mint host logic + clock read + chained mint. |
| programs/token_mint_authority/src/test_support.rs | Test account builders and constants. |
| programs/token_mint_authority/src/tests.rs | Unit tests for cooldown, PDAs, chained call shape, and preconditions. |
| programs/token_mint_authority/core/src/lib.rs | New core types/constants + PDA derivations + verification helpers. |
| programs/token_mint_authority/core/Cargo.toml | New core crate manifest. |
| programs/token_mint_authority/Cargo.toml | New host crate manifest + example deps. |
| programs/token_mint_authority/examples/mint_authority.rs | Helper to compute/print mint-authority PDA for a built binary. |
| programs/token_mint_authority/methods/build.rs | Embed guest methods via risc0_build. |
| programs/token_mint_authority/methods/Cargo.toml | Methods crate manifest. |
| programs/token_mint_authority/methods/src/lib.rs | Host-side embedded ELF constants include. |
| programs/token_mint_authority/methods/guest/Cargo.toml | Guest crate manifest. |
| programs/token_mint_authority/methods/guest/Cargo.lock | Guest lockfile. |
| programs/token_mint_authority/methods/guest/src/bin/token_mint_authority.rs | Guest entry wiring + FaucetMint instruction handler. |
| programs/integration_tests/Cargo.toml | Add token-mint-authority core/methods to integration tests. |
| programs/integration_tests/tests/token_mint_authority.rs | New zkVM E2E tests for faucet behavior. |
| artifacts/token_mint_authority-idl.json | New IDL for the faucet instruction/accounts. |
Review details
- Files reviewed: 20/22 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
3esmit
previously requested changes
Sep 2, 2026
A permissionless faucet that holds the mint authority for faucet token definitions and lets any account self-mint a fixed grant, so testers can fund themselves on testnet. The call chain is user -> token-mint-authority -> token: the program holds no key and delegates every mint to the token program under a PDA seed. - `FaucetMint` (no amount) mints a fixed 10_000e18 to the caller, at most once per 24h per (recipient, token definition), via a chained `Token::MintWithAuthority` authorized by the mint-authority PDA seed. - Rate limiting is a per-(recipient, definition) `MintAllowance` PDA (last-mint timestamp), claimed on first use and rewritten thereafter. - Wall-clock time is read from the system CLOCK_01 account, as the stablecoin program does. Setup: the faucet token must be created via the token program's `NewFungibleDefinition` with `mint_authority` set to `compute_mint_authority_pda(<program id>)`; the program refuses to mint a token whose stored authority is not its PDA.
0x-r4bbit
force-pushed
the
feat/token-minter
branch
from
September 8, 2026 12:09
33a8772 to
7a83193
Compare
0x-r4bbit
dismissed
3esmit’s stale review
September 8, 2026 12:21
Addressed all comments. Dismissing.
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.
A permissionless faucet that holds the mint authority for faucet token definitions and lets any account self-mint a fixed grant, so testers can fund themselves on testnet. The call chain is user -> token-mint-authority -> token: the program holds no key and delegates every mint to the token program under a PDA seed.
FaucetMint(no amount) mints a fixed 10_000e18 to the caller, at most once per 24h per (recipient, token definition), via a chainedToken::MintWithAuthorityauthorized by the mint-authority PDA seed.MintAllowancePDA (last-mint timestamp), claimed on first use and rewritten thereafter.Setup: the faucet token must be created via the token program's
NewFungibleDefinitionwithmint_authorityset tocompute_mint_authority_pda(<program id>); the program refuses to mint a token whose stored authority is not its PDA.