refactor(proposal): remove the ApproveServerUpdate proposal kind
This commit is contained in:
@@ -14,7 +14,6 @@ message CreateProposalRequest {
|
|||||||
oneof kind {
|
oneof kind {
|
||||||
ApproveSdkClientPayload approve_sdk_client = 1;
|
ApproveSdkClientPayload approve_sdk_client = 1;
|
||||||
GrantWalletAccessPayload grant_wallet_access = 3;
|
GrantWalletAccessPayload grant_wallet_access = 3;
|
||||||
ApproveServerUpdatePayload approve_server_update = 4;
|
|
||||||
ReplaceOperatorPayload replace_operator = 5;
|
ReplaceOperatorPayload replace_operator = 5;
|
||||||
UpdateShamirParametersPayload update_shamir_parameters = 6;
|
UpdateShamirParametersPayload update_shamir_parameters = 6;
|
||||||
ApprovePersistentGrantPayload approve_persistent_grant = 7;
|
ApprovePersistentGrantPayload approve_persistent_grant = 7;
|
||||||
@@ -32,8 +31,6 @@ message UpdateShamirParametersPayload {
|
|||||||
uint32 new_n = 1;
|
uint32 new_n = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ApproveServerUpdatePayload {}
|
|
||||||
|
|
||||||
message ApproveSdkClientPayload {
|
message ApproveSdkClientPayload {
|
||||||
int32 client_id = 1;
|
int32 client_id = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ pub enum ProposalKind {
|
|||||||
wallet_id: i32,
|
wallet_id: i32,
|
||||||
client_id: i32,
|
client_id: i32,
|
||||||
},
|
},
|
||||||
ApproveServerUpdate,
|
|
||||||
ReplaceOperator {
|
ReplaceOperator {
|
||||||
old_operator_id: i32,
|
old_operator_id: i32,
|
||||||
new_pubkey: Vec<u8>,
|
new_pubkey: Vec<u8>,
|
||||||
@@ -67,7 +66,6 @@ impl ProposalKind {
|
|||||||
buf.extend_from_slice(&client_id.to_be_bytes());
|
buf.extend_from_slice(&client_id.to_be_bytes());
|
||||||
buf
|
buf
|
||||||
}
|
}
|
||||||
Self::ApproveServerUpdate => vec![],
|
|
||||||
Self::ReplaceOperator {
|
Self::ReplaceOperator {
|
||||||
old_operator_id,
|
old_operator_id,
|
||||||
new_pubkey,
|
new_pubkey,
|
||||||
@@ -114,7 +112,6 @@ impl ProposalKind {
|
|||||||
client_id: i32::from_be_bytes(bytes[4..].try_into().unwrap()),
|
client_id: i32::from_be_bytes(bytes[4..].try_into().unwrap()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ProposalKindTag::ApproveServerUpdate => Ok(Self::ApproveServerUpdate),
|
|
||||||
ProposalKindTag::ReplaceOperator => {
|
ProposalKindTag::ReplaceOperator => {
|
||||||
let (id_bytes, rest) = payload
|
let (id_bytes, rest) = payload
|
||||||
.split_first_chunk::<4>()
|
.split_first_chunk::<4>()
|
||||||
@@ -692,7 +689,6 @@ impl ProposalManager {
|
|||||||
wallet_id,
|
wallet_id,
|
||||||
client_id,
|
client_id,
|
||||||
} => self.execute_grant_wallet_access(wallet_id, client_id).await,
|
} => self.execute_grant_wallet_access(wallet_id, client_id).await,
|
||||||
ProposalKind::ApproveServerUpdate => Ok(()),
|
|
||||||
ProposalKind::ReplaceOperator {
|
ProposalKind::ReplaceOperator {
|
||||||
old_operator_id,
|
old_operator_id,
|
||||||
new_pubkey,
|
new_pubkey,
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ async fn handle_create(
|
|||||||
wallet_id: p.wallet_id,
|
wallet_id: p.wallet_id,
|
||||||
client_id: p.client_id,
|
client_id: p.client_id,
|
||||||
},
|
},
|
||||||
Some(ProtoKind::ApproveServerUpdate(_)) => ProposalKind::ApproveServerUpdate,
|
|
||||||
Some(ProtoKind::ReplaceOperator(p)) => ProposalKind::ReplaceOperator {
|
Some(ProtoKind::ReplaceOperator(p)) => ProposalKind::ReplaceOperator {
|
||||||
old_operator_id: p.old_operator_id,
|
old_operator_id: p.old_operator_id,
|
||||||
new_pubkey: p.new_pubkey,
|
new_pubkey: p.new_pubkey,
|
||||||
|
|||||||
@@ -917,47 +917,6 @@ async fn key_rotation_requires_full_quorum() {
|
|||||||
assert_eq!(cast(op3, &key3).await, VoteOutcome::QuorumApproved);
|
assert_eq!(cast(op3, &key3).await, VoteOutcome::QuorumApproved);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn approve_server_update_reaches_quorum() {
|
|
||||||
let db = db::create_test_pool().await;
|
|
||||||
let actors = GlobalActors::spawn(db.clone()).await.unwrap();
|
|
||||||
actors
|
|
||||||
.vault
|
|
||||||
.ask(Bootstrap { seal_key: KeyCell::from([0u8; 32]) })
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let signing_key = authn::SigningKey::generate();
|
|
||||||
let op_id = register_operator(&db, &signing_key.public_key()).await;
|
|
||||||
|
|
||||||
let proposal_id = actors
|
|
||||||
.proposal_manager
|
|
||||||
.ask(CreateProposal {
|
|
||||||
kind: ProposalKind::ApproveServerUpdate,
|
|
||||||
initiator_id: op_id,
|
|
||||||
ttl_secs: None,
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let msg = make_vote_message(proposal_id, true);
|
|
||||||
let sig = signing_key
|
|
||||||
.sign_message(&msg, SigningContext::GovernanceVote)
|
|
||||||
.unwrap();
|
|
||||||
let outcome = actors
|
|
||||||
.proposal_manager
|
|
||||||
.ask(CastVote {
|
|
||||||
proposal_id,
|
|
||||||
operator_id: op_id,
|
|
||||||
approve: true,
|
|
||||||
signature: sig.to_bytes(),
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── §3.5 / §3.6 Recovery Operator tests ──────────────────────────────────
|
// ─── §3.5 / §3.6 Recovery Operator tests ──────────────────────────────────
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
Reference in New Issue
Block a user