Skip to content

Commit

Permalink
fix: use raw bool instead of HasPacketReceiptReturn (#1829)
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-aitlahcen authored Apr 26, 2024
2 parents 9e7ff3e + f091f2f commit db68149
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 21 deletions.
6 changes: 2 additions & 4 deletions generated/rust/protos/src/union.ibc.lightclients.scroll.v1.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/chain-utils/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ impl_eth_call_ext! {
GetChannelCall -> GetChannelReturn;
GetHashedPacketCommitmentCall -> GetHashedPacketCommitmentReturn;
GetHashedPacketAcknowledgementCommitmentCall -> GetHashedPacketAcknowledgementCommitmentReturn;
HasPacketReceiptCall -> HasPacketReceiptReturn;
HasPacketReceiptCall -> bool;
NextConnectionSequenceCall -> u64;
NextClientSequenceCall -> u64;
}
Expand Down Expand Up @@ -876,7 +876,7 @@ where
}

fn decode_ibc_state(encoded: <Self::EthCall as EthCallExt>::Return) -> Self::Value {
encoded.0
encoded
}
}

Expand Down
1 change: 0 additions & 1 deletion lib/chain-utils/src/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ impl Chain for Scroll {
.unwrap();

scroll::consensus_state::ConsensusState {
batch_index,
ibc_storage_root: storage_root.into(),
// Normalize to nanoseconds to be ibc-go compliant
timestamp: self
Expand Down
3 changes: 0 additions & 3 deletions lib/unionlabs/src/ibc/lightclients/scroll/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ use crate::{errors::InvalidLength, hash::H256};
from
))]
pub struct ConsensusState {
pub batch_index: u64,
pub ibc_storage_root: H256,
pub timestamp: u64,
}

impl From<ConsensusState> for protos::union::ibc::lightclients::scroll::v1::ConsensusState {
fn from(value: ConsensusState) -> Self {
Self {
batch_index: value.batch_index,
ibc_storage_root: value.ibc_storage_root.into(),
timestamp: value.timestamp,
}
Expand All @@ -35,7 +33,6 @@ impl TryFrom<protos::union::ibc::lightclients::scroll::v1::ConsensusState> for C
value: protos::union::ibc::lightclients::scroll::v1::ConsensusState,
) -> Result<Self, Self::Error> {
Ok(Self {
batch_index: value.batch_index,
ibc_storage_root: value
.ibc_storage_root
.try_into()
Expand Down
10 changes: 2 additions & 8 deletions light-clients/scroll-light-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,15 @@ impl IbcClient for ScrollLightClient {
update_client_state(deps.branch(), client_state, header.last_batch_index);
}

let updated_height = Height {
// TODO: Extract into a constant
revision_number: 0,
revision_height: header.last_batch_index,
};
let consensus_state = WasmConsensusState {
data: ConsensusState {
batch_index: header.last_batch_index,
ibc_storage_root: header.l2_ibc_account_proof.storage_root,
// must be nanos
timestamp: 1_000_000_000 * timestamp,
},
};
save_consensus_state(deps, consensus_state, &updated_height);
Ok(vec![updated_height])
save_consensus_state(deps, consensus_state, &header.l1_height);
Ok(vec![header.l1_height])
}

fn update_state_on_misbehaviour(
Expand Down
5 changes: 2 additions & 3 deletions uniond/proto/union/ibc/lightclients/scroll/v1/scroll.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ message ClientState {
}

message ConsensusState {
uint64 batch_index = 1;
bytes ibc_storage_root = 2;
uint64 timestamp = 3;
bytes ibc_storage_root = 1;
uint64 timestamp = 2;
}

message Header {
Expand Down

0 comments on commit db68149

Please sign in to comment.