Skip to content

Commit

Permalink
fix(test) - fix flaky test (#11508)
Browse files Browse the repository at this point in the history
The `test_in_memory_trie_node_consistency` was failing occasionally
because the config with disabled congestion control wasn't properly
passed into the nightshade runtime. Also setting the threshold for
rejecting transactions from 1 to 2 because otherwise some could still
get rejected under full congestion.
  • Loading branch information
wacban authored Jun 6, 2024
1 parent 56dc3df commit f4557ec
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion chain/chain/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ impl NightshadeRuntime {
compiled_contract_cache: Box<dyn ContractRuntimeCache>,
genesis_config: &GenesisConfig,
epoch_manager: Arc<EpochManagerHandle>,
runtime_config_store: Option<RuntimeConfigStore>,
trie_config: TrieConfig,
state_snapshot_type: StateSnapshotType,
) -> Arc<Self> {
Expand All @@ -177,7 +178,7 @@ impl NightshadeRuntime {
epoch_manager,
None,
None,
None,
runtime_config_store,
DEFAULT_GC_NUM_EPOCHS_TO_KEEP,
trie_config,
StateSnapshotConfig {
Expand Down
2 changes: 1 addition & 1 deletion core/parameters/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl CongestionControlConfig {
allowed_shard_outgoing_gas: max_value,
max_tx_gas: max_value,
min_tx_gas: max_value,
reject_tx_congestion_threshold: 1.0,
reject_tx_congestion_threshold: 2.0,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ fn test_stateless_validators_with_multi_test_loop() {
contract_cache,
&genesis.config,
epoch_manager.clone(),
None,
TrieConfig::from_store_config(&store_config),
StateSnapshotType::EveryEpoch,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ fn test_client_with_multi_test_loop() {
contract_cache,
&genesis.config,
epoch_manager.clone(),
None,
TrieConfig::from_store_config(&store_config),
StateSnapshotType::EveryEpoch,
);
Expand Down
3 changes: 2 additions & 1 deletion nearcore/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl TestEnvNightshadeSetupExt for TestEnvBuilder {
store: Store,
contract_cache: Box<dyn ContractRuntimeCache>,
epoch_manager: Arc<EpochManagerHandle>,
_,
runtime_config_store: RuntimeConfigStore,
trie_config: TrieConfig|
-> Arc<dyn RuntimeAdapter> {
// TODO: It's not ideal to initialize genesis state with the nightshade runtime here for tests
Expand All @@ -98,6 +98,7 @@ impl TestEnvNightshadeSetupExt for TestEnvBuilder {
contract_cache,
&genesis.config,
epoch_manager,
Some(runtime_config_store),
trie_config,
state_snapshot_type.clone(),
)
Expand Down

0 comments on commit f4557ec

Please sign in to comment.