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

Commits on Nov 17, 2022

  1. define CryptoProvider trait

    blasrodri authored and mzabaluev committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    62dda70 View commit details
    Browse the repository at this point in the history
  2. wip

    blasrodri authored and mzabaluev committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    b7920c3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c4b52de View commit details
    Browse the repository at this point in the history
  4. comment issues

    blasrodri authored and mzabaluev committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    a35c105 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    47b56bf View commit details
    Browse the repository at this point in the history
  6. introduce EcdsaSecp256k1Signer

    blasrodri authored and mzabaluev committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    2d0fc38 View commit details
    Browse the repository at this point in the history
  7. doc a bit

    blasrodri authored and mzabaluev committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    6cbcbb3 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e6edade View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    bcd6be0 View commit details
    Browse the repository at this point in the history
  10. tendermint: Remove ED25519_SIGNATURE_SIZE

    It has been deprecated for some time.
    mzabaluev committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    7f5e812 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3fecdef View commit details
    Browse the repository at this point in the history
  12. Disentangle CryptoProvider from k256 crate

    The API needs to be abstract, so make p256k1 signature
    an associated type of CryptoProvider.
    mzabaluev committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    4a511c5 View commit details
    Browse the repository at this point in the history
  13. Add DefaultCryptoProvider

    Guarded by the rust-crypto feature, this is an implementation of
    CryptoProvider with pure Rust crates.
    mzabaluev committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    9575852 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2022

  1. tendermint: reorg mod crypto

    Move CryptoProvider definition out of the crypto module into
    the provider sub-module. Rename default_provider to default.
    mzabaluev committed Nov 18, 2022
    Configuration menu
    Copy the full SHA
    3573ef0 View commit details
    Browse the repository at this point in the history
  2. tendermint: generalize hash methods

    Add generic methods Header::hash_with and ValidatorSet::hash_with
    enabling a custom CryptoProvider to be plugged in for calculating
    hashes.
    The .hash() methods, implemented with the DefaultCryptoProvider,
    are feature-gated behind "rust-crypto".
    mzabaluev committed Nov 18, 2022
    Configuration menu
    Copy the full SHA
    2baed4f View commit details
    Browse the repository at this point in the history
  3. tendermint: eliminate get_split_point helper

    2usize.next_power_of_two() / 1 == 1, and we have eliminated the other
    two explicitly matched cases at the call site, so the non-catchall
    match branches and the panics are dead code.
    mzabaluev committed Nov 18, 2022
    Configuration menu
    Copy the full SHA
    a032364 View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2022

  1. light-client: eliminate Hasher

    The Hasher trait is obviated by CryptoProvider.
    Also, we could do with less dynamic dispatching.
    mzabaluev committed Nov 21, 2022
    Configuration menu
    Copy the full SHA
    f264742 View commit details
    Browse the repository at this point in the history
  2. fix no_std

    mzabaluev committed Nov 21, 2022
    Configuration menu
    Copy the full SHA
    f0eee32 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2022

  1. Fix the tools build

    mzabaluev committed Nov 23, 2022
    Configuration menu
    Copy the full SHA
    ce146c8 View commit details
    Browse the repository at this point in the history
  2. Fix wasm-light-client build

    mzabaluev committed Nov 23, 2022
    Configuration menu
    Copy the full SHA
    4a65669 View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2022

  1. Configuration menu
    Copy the full SHA
    d39148d View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2022

  1. Configuration menu
    Copy the full SHA
    4503794 View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2022

  1. Configuration menu
    Copy the full SHA
    f1d9593 View commit details
    Browse the repository at this point in the history
  2. Break down CryptoProvider into functional traits

    Instead of a super-trait whose sole purpose is to bind down some
    associated types that provide the actual functionality, provide:
    - Sha256, a purpose-specific trait for SHA256 hashing that has
      a more human-friendly interface than rust-crypto.
    - Nothing else for signing and verifying! These are covered by the
      signature framework, and it's easy to plug into that as the
      alt_crypto test demonstrates.
    
    The crypto::default module, gated by the "rust-crypto" feature,
    provides aliases for pure Rust implementations.
    mzabaluev committed Dec 1, 2022
    Configuration menu
    Copy the full SHA
    ec3cf88 View commit details
    Browse the repository at this point in the history
  3. alt_crypto test: Roll our own signature type

    An alt implementation would not be able to reuse the signature
    type from k256.
    mzabaluev committed Dec 1, 2022
    Configuration menu
    Copy the full SHA
    5a2dfe5 View commit details
    Browse the repository at this point in the history
  4. Fix the wasm build

    mzabaluev committed Dec 1, 2022
    Configuration menu
    Copy the full SHA
    58c113a View commit details
    Browse the repository at this point in the history
  5. Fix a clippy lint

    mzabaluev committed Dec 1, 2022
    Configuration menu
    Copy the full SHA
    dcabd56 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    76a3fce View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2022

  1. Disentangle CommitValidator from the hasher

    Remove the only purpose for using a hasher in the implementation
    by returning the set of validators in
    VerificationErrorDetail::FaultySigner.
    
    CommitValidator can now revert to being a (weird) default-implemented
    trait, with a ProdCommitValidator to anchor the implementation.
    mzabaluev committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    a9c86f2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    79af98a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c5ec595 View commit details
    Browse the repository at this point in the history
  4. Recover LightClient::verify_backward

    A critical code block was hastily commented out in this
    "unstable" part of code.
    mzabaluev committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    4f73378 View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2022

  1. Configuration menu
    Copy the full SHA
    41efc0b View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2022

  1. tendermint: Make sha2 an optional dependency

    Use the Sha2 alias from crypto::default instead of the direct
    references to sha2 crate. All code that used Sha2 non-generically
    is feature-gated behind "rust-crypto".
    mzabaluev committed Dec 7, 2022
    Configuration menu
    Copy the full SHA
    6365d49 View commit details
    Browse the repository at this point in the history

Commits on Dec 13, 2022

  1. Redesign crypto::Sha256, add MerkleHash trait

    The host API for obtaining SHA256 digests on Substrate is a simple
    function, it cannot work incrementally. Change the Sha256 trait to
    match this, but provide a MerkleHash trait to retain incremental
    Merkle hashing with Rust-Crypto conformant digest implementations.
    The merkle::NonIncremental adapter type is provided to fit the lowest common
    denominator Sha256 API to a Merkle hash implementation, at the
    cost of some allocations and extra copying.
    mzabaluev committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    58425b5 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2022

  1. Fix all-features build

    mzabaluev committed Dec 14, 2022
    Configuration menu
    Copy the full SHA
    1bb92a9 View commit details
    Browse the repository at this point in the history
  2. chore: fix clippy lints

    mzabaluev committed Dec 14, 2022
    Configuration menu
    Copy the full SHA
    079ec41 View commit details
    Browse the repository at this point in the history
  3. tendermint: "rust-crypto" does not imply "k256"

    Also rename crypto::default::ecdsa_secp256 to ecdsa_secp256k1,
    to harmonize the naming with the feature that gates this module.
    mzabaluev committed Dec 14, 2022
    Configuration menu
    Copy the full SHA
    1133fd9 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2022

  1. rpc: require tendermint/rust-crypto

    Needed for NodeKey.
    mzabaluev committed Dec 15, 2022
    Configuration menu
    Copy the full SHA
    4a38c73 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    374303c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    adb6327 View commit details
    Browse the repository at this point in the history
  4. Changelog entry for #1238

    mzabaluev committed Dec 15, 2022
    Configuration menu
    Copy the full SHA
    eac7b5a View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2023

  1. Configuration menu
    Copy the full SHA
    24573b9 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2023

  1. Configuration menu
    Copy the full SHA
    2a7f441 View commit details
    Browse the repository at this point in the history

Commits on Jan 24, 2023

  1. tendermint: crypto::signature::Verifier trait

    Define Verifier trait to abstract signature verification given a
    PublicKey.
    
    The ed25519-consensus dependency is made optional and gated by the
    "rust-crypto" feature.
    The Verifier implementation is provided for a dummy type
    crate::crypto::default::signature::Verifier, using ed25519-consensus.
    The Ed25519 key types in public_key and private_key module are redefined
    to in-crate newtypes.
    mzabaluev committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    d525562 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    672db2d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3d7ee0a View commit details
    Browse the repository at this point in the history
  4. tendermint: remove re-exports from signature crate

    As we don't currently use the signature framework, it makes no
    sense to provide its traits through the crate.
    mzabaluev committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    3acfa23 View commit details
    Browse the repository at this point in the history
  5. tendermint: rework signature in alt_crypto test

    Implement the new Verifier trait instead of the signature traits.
    mzabaluev committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    2b49f63 View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2023

  1. Configuration menu
    Copy the full SHA
    3741884 View commit details
    Browse the repository at this point in the history

Commits on Jan 31, 2023

  1. Configuration menu
    Copy the full SHA
    5ef4502 View commit details
    Browse the repository at this point in the history