Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/data_provider/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,23 @@ export const _processGenesis = async (paraId) => {
const setIdKey = parentApi.query.grandpa.currentSetId.key()
const setId = await parentApi.query.grandpa.currentSetId.at(parentHash)

const grandpaAuthorities = parentApi.createType(
'VersionedAuthorityList',
(await parentApi.rpc.state.getStorage(GRANDPA_AUTHORITIES_KEY, parentHash))
.value
)
let grandpaAuthoritiesKey = GRANDPA_AUTHORITIES_KEY;
let grandpaAuthoritiesValue = (await parentApi.rpc.state.getStorage(grandpaAuthoritiesKey, parentHash))
.value;
let grandpaAuthorities;
if (grandpaAuthoritiesValue) {
const versionedAuthorities = parentApi.createType(
'VersionedAuthorityList',
grandpaAuthoritiesValue
);
grandpaAuthorities = versionedAuthorities.authorityList;
} else {
grandpaAuthoritiesKey = parentApi.query.grandpa.authorities.key();
grandpaAuthorities = await parentApi.query.grandpa.authorities.at(parentHash);
};
const grandpaAuthoritiesStorageProof = (
await parentApi.rpc.state.getReadProof(
[GRANDPA_AUTHORITIES_KEY, setIdKey],
[grandpaAuthoritiesKey, setIdKey],
parentHash
)
).proof
Expand All @@ -49,7 +58,7 @@ export const _processGenesis = async (paraId) => {
.createType('GenesisInfo', {
header: parentHeader,
authoritySet: {
authoritySet: grandpaAuthorities.authorityList,
authoritySet: grandpaAuthorities,
setId,
},
proof: grandpaAuthoritiesStorageProof,
Expand Down