Jayant Krishnamurthy vor 2 Jahren
Ursprung
Commit
927c8dbde1
2 geänderte Dateien mit 9 neuen und 11 gelöschten Zeilen
  1. 0 8
      cosmwasm/contracts/pyth/src/contract.rs
  2. 9 3
      cosmwasm/contracts/pyth/src/state.rs

+ 0 - 8
cosmwasm/contracts/pyth/src/contract.rs

@@ -155,7 +155,6 @@ fn execute_governance_instruction(
     _info: MessageInfo,
     data: &Binary,
 ) -> StdResult<Response> {
-    println!("here");
     let vaa = parse_vaa(deps.branch(), env.block.time.seconds(), data)?;
     let state = config_read(deps.storage).load()?;
 
@@ -168,14 +167,11 @@ fn execute_governance_instruction(
     } else {
         updated_config.governance_sequence_number = vaa.sequence;
     }
-    println!("trying to deserialize payload");
 
     let data = &vaa.payload;
     let instruction = GovernanceInstruction::deserialize(&data[..])
         .map_err(|_| PythContractError::InvalidGovernancePayload)?;
 
-    println!("Deserialized {instruction:?}");
-
     if instruction.target_chain_id != state.chain_id && instruction.target_chain_id != 0 {
         return Err(PythContractError::InvalidGovernancePayload)?;
     }
@@ -191,8 +187,6 @@ fn execute_governance_instruction(
                 GovernanceInstruction::deserialize(parsed_claim_vaa.payload.as_slice())
                     .map_err(|_| PythContractError::InvalidGovernancePayload)?;
 
-            println!("claim VAA instruction: {claim_vaa_instruction:?}");
-
             if claim_vaa_instruction.target_chain_id != state.chain_id
                 && claim_vaa_instruction.target_chain_id != 0
             {
@@ -234,8 +228,6 @@ fn execute_governance_instruction(
             }
         }
         SetDataSources { data_sources } => {
-            println!("setting data sources");
-
             updated_config.data_sources = HashSet::from_iter(data_sources.iter().cloned());
 
             Response::new()

+ 9 - 3
cosmwasm/contracts/pyth/src/state.rs

@@ -37,16 +37,22 @@ pub struct PythDataSource {
     pub pyth_emitter_chain: u16,
 }
 
-// Guardian set information
 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
 pub struct ConfigInfo {
     pub owner:                      Addr,
     pub wormhole_contract:          Addr,
     pub data_sources:               HashSet<PythDataSource>,
     pub governance_source:          PythDataSource,
-    // Incrementing index for the number of times the governance data source has been changed
+    // Index for preventing replay attacks on governance data source transfers.
+    // This index increases every time the governance data source is changed, which prevents old
+    // transfer request VAAs from being replayed.
     pub governance_source_index:    u32,
-    // The wormhole sequence number for governance messages
+    // The wormhole sequence number for governance messages. This value is increased every time the
+    // a governance instruction is executed.
+    //
+    // This field differs from the one above in that it is generated by wormhole and applicable to all
+    // governance messages, whereas the one above is generated by Pyth and only applicable to governance
+    // source transfers.
     pub governance_sequence_number: u64,
     // FIXME: This id needs to agree with the wormhole chain id.
     // We should read this directly from wormhole.