L2 totalGRTBurned / totalGRTMinted include bridge burns/mints (~99% of "burned" is L2→L1 withdrawals)
还没有人认领这个 Issue。
评估
- 难度
- 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 字段(在 gateway handler 中更新,因为同一 tx 中 token 的 Transfer 先于 gateway 事件)和处理 BridgeBurned/BridgeMinted 之间做出决定,然后更新 schema.graphql,重新生成 types,并运行 subgraph 的测试以及跨区块 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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
-
[bug] diagnostics.dumpBody:Buffer 形态请求(透传 lane)跳过 dumps/ 落盘,仅留 raw/-unknown-可能已有人在做 @ranxianglei 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
ranxianglei/billion-context#2421 · 2 条评论 ·
维护者通常 1 天内回复
-
pending triage
难度 2/5 1-3 小时 新手友好度 76/100
nuxt/test-utils#1842 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
MoonshotAI/kimi-code#4146 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
farbenmeer/tapi#531 ·
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复