Skip to content

Commit c3e0f49

Browse files
committed
explaining byte padding
1 parent 7d74c6f commit c3e0f49

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl GuardianSetUpgrade {
117117
let (key, _) = slice.split_at(20);
118118
let mut full_address_key = Bytes::with_capacity(32);
119119

120-
120+
// Sway's from_be_bytes expects a 32-byte array, so we pad with zeros
121121
let mut j = 0;
122122
while j < 12 {
123123
full_address_key.push(0u8);
@@ -128,7 +128,6 @@ impl GuardianSetUpgrade {
128128

129129
let key: b256 = b256::from_be_bytes(full_address_key.clone());
130130

131-
132131
new_guardian_set.keys.push(key);
133132
index += 20;
134133
i += 1;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ 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+
// Sway's from_be_bytes expects a 32-byte array, so we pad with zeros
2324
let mut full_address_child_a = Bytes::with_capacity(32);
2425
let mut full_address_child_b = Bytes::with_capacity(32);
2526

0 commit comments

Comments
 (0)