Skip to content

Commit 4cac861

Browse files
committed
feat(cosmwasm): move Status enum to types and update status commitment query
1 parent f1d7005 commit 4cac861

File tree

32 files changed

+58
-89
lines changed

32 files changed

+58
-89
lines changed

Cargo.lock

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cosmwasm/ibc-union/core/light-client-interface/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use ibc_union_msg::lightclient::{
1111
MisbehaviourResponse, QueryMsg, StorageWrites, UpdateStateResponse, VerifyCreationResponse,
1212
VerifyCreationResponseEvent,
1313
};
14-
use ibc_union_spec::{path::Status, ClientId, Timestamp};
14+
use ibc_union_spec::{ClientId, Status, Timestamp};
1515
use unionlabs::{
1616
encoding::{Decode, DecodeAs, DecodeErrorOf, Encode, EncodeAs, Encoding, EthAbi},
1717
primitives::Bytes,

cosmwasm/ibc-union/core/msg/src/query.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ pub enum QueryMsg {
1616
GetClientState { client_id: ClientId },
1717
#[cfg_attr(feature = "cw-orch-interface", returns(unionlabs_primitives::Bytes))]
1818
GetConsensusState { client_id: ClientId, height: u64 },
19-
#[cfg_attr(feature = "cw-orch-interface", returns(ibc_union_spec::path::Status))]
19+
#[cfg_attr(feature = "cw-orch-interface", returns(ibc_union_spec::Status))]
2020
GetStatus { client_id: ClientId },
21-
#[cfg_attr(feature = "cw-orch-interface", returns(ibc_union_spec::path::Status))]
22-
GetCommittedStatus { client_id: ClientId },
21+
#[cfg_attr(feature = "cw-orch-interface", returns(Option<H256>))]
22+
GetStatusCommitment { client_id: ClientId },
2323
#[cfg_attr(feature = "cw-orch-interface", returns(String))]
2424
GetClientType { client_id: ClientId },
2525
#[cfg_attr(feature = "cw-orch-interface", returns(ibc_union_spec::Connection))]

cosmwasm/ibc-union/core/src/contract.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ use ibc_union_msg::{
2828
use ibc_union_spec::{
2929
path::{
3030
commit_packets, BatchPacketsPath, BatchReceiptsPath, ChannelPath, ClientStatePath,
31-
ClientStatusPath, ConnectionPath, ConsensusStatePath, Status, COMMITMENT_MAGIC,
31+
ClientStatusPath, ConnectionPath, ConsensusStatePath, COMMITMENT_MAGIC,
3232
COMMITMENT_MAGIC_ACK,
3333
},
3434
Channel, ChannelId, ChannelState, ClientId, Connection, ConnectionId, ConnectionState, Packet,
35-
Timestamp,
35+
Status, Timestamp,
3636
};
3737
use serde::{de::DeserializeOwned, Deserialize, Serialize};
3838
use unionlabs::{
3939
ethereum::keccak256,
40-
primitives::{Bytes, H256},
40+
primitives::{Bytes, H256, U256},
4141
};
4242

4343
use crate::{
@@ -605,18 +605,14 @@ pub fn execute(
605605
client_id: msg.client_id,
606606
},
607607
)?;
608-
609-
let status_bytes = (status as u8).to_le_bytes();
610-
611608
store_commit(
612609
deps.branch(),
613610
&ClientStatusPath {
614611
client_id: msg.client_id,
615612
}
616613
.key(),
617-
&commit(status_bytes),
614+
&commit(U256::from(status as u32).to_le_bytes()),
618615
);
619-
620616
Ok(Response::default())
621617
}
622618
}
@@ -2194,7 +2190,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result<Binary, ContractErr
21942190
)?;
21952191
Ok(to_json_binary(&status)?)
21962192
}
2197-
QueryMsg::GetCommittedStatus { client_id } => {
2193+
QueryMsg::GetStatusCommitment { client_id } => {
21982194
let commit = read_commit(deps, &ClientStatusPath { client_id }.key());
21992195
Ok(to_json_binary(&commit)?)
22002196
}

cosmwasm/ibc-union/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ mod tests;
1010

1111
use cosmwasm_std::{Addr, StdError};
1212
use frissitheto::UpgradeError;
13-
use ibc_union_spec::{path::Status, ChannelId, ChannelState, ClientId, ConnectionState, Timestamp};
13+
use ibc_union_spec::{ChannelId, ChannelState, ClientId, ConnectionState, Status, Timestamp};
1414
use thiserror::Error;
1515
use unionlabs::primitives::Bytes;
1616

cosmwasm/ibc-union/lightclient/arbitrum/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ ethereum-light-client-types = { workspace = true }
2424
frissitheto = { workspace = true }
2525
ibc-union-light-client = { workspace = true }
2626
ibc-union-msg = { workspace = true }
27-
ibc-union-spec = { workspace = true }
2827
serde = { workspace = true, features = ["derive"] }
2928
thiserror = { workspace = true }
3029
unionlabs = { workspace = true, features = ["ethabi"] }

cosmwasm/ibc-union/lightclient/arbitrum/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use cosmwasm_std::{Addr, Empty};
33
use ethereum_light_client::client::EthereumLightClient;
44
use ethereum_light_client_types::StorageProof;
55
use ibc_union_light_client::{
6-
spec::Timestamp, ClientCreationResult, IbcClient, IbcClientCtx, IbcClientError, StateUpdate,
6+
spec::{Status, Timestamp},
7+
ClientCreationResult, IbcClient, IbcClientCtx, IbcClientError, StateUpdate,
78
};
8-
use ibc_union_spec::path::Status;
99
use unionlabs::encoding::Bincode;
1010

1111
use crate::errors::Error;

cosmwasm/ibc-union/lightclient/base/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ evm-storage-verifier = { workspace = true }
2828
frissitheto = { workspace = true }
2929
ibc-union-light-client = { workspace = true }
3030
ibc-union-msg = { workspace = true }
31-
ibc-union-spec = { workspace = true }
3231
ics23 = { workspace = true }
3332
serde = { workspace = true, features = ["derive"] }
3433
thiserror = { workspace = true }

cosmwasm/ibc-union/lightclient/base/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use cosmwasm_std::{Addr, Empty};
33
use ethereum_light_client::client::EthereumLightClient;
44
use ethereum_light_client_types::StorageProof;
55
use ibc_union_light_client::{
6-
spec::Timestamp, ClientCreationResult, IbcClient, IbcClientCtx, IbcClientError, StateUpdate,
6+
spec::{Status, Timestamp},
7+
ClientCreationResult, IbcClient, IbcClientCtx, IbcClientError, StateUpdate,
78
};
8-
use ibc_union_spec::path::Status;
99
use unionlabs::encoding::Bincode;
1010

1111
use crate::errors::Error;

cosmwasm/ibc-union/lightclient/berachain/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ evm-storage-verifier = { workspace = true }
2828
frissitheto = { workspace = true }
2929
ibc-union-light-client = { workspace = true }
3030
ibc-union-msg = { workspace = true }
31-
ibc-union-spec = { workspace = true }
3231
ics23 = { workspace = true }
3332
serde = { workspace = true, features = ["derive"] }
3433
tendermint-light-client = { workspace = true, features = ["library"] }

0 commit comments

Comments
 (0)