-
Notifications
You must be signed in to change notification settings - Fork 458
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## release/6.1.0 #9137 +/- ##
==============================================
Coverage 84.35% 84.35%
==============================================
Files 655 655
Lines 24113 24113
Branches 3497 3497
==============================================
Hits 20341 20341
Misses 3772 3772
|
|
||
// Check that sending chain is valid. This check is relevant only in case direct sidechain channels are enabled | ||
if (!chainID.equals(getMainchainID(chainID)) && !ccm.sendingChainID.equals(chainID)) { | ||
return { | ||
status: VerifyStatus.FAIL, | ||
error: new Error('Cross-chain message sending chain ID is not valid.'), | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not sure why this is added 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is not needed in the mainchain. As the comment in the LIP says
# Check that sending chain is valid. This check is relevant only in case direct sidechain channels are enabled
if OWN_CHAIN_ID != getMainchainID() and ccm.sendingChainID != OWN_CHAIN_ID:
raise Exception("Cross-chain message sending chain ID is not valid.")
Currently (no direct channels) the message recovery command exists only in mainchain and this extra check is not needed. It is anyways pointless since the OWN_CHAIN_ID != getMainchainID()
would never be true in mainchain, so adding it would never change the outcome of the verification.
In the future, in case direct sidechain channels get enabled, then the message recovery command would also need to be supported in the sidechains. There, we would need this check to ensure the validity (this check essentially says that sidechains can never forward messages from other chains).
So this check would be needed only in case message recovery gets enabled in sidechains.
…ecovery gets enabled in sidechains
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes look good, but there is one open point in issue #8193 , namely the very last one:
Tests of lines 594, 633: I am not sure that it is checked that recoveredCCMs array is correctly updated.
The tests were refactored quite a bit in the meantime, but the corresponding ones in the current version are the ones in line 572 and 603. So far, it is only tested that terminatedOutboxStore.set
is called, but is not tested that it is called with the correct value. So I think the right way to do this is
- testing that
RMTCalculateRoot
was called with the right values (namelyrecoveredCCMs
as Greg commented), and - that
terminatedOutboxStore.set
is called with the return value ofRMTCalculateRoot
.
@@ -584,25 +591,53 @@ describe('MessageRecoveryCommand', () => { | |||
), | |||
}; | |||
|
|||
const recoveredCCM = await command['_applyRecovery'](ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
due to this, the expectation in line 597 will be met, even though it was not triggered from the function you are testing, right? Alternatively, you could create a copy of ctx
, change the status of ccm
to CCM_STATUS_CODE_RECOVERED
and swap ccm.sendingChainID
and ccm.receivingChainID
.
@@ -613,23 +648,41 @@ describe('MessageRecoveryCommand', () => { | |||
), | |||
}; | |||
|
|||
const recoveredCCM = await command['_forwardRecovery'](ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
What was the problem?
This PR resolves #8193
How was it solved?
Update code since LIP is updated
How was it tested?
Corresponding tests added