Skip to content

Commit

Permalink
Refactor params config (ava-labs#634)
Browse files Browse the repository at this point in the history
* get upgrade configs from context

* fix chainIDs

* fix avago version

* commment out override

* Remove comment out code

* use network ID rather than chain ID

* refactor params config

* update avago

* rename

* fix runtime networks

* Update params/network_upgrades.go

Signed-off-by: Darioush Jalali <darioush.jalali@avalabs.org>

---------

Signed-off-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
  • Loading branch information
2 people authored and oxbee committed Nov 6, 2024
1 parent e0fbe92 commit f738a58
Show file tree
Hide file tree
Showing 14 changed files with 1,024 additions and 931 deletions.
26 changes: 14 additions & 12 deletions core/state_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,20 @@ func TestStateProcessorErrors(t *testing.T) {
db = rawdb.NewMemoryDatabase()
gspec = &Genesis{
Config: &params.ChainConfig{
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
ApricotPhase1BlockTimestamp: utils.NewUint64(0),
ApricotPhase2BlockTimestamp: utils.NewUint64(0),
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
NetworkUpgrades: params.NetworkUpgrades{
ApricotPhase1BlockTimestamp: utils.NewUint64(0),
ApricotPhase2BlockTimestamp: utils.NewUint64(0),
},
},
Alloc: GenesisAlloc{
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
Expand Down
34 changes: 18 additions & 16 deletions core/vm/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,24 @@ type Config struct {
func setDefaults(cfg *Config) {
if cfg.ChainConfig == nil {
cfg.ChainConfig = &params.ChainConfig{
ChainID: big.NewInt(1),
HomesteadBlock: new(big.Int),
DAOForkBlock: new(big.Int),
DAOForkSupport: false,
EIP150Block: new(big.Int),
EIP155Block: new(big.Int),
EIP158Block: new(big.Int),
ByzantiumBlock: new(big.Int),
ConstantinopleBlock: new(big.Int),
PetersburgBlock: new(big.Int),
IstanbulBlock: new(big.Int),
MuirGlacierBlock: new(big.Int),
ApricotPhase1BlockTimestamp: new(uint64),
ApricotPhase2BlockTimestamp: new(uint64),
ApricotPhase3BlockTimestamp: new(uint64),
ApricotPhase4BlockTimestamp: new(uint64),
ChainID: big.NewInt(1),
HomesteadBlock: new(big.Int),
DAOForkBlock: new(big.Int),
DAOForkSupport: false,
EIP150Block: new(big.Int),
EIP155Block: new(big.Int),
EIP158Block: new(big.Int),
ByzantiumBlock: new(big.Int),
ConstantinopleBlock: new(big.Int),
PetersburgBlock: new(big.Int),
IstanbulBlock: new(big.Int),
MuirGlacierBlock: new(big.Int),
NetworkUpgrades: params.NetworkUpgrades{
ApricotPhase1BlockTimestamp: new(uint64),
ApricotPhase2BlockTimestamp: new(uint64),
ApricotPhase3BlockTimestamp: new(uint64),
ApricotPhase4BlockTimestamp: new(uint64),
},
}
}

Expand Down
28 changes: 15 additions & 13 deletions internal/ethapi/transaction_args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,21 @@ type backendMock struct {

func newBackendMock() *backendMock {
config := &params.ChainConfig{
ChainID: big.NewInt(42),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
ApricotPhase3BlockTimestamp: utils.NewUint64(1000),
ChainID: big.NewInt(42),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
NetworkUpgrades: params.NetworkUpgrades{
ApricotPhase3BlockTimestamp: utils.NewUint64(1000),
},
}
return &backendMock{
current: &types.Header{
Expand Down
Loading

0 comments on commit f738a58

Please # to comment.