10 Commits

Author SHA1 Message Date
bristinWild
210e2f4ad7 fix(demo): align spel CLI args to IDL; remove b58_to_hex conversion 2026-07-02 01:25:13 +05:30
bristinWild
686a7d066a fix(token): owner-guard set_authority; align demo script to token IDL
Second review round on PR #125 (LP-0013):

- set_authority now rejects foreign-owned definitions. It takes the
  ProgramContext and asserts definition_account.program_owner ==
  self_program_id, matching mint and initialize_account. Without this a
  foreign-owned account with token-shaped data could have its authority
  field rewritten. Added test_set_authority_rejects_foreign_owned_definition.

- demo-full-flow.sh now calls instruction and flag names that exist in
  the regenerated token IDL: new-fungible-definition (was the nonexistent
  new-fungible-definition-with-authority), --total-supply (was
  --initial-supply), and drops --authority-account for the self-authority
  mint/set-authority path (the rest account is --authority-accounts and is
  empty when the definition is its own authority).

- Stripped a trailing-space lint nit in docs/LP-0013-README.md.
2026-07-02 01:20:32 +05:30
bristinWild
160ff8ee4a fix(token): support external mint authority; intentional metadata supply; demo path resolver
Addresses review on PR #125 (LP-0013):

#1 authority transfer now hands control to the new signer. mint and
set_authority take a trailing authority_accounts (Vec<AccountWithMetadata>):
empty preserves the original self/PDA-authority behavior (AMM unchanged),
one entry lets an external/rotated authority actually mint or rotate again.
Tests: rotated_authority_can_mint, rotated_authority_old_key_cannot_mint.

#2 metadata-backed fungibles take a real mint_authority instead of a
hardcoded Authority::renounced(), matching the plain-fungible supply model.
Test: test_metadata_fungible_with_authority_is_mintable.

#3 demo-full-flow.sh resolves TOKEN_BIN from the README-documented
cargo risczero build output, falling back to the workspace build, with an
explicit TOKEN_BIN override still respected.

Regenerated token-idl.json for the new trailing authority_accounts.
2026-07-02 01:20:32 +05:30
bristinWild
1c41d19a51 feat: reject all-zero mint authority; restore 7-step demo-full-flow.sh
- new_fungible_definition_with_authority rejects all-zero mint_authority (RFP-001 reliability)
- add test_new_fungible_definition_with_authority_rejects_zero_authority
- restore demo-full-flow.sh (had been overwritten with example content); now
  uses the correct account parsing, base58->hex authority, and --authority-account flag
- commit updated Cargo.lock files for the lez-authority dependency
2026-07-02 01:16:49 +05:30
bristinWild
175c9d256c refactor: gate mint/set_authority via lez-authority with explicit signer account 2026-07-02 01:15:03 +05:30
bristinWild
b561f91db2 fix: enforce mint authority key validation in mint and set_authority
- mint.rs: validate caller account_id matches stored mint_authority key
- set_authority.rs: validate caller matches mint_authority before rotation/revoke
- tests.rs: align AUTHORITY constant and fixtures to match account_id [15; 32]
- demo-full-flow.sh: fix --public flag, remove || true from spel commands,
  update test count to 60
2026-07-02 01:11:53 +05:30
bristinWild
481b34a5a3 fix: correct test count in demo script summary 2026-07-02 01:11:53 +05:30
bristinWild
dab552a0db fix: make demo script portable with configurable env vars 2026-07-02 01:11:53 +05:30
bristinWild
3ba6139b4c docs: add program ID, CU costs, CLI usage, SDK docs, fix demo script timeout 2026-07-02 01:11:53 +05:30
bristinWild
a8863ab7ea feat(LP-0013): add mint authority model to token program
- Add lez-authority crate: agnostic AuthoritySlot library (RFP-001)
- Add mint_authority field to TokenDefinition::Fungible
- Add NewFungibleDefinitionWithAuthority instruction
- Add SetAuthority instruction (rotation + permanent revocation)
- Update Mint to enforce authority guard
- Wire new instructions into guest binary
- Add 8 authority unit tests (53 total passing)
- Add LP-0013 README, IDL, demo script, and example scripts
2026-07-02 01:11:53 +05:30