WIP: feat-shamir (old) #103
@@ -143,8 +143,8 @@ impl ProposalKind {
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum VoteOutcome {
|
||||
Pending,
|
||||
QuorumApproved,
|
||||
QuorumRejected,
|
||||
Approved,
|
||||
Rejected,
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@@ -445,7 +445,7 @@ impl ProposalManager {
|
||||
.await?;
|
||||
drop(conn); // release connection before async execution
|
||||
self.execute_proposal(&proposal).await?;
|
||||
return Ok(VoteOutcome::QuorumApproved);
|
||||
return Ok(VoteOutcome::Approved);
|
||||
}
|
||||
|
||||
let total_eligible = total_operators + total_recovery;
|
||||
@@ -454,7 +454,7 @@ impl ProposalManager {
|
||||
.set(schema::proposal::status.eq(ProposalStatus::Rejected))
|
||||
.execute(&mut conn)
|
||||
.await?;
|
||||
return Ok(VoteOutcome::QuorumRejected);
|
||||
return Ok(VoteOutcome::Rejected);
|
||||
}
|
||||
|
||||
Ok(VoteOutcome::Pending)
|
||||
@@ -611,7 +611,7 @@ impl ProposalManager {
|
||||
.await?;
|
||||
drop(conn);
|
||||
|
CleverWild marked this conversation as resolved
Outdated
|
||||
self.execute_proposal(&proposal).await?;
|
||||
return Ok(VoteOutcome::QuorumApproved);
|
||||
return Ok(VoteOutcome::Approved);
|
||||
}
|
||||
|
||||
let recovery_reject: i64 = schema::recovery_proposal_vote::table
|
||||
@@ -633,7 +633,7 @@ impl ProposalManager {
|
||||
.set(schema::proposal::status.eq(ProposalStatus::Rejected))
|
||||
.execute(&mut conn)
|
||||
.await?;
|
||||
return Ok(VoteOutcome::QuorumRejected);
|
||||
return Ok(VoteOutcome::Rejected);
|
||||
}
|
||||
|
||||
Ok(VoteOutcome::Pending)
|
||||
|
||||
@@ -100,8 +100,8 @@ async fn handle_vote(
|
||||
|
||||
let outcome = match result {
|
||||
Ok(VoteOutcome::Pending) => ProtoVoteOutcome::Pending,
|
||||
Ok(VoteOutcome::QuorumApproved) => ProtoVoteOutcome::Approved,
|
||||
Ok(VoteOutcome::QuorumRejected) => ProtoVoteOutcome::Rejected,
|
||||
Ok(VoteOutcome::Approved) => ProtoVoteOutcome::Approved,
|
||||
Ok(VoteOutcome::Rejected) => ProtoVoteOutcome::Rejected,
|
||||
Err(kameo::error::SendError::HandlerError(ProposalError::AlreadyVoted)) => {
|
||||
return Err(Status::invalid_argument("Already voted on this proposal"));
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ async fn single_operator_vote_reaches_quorum() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -363,7 +363,7 @@ async fn query_pending_excludes_already_voted() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Vote on p1 — with 1 operator this reaches quorum (QuorumApproved)
|
||||
// Vote on p1 — with 1 operator this reaches quorum (Approved)
|
||||
let msg = make_vote_message(p1, true);
|
||||
let sig = signing_key
|
||||
.sign_message(&msg, SigningContext::GovernanceVote)
|
||||
@@ -378,7 +378,7 @@ async fn query_pending_excludes_already_voted() {
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
|
||||
// QueryPending should return only p2
|
||||
let pending = actors
|
||||
@@ -490,7 +490,7 @@ async fn approve_sdk_client_writes_integrity_envelope() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
|
||||
let mut conn = db.get().await.unwrap();
|
||||
let count: i64 = integrity_envelope::table
|
||||
@@ -544,7 +544,7 @@ async fn grant_wallet_access_on_quorum_approval() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
|
||||
let mut conn = db.get().await.unwrap();
|
||||
let count: i64 = evm_wallet_access::table
|
||||
@@ -635,7 +635,7 @@ async fn approve_persistent_grant_creates_basic_grant_row() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
|
||||
let mut conn = db.get().await.unwrap();
|
||||
let count: i64 = evm_basic_grant::table
|
||||
@@ -752,7 +752,7 @@ async fn approve_one_off_transaction_stores_result() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
|
||||
let mut conn = db.get().await.unwrap();
|
||||
let count: i64 = proposal_result::table
|
||||
@@ -805,7 +805,7 @@ async fn replace_operator_updates_pubkey_and_starts_rekey() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
|
||||
let mut conn = db.get().await.unwrap();
|
||||
// The old identity row is updated in-place; count stays the same.
|
||||
@@ -864,7 +864,7 @@ async fn trigger_rekey_reaches_quorum() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -914,7 +914,7 @@ async fn key_rotation_requires_full_quorum() {
|
||||
// For key rotation, they must not.
|
||||
assert_eq!(cast(op1, &key1).await, VoteOutcome::Pending);
|
||||
assert_eq!(cast(op2, &key2).await, VoteOutcome::Pending);
|
||||
assert_eq!(cast(op3, &key3).await, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(cast(op3, &key3).await, VoteOutcome::Approved);
|
||||
}
|
||||
|
||||
// ─── §3.5 / §3.6 Recovery Operator tests ──────────────────────────────────
|
||||
@@ -1123,5 +1123,5 @@ async fn recovery_operator_vote_contributes_to_replace_quorum() {
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(outcome, VoteOutcome::QuorumApproved);
|
||||
assert_eq!(outcome, VoteOutcome::Approved);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user
signature check is quite complex, so separate it into several helpers and put them into
cryptosubmodule