Skip to content

Commit

Permalink
[txn-emitter] Fix computation for needed coin balance (#4614)
Browse files Browse the repository at this point in the history
With increased gas fees, we were exceeding u64. But we really shouldn't be needing that much money - and it was due to this bug
  • Loading branch information
igor-aptos authored Sep 29, 2022
1 parent aae4ea0 commit 6761db2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/transaction-emitter-lib/src/emitter/account_minter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ impl<'t> AccountMinter<'t> {
.checked_mul(SEND_AMOUNT + GAS_AMOUNT)
.unwrap(); // extra coins for secure to pay none zero gas price
let txn_factory = self.txn_factory.clone();
let coins_per_seed_account = (num_accounts as u64)
.checked_mul(coins_per_account + 1_000_000)
let expected_children_per_seed_account =
(num_accounts + expected_num_seed_accounts - 1) / expected_num_seed_accounts;
let coins_per_seed_account = (expected_children_per_seed_account as u64)
.checked_mul(coins_per_account + GAS_AMOUNT)
.unwrap();
let coins_for_root = coins_per_seed_account
.checked_mul(expected_num_seed_accounts as u64)
Expand Down

0 comments on commit 6761db2

Please sign in to comment.