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

Update inputs in genesis transactions #2396

Merged
merged 5 commits into from Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions synthesizer/src/vm/finalize.rs
Expand Up @@ -2022,7 +2022,7 @@ finalize compute:
// Reset the validators.
// Note: We use a smaller committee size to ensure that there is enough supply to allocate to the validators and genesis block transactions.
let validators =
sample_validators::<CurrentNetwork>(Committee::<CurrentNetwork>::MAX_COMMITTEE_SIZE as usize / 4, rng);
sample_validators::<CurrentNetwork>(Committee::<CurrentNetwork>::MAX_COMMITTEE_SIZE as usize, rng);

// Construct the committee.
// Track the allocated amount.
Expand Down Expand Up @@ -2226,7 +2226,7 @@ finalize compute:
// Note that the first validator is used to execute additional transactions in `VM::genesis_quorum`.
// Therefore, the balance of the first validator will be different from the expected balance.
if entry.0 == Plaintext::from_str(&first_validator.to_string()).unwrap() {
assert_eq!(entry.1, Value::from_str("249983999894244u64").unwrap());
assert_eq!(entry.1, Value::from_str("144991999894244u64").unwrap());
} else {
assert!(expected_account.contains(entry));
}
Expand Down
7 changes: 5 additions & 2 deletions synthesizer/src/vm/mod.rs
Expand Up @@ -296,7 +296,10 @@ impl<N: Network, C: ConsensusStorage<N>> VM<N, C> {
// Prepare the locator.
let locator = ("credits.aleo", "transfer_public_to_private");
// Prepare the amount for each call to the function.
let amount = ledger_committee::MIN_VALIDATOR_STAKE;
let amount = public_balances
.get(&caller)
.ok_or_else(|| anyhow!("Missing public balance for {caller}"))?
.saturating_div(Block::<N>::NUM_GENESIS_TRANSACTIONS.saturating_mul(2) as u64);
// Prepare the function inputs.
let inputs = [caller.to_string(), format!("{amount}_u64")];

Expand Down Expand Up @@ -1001,7 +1004,7 @@ function a:
// Note: `deployment_transaction_ids` is sorted lexicographically by transaction ID, so the order may change if we update internal methods.
assert_eq!(
deployment_transaction_ids,
vec![deployment_3.id(), deployment_4.id(), deployment_1.id(), deployment_2.id()],
vec![deployment_1.id(), deployment_4.id(), deployment_3.id(), deployment_2.id()],
"Update me if serialization has changed"
);
}
Expand Down
Expand Up @@ -26,7 +26,7 @@ outputs:
test_rand.aleo/rand_chacha_check:
outputs:
- '{"type":"future","id":"818878742790741579153893179075772445872751227433677932822653185952935999557field","value":"{\n program_id: test_rand.aleo,\n function_name: rand_chacha_check,\n arguments: [\n 1field,\n true\n ]\n}"}'
speculate: the execution was accepted
speculate: the execution was rejected
add_next_block: succeeded.
additional:
- child_outputs:
Expand Down