lfglabs-dev / lfglabs-dev/utu_runes_lib

Verify a chain of Runestone

Open
#2 1 comment 0 reactions 1 assignee View on GitHub

@irisdv is already working on this.

Since Dec 1, 2024.

Dominant language
Cairo
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.