Skip to content

Commit

Permalink
yield_resume: add more integration tests (near#11287)
Browse files Browse the repository at this point in the history
This PR adds several unit tests covering different scenarios for yield
timeout delivery.

There is also a minor bugfix for the case in which yield_resume is
invoked in the same chunk in which the timeout is processed.
  • Loading branch information
saketh-are authored and nagisa committed May 15, 2024
1 parent c314b8a commit 0d2cd92
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 23 deletions.
6 changes: 5 additions & 1 deletion core/parameters/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ use near_primitives_core::version::PROTOCOL_VERSION;

use super::parameter_table::InvalidConfigError;

// Lowered promise yield timeout length used in integration tests.
// The resharding tests for yield timeouts take too long to run otherwise.
pub const TEST_CONFIG_YIELD_TIMEOUT_LENGTH: u64 = 10;

/// The structure that holds the parameters of the runtime, mostly economics.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RuntimeConfig {
Expand Down Expand Up @@ -44,7 +48,7 @@ impl RuntimeConfig {
let mut wasm_config =
crate::vm::Config::clone(&config_store.get_config(PROTOCOL_VERSION).wasm_config);
// Lower the yield timeout length so that we can observe timeouts in integration tests.
wasm_config.limit_config.yield_timeout_length_in_blocks = 10;
wasm_config.limit_config.yield_timeout_length_in_blocks = TEST_CONFIG_YIELD_TIMEOUT_LENGTH;

RuntimeConfig {
fees: RuntimeFeesConfig::test(),
Expand Down
1 change: 1 addition & 0 deletions integration-tests/src/tests/client/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ mod restrict_tla;
mod simple_test_loop_example;
mod stateless_validation;
mod wallet_contract;
mod yield_timeouts;
mod zero_balance_account;

0 comments on commit 0d2cd92

Please sign in to comment.