diff --git a/multichain-testing/test/auto-stake-it.test.ts b/multichain-testing/test/auto-stake-it.test.ts index 16e32bdf9a4e..5aee9d6fa151 100644 --- a/multichain-testing/test/auto-stake-it.test.ts +++ b/multichain-testing/test/auto-stake-it.test.ts @@ -11,6 +11,7 @@ import { import { makeQueryClient } from '../tools/query.js'; import type { SetupContextWithWallets } from './support.js'; import { chainConfig, commonSetup } from './support.js'; +import { AUTO_STAKE_IT_DELEGATIONS_TIMEOUT } from './config.js'; const test = anyTest as TestFn; @@ -179,7 +180,8 @@ const autoStakeItScenario = test.macro({ const { delegation_responses } = await retryUntilCondition( () => remoteQueryClient.queryDelegations(icaAddress), ({ delegation_responses }) => !!delegation_responses.length, - `delegations visible on ${chainName}`, + `auto-stake-it delegations visible on ${chainName}`, + AUTO_STAKE_IT_DELEGATIONS_TIMEOUT, ); t.log('delegation balance', delegation_responses[0]?.balance); t.like( diff --git a/multichain-testing/test/config.ts b/multichain-testing/test/config.ts new file mode 100644 index 000000000000..a8619398f73a --- /dev/null +++ b/multichain-testing/test/config.ts @@ -0,0 +1,32 @@ +import type { RetryOptions } from '../tools/sleep.js'; + +/** + * Wait 90 seconds to ensure staking rewards are available. + * + * While we expect staking rewards to be available after a + * single block (~5-12 seconds for most chains), this provides additional + * padding after observed failures in CI + * (https://github.com/Agoric/agoric-sdk/issues/9934). + * + * A more robust approach might consider Distribution params and the + * {@link FAUCET_POUR} constant to determine how many blocks it should take for + * rewards to be available. + */ +export const STAKING_REWARDS_TIMEOUT: RetryOptions = { + retryIntervalMs: 5000, + maxRetries: 18, +}; + +/** + * Wait 2 minutes to ensure: + * - IBC Transfer from LocalAccount -> ICA Account Completes + * - Delegation from ICA Account (initiated from SwingSet) Completes + * - Delegations are visible via LCD (API Endpoint) + * + * Most of the time this finishes in <7 seconds, but other times it + * appears to take much longer. + */ +export const AUTO_STAKE_IT_DELEGATIONS_TIMEOUT: RetryOptions = { + retryIntervalMs: 5000, + maxRetries: 24, +}; diff --git a/multichain-testing/test/stake-ica.test.ts b/multichain-testing/test/stake-ica.test.ts index 01cbeabcc7da..d3007496450f 100644 --- a/multichain-testing/test/stake-ica.test.ts +++ b/multichain-testing/test/stake-ica.test.ts @@ -7,29 +7,13 @@ import { } from './support.js'; import { makeDoOffer } from '../tools/e2e-tools.js'; import { makeQueryClient } from '../tools/query.js'; -import { sleep, type RetryOptions } from '../tools/sleep.js'; +import { sleep } from '../tools/sleep.js'; +import { STAKING_REWARDS_TIMEOUT } from './config.js'; const test = anyTest as TestFn; const accounts = ['user1', 'user2']; -/** - * Wait 90 seconds to ensure staking rewards are available. - * - * While we expect staking rewards to be available after a - * single block (~5-12 seconds for most chains), this provide additional - * padding after observed failures in CI - * (https://github.com/Agoric/agoric-sdk/issues/9934). - * - * A more robust approach might consider Distribution params and the - * {@link FAUCET_POUR} constant to determine how many blocks it should take for - * rewards to be available. - */ -export const STAKING_REWARDS_TIMEOUT: RetryOptions = { - retryIntervalMs: 5000, - maxRetries: 18, -}; - test.before(async t => { const { deleteTestKeys, setupTestKeys, ...rest } = await commonSetup(t); // XXX not necessary for CI, but helpful for unexpected failures in diff --git a/multichain-testing/tools/ibc-transfer.ts b/multichain-testing/tools/ibc-transfer.ts index 173f8c9aaa61..7d4fdae8624d 100644 --- a/multichain-testing/tools/ibc-transfer.ts +++ b/multichain-testing/tools/ibc-transfer.ts @@ -37,12 +37,14 @@ type SimpleChainAddress = { chainName: string; }; -export const DEFAULT_TIMEOUT_NS = 1893456000000000000n; +// 2030-01-01T00:00:00Z +export const DEFAULT_TIMEOUT_NS = + 1893456000n * NANOSECONDS_PER_MILLISECOND * MILLISECONDS_PER_SECOND; /** * @param {number} [ms] current time in ms (e.g. Date.now()) * @param {bigint} [minutes=5n] number of minutes in the future - * @returns {bigint} nanosecond timestamp 5 mins in the future */ + * @returns {bigint} nanosecond timestamp absolute since Unix epoch */ export const getTimeout = (ms: number = 0, minutes = 5n) => { // UNTIL #9200. timestamps are getting clobbered somewhere along the way // and we are observing failed transfers with timeouts years in the past.