Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benluelo committed Nov 1, 2023
1 parent 354f2e9 commit ecdddfe
Show file tree
Hide file tree
Showing 28 changed files with 362 additions and 421 deletions.
2 changes: 1 addition & 1 deletion lib/chain-utils/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ use unionlabs::{
ConnectionOpenAck, ConnectionOpenConfirm, ConnectionOpenInit, ConnectionOpenTry,
CreateClient, IbcEvent, RecvPacket, SendPacket,
},
google::protobuf::any::Any,
ibc::{
core::{
channel::channel::Channel, client::height::Height,
connection::connection_end::ConnectionEnd,
},
google::protobuf::any::Any,
lightclients::{cometbls, ethereum, tendermint::fraction::Fraction, wasm},
},
id::{ChannelId, ClientId, ConnectionId, PortId},
Expand Down
2 changes: 1 addition & 1 deletion lib/chain-utils/src/union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use tendermint_rpc::{query::Query, Client, Order, WebSocketClient, WebSocketClie
use unionlabs::{
ethereum::H256,
events::{IbcEvent, TryFromTendermintEventError, WriteAcknowledgement},
google::protobuf::{any::Any, duration::Duration},
ibc::{
core::{client::height::Height, commitment::merkle_root::MerkleRoot},
google::protobuf::{any::Any, duration::Duration},
lightclients::{cometbls, wasm},
},
id::ClientId,
Expand Down
3 changes: 2 additions & 1 deletion lib/ics-008-wasm-client/src/storage_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use core::fmt::Debug;

use cosmwasm_std::{CustomQuery, Deps, DepsMut};
use unionlabs::{
ibc::{core::client::height::Height, google::protobuf::any::Any, lightclients::wasm},
google::protobuf::any::Any,
ibc::{core::client::height::Height, lightclients::wasm},
IntoProto, Proto, TryFromProto, TryFromProtoErrorOf,
};

Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/fuzz/fuzz_targets/duration/checked_add.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use unionlabs::ibc::google::protobuf::duration::Duration;
use unionlabs::google::protobuf::duration::Duration;

fuzz_target!(|data: (Duration, Duration)| {
let (a, b) = data;
Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/fuzz/fuzz_targets/duration/from_str.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use unionlabs::ibc::google::protobuf::duration::Duration;
use unionlabs::google::protobuf::duration::Duration;

fuzz_target!(|data: &str| {
let _ = data.parse::<Duration>();
Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/fuzz/fuzz_targets/duration/roundtrip.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use unionlabs::{ibc::google::protobuf::duration::Duration, test_utils::*};
use unionlabs::{google::protobuf::duration::Duration, test_utils::*};

fuzz_target!(|data: Duration| {
assert_proto_roundtrip(&data);
Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/fuzz/fuzz_targets/timestamp/roundtrip.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use unionlabs::{ibc::google::protobuf::timestamp::Timestamp, test_utils::*};
use unionlabs::{google::protobuf::timestamp::Timestamp, test_utils::*};

fuzz_target!(|data: Timestamp| {
assert_proto_roundtrip(&data);
Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/src/cosmos/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Debug;
use serde::{Deserialize, Serialize};

use crate::{
errors::InvalidLength, ibc::google::protobuf::any::Any, IntoProto, Proto, TryFromProto,
errors::InvalidLength, google::protobuf::any::Any, IntoProto, Proto, TryFromProto,
TryFromProtoBytesError, TypeUrl,
};

Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/src/cosmos/staking/commission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::{
cosmos::staking::commission_rates::CommissionRates,
errors::{required, MissingField},
ibc::google::protobuf::timestamp::Timestamp,
google::protobuf::timestamp::Timestamp,
Proto, TryFromProtoErrorOf, TypeUrl,
};

Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/src/cosmos/staking/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
staking::{bond_status::BondStatus, commission::Commission, description::Description},
},
errors::{required, MissingField, UnknownEnumVariant},
ibc::google::protobuf::timestamp::Timestamp,
google::protobuf::timestamp::Timestamp,
Proto, TryFromProtoErrorOf, TypeUrl,
};

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::{
#[derive(Debug, Clone, PartialEq)]
pub struct Any<T>(pub T);

/// TODO(unionlabs/union#876): Properly implement google.protobuf.Any json serde
impl<'de, T> Deserialize<'de> for Any<T>
where
T: Deserialize<'de> + TryFromProto,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use serde::{

use crate::{
bounded::{BoundedI32, BoundedI64, BoundedIntError},
ibc::google::protobuf::duration::{Duration, NANOS_PER_SECOND},
google::protobuf::duration::{Duration, NANOS_PER_SECOND},
Proto, TypeUrl,
};

Expand Down
1 change: 0 additions & 1 deletion lib/unionlabs/src/ibc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod applications;
pub mod core;
pub mod google;
pub mod lightclients;
3 changes: 1 addition & 2 deletions lib/unionlabs/src/ibc/core/client/msg_update_client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use serde::{Deserialize, Serialize};

use crate::{
ibc::google::protobuf::any::Any, traits, CosmosAccountId, IntoProto, MsgIntoProto, Proto,
TypeUrl,
google::protobuf::any::Any, traits, CosmosAccountId, IntoProto, MsgIntoProto, Proto, TypeUrl,
};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
Expand Down
3 changes: 2 additions & 1 deletion lib/unionlabs/src/ibc/lightclients/cometbls/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use serde::{Deserialize, Serialize};

use crate::{
errors::{required, MissingField},
ibc::{core::client::height::Height, google::protobuf::duration::Duration},
google::protobuf::duration::Duration,
ibc::core::client::height::Height,
Proto, TryFromProtoErrorOf, TypeUrl,
};

Expand Down
5 changes: 4 additions & 1 deletion lib/unionlabs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ use sha2::Digest;

use crate::{errors::TryFromBranchError, ethereum::H256, id::Bounded, validated::Validated};

/// Wrapper types around protos defined in <https://github.com/cosmos/gogoproto/tree/main/protobuf/google/protobuf>, matching the proto module structure.
pub mod google;

/// Defines types that wrap the IBC specification, matching the proto module structure. This also includes `union` extensions to ibc (i.e. types defined in `union.ibc`).
pub mod ibc;

Expand Down Expand Up @@ -438,9 +441,9 @@ pub mod traits {
use crate::{
ethereum::{H256, U256},
ethereum_consts_traits::ChainSpec,
google::protobuf::any::Any,
ibc::{
core::client::height::{Height, IsHeight},
google::protobuf::any::Any,
lightclients::{cometbls, ethereum, wasm},
},
id::{ChannelId, PortId},
Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/src/tendermint/types/commit_sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::{
errors::{required, InvalidLength, MissingField},
ethereum::{Address, H512},
ibc::google::protobuf::timestamp::Timestamp,
google::protobuf::timestamp::Timestamp,
tendermint::types::block_id_flag::BlockIdFlag,
Proto, TryFromProtoErrorOf, TypeUrl,
};
Expand Down
2 changes: 1 addition & 1 deletion lib/unionlabs/src/tendermint/types/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
bounded::{BoundedI64, BoundedIntError},
errors::{required, InvalidLength, MissingField},
ethereum::{Address, H256},
ibc::google::protobuf::timestamp::Timestamp,
google::protobuf::timestamp::Timestamp,
tendermint::{types::block_id::BlockId, version::consensus::Consensus},
Proto, TryFromProtoErrorOf, TypeUrl,
};
Expand Down
2 changes: 1 addition & 1 deletion light-clients/cometbls-light-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use ics008_wasm_client::{
};
use prost::Message;
use unionlabs::{
google::protobuf::timestamp::Timestamp,
ibc::{
core::{client::height::Height, commitment::merkle_root::MerkleRoot},
google::protobuf::timestamp::Timestamp,
lightclients::cometbls::{
client_state::ClientState, consensus_state::ConsensusState, header::Header,
},
Expand Down
1 change: 1 addition & 0 deletions tools/todo-comment.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
name = "tdc";
runtimeInputs = with pkgs; [ gh coreutils ];
text = ''
gh auth login
TODO_ID=$(gh issue create -t "$1" -b "_Generated by the devShell's \`tdc\` cli_" --label "todo comment" -a "@me" | tail -n 1 | sed 's|https://github.com/\(.*\)/issues/\(.*\)|\1#\2|');
echo "TODO($TODO_ID): $1"
'';
Expand Down
2 changes: 1 addition & 1 deletion voyager/src/chain/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use unionlabs::{
Address,
},
ethereum_consts_traits::{ChainSpec, Mainnet, Minimal},
google::protobuf::any::Any,
ibc::{
core::{
client::{
Expand All @@ -45,7 +46,6 @@ use unionlabs::{
},
connection::connection_end::ConnectionEnd,
},
google::protobuf::any::Any,
lightclients::{
ethereum::{
self,
Expand Down
4 changes: 2 additions & 2 deletions voyager/src/chain/union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ use unionlabs::{
bounded::BoundedI64,
ethereum::{Address, H256, H512},
ethereum_consts_traits::{ChainSpec, Mainnet, Minimal},
google::protobuf::{any::Any, timestamp::Timestamp},
ibc::{
core::{
client::{height::Height, msg_update_client::MsgUpdateClient},
connection::connection_end::ConnectionEnd,
},
google::protobuf::{any::Any, timestamp::Timestamp},
lightclients::{cometbls, ethereum, wasm},
},
id::ClientId,
Expand Down Expand Up @@ -411,7 +411,7 @@ where
tendermint::block::CommitSig::BlockIdFlagAbsent => CommitSig {
block_id_flag: BlockIdFlag::Absent,
validator_address: Address([0; 20]),
timestamp: unionlabs::ibc::google::protobuf::timestamp::Timestamp {
timestamp: unionlabs::google::protobuf::timestamp::Timestamp {
seconds: 0.try_into().unwrap(),
nanos: 0.try_into().unwrap(),
},
Expand Down
Loading

0 comments on commit ecdddfe

Please sign in to comment.