From 826a7c38d479338e6a2bc75f628b1e8fdefb3e62 Mon Sep 17 00:00:00 2001 From: Dustin Xie Date: Wed, 19 Jun 2024 17:30:04 -0700 Subject: [PATCH] enabling features at Upernavik height --- action/protocol/context.go | 14 +++++++------- .../handler_candidate_transfer_ownership_test.go | 2 +- .../protocol/staking/handler_stake_migrate_test.go | 3 +-- blockchain/integrity/integrity_test.go | 2 +- e2etest/native_staking_test.go | 5 ++--- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/action/protocol/context.go b/action/protocol/context.go index 191939c5bc..d6757bcd8b 100644 --- a/action/protocol/context.go +++ b/action/protocol/context.go @@ -270,13 +270,13 @@ func WithFeatureCtx(ctx context.Context) context.Context { CandidateRegisterMustWithStake: !g.IsTsunami(height), DisableDelegateEndorsement: !g.IsTsunami(height), RefactorFreshAccountConversion: g.IsTsunami(height), - SuicideTxLogMismatchPanic: g.IsToBeEnabled(height), - PanicUnrecoverableError: g.IsToBeEnabled(height), - CandidateIdentifiedByOwner: !g.IsToBeEnabled(height), - UseTxContainer: g.IsToBeEnabled(height), - LimitedStakingContract: !g.IsToBeEnabled(height), - MigrateNativeStake: g.IsToBeEnabled(height), - AddClaimRewardAddress: g.IsToBeEnabled(height), + SuicideTxLogMismatchPanic: g.IsUpernavik(height), + PanicUnrecoverableError: g.IsUpernavik(height), + CandidateIdentifiedByOwner: !g.IsUpernavik(height), + UseTxContainer: g.IsUpernavik(height), + LimitedStakingContract: !g.IsUpernavik(height), + MigrateNativeStake: g.IsUpernavik(height), + AddClaimRewardAddress: g.IsUpernavik(height), }, ) } diff --git a/action/protocol/staking/handler_candidate_transfer_ownership_test.go b/action/protocol/staking/handler_candidate_transfer_ownership_test.go index 090379e7dc..bdd2cb94f1 100644 --- a/action/protocol/staking/handler_candidate_transfer_ownership_test.go +++ b/action/protocol/staking/handler_candidate_transfer_ownership_test.go @@ -213,7 +213,7 @@ func TestProtocol_HandleCandidateTransferOwnership(t *testing.T) { }) cfg := deepcopy.Copy(genesis.Default).(genesis.Genesis) cfg.TsunamiBlockHeight = 1 - cfg.ToBeEnabledBlockHeight = 1 // enable candidate owner transfer feature + cfg.UpernavikBlockHeight = 1 // enable candidate owner transfer feature ctx = genesis.WithGenesisContext(ctx, cfg) ctx = protocol.WithFeatureCtx(protocol.WithFeatureWithHeightCtx(ctx)) require.NoError(p.Validate(ctx, act, sm)) diff --git a/action/protocol/staking/handler_stake_migrate_test.go b/action/protocol/staking/handler_stake_migrate_test.go index 28fdfe2528..0f61f56714 100644 --- a/action/protocol/staking/handler_stake_migrate_test.go +++ b/action/protocol/staking/handler_stake_migrate_test.go @@ -66,8 +66,7 @@ func TestHandleStakeMigrate(t *testing.T) { cfg.RedseaBlockHeight = 1 cfg.SumatraBlockHeight = 1 cfg.TsunamiBlockHeight = 1 - cfg.UpernavikBlockHeight = 1000000 // not enabled - cfg.ToBeEnabledBlockHeight = 1 // enable CandidateIdentifiedByOwner feature + cfg.UpernavikBlockHeight = 2 // enable CandidateIdentifiedByOwner feature } initCfg(&cfg) diff --git a/blockchain/integrity/integrity_test.go b/blockchain/integrity/integrity_test.go index 799aa75535..cf21cb4dc3 100644 --- a/blockchain/integrity/integrity_test.go +++ b/blockchain/integrity/integrity_test.go @@ -993,7 +993,7 @@ func TestBlockchainHardForkFeatures(t *testing.T) { cfg.Genesis.RedseaBlockHeight = 2 cfg.Genesis.SumatraBlockHeight = 2 cfg.Genesis.TsunamiBlockHeight = 3 - cfg.Genesis.ToBeEnabledBlockHeight = 3 + cfg.Genesis.UpernavikBlockHeight = 4 cfg.Genesis.InitBalanceMap[identityset.Address(27).String()] = unit.ConvertIotxToRau(10000000000).String() ctx := context.Background() diff --git a/e2etest/native_staking_test.go b/e2etest/native_staking_test.go index 501c6ae502..da8463b180 100644 --- a/e2etest/native_staking_test.go +++ b/e2etest/native_staking_test.go @@ -530,7 +530,7 @@ func TestNativeStaking(t *testing.T) { cfg.Genesis.FbkMigrationBlockHeight = 1 cfg.Genesis.TsunamiBlockHeight = 2 cfg.Genesis.EndorsementWithdrawWaitingBlocks = 10 - cfg.Genesis.ToBeEnabledBlockHeight = 3 // enable CandidateIdentifiedByOwner feature + cfg.Genesis.UpernavikBlockHeight = 3 // enable CandidateIdentifiedByOwner feature t.Run("test native staking", func(t *testing.T) { testNativeStaking(cfg, t) @@ -629,8 +629,7 @@ func TestCandidateTransferOwnership(t *testing.T) { cfg.Genesis.RedseaBlockHeight = 1 cfg.Genesis.SumatraBlockHeight = 1 cfg.Genesis.TsunamiBlockHeight = 1 - cfg.Genesis.UpernavikBlockHeight = 1000000 // not enabled - cfg.Genesis.ToBeEnabledBlockHeight = 1 // enable CandidateIdentifiedByOwner feature + cfg.Genesis.UpernavikBlockHeight = 2 // enable CandidateIdentifiedByOwner feature return cfg } registerAmount, _ := big.NewInt(0).SetString("1200000000000000000000000", 10)