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

Update validateFormat for ccm #7599

Closed
Tracked by #7211
ishantiw opened this issue Sep 30, 2022 · 0 comments · Fixed by #7655
Closed
Tracked by #7211

Update validateFormat for ccm #7599

ishantiw opened this issue Sep 30, 2022 · 0 comments · Fixed by #7655
Labels
framework/module/interoperability Interoperability module
Milestone

Comments

@ishantiw
Copy link
Contributor

ishantiw commented Sep 30, 2022

Description

def validateFormat(ccm: CCM) -> None:
    # Try to encode ccm.
    # This raises an error if the ccm does not follow the correct schema.
    ccmBytes = encode(crossChainMessageSchema, ccm)
    # ccm.module must be an alphanumeric string.
    if not re.match("^[a-zA-Z0-9]*$", ccm.module):
        raise Exception("Cross-chain message module name must be alphanumeric.")
    # ccm.module must be an alphanumeric string.
    if not re.match("^[a-zA-Z0-9]*$", ccm.crossChainCommand):
        raise Exception("Cross-chain message command name must be alphanumeric.")
    # Check ccm size.
    if ccmBytes > MAX_CCM_SIZE:
        raise Exception(f"Cross-chain message size is larger than {MAX_CCM_SIZE}.")

Acceptance Criteria

  • Update and add unit test cases for validateFormat

Additional Information

Related LIP PR update LiskArchive/lips#148

@ishantiw ishantiw added the framework/module/interoperability Interoperability module label Sep 30, 2022
@shuse2 shuse2 added this to the Sprint 80 milestone Oct 10, 2022
@ishantiw ishantiw linked a pull request Oct 18, 2022 that will close this issue
ishantiw added a commit that referenced this issue Oct 24, 2022
### What was the problem?

This PR resolves #7599

### How was it solved?

Updated `validateFormat` according to requirement
Updated `ccmSchema` according to requirement

### How was it tested?
Updated unit-test
@shuse2 shuse2 modified the milestones: Sprint 80, Sprint 81 Oct 24, 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

Successfully merging a pull request may close this issue.

2 participants