-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(e2e): native token transfer from cosmos to starknet #172
base: main
Are you sure you want to change the base?
Conversation
Current test fails because of cosmos/ibc-rs#1262. The fix is present in Update: started using ibc-go v9 9929d13 |
d1f52f6
to
26ae0c1
Compare
26ae0c1
to
9929d13
Compare
19bf4e8
to
63fc99a
Compare
Currently, the test fails, as the Starknet doesn't accept packet_ack because of commitment mismatch. Update: I forgot to add the trace prefix. cd0f882 |
fn ibc_token_addresses(self: @TContractState) -> Array<ContractAddress>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the goal of adding this endpoint is only to obtain the token address of an IBC-created token, it’s actually unnecessary. We can either listen to the CreateTokenEvent
that gets emitted or construct the token's key on the relayer side and use the ibc_token_address
, same as it's computed by the contract.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is indeed unnecessary. I added it as a hack. I just forgot to add a TODO
comment on top of it.
Essentially, the relay_packet
method should return any stateful data generated during the relay -- specifically token address of the minted denom. I will wait for Soares to fix this. After that, we can remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you open up an issue for this? What exactly is blocking us and what's needed in hermes-sdk
so that we can rely on existing facilities here?
fn from_cosmos_to_cairo_packet<Encoding>(packet: &IbcPacket, encoding: &Encoding) -> CairoPacket | ||
where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to finish up the handshake and relays, as I already started working on this.
Or, we can merge until here and work on #150 and then resume work on getting packet relay working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have enough time ahead of us, thus not recommend leaving the PR with this function.
Let's get #150 done first. Let me know if I can be assist on that.
relayer/crates/starknet-chain-components/src/types/messages/ibc/ibc_transfer.rs
Outdated
Show resolved
Hide resolved
) | ||
.await?; | ||
|
||
// TODO(rano): how do I get the ics20 token contract address from starknet events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a token is created, the ICS20 emits a CreateTokenEvent
that includes the token's address. We can read the address by retrieving that event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is mainly about how to use relay_packet
and still get the token address. The hack, that you pointed in #172 (comment), is introduced exactly for this.
I wanted to perform erc20 token transfer from starknet to cosmos, but I realized, we need to I am making this PR final. Let's test starknet -> cosmos -> starknet on a different PR. |
80c2ea2
to
9881575
Compare
@rnbguy Now that the test is working, we can be confident in the correctness of our implementation on both the relayer and contracts side. My suggestion is to address #172 (comment) and #172 (comment) first, update the PR, and then wrap it up. |
The way it works at the moment, users should approve their allowance before initiating a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, I approve the PR, leaving that to you how to organize issues/PRs moving forward.
Partially resolves #170 #171
ics20 transfer: cosmos -> starknet -> cosmos