Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non persistent TSS signer and x25519 keypair #1216

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1de907a
Dont allow mnemonic to be passed in via CLI, or environment variable …
ameba23 Oct 22, 2024
6b97f8f
Changelog
ameba23 Oct 22, 2024
7bd4358
Error handling
ameba23 Oct 22, 2024
4fcfc30
Add endpoint giving public keys
ameba23 Oct 23, 2024
e1649a4
Document new endpoint
ameba23 Oct 23, 2024
b12149b
Changelog
ameba23 Oct 23, 2024
53d5175
Clippy
ameba23 Oct 23, 2024
7c7acc7
Merge master
ameba23 Nov 8, 2024
a2c9cd7
Merge master
ameba23 Nov 18, 2024
5b8db51
Merge master
ameba23 Dec 5, 2024
1de6e81
Fix lockfile
ameba23 Dec 5, 2024
e97aa16
Merge branch 'master' into peg/generate-mnemonic
ameba23 Dec 13, 2024
8a8cb52
Add keys to appstate
ameba23 Dec 13, 2024
542849e
Rm persisted TSS keys
ameba23 Dec 13, 2024
15d3bbe
Tidy following app state change
ameba23 Dec 13, 2024
1ca0a0c
Fixes for tests and test helpers
ameba23 Dec 16, 2024
1303be2
Revert commented out import
ameba23 Dec 16, 2024
ebc339e
Clippy
ameba23 Dec 16, 2024
87c6afd
Update unsafe get test
ameba23 Dec 16, 2024
e71cc72
Rm setup only option, tidy
ameba23 Dec 16, 2024
6831f49
Tidy AppState interface
ameba23 Dec 16, 2024
1c36ae0
Allow for entropy-tss to be put in a non-ready state
ameba23 Dec 16, 2024
e416800
Update node info test
ameba23 Dec 16, 2024
7d8690b
Make app state ready in tests
ameba23 Dec 17, 2024
96c6a1a
Comments
ameba23 Dec 17, 2024
91ac834
Fix node info test
ameba23 Dec 17, 2024
b59d78d
Update pre-requisite checks
ameba23 Dec 17, 2024
c7d5ca2
Clippy
ameba23 Dec 17, 2024
a05a2a3
Force getting minimum balance before start
ameba23 Dec 17, 2024
079c394
Clippy
ameba23 Dec 17, 2024
12e940d
Comments
ameba23 Dec 17, 2024
a71521b
Fixes, add helper
ameba23 Dec 17, 2024
9d2f80d
Merge master
ameba23 Dec 18, 2024
7cb7ac6
Changelog
ameba23 Dec 18, 2024
3c08c75
Improve display of failed balance check errors
ameba23 Dec 18, 2024
c18124e
Improve display of failed registration checks
ameba23 Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ At the moment this project **does not** adhere to
structure, and the `NodeInfoChanged` event were removed from the Staking Extension pallet. The
`AttestationHandler` config type was added to the Staking Extension pallet. The `KeyProvider` and
`AttestationQueue` config types were removed from the Attestation pallet.
- In [#1128](https://github.com/entropyxyz/entropy-core/pull/1128) mnemonics can no longer be passed
in via a command line argument, file, or environment variable. Instead they are randomly generated
internally.
- In [#1179](https://github.com/entropyxyz/entropy-core/pull/1179) the format of TDX Quote input data has
been changed.
- In [#1147](https://github.com/entropyxyz/entropy-core/pull/1147) a field is added to the
chainspec: `jump_started_signers` which allows the chain to be started in a pre-jumpstarted state
for testing. If this is not desired it should be set to `None`.

### Added
- [#1128](https://github.com/entropyxyz/entropy-core/pull/1128) adds an `/info` route to `entropy-tss`
which can be used to get the TSS account ID and x25519 public key.
- In [#1068](https://github.com/entropyxyz/entropy-core/pull/1068) an extra type `PckCertChainVerifier`
was added to the staking extension pallet's `Config` trait.
- In [#1123](https://github.com/entropyxyz/entropy-core/pull/1123/) the `change_endpoint()` and
Expand All @@ -24,13 +36,6 @@ At the moment this project **does not** adhere to
- In [#1153](https://github.com/entropyxyz/entropy-core/pull/1153/) the program runtime was updated to accept
multiple oracle inputs, this means any programs that were compiled and used need to be recompiled to the new
runtime
- In [#1179](https://github.com/entropyxyz/entropy-core/pull/1179) the format of TDX Quote input data has
been changed.
- In [#1147](https://github.com/entropyxyz/entropy-core/pull/1147) a field is added to the
chainspec: `jump_started_signers` which allows the chain to be started in a pre-jumpstarted state
for testing. If this is not desired it should be set to `None`.

### Added
- Protocol message versioning ([#1140](https://github.com/entropyxyz/entropy-core/pull/1140))
- CLI command to get oracle headings ([#1170](https://github.com/entropyxyz/entropy-core/pull/1170))
- Add TSS endpoint to get TDX quote ([#1173](https://github.com/entropyxyz/entropy-core/pull/1173))
Expand Down
2 changes: 2 additions & 0 deletions crates/protocol/src/protocol_transport/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pub enum WsError {
Serialization(#[from] bincode::Error),
#[error("Received bad subscribe message")]
BadSubscribeMessage,
#[error("Node has started fresh and is not yet successfully set up")]
NotReady,
}

/// An error relating to handling a `ProtocolMessage`
Expand Down
15 changes: 6 additions & 9 deletions crates/threshold-signature-server/src/attestation/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use crate::{
attestation::errors::AttestationErr,
chain_api::{entropy, get_api, get_rpc, EntropyConfig},
get_signer_and_x25519_secret,
helpers::{
launch::LATEST_BLOCK_NUMBER_ATTEST,
substrate::{query_chain, submit_transaction},
Expand Down Expand Up @@ -46,7 +45,6 @@ pub async fn attest(
State(app_state): State<AppState>,
input: Bytes,
) -> Result<StatusCode, AttestationErr> {
let (signer, x25519_secret) = get_signer_and_x25519_secret(&app_state.kv_store).await?;
let attestation_requests = OcwMessageAttestationRequest::decode(&mut input.as_ref())?;

let api = get_api(&app_state.configuration.endpoint).await?;
Expand All @@ -59,15 +57,15 @@ pub async fn attest(
validate_new_attestation(block_number, &attestation_requests, &app_state.kv_store).await?;

// Check whether there is an attestion request for us
if !attestation_requests.tss_account_ids.contains(&signer.signer().public().0) {
if !attestation_requests.tss_account_ids.contains(&app_state.pair.public().0) {
return Ok(StatusCode::OK);
}

// Get the input nonce for this attestation
// Also acts as chain check to make sure data is on chain
let nonce = {
let pending_attestation_query =
entropy::storage().attestation().pending_attestations(signer.account_id());
entropy::storage().attestation().pending_attestations(app_state.signer().account_id());
query_chain(&api, &rpc, pending_attestation_query, None)
.await?
.ok_or_else(|| AttestationErr::Unexpected)?
Expand All @@ -76,11 +74,11 @@ pub async fn attest(
// TODO (#1181): since this endpoint is currently only used in tests we don't know what the context should be
let context = QuoteContext::Validate;

let quote = create_quote(nonce, &signer, &x25519_secret, context).await?;
let quote = create_quote(nonce, &app_state.signer(), &app_state.x25519_secret, context).await?;

// Submit the quote
let attest_tx = entropy::tx().attestation().attest(quote.clone());
submit_transaction(&api, &rpc, &signer, &attest_tx, None).await?;
submit_transaction(&api, &rpc, &app_state.signer(), &attest_tx, None).await?;

Ok(StatusCode::OK)
}
Expand All @@ -94,16 +92,15 @@ pub async fn get_attest(
State(app_state): State<AppState>,
Query(context_querystring): Query<QuoteContextQuery>,
) -> Result<(StatusCode, Vec<u8>), AttestationErr> {
let (signer, x25519_secret) = get_signer_and_x25519_secret(&app_state.kv_store).await?;
let api = get_api(&app_state.configuration.endpoint).await?;
let rpc = get_rpc(&app_state.configuration.endpoint).await?;

// Request attestation to get nonce
let nonce = request_attestation(&api, &rpc, signer.signer()).await?;
let nonce = request_attestation(&api, &rpc, &app_state.pair).await?;

let context = context_querystring.as_quote_context()?;

let quote = create_quote(nonce, &signer, &x25519_secret, context).await?;
let quote = create_quote(nonce, &app_state.signer(), &app_state.x25519_secret, context).await?;

Ok((StatusCode::OK, quote))
}
Expand Down
Loading
Loading