Closed ziogaschr closed 1 year ago
Note: I still want to test the functionality while running in --dev
mode
Two new fields are added to the Genesis type: ExcessBlobGas
and BlobGasUsed
. While these, along with BaseFee
, are relevant to ETHereum chains, they are not relevant for all chains that core-geth supports, resulting in empty (null
) fields.
What do you think about adding omitempty
tags for these fields?
diff --git a/params/types/genesisT/gen_genesis.go b/params/types/genesisT/gen_genesis.go
index 0136309ee6..12f3d10b05 100644
--- a/params/types/genesisT/gen_genesis.go
+++ b/params/types/genesisT/gen_genesis.go
@@ -33,9 +33,9 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
Number math.HexOrDecimal64 `json:"number"`
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"`
- BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"`
- ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas"`
- BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed"`
+ BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas,omitempty"`
+ ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas,omitempty"`
+ BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty"`
}
var enc Genesis
enc.Config = g.Config
diff --git a/params/types/genesisT/genesis.go b/params/types/genesisT/genesis.go
index f2be54ec74..97676daee0 100644
--- a/params/types/genesisT/genesis.go
+++ b/params/types/genesisT/genesis.go
@@ -55,9 +55,9 @@ type Genesis struct {
Number uint64 `json:"number"`
GasUsed uint64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"`
- BaseFee *big.Int `json:"baseFeePerGas"` // EIP-1559
- ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844
- BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844
+ BaseFee *big.Int `json:"baseFeePerGas,omitempty"` // EIP-1559
+ ExcessBlobGas *uint64 `json:"excessBlobGas,omitempty"` // EIP-4844
+ BlobGasUsed *uint64 `json:"blobGasUsed,omitempty"` // EIP-4844
}
func (g *Genesis) GetElasticityMultiplier() uint64 {
Two new fields are added to the Genesis type:
ExcessBlobGas
andBlobGasUsed
. While these, along withBaseFee
, are relevant to ETHereum chains, they are not relevant for all chains that core-geth supports, resulting in empty (null
) fields.What do you think about adding
omitempty
tags for these fields?diff --git a/params/types/genesisT/gen_genesis.go b/params/types/genesisT/gen_genesis.go index 0136309ee6..12f3d10b05 100644 --- a/params/types/genesisT/gen_genesis.go +++ b/params/types/genesisT/gen_genesis.go @@ -33,9 +33,9 @@ func (g Genesis) MarshalJSON() ([]byte, error) { Number math.HexOrDecimal64 `json:"number"` GasUsed math.HexOrDecimal64 `json:"gasUsed"` ParentHash common.Hash `json:"parentHash"` - BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"` - ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas"` - BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed"` + BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas,omitempty"` + ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas,omitempty"` + BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty"` } var enc Genesis enc.Config = g.Config diff --git a/params/types/genesisT/genesis.go b/params/types/genesisT/genesis.go index f2be54ec74..97676daee0 100644 --- a/params/types/genesisT/genesis.go +++ b/params/types/genesisT/genesis.go @@ -55,9 +55,9 @@ type Genesis struct { Number uint64 `json:"number"` GasUsed uint64 `json:"gasUsed"` ParentHash common.Hash `json:"parentHash"` - BaseFee *big.Int `json:"baseFeePerGas"` // EIP-1559 - ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844 - BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844 + BaseFee *big.Int `json:"baseFeePerGas,omitempty"` // EIP-1559 + ExcessBlobGas *uint64 `json:"excessBlobGas,omitempty"` // EIP-4844 + BlobGasUsed *uint64 `json:"blobGasUsed,omitempty"` // EIP-4844 } func (g *Genesis) GetElasticityMultiplier() uint64 {
Makes sense to me too. Might be that a test can break, in case they check for this fields, but maybe it makes sense to modify those tests as well.
Yea, my rationale for removing them is mostly based on the pattern of extensive use of omitempty
in the chain config types, which is obviously a closely related data type. So I would infer and assume that similar tests would be used for both data types, and that therefore checks for the existence or absence of fields should have similar expectations (permitting, or even expecting, that zero-value fields are omitted).
Merges ethereum/go-ethereum branch release/1.12.2 to core-geth master.
Notes
--dev
mode? We still allow use--dev.pow
for ethash. 9d4ea2e83fc21b41135984363a06334aff106055withdrawalsRoot
while the Block itself can havewithdrawals
. 23da7ca9d6ae460324a766a0830b4275b8dc9764 ...TODO
RemovePendingTransaction
, as it's not working now that blobpool has been added Ref: https://github.com/etclabscore/core-geth/pull/203--dev
mode works https://github.com/etclabscore/core-geth/pull/560#issuecomment-1698943446