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

Commit

Permalink
Update tests for interop cross chain updates (#9138)
Browse files Browse the repository at this point in the history
* Update tests for interop cross chain updates

* expect `verifyRoutingRules` to return error in all cases

* Move repeated declarations to parent scope

* Use ccmContext instead

* Remove `// ***`

* Remove `describe('isMainchain'` to have all checks inside a single `describe('verifyRoutingRules'`

* use chainID other than mainchainID

* `Sending and receiving chains must differ.` condition should run for both (mainchain & sidechain) cases

* Address redundant assignments

* Removing expectation, since following expects will fail, if there is no error throw from verifyRoutingRules

---------

Co-authored-by: !shan <ishantiw.quasar@gmail.com>
  • Loading branch information
sitetester and ishantiw authored Nov 23, 2023
1 parent 799585e commit 7d8301a
Show file tree
Hide file tree
Showing 6 changed files with 279 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export abstract class BaseCrossChainUpdateCommand<
}
}

// https://github.com/LiskHQ/lips/blob/main/proposals/lip-0053.md#beforecrosschainmessagesexecution
protected async beforeCrossChainMessagesExecution(
context: CommandExecuteContext<CrossChainUpdateTransactionParams>,
isMainchain: boolean,
Expand Down Expand Up @@ -195,6 +196,7 @@ export abstract class BaseCrossChainUpdateCommand<
return [ccms, true];
}

// https://github.com/LiskHQ/lips/blob/main/proposals/lip-0053.md#verifyroutingrules
protected verifyRoutingRules(
ccm: CCMsg,
ccuParams: CrossChainUpdateTransactionParams,
Expand All @@ -219,7 +221,8 @@ export abstract class BaseCrossChainUpdateCommand<
}
}

protected async afterCrossChainMessagesExecute(
// https://github.com/LiskHQ/lips/blob/main/proposals/lip-0053.md#aftercrosschainmessagesexecution
protected async afterCrossChainMessagesExecution(
context: CommandExecuteContext<CrossChainUpdateTransactionParams>,
) {
const { params } = context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class SubmitMainchainCrossChainUpdateCommand extends BaseCrossChainUpdate
context.contextStore.delete(CONTEXT_STORE_KEY_CCM_PROCESSING);
}

await this.afterCrossChainMessagesExecute(context);
await this.afterCrossChainMessagesExecution(context);
}

private async _beforeCrossChainMessageForwarding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { getIDFromCCMBytes } from '../../utils';
import { SidechainInteroperabilityInternalMethod } from '../internal_method';

// https://github.com/LiskHQ/lips/blob/main/proposals/lip-0053.md#sidechaincrosschainupdate

export class SubmitSidechainCrossChainUpdateCommand extends BaseCrossChainUpdateCommand<SidechainInteroperabilityInternalMethod> {
public async verify(
context: CommandVerifyContext<CrossChainUpdateTransactionParams>,
Expand Down Expand Up @@ -81,6 +80,6 @@ export class SubmitSidechainCrossChainUpdateCommand extends BaseCrossChainUpdate
context.contextStore.delete(CONTEXT_STORE_KEY_CCM_PROCESSING);
}

await this.afterCrossChainMessagesExecute(context);
await this.afterCrossChainMessagesExecution(context);
}
}
Loading

0 comments on commit 7d8301a

Please sign in to comment.