#453 (and its PR #471) have left the preimages pallet with good end-to-end test coverage.
Two outstanding points remain:
- the test to
ensureUpdated needs a fix regarding the check of transaction fee waiving
|
/** |
|
* Test the "ensure_updated" preimage functionality. |
|
* |
|
* 1. Simulate a number of pre-deprecation preimages with bogus hashes. |
|
* 2. Alice registers a number of post-deprecation (valid) preimages. |
|
* 3. Ensure that all valid preimages have been registered. |
|
* 4. Alice calls "ensure_updated" for all hashes (valid and bogus). |
|
* 5. Verify that Alice's reserved funds remain the same after the update. |
|
* 6. If the ratio of new to total preimages is less than 90%, check that fees have been paid. |
|
*/ |
|
async function preimageEnsureUpdatedTest< |
|
TCustom extends Record<string, unknown> | undefined, |
|
TInitStorages extends Record<string, Record<string, any>> | undefined, |
|
>(chain: Chain<TCustom, TInitStorages>, oldPreimagesCount: number, newPreimagesCount: number) { |
|
const [client] = await setupNetworks(chain) |
- the test to excessively large preimages is currently not submitting the preimage it generates
|
/** |
|
* Test the registering (noting) and unregistering (unnoting) of an oversized preimage. |
|
* |
|
* 1. Alice registers an oversized preimage. |
|
* 2. The registration fails and no preimage is stored. |
|
*/ |
|
async function preimageOversizedTest< |
|
TCustom extends Record<string, unknown> | undefined, |
|
TInitStorages extends Record<string, Record<string, any>> | undefined, |
|
>(chain: Chain<TCustom, TInitStorages>) { |
|
const [client] = await setupNetworks(chain) |
|
|
|
const alice = testAccounts.alice |
|
setupBalances(client, [{ address: alice.address, amount: 1000e10 }]) |
|
|
|
// 1. Alice registers an oversized preimage (more than 4 MB). |
|
const maxPreimageSize = 4 * 1024 * 1024 |
|
const oversizedBytes = new Uint8Array(maxPreimageSize + 1).fill(1) |
This PR is to address these minor issues.
#453 (and its PR #471) have left the preimages pallet with good end-to-end test coverage.
Two outstanding points remain:
ensureUpdatedneeds a fix regarding the check of transaction fee waivingpolkadot-ecosystem-tests/packages/shared/src/preimage.ts
Lines 730 to 744 in 20f9bf5
polkadot-ecosystem-tests/packages/shared/src/preimage.ts
Lines 695 to 712 in 20f9bf5
This PR is to address these minor issues.