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.
Add message recovery command execution to mainchain interoperability module.
let trsSenderAddress be the address of the trs.senderPublicKey
# Set CCM status to recovered and assign fee to trs sender
updatedCCMs = []
for ccm in deserializedCCMs:
for each module mdl for which beforeRecoverCCM exists:
mdl.beforeRecoverCCM(trsSenderAddress, ccm)
if the previous call fails:
execution fails and trs is invalid
ccm.status = CCM_STATUS_RECOVERED
ccm.fee = 0
push serialized(ccm) to updatedCCMs # CCM is serialized again
# Update sidechain outbox root
proof = { size: terminatedOutboxAccount(trs.params.chainID).outboxSize,
idxs: trs.params.idxs,
siblingHashes: trs.params.siblingHashes}
terminatedOutboxAccount(trs.params.chainID).outboxRoot = RMTCalculateRoot([SHA-256(ccmData) for CCMData in updatedCCMs], proof)
# Process recovery
for ccm in deserializedCCMs:
swap ccm.sendingChainID and ccm.receivingChainID
# On sidechain, this case is always triggered and the message logic should be supported
if ccm.receivingChainID == ownChainAccount.ID:
if (ccm.moduleID, ccm.crossChainCommandID) is supported:
call the logic associated with (ccm.moduleID, ccm.crossChainCommandID) on ccm
elif ownChainAccount.ID == MAINCHAIN_ID:
# Only send messages to active and live chains
if (chainAccount(ccm.receivingChainID) exists
and chainAccount(ccm.receivingChainID).status == CHAIN_ACTIVE
and isLive(ccm.receivingChainID):
addToOutbox(ccm.receivingChainID, ccm)
Acceptance Criteria
Add unit tests for message recovery
The text was updated successfully, but these errors were encountered:
Description
Add message recovery command execution to mainchain interoperability module.
Acceptance Criteria
The text was updated successfully, but these errors were encountered: