ntt-accountant: improved relayer parsing test
This commit is contained in:
parent
fca76d14f5
commit
41e0b9accd
|
@ -6,6 +6,7 @@ use std::io::{Cursor, Read};
|
|||
// Example testnet delivery VAA https://wormholescan.io/#/tx/0xb6de172a31d41e0aff2c928c4601d5328b05ccfd382ad853d0b1a61c3bfed869?network=TESTNET&view=rawdata
|
||||
// 010000000001000bd93f481e47872d345503d995fd56cb14bccf330d7f1861f0d34cf8fed0c71a3de7d57ff4c6d9a8ced5af186e32f69544cfdd5ed57fdfe2bafeb5c8787173fe0065d6cc010000000027130000000000000000000000007b1bd7a6b4e61c2a123ac6bc2cbfc614437d047000000000000001030f01271200000000000000000000000079689ce600d3fd3524ec2b4bedcc70131eda67b60000009f9945ff10000000000000000000000000e493cc4f069821404d272b994bb80b1ba1631914007900000000000000070000000000000000000000008f26a0025dccc6cfc07a7d38756280a10e295ad7004f994e54540800000000000003e8000000000000000000000000a88085e6370a551cc046fb6b1e3fb9be23ac3a210000000000000000000000008f26a0025dccc6cfc07a7d38756280a10e295ad7271200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a120000000000000000000000000000000000000000000000000000000046f5399e7271200000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a0a53847776f7e94cc35742971acb2217b0db810000000000000000000000007a0a53847776f7e94cc35742971acb2217b0db81000000000000000000000000e493cc4f069821404d272b994bb80b1ba163191400
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct DeliveryInstruction {
|
||||
pub target_chain: u16,
|
||||
pub target_address: [u8; 32],
|
||||
|
@ -104,6 +105,7 @@ impl DeliveryInstruction {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct MessageKey {
|
||||
pub key_type: u8,
|
||||
pub key: Vec<u8>,
|
||||
|
@ -180,94 +182,73 @@ mod test {
|
|||
];
|
||||
let delivery = DeliveryInstruction::deserialize(&payload).unwrap();
|
||||
|
||||
assert_eq!(delivery.target_chain, 10002);
|
||||
assert_eq!(
|
||||
delivery.target_address,
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x68,
|
||||
0x9c, 0xe6, 0x00, 0xd3, 0xfd, 0x35, 0x24, 0xec, 0x2b, 0x4b, 0xed, 0xcc, 0x70, 0x13,
|
||||
0x1e, 0xda, 0x67, 0xb6,
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
delivery.payload,
|
||||
[
|
||||
0x99, 0x45, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xe4, 0x93, 0xcc, 0x4f, 0x06, 0x98, 0x21, 0x40, 0x4d, 0x27, 0x2b, 0x99,
|
||||
0x4b, 0xb8, 0x0b, 0x1b, 0xa1, 0x63, 0x19, 0x14, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x8f, 0x26, 0xa0, 0x02, 0x5d, 0xcc, 0xc6, 0xcf, 0xc0, 0x7a, 0x7d, 0x38,
|
||||
0x75, 0x62, 0x80, 0xa1, 0x0e, 0x29, 0x5a, 0xd7, 0x00, 0x4f, 0x99, 0x4e, 0x54, 0x54,
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x80, 0x85, 0xe6, 0x37, 0x0a, 0x55,
|
||||
0x1c, 0xc0, 0x46, 0xfb, 0x6b, 0x1e, 0x3f, 0xb9, 0xbe, 0x23, 0xac, 0x3a, 0x21, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x26, 0xa0,
|
||||
0x02, 0x5d, 0xcc, 0xc6, 0xcf, 0xc0, 0x7a, 0x7d, 0x38, 0x75, 0x62, 0x80, 0xa1, 0x0e,
|
||||
0x29, 0x5a, 0xd7, 0x27, 0x12,
|
||||
]
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
delivery.requested_reciever_value,
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
delivery.extra_reciever_value,
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
delivery.encoded_execution_info,
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xa1, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x6f, 0x53, 0x99, 0xe7,
|
||||
]
|
||||
);
|
||||
assert_eq!(delivery.refund_chain_id, 10002);
|
||||
assert_eq!(
|
||||
delivery.refund_address,
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
delivery.refund_delivery_provider,
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x0a,
|
||||
0x53, 0x84, 0x77, 0x76, 0xf7, 0xe9, 0x4c, 0xc3, 0x57, 0x42, 0x97, 0x1a, 0xcb, 0x22,
|
||||
0x17, 0xb0, 0xdb, 0x81,
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
delivery.source_delivery_provider,
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x0a,
|
||||
0x53, 0x84, 0x77, 0x76, 0xf7, 0xe9, 0x4c, 0xc3, 0x57, 0x42, 0x97, 0x1a, 0xcb, 0x22,
|
||||
0x17, 0xb0, 0xdb, 0x81
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
delivery.sender_address,
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x93,
|
||||
0xcc, 0x4f, 0x06, 0x98, 0x21, 0x40, 0x4d, 0x27, 0x2b, 0x99, 0x4b, 0xb8, 0x0b, 0x1b,
|
||||
0xa1, 0x63, 0x19, 0x14
|
||||
]
|
||||
);
|
||||
assert_eq!(delivery.messages.len(), 0);
|
||||
delivery,
|
||||
DeliveryInstruction {
|
||||
target_chain: 10002,
|
||||
target_address: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79,
|
||||
0x68, 0x9c, 0xe6, 0x00, 0xd3, 0xfd, 0x35, 0x24, 0xec, 0x2b, 0x4b, 0xed, 0xcc,
|
||||
0x70, 0x13, 0x1e, 0xda, 0x67, 0xb6,
|
||||
],
|
||||
payload: vec![
|
||||
0x99, 0x45, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xe4, 0x93, 0xcc, 0x4f, 0x06, 0x98, 0x21, 0x40, 0x4d, 0x27,
|
||||
0x2b, 0x99, 0x4b, 0xb8, 0x0b, 0x1b, 0xa1, 0x63, 0x19, 0x14, 0x00, 0x79, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x26, 0xa0, 0x02, 0x5d, 0xcc, 0xc6,
|
||||
0xcf, 0xc0, 0x7a, 0x7d, 0x38, 0x75, 0x62, 0x80, 0xa1, 0x0e, 0x29, 0x5a, 0xd7,
|
||||
0x00, 0x4f, 0x99, 0x4e, 0x54, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xa8, 0x80, 0x85, 0xe6, 0x37, 0x0a, 0x55, 0x1c, 0xc0, 0x46, 0xfb, 0x6b,
|
||||
0x1e, 0x3f, 0xb9, 0xbe, 0x23, 0xac, 0x3a, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x26, 0xa0, 0x02, 0x5d, 0xcc,
|
||||
0xc6, 0xcf, 0xc0, 0x7a, 0x7d, 0x38, 0x75, 0x62, 0x80, 0xa1, 0x0e, 0x29, 0x5a,
|
||||
0xd7, 0x27, 0x12,
|
||||
],
|
||||
requested_reciever_value: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
],
|
||||
extra_reciever_value: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
],
|
||||
encoded_execution_info: vec![
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xa1, 0x20, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0x6f, 0x53, 0x99, 0xe7,
|
||||
],
|
||||
refund_chain_id: 10002,
|
||||
refund_address: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
],
|
||||
refund_delivery_provider: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a,
|
||||
0x0a, 0x53, 0x84, 0x77, 0x76, 0xf7, 0xe9, 0x4c, 0xc3, 0x57, 0x42, 0x97, 0x1a,
|
||||
0xcb, 0x22, 0x17, 0xb0, 0xdb, 0x81,
|
||||
],
|
||||
source_delivery_provider: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a,
|
||||
0x0a, 0x53, 0x84, 0x77, 0x76, 0xf7, 0xe9, 0x4c, 0xc3, 0x57, 0x42, 0x97, 0x1a,
|
||||
0xcb, 0x22, 0x17, 0xb0, 0xdb, 0x81
|
||||
],
|
||||
sender_address: [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4,
|
||||
0x93, 0xcc, 0x4f, 0x06, 0x98, 0x21, 0x40, 0x4d, 0x27, 0x2b, 0x99, 0x4b, 0xb8,
|
||||
0x0b, 0x1b, 0xa1, 0x63, 0x19, 0x14
|
||||
],
|
||||
messages: Vec::new()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue