Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie committed Feb 17, 2023
1 parent 985399b commit 27738df
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions action/protocol/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ func WithFeatureCtx(ctx context.Context) context.Context {
FixUnproductiveDelegates: g.IsOkhotsk(height),
CorrectGasRefund: g.IsOkhotsk(height),
FixRewardErroCheckPosition: g.IsOkhotsk(height),
EnableWeb3Rewarding: g.IsQueensland(height),
EnableNodeInfo: g.IsQueensland(height),
EnableWeb3Rewarding: g.IsPalau(height),
EnableNodeInfo: g.IsPalau(height),
},
)
}
Expand Down
2 changes: 1 addition & 1 deletion api/coreservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func (core *coreService) validateChainID(chainID uint32) error {
}

func (core *coreService) validateWeb3Rewarding(selp action.SealedEnvelope) error {
if ge := core.bc.Genesis(); ge.IsQueensland(core.bc.TipHeight()) || selp.Encoding() != uint32(iotextypes.Encoding_ETHEREUM_RLP) {
if ge := core.bc.Genesis(); ge.IsPalau(core.bc.TipHeight()) || selp.Encoding() != uint32(iotextypes.Encoding_ETHEREUM_RLP) {
return nil
}
switch selp.Action().(type) {
Expand Down
4 changes: 2 additions & 2 deletions api/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ type BatchWriter struct {
// NewBatchWriter returns a new BatchWriter
func NewBatchWriter(singleWriter Web3ResponseWriter) *BatchWriter {
return &BatchWriter{
writer: singleWriter,
buf: make([]json.RawMessage, 0),
writer: singleWriter,
buf: make([]json.RawMessage, 0),
}
}

Expand Down
12 changes: 6 additions & 6 deletions blockchain/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func defaultConfig() Genesis {
MidwayBlockHeight: 16509241,
NewfoundlandBlockHeight: 17662681,
OkhotskBlockHeight: 21542761,
QueenslandBlockHeight: 31542761,
PalauBlockHeight: 31542761,
ToBeEnabledBlockHeight: math.MaxUint64,
},
Account: Account{
Expand Down Expand Up @@ -226,10 +226,10 @@ type (
// 3. fix gas and nonce update
// 4. fix unproductive delegates in staking protocol
OkhotskBlockHeight uint64 `yaml:"okhotskHeight"`
// QueenslandBlockHeight is the the start height to
// PalauBlockHeight is the the start height to
// 1. enable rewarding action via web3
// 2. broadcast node info into the p2p network
QueenslandBlockHeight uint64 `yaml:"queenslandHeight"`
PalauBlockHeight uint64 `yaml:"palauHeight"`
// ToBeEnabledBlockHeight is a fake height that acts as a gating factor for WIP features
// upon next release, change IsToBeEnabled() to IsNextHeight() for features to be released
ToBeEnabledBlockHeight uint64 `yaml:"toBeEnabledHeight"`
Expand Down Expand Up @@ -545,9 +545,9 @@ func (g *Blockchain) IsOkhotsk(height uint64) bool {
return g.isPost(g.OkhotskBlockHeight, height)
}

// IsQueensland checks whether height is equal to or larger than queensland height
func (g *Blockchain) IsQueensland(height uint64) bool {
return g.isPost(g.QueenslandBlockHeight, height)
// IsPalau checks whether height is equal to or larger than palau height
func (g *Blockchain) IsPalau(height uint64) bool {
return g.isPost(g.PalauBlockHeight, height)
}

// IsToBeEnabled checks whether height is equal to or larger than toBeEnabled height
Expand Down
6 changes: 3 additions & 3 deletions blockchain/genesis/heightupgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func TestNewHeightChange(t *testing.T) {
require.True(cfg.IsNewfoundland(uint64(17662681)))
require.False(cfg.IsOkhotsk(uint64(21542760)))
require.True(cfg.IsOkhotsk(uint64(21542761)))
require.False(cfg.IsQueensland(uint64(31542760)))
require.True(cfg.IsQueensland(uint64(31542761)))
require.False(cfg.IsPalau(uint64(31542760)))
require.True(cfg.IsPalau(uint64(31542761)))

require.Equal(cfg.PacificBlockHeight, uint64(432001))
require.Equal(cfg.AleutianBlockHeight, uint64(864001))
Expand All @@ -74,5 +74,5 @@ func TestNewHeightChange(t *testing.T) {
require.Equal(cfg.MidwayBlockHeight, uint64(16509241))
require.Equal(cfg.NewfoundlandBlockHeight, uint64(17662681))
require.Equal(cfg.OkhotskBlockHeight, uint64(21542761))
require.Equal(cfg.QueenslandBlockHeight, uint64(31542761))
require.Equal(cfg.PalauBlockHeight, uint64(31542761))
}
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ func ValidateForkHeights(cfg Config) error {
return errors.Wrap(ErrInvalidCfg, "Midway is heigher than Newfoundland")
case hu.NewfoundlandBlockHeight > hu.OkhotskBlockHeight:
return errors.Wrap(ErrInvalidCfg, "Newfoundland is heigher than Okhotsk")
case hu.OkhotskBlockHeight > hu.QueenslandBlockHeight:
return errors.Wrap(ErrInvalidCfg, "Okhotsk is heigher than Queensland")
case hu.OkhotskBlockHeight > hu.PalauBlockHeight:
return errors.Wrap(ErrInvalidCfg, "Okhotsk is heigher than Palau")
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func TestValidateForkHeights(t *testing.T) {
"Newfoundland", ErrInvalidCfg, "Newfoundland is heigher than Okhotsk",
},
{
"Okhotsk", ErrInvalidCfg, "Okhotsk is heigher than Queensland",
"Okhotsk", ErrInvalidCfg, "Okhotsk is heigher than Palau",
},
{
"", nil, "",
Expand Down Expand Up @@ -419,7 +419,7 @@ func newTestCfg(fork string) Config {
case "Newfoundland":
cfg.Genesis.NewfoundlandBlockHeight = cfg.Genesis.OkhotskBlockHeight + 1
case "Okhotsk":
cfg.Genesis.OkhotskBlockHeight = cfg.Genesis.QueenslandBlockHeight + 1
cfg.Genesis.OkhotskBlockHeight = cfg.Genesis.PalauBlockHeight + 1
}
return cfg
}
Expand Down
2 changes: 1 addition & 1 deletion e2etest/nodeinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func newConfigForNodeInfoTest(triePath, dBPath, idxDBPath string) (config.Config
if err != nil {
return cfg, nil, err
}
cfg.Genesis.QueenslandBlockHeight = 0
cfg.Genesis.PalauBlockHeight = 0
testTriePath, err := testutil.PathOfTempFile(triePath)
if err != nil {
return cfg, nil, err
Expand Down
6 changes: 3 additions & 3 deletions nodeinfo/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestNewDelegateManager(t *testing.T) {
hMock.EXPECT().TipHeight().Return(uint64(2)).MinTimes(1)
hMock.EXPECT().Genesis().DoAndReturn(func() genesis.Genesis {
g := genesis.TestDefault()
g.QueenslandBlockHeight = 1
g.PalauBlockHeight = 1
return g
}).MinTimes(1)
err := dm.Start(context.Background())
Expand All @@ -69,7 +69,7 @@ func TestNewDelegateManager(t *testing.T) {
hMock.EXPECT().TipHeight().Return(uint64(10)).MinTimes(1)
hMock.EXPECT().Genesis().DoAndReturn(func() genesis.Genesis {
g := genesis.TestDefault()
g.QueenslandBlockHeight = 1
g.PalauBlockHeight = 1
return g
}).MinTimes(1)
tMock.EXPECT().BroadcastOutbound(gomock.Any(), gomock.Any()).Return(nil).MinTimes(1)
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestNewDelegateManager(t *testing.T) {
hMock.EXPECT().TipHeight().Return(uint64(10)).MinTimes(1)
hMock.EXPECT().Genesis().DoAndReturn(func() genesis.Genesis {
g := genesis.TestDefault()
g.QueenslandBlockHeight = 1
g.PalauBlockHeight = 1
return g
}).MinTimes(1)
tMock.EXPECT().BroadcastOutbound(gomock.Any(), gomock.Any()).Return(nil).MinTimes(1)
Expand Down

0 comments on commit 27738df

Please sign in to comment.