Skip to content

Commit

Permalink
solana-ibc: use a proper timestamp in mock headers (#134)
Browse files Browse the repository at this point in the history
The timestamp default to None while setting up mock headers in the tests. Since they are not set ( None ), it fails while comparing the current timestamp. So using a value instead would solve it. The value has to be less than the current timestamp.

* use a timestamp value instead of None

* fmt

* fix imports
  • Loading branch information
dhruvja authored Nov 28, 2023
1 parent 4f5e5d4 commit 4096784
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions solana/solana-ibc/programs/solana-ibc/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub mod mock {
pub use ibc_testkit::testapp::ibc::clients::mock::consensus_state::{
MockConsensusState, MOCK_CONSENSUS_STATE_TYPE_URL,
};
pub use ibc_testkit::testapp::ibc::clients::mock::header::MockHeader;
pub use ibc_testkit::testapp::ibc::clients::mock::proto::{
ClientState as ClientStatePB, ConsensusState as ConsensusStatePB,
};
Expand Down
8 changes: 6 additions & 2 deletions solana/solana-ibc/programs/solana-ibc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ fn airdrop(client: &RpcClient, account: Pubkey, lamports: u64) -> Signature {

fn create_mock_client_and_cs_state(
) -> (ibc::mock::MockClientState, ibc::mock::MockConsensusState) {
let mock_client_state = ibc::mock::MockClientState::new(Default::default());
let mock_cs_state = ibc::mock::MockConsensusState::new(Default::default());
let mock_header = ibc::mock::MockHeader {
height: ibc::Height::min(0),
timestamp: ibc::Timestamp::from_nanoseconds(1).unwrap(),
};
let mock_client_state = ibc::mock::MockClientState::new(mock_header);
let mock_cs_state = ibc::mock::MockConsensusState::new(mock_header);
(mock_client_state, mock_cs_state)
}

Expand Down

0 comments on commit 4096784

Please sign in to comment.