Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Plasma NFT Deposit Range
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Stake Technologies
July 29, 2019
Technology
0
63
Plasma NFT Deposit Range
Stake Technologies
July 29, 2019
Tweet
Share
More Decks by Stake Technologies
See All by Stake Technologies
Substrate ink!
staketechnologies
0
31
Plasma on Substrate @Fukuoka
staketechnologies
0
72
Sub0 Recap Japanese
staketechnologies
0
61
Plasm Introduction
staketechnologies
1
110
0318Substrateプレゼン資料.pdf
staketechnologies
4
620
2019.01ブロックチェーントレンド
staketechnologies
0
37
Other Decks in Technology
See All in Technology
【AWS】CloudTrail LakeとCloudWatch Logs Insightsの使い分け方針
tsurunosd
0
120
スピンアウト講座03_CLAUDE-MDとSKILL-MD
overflowinc
0
1.4k
Phase05_ClaudeCode入門
overflowinc
0
2.3k
やさしいとこから始めるGitHubリポジトリのセキュリティ
tsubakimoto_s
3
1.8k
SaaSに宿る21g
kanyamaguc
2
170
Phase08_クイックウィン実装
overflowinc
0
1.9k
Phase03_ドキュメント管理
overflowinc
0
2.8k
How to install a gem
indirect
0
1.7k
Kubernetesの「隠れメモリ消費」によるNode共倒れと、Request適正化という処方箋
g0xu
0
140
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
2
16k
Laravelで学ぶOAuthとOpenID Connectの基礎と実装
kyoshidaxx
4
1.9k
開発チームとQAエンジニアの新しい協業モデル -年末調整開発チームで実践する【QAリード施策】-
kaomi_wombat
0
250
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Mobile First: as difficult as doing things right
swwweet
225
10k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
650
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
300
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.5k
Agile that works and the tools we love
rasmusluckow
331
21k
Thoughts on Productivity
jonyablonski
75
5.1k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
210
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Transcript
DepositedRanges
概要 PlasmaCash 派生ではすべての資産を NFT として扱う。 子チェーンに資産を移すことを Deposit 子チェーンから親チェーンに資産を戻すことを Exit と呼ぶ。
親チェーンでは不正な Exit を防ぐために 子チェーンに存在する資産を把握している必要がある。 DepositedRanges は子チェーンに移した NFT を把握し 子チェーンに存在しない資産を不正に Exit できないようにするためのデータ構造。
データ構造 区間を表す構造体、 Range を定義する。 struct Range { start: u128, end:
u128 } Plasma 上の NFT は index が連番で割り振られており Range を使って どの NFT を指しているかを特定する。 DepositedRanges を定義する。 DepositedRanges: storage::HashMap<u128, Range>; DepositedRanges は現在 Deposit されている NFT の ID を管理する。
要件 DepositedRanges は以下のことがそれぞれ O(1) でできる。 • 区間の拡張。 ◦ Input ▪
amount : u128 ◦ 現在の Deposit されている総量から新たに amount だけ区間を拡張する。 • 区間の削除。 ◦ Input ▪ range: Range ▪ deposited_range_id: u128 ◦ 任意の区間を指定して削除する。 ◦ この際、削除する部分区間とする区間の左端の index が入力で与えられる。 (deposited_range_id)
Deposit アルゴリズム 初期状態 : total_deposit = 0; depositedRanges = {
} 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit( amount = 4 ); total_deposit = 0; depositedRanges =
{ 4: Range { 0, 4 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit( amount = 4 ); total_deposit = 4; depositedRanges =
{ 4: Range { 0, 4 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( amount = 6 ); total_deposit = 4; depositedRanges
= { 4: Range { 0, 4 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( amount = 6 ); total_deposit = 10; depositedRanges
= { 10: Range { 0, 10 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( amount = 2 ); total_deposit = 10; depositedRanges
= { 10: Range { 0, 10 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( amount = 2 ); total_deposit = 12; depositedRanges
= { 12: Range { 0,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Exit ( range = Range { 2, 8 } );
total_deposit = 12; depositedRanges = { 12: Range { 0,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Exit ( range = Range { 2, 8 } );
total_deposit = 12; depositedRanges = { 12: Range { 0,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12 ※ deposited_range_id は 作用したい区間を含むような 区間を depositedRanges から 取得するためのキー。 左端の index と等しい。
Exit ( range = Range { 2, 8 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 12: Range { 8,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12 ※ deposited_range_id は 作用したい区間を含むような 区間を depositedRanges から 取得するためのキー。 左端の index と等しい。
Exit ( range = Range { 6, 10 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 12: Range { 8,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12
Exit ( range = Range { 6, 10 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 12: Range { 8,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12
Exit ( range = Range { 10, 12 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 12: Range { 8,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12
Exit ( range = Range { 10, 12 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 10: Range { 8,10}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12
Deposit ( acmount = 5 ); total_deposit = 12; depositedRanges
= { 2: Range { 0, 2 }, 10: Range { 8,10}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( acmount = 5 ); total_deposit = 17; depositedRanges
= { 2: Range { 0, 2 }, 10: Range { 8,10}, 17: Range {12,17}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Exit ( Range { 12, 14 } ); total_deposit =
17; depositedRanges = { 2: Range { 0, 2 }, 10: Range { 8,10}, 17: Range {12,17}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Exit ( Range { 12, 14 } ); total_deposit =
17; depositedRanges = { 2: Range { 0, 2 }, 10: Range { 8,10}, 17: Range {14,17}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
How do I know deposited_range_id? 方法①:ルートチェーンから発行されるイベントを 全て捜査してクライアント側で構築 方法②:DepositedRanges の Map
の実装を平衡二分探索木などを 用いて key をBinarySearch