Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

terminateChain method does not work #8603

Closed
Tracked by #7226
ishantiw opened this issue Jun 16, 2023 · 0 comments
Closed
Tracked by #7226

terminateChain method does not work #8603

ishantiw opened this issue Jun 16, 2023 · 0 comments
Assignees
Milestone

Comments

@ishantiw
Copy link
Contributor

Description

The terminateChain method of the interoperability module always fails. The terminateChain method uses the getTerminatedStateAccount function to determine if the chain is already terminated, in which case it returns early. If getTerminatedStateAccount returns a falsy value (e.g., undefined), then it terminates the chain by calling the sendInternal method with CROSS_CHAIN_COMMAND_CHANNEL_TERMINATED.
However, getTerminatedStateAccount throws a NotFoundError exception when the chain is not present in the TerminatedStateStore, which causes the terminateChain method to bubble up the exception, meaning that sendInternal is never called.

https://github.com/LiskHQ/lisk-sdk/blob/89e7504ef5eb6183aefe576a93be3d6052e56038/framework/src/modules/interoperability/base_interoperability_method.ts#L87-L89

https://github.com/LiskHQ/lisk-sdk/blob/89e7504ef5eb6183aefe576a93be3d6052e56038/framework/src/modules/interoperability/base_interoperability_method.ts#L168-L186

The existing test cases do not catch this issue because the getTerminatedStateAccount is mocked in a way that does not reflect the correct behavior of that function

https://github.com/LiskHQ/lisk-sdk/blob/89e7504ef5eb6183aefe576a93be3d6052e56038/framework/test/unit/modules/interoperability/method.spec.ts#L520-L524

Acceptance Criteria

  • Update the unit tests to correctly test the behaviour of getTerminatedStateAccount
  • All unit tests should pass
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants