Skip to content

Commit 8f49ad0

Browse files
committed
test(solana): test call account creation
1 parent 0b0ed8d commit 8f49ad0

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

solana/programs/portal/src/instructions/solana_to_base/send_call.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ mod tests {
340340
ty,
341341
to,
342342
gas_limit,
343-
data,
343+
data: data.clone(),
344344
}
345345
.data(),
346346
};
@@ -352,7 +352,6 @@ mod tests {
352352
svm.latest_blockhash(),
353353
);
354354

355-
// TODO: Check that the correct event is emitted
356355
svm.send_transaction(tx)
357356
.expect("Transaction should succeed");
358357

@@ -367,6 +366,17 @@ mod tests {
367366
let portal_account = svm.get_account(&portal_pda).unwrap();
368367
let portal_data = Portal::try_deserialize(&mut portal_account.data.as_slice()).unwrap();
369368
assert_eq!(portal_data.nonce, 1);
369+
370+
// Verify that the call was created
371+
let call_account = svm.get_account(&call_pda).unwrap();
372+
let call_data = Call::try_deserialize(&mut call_account.data.as_slice()).unwrap();
373+
assert_eq!(call_data.nonce, 0);
374+
assert_eq!(call_data.ty, ty);
375+
assert_eq!(call_data.from, authority_pk);
376+
assert_eq!(call_data.to, to);
377+
assert_eq!(call_data.gas_limit, gas_limit);
378+
assert_eq!(call_data.remote_value, 0);
379+
assert_eq!(call_data.data, data);
370380
}
371381

372382
#[test]

solana/programs/portal/src/state/call.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use anchor_lang::prelude::*;
22

3-
#[derive(Debug, Copy, Clone, AnchorSerialize, AnchorDeserialize, InitSpace)]
3+
#[derive(Debug, Copy, Clone, Eq, PartialEq, AnchorSerialize, AnchorDeserialize, InitSpace)]
44
#[repr(u8)]
55
pub enum CallType {
66
Call,
@@ -10,7 +10,7 @@ pub enum CallType {
1010
}
1111

1212
#[account]
13-
#[derive(InitSpace)]
13+
#[derive(Debug, InitSpace)]
1414
pub struct Call {
1515
pub nonce: u64,
1616
pub ty: CallType,

0 commit comments

Comments
 (0)