Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add status to classic messages #240

Merged
merged 7 commits into from
Feb 16, 2023
Merged

Conversation

brtkx
Copy link
Contributor

@brtkx brtkx commented Feb 9, 2023

I think that's all that needs to be returned but lmk if I missed something

@brtkx brtkx requested review from yahgwai and spsjvc February 9, 2023 16:55
@cla-bot cla-bot bot added the cla-signed label Feb 9, 2023
return L1ToL2MessageStatus.CREATION_FAILED
}

return L1ToL2MessageStatus.REDEEMED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to discern between expired and redeemed? We derive the l2txHash from the retryablecreationid:

private static calculateL2DerivedHash(
    retryableCreationId: string,
    l2TxnType: L2TxnType
  ): string {
    return keccak256(
      concat([
        zeroPad(retryableCreationId, 32),
        zeroPad(BigNumber.from(l2TxnType).toHexString(), 32),
      ])
    )
  }

then check if that tx was successful:

    if (l2TxReceipt && l2TxReceipt.status === 1) {
      return L1ToL2MessageStatus.REDEEMED
    }

otherwise the ticket would be EXPIRED.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yahgwai Is l2TxnType taken from creationReceipt.type? I'm using it to call calculateL2DerivedHash, and then running l2Provider.getTransactionReceipt( l2DerivedHash ) but it's returning null

@brtkx brtkx requested a review from yahgwai February 15, 2023 16:22
@brtkx brtkx requested a review from spsjvc February 15, 2023 16:23
@spsjvc spsjvc changed the title Add status to classic messages feat: add status to classic messages Feb 16, 2023
@spsjvc spsjvc merged commit 0b96cdc into main Feb 16, 2023
@spsjvc spsjvc deleted the add-status-to-classic-messages branch February 16, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants