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.
In chain connector plugin => newBlockHandler => computeCCUParams method, when no new certificate and last certified height === 0, there is an early return.
Actual behavior
Currently on every new block received we execute the following logic to calculate message witness:
const lastSentCCM = (await this._chainConnectorStore.getLastSentCCM()) ?? {
nonce: DEFAULT_LAST_CCM_SENT_NONCE,
height: this._lastCertificate.height,
};
let activeValidatorsUpdate: ActiveValidatorsUpdate = {
blsKeysUpdate: [],
bftWeightsUpdate: [],
bftWeightsUpdateBitmap: EMPTY_BYTES,
};
let certificate = EMPTY_BYTES;
let certificateThreshold;
let outboxRootWitness;
// Take range from lastSentCCM height until new or last certificate height
const ccmsToBeIncluded = ccmsFromEvents.filter(
record =>
record.height >= lastSentCCM.height &&
// If no newCertificate then use lastCertificate height
record.height <= (newCertificate ? newCertificate.height : this._lastCertificate.height),
);
// Calculate messageWitnessHashes for pending CCMs if any
const channelDataOnReceivingChain = await this._receivingChainClient.invoke<ChannelDataJSON>(
'interoperability_getChannel',
{ chainID: this._ownChainID.toString('hex') },
);
if (!channelDataOnReceivingChain?.inbox) {
this.logger.info('Receiving chain is not registered yet on the sending chain.');
return;
}
const inboxSizeOnReceivingChain = channelDataJSONToObj(channelDataOnReceivingChain).inbox.size;
const receivingChainChannelDataJSON = await this._sendingChainClient.invoke<ChannelDataJSON>(
'interoperability_getChannel',
{ chainID: this._receivingChainID.toString('hex') },
);
if (!receivingChainChannelDataJSON?.outbox) {
this.logger.info('Sending chain is not registered yet on the receiving chain.');
return;
}
const outboxSizeOnSendingChain = channelDataJSONToObj(receivingChainChannelDataJSON).outbox
.size;
const messageWitnessHashesForCCMs = calculateMessageWitnesses(
inboxSizeOnReceivingChain,
outboxSizeOnSendingChain,
lastSentCCM,
ccmsToBeIncluded,
this._maxCCUSize,
);
However, we can avoid unnecessarily executing this logic upon every new bloc received when there is no new certificate and last certified height === 0 since we have this information earlier on in the logic.
Steps to reproduce
Check chain connector newBlockHandler logic
Which version(s) does this affect? (Environment, OS, etc...)
v6.0
The text was updated successfully, but these errors were encountered:
Expected behavior
In chain connector plugin =>
newBlockHandler
=>computeCCUParams
method, when no new certificate and last certified height === 0, there is an early return.Actual behavior
Currently on every new block received we execute the following logic to calculate message witness:
However, we can avoid unnecessarily executing this logic upon every new bloc received when there is no new certificate and last certified height === 0 since we have this information earlier on in the logic.
Steps to reproduce
Check chain connector
newBlockHandler
logicWhich version(s) does this affect? (Environment, OS, etc...)
v6.0
The text was updated successfully, but these errors were encountered: