contract/money: Faucet cleanup

This removes clear inputs from Money::Transfer, and removes all faucet
references in the code.

Additionally, in src/validator/ we use the ValidatorConfig struct
directly, rather than using the ValidatorConfig::new() function.
This commit is contained in:
parazyd
2024-02-08 11:59:33 +01:00
parent 0957973ff6
commit 00aefdded5
16 changed files with 57 additions and 182 deletions

View File

@@ -223,14 +223,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
None
};
let config = ValidatorConfig::new(
blockchain_config.threshold,
blockchain_config.pow_target,
let config = ValidatorConfig {
finalization_threshold: blockchain_config.threshold,
pow_target: blockchain_config.pow_target,
pow_fixed_difficulty,
genesis_block,
vec![],
false, // TODO: Make configurable
);
verify_fees: false, // TODO: Make configurable
};
// Initialize validator
let validator = Validator::new(&sled_db, config).await?;

View File

@@ -85,14 +85,13 @@ impl Harness {
// Generate validators configuration
// NOTE: we are not using consensus constants here so we
// don't get circular dependencies.
let validator_config = ValidatorConfig::new(
3,
config.pow_target,
config.pow_fixed_difficulty.clone(),
let validator_config = ValidatorConfig {
finalization_threshold: 3,
pow_target: config.pow_target,
pow_fixed_difficulty: config.pow_fixed_difficulty.clone(),
genesis_block,
vec![],
verify_fees,
);
};
// Generate validators using pregenerated vks
let (_, vks) = vks::read_or_gen_vks_and_pks()?;
@@ -141,18 +140,11 @@ impl Harness {
let bob = &self.bob.validator;
alice
.validate_blockchain(
vec![],
self.config.pow_target,
self.config.pow_fixed_difficulty.clone(),
)
.validate_blockchain(self.config.pow_target, self.config.pow_fixed_difficulty.clone())
.await?;
bob.validate_blockchain(self.config.pow_target, self.config.pow_fixed_difficulty.clone())
.await?;
bob.validate_blockchain(
vec![],
self.config.pow_target,
self.config.pow_fixed_difficulty.clone(),
)
.await?;
let alice_blockchain_len = alice.blockchain.len();
assert_eq!(alice_blockchain_len, bob.blockchain.len());

View File

@@ -73,7 +73,7 @@ async fn sync_blocks_real(ex: Arc<Executor<'static>>) -> Result<()> {
// Verify node synced
let alice = &th.alice.validator;
let charlie = &charlie.validator;
charlie.validate_blockchain(vec![], pow_target, pow_fixed_difficulty).await?;
charlie.validate_blockchain(pow_target, pow_fixed_difficulty).await?;
assert_eq!(alice.blockchain.len(), charlie.blockchain.len());
// Thanks for reading

View File

@@ -245,7 +245,6 @@ impl Drk {
let debris = builder.build()?;
let full_params = MoneyTransferParamsV1 {
clear_inputs: vec![],
inputs: vec![partial.params.inputs[0].clone(), debris.params.inputs[0].clone()],
outputs: vec![partial.params.outputs[0].clone(), debris.params.outputs[0].clone()],
};