djust keys/entries retrieval batch sizes (#3638)

This commit is contained in:
Jaco
2021-06-11 18:09:47 +02:00
committed by GitHub
parent 94aa79d1e5
commit f46916b215
3 changed files with 20 additions and 3 deletions
+2
View File
@@ -5,7 +5,9 @@
Changes:
- Do strict length checking on `[u8; <length>]` type inputs
- Adjust keys/entries retrieval batch sizes
- Add upgrade block for Kusama 9040
- Use `BN` imports from `@polkadot/util`
## 4.13.1 Jun 6, 2021
+2 -2
View File
@@ -37,8 +37,8 @@ interface MetaDecoration {
}
// the max amount of keys/values that we will retrieve at once
const PAGE_SIZE_K = 768; // limited since the trie lookups are heavy
const PAGE_SIZE_V = 256; // limited since the data may be very large
const PAGE_SIZE_K = 1000; // limit aligned with the 1k on the node (trie lookups are heavy)
const PAGE_SIZE_V = 250; // limited since the data may be very large (e.g. misfiring elections)
const l = logger('api/init');
+16 -1
View File
@@ -1,7 +1,9 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BN } from '@polkadot/util';
import BNOrig from 'bn.js';
import { BN, BN_TWO } from '@polkadot/util';
import { TypeRegistry } from '../create';
import { UInt } from '.';
@@ -9,6 +11,19 @@ import { UInt } from '.';
describe('UInt', (): void => {
const registry = new TypeRegistry();
it('still has the BN interfaces', (): void => {
expect([
new UInt(registry, 32).mul(BN_TWO).toNumber(),
new UInt(registry, 64).divn(2).toNumber()
]).toEqual([64, 32]);
});
it('is a BN instance', (): void => {
expect(
BNOrig.isBN(new UInt(registry, 16))
).toBe(true);
});
it('fails on a number that is too large for the bits specified', (): void => {
expect(
(): UInt => new UInt(registry, '12345678901234567890123456789012345678901234567890', 32)