Skip to content

Commit

Permalink
refactor!: refactor repository structure
Browse files Browse the repository at this point in the history
 - forks/ has been removed, and it's contents have been put in lib/
 - utils/rust/serde-utils has been moved to lib/serde-utils
  • Loading branch information
benluelo committed May 24, 2023
1 parent 6f564f0 commit dccaa0b
Show file tree
Hide file tree
Showing 78 changed files with 81 additions and 83 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[workspace]
members = [
"forks/*",
"lib/*",
"light-clients/ethereum-light-client",
"light-clients/wasm-light-client-types",
"generated/rust",
"utils/rust/serde-utils",
"unionvisor",
"relayer"
]
Expand Down
4 changes: 3 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"ignorePaths": [
"light-clients/ethereum-light-client/src/test/valid_light_client_update_*.json",
"generated/**",
"forks/*",
"lib/ethereum-consensus",
"lib/ethereum-verifier",
"lib/lodestar-rpc",
"dictionaries/**",
"**/*.svg",
"**/node_modules",
Expand Down
6 changes: 3 additions & 3 deletions generated/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ default-features = false
features = ["derive"]
version = "1.0"
[dependencies.serde-utils]
path = "../../utils/rust/serde-utils"
path = "../../lib/serde-utils"
[dependencies.tonic]
features = ["gzip"]
optional = true
Expand Down Expand Up @@ -107,7 +107,6 @@ proto_full = [
"ibc+core+commitment+v1",
"ibc+core+connection+v1",
"ibc+core+types+v1",
"ibc+lightclients+ethereum+v1",
"ibc+lightclients+localhost+v2",
"ibc+lightclients+solomachine+v2",
"ibc+lightclients+solomachine+v3",
Expand All @@ -128,6 +127,7 @@ proto_full = [
"tendermint+types",
"tendermint+version",
"union+ibc+lightclients+cometbls+v1",
"union+ibc+lightclients+ethereum+v1",
"union+prover+api+v1",
"union+union",
]
Expand Down Expand Up @@ -282,7 +282,6 @@ proto_full = [
"ibc+core+client+v1",
"ibc+core+connection+v1",
]
"ibc+lightclients+ethereum+v1" = ["ibc+core+client+v1"]
"ibc+lightclients+localhost+v2" = ["ibc+core+client+v1"]
"ibc+lightclients+solomachine+v2" = [
"google+protobuf",
Expand Down Expand Up @@ -331,6 +330,7 @@ proto_full = [
"ibc+core+commitment+v1",
"tendermint+types",
]
"union+ibc+lightclients+ethereum+v1" = ["ibc+core+client+v1"]
"union+prover+api+v1" = ["tendermint+types"]
"union+union" = []
## @@protoc_insertion_point(features)
Expand Down
16 changes: 8 additions & 8 deletions generated/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,14 +660,6 @@ pub mod ibc {
}
}
pub mod lightclients {
pub mod ethereum {
#[cfg(feature = "ibc+lightclients+ethereum+v1")]
// @@protoc_insertion_point(attribute:ibc.lightclients.ethereum.v1)
pub mod v1 {
include!("ibc.lightclients.ethereum.v1.rs");
// @@protoc_insertion_point(ibc.lightclients.ethereum.v1)
}
}
pub mod localhost {
#[cfg(feature = "ibc+lightclients+localhost+v2")]
// @@protoc_insertion_point(attribute:ibc.lightclients.localhost.v2)
Expand Down Expand Up @@ -809,6 +801,14 @@ pub mod union {
// @@protoc_insertion_point(union.ibc.lightclients.cometbls.v1)
}
}
pub mod ethereum {
#[cfg(feature = "union+ibc+lightclients+ethereum+v1")]
// @@protoc_insertion_point(attribute:union.ibc.lightclients.ethereum.v1)
pub mod v1 {
include!("union.ibc.lightclients.ethereum.v1.rs");
// @@protoc_insertion_point(union.ibc.lightclients.ethereum.v1)
}
}
}
}
pub mod prover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ pub struct ClientState {
#[prost(uint64, tag = "11")]
pub latest_execution_block_number: u64,
#[prost(message, optional, tag = "12")]
pub frozen_height: ::core::option::Option<super::super::super::core::client::v1::Height>,
pub frozen_height:
::core::option::Option<super::super::super::super::super::ibc::core::client::v1::Height>,
}
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -79,7 +80,8 @@ pub struct Header {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrustedSyncCommittee {
#[prost(message, optional, tag = "1")]
pub trusted_height: ::core::option::Option<super::super::super::core::client::v1::Height>,
pub trusted_height:
::core::option::Option<super::super::super::super::super::ibc::core::client::v1::Height>,
#[prost(message, optional, tag = "2")]
pub sync_committee: ::core::option::Option<SyncCommittee>,
#[prost(bool, tag = "3")]
Expand Down
4 changes: 4 additions & 0 deletions generated/rust/src/union.prover.api.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ pub struct ZeroKnowledgeProof {
#[prost(bytes = "vec", tag = "1")]
pub content: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub evm_proof: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
pub public_inputs: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -40,6 +42,8 @@ pub struct ProveResponse {
#[prost(message, optional, tag = "1")]
pub proof: ::core::option::Option<ZeroKnowledgeProof>,
#[prost(bytes = "vec", tag = "2")]
pub trusted_validator_set_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
pub untrusted_validator_set_root: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions light-clients/ethereum-light-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ eth-minimal = []
bytes = { version = "1.2.1", default-features = false }
cosmwasm-schema = "1.2.0"
cosmwasm-std = { version = "1.2.0", default-features = false, features = ["abort"] }
ethereum-consensus = { path = "../../forks/ethereum-consensus", default-features = false }
ethereum-light-client-verifier = { path = "../../forks/ethereum-verifier", default-features = false }
ethereum-consensus = { path = "../../lib/ethereum-consensus", default-features = false }
ethereum-light-client-verifier = { path = "../../lib/ethereum-verifier", default-features = false }
hex = { version = "0.4", default-features = false }
ibc = { version = "0.37.0", default-features = false, features = [ "serde" ] }
protos = { path = "../../generated/rust", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions light-clients/ethereum-light-client/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use ibc::{
use prost::Message;
use protos::{
google::protobuf::Any,
ibc::lightclients::ethereum::v1::{ClientState as RawClientState, Fork},
union::ibc::lightclients::ethereum::v1::{ClientState as RawClientState, Fork},
// protobuf::Protobuf,
};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -191,7 +191,7 @@ impl TryFrom<RawClientState> for ClientState {
impl From<ClientState> for RawClientState {
fn from(value: ClientState) -> Self {
use protos::ibc::core::client::v1::Height as ProtoHeight;
use protos::ibc::lightclients::ethereum::v1::{
use protos::union::ibc::lightclients::ethereum::v1::{
ForkParameters as ProtoForkParameters, Fraction as ProtoFraction,
};

Expand Down
2 changes: 1 addition & 1 deletion light-clients/ethereum-light-client/src/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ibc::core::ics23_commitment::commitment::CommitmentRoot;
use prost::Message;
use protos::{
google::protobuf::Any as IBCAny,
ibc::lightclients::ethereum::v1::ConsensusState as RawConsensusState,
union::ibc::lightclients::ethereum::v1::ConsensusState as RawConsensusState,
};

pub const ETHEREUM_CONSENSUS_STATE_TYPE_URL: &str = "/ibc.lightclients.ethereum.v1.ConsensusState";
Expand Down
6 changes: 2 additions & 4 deletions light-clients/ethereum-light-client/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ use ethereum_consensus::{
use ethereum_light_client_verifier::consensus::SyncProtocolVerifier;
use ibc::core::ics24_host::Path;
use prost::Message;
use protos::ibc::{
core::connection::v1::ConnectionEnd,
lightclients::ethereum::v1::{Header as RawEthHeader, StorageProof},
};
use protos::ibc::core::connection::v1::ConnectionEnd;
use protos::union::ibc::lightclients::ethereum::v1::{Header as RawEthHeader, StorageProof};
use std::str::FromStr;
use wasm_light_client_types::msg::{
ClientMessage, ContractResult, Height, MerklePath, Status, StatusResponse,
Expand Down
7 changes: 2 additions & 5 deletions light-clients/ethereum-light-client/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ use crate::{
};
use ibc::timestamp::Timestamp;
use prost::Message;
use protos::{
google::protobuf::Any as IBCAny,
ibc::lightclients::ethereum::v1::Header as RawHeader,
// protobuf::Protobuf,
};
use protos::google::protobuf::Any as IBCAny;
use protos::union::ibc::lightclients::ethereum::v1::Header as RawHeader;

pub const ETHEREUM_HEADER_TYPE_URL: &str = "/ibc.lightclients.ethereum.v1.Header";

Expand Down
2 changes: 1 addition & 1 deletion light-clients/ethereum-light-client/src/misbehaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ethereum_light_client_verifier::misbehaviour::{
use ibc::core::ics24_host::identifier::ClientId;
use prost::Message;
use protos::google::protobuf::Any as IBCAny;
use protos::ibc::lightclients::ethereum::v1::{
use protos::union::ibc::lightclients::ethereum::v1::{
FinalizedHeaderMisbehaviour as RawFinalizedHeaderMisbehaviour,
NextSyncCommitteeMisbehaviour as RawNextSyncCommitteeMisbehaviour,
};
Expand Down
8 changes: 5 additions & 3 deletions light-clients/ethereum-light-client/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use ibc::Height;
use prost::Message;
use protos::{
google::protobuf::Any,
ibc::lightclients::{
ethereum::v1::{ClientState as RawClientState, ConsensusState as RawConsensusState},
wasm::v1::{ClientState as WasmClientState, ConsensusState as WasmConsensusState},
ibc::lightclients::wasm::v1::{
ClientState as WasmClientState, ConsensusState as WasmConsensusState,
},
union::ibc::lightclients::ethereum::v1::{
ClientState as RawClientState, ConsensusState as RawConsensusState,
},
};

Expand Down
16 changes: 7 additions & 9 deletions light-clients/ethereum-light-client/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ use ethereum_light_client_verifier::updates::{
capella::ConsensusUpdateInfo as CapellaConsensusUpdateInfo, ConsensusUpdate,
};
use ibc::Height;
use protos::ibc::{
core::client::v1::Height as ProtoHeight,
lightclients::ethereum::v1::{
AccountUpdate as ProtoAccountUpdate, BeaconBlockHeader as ProtoBeaconBlockHeader,
ExecutionPayloadHeader as ProtoExecutionPayloadHeader,
LightClientHeader as ProtoLightClientHeader, LightClientUpdate as ProtoLightClientUpdate,
SyncAggregate as ProtoSyncAggregate, SyncCommittee as ProtoSyncCommittee,
TrustedSyncCommittee as ProtoTrustedSyncCommittee,
},
use protos::ibc::core::client::v1::Height as ProtoHeight;
use protos::union::ibc::lightclients::ethereum::v1::{
AccountUpdate as ProtoAccountUpdate, BeaconBlockHeader as ProtoBeaconBlockHeader,
ExecutionPayloadHeader as ProtoExecutionPayloadHeader,
LightClientHeader as ProtoLightClientHeader, LightClientUpdate as ProtoLightClientUpdate,
SyncAggregate as ProtoSyncAggregate, SyncCommittee as ProtoSyncCommittee,
TrustedSyncCommittee as ProtoTrustedSyncCommittee,
};
use ssz_rs::{Bitvector, Deserialize, Vector};

Expand Down
4 changes: 2 additions & 2 deletions relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ tokio = { version = "1.27.0", features = ["macros"] }
protos = { path = "../generated/rust", features = ["proto_full", "client"] }
tonic = { version = "0.8", features = ["transport","tls","tls-roots","tls-webpki-roots"] }
tower = { version = "*", features = ["log"] }
ethereum-consensus = { path = "../forks/ethereum-consensus", default-features = false }
lodestar-rpc = { path = "../forks/lodestar-rpc", default-features = false }
ethereum-consensus = { path = "../lib/ethereum-consensus", default-features = false }
lodestar-rpc = { path = "../lib/lodestar-rpc", default-features = false }
reqwest = { version = "0.11.17", default-features = false, features = ["tokio-rustls"] }
bech32 = "0.9.1"
subtle-encoding = { version = "0.5.1", features = ["bech32-preview"] }
Expand Down
16 changes: 7 additions & 9 deletions relayer/src/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ use protos::{
Height, MsgCreateClient, MsgUpdateClient, QueryClientStateRequest,
QueryClientStateResponse,
},
lightclients::{
ethereum::{
self,
v1::{
AccountUpdate, BeaconBlockHeader, ExecutionPayloadHeader, LightClientUpdate,
SyncAggregate, TrustedSyncCommittee,
},
},
wasm::{self, v1::QueryCodeIdsRequest},
lightclients::wasm::{self, v1::QueryCodeIdsRequest},
},
union::ibc::lightclients::ethereum::{
self,
v1::{
AccountUpdate, BeaconBlockHeader, ExecutionPayloadHeader, LightClientUpdate,
SyncAggregate, TrustedSyncCommittee,
},
},
};
Expand Down
52 changes: 26 additions & 26 deletions tools/rust-proto.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
serde = { version = "1.0"; default-features = false; features = ["derive"]; };
tonic = { version = "0.8"; features = [ "gzip" ]; optional = true; };
schemars = { version = "0.8.3"; default-features = false; optional = true; };
serde-utils = { path = "../../utils/rust/serde-utils"; };
serde-utils = { path = "../../lib/serde-utils"; };
};
features = {
default = [ "proto_full" "std" ];
Expand Down Expand Up @@ -163,7 +163,7 @@
".ibc.applications.interchain_accounts.v1" = [ serde ];
".ibc.applications.interchain_accounts.controller.v1" = [ serde ];
".ibc.lightclients.wasm.v1" = [ serde ];
".ibc.lightclients.ethereum.v1" = [ serde ];
".union.ibc.lightclients.ethereum.v1" = [ serde ];
".cosmos.ics23.v1" = [ serde ];
".cosmos.ics23.v1.LeafOp" = [ jsonschema eq ];
".cosmos.ics23.v1.InnerOp" = [ jsonschema eq ];
Expand All @@ -184,29 +184,29 @@
".ibc.lightclients.wasm.v1.ClientState.code_id" = [ serde_base64 ];
".ibc.lightclients.wasm.v1.ConsensusState.data" = [ serde_base64 ];
".ibc.lightclients.wasm.v1.Header.data" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.SyncCommittee.aggregate_pubkey" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.SyncCommittee.pubkeys" = [ serde_inner_base64 ];
".ibc.lightclients.ethereum.v1.BeaconBlockHeader.parent_root" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.BeaconBlockHeader.state_root" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.BeaconBlockHeader.body_root" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.parent_hash" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.fee_recipient" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.state_root" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.receipts_root" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.logs_bloom" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.prev_randao" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.extra_data" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.base_fee_per_gas" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.block_hash" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.transactions_root" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.withdrawals_root" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.LightClientHeader.execution_branch" = [ serde_inner_base64 ];
".ibc.lightclients.ethereum.v1.LightClientUpdate.next_sync_committee_branch" = [ serde_inner_base64 ];
".ibc.lightclients.ethereum.v1.LightClientUpdate.finality_branch" = [ serde_inner_base64 ];
".ibc.lightclients.ethereum.v1.SyncAggregate.sync_committee_bits" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.SyncAggregate.sync_committee_signature" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.AccountUpdate.account_proof" = [ serde_base64 ];
".ibc.lightclients.ethereum.v1.AccountUpdate.account_storage_root" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.SyncCommittee.aggregate_pubkey" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.SyncCommittee.pubkeys" = [ serde_inner_base64 ];
".union.ibc.lightclients.ethereum.v1.BeaconBlockHeader.parent_root" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.BeaconBlockHeader.state_root" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.BeaconBlockHeader.body_root" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.parent_hash" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.fee_recipient" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.state_root" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.receipts_root" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.logs_bloom" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.prev_randao" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.extra_data" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.base_fee_per_gas" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.block_hash" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.transactions_root" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader.withdrawals_root" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.LightClientHeader.execution_branch" = [ serde_inner_base64 ];
".union.ibc.lightclients.ethereum.v1.LightClientUpdate.next_sync_committee_branch" = [ serde_inner_base64 ];
".union.ibc.lightclients.ethereum.v1.LightClientUpdate.finality_branch" = [ serde_inner_base64 ];
".union.ibc.lightclients.ethereum.v1.SyncAggregate.sync_committee_bits" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.SyncAggregate.sync_committee_signature" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.AccountUpdate.account_proof" = [ serde_base64 ];
".union.ibc.lightclients.ethereum.v1.AccountUpdate.account_storage_root" = [ serde_base64 ];
".cosmos.ics23.v1.LeafOp.prehash_key" = [ serde_default ];
".cosmos.ics23.v1.LeafOp.prefix" = [ jsonschema_str serde_base64 ];
".cosmos.ics23.v1.InnerOp.prefix" = [ serde_base64 jsonschema_str ];
Expand Down Expand Up @@ -326,7 +326,7 @@
outdir="generated/rust"
cp -r ${rust-proto}/* $outdir
cp -r --no-preserve=mode ${rust-proto}/* $outdir
echo "Generation successful!"
'';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ syntax = "proto3";

package union.ibc.lightclients.cometbls.v1;

option go_package = "github.com/unionfi/cometbls/types";

import "tendermint/types/types.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package union.ibc.lightclients.ethereum.v1;

option go_package = "github.com/datachainlab/ethereum-lcp/go/light-clients/ethereum/types";
option go_package = "union/ibc/lightclients/ethereum";
import "ibc/core/client/v1/client.proto";

message StorageProof {
Expand Down

0 comments on commit dccaa0b

Please sign in to comment.