docs: design plan for Turnkey enclave-backed remote signer (non-custodial gateway keys) - #6
Draft
eliteprox wants to merge 1 commit into
Draft
docs: design plan for Turnkey enclave-backed remote signer (non-custodial gateway keys)#6eliteprox wants to merge 1 commit into
eliteprox wants to merge 1 commit into
Conversation
Design plan for signing offchain PM tickets with a user-owned Turnkey secure enclave instead of an operator-held keystore, so a hosted remote signer can serve users' own deposit and reserve without custody of their gateway ETH keys. Covers the on-chain TicketBroker constraint that fixes the signature format, the Turnkey-backed pm.Signer backend, batch signing, remote signer multi-tenancy, and the residual custody gap with mitigations. Co-authored-by: John | Elite Encoder <john@eliteencoder.net>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc @rickstaa — would appreciate your review on the approach here, particularly §4 (multi-tenancy) and §6 (residual custody gap).
What does this pull request do? Explain your changes. (required)
Adds a design plan (docs only, no code) for signing offchain PM tickets with a user-owned Turnkey secure enclave instead of an operator-held keystore file. The goal is to let a hosted remote signer (the
remote_signer.goHTTP service) serve users' own deposit and reserve without the operator ever taking custody of their gateway ETH private key.The headline finding is that the signature format itself cannot change. I dumped the deployed
TicketBrokerABI from the bindings in this repo:There is no
isApprovedSigner, no signer registry, and no ERC-1271 hook. On redemption the contract doesECDSA.recover(toEthSignedMessageHash(ticketHash), sig)and requires the recovered address to equalticket.sender— the address that owns the deposit and reserve. On top of that, the winning lottery is computed over the signature bytes (keccak256(sig ‖ recipientRand) < winProbinpm/validator.go), so even the signature encoding is protocol-relevant on both sides.So remote attestation quotes, BLS, or any other "no raw key" signature type are not redeemable on-chain without a new TicketBroker deployment plus a coordinated orchestrator upgrade. What works today is keeping the 65-byte secp256k1/EIP-191 signature byte-identical and changing who holds the key: Turnkey generates and decrypts the key only inside an attested enclave, the user owns the sub-org root quorum, and the operator holds only a revocable delegated API key.
Specific updates (required)
ProcessPayment,ReceiveTicket, and redemption are untouched.broadcaster.Signreturns[]byte{}whennode.Eth == nil, and it uses the cachedRemoteEthAddr/InfoSigfrom the signer.pm: a Turnkey-backedpm.Signer, batch signing (CreateTicketBatchcan sign up to 100 tickets, currently one round trip each), remote signer multi-tenancy, and replacing the ETH-key state-blob signature with an HMAC.hash_functionandencodingforSIGN_RAW_PAYLOAD(S), not the payload, so a delegated key can in principle still sign anunlock()/withdraw()transaction. Includes the mitigations and the two ways to actually close it.How did you test each of these updates (required)
Docs-only change, no code modified. Verification performed while writing it:
TicketBrokerABI out ofeth/contracts/ticketBroker.goto confirm no approved-signer or ERC-1271 facility exists.pm/sender.go→pm/validator.go→crypto/verify.go→eth/client_ticketbroker.go, and the gateway/orchestrator handshake inserver/rpc.goandserver/segment_rpc.go.SenderWatcher.GetSenderInfois address-agnostic and lazily caches per address, so per-tenant deposit/reserve validation needs no watcher changes.github.com/tkhq/go-sdk/v2 v2.1.0resolves on the module proxy, and thatACTIVITY_TYPE_SIGN_RAW_PAYLOADSsupports batch signing returning{r, s, v}.make/./test.shwere not run: no Go sources are touched by this PR.Does this pull request close any open issues?
No.
Checklist:
makeruns successfully — n/a, no Go sources changed./test.shpass — n/a, no Go sources changed