Ver Fonte

fix(target_chains/fuel): upgrade to fuel testnet from beta-5 (#1625)

* upgrade libs and deps to latest

* fix more errors

* fix test

* fix test
Daniel Chew há 1 ano atrás
pai
commit
3513eed6c9
20 ficheiros alterados com 622 adições e 198 exclusões
  1. 496 62
      target_chains/fuel/contracts/Cargo.lock
  2. 1 1
      target_chains/fuel/contracts/Cargo.toml
  3. 17 17
      target_chains/fuel/contracts/Forc.lock
  4. 3 3
      target_chains/fuel/contracts/fuel-toolchain.toml
  5. 2 2
      target_chains/fuel/contracts/pyth-contract/Forc.toml
  6. 4 4
      target_chains/fuel/contracts/pyth-contract/src/data_structures/accumulator_update.sw
  7. 2 2
      target_chains/fuel/contracts/pyth-contract/src/data_structures/batch_attestation_update.sw
  8. 3 3
      target_chains/fuel/contracts/pyth-contract/src/data_structures/price.sw
  9. 1 1
      target_chains/fuel/contracts/pyth-contract/src/data_structures/update_type.sw
  10. 25 30
      target_chains/fuel/contracts/pyth-contract/src/data_structures/wormhole_light.sw
  11. 15 15
      target_chains/fuel/contracts/pyth-contract/src/events.sw
  12. 26 31
      target_chains/fuel/contracts/pyth-contract/src/main.sw
  13. 1 1
      target_chains/fuel/contracts/pyth-interface/Forc.toml
  14. 2 2
      target_chains/fuel/contracts/pyth-interface/src/data_structures/data_source.sw
  15. 5 5
      target_chains/fuel/contracts/pyth-interface/src/data_structures/governance_instruction.sw
  16. 6 6
      target_chains/fuel/contracts/pyth-interface/src/data_structures/governance_payload.sw
  17. 7 7
      target_chains/fuel/contracts/pyth-interface/src/data_structures/price.sw
  18. 2 2
      target_chains/fuel/contracts/pyth-interface/src/data_structures/wormhole_light.sw
  19. 3 3
      target_chains/fuel/contracts/src/pyth_utils.rs
  20. 1 1
      target_chains/fuel/contracts/tests/utils/setup.rs

Diff do ficheiro suprimidas por serem muito extensas
+ 496 - 62
target_chains/fuel/contracts/Cargo.lock


+ 1 - 1
target_chains/fuel/contracts/Cargo.toml

@@ -9,7 +9,7 @@ license = "Apache-2.0"
 [dependencies]
 rand = "0.8.5"
 base64 = "0.22"
-fuels = { version = "0.55", features = ["fuel-core-lib"] }
+fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
 tokio = { version = "1.12", features = ["rt", "macros"] }
 hex = "0.4.3"
 reqwest = "0.11.27"

+ 17 - 17
target_chains/fuel/contracts/Forc.lock

@@ -1,44 +1,44 @@
 [[package]]
 name = "core"
-source = "path+from-root-566CA1D5F8BEAFBF"
-
-[[package]]
-name = "ownership"
-source = "git+https://github.com/FuelLabs/sway-libs?tag=v0.18.0#8d196e9379463d4596ac582a20a84ed52ff58c69"
-dependencies = [
-    "src_5",
-    "std",
-]
+source = "path+from-root-E19CE48B3E858B72"
 
 [[package]]
 name = "pyth-contract"
 source = "member"
 dependencies = [
-    "ownership",
     "pyth_interface",
-    "src5",
+    "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae",
     "std",
+    "sway_libs",
 ]
 
 [[package]]
 name = "pyth_interface"
 source = "path+from-root-555D3D27A908977B"
 dependencies = [
-    "src5",
+    "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae",
     "std",
 ]
 
 [[package]]
-name = "src5"
-source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.3.3#4198b4b07449ad16104cc8a0501f3013670fdcfd"
+name = "standards"
+source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.4.3#6f63eb7dff2458a7d976184e565b5cbf26f61da2"
 dependencies = ["std"]
 
 [[package]]
-name = "src_5"
-source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.2.2#6989cf8224b0d8aabea62f3d3c648fc754948705"
+name = "standards"
+source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae"
 dependencies = ["std"]
 
 [[package]]
 name = "std"
-source = "git+https://github.com/fuellabs/sway?tag=v0.49.3#0dc6570377ee9c4a6359ade597fa27351e02a728"
+source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
 dependencies = ["core"]
+
+[[package]]
+name = "sway_libs"
+source = "git+https://github.com/FuelLabs/sway-libs?tag=v0.21.0#6a227ed34c86fe1ebd334dbdfeccf66c43e3915b"
+dependencies = [
+    "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.4.3#6f63eb7dff2458a7d976184e565b5cbf26f61da2",
+    "std",
+]

+ 3 - 3
target_chains/fuel/contracts/fuel-toolchain.toml

@@ -1,6 +1,6 @@
 [toolchain]
-channel = "beta-5"
+channel = "latest-aarch64-apple-darwin"
 
 [components]
-forc = "0.49.3"
-fuel-core = "0.22.4"
+forc = "0.60.0"
+fuel-core = "0.26.0"

+ 2 - 2
target_chains/fuel/contracts/pyth-contract/Forc.toml

@@ -5,6 +5,6 @@ license = "Apache-2.0"
 name = "pyth-contract"
 
 [dependencies]
-ownership = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.18.0" }
+sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.21.0" }
 pyth_interface = { path = "../pyth-interface" }
-src5 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" }
+standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.4" }

+ 4 - 4
target_chains/fuel/contracts/pyth-contract/src/data_structures/accumulator_update.sw

@@ -39,7 +39,7 @@ impl AccumulatorUpdate {
         require(trailing_header_size.is_some(), PythError::InvalidHeaderSize);
         // skip trailing headers and update type
         let offset = 8 + trailing_header_size.unwrap().as_u64();
-        require(self.data.len >= offset, PythError::InvalidUpdateDataLength);
+        require(self.data.len()  >= offset, PythError::InvalidUpdateDataLength);
         offset
     }
 }
@@ -53,7 +53,7 @@ impl AccumulatorUpdate {
 ) -> (u64, Bytes, u64, Bytes) {
         let encoded_offset = self.verify();
         let (_, slice) = self.data.split_at(encoded_offset);
-        let (encoded_slice, _) = slice.split_at(self.data.len - encoded_offset);
+        let (encoded_slice, _) = slice.split_at(self.data.len()  - encoded_offset);
         let mut offset = 0;
         let wormhole_proof_size = u16::from_be_bytes([encoded_slice.get(offset).unwrap(), encoded_slice.get(offset + 1).unwrap()]).as_u64();
         offset += 2;
@@ -80,7 +80,7 @@ impl AccumulatorUpdate {
         payload_offset += 20;
         require(
             payload_offset <= encoded_payload
-                .len,
+                .len(),
             PythError::InvalidPayloadLength,
         );
         let number_of_updates = encoded_slice.get(offset);
@@ -125,7 +125,7 @@ impl AccumulatorUpdate {
         }
         require(
             offset == encoded_data
-                .len,
+                .len(),
             PythError::InvalidUpdateDataLength,
         );
         (number_of_updates, updated_ids)

+ 2 - 2
target_chains/fuel/contracts/pyth-contract/src/data_structures/batch_attestation_update.sw

@@ -8,7 +8,7 @@ use std::{bytes::Bytes, hash::Hash};
 const BATCH_MAGIC: u32 = 0x50325748;
 
 pub struct BatchAttestationUpdate {
-    data: Bytes,
+    pub data: Bytes,
 }
 impl BatchAttestationUpdate {
     pub fn new(data: Bytes) -> Self {
@@ -87,7 +87,7 @@ pub fn parse_and_verify_batch_attestation_header(encoded_payload: Bytes) -> (u64
     index += 2;
     require(
         encoded_payload
-            .len == index + (attestation_size * number_of_attestations)
+            .len()  == index + (attestation_size * number_of_attestations)
             .as_u64(),
         PythError::InvalidPayloadLength,
     );

+ 3 - 3
target_chains/fuel/contracts/pyth-contract/src/data_structures/price.sw

@@ -28,7 +28,7 @@ impl Price {
 impl PriceFeedId {
     pub fn is_target(self, target_price_feed_ids: Vec<PriceFeedId>) -> bool {
         let mut i = 0;
-        while i < target_price_feed_ids.len {
+        while i < target_price_feed_ids.len()  {
             if target_price_feed_ids.get(i).unwrap() == self {
                 return true;
             }
@@ -38,7 +38,7 @@ impl PriceFeedId {
     }
     pub fn is_contained_within(self, output_price_feeds: Vec<PriceFeed>) -> bool {
         let mut i = 0;
-        while i < output_price_feeds.len {
+        while i < output_price_feeds.len()  {
             if output_price_feeds.get(i).unwrap().id == self {
                 return true;
             }
@@ -133,7 +133,7 @@ impl PriceFeed {
         offset += 8;
         require(
             offset <= encoded_price_feed
-                .len,
+                .len(),
             PythError::InvalidPriceFeedDataLength,
         );
         //convert publish_time from UNIX to TAI64

+ 1 - 1
target_chains/fuel/contracts/pyth-contract/src/data_structures/update_type.sw

@@ -16,7 +16,7 @@ pub enum UpdateType {
 impl UpdateType {
     pub fn determine_type(data: Bytes) -> Self {
         let (magic, _) = data.split_at(4); //TODO: Convert to u32 for comparison with const ACCUMULATOR_MAGIC. Use raw_ptr.read::<u32>()? Remove accumulator_magic_bytes()
-        if data.len > 4 && magic == accumulator_magic_bytes() {
+        if data.len()  > 4 && magic == accumulator_magic_bytes() {
             UpdateType::Accumulator(AccumulatorUpdate::new(data))
         } else {
             UpdateType::BatchAttestation((BatchAttestationUpdate::new(data)))

+ 25 - 30
target_chains/fuel/contracts/pyth-contract/src/data_structures/wormhole_light.sw

@@ -40,8 +40,8 @@ impl GuardianSet {
 }
 
 pub struct StorageGuardianSet {
-    expiration_time: u64,
-    keys: StorageKey<StorageVec<b256>>,
+    pub expiration_time: u64,
+    pub keys: StorageKey<StorageVec<b256>>,
 }
 
 impl StorageGuardianSet {
@@ -54,11 +54,11 @@ impl StorageGuardianSet {
 }
 
 pub struct GuardianSetUpgrade {
-    action: u8,
-    chain: u16,
-    module: b256,
-    new_guardian_set: StorageGuardianSet,
-    new_guardian_set_index: u32,
+    pub action: u8,
+    pub chain: u16,
+    pub module: b256,
+    pub new_guardian_set: StorageGuardianSet,
+    pub new_guardian_set_index: u32,
 }
 
 impl GuardianSetUpgrade {
@@ -106,13 +106,9 @@ impl GuardianSetUpgrade {
         index += 4;
         let guardian_length = encoded_upgrade.get(index).unwrap();
         index += 1;
-        let mut new_guardian_set = StorageGuardianSet::new(
+        let mut new_guardian_set: StorageGuardianSet = StorageGuardianSet::new(
             0,
-            StorageKey {
-                slot: sha256(("guardian_set_keys", new_guardian_set_index)),
-                offset: 0,
-                field_id: ZERO_B256,
-            },
+            StorageKey::<StorageVec<b256>>::new(sha256(("guardian_set_keys", new_guardian_set_index)), 0, ZERO_B256),
         );
         let mut i: u8 = 0;
         while i < guardian_length {
@@ -131,7 +127,7 @@ impl GuardianSetUpgrade {
         );
         require(
             encoded_upgrade
-                .len == index,
+                .len()  == index,
             WormholeError::InvalidGuardianSetUpgradeLength,
         );
         GuardianSetUpgrade::new(
@@ -222,25 +218,24 @@ impl GuardianSignature {
         require(
             recovered_signer
                 .is_ok() && recovered_signer
-                .unwrap()
-                .value == guardian_set_key,
+                .unwrap().bits() == guardian_set_key,
             WormholeError::SignatureInvalid,
         );
     }
 }
 
 pub struct WormholeVM {
-    version: u8,
-    guardian_set_index: u32,
-    governance_action_hash: b256,
+    pub version: u8,
+    pub guardian_set_index: u32,
+    pub governance_action_hash: b256,
     // signatures: Vec<GuardianSignature>, // Shown here to represent data layout of VM, but not needed
-    timestamp: u32,
-    nonce: u32,
-    emitter_chain_id: u16,
-    emitter_address: b256,
-    sequence: u64,
-    consistency_level: u8,
-    payload: Bytes,
+    pub timestamp: u32,
+    pub nonce: u32,
+    pub emitter_chain_id: u16,
+    pub emitter_address: b256,
+    pub sequence: u64,
+    pub consistency_level: u8,
+    pub payload: Bytes,
 }
 
 impl WormholeVM {
@@ -339,7 +334,7 @@ impl WormholeVM {
         let hash_index = index + (signers_length * 66);
         require(
             hash_index < encoded_vm
-                .len,
+                .len(),
             WormholeError::InvalidSignatureLength,
         );
         let (_, slice) = encoded_vm.split_at(hash_index);
@@ -435,7 +430,7 @@ impl WormholeVM {
             WormholeError::ConsistencyLevelIrretrievable,
         );
         index += 1;
-        require(index <= encoded_vm.len, WormholeError::InvalidPayloadLength);
+        require(index <= encoded_vm.len(), WormholeError::InvalidPayloadLength);
         let (_, payload) = encoded_vm.split_at(index);
         WormholeVM::new(
             version
@@ -485,7 +480,7 @@ impl WormholeVM {
         let hash_index = index + (signers_length * 66);
         require(
             hash_index < encoded_vm
-                .len,
+                .len(),
             WormholeError::InvalidSignatureLength,
         );
         let (_, slice) = encoded_vm.split_at(hash_index);
@@ -538,7 +533,7 @@ impl WormholeVM {
             WormholeError::ConsistencyLevelIrretrievable,
         );
         index += 1;
-        require(index <= encoded_vm.len, WormholeError::InvalidPayloadLength);
+        require(index <= encoded_vm.len(), WormholeError::InvalidPayloadLength);
         let (_, payload) = encoded_vm.split_at(index);
         WormholeVM::new(
             version

+ 15 - 15
target_chains/fuel/contracts/pyth-contract/src/events.sw

@@ -6,41 +6,41 @@ use pyth_interface::data_structures::{
 };
 
 pub struct ConstructedEvent {
-    guardian_set_index: u32,
+    pub guardian_set_index: u32,
 }
 
 pub struct NewGuardianSetEvent {
-    governance_action_hash: b256,
+    pub governance_action_hash: b256,
     // new_guardian_set: GuardianSet, // TODO: Uncomment when SDK supports logs with nested Vecs https://github.com/FuelLabs/fuels-rs/issues/1046
-    new_guardian_set_index: u32,
+    pub new_guardian_set_index: u32,
 }
 
 pub struct UpdatedPriceFeedsEvent {
-    updated_price_feeds: Vec<PriceFeedId>,
+    pub updated_price_feeds: Vec<PriceFeedId>,
 }
 
 pub struct ContractUpgradedEvent {
-    old_implementation: Identity,
-    new_implementation: Identity,
+    pub old_implementation: Identity,
+    pub new_implementation: Identity,
 }
 
 pub struct GovernanceDataSourceSetEvent {
-    old_data_source: DataSource,
-    new_data_source: DataSource,
-    initial_sequence: u64,
+    pub old_data_source: DataSource,
+    pub new_data_source: DataSource,
+    pub initial_sequence: u64,
 }
 
 pub struct DataSourcesSetEvent {
-    old_data_sources: Vec<DataSource>,
-    new_data_sources: Vec<DataSource>,
+    pub old_data_sources: Vec<DataSource>,
+    pub new_data_sources: Vec<DataSource>,
 }
 
 pub struct FeeSetEvent {
-    old_fee: u64,
-    new_fee: u64,
+    pub old_fee: u64,
+    pub new_fee: u64,
 }
 
 pub struct ValidPeriodSetEvent {
-    old_valid_period: u64,
-    new_valid_period: u64,
+    pub old_valid_period: u64,
+    pub new_valid_period: u64,
 }

+ 26 - 31
target_chains/fuel/contracts/pyth-contract/src/main.sw

@@ -7,11 +7,11 @@ mod data_structures;
 mod events;
 
 use std::{
+    asset_id::AssetId,
     block::timestamp,
     bytes::Bytes,
     call_frames::msg_asset_id,
     constants::{
-        BASE_ASSET_ID,
         ZERO_B256,
     },
     context::msg_amount,
@@ -24,7 +24,6 @@ use std::{
         storage_map::StorageMap,
         storage_vec::*,
     },
-    u256::U256,
     revert::revert,
 };
 
@@ -60,8 +59,8 @@ use pyth_interface::{
     WormholeGuardians,
 };
 
-use ownership::*;
-use src5::{SRC5, State};
+use sway_libs::ownership::*;
+use standards::src5::{SRC5, State};
 
 configurable {
     DEPLOYER: Identity = Identity::Address(Address::from(ZERO_B256)),
@@ -150,16 +149,16 @@ impl PythCore for Contract {
         update_data: Vec<Bytes>,
     ) -> Vec<PriceFeed> {
         require(
-            msg_asset_id() == BASE_ASSET_ID,
+            msg_asset_id() == AssetId::base(),
             PythError::FeesCanOnlyBePaidInTheBaseAsset,
         );
 
         let required_fee = update_fee(update_data);
         require(msg_amount() >= required_fee, PythError::InsufficientFee);
 
-        let mut output_price_feeds: Vec<PriceFeed> = Vec::with_capacity(target_price_feed_ids.len);
+        let mut output_price_feeds: Vec<PriceFeed> = Vec::with_capacity(target_price_feed_ids.len());
         let mut i = 0;
-        while i < update_data.len {
+        while i < update_data.len()  {
             let data = update_data.get(i).unwrap();
 
             match UpdateType::determine_type(data) {
@@ -195,7 +194,7 @@ impl PythCore for Contract {
 
                         i_2 += 1;
                     }
-                    require(offset == encoded.len, PythError::InvalidUpdateDataLength);
+                    require(offset == encoded.len(), PythError::InvalidUpdateDataLength);
                 },
                 UpdateType::BatchAttestation(batch_attestation_update) => {
                     let vm = WormholeVM::parse_and_verify_pyth_vm(
@@ -248,8 +247,8 @@ impl PythCore for Contract {
 
         require(
             target_price_feed_ids
-                .len == output_price_feeds
-                .len,
+                .len()  == output_price_feeds
+                .len(),
             PythError::PriceFeedNotFoundWithinRange,
         );
 
@@ -289,13 +288,13 @@ impl PythCore for Contract {
     ) {
         require(
             price_feed_ids
-                .len == publish_times
-                .len,
+                .len()  == publish_times
+                .len(),
             PythError::LengthOfPriceFeedIdsAndPublishTimesMustMatch,
         );
 
         let mut i = 0;
-        while i < price_feed_ids.len {
+        while i < price_feed_ids.len()  {
             if latest_publish_time(price_feed_ids.get(i).unwrap()) < publish_times.get(i).unwrap()
             {
                 update_price_feeds(update_data);
@@ -356,7 +355,7 @@ fn price_unsafe(price_feed_id: PriceFeedId) -> Price {
 fn update_fee(update_data: Vec<Bytes>) -> u64 {
     let mut total_number_of_updates = 0;
     let mut i = 0;
-    while i < update_data.len {
+    while i < update_data.len()  {
         let data = update_data.get(i).unwrap();
 
         match UpdateType::determine_type(data) {
@@ -379,7 +378,7 @@ fn update_fee(update_data: Vec<Bytes>) -> u64 {
 #[storage(read, write), payable]
 fn update_price_feeds(update_data: Vec<Bytes>) {
     require(
-        msg_asset_id() == BASE_ASSET_ID,
+        msg_asset_id() == AssetId::base(),
         PythError::FeesCanOnlyBePaidInTheBaseAsset,
     );
 
@@ -387,7 +386,7 @@ fn update_price_feeds(update_data: Vec<Bytes>) {
 
     // let mut updated_price_feeds: Vec<PriceFeedId> = Vec::new(); // TODO: requires append for Vec
     let mut i = 0;
-    while i < update_data.len {
+    while i < update_data.len()  {
         let data = update_data.get(i).unwrap();
 
         match UpdateType::determine_type(data) {
@@ -492,10 +491,10 @@ impl PythInit for Contract {
         // This function ensures that the sender is the owner. https://github.com/FuelLabs/sway-libs/blob/8045a19e3297599750abdf6300c11e9927a29d40/libs/src/ownership.sw#L59-L65
         only_owner();
 
-        require(data_sources.len > 0, PythError::InvalidDataSourcesLength);
+        require(data_sources.len()  > 0, PythError::InvalidDataSourcesLength);
 
         let mut i = 0;
-        while i < data_sources.len {
+        while i < data_sources.len() {
             let data_source = data_sources.get(i).unwrap();
             storage.is_valid_data_source.insert(data_source, true);
             storage.valid_data_sources.push(data_source);
@@ -512,11 +511,7 @@ impl PythInit for Contract {
         let guardian_length: u8 = wormhole_guardian_set_addresses.len().try_as_u8().unwrap();
         let mut new_guardian_set = StorageGuardianSet::new(
             0,
-            StorageKey {
-                slot: sha256(("guardian_set_keys", wormhole_guardian_set_index)),
-                offset: 0,
-                field_id: ZERO_B256,
-            },
+            StorageKey::<StorageVec<b256>>::new(sha256(("guardian_set_keys", wormhole_guardian_set_index)), 0, ZERO_B256),
         );
         let mut i: u8 = 0;
         while i < guardian_length {
@@ -646,7 +641,7 @@ fn governance_action_is_consumed(governance_action_hash: b256) -> bool {
 
 #[storage(read, write)]
 fn submit_new_guardian_set(encoded_vm: Bytes) {
-    let vm = WormholeVM::parse_and_verify_wormhole_vm(
+    let vm: WormholeVM = WormholeVM::parse_and_verify_wormhole_vm(
         current_guardian_set_index(),
         encoded_vm,
         storage
@@ -656,7 +651,7 @@ fn submit_new_guardian_set(encoded_vm: Bytes) {
         vm.guardian_set_index == current_guardian_set_index(),
         WormholeError::NotSignedByCurrentGuardianSet,
     );
-    let current_wormhole_provider = current_wormhole_provider();
+    let current_wormhole_provider: DataSource = current_wormhole_provider();
     require(
         vm.emitter_chain_id == current_wormhole_provider
             .chain_id,
@@ -672,8 +667,8 @@ fn submit_new_guardian_set(encoded_vm: Bytes) {
         WormholeError::GovernanceActionAlreadyConsumed,
     );
 
-    let current_guardian_set_index = current_guardian_set_index();
-    let upgrade = GuardianSetUpgrade::parse_encoded_upgrade(current_guardian_set_index, vm.payload);
+    let current_guardian_set_index: u32 = current_guardian_set_index();
+    let upgrade: GuardianSetUpgrade = GuardianSetUpgrade::parse_encoded_upgrade(current_guardian_set_index, vm.payload);
 
     storage
         .wormhole_consumed_governance_actions
@@ -708,7 +703,7 @@ fn authorize_governance_data_source_transfer(payload: AuthorizeGovernanceDataSou
     let old_governance_data_source = governance_data_source();
 
     // Parse and verify the VAA contained in the payload to ensure it's valid and can manage the contract
-    let vm = WormholeVM::parse_and_verify_wormhole_vm(
+    let vm: WormholeVM = WormholeVM::parse_and_verify_wormhole_vm(
         current_guardian_set_index(),
         payload.claim_vaa,
         storage.wormhole_guardian_sets,
@@ -750,7 +745,7 @@ fn set_data_sources(payload: SetDataSourcesPayload) {
     let old_data_sources = storage.valid_data_sources.load_vec();
 
     let mut i = 0;
-    while i < old_data_sources.len {
+    while i < old_data_sources.len()  {
         let data_source = old_data_sources.get(i).unwrap();
         storage.is_valid_data_source.insert(data_source, false);
         i += 1;
@@ -761,7 +756,7 @@ fn set_data_sources(payload: SetDataSourcesPayload) {
 
     i = 0;
     // Add new data sources from the payload and mark them as valid
-    while i < payload.data_sources.len {
+    while i < payload.data_sources.len()  {
         let data_source = payload.data_sources.get(i).unwrap();
         storage.valid_data_sources.push(data_source);
         storage.is_valid_data_source.insert(data_source, true);
@@ -869,7 +864,7 @@ impl PythGovernance for Contract {
 
 #[storage(read, write)]
 fn verify_governance_vm(encoded_vm: Bytes) -> WormholeVM {
-    let vm = WormholeVM::parse_and_verify_wormhole_vm(
+    let vm: WormholeVM = WormholeVM::parse_and_verify_wormhole_vm(
         current_guardian_set_index(),
         encoded_vm,
         storage

+ 1 - 1
target_chains/fuel/contracts/pyth-interface/Forc.toml

@@ -5,4 +5,4 @@ license = "Apache-2.0"
 name = "pyth_interface"
 
 [dependencies]
-src5 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" }
+standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.4" }

+ 2 - 2
target_chains/fuel/contracts/pyth-interface/src/data_structures/data_source.sw

@@ -1,6 +1,6 @@
 library;
 
 pub struct DataSource {
-    chain_id: u16,
-    emitter_address: b256,
+    pub chain_id: u16,
+    pub emitter_address: b256,
 }

+ 5 - 5
target_chains/fuel/contracts/pyth-interface/src/data_structures/governance_instruction.sw

@@ -3,11 +3,11 @@ library;
 use std::bytes::Bytes;
 
 pub struct GovernanceInstruction {
-    magic: u32,
-    module: GovernanceModule,
-    action: GovernanceAction,
-    target_chain_id: u16,
-    payload: Bytes,
+    pub magic: u32,
+    pub module: GovernanceModule,
+    pub action: GovernanceAction,
+    pub target_chain_id: u16,
+    pub payload: Bytes,
 }
 
 pub enum GovernanceModule {

+ 6 - 6
target_chains/fuel/contracts/pyth-interface/src/data_structures/governance_payload.sw

@@ -5,25 +5,25 @@ use std::bytes::Bytes;
 use ::data_structures::data_source::DataSource;
 
 pub struct UpgradeContractPayload {
-    new_implementation: Identity,
+    pub new_implementation: Identity,
 }
 
 pub struct AuthorizeGovernanceDataSourceTransferPayload {
-    claim_vaa: Bytes,
+    pub claim_vaa: Bytes,
 }
 
 pub struct RequestGovernanceDataSourceTransferPayload {
-    governance_data_source_index: u32,
+    pub governance_data_source_index: u32,
 }
 
 pub struct SetDataSourcesPayload {
-    data_sources: Vec<DataSource>,
+    pub data_sources: Vec<DataSource>,
 }
 
 pub struct SetFeePayload {
-    new_fee: u64,
+    pub new_fee: u64,
 }
 
 pub struct SetValidPeriodPayload {
-    new_valid_period: u64,
+    pub new_valid_period: u64,
 }

+ 7 - 7
target_chains/fuel/contracts/pyth-interface/src/data_structures/price.sw

@@ -10,15 +10,15 @@ library;
 // to how this price safely.
 pub struct Price {
     // Confidence interval around the price
-    confidence: u64,
+    pub confidence: u64,
     // Price exponent
     // This value represents the absolute value of an i32 in the range -255 to 0. Values other than 0, should be considered negative:
     // exponent of 5 means the Pyth Price exponent was -5
-    exponent: u32,
+    pub exponent: u32,
     // Price
-    price: u64,
+    pub price: u64,
     // The TAI64 timestamp describing when the price was published
-    publish_time: u64,
+    pub publish_time: u64,
 }
 
 // The `PriceFeedId` type is an alias for `b256` that represents the id for a specific Pyth price feed.
@@ -27,9 +27,9 @@ pub type PriceFeedId = b256;
 // PriceFeed represents a current aggregate price from Pyth publisher feeds.
 pub struct PriceFeed {
     // Latest available exponentially-weighted moving average price
-    ema_price: Price,
+    pub ema_price: Price,
     // The price ID.
-    id: PriceFeedId,
+    pub id: PriceFeedId,
     // Latest available price
-    price: Price,
+    pub price: Price,
 }

+ 2 - 2
target_chains/fuel/contracts/pyth-interface/src/data_structures/wormhole_light.sw

@@ -1,6 +1,6 @@
 library;
 
 pub struct GuardianSet {
-    expiration_time: u64,
-    keys: Vec<b256>,
+    pub expiration_time: u64,
+    pub keys: Vec<b256>,
 }

+ 3 - 3
target_chains/fuel/contracts/src/pyth_utils.rs

@@ -214,7 +214,7 @@ impl Pyth {
                 wormhole_guardian_set_index,
                 chain_id,
             )
-            .with_tx_policies(TxPolicies::default().with_gas_price(1))
+            .with_tx_policies(TxPolicies::default().with_tip(1))
             .call()
             .await
     }
@@ -223,7 +223,7 @@ impl Pyth {
         let mut rng = rand::thread_rng();
         let salt = rng.gen::<[u8; 32]>();
         let configurables = PythOracleContractConfigurables::default()
-            .with_DEPLOYER(Identity::Address(Address::from(wallet.address())));
+            .with_DEPLOYER(Identity::Address(Address::from(wallet.address())))?;
         let config = LoadConfiguration::default().with_configurables(configurables);
 
         let id = Contract::load_from(
@@ -232,7 +232,7 @@ impl Pyth {
         )?;
         let deployed_contract = id
             .with_salt(salt)
-            .deploy(&wallet, TxPolicies::default().with_gas_price(1))
+            .deploy(&wallet, TxPolicies::default().with_tip(1))
             .await?;
 
         Ok(Self {

+ 1 - 1
target_chains/fuel/contracts/tests/utils/setup.rs

@@ -19,7 +19,7 @@ pub(crate) async fn setup_environment() -> Result<(ContractId, Pyth), Error> {
 
     let deployer_wallet = wallets
         .pop()
-        .ok_or_else(|| Error::WalletError("No deployer wallet found".to_string()))?;
+        .ok_or_else(|| Error::Other("No deployer wallet found".to_string()))?;
 
     let pyth = Pyth::deploy(deployer_wallet).await?;
 

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff