diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 72ff6762..7a06b8d7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,8 +2,6 @@ ## [Unreleased] -## [1.2.1] - 2024-04-25 - ### Changed * fix: retry logic now includes delays with exponential backoff. Retries should no longer happen too quickly for the replica to catch up. @@ -11,6 +9,11 @@ ### Added * new `HttpAgent` option: `backoffStrategy` - allows you to set a custom delay strategy for retries. The default is a newly exported `exponentialBackoff`, but you can pass your own function to customize the delay between retries. + +## [1.2.1] - 2024-04-25 + +### Added + - feat: make `IdbStorage` `get/set` methods generic - chore: add context to errors thrown when failing to decode CBOR values. - chore: replaces globle npm install with setup-node for size-limit action diff --git a/e2e/node/basic/mainnet.test.ts b/e2e/node/basic/mainnet.test.ts index 3368c003..e96a040c 100644 --- a/e2e/node/basic/mainnet.test.ts +++ b/e2e/node/basic/mainnet.test.ts @@ -31,7 +31,6 @@ const createWhoamiActor = async (identity: Identity) => { }; describe('certified query', () => { - vi.useRealTimers(); it('should verify a query certificate', async () => { const actor = await createWhoamiActor(new AnonymousIdentity()); const result = await actor.whoami(); diff --git a/e2e/node/basic/watermark.test.ts b/e2e/node/basic/watermark.test.ts index 83e2c6f6..797606db 100644 --- a/e2e/node/basic/watermark.test.ts +++ b/e2e/node/basic/watermark.test.ts @@ -82,7 +82,6 @@ test('replay queries only', async () => { }, 10_000); test('replay attack', async () => { - vi.useRealTimers(); const fetchProxy = new FetchProxy(); global.fetch; @@ -92,7 +91,6 @@ test('replay attack', async () => { backoffStrategy: () => ({ next: () => 0, }), - retryTimes: 3, }); const agent = Actor.agentOf(actor) as HttpAgent; diff --git a/packages/agent/src/actor.test.ts b/packages/agent/src/actor.test.ts index 7d7fcc34..2c467e94 100644 --- a/packages/agent/src/actor.test.ts +++ b/packages/agent/src/actor.test.ts @@ -6,7 +6,7 @@ import { CallRequest, SubmitRequestType, UnSigned } from './agent/http/types'; import * as cbor from './cbor'; import { requestIdOf } from './request_id'; import * as pollingImport from './polling'; -import { Actor, ActorConfig } from './actor'; +import { ActorConfig } from './actor'; const importActor = async (mockUpdatePolling?: () => void) => { jest.dontMock('./polling'); @@ -24,8 +24,6 @@ afterEach(() => { global.Date.now = originalDateNowFn; }); - -jest.setTimeout(30000); describe('makeActor', () => { // TODO: update tests to be compatible with changes to Certificate it.skip('should encode calls', async () => { @@ -135,7 +133,7 @@ describe('makeActor', () => { const expectedCallRequestId = await requestIdOf(expectedCallRequest.content); - const httpAgent = new HttpAgent({ fetch: mockFetch, retryTimes: 0 }); + const httpAgent = new HttpAgent({ fetch: mockFetch }); const actor = Actor.createActor(actorInterface, { canisterId, agent: httpAgent }); const reply = await actor.greet(argValue); @@ -230,7 +228,6 @@ describe('makeActor', () => { }); }); it('should enrich actor interface with httpDetails', async () => { - jest.useRealTimers(); const canisterDecodedReturnValue = 'Hello, World!'; const expectedReplyArg = IDL.encode([IDL.Text], [canisterDecodedReturnValue]); const { Actor } = await importActor(() => @@ -277,12 +274,6 @@ describe('makeActor', () => { fetch: mockFetch, host: 'http://127.0.0.1', verifyQuerySignatures: false, - backoffStrategy: () => { - return { - next: () => 0, - }; - }, - retryTimes: 0, }); const canisterId = Principal.fromText('2chl6-4hpzw-vqaaa-aaaaa-c'); const actor = Actor.createActor(actorInterface, { canisterId, agent: httpAgent }); @@ -322,7 +313,7 @@ describe('makeActor', () => { greet: IDL.Func([IDL.Text], [IDL.Text]), }); }; - const httpAgent = new HttpAgent({ fetch: mockFetch, host: 'http://127.0.0.1', retryTimes: 0 }); + const httpAgent = new HttpAgent({ fetch: mockFetch, host: 'http://127.0.0.1' }); const canisterId = Principal.fromText('2chl6-4hpzw-vqaaa-aaaaa-c'); const actor = Actor.createActor(actorInterface, { canisterId, agent: httpAgent }); @@ -337,7 +328,7 @@ describe('makeActor', () => { } }); it('should throw a helpful error if the canisterId is not set', async () => { - const httpAgent = new HttpAgent({ host: 'http://127.0.0.1', retryTimes: 0 }); + const httpAgent = new HttpAgent({ host: 'http://127.0.0.1' }); const actorInterface = () => { return IDL.Service({ greet: IDL.Func([IDL.Text], [IDL.Text]), diff --git a/packages/agent/src/agent/http/http.test.ts b/packages/agent/src/agent/http/http.test.ts index 3d958262..2b8e4d48 100644 --- a/packages/agent/src/agent/http/http.test.ts +++ b/packages/agent/src/agent/http/http.test.ts @@ -789,7 +789,6 @@ test('retry requests that fail due to a network failure', async () => { const agent = new HttpAgent({ host: HTTP_AGENT_HOST, fetch: mockFetch, - retryTimes: 3, }); try {