Skip to content

Commit

Permalink
Adding Location to the ChainConfig
Browse files Browse the repository at this point in the history
For the filter on the ForkId we need the location on the chainconfig
  • Loading branch information
gameofpointers committed Sep 15, 2023
1 parent fa2367e commit 0a7d1fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if !ctx.GlobalBool(LocalFlag.Name) {
cfg.Genesis.Nonce = ctx.GlobalUint64(GenesisNonceFlag.Name)
}

cfg.Genesis.Config.SetLocation(common.NodeLocation)
}

// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if
Expand Down
13 changes: 10 additions & 3 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ var (
//
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
AllProgpowProtocolChanges = &ChainConfig{big.NewInt(1337), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Hash{}}
AllProgpowProtocolChanges = &ChainConfig{big.NewInt(1337), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Hash{}, common.NodeLocation}

TestChainConfig = &ChainConfig{big.NewInt(1), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Hash{}}
TestChainConfig = &ChainConfig{big.NewInt(1), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Hash{}, common.NodeLocation}
TestRules = TestChainConfig.Rules(new(big.Int))
)

Expand All @@ -130,6 +130,12 @@ type ChainConfig struct {
Blake3Pow *Blake3powConfig `json:"blake3pow,omitempty"`
Progpow *ProgpowConfig `json:"progpow,omitempty"`
GenesisHash common.Hash
Location common.Location
}

// SetLocation sets the location on the chain config
func (cfg *ChainConfig) SetLocation(location common.Location) {
cfg.Location = location
}

// Blake3powConfig is the consensus engine configs for proof-of-work based sealing.
Expand Down Expand Up @@ -159,9 +165,10 @@ func (c *ChainConfig) String() string {
default:
engine = "unknown"
}
return fmt.Sprintf("{ChainID: %v, Engine: %v}",
return fmt.Sprintf("{ChainID: %v, Engine: %v, Location: %v}",
c.ChainID,
engine,
c.Location,
)
}

Expand Down

0 comments on commit 0a7d1fc

Please sign in to comment.