Skip to content

Commit 75dce36

Browse files
CoderZhienvestcc
andauthored
adjust wake block interval and block reward (#4637)
--------- Co-authored-by: Chen Chen <chen1233216@hotmail.com>
1 parent d932b99 commit 75dce36

File tree

6 files changed

+20
-25
lines changed

6 files changed

+20
-25
lines changed

action/protocol/rewarding/reward_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestProtocol_GrantBlockReward(t *testing.T) {
4242
isWakeBlock bool
4343
}{
4444
{big.NewInt(10), big.NewInt(200), false},
45-
{big.NewInt(48), big.NewInt(300), true},
45+
{big.NewInt(40), big.NewInt(300), true},
4646
} {
4747
testProtocol(t, func(t *testing.T, ctx context.Context, sm protocol.StateManager, p *Protocol) {
4848
if tv.isWakeBlock {

blockchain/genesis/genesis.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ func defaultConfig() Genesis {
4242
Timestamp: 1553558500,
4343
BlockGasLimit: 20000000,
4444
TsunamiBlockGasLimit: 50000000,
45-
WakeBlockGasLimit: 30000000,
45+
WakeBlockGasLimit: 25000000,
4646
ActionGasLimit: 5000000,
4747
BlockInterval: 10 * time.Second,
4848
NumSubEpochs: 15,
4949
DardanellesNumSubEpochs: 30,
50-
WakeNumSubEpochs: 50,
50+
WakeNumSubEpochs: 60,
5151
NumDelegates: 24,
5252
NumCandidateDelegates: 36,
5353
TimeBasedRotation: true,
@@ -159,7 +159,7 @@ func defaultConfig() Genesis {
159159
FoundationBonusP2StartEpoch: 9698,
160160
FoundationBonusP2EndEpoch: 18458,
161161
ProductivityThreshold: 85,
162-
WakeBlockRewardStr: "4800000000000000000",
162+
WakeBlockRewardStr: "4000000000000000000",
163163
},
164164
Staking: Staking{
165165
VoteWeightCalConsts: VoteWeightCalConsts{

blockchain/genesis/genesis_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ func TestTsunamiBlockGasLimit(t *testing.T) {
7272
{cfg.TsunamiBlockHeight - 1, 20000000},
7373
{cfg.TsunamiBlockHeight, 50000000},
7474
{cfg.WakeBlockHeight - 1, 50000000},
75-
{cfg.WakeBlockHeight, 30000000},
76-
{cfg.ToBeEnabledBlockHeight, 30000000},
75+
{cfg.WakeBlockHeight, 25000000},
76+
{cfg.ToBeEnabledBlockHeight, 25000000},
7777
} {
7878
r.Equal(v.gasLimit, cfg.BlockGasLimitByHeight(v.height))
7979
}
@@ -119,13 +119,8 @@ func TestDeployerWhitelist(t *testing.T) {
119119

120120
func TestWakeBlockReward(t *testing.T) {
121121
r := require.New(t)
122-
four, five := unit.ConvertIotxToRau(4), unit.ConvertIotxToRau(5)
123-
four.Add(four, five)
124-
four.Rsh(four, 1)
125122
wake := Default.WakeBlockReward()
126-
// wake block reward = 4.8, between 4.5 and 5
127-
r.Equal(1, wake.Cmp(four))
128-
r.Equal(-1, wake.Cmp(five))
123+
r.Equal(0, wake.Cmp(unit.ConvertIotxToRau(4)))
129124
}
130125

131126
func TestGenesisMapEmpty(t *testing.T) {

chainservice/builder_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func TestEstimateTipHeight(t *testing.T) {
2525
blk, err = block.NewBuilder(block.RunnableActions{}).SetHeight(cfg.Genesis.WakeBlockHeight - 3).SignAndBuild(sk)
2626
r.NoError(err)
2727
r.Equal(blk.Height()+2, estimateTipHeight(&cfg, &blk, 10*time.Second))
28-
r.Equal(blk.Height()+3, estimateTipHeight(&cfg, &blk, 13*time.Second))
29-
r.Equal(blk.Height()+3, estimateTipHeight(&cfg, &blk, 15*time.Second))
28+
r.Equal(blk.Height()+3, estimateTipHeight(&cfg, &blk, 12500*time.Millisecond))
29+
r.Equal(blk.Height()+3, estimateTipHeight(&cfg, &blk, 14500*time.Millisecond))
3030
})
3131
t.Run("before dardanelles", func(t *testing.T) {
3232
blk, err := block.NewBuilder(block.RunnableActions{}).SetHeight(cfg.Genesis.DardanellesBlockHeight - 100).SignAndBuild(sk)
@@ -39,9 +39,9 @@ func TestEstimateTipHeight(t *testing.T) {
3939
t.Run("after wake", func(t *testing.T) {
4040
blk, err := block.NewBuilder(block.RunnableActions{}).SetHeight(cfg.Genesis.WakeBlockHeight).SignAndBuild(sk)
4141
r.NoError(err)
42-
r.Equal(blk.Height()+1, estimateTipHeight(&cfg, &blk, 3*time.Second))
43-
r.Equal(blk.Height()+1, estimateTipHeight(&cfg, &blk, 5*time.Second))
44-
r.Equal(blk.Height()+2, estimateTipHeight(&cfg, &blk, 6*time.Second))
42+
r.Equal(blk.Height()+1, estimateTipHeight(&cfg, &blk, 2500*time.Millisecond))
43+
r.Equal(blk.Height()+1, estimateTipHeight(&cfg, &blk, 4*time.Second))
44+
r.Equal(blk.Height()+2, estimateTipHeight(&cfg, &blk, 5*time.Second))
4545
})
4646
}
4747

consensus/consensusfsm/consensus_ttl.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ var (
2525
}
2626
// DefaultWakeUpgradeConfig is the default config for wake upgrade
2727
DefaultWakeUpgradeConfig = WakeUpgrade{
28-
UnmatchedEventTTL: 2 * time.Second,
28+
UnmatchedEventTTL: 1500 * time.Millisecond,
2929
UnmatchedEventInterval: 100 * time.Millisecond,
30-
AcceptBlockTTL: 1 * time.Second,
31-
AcceptProposalEndorsementTTL: time.Second,
32-
AcceptLockEndorsementTTL: 500 * time.Millisecond,
33-
CommitTTL: 500 * time.Millisecond,
34-
BlockInterval: 3 * time.Second,
30+
AcceptBlockTTL: 800 * time.Millisecond,
31+
AcceptProposalEndorsementTTL: 800 * time.Millisecond,
32+
AcceptLockEndorsementTTL: 450 * time.Millisecond,
33+
CommitTTL: 450 * time.Millisecond,
34+
BlockInterval: 2500 * time.Millisecond,
3535
}
3636
)
3737

consensus/consensusfsm/consensus_ttl_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ func TestConsensusConfig_BlockInterval(t *testing.T) {
3434
{
3535
name: "At Wake height",
3636
height: cfg.Genesis.WakeBlockHeight,
37-
expectedResult: 3 * time.Second,
37+
expectedResult: 2500 * time.Millisecond,
3838
},
3939
{
4040
name: "After Wake height",
4141
height: cfg.Genesis.WakeBlockHeight + 1,
42-
expectedResult: 3 * time.Second,
42+
expectedResult: 2500 * time.Millisecond,
4343
},
4444
}
4545

0 commit comments

Comments
 (0)