Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#337 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
blockchain

Hướng nghiên cứu

Bắt đầu tại src/mappings/graphToken.ts dòng 26-37, nơi mọi Transfer tới/từ địa chỉ zero làm tăng totalGRTBurned/totalGRTMinted, và src/mappings/l2Gateway.ts dòng 6-41 nơi handleWithdrawalInitiated và handleDepositFinalized đã theo dõi totalGRTWithdrawn/totalGRTDepositedConfirmed. Quyết định giữa các trường GraphNetwork mới được đề xuất (được cập nhật trong các gateway handler, vì Transfer của token đi trước event của gateway trong cùng tx) hoặc xử lý BridgeBurned/BridgeMinted, sau đó cập nhật schema.graphql, tạo lại types và chạy các test của subgraph cùng query GraphQL tái hiện qua các block 510908608/510908609 để xác nhận totalGRTBurned không còn thay đổi theo withdrawal.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
82
Fork
47
Merge trung bình
7 ngày 3 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của graphprotocol/graph-network-subgraph

Tất cả issue của graphprotocol/graph-network-subgraph

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.