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

Add zkSBTs #1012

Merged
merged 78 commits into from
Mar 29, 2023
Merged

Add zkSBTs #1012

merged 78 commits into from
Mar 29, 2023

Conversation

ferrell-code
Copy link
Contributor

@ferrell-code ferrell-code commented Feb 3, 2023

Description

SBT feature for Manta

Changes:

  • Pulls types in MantaPay into a support crate for common use in pallet-manta-pay and pallet-manta-sbt
  • Adds SBT functunality in pallet-manta-sbt
  • Adds MantaSbt to Dolphin and Calamari runtime along with sbt rpc enpoints in each client

Workflow of pallet-manta-sbt:

MantaSbt has two calls reserve_sbt and to_private.

step 1: reserve_sbt

  • Reserves unique AssetIds by incrementing NextSbtId
  • Maps the above unique AssetIds to the polkadot address in ReservedId to whitelist that account. This allows this specific polkadot address to call to_private on those specific AssetIds

step 2: to_private

  • Checks that caller has ReservedIds in storage. And ensures that the TransferPost is a ToPrivate corresponding to the correct AssetId from ReservedIds. Then it inserts metadata and UTXO into MantaSbt storage.

closes: #936

Before we can approve this PR for merge, please make sure that all the following items have been checked off:

  • Connected to an issue with discussion and accepted design using zenhub "Connect issue" button below
  • Added one label out of the L- group to this PR
  • Added one or more labels from the A- and C- groups to this PR
  • Explicitly labelled A-calamari, A-dolphin and/or A-manta if your changes are meant for/impact either of these (CI depends on it)
  • Re-reviewed Files changed in the Github PR explorer.

Situational Notes:

  • If adding functionality, write unit tests!
  • If importing a new pallet, choose a proper module index for it, and allow it in BaseFilter. Ensure every extrinsic works from front-end. If there's corresponding tool, ensure both work for each other.
  • If needed, update our Javascript/Typescript APIs. These APIs are officially used by exchanges or community developers.
  • If modifying existing runtime storage items, make sure to implement storage migrations for the runtime and test them with try-runtime. This includes migrations inherited from upstream changes, and you can search the diffs for modifications of #[pallet::storage] items to check for any.

Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
@ferrell-code ferrell-code added C-enhancement Category: An issue proposing an enhancement or a PR with one A-manta Area: Issues and PRs related to the Manta Runtime A-dolphin Area: Issues and PRs related to the Dolphin Runtime A-manta-pay Area: Issues and PRs related to the MantaPay Pallet L-added Log: Issues and PRs related to addition labels Feb 3, 2023
@ferrell-code ferrell-code marked this pull request as draft February 3, 2023 18:43
@ferrell-code ferrell-code changed the title Fer/feat/sbt Add SBTs Feb 3, 2023
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
@ferrell-code ferrell-code removed the A-manta-pay Area: Issues and PRs related to the MantaPay Pallet label Feb 23, 2023
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
zqhxuyuan and others added 3 commits March 24, 2023 17:55
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Copy link
Contributor

@ghzlatarev ghzlatarev left a comment

Choose a reason for hiding this comment

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

I guess you can put ignore on the fee test, we already have an issue.

@Garandor
Copy link
Contributor

I guess you can put ignore on the fee test, we already have an issue.

#1053 is ready to get merged after review and will resolve this

@github-actions
Copy link

github-actions bot commented Mar 28, 2023

⚠️ Congestion test: 1-day congestion cost (calamari) is NOT above target_daily_congestion_cost_kma

@ghzlatarev
Copy link
Contributor

⚠️ Congestion test: 1-day congestion cost (calamari) is NOT above target_daily_congestion_cost_kma

nice

@ghzlatarev ghzlatarev merged commit 4aaef92 into manta Mar 29, 2023
@ghzlatarev ghzlatarev deleted the fer/feat/sbt branch March 29, 2023 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-calamari Area: Issues and PRs related to the Calamari Runtime A-dolphin Area: Issues and PRs related to the Dolphin Runtime A-manta Area: Issues and PRs related to the Manta Runtime C-enhancement Category: An issue proposing an enhancement or a PR with one L-added Log: Issues and PRs related to addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SBT Pallet Prototype
5 participants