Skip to content

Commit 52f5243

Browse files
committed
commented out motsu-incompatible tests, cargo fmt
1 parent 4bd1552 commit 52f5243

File tree

1 file changed

+46
-36
lines changed

1 file changed

+46
-36
lines changed

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

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ mod test {
103103
let result2 = pyth_contract
104104
.sender(alice)
105105
.execute_governance_instruction(bytes.clone());
106-
assert!(result2.is_err(), "Second execution should fail due to sequence number check");
107-
106+
assert!(
107+
result2.is_err(),
108+
"Second execution should fail due to sequence number check"
109+
);
108110
}
109111

110112
#[motsu::test]
@@ -124,7 +126,6 @@ mod test {
124126

125127
println!("Result: {:?}", result.unwrap_err());
126128
// assert!(result.is_ok());
127-
128129
}
129130

130131
#[motsu::test]
@@ -147,8 +148,10 @@ mod test {
147148
let result2 = pyth_contract
148149
.sender(alice)
149150
.execute_governance_instruction(bytes.clone());
150-
assert!(result2.is_err(), "Second execution should fail due to sequence number check");
151-
151+
assert!(
152+
result2.is_err(),
153+
"Second execution should fail due to sequence number check"
154+
);
152155
}
153156

154157
#[motsu::test]
@@ -173,39 +176,44 @@ mod test {
173176
let result2 = pyth_contract
174177
.sender(alice)
175178
.execute_governance_instruction(bytes.clone());
176-
assert!(result2.is_err(), "Second execution should fail due to sequence number check");
177-
179+
assert!(
180+
result2.is_err(),
181+
"Second execution should fail due to sequence number check"
182+
);
178183
}
179184

180-
#[motsu::test]
181-
fn test_set_wormhole_address(
182-
pyth_contract: Contract<PythReceiver>,
183-
wormhole_contract: Contract<WormholeContract>,
184-
alice: Address,
185-
) {
186-
pyth_wormhole_init(&pyth_contract, &wormhole_contract, &alice, 0);
187-
188-
let hex_str = "010000000001001daf08e5e3799cbc6096a90c2361e43220325418f377620a7a73d6bece18322679f6ada9725d9081743805efb8bccecd51098f1d76f34cba8b835fae643bbd9c000000000100000000000100000000000000000000000000000000000000000000000000000000000000110000000000000001005054474d010600027e5f4552091a69125d5dfcb7b8c2659029395bdf";
189-
let bytes = Vec::from_hex(hex_str).expect("Invalid hex string");
185+
// This test is commented out because it requires an already deployed new Wormhole contract.
186+
// This function demonstrates the usage of this instruction, however.
187+
/*
188+
#[motsu::test]
189+
fn test_set_wormhole_address(
190+
pyth_contract: Contract<PythReceiver>,
191+
wormhole_contract: Contract<WormholeContract>,
192+
alice: Address,
193+
) {
194+
pyth_wormhole_init(&pyth_contract, &wormhole_contract, &alice, 0);
195+
196+
let hex_str = "010000000001001daf08e5e3799cbc6096a90c2361e43220325418f377620a7a73d6bece18322679f6ada9725d9081743805efb8bccecd51098f1d76f34cba8b835fae643bbd9c000000000100000000000100000000000000000000000000000000000000000000000000000000000000110000000000000001005054474d010600027e5f4552091a69125d5dfcb7b8c2659029395bdf";
197+
let bytes = Vec::from_hex(hex_str).expect("Invalid hex string");
198+
199+
let result = pyth_contract
200+
.sender(alice)
201+
.execute_governance_instruction(bytes.clone());
202+
if result.is_err() {
203+
println!(
204+
"SetWormholeAddress Error: {:?}",
205+
result.as_ref().unwrap_err()
206+
);
207+
}
208+
assert!(result.is_ok());
209+
210+
let result2 = pyth_contract
211+
.sender(alice)
212+
.execute_governance_instruction(bytes.clone());
213+
assert!(result2.is_err(), "Second execution should fail due to sequence number check");
190214
191-
let result = pyth_contract
192-
.sender(alice)
193-
.execute_governance_instruction(bytes.clone());
194-
if result.is_err() {
195-
println!(
196-
"SetWormholeAddress Error: {:?}",
197-
result.as_ref().unwrap_err()
198-
);
199215
}
200-
assert!(result.is_ok());
201-
202-
let result2 = pyth_contract
203-
.sender(alice)
204-
.execute_governance_instruction(bytes.clone());
205-
assert!(result2.is_err(), "Second execution should fail due to sequence number check");
206-
207-
}
208-
216+
*/
209217
#[motsu::test]
210218
fn test_authorize_governance_data_source_transfer(
211219
pyth_contract: Contract<PythReceiver>,
@@ -254,8 +262,10 @@ mod test {
254262
let result2 = pyth_contract
255263
.sender(alice)
256264
.execute_governance_instruction(bytes.clone());
257-
assert!(result2.is_err(), "Second execution should fail due to sequence number check");
258-
265+
assert!(
266+
result2.is_err(),
267+
"Second execution should fail due to sequence number check"
268+
);
259269
}
260270

261271
// Fee transfers can't be done in the motsu testing framework. This commented test serves as an example for how to use the function, though.

0 commit comments

Comments
 (0)