Skip to content

Conversation

@rplusq
Copy link
Contributor

@rplusq rplusq commented Oct 8, 2025

Summary

  • Add Turnkey as a remote signer option alongside AWS KMS and GCP KMS
  • Fix wallet feature flags in forge to properly gate foundry-wallets dependency

Changes

  • Added alloy-signer-turnkey dependency to foundry-wallets
  • Implemented Turnkey wallet CLI args and initialization logic
  • Added turnkey feature flags to cast and forge
  • Updated Dockerfile and Makefile to include turnkey in release builds

Bug Fix: forge wallet features

Made foundry-wallets an optional dependency in forge/Cargo.toml and updated feature definitions.

Issue: The aws-kms, gcp-kms, and turnkey features were defined but non-functional when using cargo run --features forge/turnkey. The features only worked in release builds via Makefile.

Root cause: foundry-wallets was a dev-dependency, so feature flags had no effect. Additionally, it was unconditionally compiled in the default build despite being feature-gated, causing unused dependency warnings.

Fix:

  • Made foundry-wallets an optional dependency: foundry-wallets = { workspace = true, optional = true }
  • Updated features to enable the dependency: turnkey = ["dep:foundry-wallets", "foundry-wallets/turnkey"]
  • Added conditional import guard in lib.rs to only use the crate when features are enabled

This aligns forge with cast's wallet handling and resolves clippy warnings about unused dependencies.

Testing

# Before: --turnkey flag doesn't appear
cargo run --bin forge --features forge/turnkey -- create -h | grep turnkey
# (no output)

# After: --turnkey flag works
cargo run --bin forge --features forge/turnkey -- create -h | grep turnkey  
# --turnkey  Use Turnkey

# CI checks pass
cargo check --all                                          #
cargo +nightly fmt -- --check                              #
cargo +nightly clippy --all --all-targets --all-features -- -D warnings  #

🤖 Generated with Claude Code

@rplusq
Copy link
Contributor Author

rplusq commented Oct 8, 2025

Blocked by alloy-rs/alloy#2962, will update when the signer makes it into Alloy

@zerosnacks
Copy link
Member

Hi @rplusq, excited for this to land in Foundry :)

For the time being, can you update the PR to use Alloy's cc11f15 commit as patch?

When a new release of alloy is ready we can then simply update it

rplusq added a commit to rplusq/foundry that referenced this pull request Oct 16, 2025
Updates alloy patches to use commit e97f5be (alloy 1.0.39) instead of
cc11f15 as recommended by @zerosnacks in foundry-rs#12026.

This commit includes 10 additional fixes and improvements beyond cc11f15,
including bug fixes for provider serialization and transaction deserialization.

Patches 15 alloy crates to enable alloy-signer-turnkey:
- Core: consensus, eips
- Network: network, network-primitives
- RPC: rpc-types, rpc-types-{engine,eth,trace}
- Support: serde, genesis
- Signers: signer, signer-{ledger,local,trezor,turnkey}

These patches are temporary and will be removed when Foundry officially
updates to alloy 1.0.39 or later.

🤖 Generated with Claude Code

Co-Authored-By: Claude <[email protected]>
rplusq added a commit to rplusq/foundry that referenced this pull request Oct 16, 2025
Updates alloy patches to use commit e97f5be (alloy 1.0.39) instead of
cc11f15 as recommended by @zerosnacks in foundry-rs#12026.

This commit includes 10 additional fixes and improvements beyond cc11f15,
including bug fixes for provider serialization and transaction deserialization.

Patches 15 alloy crates to enable alloy-signer-turnkey:
- Core: consensus, eips
- Network: network, network-primitives
- RPC: rpc-types, rpc-types-{engine,eth,trace}
- Support: serde, genesis
- Signers: signer, signer-{ledger,local,trezor,turnkey}

These patches are temporary and will be removed when Foundry officially
updates to alloy 1.0.39 or later.

🤖 Generated with Claude Code

Co-Authored-By: Claude <[email protected]>
@rplusq rplusq force-pushed the feat/turnkey-signer branch from b91271c to 78ac1ea Compare October 16, 2025 21:20
@rplusq
Copy link
Contributor Author

rplusq commented Oct 16, 2025

@zerosnacks Followed your advice but with e97f5be as the commit patch. Ready for review. Will try to help with 1.0.40 to make this easier.

@rplusq rplusq marked this pull request as ready for review October 16, 2025 21:40
@zerosnacks
Copy link
Member

Hi @rplusq , https://crates.io/crates/alloy/1.0.41 has just been released

@rplusq
Copy link
Contributor Author

rplusq commented Oct 17, 2025

@zerosnacks updated here #12149. Using that as base and will rebase once merged.

@rplusq rplusq force-pushed the feat/turnkey-signer branch from 15a7037 to 8d2e0eb Compare October 17, 2025 11:48
rplusq and others added 3 commits October 17, 2025 17:53
Add Turnkey as a remote signer option alongside AWS KMS and GCP KMS.

Key changes:
- Added alloy-signer-turnkey dependency to foundry-wallets
- Implemented Turnkey wallet CLI args and initialization logic
- Added turnkey feature flags to cast and forge
- Updated Dockerfile and Makefile to include turnkey in release builds

Fixed forge wallet feature flags:
- Moved foundry-wallets from dev-dependencies to dependencies in forge/Cargo.toml
- This fixes an issue where aws-kms, gcp-kms, and turnkey features were defined
  but non-functional when using cargo run with --features flags
- The features worked in release builds (via Makefile) but not in local dev
- This aligns forge with cast, which already had foundry-wallets as a regular dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@rplusq rplusq force-pushed the feat/turnkey-signer branch from 8d2e0eb to 2864d03 Compare October 17, 2025 16:54
@rplusq rplusq marked this pull request as draft October 17, 2025 17:18
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these looks complete

pending @zerosnacks

@rplusq
Copy link
Contributor Author

rplusq commented Oct 17, 2025

Will have to wait, needs to remove native-tls from turnkey client, update alloy and then update here again.

@rplusq
Copy link
Contributor Author

rplusq commented Oct 17, 2025

Opened tkhq/rust-sdk#62, will then PR into alloy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants