Enforce encrypted transaction inputs on submission - #2389
Conversation
| let mut cached = self.sealer.write().await; | ||
| // Another task may have populated the cache while this one waited for the write lock. | ||
| if let Some(sealer) = cached.clone() { | ||
| return Ok(sealer); | ||
| } | ||
|
|
||
| let key = self.inner.clone().get_transaction_encryption_key(()).await?.into_inner(); |
There was a problem hiding this comment.
We are acquirying a lock here, then going through an rpc call before releasing it. Can we assume it will never block?
There was a problem hiding this comment.
Good catch. The RPC call now runs without the lock. The cache is checked again before insertion.
65fbf68 to
74e4f32
Compare
| Network transaction checks also require `MIDEN_MONITOR_VALIDATOR_SIGNING_PUBLIC_KEY`. It must contain the hex-encoded | ||
| validator key that signs transaction encryption key attestations. The monitor will not submit a transaction unless it | ||
| can verify the advertised encryption key. |
There was a problem hiding this comment.
Question (relevant for some other places too): is this a temporary simplification? The monitor should be able to get validator's signing keys from the blockchains (i.e., the block headers) - right?
There was a problem hiding this comment.
Yes. MIDEN_MONITOR_VALIDATOR_SIGNING_PUBLIC_KEY is temporary. #2389 uses it to trust encryption-key attestations. The monitor should instead read validator signing keys from authenticated block headers.
#2390 and #2393 keep the fixed setting. After they land, #2373, including #2382, will be rebased on top. That integration should pass chain-derived validator keys to #2373’s schedule verifier and remove the environment variable. The same change should remove fixed validator keys from the other node submitters. Each submitter will then follow validator changes through trusted chain state instead of local config.
/cc @juan518munoz
74e4f32 to
a015c75
Compare
Mirko-von-Leipzig
left a comment
There was a problem hiding this comment.
I have some nits but I don't think they're worth it since a lot of this will change over the stacks
(cherry picked from commit 8427c13)
a015c75 to
c6de87e
Compare
Summary
Clients must now encrypt private transaction inputs before submission. RPC nodes pass the ciphertext to the validator unchanged. The validator decrypts it before the current checks and rejects missing, plain, or invalid inputs.
Each submitter in this repository verifies the validator's encryption key against a trusted signing key. The NTX builder fetches a new key and retries once when the validator rejects an old key. The public RPC does not cache encryption keys.
This supersedes (but builds on) #2381. It completes encrypted submission for Phase 1, modulo key rotation (part of #2373, which should come later). Validation of the encryption key is against a fixed attestation for now.
Existing NTX builder data directories must be bootstrapped again. The database now stores the trusted validator keys from genesis.
Changelog