Skip to content

Commit

Permalink
rename to committee definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron Hambly committed Feb 15, 2022
1 parent fcb7f17 commit c91c7ce
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 80 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ node_modules
buildtools/Output/
/applications/tari_collectibles/src-tauri/data

# Asset files
assets/
# some folders called assets are kind of important now
# any specific "assets" folders should be gitignored
# closer to where they live
#assets/
4 changes: 2 additions & 2 deletions applications/tari_app_grpc/proto/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ message OutputFeatures {
SideChainCheckpointFeatures sidechain_checkpoint = 8;
// Version
uint32 version = 9;
CommitteeCheckpointFeatures committee_checkpoint = 10;
CommitteeDefinitionFeatures committee_definition = 10;
}

message AssetOutputFeatures {
Expand All @@ -250,7 +250,7 @@ message SideChainCheckpointFeatures {
repeated bytes committee = 2;
}

message CommitteeCheckpointFeatures {
message CommitteeDefinitionFeatures {
repeated bytes committee = 1;
uint64 effective_sidechain_height = 2;
}
Expand Down
6 changes: 3 additions & 3 deletions applications/tari_app_grpc/proto/wallet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ service Wallet {
rpc CreateInitialAssetCheckpoint(CreateInitialAssetCheckpointRequest) returns (CreateInitialAssetCheckpointResponse);
// TODO: Needs a better name pls
rpc CreateFollowOnAssetCheckpoint(CreateFollowOnAssetCheckpointRequest) returns (CreateFollowOnAssetCheckpointResponse);
rpc CreateCommitteeCheckpoint(CreateCommitteeCheckpointRequest) returns (CreateCommitteeCheckpointResponse);
rpc CreateCommitteeDefinition(CreateCommitteeDefinitionRequest) returns (CreateCommitteeDefinitionResponse);

rpc GetOwnedAssets(Empty) returns (GetOwnedAssetsResponse);

Expand Down Expand Up @@ -281,13 +281,13 @@ message CreateFollowOnAssetCheckpointResponse {

}

message CreateCommitteeCheckpointRequest {
message CreateCommitteeDefinitionRequest {
bytes asset_public_key = 1;
repeated bytes committee = 2;
uint64 effective_sidechain_height = 3;
}

message CreateCommitteeCheckpointResponse {
message CreateCommitteeDefinitionResponse {

}

Expand Down
14 changes: 7 additions & 7 deletions applications/tari_app_grpc/src/conversions/output_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use tari_common_types::{
};
use tari_core::transactions::transaction_components::{
AssetOutputFeatures,
CommitteeCheckpointFeatures,
CommitteeDefinitionFeatures,
MintNonFungibleFeatures,
OutputFeatures,
OutputFeaturesVersion,
Expand Down Expand Up @@ -68,7 +68,7 @@ impl TryFrom<grpc::OutputFeatures> for OutputFeatures {
features.asset.map(|a| a.try_into()).transpose()?,
features.mint_non_fungible.map(|m| m.try_into()).transpose()?,
features.sidechain_checkpoint.map(|s| s.try_into()).transpose()?,
features.committee_checkpoint.map(|c| c.try_into()).transpose()?,
features.committee_definition.map(|c| c.try_into()).transpose()?,
))
}
}
Expand All @@ -88,7 +88,7 @@ impl From<OutputFeatures> for grpc::OutputFeatures {
mint_non_fungible: features.mint_non_fungible.map(|m| m.into()),
sidechain_checkpoint: features.sidechain_checkpoint.map(|m| m.into()),
version: features.version as u32,
committee_checkpoint: features.committee_checkpoint.map(|c| c.into()),
committee_definition: features.committee_definition.map(|c| c.into()),
}
}
}
Expand Down Expand Up @@ -188,19 +188,19 @@ impl TryFrom<grpc::SideChainCheckpointFeatures> for SideChainCheckpointFeatures
}
}

impl From<CommitteeCheckpointFeatures> for grpc::CommitteeCheckpointFeatures {
fn from(value: CommitteeCheckpointFeatures) -> Self {
impl From<CommitteeDefinitionFeatures> for grpc::CommitteeDefinitionFeatures {
fn from(value: CommitteeDefinitionFeatures) -> Self {
Self {
committee: value.committee.iter().map(|c| c.as_bytes().to_vec()).collect(),
effective_sidechain_height: value.effective_sidechain_height,
}
}
}

impl TryFrom<grpc::CommitteeCheckpointFeatures> for CommitteeCheckpointFeatures {
impl TryFrom<grpc::CommitteeDefinitionFeatures> for CommitteeDefinitionFeatures {
type Error = String;

fn try_from(value: grpc::CommitteeCheckpointFeatures) -> Result<Self, Self::Error> {
fn try_from(value: grpc::CommitteeDefinitionFeatures) -> Result<Self, Self::Error> {
let committee = value
.committee
.iter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,28 +134,28 @@ impl WalletClient {
Ok(result.into_inner())
}

pub async fn create_committee_checkpoint(
pub async fn create_committee_definition(
&mut self,
asset_public_key: &str,
committee: Vec<String>,
effective_sidechain_height: u64,
) -> Result<grpc::CreateCommitteeCheckpointResponse, CollectiblesError> {
) -> Result<grpc::CreateCommitteeDefinitionResponse, CollectiblesError> {
let inner = self.get_inner_mut()?;
let committee = committee
.iter()
.map(|s| Vec::from_hex(s))
.collect::<Result<Vec<_>, _>>()?;

let request = grpc::CreateCommitteeCheckpointRequest {
let request = grpc::CreateCommitteeDefinitionRequest {
asset_public_key: Vec::from_hex(asset_public_key)?,
committee,
effective_sidechain_height,
};
let result = inner
.create_committee_checkpoint(request)
.create_committee_definition(request)
.await
.map_err(|source| CollectiblesError::ClientRequest {
request: "create_committee_checkpoint".to_string(),
request: "create_committee_definition".to_string(),
source,
})?;
debug!(target: LOG_TARGET, "result {:?}", result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ pub(crate) async fn assets_create_initial_checkpoint(
}

#[tauri::command]
pub(crate) async fn assets_create_committee_checkpoint(
pub(crate) async fn assets_create_committee_definition(
asset_public_key: String,
committee: Vec<String>,
state: tauri::State<'_, ConcurrentAppState>,
Expand All @@ -268,7 +268,7 @@ pub(crate) async fn assets_create_committee_checkpoint(

// TODO: effective sidechain height...
client
.create_committee_checkpoint(&asset_public_key, committee, 0)
.create_committee_definition(&asset_public_key, committee, 0)
.await?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_collectibles/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn main() -> Result<(), Box<dyn Error>> {
commands::assets::assets_list_owned,
commands::assets::assets_list_registered_assets,
commands::assets::assets_create_initial_checkpoint,
commands::assets::assets_create_committee_checkpoint,
commands::assets::assets_create_committee_definition,
commands::assets::assets_get_registration,
commands::asset_wallets::asset_wallets_create,
commands::asset_wallets::asset_wallets_list,
Expand Down
6 changes: 3 additions & 3 deletions applications/tari_collectibles/web-app/src/Create.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ class Create extends React.Component {
let asset_registration =
await binding.command_asset_create_initial_checkpoint(publicKey);
console.log(asset_registration);
let committee_checkpoint =
await binding.command_asset_create_committee_checkpoint(
let committee_definition =
await binding.command_asset_create_committee_definition(
publicKey,
this.state.tip003Data.committee
);
console.log(committee_checkpoint);
console.log(committee_definition);
}
let history = this.props.history;

Expand Down
6 changes: 3 additions & 3 deletions applications/tari_collectibles/web-app/src/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ async function command_asset_create_initial_checkpoint(assetPubKey) {
});
}

async function command_asset_create_committee_checkpoint(
async function command_asset_create_committee_definition(
assetPubKey,
committee
) {
return await invoke("assets_create_committee_checkpoint", {
return await invoke("assets_create_committee_definition", {
assetPubKey,
committee,
});
Expand Down Expand Up @@ -157,7 +157,7 @@ const commands = {
command_assets_list_owned,
command_assets_list_registered_assets,
command_asset_create_initial_checkpoint,
command_asset_create_committee_checkpoint,
command_asset_create_committee_definition,
command_next_asset_public_key,
command_asset_wallets_create,
command_asset_wallets_get_balance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Display for ParsedCommand {
RegisterAsset => "register-asset",
MintTokens => "mint-tokens",
CreateInitialCheckpoint => "create-initial-checkpoint",
CreateCommitteeCheckpoint => "create-committee-checkpoint",
CreateCommitteeDefinition => "create-committee-definition",
};

let args = self
Expand Down Expand Up @@ -142,7 +142,7 @@ pub fn parse_command(command: &str) -> Result<ParsedCommand, ParseError> {
// mint-tokens pub_key nft_id1 nft_id2
MintTokens => parser_builder(args).pub_key().text_array().build()?,
CreateInitialCheckpoint => parser_builder(args).pub_key().text().build()?,
CreateCommitteeCheckpoint => parser_builder(args).pub_key().pub_key_array().build()?,
CreateCommitteeDefinition => parser_builder(args).pub_key().pub_key_array().build()?,
};

Ok(ParsedCommand { command, args })
Expand Down
6 changes: 3 additions & 3 deletions applications/tari_console_wallet/src/automation/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub enum WalletCommand {
RegisterAsset,
MintTokens,
CreateInitialCheckpoint,
CreateCommitteeCheckpoint,
CreateCommitteeDefinition,
}

#[derive(Debug, EnumString, PartialEq, Clone)]
Expand Down Expand Up @@ -878,7 +878,7 @@ pub async fn command_runner(
.submit_transaction(tx_id, transaction, 0.into(), message)
.await?;
},
CreateCommitteeCheckpoint => {
CreateCommitteeDefinition => {
let asset_public_key = match parsed.args[0] {
ParsedArgument::PublicKey(ref key) => Ok(key.clone()),
_ => Err(CommandError::Argument),
Expand Down Expand Up @@ -908,7 +908,7 @@ pub async fn command_runner(
let mut asset_manager = wallet.asset_manager.clone();
// todo: effective sidechain height...
let (tx_id, transaction) = asset_manager
.create_committee_checkpoint(&asset_public_key, &committee_public_keys, 0)
.create_committee_definition(&asset_public_key, &committee_public_keys, 0)
.await?;

let _result = transaction_service
Expand Down
14 changes: 7 additions & 7 deletions applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ use tari_app_grpc::{
ClaimShaAtomicSwapResponse,
CoinSplitRequest,
CoinSplitResponse,
CreateCommitteeCheckpointRequest,
CreateCommitteeCheckpointResponse,
CreateCommitteeDefinitionRequest,
CreateCommitteeDefinitionResponse,
CreateFollowOnAssetCheckpointRequest,
CreateFollowOnAssetCheckpointResponse,
CreateInitialAssetCheckpointRequest,
Expand Down Expand Up @@ -720,10 +720,10 @@ impl wallet_server::Wallet for WalletGrpcServer {
Ok(Response::new(CreateFollowOnAssetCheckpointResponse {}))
}

async fn create_committee_checkpoint(
async fn create_committee_definition(
&self,
request: Request<CreateCommitteeCheckpointRequest>,
) -> Result<Response<CreateCommitteeCheckpointResponse>, Status> {
request: Request<CreateCommitteeDefinitionRequest>,
) -> Result<Response<CreateCommitteeDefinitionResponse>, Status> {
let mut asset_manager = self.wallet.asset_manager.clone();
let mut transaction_service = self.wallet.transaction_service.clone();
let message = request.into_inner();
Expand All @@ -739,7 +739,7 @@ impl wallet_server::Wallet for WalletGrpcServer {
let effective_sidechain_height = message.effective_sidechain_height;

let (tx_id, transaction) = asset_manager
.create_committee_checkpoint(&asset_public_key, &committee_public_keys, effective_sidechain_height)
.create_committee_definition(&asset_public_key, &committee_public_keys, effective_sidechain_height)
.await
.map_err(|e| Status::internal(e.to_string()))?;

Expand All @@ -752,7 +752,7 @@ impl wallet_server::Wallet for WalletGrpcServer {
.await
.map_err(|e| Status::internal(e.to_string()))?;

Ok(Response::new(CreateCommitteeCheckpointResponse {}))
Ok(Response::new(CreateCommitteeDefinitionResponse {}))
}

async fn mint_tokens(&self, request: Request<MintTokensRequest>) -> Result<Response<MintTokensResponse>, Status> {
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/blocks/genesis_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ fn get_dibbler_genesis_block_raw() -> Block {
asset: None,
mint_non_fungible: None,
sidechain_checkpoint: None,
committee_checkpoint: None
committee_definition: None
},
Commitment::from_hex("e2b9ee8fdf05f9fa8fd7598d4568b539eef694e58cdae84c779140271a96d733 ").unwrap(),
BulletRangeProof::from_hex("0c02c6d9bdbd1c21b29ee0f83bed597ed07f71a60f99ddcbc02550059c4c08020438f8fc25c69160dc6af81f84c037fc79b9f4a7baa93ab4d6ef1640356d9b575efe1f3f8b40f6c64d1a964aab215491f79738ccac1712d756607626442dda37ac30010dc663985153786cc53c865c01bfec186a803c1edb1a34efa3088ec221016a63cdbd2b58fa4c258bfbf0cff6b793ab62f5db0fb781f046effb5f4e7c0a956c2e042e3f0c16a72f20a624625fa6dc0b742e49e0158a50c8abde54834e04bb35baef0c258da30b738256549e3a2612ff89b4f6bfe82d16aa10b38daabe0df6b922717cb4b1604ab97a2a5efa4d325beb56c5419cff185d61e1a0fc9e374098bf4a10404d788141e2c77de222d68c14b421b62f300898c25487f491aff26be85e54c011e90cc96aff6b31993ce74233674fb150de929fbc259bcc7808a84432cf28bf83c2a0fbf2b47a6244fbafa02ca4f5c9d46c5380fe8eaed734f1d56e769e59800137900cb5905191bbb463cbcb4ea0a2073d716f18878ed4455d19426a2c1133bf703510bf0f1b3b70e9e5ee6fbb70a8e710fd0a4b8f37eacfdeef3df66e461f16ffdb270a7181505b1358f56578840bbfa284444c35160794f0294300ecb3fde701a3f5ed9234e4c196b93fd70633069eeb184ab53685b5324c963a7428094f0c7d4306b5da6ef5fb68d085c32adabe004bebcbf335ee8fc92e5e034edcb035872d08f139e9445539241ff9b9fbebbc0e7b248cbd97fa7c6f3d7823085893c9ced1685d69d2a7cf111f81e086927565c301d4e33639def1139bd5245a0ae9085d5ba10cdc1f89fc7a7fa95cc3aa11784ec40ebf57475ffb4f2b2042018e3dbe905ebd5d0ebe533f36f43f709110372c94258a59e53c9b319adca30c8e9f4f92d5937f994ff36a5bb38a15682187dc8734162f45e169a97a36fb5a05").unwrap(),
Expand Down
6 changes: 3 additions & 3 deletions base_layer/core/src/proto/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ message TransactionOutput {
uint32 version = 8;
}

// Options for UTXO's
// Options for UTXOs
message OutputFeatures {
// Flags are the feature flags that differentiate between outputs, eg Coinbase all of which has different rules
uint32 flags = 1;
Expand All @@ -95,7 +95,7 @@ message OutputFeatures {
SideChainCheckpointFeatures sidechain_checkpoint = 8;
// Version
uint32 version = 9;
CommitteeCheckpointFeatures committee_checkpoint = 10;
CommitteeDefinitionFeatures committee_definition = 10;
}

message AssetOutputFeatures {
Expand All @@ -120,7 +120,7 @@ message SideChainCheckpointFeatures {
repeated bytes committee = 2;
}

message CommitteeCheckpointFeatures {
message CommitteeDefinitionFeatures {
repeated bytes committee = 1;
uint64 effective_sidechain_height = 2;
}
Expand Down
14 changes: 7 additions & 7 deletions base_layer/core/src/proto/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use crate::{
tari_amount::MicroTari,
transaction_components::{
AssetOutputFeatures,
CommitteeCheckpointFeatures,
CommitteeDefinitionFeatures,
KernelFeatures,
MintNonFungibleFeatures,
OutputFeatures,
Expand Down Expand Up @@ -302,7 +302,7 @@ impl TryFrom<proto::types::OutputFeatures> for OutputFeatures {
None => None,
},
features.sidechain_checkpoint.map(|s| s.try_into()).transpose()?,
features.committee_checkpoint.map(|c| c.try_into()).transpose()?,
features.committee_definition.map(|c| c.try_into()).transpose()?,
))
}
}
Expand All @@ -322,7 +322,7 @@ impl From<OutputFeatures> for proto::types::OutputFeatures {
mint_non_fungible: features.mint_non_fungible.map(|m| m.into()),
sidechain_checkpoint: features.sidechain_checkpoint.map(|s| s.into()),
version: features.version as u32,
committee_checkpoint: features.committee_checkpoint.map(|c| c.into()),
committee_definition: features.committee_definition.map(|c| c.into()),
}
}
}
Expand Down Expand Up @@ -429,10 +429,10 @@ impl From<SideChainCheckpointFeatures> for proto::types::SideChainCheckpointFeat
}
}

impl TryFrom<proto::types::CommitteeCheckpointFeatures> for CommitteeCheckpointFeatures {
impl TryFrom<proto::types::CommitteeDefinitionFeatures> for CommitteeDefinitionFeatures {
type Error = String;

fn try_from(value: proto::types::CommitteeCheckpointFeatures) -> Result<Self, Self::Error> {
fn try_from(value: proto::types::CommitteeDefinitionFeatures) -> Result<Self, Self::Error> {
let committee = value
.committee
.into_iter()
Expand All @@ -447,8 +447,8 @@ impl TryFrom<proto::types::CommitteeCheckpointFeatures> for CommitteeCheckpointF
}
}

impl From<CommitteeCheckpointFeatures> for proto::types::CommitteeCheckpointFeatures {
fn from(value: CommitteeCheckpointFeatures) -> Self {
impl From<CommitteeDefinitionFeatures> for proto::types::CommitteeDefinitionFeatures {
fn from(value: CommitteeDefinitionFeatures) -> Self {
Self {
committee: value.committee.into_iter().map(|c| c.as_bytes().to_vec()).collect(),
effective_sidechain_height: value.effective_sidechain_height,
Expand Down
Loading

0 comments on commit c91c7ce

Please sign in to comment.