Skip to content

Commit

Permalink
feat: signers (#44)
Browse files Browse the repository at this point in the history
* init

* setup

* wip

* cfg stuff

* chore: clippy

* signature methods, tests

* fix mnemonic test

* fixes

* wip: split to crates

* fixes

* chore: clippy

* sort

* chore: consolidate aws to a single file

* rename `{Ledger,Trezor}` to `{Ledger,Trezor}Signer`

* restructure

* add `set_chain_id`, provide a default `with_chain_id`

* bump AWS to 1.0

* better default impls for trait methods, sync feature

* remove Error GAT

* remove chain_id

* chore: clippy

* feats

* msrv

* deps

* wazm

* stop failing

* asynctrait

* tracing

* update ledger

* Revert "remove chain_id"

This reverts commit 0514193.

* split signer into two traits

* make async the default method name

* docs

* make signature copy

* wallet error module

* docs

* update ledger tests

* update ledger tests again

* use serial

* fix

* todos

* auto_impl
  • Loading branch information
DaniPopes authored Dec 12, 2023
1 parent d453a02 commit 16300ad
Show file tree
Hide file tree
Showing 33 changed files with 3,310 additions and 25 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: ["stable", "beta", "nightly", "1.65"] # MSRV
rust: ["stable", "beta", "nightly", "1.68"] # MSRV
flags: ["--no-default-features", "", "--all-features"]
exclude:
# Skip because some features have highest MSRV.
- rust: "1.65" # MSRV
# Some features have higher MSRV.
- rust: "1.68" # MSRV
flags: "--all-features"
steps:
- uses: actions/checkout@v3
Expand All @@ -39,10 +39,10 @@ jobs:
cache-on-failure: true
# Only run tests on latest stable and above
- name: build
if: ${{ matrix.rust == '1.65' }} # MSRV
if: ${{ matrix.rust == '1.68' }} # MSRV
run: cargo build --workspace ${{ matrix.flags }}
- name: test
if: ${{ matrix.rust != '1.65' }} # MSRV
if: ${{ matrix.rust != '1.68' }} # MSRV
run: cargo test --workspace ${{ matrix.flags }}

wasm:
Expand All @@ -52,13 +52,19 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
target: wasm32-unknown-unknown
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: check
# Do not run WASM checks on IPC as it doesn't make sense
run: cargo check --workspace --target wasm32-unknown-unknown --exclude "alloy-transport-ipc"
- name: cargo hack
run: |
cargo hack check --workspace --target wasm32-unknown-unknown \
--exclude alloy-transport-ipc \
--exclude alloy-signer \
--exclude alloy-signer-aws \
--exclude alloy-signer-ledger \
--exclude alloy-signer-trezor
feature-checks:
runs-on: ubuntu-latest
Expand Down
49 changes: 38 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolver = "2"
[workspace.package]
version = "0.1.0"
edition = "2021"
rust-version = "1.65"
rust-version = "1.68"
authors = ["Alloy Contributors"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/alloy-rs/next"
Expand All @@ -18,31 +18,58 @@ rustdoc-args = ["--cfg", "docsrs"]

[workspace.dependencies]
alloy-json-rpc = { version = "0.1.0", path = "crates/json-rpc" }
alloy-transport = { version = "0.1.0", path = "crates/transport" }
alloy-networks = { version = "0.1.0", path = "crates/networks" }
alloy-pubsub = { version = "0.1.0", path = "crates/pubsub" }
alloy-rpc-client = { version = "0.1.0", path = "crates/rpc-client" }
alloy-rpc-types = { version = "0.1.0", path = "crates/rpc-types" }
alloy-signer = { version = "0.1.0", path = "crates/signer" }
alloy-signer-aws = { version = "0.1.0", path = "crates/signer-aws" }
alloy-signer-ledger = { version = "0.1.0", path = "crates/signer-ledger" }
alloy-signer-trezor = { version = "0.1.0", path = "crates/signer-trezor" }
alloy-transport = { version = "0.1.0", path = "crates/transport" }
alloy-transport-http = { version = "0.1.0", path = "crates/transport-http" }
alloy-transport-ipc = { version = "0.1.0", path = "crates/transport-ipc" }
alloy-transport-ws = { version = "0.1.0", path = "crates/transport-ws" }
alloy-networks = { version = "0.1.0", path = "crates/networks" }
alloy-rpc-types = { version = "0.1.0", path = "crates/rpc-types" }
alloy-rpc-client = { version = "0.1.0", path = "crates/rpc-client" }

alloy-primitives = { version = "0.5.1", features = ["serde"] }
alloy-primitives = { version = "0.5.1", default-features = false, features = ["std"] }
alloy-sol-types = { version = "0.5.1", default-features = false, features = ["std"] }
alloy-rlp = "0.3"

# crypto
elliptic-curve = { version = "0.13.5", default-features = false, features = ["std"] }
generic-array = { version = "0.14.7", default-features = false, features = ["std"] }
k256 = { version = "0.13.2", default-features = false, features = ["ecdsa", "std"] }
sha2 = { version = "0.10.8", default-features = false, features = ["std"] }
spki = { version = "0.7.2", default-features = false, features = ["std"] }

# async
async-trait = "0.1.74"
base64 = "0.21"
bimap = "0.6"
futures = "0.3.29"
futures-util = "0.3.29"
futures-executor = "0.3.29"

hyper = "0.14.27"
tokio = "1.33"
tower = { version = "0.4.13", features = ["util"] }

tracing = "0.1.40"
tracing-subscriber = "0.3.18"

tempfile = "3.8"

auto_impl = "1.1"
assert_matches = "1.5"
base64 = "0.21"
bimap = "0.6"
itertools = "0.12"
pin-project = "1.1"
rand = "0.8.5"
reqwest = "0.11.18"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_with = "3.4"
home = "0.5"
semver = "1.0"
serial_test = "2.0"
thiserror = "1.0"
tokio = { version = "1.33", features = ["sync", "macros"] }
tower = { version = "0.4.13", features = ["util"] }
tracing = "0.1.40"
url = "2.4"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ When updating this, also update:

Alloy will keep a rolling MSRV (minimum supported rust version) policy of **at
least** 6 months. When increasing the MSRV, the new Rust version must have been
released at least six months ago. The current MSRV is 1.65.0.
released at least six months ago. The current MSRV is 1.68.

Note that the MSRV is not increased automatically, and only as part of a minor
release.
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.65"
msrv = "1.68"
2 changes: 1 addition & 1 deletion crates/json-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository.workspace = true
exclude.workspace = true

[dependencies]
alloy-primitives.workspace = true
alloy-primitives = { workspace = true, features = ["serde"] }
serde.workspace = true
serde_json = { workspace = true, features = ["raw_value"] }
thiserror.workspace = true
2 changes: 1 addition & 1 deletion crates/pubsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ alloy-transport.workspace = true
bimap.workspace = true
futures.workspace = true
serde_json.workspace = true
tokio.workspace = true
tokio = { workspace = true, features = ["macros", "sync"] }
tower.workspace = true
tracing.workspace = true
30 changes: 30 additions & 0 deletions crates/signer-aws/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "alloy-signer-aws"
description = "Ethereum AWS KMS signer"

version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
exclude.workspace = true

[dependencies]
alloy-primitives.workspace = true
alloy-signer.workspace = true

async-trait.workspace = true
aws-sdk-kms = { version = "1.1", default-features = false }
k256.workspace = true
spki.workspace = true
thiserror.workspace = true
tracing.workspace = true

[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
aws-config = { version = "1.0", default-features = false }

[features]
eip712 = ["alloy-signer/eip712"]
5 changes: 5 additions & 0 deletions crates/signer-aws/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# alloy-signer-aws

Ethereum [AWS KMS] signer.

[AWS KMS]: https://aws.amazon.com/kms
22 changes: 22 additions & 0 deletions crates/signer-aws/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#![doc = include_str!("../README.md")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
)]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
missing_docs,
unreachable_pub,
clippy::missing_const_for_fn,
rustdoc::all
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[macro_use]
extern crate tracing;

mod signer;
pub use signer::{AwsSigner, AwsSignerError};
Loading

0 comments on commit 16300ad

Please sign in to comment.