Skip to content

Commit 10e5345

Browse files
committed
cleaned le to be switch
1 parent 57a2485 commit 10e5345

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

target_chains/fuel/contracts/pyth-contract/src/main.sw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ use src5::{SRC5, State};
5858

5959
const GUARDIAN_SET_EXPIRATION_TIME_SECONDS: u64 = 86400; // 24 hours in seconds
6060
configurable {
61-
DEPLOYER: Identity = Identity::Address(Address::from(ZERO_B256)),
61+
DEPLOYER: Identity = Identity::Address(Address::from(b256::zero())),
6262
}
6363

6464
storage {
@@ -209,7 +209,7 @@ impl PythCore for Contract {
209209
while i_2 < number_of_attestations {
210210
let (_, slice) = vm.payload.split_at(attestation_index + 32);
211211
let (price_feed_id, _) = slice.split_at(32);
212-
let price_feed_id: PriceFeedId = b256::from_le_bytes(price_feed_id.clone());
212+
let price_feed_id: PriceFeedId = b256::from_be_bytes(price_feed_id.clone());
213213

214214
if price_feed_id.is_target(target_price_feed_ids) == false {
215215
attestation_index += attestation_size_u16;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl GovernanceInstruction {
139139
index += 2;
140140
let (_, slice) = encoded_payload.split_at(index);
141141
let (slice, _) = slice.split_at(32);
142-
let emitter_address: b256 = b256::from_le_bytes(slice.clone());
142+
let emitter_address: b256 = b256::from_be_bytes(slice.clone());
143143
index += 32;
144144

145145
data_sources.push(DataSource {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl PriceFeed {
9999
let mut offset = 1u64;
100100
let (_, slice) = encoded_price_feed.split_at(offset);
101101
let (price_feed_id, _) = slice.split_at(32);
102-
let price_feed_id: PriceFeedId = b256::from_le_bytes(price_feed_id.clone());
102+
let price_feed_id: PriceFeedId = b256::from_be_bytes(price_feed_id.clone());
103103
offset += 32;
104104
let price = u64::from_be_bytes([
105105
encoded_price_feed.get(offset).unwrap(),
@@ -186,7 +186,7 @@ impl PriceFeed {
186186
let mut attestation_index = index + 32;
187187
let (_, slice) = encoded_payload.split_at(attestation_index);
188188
let (price_feed_id, _) = slice.split_at(32);
189-
let price_feed_id: PriceFeedId = b256::from_le_bytes(price_feed_id.clone());
189+
let price_feed_id: PriceFeedId = b256::from_be_bytes(price_feed_id.clone());
190190
attestation_index += 32;
191191
let mut price = u64::from_be_bytes([
192192
encoded_payload.get(attestation_index).unwrap(),

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl GuardianSetUpgrade {
8686
let mut index = 0;
8787
let (_, slice) = encoded_upgrade.split_at(index);
8888
let (module, _) = slice.split_at(32);
89-
let module: b256 = b256::from_le_bytes(module.clone());
89+
let module: b256 = b256::from_be_bytes(module.clone());
9090
require(module == UPGRADE_MODULE, WormholeError::InvalidModule);
9191
index += 32;
9292
let action = encoded_upgrade.get(index).unwrap();
@@ -115,7 +115,7 @@ impl GuardianSetUpgrade {
115115
while i < guardian_length {
116116
let (_, slice) = encoded_upgrade.split_at(index);
117117
let (key, _) = slice.split_at(20);
118-
let key: b256 = b256::from_le_bytes(key.clone());
118+
let key: b256 = b256::from_be_bytes(key.clone());
119119
new_guardian_set.keys.push(key.rsh(96));
120120
index += 20;
121121
i += 1;
@@ -353,10 +353,10 @@ impl WormholeVM {
353353
index += 1;
354354
let (_, slice) = encoded_vm.split_at(index);
355355
let (slice, remainder) = slice.split_at(32);
356-
let r: b256 = b256::from_le_bytes(slice.clone());
356+
let r: b256 = b256::from_be_bytes(slice.clone());
357357
index += 32;
358358
let (slice, remainder) = remainder.split_at(32);
359-
let s: b256 = b256::from_le_bytes(slice.clone());
359+
let s: b256 = b256::from_be_bytes(slice.clone());
360360
index += 32;
361361
let v = remainder.get(0);
362362
require(v.is_some(), WormholeError::SignatureVIrretrievable);
@@ -409,7 +409,7 @@ impl WormholeVM {
409409
index += 2;
410410
let (_, slice) = encoded_vm.split_at(index);
411411
let (slice, _) = slice.split_at(32);
412-
let emitter_address: b256 = b256::from_le_bytes(slice.clone());
412+
let emitter_address: b256 = b256::from_be_bytes(slice.clone());
413413
index += 32;
414414
let (_, slice) = encoded_vm.split_at(index);
415415
let (slice, _) = slice.split_at(8);
@@ -512,7 +512,7 @@ impl WormholeVM {
512512
index += 2;
513513
let (_, slice) = encoded_vm.split_at(index);
514514
let (slice, _) = slice.split_at(32);
515-
let emitter_address: b256 = b256::from_le_bytes(slice.clone());
515+
let emitter_address: b256 = b256::from_be_bytes(slice.clone());
516516
index += 32;
517517
let (_, slice) = encoded_vm.split_at(index);
518518
let (slice, _) = slice.split_at(8);

target_chains/fuel/contracts/pyth-interface/src/pyth_merkle_proof.sw

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ fn node_hash(child_a: Bytes, child_b: Bytes) -> Bytes {
2020
let mut bytes = Bytes::with_capacity(41);
2121
bytes.push(MERKLE_NODE_PREFIX);
2222

23-
// let a: b256 = child_a.into();
24-
// let b: b256 = child_b.into();
25-
26-
let a: b256 = b256::from_le_bytes(child_a.clone());
27-
let b: b256 = b256::from_le_bytes(child_b.clone());
23+
let a: b256 = b256::from_be_bytes(child_a.clone());
24+
let b: b256 = b256::from_be_bytes(child_b.clone());
2825

2926
if a > b {
3027
bytes.append(child_b);
@@ -58,8 +55,8 @@ pub fn validate_proof(
5855
i += 1;
5956
}
6057

61-
let current_digest_b256: b256 = b256::from_le_bytes(current_digest.clone());
62-
let root_b256: b256 = b256::from_le_bytes(root.clone());
58+
let current_digest_b256: b256 = b256::from_be_bytes(current_digest.clone());
59+
let root_b256: b256 = b256::from_be_bytes(root.clone());
6360

6461
require(current_digest_b256 == root_b256, PythError::InvalidProof);
6562

0 commit comments

Comments
 (0)