Skip to content

Commit

Permalink
feat: ensures zero fee address is correctly set (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckartik authored Nov 27, 2024
1 parent 4672545 commit 7cb1fc1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 75 deletions.
8 changes: 8 additions & 0 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
cfg.Eth.OverrideVerkle = &v
}
if ctx.IsSet(utils.ZeroFeeAddressesFlag.Name) {
for _, addr := range ctx.StringSlice(utils.ZeroFeeAddressesFlag.Name) {
cfg.Eth.ZeroFeeAddresses = append(
cfg.Eth.ZeroFeeAddresses,
common.HexToAddress(strings.TrimSpace(addr)),
)
}
}
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)

// Create gauge with geth system and build information
Expand Down
1 change: 0 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,6 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheGCFlag.Name) {
cache.TrieDirtyLimit = ctx.Int(CacheFlag.Name) * ctx.Int(CacheGCFlag.Name) / 100
}

vmcfg := vm.Config{EnablePreimageRecording: ctx.Bool(VMEnableDebugFlag.Name)}
if ctx.IsSet(ZeroFeeAddressesFlag.Name) {
for _, addr := range ctx.StringSlice(ZeroFeeAddressesFlag.Name) {
Expand Down
1 change: 1 addition & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
var (
vmConfig = vm.Config{
EnablePreimageRecording: config.EnablePreimageRecording,
ZeroFeeAddresses: config.ZeroFeeAddresses,
}
cacheConfig = &core.CacheConfig{
TrieCleanLimit: config.TrieCleanCache,
Expand Down
3 changes: 3 additions & 0 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ type Config struct {

// OverrideVerkle (TODO: remove after the fork)
OverrideVerkle *uint64 `toml:",omitempty"`

// ZeroFeeAddresses is a list of addresses that are exempt from the zero fee policy.
ZeroFeeAddresses []common.Address `toml:",omitempty"`
}

// CreateConsensusEngine creates a consensus engine for the given chain config.
Expand Down
102 changes: 30 additions & 72 deletions geth-poa/genesis.json
Original file line number Diff line number Diff line change
@@ -1,74 +1,32 @@
{
"config": {
"chainId": 17864,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"cancunTime": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"clique": {
"period": 200,
"epoch": 30000
}
},
"nonce": "0x0",
"timestamp": "0x18E0A4E0D22",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000d9cd8E5DE6d55f796D980B818D350C0746C25b970000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x1c9c380",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0xBe3dEF3973584FdcC1326634aF188f0d9772D57D": {
"balance": "10000000000000000000000000000"
},
"0xd9cd8E5DE6d55f796D980B818D350C0746C25b97": {
"balance": "10000000000000000000000000000"
},
"0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4": {
"balance": "10000000000000000000000000000"
},
"0xf6ba5bca9b489de3a4ac3a57823d5d97d608feb9": {
"balance": "10000000000000000000000000000"
},
"0x0DCaa27B9E4Db92F820189345792f8eC5Ef148F6": {
"balance": "10000000000000000000000000000"
},
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266": {
"balance": "10000000000000000000000000000"
},
"0x3fab184622dc19b6109349b94811493bf2a45362": {
"balance": "10000000000000000000000000000"
},
"0xBcA333b67fb805aB18B4Eb7aa5a0B09aB25E5ce2": {
"balance": "10000000000000000000000000000"
},
"0xB9286CB4782E43A202BfD426AbB72c8cb34f886c": {
"balance": "10000000000000000000000000000"
},
"0x04F713A0b687c84D4F66aCd1423712Af6F852B78": {
"balance": "10000000000000000000000000000"
},
"0x82b941824b43F33e417be1E92273A3020a0D760c": {
"balance": "10000000000000000000000000000"
},
"0x57508f0B0f3426758F1f3D63ad4935a7c9383620": {
"balance": "10000000000000000000000000000"
},
"0xa51f13769d1466e0b5483cb719e89add8d615052": {
"balance": "10000000000000000000000000000"
},
"0x9a5a8ebd13951c8500c728c1982317a503b3e8ce": {
"balance": "10000000000000000000000000000"
}
"config": {
"chainId": 13923,
"terminalTotalDifficulty": 500,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"shanghaiTime": 0,
"cancunTime": 0,
"pragueTime": 0
},
"alloc": {
"0xc3bc246D6B0094C8B7D054f911F2bE3b07cE8A63": {
"balance": "999999999999911111"
}
}
},
"coinbase": "0x0000000000000000000000000000000000000000",
"difficulty": "0x0",
"extraData": "",
"gasLimit": "0x2fefd8",
"nonce": "0x0000000000000042",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/ethereum/go-ethereum

go 1.22.0

toolchain go1.23.1

require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0
github.com/Microsoft/go-winio v0.6.1
Expand Down

0 comments on commit 7cb1fc1

Please sign in to comment.