Skip to content

Commit

Permalink
Finish adding the transaction protobuf types
Browse files Browse the repository at this point in the history
  • Loading branch information
djordon committed Sep 27, 2024
1 parent 53d43bb commit 1bc84b4
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 26 deletions.
66 changes: 53 additions & 13 deletions protobufs/stacks/signer/v1/requests.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,29 @@ message BitcoinTransactionSignRequest {
message StacksTransactionSignRequest {
// The aggregate public key that will sign the transaction.
crypto.PublicKey aggregate_key = 1;
// The contract call transaction to sign.
// pub contract_call: ContractCall,
// The nonce to use for the transaction.
uint64 nonce = 3;
uint64 nonce = 2;
// The transaction fee in microSTX.
uint64 tx_fee = 4;
// The expected digest of the transaction than needs to be signed.
// It's essentially a hash of the contract call struct, the nonce, the
// tx_fee and a few other things.
crypto.Uint256 digest = 5;
uint64 tx_fee = 3;
// The expected digest of the transaction than needs to be signed. It's
// essentially a hash of the contract call struct, the nonce, the tx_fee
// and a few other things.
crypto.Uint256 digest = 4;
// The contract call transaction to sign.
oneof contract_call {
// The `complete-deposit` contract call
CompleteDeposit complete_deposit = 5;
// The `accept-withdrawal-request` contract call
AcceptWithdrawal accept_withdrawal = 6;
// The `reject-withdrawal-request` contract call
RejectWithdrawal reject_withdrawal = 7;
// The `rotate-keys-wrapper` contract call
RotateKeys rotate_keys = 8;
}
}

// A complete-deposit contract call on Stacks.
// For making a `complete-deposit` contract call in the sbtc-deposit
// smart contract.
message CompleteDeposit {
// The outpoint of the bitcoin UTXO that was spent as a deposit for
// sBTC.
Expand All @@ -54,7 +64,8 @@ message CompleteDeposit {
uint64 sweep_block_height = 7;
}

// The `accept-withdrawal-request` contract call on the stacks blockchain.
// For making a `accept-withdrawal-request` contract call in the
// sbtc-withdrawal smart contract.
message AcceptWithdrawal {
// The ID of the withdrawal request generated by the
// `initiate-withdrawal-request` function in the sbtc-withdrawal smart
Expand All @@ -66,9 +77,9 @@ message AcceptWithdrawal {
// The fee that was spent to the bitcoin miner when fulfilling the
// withdrawal request.
uint64 tx_fee = 3;
// A bitmap of how the signers voted. This structure supports up to
// 128 distinct signers. Here, we assume that a 1 (or true) implies
// that the signer voted *against* the transaction.
// A bitmap of how the signers voted. The length of the list must be less
// than or equal to 128. Here, we assume that a true implies that the
// associated signer voted *against* the withdrawal.
repeated bool signer_bitmap = 4;
// The address that deployed the contract.
stacks.StacksAddress deployer = 5;
Expand All @@ -78,3 +89,32 @@ message AcceptWithdrawal {
// The block height associated with the above bitcoin block hash.
uint64 sweep_block_height = 7;
}

// For making a `reject-withdrawal-request` contract call in the
// sbtc-withdrawal smart contract.
message RejectWithdrawal {
// The ID of the withdrawal request generated by the
// `initiate-withdrawal-request` function in the sbtc-withdrawal smart
// contract.
uint64 request_id = 1;
// A bitmap of how the signers voted. The length of the list must be less
// than or equal to 128. Here, we assume that a true implies that the
// associated signer voted *against* the withdrawal.
repeated bool signer_bitmap = 2;
// The address that deployed the smart contract.
stacks.StacksAddress deployer = 3;
}

// For making a `rotate-keys-wrapper` contract call in the
// `sbtc-bootstrap-signers` smart contract.
message RotateKeys {
// The new set of public keys for all known signers during this
// PoX cycle.
repeated crypto.PublicKey new_keys = 1;
// The aggregate key created by combining the above public keys.
crypto.PublicKey aggregate_key = 2;
// The address that deployed the contract.
stacks.StacksAddress deployer = 3;
// The number of signatures required for the multi-sig wallet.
uint32 signatures_required = 4;
}
92 changes: 79 additions & 13 deletions signer/src/proto/generated/stacks.signer.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,48 @@ pub struct StacksTransactionSignRequest {
/// The aggregate public key that will sign the transaction.
#[prost(message, optional, tag = "1")]
pub aggregate_key: ::core::option::Option<super::super::super::crypto::PublicKey>,
/// The contract call transaction to sign.
/// pub contract_call: ContractCall,
/// The nonce to use for the transaction.
#[prost(uint64, tag = "3")]
#[prost(uint64, tag = "2")]
pub nonce: u64,
/// The transaction fee in microSTX.
#[prost(uint64, tag = "4")]
#[prost(uint64, tag = "3")]
pub tx_fee: u64,
/// The expected digest of the transaction than needs to be signed.
/// It's essentially a hash of the contract call struct, the nonce, the
/// tx_fee and a few other things.
#[prost(message, optional, tag = "5")]
/// The expected digest of the transaction than needs to be signed. It's
/// essentially a hash of the contract call struct, the nonce, the tx_fee
/// and a few other things.
#[prost(message, optional, tag = "4")]
pub digest: ::core::option::Option<super::super::super::crypto::Uint256>,
/// The contract call transaction to sign.
#[prost(
oneof = "stacks_transaction_sign_request::ContractCall",
tags = "5, 6, 7, 8"
)]
pub contract_call: ::core::option::Option<
stacks_transaction_sign_request::ContractCall,
>,
}
/// A complete-deposit contract call on Stacks.
/// Nested message and enum types in `StacksTransactionSignRequest`.
pub mod stacks_transaction_sign_request {
/// The contract call transaction to sign.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ContractCall {
/// The `complete-deposit` contract call
#[prost(message, tag = "5")]
CompleteDeposit(super::CompleteDeposit),
/// The `accept-withdrawal-request` contract call
#[prost(message, tag = "6")]
AcceptWithdrawal(super::AcceptWithdrawal),
/// The `reject-withdrawal-request` contract call
#[prost(message, tag = "7")]
RejectWithdrawal(super::RejectWithdrawal),
/// The `rotate-keys-wrapper` contract call
#[prost(message, tag = "8")]
RotateKeys(super::RotateKeys),
}
}
/// For making a `complete-deposit` contract call in the sbtc-deposit
/// smart contract.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompleteDeposit {
Expand Down Expand Up @@ -120,7 +147,8 @@ pub struct CompleteDeposit {
#[prost(uint64, tag = "7")]
pub sweep_block_height: u64,
}
/// The `accept-withdrawal-request` contract call on the stacks blockchain.
/// For making a `accept-withdrawal-request` contract call in the
/// sbtc-withdrawal smart contract.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AcceptWithdrawal {
Expand All @@ -137,9 +165,9 @@ pub struct AcceptWithdrawal {
/// withdrawal request.
#[prost(uint64, tag = "3")]
pub tx_fee: u64,
/// A bitmap of how the signers voted. This structure supports up to
/// 128 distinct signers. Here, we assume that a 1 (or true) implies
/// that the signer voted *against* the transaction.
/// A bitmap of how the signers voted. The length of the list must be less
/// than or equal to 128. Here, we assume that a true implies that the
/// associated signer voted *against* the withdrawal.
#[prost(bool, repeated, tag = "4")]
pub signer_bitmap: ::prost::alloc::vec::Vec<bool>,
/// The address that deployed the contract.
Expand All @@ -155,3 +183,41 @@ pub struct AcceptWithdrawal {
#[prost(uint64, tag = "7")]
pub sweep_block_height: u64,
}
/// For making a `reject-withdrawal-request` contract call in the
/// sbtc-withdrawal smart contract.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RejectWithdrawal {
/// The ID of the withdrawal request generated by the
/// `initiate-withdrawal-request` function in the sbtc-withdrawal smart
/// contract.
#[prost(uint64, tag = "1")]
pub request_id: u64,
/// A bitmap of how the signers voted. The length of the list must be less
/// than or equal to 128. Here, we assume that a true implies that the
/// associated signer voted *against* the withdrawal.
#[prost(bool, repeated, tag = "2")]
pub signer_bitmap: ::prost::alloc::vec::Vec<bool>,
/// The address that deployed the smart contract.
#[prost(message, optional, tag = "3")]
pub deployer: ::core::option::Option<super::super::StacksAddress>,
}
/// For making a `rotate-keys-wrapper` contract call in the
/// `sbtc-bootstrap-signers` smart contract.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RotateKeys {
/// The new set of public keys for all known signers during this
/// PoX cycle.
#[prost(message, repeated, tag = "1")]
pub new_keys: ::prost::alloc::vec::Vec<super::super::super::crypto::PublicKey>,
/// The aggregate key created by combining the above public keys.
#[prost(message, optional, tag = "2")]
pub aggregate_key: ::core::option::Option<super::super::super::crypto::PublicKey>,
/// The address that deployed the contract.
#[prost(message, optional, tag = "3")]
pub deployer: ::core::option::Option<super::super::StacksAddress>,
/// The number of signatures required for the multi-sig wallet.
#[prost(uint32, tag = "4")]
pub signatures_required: u32,
}
1 change: 1 addition & 0 deletions signer/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
mod generated;

pub use generated::crypto::*;
pub use generated::stacks::signer::v1::stacks_transaction_sign_request::*;
pub use generated::stacks::signer::v1::*;
pub use generated::stacks::signer::*;
pub use generated::stacks::*;
Expand Down

0 comments on commit 1bc84b4

Please sign in to comment.