Add private recovery API for validated inputs - #2407
Conversation
kkovaacs
left a comment
There was a problem hiding this comment.
I assume this is a temporary feature just for the demo, right?
In that context this looks good to me.
| ) -> Result<Vec<u8>, PrivateRecordError> | ||
| where | ||
| R: RngCore + CryptoRng, | ||
| P: PrivateRecordSharePolicy + ?Sized, |
There was a problem hiding this comment.
Why do we need this policy thing? Surely we have exactly one.
| return Err(PrivateRecordError::ShareDenied); | ||
| } | ||
|
|
||
| self.issue_decryption_share(rng, record.encrypted_record_key(), request.context()) |
There was a problem hiding this comment.
Why do we have two pub methods?
There was a problem hiding this comment.
This could just be called load_all_transactions imo. Currently it implies there exist public or unvalidated transactions.
| CHECK (length(encrypted_record) >= 16), | ||
| CHECK (length(encrypted_record_key) > 0) | ||
| ) WITHOUT ROWID; | ||
| ); |
There was a problem hiding this comment.
Why are we adding back ROWID?
| /// Loads all validated private transactions in insertion order. | ||
| pub(crate) fn load_validated_private_transactions( |
There was a problem hiding this comment.
Similar nit:
| /// Loads all validated private transactions in insertion order. | |
| pub(crate) fn load_validated_private_transactions( | |
| /// Loads all validated private transactions in insertion order. | |
| pub(crate) fn load_all_transactions( |
| listen: std::net::SocketAddr, | ||
|
|
||
| /// Socket address at which to serve the private administration API. | ||
| #[arg(long = "admin-listen", env = ENV_ADMIN_LISTEN, value_name = "LISTEN")] |
There was a problem hiding this comment.
| #[arg(long = "admin-listen", env = ENV_ADMIN_LISTEN, value_name = "LISTEN")] | |
| #[arg(long = "admin.listen", env = ENV_ADMIN_LISTEN, value_name = "LISTEN")] |
| target: LOG_TARGET, | ||
| { | ||
| service.name = "miden-validator-admin", | ||
| validator.admin_listen = %endpoint, | ||
| }, | ||
| "Validator admin server ready", | ||
| ); |
There was a problem hiding this comment.
@kkovaacs is there some sort of standard for this?
There was a problem hiding this comment.
@kkovaacs is there some sort of standard for this?
Not really. We do have a standard log line that is logged when starting up a service, but this is just an additional API that is exposed by the validator service.
| pub async fn serve(self, shutdown: CancellationToken) -> anyhow::Result<()> { | ||
| let listener = TcpListener::bind(self.address) | ||
| .await | ||
| .context("failed to bind validator admin address")?; |
There was a problem hiding this comment.
Nit: we don't really need to prefix things with validator, this is already in the validator context.
| .context("failed to bind validator admin address")?; | |
| .context("failed to bind admin address")?; |
df32357 to
396e12f
Compare
Summary
After #2393, validators store transaction inputs under a Golden threshold key. The demo also needs a private way to find these records and ask each validator for a decryption share.
Operators can now start an optional HTTP admin service on a separate listener.
GET /admin/transactionsreturns all stored records as hex-encoded JSON in insertion order. Each entry includes the transaction ID, encrypted inputs, nonce, encrypted content key, and decryption context.POST /admin/decryption-shareaccepts an encrypted content key and its decryption context. It returns this validator's hex-encoded Golden share.The public validator service does not receive the Golden secret share. The admin service has no caller authentication, so operators must control access to its port. A later TEE flow will add caller checks and a share release policy.
Tests recover one validator's stored
TransactionInputswith shares from two other validators in the same Golden setup. Recovery tools receive the public Golden setup through deployment configuration.Changelog