You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
不同于 Cosmos SDK 中的 gas meter,Greenfield Blockchain 重新设计了 [gashub 模块](https://github.com/bnb-chain/greenfield-cosmos-sdk/blob/b5c75cfd81109a236b8b1e1fae3c5574d2d3d172/x/gashub/module.go#L16),以根据交易的类型和内容来计算 gas 消耗量,而不仅仅是存储和计算资源的消耗量。
29
+
30
+
与以太坊等网络不同,greenfield 交易没有 gas 价格字段。相反,它们由 fee 和 gas-wanted 组成。在交易预执行过程中,通过费用/需要的 gas 来推断 gas 价格,交易根据 gas 价格进行排队,此外,gas 价格不应低于 Greenfield 的最低 gas 价格:5gwei。
31
+
32
+
## GasHub
33
+
34
+
所有交易类型都需要将其 gas 计算逻辑注册到 gashub。目前支持 [四种类型](https://github.com/bnb-chain/greenfield-cosmos-sdk/blob/b5c75cfd81109a236b8b1e1fae3c5574d2d3d172/proto/cosmos/gashub/v1beta1/gashub.proto#L21) 的计算逻辑:
35
+
36
+
## Block Gas Meter
37
+
38
+
ctx.BlockGasMeter() 用作 gas meter,旨在监控和限制每个 block 的 gas 消耗量。
39
+
40
+
然而,某些类型的交易可能会在 greenfield 产生高昂的成本,导致大量的 gas 消耗。因此,Greenfield 不会对区块施加任何 gas 使用限制。相反,Greenfield 设置了区块大小限制,防止区块大小超过 1MB,并降低区块过大的风险。
0 commit comments