From 2e5b6b1e3e1c078d199701c2c56887ac0309d91c Mon Sep 17 00:00:00 2001 From: lumat Date: Thu, 25 Jun 2020 10:05:24 +0200 Subject: [PATCH] Introduce reward decrease at block 5000001 --- core/assets/assets.go | 84 ++++++++++++++++++++++------------------ core/config/mainnet.json | 4 ++ core/state_processor.go | 7 +++- 3 files changed, 56 insertions(+), 39 deletions(-) diff --git a/core/assets/assets.go b/core/assets/assets.go index fff70a681..f00766650 100644 --- a/core/assets/assets.go +++ b/core/assets/assets.go @@ -355,47 +355,55 @@ func init() { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3a, 0x20, 0x33, 0x36, 0x30, 0x30, 0x30, 0x30, 0x31, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x22, 0x62, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, - 0x65, 0x73, 0x22, 0x3a, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x5d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x2c, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x22, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, - 0x61, 0x70, 0x22, 0x3a, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x22, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x3a, 0x2f, 0x2f, - 0x63, 0x36, 0x65, 0x63, 0x39, 0x61, 0x66, 0x35, 0x30, 0x62, 0x65, 0x38, - 0x30, 0x34, 0x65, 0x33, 0x32, 0x62, 0x37, 0x33, 0x66, 0x30, 0x61, 0x32, - 0x34, 0x66, 0x31, 0x34, 0x35, 0x62, 0x35, 0x35, 0x30, 0x33, 0x35, 0x64, - 0x34, 0x38, 0x64, 0x61, 0x34, 0x34, 0x39, 0x37, 0x66, 0x39, 0x66, 0x31, - 0x63, 0x64, 0x66, 0x64, 0x38, 0x64, 0x66, 0x65, 0x36, 0x36, 0x39, 0x32, - 0x38, 0x38, 0x64, 0x64, 0x30, 0x61, 0x64, 0x33, 0x39, 0x39, 0x31, 0x38, - 0x62, 0x66, 0x64, 0x35, 0x39, 0x61, 0x33, 0x32, 0x65, 0x34, 0x61, 0x30, - 0x36, 0x38, 0x64, 0x61, 0x61, 0x65, 0x63, 0x31, 0x34, 0x36, 0x65, 0x32, - 0x33, 0x33, 0x38, 0x31, 0x63, 0x31, 0x30, 0x63, 0x37, 0x66, 0x35, 0x35, - 0x62, 0x34, 0x35, 0x66, 0x35, 0x38, 0x36, 0x65, 0x36, 0x61, 0x64, 0x31, - 0x34, 0x62, 0x32, 0x30, 0x37, 0x31, 0x62, 0x63, 0x40, 0x32, 0x31, 0x32, - 0x2e, 0x33, 0x32, 0x2e, 0x32, 0x35, 0x35, 0x2e, 0x38, 0x30, 0x3a, 0x33, - 0x31, 0x34, 0x34, 0x30, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x22, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x3a, 0x2f, 0x2f, - 0x33, 0x33, 0x66, 0x31, 0x63, 0x36, 0x61, 0x39, 0x66, 0x63, 0x37, 0x65, - 0x33, 0x32, 0x30, 0x37, 0x30, 0x62, 0x38, 0x64, 0x66, 0x61, 0x36, 0x35, - 0x34, 0x64, 0x64, 0x64, 0x31, 0x38, 0x66, 0x64, 0x33, 0x63, 0x63, 0x38, - 0x63, 0x31, 0x31, 0x66, 0x39, 0x66, 0x32, 0x31, 0x64, 0x33, 0x37, 0x31, - 0x34, 0x31, 0x34, 0x36, 0x33, 0x34, 0x65, 0x38, 0x63, 0x61, 0x63, 0x61, - 0x37, 0x35, 0x38, 0x61, 0x34, 0x31, 0x36, 0x36, 0x63, 0x35, 0x63, 0x61, - 0x63, 0x61, 0x37, 0x66, 0x35, 0x35, 0x35, 0x63, 0x30, 0x64, 0x38, 0x34, - 0x38, 0x31, 0x65, 0x38, 0x30, 0x34, 0x35, 0x32, 0x34, 0x39, 0x32, 0x64, - 0x31, 0x62, 0x34, 0x66, 0x62, 0x36, 0x62, 0x35, 0x63, 0x63, 0x37, 0x31, - 0x30, 0x32, 0x34, 0x38, 0x35, 0x38, 0x34, 0x39, 0x32, 0x66, 0x33, 0x35, - 0x63, 0x36, 0x33, 0x37, 0x33, 0x37, 0x64, 0x34, 0x40, 0x32, 0x31, 0x32, - 0x2e, 0x33, 0x32, 0x2e, 0x32, 0x35, 0x35, 0x2e, 0x31, 0x39, 0x35, 0x3a, - 0x33, 0x31, 0x34, 0x34, 0x30, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, - 0x0a, 0x7d, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x2c, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x20, + 0x22, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x22, 0x2c, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x22, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3a, 0x20, + 0x35, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x62, 0x61, 0x64, 0x48, 0x61, 0x73, + 0x68, 0x65, 0x73, 0x22, 0x3a, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x5d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x2c, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x22, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x22, 0x3a, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x22, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x3a, 0x2f, + 0x2f, 0x63, 0x36, 0x65, 0x63, 0x39, 0x61, 0x66, 0x35, 0x30, 0x62, 0x65, + 0x38, 0x30, 0x34, 0x65, 0x33, 0x32, 0x62, 0x37, 0x33, 0x66, 0x30, 0x61, + 0x32, 0x34, 0x66, 0x31, 0x34, 0x35, 0x62, 0x35, 0x35, 0x30, 0x33, 0x35, + 0x64, 0x34, 0x38, 0x64, 0x61, 0x34, 0x34, 0x39, 0x37, 0x66, 0x39, 0x66, + 0x31, 0x63, 0x64, 0x66, 0x64, 0x38, 0x64, 0x66, 0x65, 0x36, 0x36, 0x39, + 0x32, 0x38, 0x38, 0x64, 0x64, 0x30, 0x61, 0x64, 0x33, 0x39, 0x39, 0x31, + 0x38, 0x62, 0x66, 0x64, 0x35, 0x39, 0x61, 0x33, 0x32, 0x65, 0x34, 0x61, + 0x30, 0x36, 0x38, 0x64, 0x61, 0x61, 0x65, 0x63, 0x31, 0x34, 0x36, 0x65, + 0x32, 0x33, 0x33, 0x38, 0x31, 0x63, 0x31, 0x30, 0x63, 0x37, 0x66, 0x35, + 0x35, 0x62, 0x34, 0x35, 0x66, 0x35, 0x38, 0x36, 0x65, 0x36, 0x61, 0x64, + 0x31, 0x34, 0x62, 0x32, 0x30, 0x37, 0x31, 0x62, 0x63, 0x40, 0x32, 0x31, + 0x32, 0x2e, 0x33, 0x32, 0x2e, 0x32, 0x35, 0x35, 0x2e, 0x38, 0x30, 0x3a, + 0x33, 0x31, 0x34, 0x34, 0x30, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x22, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x3a, 0x2f, + 0x2f, 0x33, 0x33, 0x66, 0x31, 0x63, 0x36, 0x61, 0x39, 0x66, 0x63, 0x37, + 0x65, 0x33, 0x32, 0x30, 0x37, 0x30, 0x62, 0x38, 0x64, 0x66, 0x61, 0x36, + 0x35, 0x34, 0x64, 0x64, 0x64, 0x31, 0x38, 0x66, 0x64, 0x33, 0x63, 0x63, + 0x38, 0x63, 0x31, 0x31, 0x66, 0x39, 0x66, 0x32, 0x31, 0x64, 0x33, 0x37, + 0x31, 0x34, 0x31, 0x34, 0x36, 0x33, 0x34, 0x65, 0x38, 0x63, 0x61, 0x63, + 0x61, 0x37, 0x35, 0x38, 0x61, 0x34, 0x31, 0x36, 0x36, 0x63, 0x35, 0x63, + 0x61, 0x63, 0x61, 0x37, 0x66, 0x35, 0x35, 0x35, 0x63, 0x30, 0x64, 0x38, + 0x34, 0x38, 0x31, 0x65, 0x38, 0x30, 0x34, 0x35, 0x32, 0x34, 0x39, 0x32, + 0x64, 0x31, 0x62, 0x34, 0x66, 0x62, 0x36, 0x62, 0x35, 0x63, 0x63, 0x37, + 0x31, 0x30, 0x32, 0x34, 0x38, 0x35, 0x38, 0x34, 0x39, 0x32, 0x66, 0x33, + 0x35, 0x63, 0x36, 0x33, 0x37, 0x33, 0x37, 0x64, 0x34, 0x40, 0x32, 0x31, + 0x32, 0x2e, 0x33, 0x32, 0x2e, 0x32, 0x35, 0x35, 0x2e, 0x31, 0x39, 0x35, + 0x3a, 0x33, 0x31, 0x34, 0x34, 0x30, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x5d, 0x0a, 0x7d, 0x0a, }, fi: FileInfo{ name: "mainnet.json", - size: 3015, - modTime: time.Unix(0, 1575374661441734236), + size: 3112, + modTime: time.Unix(0, 1593069997257357428), isDir: false, }, }, "/core/config/morden.json": File{ diff --git a/core/config/mainnet.json b/core/config/mainnet.json index ea80517d4..504374034 100644 --- a/core/config/mainnet.json +++ b/core/config/mainnet.json @@ -82,6 +82,10 @@ { "name": "Reward", "block": 3600001 + }, + { + "name": "Reward2", + "block": 5000001 } ], "badHashes": [ diff --git a/core/state_processor.go b/core/state_processor.go index 3a4a7497f..6c2c6d755 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -209,8 +209,10 @@ func GetBlockWinnerRewardByEra(eraOrig *big.Int) *big.Int { return new(big.Int).Set(MaximumBlockReward) } - if era.Cmp(big.NewInt(45)) >= 0 { + if era.Cmp(big.NewInt(45)) >= 0 && era.Cmp(big.NewInt(50)) < 0 { era.Add(era, big.NewInt(475)) // skip 475 eras due to reward decrease + } else if era.Cmp(big.NewInt(56)) >= 0 { + era.Add(era, big.NewInt(865)) // skip 865 eras due to reward decrease } // MaxBlockReward _r_ * (249/250)**era == MaxBlockReward * (249**era) / (250**era) @@ -227,6 +229,9 @@ func GetBlockWinnerRewardByEra(eraOrig *big.Int) *big.Int { if era.Cmp(big.NewInt(36)) >= 0 && era.Cmp(big.NewInt(45)) < 0 { rewards := []int64{2000, 1300, 1200, 1100, 1000, 900, 800, 700, 625} r.Mul(big.NewInt(rewards[era.Int64()-36]), big.NewInt(10000000000000000)) + } else if era.Cmp(big.NewInt(50)) >= 0 && era.Cmp(big.NewInt(56)) < 0 { + rewards := []int64{500, 400, 300, 225, 160, 125} + r.Mul(big.NewInt(rewards[era.Int64()-50]), big.NewInt(10000000000000000)) } else if era.Cmp(big.NewInt(33)) >= 0 && era.Cmp(big.NewInt(36)) < 0 { // r - (r/2/(45-33) * (era-33+1)) r = GetBlockWinnerRewardByEra(big.NewInt(33-1))