Add missing derivation checks

Change-Id: I615c5fc4fd737cdeb9bb4a118cdbfb8ef7abc5db
This commit is contained in:
Hendrik Hofstadt 2021-07-08 19:49:07 +02:00
parent 5afe6732f9
commit 2bfdc2fdc9
1 changed files with 12 additions and 0 deletions

View File

@ -136,6 +136,18 @@ pub fn upgrade_guardian_set(
_data: UpgradeGuardianSetData,
) -> Result<()> {
verify_claim(&accs.vaa)?;
accs.guardian_set_old.verify_derivation(
ctx.program_id,
&GuardianSetDerivationData {
index: accs.vaa.new_guardian_set_index - 1,
},
)?;
accs.guardian_set_new.verify_derivation(
ctx.program_id,
&GuardianSetDerivationData {
index: accs.vaa.new_guardian_set_index,
},
)?;
accs.vaa.claim(ctx, accs.payer.key)?;