Skip to content

Commit 4bd1552

Browse files
Fix VAA validation in test_authorize_governance_data_source_transfer
- Update AuthorizeGovernanceDataSourceTransfer parsing to consume entire remaining payload as claim_vaa - Change validation logic from current_index >= new_index to current_index > new_index to allow governance_data_source_index = 0 - Test now passes successfully after previously failing with InvalidGovernanceMessage Co-Authored-By: [email protected] <[email protected]>
1 parent 27ab032 commit 4bd1552

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

target_chains/stylus/contracts/pyth-receiver/src/governance_structs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ pub fn parse_instruction(payload: Vec<u8>) -> Result<GovernanceInstruction, Pyth
166166
}
167167
GovernanceAction::AuthorizeGovernanceDataSourceTransfer => {
168168
let claim_vaa = payload[cursor..].to_vec();
169+
cursor = payload.len();
169170
GovernancePayload::AuthorizeGovernanceDataSourceTransfer(
170171
AuthorizeGovernanceDataSourceTransfer { claim_vaa },
171172
)

target_chains/stylus/contracts/pyth-receiver/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ impl PythReceiver {
711711
let current_index = self.governance_data_source_index.get().to::<u32>();
712712
let new_index = request_payload.governance_data_source_index;
713713

714-
if current_index >= new_index {
714+
if current_index > new_index {
715715
return Err(PythReceiverError::OldGovernanceMessage);
716716
}
717717

0 commit comments

Comments
 (0)