Skip to content

Commit

Permalink
Bug fix for test_simulated_load_shared_object_congestion_control (#…
Browse files Browse the repository at this point in the history
…20139)

## Description 

Prevents the test from erroneously picking up current protocol config
setting for separate randomness congestion control budget.

## Test plan 

Is a test fix

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
aschran authored Nov 1, 2024
1 parent 669cf6d commit d2a9fb6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions crates/sui-benchmark/tests/simtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ mod test {
config.max_accumulated_txn_cost_per_object_in_mysticeti_commit() / 10,
),
);
} else {
config
.disable_max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit_for_testing();
}
config
});
Expand Down
22 changes: 18 additions & 4 deletions crates/sui-core/src/authority/shared_object_congestion_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use sui_types::base_types::{ObjectID, TransactionDigest};
use sui_types::error::SuiResult;
use sui_types::executable_transaction::VerifiedExecutableTransaction;
use sui_types::transaction::{Argument, SharedInputObject, TransactionDataAPI};
use tracing::debug;

// SharedObjectCongestionTracker stores the accumulated cost of executing transactions on an object, for
// all transactions in a consensus commit.
Expand Down Expand Up @@ -44,6 +45,8 @@ impl SharedObjectCongestionTracker {
gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
max_txn_cost_overage_per_object_in_commit: u64,
) -> Self {
let object_execution_cost: HashMap<ObjectID, u64> =
initial_object_debts.into_iter().collect();
let max_accumulated_txn_cost_per_object_in_commit =
if mode == PerObjectCongestionControlMode::None {
0
Expand All @@ -52,14 +55,25 @@ impl SharedObjectCongestionTracker {
"max_accumulated_txn_cost_per_object_in_commit must be set if mode is not None",
)
};
let gas_budget_based_txn_cost_absolute_cap =
gas_budget_based_txn_cost_absolute_cap_commit_count
.map(|m| m * max_accumulated_txn_cost_per_object_in_commit);
debug!(
"created SharedObjectCongestionTracker with
{} initial object debts,
mode: {mode:?},
max_accumulated_txn_cost_per_object_in_commit: {max_accumulated_txn_cost_per_object_in_commit:?},
gas_budget_based_txn_cost_cap_factor: {gas_budget_based_txn_cost_cap_factor:?},
gas_budget_based_txn_cost_absolute_cap: {gas_budget_based_txn_cost_absolute_cap:?},
max_txn_cost_overage_per_object_in_commit: {max_txn_cost_overage_per_object_in_commit:?}",
object_execution_cost.len(),
);
Self {
object_execution_cost: initial_object_debts.into_iter().collect(),
object_execution_cost,
mode,
max_accumulated_txn_cost_per_object_in_commit,
gas_budget_based_txn_cost_cap_factor,
gas_budget_based_txn_cost_absolute_cap:
gas_budget_based_txn_cost_absolute_cap_commit_count
.map(|m| m * max_accumulated_txn_cost_per_object_in_commit),
gas_budget_based_txn_cost_absolute_cap,
max_txn_cost_overage_per_object_in_commit,
}
}
Expand Down

0 comments on commit d2a9fb6

Please sign in to comment.