You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
This seems to be a bug & we can take it outside of loop, i.e.,
for (const chainInfo of chainInfos) {
// For each entry chainInfo in chainInfos, chainInfo.chainData.status == CHAIN_STATUS_TERMINATED
// if and only if a corresponding entry (i.e., with chainID == chainInfo.chainID) exists in terminatedStateAccounts.
if (chainInfo.chainData.status === ChainStatus.TERMINATED) {
const correspondingTerminatedAccount = terminatedStateAccounts.find(
terminatedStateAccount => terminatedStateAccount.chainID.equals(chainInfo.chainID),
);
if (!correspondingTerminatedAccount) {
throw new Error(
'For each chainInfo with status terminated there should be a corresponding entry in terminatedStateAccounts.',
);
}
}
}
this._verifyTerminatedStateAccountsCommon(terminatedStateAccounts, mainchainID); // ***
Actual behavior
In current code, _verifyTerminatedStateAccountsCommon is called inside loop
for (const chainInfo of chainInfos) {
// For each entry chainInfo in chainInfos, chainInfo.chainData.status == CHAIN_STATUS_TERMINATED
// if and only if a corresponding entry (i.e., with chainID == chainInfo.chainID) exists in terminatedStateAccounts.
if (chainInfo.chainData.status === ChainStatus.TERMINATED) {
const terminatedAccount = terminatedStateAccounts.find(tAccount =>
tAccount.chainID.equals(chainInfo.chainID),
);
if (!terminatedAccount) {
throw new Error(
'For each chainInfo with status terminated there should be a corresponding entry in terminatedStateAccounts.',
);
}
this._verifyTerminatedStateAccountsCommon(terminatedStateAccounts, mainchainID); // ***
Another small point const mainchainID = getMainchainID(mainchainInfo.chainID);
=> const mainchainID = getMainchainID(ctx.chainID);
Each entry stateAccount in terminatedStateAccounts has a unique stateAccount.chainID and terminatedStateAccounts is ordered lexicographically by stateAccount.chainID. Furthermore for each entry it holds stateAccount.chainID != getMainchainID() and stateAccount.chainId[0] == getMainchainID()[0].
Which version(s) does this affect? (Environment, OS, etc...)
git branch release/6.0.0
The text was updated successfully, but these errors were encountered:
Expected behavior
Actual behavior
In current code,
_verifyTerminatedStateAccountsCommon
is called inside loopconst mainchainID = getMainchainID(mainchainInfo.chainID);
=>
const mainchainID = getMainchainID(ctx.chainID);
Steps to reproduce
https://github.com/LiskHQ/lips/blob/main/proposals/lip-0045.md#mainchain
Which version(s) does this affect? (Environment, OS, etc...)
git branch
release/6.0.0
The text was updated successfully, but these errors were encountered: