Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Refactor: Decouple *Client types from Any* types #60

Merged
merged 28 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5e105fa
Decouple `*Client` types from `Any*` types
vmarkushin Sep 1, 2022
4ade2bc
Remove unused bounds and imports
vmarkushin Sep 7, 2022
4a1b9ec
Fix tests
vmarkushin Sep 8, 2022
df23299
Remove commented code
vmarkushin Sep 9, 2022
c259764
Merge branch 'master' into trait-refactor
vmarkushin Sep 9, 2022
f9eeded
Fix warnings
vmarkushin Sep 9, 2022
c31b5c8
Fix more warnings
vmarkushin Sep 9, 2022
0beda80
ClientTypes should only exist on ClientKeeper
seunlanlege Sep 9, 2022
b17d4e3
Merge remote-tracking branch 'origin/trait-refactor' into trait-refactor
vmarkushin Sep 9, 2022
1d0abdf
Finish "ClientTypes should only exist on ClientKeeper"
vmarkushin Sep 9, 2022
ae5075f
Get rid of `GlobalDefs`
vmarkushin Sep 9, 2022
bba9089
fix tests
vmarkushin Sep 9, 2022
e3d3ac7
remove unused functions
vmarkushin Sep 12, 2022
72923bc
Proc-macros for `Any*` types + Protobuf generation
vmarkushin Sep 13, 2022
97d6660
Move client types to a separate crate
vmarkushin Sep 13, 2022
6c0b276
fix tests
vmarkushin Sep 14, 2022
47fd91b
remove ics18-relayer
vmarkushin Sep 15, 2022
207ecde
make `downcast` and `wrap` return Option
vmarkushin Sep 15, 2022
04bdb0d
HostFunctions is now the responsibility of Clients
seunlanlege Sep 15, 2022
43fe236
Make `ClientType` - `str`
vmarkushin Sep 15, 2022
db01785
Merge remote-tracking branch 'origin/trait-refactor' into trait-refactor
vmarkushin Sep 15, 2022
f638bb0
Finish 'HostFunctions is now the responsibility of Clients'
vmarkushin Sep 16, 2022
ca6b668
cargo fix & fmt
vmarkushin Sep 16, 2022
ea59e8a
Clean up dependencies
vmarkushin Sep 16, 2022
e58dbdc
re-introduce host consensus state proofs
seunlanlege Sep 16, 2022
b5efb25
fix compilation
seunlanlege Sep 16, 2022
a1747b2
remove clients
seunlanlege Sep 16, 2022
cbe3fac
cargo fmt
seunlanlege Sep 16, 2022
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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false, optional = true }
sha3 = { version = "0.10.1", optional = true }
ripemd = { version = "0.1.1", optional = true }
derivative = { version = "2.2.0", default-features = false }

primitive-types = { version = "0.11.1", default-features = false, features = ["serde_no_std"] }

Expand Down
15 changes: 10 additions & 5 deletions modules/src/clients/host_functions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::core::ics02_client::error::Error;
use crate::prelude::*;
use core::marker::PhantomData;
use derivative::Derivative;

/// This trait captures all the functions that the host chain should provide for
/// crypto operations.
Expand Down Expand Up @@ -62,7 +63,14 @@ pub trait HostFunctionsProvider: Clone + Send + Sync + Default {
/// This is a work around that allows us to have one super trait [`HostFunctionsProvider`]
/// that encapsulates all the needed host functions by different subsytems, and then
/// implement the needed traits through this wrapper.
#[derive(Clone, Debug, Default)]
#[derive(Derivative)]
#[derivative(
Debug(bound = ""),
vmarkushin marked this conversation as resolved.
Show resolved Hide resolved
PartialEq(bound = ""),
Eq(bound = ""),
Clone(bound = ""),
Default(bound = "")
)]
pub struct HostFunctionsManager<T: HostFunctionsProvider>(PhantomData<T>);

// implementation for beefy host functions
Expand Down Expand Up @@ -114,10 +122,7 @@ where
}

// implementation for ics23
impl<H> ics23::HostFunctionsProvider for HostFunctionsManager<H>
where
H: HostFunctionsProvider,
{
impl<H: HostFunctionsProvider> ics23::HostFunctionsProvider for HostFunctionsManager<H> {
fn sha2_256(message: &[u8]) -> [u8; 32] {
H::sha2_256(message)
}
Expand Down
Loading