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

Update sidechain terminated cross chain command #7658

Closed
Tracked by #7211
ishantiw opened this issue Oct 18, 2022 · 0 comments
Closed
Tracked by #7211

Update sidechain terminated cross chain command #7658

ishantiw opened this issue Oct 18, 2022 · 0 comments
Assignees
Labels
framework/module/interoperability Interoperability module
Milestone

Comments

@ishantiw
Copy link
Contributor

Description

  • Update schema
sidechainTerminatedCCMParamsSchema = {
    "type": "object",
    "required": ["chainID", "stateRoot"],
    "properties": {
        "chainID": {
            "dataType": "bytes",
            "length": CHAIN_ID_LENGTH,
            "fieldNumber": 1
        },
        "stateRoot": {
            "dataType": "bytes",
            "length": HASH_LENGTH,
            "fieldNumber": 2
        }
    }
}
  • Update verification method
def verify(ccu: Transaction, ccm: CCM) -> None:
    if ccm.status != CCM_STATUS_CODE_OK:
        raise Exception("Sidechain terminated message must have status OK.")
    # This message should only be created on the mainchain.
    if ccm.sendingChainID != CHAIN_ID_MAINCHAIN:
        raise Exception("Sidechain terminated message must be sent from the mainchain.")
  • Update execution method
def execute(ccu: Transaction, ccm: CCM) -> None:
    if isLive(ccm.params.chainID):
        createTerminatedStateAccount(ccm.params.chainID, ccm.params.stateRoot)

Acceptance Criteria

  • Should have all the unit tests

Additional Information

@ishantiw ishantiw added the framework/module/interoperability Interoperability module label Oct 18, 2022
@shuse2 shuse2 added this to the Sprint 81 milestone Oct 24, 2022
@shuse2 shuse2 modified the milestones: Sprint 81, Sprint 82 Nov 7, 2022
@shuse2 shuse2 self-assigned this Nov 11, 2022
shuse2 added a commit that referenced this issue Nov 17, 2022
### What was the problem?

This PR resolves #7658 

### How was it solved?

- Update CCCommand execute to use `CCCommandExecuteContext`
- Update CCCommand to be able to have no schema
- Remove Sidechain terminated CCCommand from mainchain
- Update Sidechain terminated CCCommand on sidechain

### How was it tested?

- Add unit test to cover the cases
@shuse2 shuse2 closed this as completed Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
framework/module/interoperability Interoperability module
Projects
None yet
Development

No branches or pull requests

2 participants