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

Update logic for verifyCertificate for CCU verification #7687

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

Update logic for verifyCertificate for CCU verification #7687

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

Comments

@ishantiw
Copy link
Contributor

ishantiw commented Oct 24, 2022

Description

Update logic associated with certificate verification based on the latest implementation of LIP0053

def verifyCertificate(ccu: Transaction) -> None:
    certificateBytes = ccu.params.certificate      
    certificate = decode(certificateSchema, certificateBytes)
    partnerchainID = ccu.params.sendingChainID
    partnerchainAccount = chainAccount(partnerchainID)
    # Certificate height must be greater than last certificate height.
    if certificate.height <= partnerchainAccount.lastCertificate.height:
        raise Exception("Certificate height is not greater than last certificate height.")
    # Certificate timestamp must be smaller than timestamp of the block including the CCU.
    timestamp = timestamp of the block including ccu
    if certificate.timestamp >= timestamp:
        raise Exception("Certificate timestamp is not smaller than timestamp of the block including the CCU.")

Acceptance Criteria

  • Should have unit test

Additional Information

@ishantiw ishantiw added the framework/module/interoperability Interoperability module label Oct 24, 2022
@shuse2 shuse2 self-assigned this Nov 10, 2022
@shuse2 shuse2 added this to the Sprint 82 milestone Nov 10, 2022
shuse2 added a commit that referenced this issue Nov 15, 2022
### What was the problem?

This PR resolves #7687 and resolves #7688

### How was it solved?

- Move verifyCertificateSignature to internalMethod and update per LIP
- Add verifyCertificate to internalMethod per LIP

### How was it tested?

- Add unit tests to cover all the cases

Co-authored-by: !shan <[email protected]>
@shuse2 shuse2 closed this as completed Nov 15, 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