Skip to content

Commit

Permalink
Revert "feat(sentinel): Sentinel " (#2276)
Browse files Browse the repository at this point in the history
Reverts #2127
  • Loading branch information
KaiserKarel authored Jun 25, 2024
2 parents e4845c9 + e84c241 commit ef0d35a
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 2,474 deletions.
64 changes: 5 additions & 59 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ members = [
"near/near-light-client",
"near/dummy-ibc-app",
"near/near-ibc-tests",
"sentinel",
]

[workspace.package]
Expand Down Expand Up @@ -125,7 +124,6 @@ ssz-derive = { path = "lib/ssz-derive", default-features = false
tendermint-light-client = { path = "light-clients/tendermint-light-client", default-features = false }
tendermint-verifier = { path = "lib/tendermint-verifier", default-features = false }
token-factory-api = { path = "cosmwasm/token-factory-api", default-features = false }
ucs01-relay = { path = "cosmwasm/ucs01-relay", default-features = false }
ucs01-relay-api = { path = "cosmwasm/ucs01-relay-api", default-features = false }
unionlabs = { path = "lib/unionlabs", default-features = false }
voyager-message = { path = "lib/voyager-message", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@
./devnet-compose/devnet-compose.nix
./faucet/faucet.nix
./ucli/ucli.nix
./sentinel/sentinel.nix
treefmt-nix.flakeModule
];

Expand Down
6 changes: 2 additions & 4 deletions lib/block-message/src/chain/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use unionlabs::{
},
ics24::ChannelEndPath,
id::ClientIdValidator,
traits::{ChainIdOf, ClientIdOf, HeightOf},
traits::{Chain, ChainIdOf, ClientIdOf, HeightOf},
validated::ValidateT,
};

Expand All @@ -54,9 +54,7 @@ use crate::{
id, AnyChainIdentified, BlockMessage, ChainExt, DoAggregate, Identified, IsAggregateData,
};

pub trait EthereumChainExt = ChainExt
+ chain_utils::ethereum::EthereumExecutionRpcsExt
+ chain_utils::ethereum::EthereumChain;
pub trait EthereumChainExt = ChainExt + chain_utils::ethereum::EthereumChainExt;

impl<C: ChainSpec> ChainExt for Ethereum<C> {
type Data = EthereumData<C>;
Expand Down
6 changes: 3 additions & 3 deletions lib/chain-utils/src/arbitrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use unionlabs::{
use crate::{
ethereum::{
self, balance_of_signers, get_proof, Ethereum, EthereumChain, EthereumConsensusChain,
EthereumExecutionRpcs, EthereumInitError, EthereumKeyring, EthereumSignerMiddleware,
EthereumSignersConfig, ReadWrite, Readonly,
EthereumInitError, EthereumKeyring, EthereumSignerMiddleware, EthereumSignersConfig,
ReadWrite, Readonly,
},
keyring::{ChainKeyring, ConcurrentKeyring, KeyringConfig, SignerBalance},
union::Union,
Expand Down Expand Up @@ -155,7 +155,7 @@ impl Arbitrum {
}
}

impl EthereumExecutionRpcs for Arbitrum {
impl EthereumChain for Arbitrum {
fn provider(&self) -> Arc<Provider<Ws>> {
self.provider.clone()
}
Expand Down
8 changes: 4 additions & 4 deletions lib/chain-utils/src/berachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ use unionlabs::{

use crate::{
ethereum::{
self, balance_of_signers, EthereumChain, EthereumConsensusChain, EthereumExecutionRpcs,
EthereumSignerMiddleware, EthereumSignersConfig, ReadWrite,
self, balance_of_signers, EthereumChain, EthereumConsensusChain, EthereumSignerMiddleware,
EthereumSignersConfig, ReadWrite,
},
keyring::{ChainKeyring, ConcurrentKeyring, SignerBalance},
};
Expand Down Expand Up @@ -189,7 +189,7 @@ impl Chain for Berachain {
denominator: option_unwrap!(NonZeroU64::new(3)),
}
},
trusting_period: const { result_unwrap!(Duration::new((UNBONDING_PERIOD * 85) / 100, 0)) },
trusting_period: const { result_unwrap!(Duration::new(UNBONDING_PERIOD * 85 / 100, 0)) },
max_clock_drift: const { result_unwrap!(Duration::new(60 * 10, 0)) },
frozen_height: None,
latest_height: Height {
Expand Down Expand Up @@ -234,7 +234,7 @@ impl Chain for Berachain {
}
}

impl EthereumExecutionRpcs for Berachain {
impl EthereumChain for Berachain {
fn provider(&self) -> Arc<Provider<Ws>> {
self.provider.clone()
}
Expand Down
13 changes: 5 additions & 8 deletions lib/chain-utils/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,14 @@ pub type EthereumSignerMiddleware =

// NOTE: ClientType bound is temporary until I figure out a better way to deal with client types
/// A chain running the EVM and our solidity IBC stack. This can be any Ethereum L1 or L2, or a chain running the EVM in a different environment (such as Berachain).
pub trait EthereumExecutionRpcs {
pub trait EthereumChain: Chain<IbcStateEncoding = EthAbi, ClientType = String> {
/// The provider connected to this chain's [JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/).
fn provider(&self) -> Arc<Provider<Ws>>;

/// The address of the [`IBCHandler`] smart contract deployed natively on this chain.
fn ibc_handler_address(&self) -> H160;
}

pub trait EthereumChain =
EthereumExecutionRpcs + Chain<IbcStateEncoding = EthAbi, ClientType = String>;

/// An Ethereum-based chain. This can be any chain that is based off of and settles on Ethereum (i.e. Ethereum mainnet/ Sepolia, L2s such as Scroll).
pub trait EthereumConsensusChain: EthereumChain<StateProof = StorageProof> {
/// Fetch the execution height associated with the given beacon slot. For [`Ethereum`], this will simply be the execution block number, but for L2s this will fetch the settled height at the L1 block number.
Expand All @@ -77,17 +74,17 @@ pub trait EthereumConsensusChain: EthereumChain<StateProof = StorageProof> {
) -> impl Future<Output = StorageProof>;
}

#[diagnostic::on_unimplemented(message = "{Self} does not implement `EthereumExecutionRpcs`")]
pub trait EthereumExecutionRpcsExt: EthereumExecutionRpcs {
#[diagnostic::on_unimplemented(message = "{Self} does not implement `EthereumChain`")]
pub trait EthereumChainExt: EthereumChain {
/// Convenience method to construct an [`IBCHandler`] instance for this chain.
fn ibc_handler(&self) -> IBCHandler<Provider<Ws>> {
IBCHandler::new(self.ibc_handler_address(), self.provider())
}
}

impl<T: EthereumExecutionRpcs> EthereumExecutionRpcsExt for T {}
impl<T: EthereumChain> EthereumChainExt for T {}

impl<C: ChainSpec, S: EthereumSignersConfig> EthereumExecutionRpcs for Ethereum<C, S> {
impl<C: ChainSpec, S: EthereumSignersConfig> EthereumChain for Ethereum<C, S> {
fn provider(&self) -> Arc<Provider<Ws>> {
self.provider.clone()
}
Expand Down
10 changes: 4 additions & 6 deletions lib/chain-utils/src/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use unionlabs::{
use crate::{
ethereum::{
self, balance_of_signers, Ethereum, EthereumChain, EthereumConsensusChain,
EthereumExecutionRpcs, EthereumInitError, EthereumKeyring, EthereumSignerMiddleware,
EthereumSignersConfig, ReadWrite, Readonly,
EthereumInitError, EthereumKeyring, EthereumSignerMiddleware, EthereumSignersConfig,
ReadWrite, Readonly,
},
keyring::{ChainKeyring, ConcurrentKeyring, KeyringConfig, SignerBalance},
union::Union,
Expand Down Expand Up @@ -95,7 +95,7 @@ impl ChainKeyring for Scroll {
}
}

impl EthereumExecutionRpcs for Scroll {
impl EthereumChain for Scroll {
fn provider(&self) -> Arc<Provider<Ws>> {
self.provider.clone()
}
Expand Down Expand Up @@ -127,9 +127,7 @@ impl EthereumConsensusChain for Scroll {
let proof = match <[_; 1]>::try_from(proof.storage_proof) {
Ok([proof]) => proof,
Err(invalid) => {
panic!(
"received invalid response from eth_getProof, expected length of 1 but got `{invalid:#?}`"
);
panic!("received invalid response from eth_getProof, expected length of 1 but got `{invalid:#?}`");
}
};

Expand Down
2 changes: 1 addition & 1 deletion lib/relay-message/src/chain/arbitrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::VecDeque, marker::PhantomData};

use chain_utils::{
arbitrum::Arbitrum,
ethereum::{EthereumChain, EthereumConsensusChain, EthereumExecutionRpcsExt, IbcHandlerExt},
ethereum::{EthereumChain, EthereumChainExt, EthereumConsensusChain, IbcHandlerExt},
};
use ethers::providers::Middleware;
use frunk::{hlist_pat, HList};
Expand Down
2 changes: 1 addition & 1 deletion lib/relay-message/src/chain/berachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::VecDeque, marker::PhantomData};

use chain_utils::{
berachain::Berachain,
ethereum::{EthereumConsensusChain, EthereumExecutionRpcsExt, IbcHandlerExt},
ethereum::{EthereumChainExt, EthereumConsensusChain, IbcHandlerExt},
};
use enumorph::Enumorph;
use ethers::providers::Middleware;
Expand Down
Loading

0 comments on commit ef0d35a

Please sign in to comment.