Skip to content

Implement StarknetSetup to automate setting up chains and IBC for testing #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Mar 26, 2025

Conversation

soareschen
Copy link
Contributor

@soareschen soareschen commented Mar 21, 2025

Closes: #174

Merge after: informalsystems/hermes-sdk#581

@soareschen soareschen marked this pull request as ready for review March 25, 2025 12:57
@soareschen soareschen requested a review from ljoss17 March 25, 2025 12:57
}

#[test]
fn test_relay_timeout_packet() -> Result<(), Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep this test until it’s migrated to the new format?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added them back now.

use crate::utils::{init_starknet_bootstrap, load_wasm_client};

#[test]
fn test_relay_update_clients() -> Result<(), Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep this test until we finish the ICS23 implementation?

Copy link
Contributor

@ljoss17 ljoss17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

assert(token.is_zero(), TransferErrors::TOKEN_ALREADY_EXISTS);

if !token.is_zero() {
return token.address;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I make token creation to be no-op if a token already exists. This helps resolving the race condition where we try to create a token while a relayer is relaying and triggering the token creation at the same time.

Copy link
Member

@rnbguy rnbguy Mar 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The race condition makes sense. The refactor is alright for me.

Comment on lines +51 to +58
let message = StarknetMessage {
call: Call {
to: ics20_contract_address.0,
selector: selector!("create_ibc_token"),
calldata,
},
counterparty_height: None,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you now allow returning existing token. Note that, this is a contract invoke -- so we will spend gas on it, even if we don't modify the state. Don't you think it makes sense to query via ibc_token_address first ? And create the token if it doesn't exist ?

Copy link
Member

@rnbguy rnbguy Mar 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore!

I see that, you're doing exactly this later. 👍🏼

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, here I make token creation to be no-op if a token already exists. This helps resolving the race condition where we try to create a token while a relayer is relaying and triggering the token creation at the same time.

Comment on lines +4 to +5
use hermes_ibc_test_suite::tests::clearing::TestPacketClearing;
use hermes_ibc_test_suite::tests::transfer::TestIbcTransfer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice ! ✨

@soareschen soareschen merged commit 146f291 into main Mar 26, 2025
9 checks passed
@soareschen soareschen deleted the soares/binary-test-setup branch March 26, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Develop reusable setups for relayer's integration tests
3 participants