Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make crypto implementations replaceable #1238

Merged
merged 51 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
62dda70
define CryptoProvider trait
blasrodri Oct 17, 2022
b7920c3
wip
blasrodri Oct 17, 2022
c4b52de
implement CryptoProvider for Substrate (WIP)
blasrodri Oct 19, 2022
a35c105
comment issues
blasrodri Oct 19, 2022
47b56bf
ed25519_verify implementation for SubstrateHostFunctionsManager
blasrodri Oct 19, 2022
2d0fc38
introduce EcdsaSecp256k1Signer
blasrodri Oct 19, 2022
6cbcbb3
doc a bit
blasrodri Oct 19, 2022
e6edade
move CryptoProvider to tendermint crate instead
blasrodri Oct 20, 2022
bcd6be0
rename host_functions module to crypto
blasrodri Oct 31, 2022
7f5e812
tendermint: Remove ED25519_SIGNATURE_SIZE
mzabaluev Nov 17, 2022
3fecdef
tendermint: clean up mod crypto
mzabaluev Nov 17, 2022
4a511c5
Disentangle CryptoProvider from k256 crate
mzabaluev Nov 17, 2022
9575852
Add DefaultCryptoProvider
mzabaluev Nov 17, 2022
3573ef0
tendermint: reorg mod crypto
mzabaluev Nov 18, 2022
2baed4f
tendermint: generalize hash methods
mzabaluev Nov 18, 2022
a032364
tendermint: eliminate get_split_point helper
mzabaluev Nov 18, 2022
f264742
light-client: eliminate Hasher
mzabaluev Nov 20, 2022
f0eee32
fix no_std
mzabaluev Nov 21, 2022
ce146c8
Fix the tools build
mzabaluev Nov 23, 2022
4a65669
Fix wasm-light-client build
mzabaluev Nov 23, 2022
d39148d
kvstore-test: No need to copy vec-of-vecs
mzabaluev Nov 24, 2022
4503794
Merge branch 'main' into mikhail/add-crypto-provider
mzabaluev Nov 28, 2022
f1d9593
Merge branch 'main' into mikhail/add-crypto-provider
mzabaluev Dec 1, 2022
ec3cf88
Break down CryptoProvider into functional traits
mzabaluev Dec 1, 2022
5a2dfe5
alt_crypto test: Roll our own signature type
mzabaluev Dec 1, 2022
58c113a
Fix the wasm build
mzabaluev Dec 1, 2022
dcabd56
Fix a clippy lint
mzabaluev Dec 1, 2022
76a3fce
Fix a clippy lint in alt_crypto test
mzabaluev Dec 1, 2022
a9c86f2
Disentangle CommitValidator from the hasher
mzabaluev Dec 2, 2022
79af98a
light-client: Enable shrinking in backward test
mzabaluev Dec 2, 2022
c5ec595
light-client: update edition to rust2021
mzabaluev Dec 2, 2022
4f73378
Recover LightClient::verify_backward
mzabaluev Dec 2, 2022
41efc0b
Fix light-client-js build, record technical debt
mzabaluev Dec 5, 2022
6365d49
tendermint: Make sha2 an optional dependency
mzabaluev Dec 7, 2022
58425b5
Redesign crypto::Sha256, add MerkleHash trait
mzabaluev Dec 13, 2022
1bb92a9
Fix all-features build
mzabaluev Dec 14, 2022
079ec41
chore: fix clippy lints
mzabaluev Dec 14, 2022
1133fd9
tendermint: "rust-crypto" does not imply "k256"
mzabaluev Dec 14, 2022
4a38c73
rpc: require tendermint/rust-crypto
mzabaluev Dec 15, 2022
374303c
Merge branch 'main' into mikhail/add-crypto-provider
mzabaluev Dec 15, 2022
adb6327
Remove a bogus lint override
mzabaluev Dec 15, 2022
eac7b5a
Changelog entry for #1238
mzabaluev Dec 15, 2022
24573b9
Merge branch 'main' into mikhail/add-crypto-provider
mzabaluev Jan 9, 2023
2a7f441
Merge branch 'main' into mikhail/add-crypto-provider
mzabaluev Jan 19, 2023
d525562
tendermint: crypto::signature::Verifier trait
mzabaluev Jan 23, 2023
672db2d
tendermint: fix secp256k1 verification tests
mzabaluev Jan 24, 2023
3d7ee0a
Guard public key extraction with rust-crypto
mzabaluev Jan 24, 2023
3acfa23
tendermint: remove re-exports from signature crate
mzabaluev Jan 24, 2023
2b49f63
tendermint: rework signature in alt_crypto test
mzabaluev Jan 24, 2023
3741884
Updated the changelog entry for #1238
mzabaluev Jan 25, 2023
5ef4502
Merge branch 'main' into mikhail/add-crypto-provider
romac Jan 31, 2023
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
Prev Previous commit
Next Next commit
Fix wasm-light-client build
  • Loading branch information
mzabaluev committed Nov 23, 2022
commit 4a656699e1b0c7800e8a4070d1bf2cb26aa3645b
2 changes: 1 addition & 1 deletion light-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ secp256k1 = ["tendermint/secp256k1", "tendermint-rpc/secp256k1"]
lightstore-sled = ["sled"]
unstable = []
# Enable to execute long-running model-based tests
mbt = []
mbt = ["rust-crypto"]

[dependencies]
tendermint = { version = "0.26.0", path = "../tendermint", default-features = false }
Expand Down
19 changes: 13 additions & 6 deletions light-client/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! Utilities and datatypes for use in tests.

use std::{collections::HashMap, time::Duration};
use std::collections::HashMap;

#[cfg(feature = "rust-crypto")]
use std::time::Duration;

use contracts::contract_trait;
use serde::{Deserialize, Serialize};
Expand All @@ -21,13 +24,14 @@ use crate::{
evidence::EvidenceReporter,
light_client::LightClient,
state::State,
verifier::{
options::Options,
types::{Height, LightBlock, PeerId, SignedHeader, Time, TrustThreshold, ValidatorSet},
ProdVerifier, Verdict, Verifier,
verifier::types::{
Height, LightBlock, PeerId, SignedHeader, Time, TrustThreshold, ValidatorSet,
},
};

#[cfg(feature = "rust-crypto")]
use crate::verifier::{Verdict, Verifier};

#[derive(Deserialize, Clone, Debug)]
pub struct TestCases<LB> {
pub batch_name: String,
Expand Down Expand Up @@ -144,6 +148,7 @@ impl MockEvidenceReporter {
}
}

#[cfg(feature = "rust-crypto")]
pub fn verify_single(
trusted_block: LightBlock,
input: LightBlock,
Expand All @@ -152,7 +157,9 @@ pub fn verify_single(
clock_drift: Duration,
now: Time,
) -> Result<LightBlock, Verdict> {
let verifier = ProdVerifier::default();
use crate::verifier::options::Options;

let verifier = crate::verifier::ProdVerifier::default();

let options = Options {
trust_threshold,
Expand Down