Skip to content
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

Update ethereum-ibc-rs to v0.0.17 #25

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ displaydoc = { version = "0.2", default-features = false }
tiny-keccak = { version = "1.4" }

light-client = { git = "https://github.com/datachainlab/lcp", rev = "v0.2.11", default-features = false, features = ["ibc"] }
ethereum-ibc = { git = "https://github.com/datachainlab/ethereum-ibc-rs", rev = "v0.0.16", default-features = false }
ethereum-ibc = { git = "https://github.com/datachainlab/ethereum-ibc-rs", rev = "v0.0.17", default-features = false }
38 changes: 8 additions & 30 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,10 @@ impl<const SYNC_COMMITTEE_SIZE: usize> LightClient for EthereumLightClient<SYNC_
let (client_state, consensus_state, prefix, path, proof) =
Self::validate_args(ctx, client_id, prefix, path, proof_height, proof)?;

client_state
.verify_height(proof_height.try_into().map_err(Error::ICS02)?)
.map_err(|e| Error::ICS02(e.into()))?;

let value = keccak256(&value);
client_state
.verify_membership(
proof_height.try_into().map_err(Error::ICS02)?,
&prefix,
&proof,
consensus_state.root(),
Expand Down Expand Up @@ -160,11 +157,13 @@ impl<const SYNC_COMMITTEE_SIZE: usize> LightClient for EthereumLightClient<SYNC_
Self::validate_args(ctx, client_id, prefix, path, proof_height, proof)?;

client_state
.verify_height(proof_height.try_into().map_err(Error::ICS02)?)
.map_err(|e| Error::ICS02(e.into()))?;

client_state
.verify_non_membership(&prefix, &proof, consensus_state.root(), path.clone())
.verify_non_membership(
proof_height.try_into().map_err(Error::ICS02)?,
&prefix,
&proof,
consensus_state.root(),
path.clone(),
)
.map_err(|e| {
Error::ICS02(ClientError::ClientSpecific {
description: e.to_string(),
Expand Down Expand Up @@ -206,13 +205,6 @@ impl<const SYNC_COMMITTEE_SIZE: usize> EthereumLightClient<SYNC_COMMITTEE_SIZE>
.try_into()
.map_err(Error::ICS02)?;

if client_state.is_frozen() {
return Err(Error::ICS02(ClientError::ClientFrozen {
client_id: client_id.into(),
})
.into());
}

let consensus_state: ConsensusState =
IBCAny::from(ctx.consensus_state(&client_id, &proof_height)?)
.try_into()
Expand All @@ -236,13 +228,6 @@ impl<const SYNC_COMMITTEE_SIZE: usize> EthereumLightClient<SYNC_COMMITTEE_SIZE>
.try_into()
.map_err(Error::ICS02)?;

if client_state.is_frozen() {
return Err(Error::ICS02(ClientError::ClientFrozen {
client_id: client_id.into(),
})
.into());
}

let height = header.height().into();
let header_timestamp: Time = header.timestamp().into();
let trusted_height = header.trusted_sync_committee.height;
Expand Down Expand Up @@ -322,13 +307,6 @@ impl<const SYNC_COMMITTEE_SIZE: usize> EthereumLightClient<SYNC_COMMITTEE_SIZE>
.try_into()
.map_err(Error::ICS02)?;

if client_state.is_frozen() {
return Err(Error::ICS02(ClientError::ClientFrozen {
client_id: client_id.into(),
})
.into());
}

let trusted_height = misbehaviour.trusted_sync_committee.height;
let trusted_consensus_state: ConsensusState = IBCAny::from(
ctx.consensus_state(&client_id, &trusted_height.into())
Expand Down
3 changes: 1 addition & 2 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ use light_client::commitments::{gen_state_id_from_any, StateID};
use light_client::types::proto::google::protobuf::Any as IBCAny;

// canonicalize_client_state canonicalizes some fields of specified client state
// target fields: latest_execution_block_number, frozen_height
// target fields: latest_execution_block_number
pub fn canonicalize_client_state<const SYNC_COMMITTEE_SIZE: usize>(
client_state: ClientState<SYNC_COMMITTEE_SIZE>,
) -> ClientState<SYNC_COMMITTEE_SIZE> {
let mut client_state = client_state;
client_state.latest_execution_block_number = 0u64.into();
client_state.frozen_height = None;
client_state
}

Expand Down
Loading