L2 totalGRTBurned / totalGRTMinted include bridge burns/mints (~99% of "burned" is L2→L1 withdrawals)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 85/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- blockchain
調査の方向性
src/mappings/graphToken.ts の26-37行目から始める。そこではゼロアドレスとの間のすべての Transfer が totalGRTBurned/totalGRTMinted を増加させている。また src/mappings/l2Gateway.ts の6-41行目では、handleWithdrawalInitiated と handleDepositFinalized がすでに totalGRTWithdrawn/totalGRTDepositedConfirmed を追跡している。提案されている新しい GraphNetwork フィールド(同じ tx では token の Transfer が gateway イベントより先に発生するため、gateway ハンドラーで更新する)と、BridgeBurned/BridgeMinted の処理のどちらかを決定し、その後 schema.graphql を更新し、types を再生成し、サブグラフのテストとブロック 510908608/510908609 にわたる再現用 GraphQL クエリを実行して、totalGRTBurned が withdrawal に伴って動かなくなったことを確認する。
索引モデルが issue の本文から書いたものです。
説明
Priority: Not urgent, but please fix this in the next network subgraph update. The reported burn is wildly off.
Summary
On the Arbitrum network subgraph, GraphNetwork.totalGRTBurned counts the Transfer(account, 0x0) emitted by L2GraphToken.bridgeBurn when users withdraw GRT to L1 through L2GraphTokenGateway. Likewise, totalGRTMinted counts bridgeMint on deposits. Those tokens aren't destroyed or newly issued. They're released from, or locked in, the L1 BridgeEscrow.
Numbers
At Arbitrum block 512,550,079:
totalGRTBurned= 1,326,791,691.745 GRTtotalGRTWithdrawn= 1,316,538,491.385 GRT (99.23% of "burned")- Real burns (HorizonStaking, L2Curation, GraphPayments) = 10,253,200.360 GRT
totalGRTMinted= 4,556,212,688.651 GRT, of which bridge deposits (totalGRTDepositedConfirmed) = 3,689,732,064.311 GRT
L1 totalGRTBurned at Ethereum block 26,140,215 is 27,088,912.106 GRT and is not affected. Real burns across both chains are about 37.34M GRT. Adding the two subgraphs together gives about 1.354B GRT.
Verified to the wei against Arbitrum eth_getLogs: the 664,012 Transfer→0x0 logs sum exactly to totalGRTBurned; the 1,897 BridgeBurned events equal the 1,897 WithdrawalInitiated events and sum exactly to totalGRTWithdrawn.
Repro
{
before: graphNetwork(id: "1", block: {number: 510908608}) { totalGRTBurned totalGRTWithdrawn }
after: graphNetwork(id: "1", block: {number: 510908609}) { totalGRTBurned totalGRTWithdrawn }
}
A single 50M GRT withdrawal (tx 0xf5cf39ef9d300233fc458c9be7655979bf85eadb4d4374b2bbc5848addadfe22) increases totalGRTBurned by exactly 50,000,000. The tx contains only the token burn, BridgeBurned, and WithdrawalInitiated. There is no protocol burn in it.
Cause
src/mappings/graphToken.ts#L26-L37treats every Transfer to or from the zero address as a burn or mint.src/mappings/l2Gateway.ts#L6-L41incrementstotalGRTWithdrawn/totalGRTDepositedConfirmedwithout adjusting the burned/minted totals.
totalSupply itself is correct. Only the burned and minted totals are misleading when they're read as protocol burns and issuance.
Suggested fix (non-breaking)
- Add
totalGRTBurnedByBridge/totalGRTMintedByBridge, ortotalGRTBurnedExcludingBridge/totalGRTMintedExcludingBridge, toGraphNetwork, updated inhandleWithdrawalInitiated/handleDepositFinalized. The token Transfer comes before the gateway event in the same tx, so subtracting there works. Or handleBridgeBurned/BridgeMintedon L2GraphToken. - At minimum, document in
schema.graphqlthat the L2 values include bridge flows.
Workaround for consumers until then: realBurned = L1.totalGRTBurned + (L2.totalGRTBurned − L2.totalGRTWithdrawn) and realL2Minted = L2.totalGRTMinted − L2.totalGRTDepositedConfirmed.
- 主要言語
- TypeScript
- スター
- 82
- フォーク
- 47
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
graphprotocol/graph-network-subgraph のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 45/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
graphprotocol/graph-network-subgraph#270 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
graphprotocol/graph-network-subgraph#249 · コメント 5 件 ·
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
graphprotocol/graph-network-subgraph#173 · コメント 1 件 ·
graphprotocol/graph-network-subgraph の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
kind/chore priority/must
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sidereal-io/sidereal#380 ·
メンテナーはふだん 1 日以内に返信
-
Mend: dependency security vulnerability
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
opfab/operatorfabric-core#10653 ·
メンテナーはふだん 1 日以内に返信
-
backend bug size:sm
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
chrisbenincasa/tunarr#2237 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 半日 初心者へのやさしさ 69/100
Lam30ne/regulate-app#39 ·