mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-07-07 07:29:49 +00:00
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 account_id [15; 32] - integration_tests/token.rs: derive authority_key from Ids::token_definition() so stored key matches actual signer account ID; update all affected asserts - demo-full-flow.sh: fix --public flag, remove || true from spel commands, update test count to 60 60 unit tests + 16 integration tests passing (RISC0_DEV_MODE=1)
This commit is contained in:
parent
b561f91db2
commit
16738c7def
@ -61,7 +61,7 @@ impl Accounts {
|
|||||||
name: String::from("Gold"),
|
name: String::from("Gold"),
|
||||||
total_supply: 1_000_000_u128,
|
total_supply: 1_000_000_u128,
|
||||||
metadata_id: None,
|
metadata_id: None,
|
||||||
mint_authority: None,
|
mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()),
|
||||||
}),
|
}),
|
||||||
nonce: Nonce(0),
|
nonce: Nonce(0),
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ impl Accounts {
|
|||||||
name: String::from("Gold"),
|
name: String::from("Gold"),
|
||||||
total_supply: 1_000_000_u128,
|
total_supply: 1_000_000_u128,
|
||||||
metadata_id: None,
|
metadata_id: None,
|
||||||
mint_authority: None,
|
mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()),
|
||||||
}),
|
}),
|
||||||
nonce: Nonce(0),
|
nonce: Nonce(0),
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ fn token_burn() {
|
|||||||
name: String::from("Gold"),
|
name: String::from("Gold"),
|
||||||
total_supply: 800_000_u128,
|
total_supply: 800_000_u128,
|
||||||
metadata_id: None,
|
metadata_id: None,
|
||||||
mint_authority: None,
|
mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()),
|
||||||
}),
|
}),
|
||||||
nonce: Nonce(0),
|
nonce: Nonce(0),
|
||||||
}
|
}
|
||||||
@ -468,7 +468,7 @@ fn token_mint() {
|
|||||||
name: String::from("Gold"),
|
name: String::from("Gold"),
|
||||||
total_supply: 1_500_000_u128,
|
total_supply: 1_500_000_u128,
|
||||||
metadata_id: None,
|
metadata_id: None,
|
||||||
mint_authority: None,
|
mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()),
|
||||||
}),
|
}),
|
||||||
nonce: Nonce(1),
|
nonce: Nonce(1),
|
||||||
}
|
}
|
||||||
@ -590,7 +590,7 @@ fn token_mint_fresh_authorized_public_recipient() {
|
|||||||
name: String::from("Gold"),
|
name: String::from("Gold"),
|
||||||
total_supply: 1_500_000_u128,
|
total_supply: 1_500_000_u128,
|
||||||
metadata_id: None,
|
metadata_id: None,
|
||||||
mint_authority: None,
|
mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()),
|
||||||
}),
|
}),
|
||||||
nonce: Nonce(1),
|
nonce: Nonce(1),
|
||||||
}
|
}
|
||||||
@ -926,7 +926,7 @@ fn token_deshielded_transfer() {
|
|||||||
fn token_new_fungible_definition_with_authority() {
|
fn token_new_fungible_definition_with_authority() {
|
||||||
let mut state = V03State::new_with_genesis_accounts(&[], vec![], 0);
|
let mut state = V03State::new_with_genesis_accounts(&[], vec![], 0);
|
||||||
deploy_token(&mut state);
|
deploy_token(&mut state);
|
||||||
let authority_key = [9_u8; 32];
|
let authority_key: [u8; 32] = Ids::token_definition().as_ref().try_into().unwrap();
|
||||||
let instruction = token_core::Instruction::NewFungibleDefinitionWithAuthority {
|
let instruction = token_core::Instruction::NewFungibleDefinitionWithAuthority {
|
||||||
name: String::from("AuthCoin"),
|
name: String::from("AuthCoin"),
|
||||||
initial_supply: 1_000_000_u128,
|
initial_supply: 1_000_000_u128,
|
||||||
@ -965,7 +965,8 @@ fn token_new_fungible_definition_with_authority() {
|
|||||||
fn token_set_authority_revoke() {
|
fn token_set_authority_revoke() {
|
||||||
let mut state = V03State::new_with_genesis_accounts(&[], vec![], 0);
|
let mut state = V03State::new_with_genesis_accounts(&[], vec![], 0);
|
||||||
deploy_token(&mut state);
|
deploy_token(&mut state);
|
||||||
let authority_key = [9_u8; 32];
|
let authority_key: [u8; 32] = Ids::token_definition().as_ref().try_into().unwrap();
|
||||||
|
|
||||||
// Create token with authority
|
// Create token with authority
|
||||||
let instruction = token_core::Instruction::NewFungibleDefinitionWithAuthority {
|
let instruction = token_core::Instruction::NewFungibleDefinitionWithAuthority {
|
||||||
name: String::from("AuthCoin"),
|
name: String::from("AuthCoin"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user