L2 totalGRTBurned / totalGRTMinted include bridge burns/mints (~99% of "burned" is L2→L1 withdrawals)
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 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.
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của graphprotocol/graph-network-subgraph
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 45/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
graphprotocol/graph-network-subgraph#270 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
graphprotocol/graph-network-subgraph#249 · 5 bình luận ·
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
graphprotocol/graph-network-subgraph#173 · 1 bình luận ·
Tất cả issue của graphprotocol/graph-network-subgraph
Issue tương tự
-
bug priority: P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
wayfinder:task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug customer-reported data-plane question Service Attention Storage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Azure/azure-rest-api-specs#47397 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Claude thinking budget can shrink capped Haiku responses to 2,048 tokensCó thể đã có người làm @DavyMassoneto đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
diegosouzapw/OmniRoute#17109 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
paperclipai/paperclip#16785 ·
Maintainer thường phản hồi trong vòng 1 ngày