Fees without governance key should fail

Change-Id: I0185db0e8f2c36c08973ca368b9a8ee176534117
This commit is contained in:
Reisen 2021-07-07 08:48:37 +00:00
parent 2bfdc2fdc9
commit 8770bf7997
1 changed files with 42 additions and 0 deletions

View File

@ -623,6 +623,48 @@ fn test_set_fees(context: &mut Context) {
}
}
fn test_set_fees_fails(context: &mut Context) {
// Initialize a wormhole bridge on Solana to test with.
let (ref payer, ref client, ref program) = common::setup();
// Use a random key to confirm only the governance key is respected.
let emitter = Keypair::new();
let sequence = context.seq.next(emitter.pubkey().to_bytes());
let nonce = rand::thread_rng().gen();
let message = GovernancePayloadSetMessageFee {
fee: U256::from(100),
persisted_fee: U256::from(100),
}
.try_to_vec()
.unwrap();
let message_key = common::post_message(
client,
program,
payer,
&emitter,
nonce,
message.clone(),
10_000,
false,
)
.unwrap();
let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1);
common::verify_signatures(client, program, payer, body, body_hash, &context.secret, 1).unwrap();
common::post_vaa(client, program, payer, vaa).unwrap();
assert!(common::set_fees(
client,
program,
payer,
message_key,
emitter.pubkey(),
sequence,
).is_err());
common::sync(client, payer);
}
fn test_transfer_fees(context: &mut Context) {
// Initialize a wormhole bridge on Solana to test with.
let (ref payer, ref client, ref program) = common::setup();