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

Verify a chain of Runestone #2

Open
Th0rgal opened this issue Nov 19, 2024 · 1 comment
Open

Verify a chain of Runestone #2

Th0rgal opened this issue Nov 19, 2024 · 1 comment
Assignees

Comments

@Th0rgal
Copy link
Member

Th0rgal commented Nov 19, 2024

This should verify the validity of a Runestone ancestry. It would not be enough to guarantee the rune verification as we would also need to verify the Runestone mint was performed correctly (if minted too late it contains no Runes).

Here is a summary of what needs to be done:

We need a public verify_runestone_ancestry function which takes a Span of Transactions where the first transaction references the 2nd, the 2nd the third, etc, and returns a boolean indicating the validity of the chain.

Steps

  • Match if array is empty (if so, return true, otherwise false), otherwise work with the tx object from pop_front()
  • Extract the runestone from this tx or panic
  • Match the runestone as a mint or as a transfer (edicts)
  • If it's a mint, return a recursive call, otherwise first ensures the edict transfers a correct amount

Advice

Note that this verification is not sufficient to guarantee the Rune mint was performed correctly - additional checks would be needed to confirm whether the Runestone contains valid Runes (for example, checking if it was minted too late).

You might need to wrap the recursive function into another function so you can add helper params (like the total amount that you need to ensure was transferred)

@Th0rgal
Copy link
Member Author

Th0rgal commented Dec 9, 2024

Note: it seems edict are not properly supported yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants