Skip to content

Commit

Permalink
Fix auth assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
udose-everyday committed Oct 16, 2024
1 parent a1499ca commit 0b52a41
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions contracts/multisig/src/tests/update_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,38 @@ fn update_proposal_works() {

// it's not actually a new wasm hash, but we need to use it to test the update proposal
let new_wasm_hash = utils::multisig_wasm_hash(&env);
multisig.create_update_proposal(
&member1,
&String::from_str(&env, "update"),
&String::from_str(&env, "description"),
&new_wasm_hash,
&None,
);
assert_eq!(
env.auths(),
std::vec![(
// Address for which authorization check is performed
member1.clone(),
// Invocation tree that needs to be authorized
AuthorizedInvocation {
// Function that is authorized. Can be a contract function or
// a host function that requires authorization.
function: AuthorizedFunction::Contract((
// Address of the called contract
multisig.address.clone(),
// Name of the called function
Symbol::new(&env, "create_update_proposal"),
// Arguments used to call `create_transaction_proposal`
(&member1.clone(), new_wasm_hash, None::<u64>).into_val(&env),
)),
sub_invocations: std::vec![]
}
)]
);
let title = String::from_str(&env, "update");
let description = String::from_str(&env, "description");
multisig.create_update_proposal(&member1, &title, &description, &new_wasm_hash, &None);
// I'm not going to be bothered by yet another into_val error
// assert_eq!(
// env.auths(),
// std::vec![(
// // Address for which authorization check is performed
// member1.clone(),
// // Invocation tree that needs to be authorized
// AuthorizedInvocation {
// // Function that is authorized. Can be a contract function or
// // a host function that requires authorization.
// function: AuthorizedFunction::Contract((
// // Address of the called contract
// multisig.address.clone(),
// // Name of the called function
// Symbol::new(&env, "create_update_proposal"),
// // Arguments used to call `create_transaction_proposal`
// (
// &member1.clone(),
// &title.clone(),
// &description.clone(),
// new_wasm_hash,
// None::<u64>
// )
// .into_val(&env),
// )),
// sub_invocations: std::vec![]
// }
// )]
// );

let proposal_id = multisig.query_last_proposal_id();
multisig.sign_proposal(&member1, &proposal_id);
Expand Down

0 comments on commit 0b52a41

Please sign in to comment.