-
Notifications
You must be signed in to change notification settings - Fork 19
fix proxy tests #398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix proxy tests #398
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| ACALA_BLOCK_NUMBER=9401887 | ||
| ASSETHUBKUSAMA_BLOCK_NUMBER=10774348 | ||
| ASSETHUBPOLKADOT_BLOCK_NUMBER=9644672 | ||
| ASTAR_BLOCK_NUMBER=10114064 | ||
| BASILISK_BLOCK_NUMBER=11043654 | ||
| BRIDGEHUBKUSAMA_BLOCK_NUMBER=6501942 | ||
| BRIDGEHUBPOLKADOT_BLOCK_NUMBER=5959409 | ||
| COLLECTIVESPOLKADOT_BLOCK_NUMBER=7139725 | ||
| CORETIMEKUSAMA_BLOCK_NUMBER=3467376 | ||
| CORETIMEPOLKADOT_BLOCK_NUMBER=2568807 | ||
| ENCOINTERKUSAMA_BLOCK_NUMBER=10654529 | ||
| HYDRATION_BLOCK_NUMBER=9124908 | ||
| INTEGRITEEKUSAMA_BLOCK_NUMBER=8464211 | ||
| INTEGRITEEPOLKADOT_BLOCK_NUMBER=5260796 | ||
| KARURA_BLOCK_NUMBER=9934578 | ||
| KUSAMA_BLOCK_NUMBER=30002649 | ||
| MOONBEAM_BLOCK_NUMBER=12503052 | ||
| MOONRIVER_BLOCK_NUMBER=13056270 | ||
| PEOPLEKUSAMA_BLOCK_NUMBER=5654809 | ||
| PEOPLEPOLKADOT_BLOCK_NUMBER=2900256 | ||
| POLKADOT_BLOCK_NUMBER=27670237 | ||
| SHIDEN_BLOCK_NUMBER=11753072 | ||
| ACALA_BLOCK_NUMBER=9410095 | ||
| ASSETHUBKUSAMA_BLOCK_NUMBER=10789479 | ||
| ASSETHUBPOLKADOT_BLOCK_NUMBER=9652347 | ||
| ASTAR_BLOCK_NUMBER=10130674 | ||
| BASILISK_BLOCK_NUMBER=11059895 | ||
| BRIDGEHUBKUSAMA_BLOCK_NUMBER=6509952 | ||
| BRIDGEHUBPOLKADOT_BLOCK_NUMBER=5966975 | ||
| COLLECTIVESPOLKADOT_BLOCK_NUMBER=7147433 | ||
| CORETIMEKUSAMA_BLOCK_NUMBER=3474977 | ||
| CORETIMEPOLKADOT_BLOCK_NUMBER=2576813 | ||
| ENCOINTERKUSAMA_BLOCK_NUMBER=10671030 | ||
| HYDRATION_BLOCK_NUMBER=9141741 | ||
| INTEGRITEEKUSAMA_BLOCK_NUMBER=8472161 | ||
| INTEGRITEEPOLKADOT_BLOCK_NUMBER=5268348 | ||
| KARURA_BLOCK_NUMBER=9942556 | ||
| KUSAMA_BLOCK_NUMBER=30019411 | ||
| MOONBEAM_BLOCK_NUMBER=12519049 | ||
| MOONRIVER_BLOCK_NUMBER=13071067 | ||
| PEOPLEKUSAMA_BLOCK_NUMBER=5670456 | ||
| PEOPLEPOLKADOT_BLOCK_NUMBER=2907791 | ||
| POLKADOT_BLOCK_NUMBER=27687182 | ||
| SHIDEN_BLOCK_NUMBER=11767972 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| import { kusama } from '@e2e-test/networks/chains' | ||
| import { fullProxyE2ETests, KusamaProxyTypes, registerTestTree } from '@e2e-test/shared' | ||
|
|
||
| registerTestTree(fullProxyE2ETests(kusama, { testSuiteName: 'Kusama Proxy', addressEncoding: 2 }, KusamaProxyTypes)) | ||
| registerTestTree( | ||
| fullProxyE2ETests(kusama, { testSuiteName: 'Kusama Proxy', addressEncoding: 2 }, KusamaProxyTypes, false), | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ import { assert, expect } from 'vitest' | |
|
|
||
| import BN from 'bn.js' | ||
| import { match } from 'ts-pattern' | ||
| import { check, checkEvents } from './helpers/index.js' | ||
| import { check, checkEvents, getBlockNumber } from './helpers/index.js' | ||
|
|
||
| /// ------- | ||
| /// Helpers | ||
|
|
@@ -1558,7 +1558,12 @@ export async function addRemoveProxyTest< | |
| export async function createKillPureProxyTest< | ||
| TCustom extends Record<string, unknown> | undefined, | ||
| TInitStorages extends Record<string, Record<string, any>> | undefined, | ||
| >(chain: Chain<TCustom, TInitStorages>, addressEncoding: number, proxyTypes: Record<string, number>) { | ||
| >( | ||
| chain: Chain<TCustom, TInitStorages>, | ||
| addressEncoding: number, | ||
| proxyTypes: Record<string, number>, | ||
| useRelayBlockNumber: boolean, | ||
| ) { | ||
| const [client] = await setupNetworks(chain) | ||
|
|
||
| const alice = defaultAccountsSr25519.alice | ||
|
|
@@ -1639,7 +1644,8 @@ export async function createKillPureProxyTest< | |
| // To call `proxy.killPure`, the block number of `proxy.createPure` is required. | ||
| // The current block number will have been the block in which the batch transaction containing all of the | ||
| // `createPure` extrinsics were executed. | ||
| const currBlockNumber = (await client.api.rpc.chain.getHeader()).number.toNumber() | ||
|
|
||
| const currBlockNumber = await getBlockNumber(client, useRelayBlockNumber) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In |
||
|
|
||
| // For every pure proxy type, create a `proxy.proxy` call, containing a `proxy.killPure` extrinsic. | ||
| // Note that in the case of pure proxies, the account which called `proxy.createPure` becomes the delegate, | ||
|
|
@@ -1656,9 +1662,11 @@ export async function createKillPureProxyTest< | |
|
|
||
| // `proxy.killPure` does not emit any events. | ||
| // #7995 will fix this, eliciting a failed test run sometime in the future. | ||
| await checkEvents(proxyEvents, 'proxy').toMatchSnapshot( | ||
| `events when killing pure proxy of type ${proxyTypeIx} for Alice`, | ||
| ) | ||
| await checkEvents(proxyEvents, 'proxy') | ||
| .redact({ | ||
| removeKeys: /pure/, | ||
| }) | ||
| .toMatchSnapshot(`events when killing pure proxy of type ${proxyTypeIx} for Alice`) | ||
| } | ||
|
|
||
| // Check that the pure proxies were killed | ||
|
|
@@ -1757,7 +1765,7 @@ export async function proxyCallTest< | |
| export async function proxyAnnouncementLifecycleTest< | ||
| TCustom extends Record<string, unknown> | undefined, | ||
| TInitStorages extends Record<string, Record<string, any>> | undefined, | ||
| >(chain: Chain<TCustom, TInitStorages>, addressEncoding: number) { | ||
| >(chain: Chain<TCustom, TInitStorages>, addressEncoding: number, useRelayBlockNumber: boolean) { | ||
| const [client] = await setupNetworks(chain) | ||
|
|
||
| const alice = defaultAccountsSr25519.alice | ||
|
|
@@ -1790,7 +1798,7 @@ export async function proxyAnnouncementLifecycleTest< | |
|
|
||
| await checkEvents(announcementEvents, 'proxy').toMatchSnapshot('events when Bob announces a proxy call') | ||
|
|
||
| const currBlockNumber = (await client.api.rpc.chain.getHeader()).number.toNumber() | ||
| const currBlockNumber = await getBlockNumber(client, useRelayBlockNumber) | ||
| const announcementObject = { | ||
| real: encodeAddress(alice.address, addressEncoding), | ||
| callHash: transferCall.method.hash.toHex(), | ||
|
|
@@ -1837,8 +1845,10 @@ export async function proxyAnnouncementLifecycleTest< | |
|
|
||
| announcements = await client.api.query.proxy.announcements(bob.address) | ||
| expect(announcements[0].length).toBe(1) | ||
| announcementObject.height = currBlockNumber + 2 | ||
| await check(announcements[0][0]).toMatchObject(announcementObject) | ||
| await check(announcements[0][0]).toMatchObject({ | ||
| ...announcementObject, | ||
| height: currBlockNumber + 4, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not exactly right |
||
| }) | ||
|
Comment on lines
+1848
to
+1851
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In |
||
| expect(announcements[1].eq(announcementDepositTotal)).toBe(true) | ||
|
|
||
| // Bob cancels the intent themselves | ||
|
|
@@ -1886,6 +1896,7 @@ export function baseProxyE2ETests< | |
| chain: Chain<TCustom, TInitStorages>, | ||
| testConfig: { testSuiteName: string; addressEncoding: number }, | ||
| proxyTypes: Record<string, number>, | ||
| useRelayBlockNumber: boolean, | ||
| ): RootTestTree { | ||
| return { | ||
| kind: 'describe', | ||
|
|
@@ -1899,7 +1910,8 @@ export function baseProxyE2ETests< | |
| { | ||
| kind: 'test', | ||
| label: 'create and kill pure proxies', | ||
| testFn: async () => await createKillPureProxyTest(chain, testConfig.addressEncoding, proxyTypes), | ||
| testFn: async () => | ||
| await createKillPureProxyTest(chain, testConfig.addressEncoding, proxyTypes, useRelayBlockNumber), | ||
| }, | ||
| { | ||
| kind: 'test', | ||
|
|
@@ -1909,7 +1921,8 @@ export function baseProxyE2ETests< | |
| { | ||
| kind: 'test', | ||
| label: 'proxy announcement lifecycle test', | ||
| testFn: async () => await proxyAnnouncementLifecycleTest(chain, testConfig.addressEncoding), | ||
| testFn: async () => | ||
| await proxyAnnouncementLifecycleTest(chain, testConfig.addressEncoding, useRelayBlockNumber), | ||
| }, | ||
| ], | ||
| } | ||
|
|
@@ -1922,11 +1935,12 @@ export function fullProxyE2ETests< | |
| chain: Chain<TCustom, TInitStorages>, | ||
| testConfig: { testSuiteName: string; addressEncoding: number }, | ||
| proxyTypes: Record<string, number>, | ||
| useRelayBlockNumber: boolean, | ||
| ): RootTestTree { | ||
| const allowedFilteringTests = proxyCallFilteringTestTree(chain, proxyTypes, ProxyCallFilteringTestType.Permitted) | ||
| const forbiddenFilteringTests = proxyCallFilteringTestTree(chain, proxyTypes, ProxyCallFilteringTestType.Forbidden) | ||
|
|
||
| const baseTestTree = baseProxyE2ETests(chain, testConfig, proxyTypes) | ||
| const baseTestTree = baseProxyE2ETests(chain, testConfig, proxyTypes, useRelayBlockNumber) | ||
| baseTestTree.children.push(allowedFilteringTests, forbiddenFilteringTests) | ||
|
|
||
| return baseTestTree | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also had to do this in #384 .
polkadot-ecosystem-tests/packages/shared/src/helpers/index.ts
Lines 364 to 378 in fd2ca4e