Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

L2 totalGRTBurned / totalGRTMinted include bridge burns/mints (~99% of "burned" is L2→L1 withdrawals)

未关闭 适合新手
#337 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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 GRT
  • totalGRTWithdrawn = 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

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, or totalGRTBurnedExcludingBridge / totalGRTMintedExcludingBridge, to GraphNetwork, updated in handleWithdrawalInitiated / handleDepositFinalized. The token Transfer comes before the gateway event in the same tx, so subtracting there works. Or handle BridgeBurned / BridgeMinted on L2GraphToken.
  • At minimum, document in schema.graphql that 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

graphprotocol/graph-network-subgraph 的其他 Issue

查看 graphprotocol/graph-network-subgraph 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。