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

feat: enable revealed-value proofs #5983

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion applications/minotari_app_grpc/proto/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ enum RangeProofType {
REVEALED_VALUE = 1;
}

message PermittedRangeProofs {
OutputType output_type = 1;
repeated RangeProofType range_proof_types = 2;
}

/// Range proof
message RangeProof {
bytes proof_bytes = 1;
Expand Down Expand Up @@ -135,5 +140,5 @@ message ConsensusConstants {
uint64 validator_node_registration_min_deposit_amount = 31;
uint64 validator_node_registration_min_lock_height = 32;
uint64 validator_node_registration_shuffle_interval_epoch = 33;
repeated RangeProofType permitted_range_proof_types = 34;
repeated PermittedRangeProofs permitted_range_proof_types = 34;
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ impl From<ConsensusConstants> for grpc::ConsensusConstants {
.map(|ot| i32::from(ot.as_byte()))
.collect::<Vec<i32>>();

let permitted_range_proof_types = cc.permitted_range_proof_types();
let permitted_range_proof_types = permitted_range_proof_types
.iter()
.map(|rpt| i32::from(rpt.as_byte()))
.collect::<Vec<i32>>();
let mut permitted_range_proof_types = Vec::with_capacity(cc.permitted_range_proof_types().len());
for (output_type, range_proof_types) in cc.permitted_range_proof_types() {
permitted_range_proof_types.push(grpc::PermittedRangeProofs {
output_type: i32::from(output_type.as_byte()),
range_proof_types: range_proof_types
.iter()
.map(|rpt| i32::from(rpt.as_byte()))
.collect::<Vec<i32>>(),
});
}

let randomx_pow = grpc::PowAlgorithmConstants {
max_difficulty: cc.max_pow_difficulty(PowAlgorithm::RandomX).as_u64(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ impl BlockTemplateProtocol<'_> {
&self.wallet_payment_address,
self.config.stealth_payment,
self.consensus_manager.consensus_constants(tari_height),
self.config.range_proof_type,
)
.await?;
Ok((coinbase_output, coinbase_kernel))
Expand Down
4 changes: 4 additions & 0 deletions applications/minotari_merge_mining_proxy/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use tari_common::{
};
use tari_common_types::tari_address::TariAddress;
use tari_comms::multiaddr::Multiaddr;
use tari_core::transactions::transaction_components::RangeProofType;

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
Expand Down Expand Up @@ -72,6 +73,8 @@ pub struct MergeMiningProxyConfig {
pub wallet_payment_address: String,
/// Stealth payment yes or no
pub stealth_payment: bool,
/// Range proof type - revealed_value or bullet_proof_plus: (default = bullet_proof_plus)
pub range_proof_type: RangeProofType,
}

impl Default for MergeMiningProxyConfig {
Expand All @@ -93,6 +96,7 @@ impl Default for MergeMiningProxyConfig {
network: Default::default(),
wallet_payment_address: TariAddress::default().to_hex(),
stealth_payment: true,
range_proof_type: RangeProofType::BulletProofPlus,
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions applications/minotari_miner/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use serde::{Deserialize, Serialize};
use tari_common::{configuration::Network, SubConfigPath};
use tari_common_types::{grpc_authentication::GrpcAuthentication, tari_address::TariAddress};
use tari_comms::multiaddr::Multiaddr;
use tari_core::transactions::transaction_components::RangeProofType;

#[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
Expand Down Expand Up @@ -77,6 +78,8 @@ pub struct MinerConfig {
pub wallet_payment_address: String,
/// Stealth payment yes or no
pub stealth_payment: bool,
/// Range proof type - revealed_value or bullet_proof_plus: (default = bullet_proof_plus)
pub range_proof_type: RangeProofType,
}

/// The proof of work data structure that is included in the block header. For the Minotari miner only `Sha3x` is
Expand Down Expand Up @@ -110,6 +113,7 @@ impl Default for MinerConfig {
wait_timeout_on_error: 10,
wallet_payment_address: TariAddress::default().to_hex(),
stealth_payment: true,
range_proof_type: RangeProofType::BulletProofPlus,
hansieodendaal marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
1 change: 1 addition & 0 deletions applications/minotari_miner/src/run_miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ async fn mining_cycle(
wallet_payment_address,
config.stealth_payment,
consensus_manager.consensus_constants(height),
config.range_proof_type,
)
.await
.map_err(|e| MinerError::CoinbaseError(e.to_string()))?;
Expand Down
18 changes: 10 additions & 8 deletions applications/minotari_node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,16 @@ mod tests {

#[test]
fn it_deserializes_enums() {
let config_str = r#"name = "blockchain champion"
inner_config.deny_methods = [
"list_headers",
"get_constants",
# "get_blocks"
"identify",
# "get_shard_key"
]"#;
let config_str = r#"
name = "blockchain champion"
inner_config.deny_methods = [
"list_headers",
"get_constants",
# "get_blocks"
"identify",
# "get_shard_key"
]
"#;
let config = toml::from_str::<TestConfig>(config_str).unwrap();

// Enums in the config
Expand Down
1 change: 1 addition & 0 deletions base_layer/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ libsqlite3-sys = { version = "0.25.1", features = ["bundled"] }
config = { version = "0.13.0" }
env_logger = "0.7.0"
tempfile = "3.1.0"
toml = { version = "0.5" }

[build-dependencies]
tari_common = { path = "../../common", features = ["build"] }
Expand Down
Loading
Loading