-
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(lc/starknet): verify signed commitment proofs from starknet #242
base: main
Are you sure you want to change the base?
Conversation
cdd28da
to
124d5d0
Compare
124d5d0
to
07e36a1
Compare
@@ -126,7 +158,7 @@ where | |||
}, | |||
delay_period, | |||
update_height, | |||
proof_init: counterparty_payload.proof_init.proof_bytes, | |||
proof_init, |
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 successfully managed to sign the proof_init
@@ -126,7 +158,7 @@ where | |||
}, | |||
delay_period, | |||
update_height, | |||
proof_init: counterparty_payload.proof_init.proof_bytes, | |||
proof_init, | |||
// TODO(rano): counterparty_payload has empty proofs? | |||
// proof_client: counterparty_payload.proof_client.proof_bytes, | |||
proof_client: vec![0x1], |
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.
Looks like these two are skipped. Probably ibc-go
doesn't use them after cosmos/ibc-go#7129
// FIXME(rano): generate the signature | ||
proof_ack: dbg!(counterparty_payload.proof_ack.proof_bytes), |
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.
Currently, the signature verification fails here. But I don't know how to create the signature at this point without access to ConnectionEnd
and ConnectionId
at starknet.
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 can query the stored counteryparty connection end (starknet) at cosmos, cosmos's own connection id to recreate the ConnectionEnd.
To generate the proofs -- specifically signatures, I hacked around. This is not ideal. To generate a signature, I need
When I am building the message with CosmosChain, I don't have access to StarknetChain. So I can't fetch the consensus_root (block_hash) for starknet. For now, I pass the @soareschen any idea how to do this properly? |
I think you need to include that in the payload. You can define a custom payload type for Starknet if needed. |
You could also modify the |
5828ef2
to
7722d4d
Compare
I ended up building the bytes that need to be signed at the Starknet (-to-Cosmos) payload builder step. But Starknet doesn't have access to the Cosmos's default signer. So I signed it at Cosmos's message builder step. But I don't see how I can sign the bytes for packet commitment, ack and receipt. |
One more question: is the ibc-starknet/relayer/crates/starknet-chain-components/src/impls/queries/packet_receipt.rs Lines 51 to 57 in a3248f9
... for |
currently fails because the |
Actually, I think, the
Starknet does have an equivalent to
But, it uses Probably, we can use ibc-starknet/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs Lines 108 to 111 in a3248f9
|
I fixed the signing problems. But now I think, I need to make the commitment proofs consistent between ibc-go and cairo contract. This is how In cairo, we use the following ibc-starknet/cairo-contracts/packages/core/src/commitment/types.cairo Lines 51 to 59 in 7967c80
I should try to fix it using this test as a reference, ibc-starknet/cairo-contracts/packages/core/src/tests/commitment.cairo Lines 52 to 58 in 7967c80
|
076afec
to
aa5bc01
Compare
let chain_status = chain.query_chain_status().await?; | ||
|
||
// FIXME: CometClientState can't be encoded to protobuf | ||
let protobuf_encoded_client_state = Vec::new(); |
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.
do we have an implementation that encodes CometClientState
to protobuf encoding?
cc @soareschen
PS. it's not important for demo2, as ibc-go currently ignored self client/consensus validation.
let chain_status = chain.query_chain_status().await?; | ||
|
||
// FIXME: CometConsensusState can't be encoded to protobuf | ||
let protobuf_encoded_consensus_state = Vec::new(); |
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.
@soareschen same as client state, but for consensus state.
if receipt_status { | ||
return Err(Chain::raise_error( | ||
"Packet is received. No non-membership proof.", | ||
)); | ||
} |
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 only return non-membership proof here.
// ibc-go uses nanosecs | ||
// https://github.com/cosmos/ibc-go/blob/98d7e7550a23ecf8d96ce042ab11ef857b184f2a/proto/ibc/core/channel/v1/channel.proto#L179-L180 | ||
coll.extend(timeout_timestamp.timestamp * 1_000_000_000); |
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 fixed this as part of this PR.
Nix error during Osmosis github tarball fetch is back. But ics20 e2e test passes locally. 🎉 |
We have to remove or trim the We are passing dummy proofs here: ibc-starknet/relayer/crates/starknet-integration-tests/src/tests/light_client.rs Lines 394 to 396 in 7967c80
ibc-starknet/relayer/crates/starknet-integration-tests/src/tests/light_client.rs Line 442 in 7967c80
The wasm light client accepts only signed proofs now. |
closes #229