Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix forcenet #5733

Merged
merged 3 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions fixtures/networks/butterfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ func ButterflySnapNet() *NetworkConf {
UpgradeSharkHeight: -20,
UpgradeHyggeHeight: 600,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
Eip155ChainID: 3141592,
ActorDebugging: false,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
AllowableClockDriftSecs: 1,
Eip155ChainID: 3141592,
ActorDebugging: false,
},
}
}
11 changes: 6 additions & 5 deletions fixtures/networks/calibration.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ func Calibration() *NetworkConf {
UpgradeSharkHeight: 16800,
UpgradeHyggeHeight: 322354, // 2023-02-21T16:30:00Z
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 10,
Eip155ChainID: 314159,
ActorDebugging: false,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 10,
AllowableClockDriftSecs: 1,
Eip155ChainID: 314159,
ActorDebugging: false,
},
}
}
15 changes: 8 additions & 7 deletions fixtures/networks/forcenet.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func ForceNet() *NetworkConf {
Network: config.NetworkParamsConfig{
DevNet: true,
NetworkType: types.NetworkForce,
GenesisNetworkVersion: network.Version18,
GenesisNetworkVersion: network.Version17,
ReplaceProofTypes: []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg8MiBV1,
abi.RegisteredSealProof_StackedDrg512MiBV1,
Expand Down Expand Up @@ -55,13 +55,14 @@ func ForceNet() *NetworkConf {
UpgradeOhSnapHeight: -18,
UpgradeSkyrHeight: -19,
UpgradeSharkHeight: -20,
UpgradeHyggeHeight: -21,
UpgradeHyggeHeight: 30,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: config.DrandMainnet},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 1,
Eip155ChainID: 31415926,
ActorDebugging: true,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: config.DrandMainnet},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 1,
AllowableClockDriftSecs: 1,
Eip155ChainID: 31415926,
ActorDebugging: true,
},
}
}
11 changes: 6 additions & 5 deletions fixtures/networks/hyperspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ func HyperspaceNet() *NetworkConf {
UpgradeSharkHeight: -20,
UpgradeHyggeHeight: -21,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
Eip155ChainID: 3141,
ActorDebugging: false,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
AllowableClockDriftSecs: 1,
Eip155ChainID: 3141,
ActorDebugging: false,
},
}
}
11 changes: 6 additions & 5 deletions fixtures/networks/integrationtestnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ func IntegrationNet() *NetworkConf {
UpgradeSharkHeight: 2383680,
UpgradeHyggeHeight: 99999999999999,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 5, 51000: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 10,
Eip155ChainID: 314,
ActorDebugging: false,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 5, 51000: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 10,
AllowableClockDriftSecs: 1,
Eip155ChainID: 314,
ActorDebugging: false,
},
}
}
11 changes: 6 additions & 5 deletions fixtures/networks/interopnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ func InteropNet() *NetworkConf {
UpgradeSharkHeight: -20,
UpgradeHyggeHeight: 99999999999999,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
Eip155ChainID: 3141592,
ActorDebugging: false,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
AllowableClockDriftSecs: 1,
Eip155ChainID: 3141592,
ActorDebugging: false,
},
}
}
11 changes: 6 additions & 5 deletions fixtures/networks/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ func Mainnet() *NetworkConf {
UpgradeSharkHeight: 2383680, // 2022-11-30T14:00:00Z
UpgradeHyggeHeight: 99999999999999,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 5, 51000: 1},
AddressNetwork: address.Mainnet,
PropagationDelaySecs: 10,
Eip155ChainID: 314,
ActorDebugging: false,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 5, 51000: 1},
AddressNetwork: address.Mainnet,
PropagationDelaySecs: 10,
AllowableClockDriftSecs: 1,
Eip155ChainID: 314,
ActorDebugging: false,
},
}
}
11 changes: 6 additions & 5 deletions fixtures/networks/net_2k.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ func Net2k() *NetworkConf {
UpgradeSharkHeight: -20,
UpgradeHyggeHeight: 30,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 1,
Eip155ChainID: 31415926,
ActorDebugging: true,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 1,
AllowableClockDriftSecs: 1,
Eip155ChainID: 31415926,
ActorDebugging: true,
},
}
}
3 changes: 3 additions & 0 deletions fixtures/networks/network_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ func SetConfigFromNetworkType(cfg *config.Config, networkType types.NetworkType)
if err != nil {
return err
}
oldAllowableClockDriftSecs := cfg.NetworkParams.AllowableClockDriftSecs
cfg.NetworkParams = &netcfg.Network
// not change, expect to adjust the value through the configuration file
cfg.NetworkParams.AllowableClockDriftSecs = oldAllowableClockDriftSecs
return nil
}

Expand Down
11 changes: 6 additions & 5 deletions fixtures/networks/wallaby.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ func WallabyNet() *NetworkConf {
UpgradeSharkHeight: -20,
UpgradeHyggeHeight: -21,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
Eip155ChainID: 31415,
ActorDebugging: false,
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
AllowableClockDriftSecs: 1,
Eip155ChainID: 31415,
ActorDebugging: false,
},
}
}
7 changes: 5 additions & 2 deletions pkg/migration/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,18 +382,21 @@ func Version11Upgrade(repoPath string) (err error) {
switch cfg.NetworkParams.NetworkType {
case types.NetworkMainnet:
cfg.NetworkParams.ForkUpgradeParam.UpgradeHyggeHeight = 99999999999999
cfg.NetworkParams.Eip155ChainID = 314
case types.Network2k:
cfg.NetworkParams.GenesisNetworkVersion = network.Version17
cfg.NetworkParams.ForkUpgradeParam.UpgradeHyggeHeight = 30
case types.NetworkCalibnet:
cfg.NetworkParams.ForkUpgradeParam.UpgradeHyggeHeight = 322354
cfg.NetworkParams.Eip155ChainID = 314159
case types.NetworkForce:
cfg.NetworkParams.GenesisNetworkVersion = network.Version18
cfg.NetworkParams.ForkUpgradeParam.UpgradeHyggeHeight = -21
cfg.NetworkParams.GenesisNetworkVersion = network.Version17
cfg.NetworkParams.ForkUpgradeParam.UpgradeHyggeHeight = 30
case types.NetworkInterop:
cfg.NetworkParams.ForkUpgradeParam.UpgradeHyggeHeight = 99999999999999
case types.NetworkButterfly:
cfg.NetworkParams.ForkUpgradeParam.UpgradeHyggeHeight = 600
cfg.NetworkParams.Eip155ChainID = 3141592
default:
return fsrRepo.Close()
}
Expand Down
14 changes: 6 additions & 8 deletions pkg/migration/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ func TestMigration(t *testing.T) {
types.NetworkButterfly: &networks.ButterflySnapNet().Network,
types.NetworkCalibnet: &networks.Calibration().Network,
types.NetworkMainnet: &networks.Mainnet().Network,
types.Integrationnet: &networks.IntegrationNet().Network,
}

for nt, paramsCfg := range cfgs {
cfg := config.NewDefaultConfig()
cfg.NetworkParams.NetworkType = nt
cfg.NetworkParams.AllowableClockDriftSecs = 10
repoPath := filepath.Join(os.TempDir(), fmt.Sprintf("TestMigration%d", time.Now().UnixNano()))

assert.Nil(t, repo.InitFSRepo(repoPath, 0, cfg))
Expand All @@ -39,13 +39,11 @@ func TestMigration(t *testing.T) {
fsRepo, err := repo.OpenFSRepo(repoPath, repo.LatestVersion)
assert.Nil(t, err)
newCfg := fsRepo.Config()
assert.Equal(t, paramsCfg.NetworkType, newCfg.NetworkParams.NetworkType)
assert.EqualValuesf(t, config.NewDefaultConfig().NetworkParams.ForkUpgradeParam, newCfg.NetworkParams.ForkUpgradeParam, fmt.Sprintf("current network type %d", paramsCfg.NetworkType))
errStr := fmt.Sprintf("current network type %d", paramsCfg.NetworkType)
assert.Equalf(t, paramsCfg.NetworkType, newCfg.NetworkParams.NetworkType, errStr)
assert.Equalf(t, uint64(0), newCfg.NetworkParams.BlockDelay, errStr)
assert.Equalf(t, paramsCfg.AllowableClockDriftSecs, newCfg.NetworkParams.AllowableClockDriftSecs, errStr)
assert.EqualValuesf(t, config.NewDefaultConfig().NetworkParams.ForkUpgradeParam, newCfg.NetworkParams.ForkUpgradeParam, errStr)
assert.NoError(t, fsRepo.Close())

cfgTmp, err := config.ReadFile(filepath.Join(repoPath, "config.json"))
assert.NoError(t, err)
assert.Equal(t, uint64(0), cfgTmp.NetworkParams.BlockDelay)
assert.Equal(t, paramsCfg.NetworkType, cfgTmp.NetworkParams.NetworkType)
}
}