Skip to content

Commit

Permalink
rename field in StarknetCommitmentProof
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed Feb 1, 2025
1 parent 7722d4d commit cb4fa8d
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
let chain_status = chain.query_chain_status().await?;

// hack(rano): passing block hash to message builder
let membership_proof_message = MembershipVerifierContainer {
let unsigned_membership_proof_bytes = MembershipVerifierContainer {
state_root: chain_status.block_hash.to_bytes_be().to_vec(),
prefix: chain.ibc_commitment_prefix().clone(),
path: Path::Ack(AckPath::new(port_id, channel_id, *sequence))
Expand All @@ -111,7 +111,7 @@ where
// TODO(rano): how to get the proof?
let dummy_proof = StarknetCommitmentProof {
proof_height: chain_status.height,
proof_bytes: membership_proof_message,
unsigned_membership_proof_bytes,
};

Ok((ack_bytes, dummy_proof))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ where
let chain_status = chain.query_chain_status().await?;

// hack(rano): passing block hash to message builder
let membership_proof_message = MembershipVerifierContainer {
let unsigned_membership_proof_bytes = MembershipVerifierContainer {
state_root: chain_status.block_hash.to_bytes_be().to_vec(),
prefix: chain.ibc_commitment_prefix().clone(),
path: Path::ChannelEnd(ChannelEndPath::new(port_id, channel_id))
Expand All @@ -135,7 +135,7 @@ where
// TODO(rano): how to get the proof?
let dummy_proof = StarknetCommitmentProof {
proof_height: chain_status.height,
proof_bytes: membership_proof_message,
unsigned_membership_proof_bytes,
};

Ok((channel_end, dummy_proof))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ where

let proof = StarknetCommitmentProof {
proof_height: *query_height,
proof_bytes: Vec::new(),
unsigned_membership_proof_bytes: Vec::new(),
};

Ok((client_state, proof))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ where
let chain_status = chain.query_chain_status().await?;

// hack(rano): passing block hash to message builder
let membership_proof_message = MembershipVerifierContainer {
let unsigned_membership_proof_bytes = MembershipVerifierContainer {
state_root: chain_status.block_hash.to_bytes_be().to_vec(),
prefix: chain.ibc_commitment_prefix().clone(),
path: Path::Connection(ConnectionPath::new(connection_id))
Expand All @@ -124,7 +124,7 @@ where
let dummy_proof = StarknetCommitmentProof {
proof_height: chain_status.height,
// FIXME(hack) we are passing msg hash as proof as we don't have access to signer
proof_bytes: membership_proof_message,
unsigned_membership_proof_bytes,
};

Ok((connection_end, dummy_proof))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ where

let proof = StarknetCommitmentProof {
proof_height: *query_height,
proof_bytes: Vec::new(),
unsigned_membership_proof_bytes: Vec::new(),
};

Ok((consensus_state, proof))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ where
let chain_status = chain.query_chain_status().await?;

// hack(rano): passing block hash to message builder
let membership_proof_message = MembershipVerifierContainer {
let unsigned_membership_proof_bytes = MembershipVerifierContainer {
state_root: chain_status.block_hash.to_bytes_be().to_vec(),
prefix: chain.ibc_commitment_prefix().clone(),
path: Path::Commitment(CommitmentPath::new(port_id, channel_id, *sequence))
Expand All @@ -110,7 +110,7 @@ where
// TODO(rano): how to get the proof?
let dummy_proof = StarknetCommitmentProof {
proof_height: chain_status.height,
proof_bytes: membership_proof_message,
unsigned_membership_proof_bytes,
};

Ok((commitment_bytes, dummy_proof))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ where
let chain_status = chain.query_chain_status().await?;

// hack(rano): passing block hash to message builder
let membership_proof_message = MembershipVerifierContainer {
let unsigned_membership_proof_bytes = MembershipVerifierContainer {
state_root: chain_status.block_hash.to_bytes_be().to_vec(),
prefix: chain.ibc_commitment_prefix().clone(),
path: Path::Receipt(ReceiptPath::new(port_id, channel_id, *sequence))
Expand All @@ -110,7 +110,7 @@ where
// TODO(rano): how to get the proof?
let dummy_proof = StarknetCommitmentProof {
proof_height: chain_status.height,
proof_bytes: membership_proof_message,
unsigned_membership_proof_bytes,
};

Ok((receipt_bytes, dummy_proof))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ where

let proof_init = chain
.get_default_signer()
.sign(&counterparty_payload.proof_init.proof_bytes)
.sign(
&counterparty_payload
.proof_init
.unsigned_membership_proof_bytes,
)
.map_err(Chain::raise_error)?;

let message = CosmosChannelOpenTryMessage {
Expand Down Expand Up @@ -131,7 +135,11 @@ where

let proof_try = chain
.get_default_signer()
.sign(&counterparty_payload.proof_try.proof_bytes)
.sign(
&counterparty_payload
.proof_try
.unsigned_membership_proof_bytes,
)
.map_err(Chain::raise_error)?;

let message = CosmosChannelOpenAckMessage {
Expand Down Expand Up @@ -174,7 +182,11 @@ where

let proof_ack = chain
.get_default_signer()
.sign(&counterparty_payload.proof_ack.proof_bytes)
.sign(
&counterparty_payload
.proof_ack
.unsigned_membership_proof_bytes,
)
.map_err(Chain::raise_error)?;

let message = CosmosChannelOpenConfirmMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ where

let proof_init = chain
.get_default_signer()
.sign(&counterparty_payload.proof_init.proof_bytes)
.sign(
&counterparty_payload
.proof_init
.unsigned_membership_proof_bytes,
)
.map_err(Chain::raise_error)?;

let message = CosmosConnectionOpenTryMessage {
Expand Down Expand Up @@ -182,7 +186,11 @@ where

let proof_try = chain
.get_default_signer()
.sign(&counterparty_payload.proof_try.proof_bytes)
.sign(
&counterparty_payload
.proof_try
.unsigned_membership_proof_bytes,
)
.map_err(Chain::raise_error)?;

let message = CosmosConnectionOpenAckMessage {
Expand Down Expand Up @@ -229,7 +237,11 @@ where

let proof_ack = chain
.get_default_signer()
.sign(&counterparty_payload.proof_ack.proof_bytes)
.sign(
&counterparty_payload
.proof_ack
.unsigned_membership_proof_bytes,
)
.map_err(Chain::raise_error)?;

let message = CosmosConnectionOpenConfirmMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ where
Chain: HasCommitmentProofType<CommitmentProof = StarknetCommitmentProof>,
{
fn commitment_proof_bytes(proof: &StarknetCommitmentProof) -> &[u8] {
&proof.proof_bytes
// FIXME: this is not the actual commitment proof bytes
&proof.unsigned_membership_proof_bytes
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub struct StarknetCommitmentProof {
pub proof_height: u64,
pub proof_bytes: Vec<u8>,
pub unsigned_membership_proof_bytes: Vec<u8>,
}

0 comments on commit cb4fa8d

Please sign in to comment.