@acala-network/chopsticks-core 0.9.8 → 0.9.9-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/blockchain/inherent/parachain/nimbus-author-inherent.d.ts +1 -1
- package/dist/cjs/blockchain/inherent/parachain/nimbus-author-inherent.js +17 -0
- package/dist/cjs/blockchain/inherent/parachain/validation-data.js +42 -19
- package/dist/cjs/setup.d.ts +16 -0
- package/dist/cjs/setup.js +22 -11
- package/dist/cjs/utils/index.js +1 -0
- package/dist/esm/blockchain/inherent/parachain/nimbus-author-inherent.d.ts +1 -1
- package/dist/esm/blockchain/inherent/parachain/nimbus-author-inherent.js +17 -0
- package/dist/esm/blockchain/inherent/parachain/validation-data.js +42 -19
- package/dist/esm/setup.d.ts +16 -0
- package/dist/esm/setup.js +19 -11
- package/dist/esm/utils/index.js +1 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HexString } from '@polkadot/util/types';
|
|
2
1
|
import { Block } from '../../block.js';
|
|
3
2
|
import { BuildBlockParams } from '../../txpool.js';
|
|
3
|
+
import { HexString } from '@polkadot/util/types';
|
|
4
4
|
import { InherentProvider } from '../index.js';
|
|
5
5
|
export declare class SetNimbusAuthorInherent implements InherentProvider {
|
|
6
6
|
createInherents(newBlock: Block, _params: BuildBlockParams): Promise<HexString[]>;
|
|
@@ -34,6 +34,23 @@ class SetNimbusAuthorInherent {
|
|
|
34
34
|
alice
|
|
35
35
|
]).toHex());
|
|
36
36
|
}
|
|
37
|
+
if (meta.query.authorityAssignment && meta.query.session) {
|
|
38
|
+
const session = await newBlock.chain.head.read('u32', meta.query.session.currentIndex);
|
|
39
|
+
if (session) {
|
|
40
|
+
// We need to set both the assignemnt for current and next sessions
|
|
41
|
+
layer.set((0, _index.compactHex)(meta.query.authorityAssignment.collatorContainerChain(session)), meta.registry.createType(`DpCollatorAssignmentAssignedCollatorsPublic`, {
|
|
42
|
+
orchestratorChain: [
|
|
43
|
+
alice
|
|
44
|
+
]
|
|
45
|
+
}).toHex());
|
|
46
|
+
layer.set((0, _index.compactHex)(meta.query.authorityAssignment.collatorContainerChain(session.toBigInt() + 1n)), meta.registry.createType(`DpCollatorAssignmentAssignedCollatorsPublic`, {
|
|
47
|
+
orchestratorChain: [
|
|
48
|
+
alice
|
|
49
|
+
]
|
|
50
|
+
}).toHex());
|
|
51
|
+
}
|
|
52
|
+
layer.set((0, _index.compactHex)(meta.query.authorNoting.didSetContainerAuthorData()), meta.registry.createType('bool', true).toHex());
|
|
53
|
+
}
|
|
37
54
|
return [
|
|
38
55
|
new _types.GenericExtrinsic(meta.registry, meta.tx.authorInherent.kickOffAuthorshipValidation()).toHex()
|
|
39
56
|
];
|
|
@@ -104,13 +104,28 @@ class SetValidationData {
|
|
|
104
104
|
]);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
// inject missing hrmpIngressChannel and hrmpEgressChannel
|
|
108
|
+
const hrmpIngressChannels = meta.registry.createType('Vec<u32>', (0, _util.hexToU8a)(decoded[hrmpIngressChannelIndexKey]));
|
|
109
|
+
const hrmpEgressChannels = meta.registry.createType('Vec<u32>', (0, _util.hexToU8a)(decoded[hrmpEgressChannelIndexKey]));
|
|
110
|
+
for(const key in params.horizontalMessages){
|
|
111
|
+
// order is important
|
|
112
|
+
const sender = meta.registry.createType('u32', key);
|
|
113
|
+
if (!hrmpIngressChannels.some((x)=>x.eq(sender))) {
|
|
114
|
+
const idx = _lodash.default.sortedIndexBy(hrmpIngressChannels, sender, (x)=>x.toNumber());
|
|
115
|
+
hrmpIngressChannels.splice(idx, 0, sender);
|
|
116
|
+
}
|
|
117
|
+
if (!hrmpEgressChannels.some((x)=>x.eq(sender))) {
|
|
118
|
+
const idx = _lodash.default.sortedIndexBy(hrmpEgressChannels, sender, (x)=>x.toNumber());
|
|
119
|
+
hrmpEgressChannels.splice(idx, 0, sender);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
107
122
|
newEntries.push([
|
|
108
123
|
hrmpIngressChannelIndexKey,
|
|
109
|
-
|
|
124
|
+
hrmpIngressChannels.toHex()
|
|
110
125
|
]);
|
|
111
126
|
newEntries.push([
|
|
112
127
|
hrmpEgressChannelIndexKey,
|
|
113
|
-
|
|
128
|
+
hrmpEgressChannels.toHex()
|
|
114
129
|
]);
|
|
115
130
|
// inject paraHead
|
|
116
131
|
const headData = meta.registry.createType('HeadData', (await parent.header).toHex());
|
|
@@ -132,25 +147,26 @@ class SetValidationData {
|
|
|
132
147
|
dmqMqcHeadKey,
|
|
133
148
|
dmqMqcHeadHash
|
|
134
149
|
]);
|
|
135
|
-
const hrmpIngressChannels = meta.registry.createType('Vec<ParaId>', decoded[hrmpIngressChannelIndexKey]).toJSON();
|
|
136
|
-
const hrmpEgressChannels = meta.registry.createType('Vec<ParaId>', decoded[hrmpEgressChannelIndexKey]).toJSON();
|
|
137
|
-
const hrmpMessages = {
|
|
138
|
-
// reset values, we just need the keys
|
|
139
|
-
..._lodash.default.mapValues(extrinsic.horizontalMessages, ()=>[]),
|
|
140
|
-
...params.horizontalMessages
|
|
141
|
-
};
|
|
142
150
|
// inject horizontal messages
|
|
143
|
-
for (const
|
|
144
|
-
|
|
145
|
-
const
|
|
151
|
+
for (const sender of hrmpIngressChannels){
|
|
152
|
+
// search by number and string just in case key is not a number
|
|
153
|
+
const messages = params.horizontalMessages[sender.toNumber()] || params.horizontalMessages[sender.toString()] || [];
|
|
146
154
|
const channelId = meta.registry.createType('HrmpChannelId', {
|
|
147
155
|
sender,
|
|
148
156
|
receiver: paraId.toNumber()
|
|
149
157
|
});
|
|
150
158
|
const hrmpChannelKey = (0, _proof.hrmpChannels)(channelId);
|
|
151
159
|
const abridgedHrmpRaw = decoded[hrmpChannelKey];
|
|
152
|
-
|
|
153
|
-
|
|
160
|
+
const abridgedHrmp = abridgedHrmpRaw ? meta.registry.createType('AbridgedHrmpChannel', (0, _util.hexToU8a)(abridgedHrmpRaw)).toJSON() : {
|
|
161
|
+
maxCapacity: 1000,
|
|
162
|
+
maxTotalSize: 102400,
|
|
163
|
+
maxMessageSize: 102400,
|
|
164
|
+
msgCount: 0,
|
|
165
|
+
totalSize: 0,
|
|
166
|
+
mqcHead: 0x0000000000000000000000000000000000000000000000000000000000000000,
|
|
167
|
+
senderDeposit: 5000000000000,
|
|
168
|
+
recipientDeposit: 5000000000000
|
|
169
|
+
};
|
|
154
170
|
const paraMessages = [];
|
|
155
171
|
for (const { data, sentAt: _unused } of messages){
|
|
156
172
|
// fake relaychain sentAt to make validationData think this msg was sent at previous block
|
|
@@ -165,24 +181,31 @@ class SetValidationData {
|
|
|
165
181
|
sentAt
|
|
166
182
|
});
|
|
167
183
|
}
|
|
168
|
-
horizontalMessages[sender] = paraMessages;
|
|
184
|
+
horizontalMessages[sender.toNumber()] = paraMessages;
|
|
169
185
|
newEntries.push([
|
|
170
186
|
hrmpChannelKey,
|
|
171
187
|
meta.registry.createType('AbridgedHrmpChannel', abridgedHrmp).toHex()
|
|
172
188
|
]);
|
|
173
189
|
}
|
|
174
190
|
// inject hrmpEgressChannels proof
|
|
175
|
-
for (const
|
|
176
|
-
// const messages = hrmpMessages[id]
|
|
177
|
-
const receiver = Number(id);
|
|
191
|
+
for (const receiver of hrmpEgressChannels){
|
|
178
192
|
const channelId = meta.registry.createType('HrmpChannelId', {
|
|
179
193
|
sender: paraId.toNumber(),
|
|
180
194
|
receiver
|
|
181
195
|
});
|
|
182
196
|
const hrmpChannelKey = (0, _proof.hrmpChannels)(channelId);
|
|
197
|
+
const abridgedHrmpRaw = decoded[hrmpChannelKey];
|
|
198
|
+
const abridgedHrmp = abridgedHrmpRaw ? meta.registry.createType('AbridgedHrmpChannel', (0, _util.hexToU8a)(abridgedHrmpRaw)).toJSON() : {
|
|
199
|
+
maxCapacity: 1000,
|
|
200
|
+
maxTotalSize: 102400,
|
|
201
|
+
maxMessageSize: 102400,
|
|
202
|
+
msgCount: 0,
|
|
203
|
+
totalSize: 0,
|
|
204
|
+
mqcHead: 0x0000000000000000000000000000000000000000000000000000000000000000
|
|
205
|
+
};
|
|
183
206
|
newEntries.push([
|
|
184
207
|
hrmpChannelKey,
|
|
185
|
-
|
|
208
|
+
meta.registry.createType('AbridgedHrmpChannel', abridgedHrmp).toHex()
|
|
186
209
|
]);
|
|
187
210
|
}
|
|
188
211
|
const upgradeKey = (0, _proof.upgradeGoAheadSignal)(paraId);
|
package/dist/cjs/setup.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@polkadot/types-codec';
|
|
2
2
|
import { RegisteredTypes } from '@polkadot/types/types';
|
|
3
|
+
import { Api } from './api.js';
|
|
3
4
|
import { Blockchain } from './blockchain/index.js';
|
|
4
5
|
import { BuildBlockMode } from './blockchain/txpool.js';
|
|
5
6
|
import { Database } from './database.js';
|
|
@@ -18,4 +19,19 @@ export type SetupOptions = {
|
|
|
18
19
|
maxMemoryBlockCount?: number;
|
|
19
20
|
};
|
|
20
21
|
export declare const genesisSetup: (chain: Blockchain, genesis: GenesisProvider) => Promise<void>;
|
|
22
|
+
export declare const processOptions: (options: SetupOptions) => Promise<{
|
|
23
|
+
blockHash: string;
|
|
24
|
+
api: Api;
|
|
25
|
+
endpoint?: string | string[] | undefined;
|
|
26
|
+
block?: string | number | null | undefined;
|
|
27
|
+
genesis?: GenesisProvider | undefined;
|
|
28
|
+
buildBlockMode?: BuildBlockMode | undefined;
|
|
29
|
+
db?: Database | undefined;
|
|
30
|
+
mockSignatureHost?: boolean | undefined;
|
|
31
|
+
allowUnresolvedImports?: boolean | undefined;
|
|
32
|
+
runtimeLogLevel?: number | undefined;
|
|
33
|
+
registeredTypes?: RegisteredTypes | undefined;
|
|
34
|
+
offchainWorker?: boolean | undefined;
|
|
35
|
+
maxMemoryBlockCount?: number | undefined;
|
|
36
|
+
}>;
|
|
21
37
|
export declare const setup: (options: SetupOptions) => Promise<Blockchain>;
|
package/dist/cjs/setup.js
CHANGED
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
|
12
12
|
genesisSetup: function() {
|
|
13
13
|
return genesisSetup;
|
|
14
14
|
},
|
|
15
|
+
processOptions: function() {
|
|
16
|
+
return processOptions;
|
|
17
|
+
},
|
|
15
18
|
setup: function() {
|
|
16
19
|
return setup;
|
|
17
20
|
}
|
|
@@ -63,7 +66,7 @@ const genesisSetup = async (chain, genesis)=>{
|
|
|
63
66
|
}
|
|
64
67
|
await chain.newBlock();
|
|
65
68
|
};
|
|
66
|
-
const
|
|
69
|
+
const processOptions = async (options)=>{
|
|
67
70
|
_logger.defaultLogger.debug(options, 'Setup options');
|
|
68
71
|
let provider;
|
|
69
72
|
if (options.genesis) {
|
|
@@ -100,28 +103,36 @@ const setup = async (options)=>{
|
|
|
100
103
|
...options,
|
|
101
104
|
blockHash
|
|
102
105
|
}, 'Args');
|
|
106
|
+
return {
|
|
107
|
+
...options,
|
|
108
|
+
blockHash,
|
|
109
|
+
api
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
const setup = async (options)=>{
|
|
113
|
+
const { api, blockHash, ...opts } = await processOptions(options);
|
|
103
114
|
const header = await api.getHeader(blockHash);
|
|
104
115
|
if (!header) {
|
|
105
116
|
throw new Error(`Cannot find header for ${blockHash}`);
|
|
106
117
|
}
|
|
107
118
|
const chain = new _index.Blockchain({
|
|
108
119
|
api,
|
|
109
|
-
buildBlockMode:
|
|
120
|
+
buildBlockMode: opts.buildBlockMode,
|
|
110
121
|
inherentProviders: _index2.inherentProviders,
|
|
111
|
-
db:
|
|
122
|
+
db: opts.db,
|
|
112
123
|
header: {
|
|
113
124
|
hash: blockHash,
|
|
114
125
|
number: Number(header.number)
|
|
115
126
|
},
|
|
116
|
-
mockSignatureHost:
|
|
117
|
-
allowUnresolvedImports:
|
|
118
|
-
runtimeLogLevel:
|
|
119
|
-
registeredTypes:
|
|
120
|
-
offchainWorker:
|
|
121
|
-
maxMemoryBlockCount:
|
|
127
|
+
mockSignatureHost: opts.mockSignatureHost,
|
|
128
|
+
allowUnresolvedImports: opts.allowUnresolvedImports,
|
|
129
|
+
runtimeLogLevel: opts.runtimeLogLevel,
|
|
130
|
+
registeredTypes: opts.registeredTypes || {},
|
|
131
|
+
offchainWorker: opts.offchainWorker,
|
|
132
|
+
maxMemoryBlockCount: opts.maxMemoryBlockCount
|
|
122
133
|
});
|
|
123
|
-
if (
|
|
124
|
-
await genesisSetup(chain,
|
|
134
|
+
if (opts.genesis) {
|
|
135
|
+
await genesisSetup(chain, opts.genesis);
|
|
125
136
|
}
|
|
126
137
|
return chain;
|
|
127
138
|
};
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -150,6 +150,7 @@ const stripChildPrefix = (key)=>{
|
|
|
150
150
|
const POTENTIAL_SLOT_KEYS = [
|
|
151
151
|
'0x1cb6f36e027abb2091cfb5110ab5087f06155b3cd9a8c9e5e9a23fd5dc13a5ed',
|
|
152
152
|
'0x57f8dc2f5ab09467896f47300f04243806155b3cd9a8c9e5e9a23fd5dc13a5ed',
|
|
153
|
+
'0x8985dff79e6002d0deba9ddac46f32a5a70806914c906d747e668a21f9021729',
|
|
153
154
|
'0xab2a8d5eca218f218c6fda6b1d22bb926bc171ab77f6a731a6e80c34ee1eda19'
|
|
154
155
|
];
|
|
155
156
|
const getCurrentSlot = async (chain)=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HexString } from '@polkadot/util/types';
|
|
2
1
|
import { Block } from '../../block.js';
|
|
3
2
|
import { BuildBlockParams } from '../../txpool.js';
|
|
3
|
+
import { HexString } from '@polkadot/util/types';
|
|
4
4
|
import { InherentProvider } from '../index.js';
|
|
5
5
|
export declare class SetNimbusAuthorInherent implements InherentProvider {
|
|
6
6
|
createInherents(newBlock: Block, _params: BuildBlockParams): Promise<HexString[]>;
|
|
@@ -25,6 +25,23 @@ export class SetNimbusAuthorInherent {
|
|
|
25
25
|
alice
|
|
26
26
|
]).toHex());
|
|
27
27
|
}
|
|
28
|
+
if (meta.query.authorityAssignment && meta.query.session) {
|
|
29
|
+
const session = await newBlock.chain.head.read('u32', meta.query.session.currentIndex);
|
|
30
|
+
if (session) {
|
|
31
|
+
// We need to set both the assignemnt for current and next sessions
|
|
32
|
+
layer.set(compactHex(meta.query.authorityAssignment.collatorContainerChain(session)), meta.registry.createType(`DpCollatorAssignmentAssignedCollatorsPublic`, {
|
|
33
|
+
orchestratorChain: [
|
|
34
|
+
alice
|
|
35
|
+
]
|
|
36
|
+
}).toHex());
|
|
37
|
+
layer.set(compactHex(meta.query.authorityAssignment.collatorContainerChain(session.toBigInt() + 1n)), meta.registry.createType(`DpCollatorAssignmentAssignedCollatorsPublic`, {
|
|
38
|
+
orchestratorChain: [
|
|
39
|
+
alice
|
|
40
|
+
]
|
|
41
|
+
}).toHex());
|
|
42
|
+
}
|
|
43
|
+
layer.set(compactHex(meta.query.authorNoting.didSetContainerAuthorData()), meta.registry.createType('bool', true).toHex());
|
|
44
|
+
}
|
|
28
45
|
return [
|
|
29
46
|
new GenericExtrinsic(meta.registry, meta.tx.authorInherent.kickOffAuthorshipValidation()).toHex()
|
|
30
47
|
];
|
|
@@ -89,13 +89,28 @@ export class SetValidationData {
|
|
|
89
89
|
]);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
// inject missing hrmpIngressChannel and hrmpEgressChannel
|
|
93
|
+
const hrmpIngressChannels = meta.registry.createType('Vec<u32>', hexToU8a(decoded[hrmpIngressChannelIndexKey]));
|
|
94
|
+
const hrmpEgressChannels = meta.registry.createType('Vec<u32>', hexToU8a(decoded[hrmpEgressChannelIndexKey]));
|
|
95
|
+
for(const key in params.horizontalMessages){
|
|
96
|
+
// order is important
|
|
97
|
+
const sender = meta.registry.createType('u32', key);
|
|
98
|
+
if (!hrmpIngressChannels.some((x)=>x.eq(sender))) {
|
|
99
|
+
const idx = _.sortedIndexBy(hrmpIngressChannels, sender, (x)=>x.toNumber());
|
|
100
|
+
hrmpIngressChannels.splice(idx, 0, sender);
|
|
101
|
+
}
|
|
102
|
+
if (!hrmpEgressChannels.some((x)=>x.eq(sender))) {
|
|
103
|
+
const idx = _.sortedIndexBy(hrmpEgressChannels, sender, (x)=>x.toNumber());
|
|
104
|
+
hrmpEgressChannels.splice(idx, 0, sender);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
92
107
|
newEntries.push([
|
|
93
108
|
hrmpIngressChannelIndexKey,
|
|
94
|
-
|
|
109
|
+
hrmpIngressChannels.toHex()
|
|
95
110
|
]);
|
|
96
111
|
newEntries.push([
|
|
97
112
|
hrmpEgressChannelIndexKey,
|
|
98
|
-
|
|
113
|
+
hrmpEgressChannels.toHex()
|
|
99
114
|
]);
|
|
100
115
|
// inject paraHead
|
|
101
116
|
const headData = meta.registry.createType('HeadData', (await parent.header).toHex());
|
|
@@ -117,25 +132,26 @@ export class SetValidationData {
|
|
|
117
132
|
dmqMqcHeadKey,
|
|
118
133
|
dmqMqcHeadHash
|
|
119
134
|
]);
|
|
120
|
-
const hrmpIngressChannels = meta.registry.createType('Vec<ParaId>', decoded[hrmpIngressChannelIndexKey]).toJSON();
|
|
121
|
-
const hrmpEgressChannels = meta.registry.createType('Vec<ParaId>', decoded[hrmpEgressChannelIndexKey]).toJSON();
|
|
122
|
-
const hrmpMessages = {
|
|
123
|
-
// reset values, we just need the keys
|
|
124
|
-
..._.mapValues(extrinsic.horizontalMessages, ()=>[]),
|
|
125
|
-
...params.horizontalMessages
|
|
126
|
-
};
|
|
127
135
|
// inject horizontal messages
|
|
128
|
-
for (const
|
|
129
|
-
|
|
130
|
-
const
|
|
136
|
+
for (const sender of hrmpIngressChannels){
|
|
137
|
+
// search by number and string just in case key is not a number
|
|
138
|
+
const messages = params.horizontalMessages[sender.toNumber()] || params.horizontalMessages[sender.toString()] || [];
|
|
131
139
|
const channelId = meta.registry.createType('HrmpChannelId', {
|
|
132
140
|
sender,
|
|
133
141
|
receiver: paraId.toNumber()
|
|
134
142
|
});
|
|
135
143
|
const hrmpChannelKey = hrmpChannels(channelId);
|
|
136
144
|
const abridgedHrmpRaw = decoded[hrmpChannelKey];
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
const abridgedHrmp = abridgedHrmpRaw ? meta.registry.createType('AbridgedHrmpChannel', hexToU8a(abridgedHrmpRaw)).toJSON() : {
|
|
146
|
+
maxCapacity: 1000,
|
|
147
|
+
maxTotalSize: 102400,
|
|
148
|
+
maxMessageSize: 102400,
|
|
149
|
+
msgCount: 0,
|
|
150
|
+
totalSize: 0,
|
|
151
|
+
mqcHead: 0x0000000000000000000000000000000000000000000000000000000000000000,
|
|
152
|
+
senderDeposit: 5000000000000,
|
|
153
|
+
recipientDeposit: 5000000000000
|
|
154
|
+
};
|
|
139
155
|
const paraMessages = [];
|
|
140
156
|
for (const { data, sentAt: _unused } of messages){
|
|
141
157
|
// fake relaychain sentAt to make validationData think this msg was sent at previous block
|
|
@@ -150,24 +166,31 @@ export class SetValidationData {
|
|
|
150
166
|
sentAt
|
|
151
167
|
});
|
|
152
168
|
}
|
|
153
|
-
horizontalMessages[sender] = paraMessages;
|
|
169
|
+
horizontalMessages[sender.toNumber()] = paraMessages;
|
|
154
170
|
newEntries.push([
|
|
155
171
|
hrmpChannelKey,
|
|
156
172
|
meta.registry.createType('AbridgedHrmpChannel', abridgedHrmp).toHex()
|
|
157
173
|
]);
|
|
158
174
|
}
|
|
159
175
|
// inject hrmpEgressChannels proof
|
|
160
|
-
for (const
|
|
161
|
-
// const messages = hrmpMessages[id]
|
|
162
|
-
const receiver = Number(id);
|
|
176
|
+
for (const receiver of hrmpEgressChannels){
|
|
163
177
|
const channelId = meta.registry.createType('HrmpChannelId', {
|
|
164
178
|
sender: paraId.toNumber(),
|
|
165
179
|
receiver
|
|
166
180
|
});
|
|
167
181
|
const hrmpChannelKey = hrmpChannels(channelId);
|
|
182
|
+
const abridgedHrmpRaw = decoded[hrmpChannelKey];
|
|
183
|
+
const abridgedHrmp = abridgedHrmpRaw ? meta.registry.createType('AbridgedHrmpChannel', hexToU8a(abridgedHrmpRaw)).toJSON() : {
|
|
184
|
+
maxCapacity: 1000,
|
|
185
|
+
maxTotalSize: 102400,
|
|
186
|
+
maxMessageSize: 102400,
|
|
187
|
+
msgCount: 0,
|
|
188
|
+
totalSize: 0,
|
|
189
|
+
mqcHead: 0x0000000000000000000000000000000000000000000000000000000000000000
|
|
190
|
+
};
|
|
168
191
|
newEntries.push([
|
|
169
192
|
hrmpChannelKey,
|
|
170
|
-
|
|
193
|
+
meta.registry.createType('AbridgedHrmpChannel', abridgedHrmp).toHex()
|
|
171
194
|
]);
|
|
172
195
|
}
|
|
173
196
|
const upgradeKey = upgradeGoAheadSignal(paraId);
|
package/dist/esm/setup.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@polkadot/types-codec';
|
|
2
2
|
import { RegisteredTypes } from '@polkadot/types/types';
|
|
3
|
+
import { Api } from './api.js';
|
|
3
4
|
import { Blockchain } from './blockchain/index.js';
|
|
4
5
|
import { BuildBlockMode } from './blockchain/txpool.js';
|
|
5
6
|
import { Database } from './database.js';
|
|
@@ -18,4 +19,19 @@ export type SetupOptions = {
|
|
|
18
19
|
maxMemoryBlockCount?: number;
|
|
19
20
|
};
|
|
20
21
|
export declare const genesisSetup: (chain: Blockchain, genesis: GenesisProvider) => Promise<void>;
|
|
22
|
+
export declare const processOptions: (options: SetupOptions) => Promise<{
|
|
23
|
+
blockHash: string;
|
|
24
|
+
api: Api;
|
|
25
|
+
endpoint?: string | string[] | undefined;
|
|
26
|
+
block?: string | number | null | undefined;
|
|
27
|
+
genesis?: GenesisProvider | undefined;
|
|
28
|
+
buildBlockMode?: BuildBlockMode | undefined;
|
|
29
|
+
db?: Database | undefined;
|
|
30
|
+
mockSignatureHost?: boolean | undefined;
|
|
31
|
+
allowUnresolvedImports?: boolean | undefined;
|
|
32
|
+
runtimeLogLevel?: number | undefined;
|
|
33
|
+
registeredTypes?: RegisteredTypes | undefined;
|
|
34
|
+
offchainWorker?: boolean | undefined;
|
|
35
|
+
maxMemoryBlockCount?: number | undefined;
|
|
36
|
+
}>;
|
|
21
37
|
export declare const setup: (options: SetupOptions) => Promise<Blockchain>;
|
package/dist/esm/setup.js
CHANGED
|
@@ -45,7 +45,7 @@ export const genesisSetup = async (chain, genesis)=>{
|
|
|
45
45
|
}
|
|
46
46
|
await chain.newBlock();
|
|
47
47
|
};
|
|
48
|
-
export const
|
|
48
|
+
export const processOptions = async (options)=>{
|
|
49
49
|
defaultLogger.debug(options, 'Setup options');
|
|
50
50
|
let provider;
|
|
51
51
|
if (options.genesis) {
|
|
@@ -82,28 +82,36 @@ export const setup = async (options)=>{
|
|
|
82
82
|
...options,
|
|
83
83
|
blockHash
|
|
84
84
|
}, 'Args');
|
|
85
|
+
return {
|
|
86
|
+
...options,
|
|
87
|
+
blockHash,
|
|
88
|
+
api
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export const setup = async (options)=>{
|
|
92
|
+
const { api, blockHash, ...opts } = await processOptions(options);
|
|
85
93
|
const header = await api.getHeader(blockHash);
|
|
86
94
|
if (!header) {
|
|
87
95
|
throw new Error(`Cannot find header for ${blockHash}`);
|
|
88
96
|
}
|
|
89
97
|
const chain = new Blockchain({
|
|
90
98
|
api,
|
|
91
|
-
buildBlockMode:
|
|
99
|
+
buildBlockMode: opts.buildBlockMode,
|
|
92
100
|
inherentProviders,
|
|
93
|
-
db:
|
|
101
|
+
db: opts.db,
|
|
94
102
|
header: {
|
|
95
103
|
hash: blockHash,
|
|
96
104
|
number: Number(header.number)
|
|
97
105
|
},
|
|
98
|
-
mockSignatureHost:
|
|
99
|
-
allowUnresolvedImports:
|
|
100
|
-
runtimeLogLevel:
|
|
101
|
-
registeredTypes:
|
|
102
|
-
offchainWorker:
|
|
103
|
-
maxMemoryBlockCount:
|
|
106
|
+
mockSignatureHost: opts.mockSignatureHost,
|
|
107
|
+
allowUnresolvedImports: opts.allowUnresolvedImports,
|
|
108
|
+
runtimeLogLevel: opts.runtimeLogLevel,
|
|
109
|
+
registeredTypes: opts.registeredTypes || {},
|
|
110
|
+
offchainWorker: opts.offchainWorker,
|
|
111
|
+
maxMemoryBlockCount: opts.maxMemoryBlockCount
|
|
104
112
|
});
|
|
105
|
-
if (
|
|
106
|
-
await genesisSetup(chain,
|
|
113
|
+
if (opts.genesis) {
|
|
114
|
+
await genesisSetup(chain, opts.genesis);
|
|
107
115
|
}
|
|
108
116
|
return chain;
|
|
109
117
|
};
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -86,6 +86,7 @@ export const stripChildPrefix = (key)=>{
|
|
|
86
86
|
const POTENTIAL_SLOT_KEYS = [
|
|
87
87
|
'0x1cb6f36e027abb2091cfb5110ab5087f06155b3cd9a8c9e5e9a23fd5dc13a5ed',
|
|
88
88
|
'0x57f8dc2f5ab09467896f47300f04243806155b3cd9a8c9e5e9a23fd5dc13a5ed',
|
|
89
|
+
'0x8985dff79e6002d0deba9ddac46f32a5a70806914c906d747e668a21f9021729',
|
|
89
90
|
'0xab2a8d5eca218f218c6fda6b1d22bb926bc171ab77f6a731a6e80c34ee1eda19'
|
|
90
91
|
];
|
|
91
92
|
export const getCurrentSlot = async (chain)=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acala-network/chopsticks-core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9-1",
|
|
4
4
|
"author": "Acala Developers <hello@acala.network>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"docs:prep": "typedoc"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@acala-network/chopsticks-executor": "0.9.
|
|
15
|
+
"@acala-network/chopsticks-executor": "0.9.9-1",
|
|
16
16
|
"@polkadot/rpc-provider": "^10.11.2",
|
|
17
17
|
"@polkadot/types": "^10.11.2",
|
|
18
18
|
"@polkadot/types-codec": "^10.11.2",
|