Skip to content

Commit 46931e2

Browse files
committed
use packet_receipt endpoint
1 parent 7644902 commit 46931e2

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

relayer/crates/starknet-chain-components/src/impls/queries/packet_receipt.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ where
5353
+ CanCallContract
5454
+ HasStarknetProofSigner<ProofSigner = Secp256k1KeyPair>
5555
+ CanRaiseAsyncError<String>
56+
+ CanRaiseAsyncError<&'static str>
5657
+ CanRaiseAsyncError<Encoding::Error>,
5758
Counterparty: HasSequenceType<Chain, Sequence = IbcSequence>,
5859
Encoding: CanEncode<ViaCairo, Product![CairoPortId, ChannelId, Sequence]>
@@ -88,15 +89,11 @@ where
8889

8990
let receipt_status = encoding.decode(&output).map_err(Chain::raise_error)?;
9091

91-
// TODO(rano): are these bytes correct?
92-
let receipt_bytes = if receipt_status {
93-
// 0x01 -> "AQ=="
94-
br#"{"result":"AQ=="}"#
95-
} else {
96-
// 0x00 -> "AA=="
97-
br#"{"result":"AA=="}"#
92+
if receipt_status {
93+
return Err(Chain::raise_error(
94+
"Packet is received. No non-membership proof.",
95+
));
9896
}
99-
.to_vec();
10097

10198
let chain_status = chain.query_chain_status().await?;
10299

@@ -106,7 +103,7 @@ where
106103
path: Path::Receipt(ReceiptPath::new(port_id, channel_id, *sequence))
107104
.to_string()
108105
.into(),
109-
value: Some(receipt_bytes.clone()),
106+
value: None,
110107
}
111108
.canonical_bytes();
112109

@@ -120,6 +117,6 @@ where
120117
proof_bytes: signed_bytes,
121118
};
122119

123-
Ok((receipt_bytes, dummy_proof))
120+
Ok((vec![], dummy_proof))
124121
}
125122
}

relayer/crates/starknet-chain-components/src/impls/queries/packet_received.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@ where
7373
.map_err(Chain::raise_error)?;
7474

7575
let output = chain
76-
.call_contract(
77-
&contract_address,
78-
&selector!("is_packet_received"),
79-
&calldata,
80-
)
76+
.call_contract(&contract_address, &selector!("packet_receipt"), &calldata)
8177
.await?;
8278

8379
let is_received = encoding.decode(&output).map_err(Chain::raise_error)?;

0 commit comments

Comments
 (0)