You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor Aptos module and utility functions for improved message handling
- Renamed `DecodedMessage` struct to `ReceiveData` for clarity.
- Simplified message parsing logic in `parse_message` function.
- Updated `lz_receive_impl` to utilize the new `ReceiveData` struct.
- Removed unused utility functions and constants from `utils.move`.
- Added unit tests for `parse_message` to ensure correct functionality.
let expected_addr1 = @0x1234567890123456789012345678901234567890;
12
+
let expected_addr2 = @0x9876543210987654321098765432109876543210;
13
+
let expected_number: u256 = 123456789012345678901234567890;
14
+
15
+
let encoded_data = x"000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c23078303030303030303030303030303030303030303030303030313233343536373839303132333435363738393031323334353637383930313233343536373839303030303030303030303030303030303030303030303030303938373635343332313039383736353433323130393837363534333231303938373635343332313030303030303030303030303030303030303030303030303030303030303030303030303030303031386565393066663663333733653065653465336630616432000000000000000000000000000000000000000000000000000000000000";
16
+
17
+
let (actual_addr1, actual_addr2, actual_number) = parse_message(encoded_data);
18
+
19
+
assert!(actual_addr1 == expected_addr1, 1);
20
+
assert!(actual_addr2 == expected_addr2, 2);
21
+
assert!(actual_number == expected_number, 3);
22
+
}
23
+
24
+
#[test]
25
+
funtest_parse_message_with_prefix() {
26
+
let expected_addr1 = @0x58b730d07e98a22f2b357bee721115c986e4dc873c1884763708ee3d4006f74e;
27
+
let expected_addr2 = @0x58b730d07e98a22f2b357bee721115c986e4dc873c1884763708ee3d4006f74e;
28
+
let expected_number: u256 = 123456789012345678901234567890;
29
+
30
+
let encoded_data = x"000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c23078353862373330643037653938613232663262333537626565373231313135633938366534646338373363313838343736333730386565336434303036663734653538623733306430376539386132326632623335376265653732313131356339383665346463383733633138383437363337303865653364343030366637346530303030303030303030303030303030303030303030303030303030303030303030303030303031386565393066663663333733653065653465336630616432000000000000000000000000000000000000000000000000000000000000";
31
+
32
+
let (actual_addr1, actual_addr2, actual_number) = parse_message(encoded_data);
0 commit comments