diff --git a/console/network/src/canary_v0.rs b/console/network/src/canary_v0.rs index 1c0cf02143..1fb44dbb4a 100644 --- a/console/network/src/canary_v0.rs +++ b/console/network/src/canary_v0.rs @@ -133,9 +133,9 @@ impl Network for CanaryV0 { /// The network edition. const EDITION: u16 = 0; /// The genesis block coinbase target. - const GENESIS_COINBASE_TARGET: u64 = (1u64 << 10).saturating_sub(1); + const GENESIS_COINBASE_TARGET: u64 = (1u64 << 29).saturating_sub(1); /// The genesis block proof target. - const GENESIS_PROOF_TARGET: u64 = 1u64 << 8; + const GENESIS_PROOF_TARGET: u64 = 1u64 << 27; /// The fixed timestamp of the genesis block. const GENESIS_TIMESTAMP: i64 = 1715776496 /* 2024-05-15 12:34:56 UTC */; /// The network ID. diff --git a/console/network/src/lib.rs b/console/network/src/lib.rs index 47210b3e90..80c392e097 100644 --- a/console/network/src/lib.rs +++ b/console/network/src/lib.rs @@ -97,14 +97,14 @@ pub trait Network: const GENESIS_TIMESTAMP: i64; /// The genesis block coinbase target. #[cfg(not(feature = "test"))] - const GENESIS_COINBASE_TARGET: u64 = (1u64 << 10).saturating_sub(1); + const GENESIS_COINBASE_TARGET: u64 = (1u64 << 29).saturating_sub(1); /// The genesis block coinbase target. /// This is deliberately set to a low value (32) for testing purposes only. #[cfg(feature = "test")] const GENESIS_COINBASE_TARGET: u64 = (1u64 << 5).saturating_sub(1); /// The genesis block proof target. #[cfg(not(feature = "test"))] - const GENESIS_PROOF_TARGET: u64 = 1u64 << 8; + const GENESIS_PROOF_TARGET: u64 = 1u64 << 27; /// The genesis block proof target. /// This is deliberately set to a low value (8) for testing purposes only. #[cfg(feature = "test")] diff --git a/console/network/src/mainnet_v0.rs b/console/network/src/mainnet_v0.rs index a0d5f397cf..16640a0d43 100644 --- a/console/network/src/mainnet_v0.rs +++ b/console/network/src/mainnet_v0.rs @@ -133,6 +133,20 @@ impl Network for MainnetV0 { /// The network edition. const EDITION: u16 = 0; + /// The genesis block coinbase target. + #[cfg(not(feature = "test"))] + const GENESIS_COINBASE_TARGET: u64 = (1u64 << 29).saturating_sub(1); + /// The genesis block coinbase target. + /// This is deliberately set to a low value (32) for testing purposes only. + #[cfg(feature = "test")] + const GENESIS_COINBASE_TARGET: u64 = (1u64 << 5).saturating_sub(1); + /// The genesis block proof target. + #[cfg(not(feature = "test"))] + const GENESIS_PROOF_TARGET: u64 = 1u64 << 27; + /// The genesis block proof target. + /// This is deliberately set to a low value (8) for testing purposes only. + #[cfg(feature = "test")] + const GENESIS_PROOF_TARGET: u64 = 1u64 << 3; /// The fixed timestamp of the genesis block. const GENESIS_TIMESTAMP: i64 = 1696118400 /* 2023-10-01 00:00:00 UTC */; /// The network ID. diff --git a/console/network/src/testnet_v0.rs b/console/network/src/testnet_v0.rs index 4990c54336..a33c96f0ad 100644 --- a/console/network/src/testnet_v0.rs +++ b/console/network/src/testnet_v0.rs @@ -133,9 +133,9 @@ impl Network for TestnetV0 { /// The network edition. const EDITION: u16 = 0; /// The genesis block coinbase target. - const GENESIS_COINBASE_TARGET: u64 = (1u64 << 10).saturating_sub(1); + const GENESIS_COINBASE_TARGET: u64 = (1u64 << 29).saturating_sub(1); /// The genesis block proof target. - const GENESIS_PROOF_TARGET: u64 = 1u64 << 8; + const GENESIS_PROOF_TARGET: u64 = 1u64 << 27; /// The fixed timestamp of the genesis block. const GENESIS_TIMESTAMP: i64 = 1715776496 /* 2024-05-15 12:34:56 UTC */; /// The network ID. diff --git a/parameters/src/canary/genesis.rs b/parameters/src/canary/genesis.rs index 36af9bea70..08a0d0299f 100644 --- a/parameters/src/canary/genesis.rs +++ b/parameters/src/canary/genesis.rs @@ -27,6 +27,6 @@ mod tests { #[test] fn test_genesis_block() { let bytes = GenesisBytes::load_bytes(); - assert_eq!(14947, bytes.len() as u64, "Update me if serialization has changed"); + assert_eq!(20083, bytes.len() as u64, "Update me if serialization has changed"); } } diff --git a/parameters/src/canary/resources/block.genesis b/parameters/src/canary/resources/block.genesis index 7f133c4c60..74a775b9c7 100644 Binary files a/parameters/src/canary/resources/block.genesis and b/parameters/src/canary/resources/block.genesis differ diff --git a/parameters/src/mainnet/genesis.rs b/parameters/src/mainnet/genesis.rs index 5abd5770e1..08a0d0299f 100644 --- a/parameters/src/mainnet/genesis.rs +++ b/parameters/src/mainnet/genesis.rs @@ -27,6 +27,6 @@ mod tests { #[test] fn test_genesis_block() { let bytes = GenesisBytes::load_bytes(); - assert_eq!(14955, bytes.len() as u64, "Update me if serialization has changed"); + assert_eq!(20083, bytes.len() as u64, "Update me if serialization has changed"); } } diff --git a/parameters/src/mainnet/resources/block.genesis b/parameters/src/mainnet/resources/block.genesis index e2b47710fa..5ef9829adb 100644 Binary files a/parameters/src/mainnet/resources/block.genesis and b/parameters/src/mainnet/resources/block.genesis differ diff --git a/parameters/src/testnet/genesis.rs b/parameters/src/testnet/genesis.rs index d3a8b49351..08a0d0299f 100644 --- a/parameters/src/testnet/genesis.rs +++ b/parameters/src/testnet/genesis.rs @@ -27,6 +27,6 @@ mod tests { #[test] fn test_genesis_block() { let bytes = GenesisBytes::load_bytes(); - assert_eq!(14943, bytes.len() as u64, "Update me if serialization has changed"); + assert_eq!(20083, bytes.len() as u64, "Update me if serialization has changed"); } } diff --git a/parameters/src/testnet/resources/block.genesis b/parameters/src/testnet/resources/block.genesis index 53847e49c9..8fa9ad161e 100644 Binary files a/parameters/src/testnet/resources/block.genesis and b/parameters/src/testnet/resources/block.genesis differ diff --git a/synthesizer/src/vm/finalize.rs b/synthesizer/src/vm/finalize.rs index 183b994c06..1ab759736b 100644 --- a/synthesizer/src/vm/finalize.rs +++ b/synthesizer/src/vm/finalize.rs @@ -1070,6 +1070,10 @@ impl> VM { *amount >= MIN_DELEGATOR_STAKE, "Ratify::Genesis(..) the delegator {address} must stake at least {MIN_DELEGATOR_STAKE}", ); + // If the corresponding validator is not a committee member yet, then continue. + if !committee.is_committee_member(*validator_address) { + continue; + } // If the address is a delegator, check that the corresponding validator is open. ensure!( committee.is_committee_member_open(*validator_address), diff --git a/synthesizer/src/vm/mod.rs b/synthesizer/src/vm/mod.rs index 9301e68cf2..d1750c614b 100644 --- a/synthesizer/src/vm/mod.rs +++ b/synthesizer/src/vm/mod.rs @@ -313,14 +313,17 @@ impl> VM { bonded_balances: IndexMap, (Address, Address, u64)>, rng: &mut R, ) -> Result> { - // Retrieve the total stake. - let total_stake = committee.total_stake(); + // Retrieve the total bonded balance. + let total_bonded_amount = bonded_balances + .values() + .try_fold(0u64, |acc, (_, _, x)| acc.checked_add(*x).ok_or(anyhow!("Invalid bonded amount")))?; // Compute the account supply. let account_supply = public_balances .values() .try_fold(0u64, |acc, x| acc.checked_add(*x).ok_or(anyhow!("Invalid account supply")))?; // Compute the total supply. - let total_supply = total_stake.checked_add(account_supply).ok_or_else(|| anyhow!("Invalid total supply"))?; + let total_supply = + total_bonded_amount.checked_add(account_supply).ok_or_else(|| anyhow!("Invalid total supply"))?; // Ensure the total supply matches. ensure!( total_supply == N::STARTING_SUPPLY, diff --git a/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out b/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out index d71649dc35..6380117c04 100644 --- a/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out +++ b/synthesizer/tests/expectations/vm/execute_and_finalize/test_rand.out @@ -19,7 +19,7 @@ outputs: test_rand.aleo/rand_chacha_check: outputs: - '{"type":"future","id":"3094014759641313043901697261267946468626327163450942596641947962222295207390field","value":"{\n program_id: test_rand.aleo,\n function_name: rand_chacha_check,\n arguments: [\n 0field,\n false\n ]\n}"}' - speculate: the execution was accepted + speculate: the execution was rejected add_next_block: succeeded. - verified: true execute: