Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
8b53351
first year implementation
sasurobert Oct 31, 2025
a9d4cd4
revert
sasurobert Oct 31, 2025
3197486
mocks and stubs
sasurobert Oct 31, 2025
d0ac531
mocks and stubs and new functions.
sasurobert Oct 31, 2025
19b0515
maybe full implementation
sasurobert Oct 31, 2025
0db532f
cleanup
sasurobert Oct 31, 2025
50d97c9
fixing tests
sasurobert Oct 31, 2025
01f5d81
fixing tests
sasurobert Oct 31, 2025
07bd535
fixing tests
sasurobert Oct 31, 2025
09773ce
fixing tests
sasurobert Oct 31, 2025
8c3024f
use correct supply
sasurobert Nov 3, 2025
8c5858a
use correct supply
sasurobert Nov 3, 2025
cc7a8f6
adding unit tests
sasurobert Nov 3, 2025
0d46299
adding unit tests
sasurobert Nov 3, 2025
5635cff
adding unit tests
sasurobert Nov 3, 2025
17a770d
strenghtening
sasurobert Nov 5, 2025
9b90751
just toml
sasurobert Nov 5, 2025
ad650e4
just toml
sasurobert Nov 10, 2025
fd58ad9
fixes after review
sasurobert Nov 10, 2025
cdf87d0
implementing computation from yearly to daily.
sasurobert Nov 11, 2025
49b9d92
implementing computation from yearly to daily.
sasurobert Nov 11, 2025
7c2b6aa
calculate inflation for epoch compound
sasurobert Nov 12, 2025
ba3e3ec
fix testing
sasurobert Nov 12, 2025
6973454
fixes after AI review
sasurobert Nov 13, 2025
a442d62
fixes after review
sasurobert Nov 13, 2025
0392de7
importdb fixes
sasurobert Nov 13, 2025
46494b1
update chain simulator
miiu96 Nov 13, 2025
072d348
add missing import
miiu96 Nov 13, 2025
34cb169
linter
sasurobert Nov 13, 2025
a9ee9cd
just test fix, as no reward tx is created when reward is zero on the …
sasurobert Nov 14, 2025
7d58cf3
unit test
miiu96 Nov 20, 2025
b30a238
just test fix, as no reward tx is created when reward is zero on the …
sasurobert Nov 20, 2025
fbf091b
Merge branch 'rc/supernova' into do-not-change-activation-round-in-ca…
miiu96 Nov 20, 2025
3136503
small fix
miiu96 Nov 20, 2025
dcdee2f
fixes after review
miiu96 Nov 21, 2025
ab874b2
Merge pull request #7386 from multiversx/stakingV5-implementation
sstanculeanu Nov 24, 2025
1091f11
compressed tail inflation epochs
sstanculeanu Nov 25, 2025
ca74993
fixes after review
miiu96 Nov 25, 2025
3202ffe
fixes
miiu96 Nov 25, 2025
55212e1
Merge branch 'master' into stakingV5-to-superNova-merge
sasurobert Nov 25, 2025
cd71b22
fix
miiu96 Nov 25, 2025
85ad2a1
Merge pull request #7466 from multiversx/v1.11.1-dev-config
sstanculeanu Nov 25, 2025
aa83f47
merges.
sasurobert Nov 25, 2025
0c253cf
fixes
sasurobert Nov 25, 2025
e87db4f
Merge branch 'master' into stakingV5-to-superNova-merge
sasurobert Nov 25, 2025
f251325
fixes
sasurobert Nov 25, 2025
9daaaef
fixes
sasurobert Nov 26, 2025
5f2642b
trace to debug
sasurobert Nov 26, 2025
dae2f08
trace to debug
sasurobert Nov 26, 2025
805d61d
Merge pull request #7424 from multiversx/do-not-change-activation-rou…
miiu96 Nov 27, 2025
3aaa0de
fix metrics chain simulator
miiu96 Nov 27, 2025
01f75fa
fix round duration
miiu96 Nov 27, 2025
2e7a880
Merge branch 'rc/supernova' into stakingV5-to-superNova-merge
sasurobert Nov 28, 2025
f93caca
fix tests
miiu96 Dec 2, 2025
989c957
fixes after review
sasurobert Dec 2, 2025
9f55358
fixes after review
sasurobert Dec 2, 2025
abc5d1e
Merge pull request #7488 from multiversx/fix-metrics-chain-simulator
axenteoctavian Dec 3, 2025
b4429f1
Merge branch 'rc/supernova' into stakingV5-to-superNova-merge
sasurobert Dec 4, 2025
90f44ed
Merge pull request #7477 from multiversx/stakingV5-to-superNova-merge
sasurobert Dec 4, 2025
c0796a6
Merge branch 'rc/supernova' into rc-to-feat-async-exec-9-dec
sasurobert Dec 9, 2025
18cb23d
fixes after merge
sasurobert Dec 9, 2025
a6b7672
fixes after merge
sasurobert Dec 9, 2025
a6f4515
fixes after merge
sasurobert Dec 15, 2025
0342ca8
Merge branch 'feat/supernova-async-exec' into rc-to-feat-async-exec-9…
sasurobert Dec 15, 2025
6494254
fixing imports
sasurobert Dec 22, 2025
6347723
Merge branch 'feat/supernova-async-exec' into rc-to-feat-async-exec-9…
sasurobert Dec 22, 2025
d35ce76
Merge branch 'feat/supernova-async-exec' into rc-to-feat-async-exec-9…
sasurobert Dec 23, 2025
d907f64
fixing imports
sasurobert Dec 23, 2025
16fe011
Merge remote-tracking branch 'origin/rc-to-feat-async-exec-9-dec' int…
sasurobert Dec 23, 2025
d236647
adding back metrics.
sasurobert Dec 23, 2025
f983e19
adding back metrics.
sasurobert Dec 23, 2025
9dd8aba
fix long test
sasurobert Dec 23, 2025
2df3405
Merge branch 'feat/supernova-async-exec' into rc-to-feat-async-exec-9…
AdoAdoAdo Dec 30, 2025
61780a8
Merge branch 'feat/supernova-async-exec' into rc-to-feat-async-exec-9…
AdoAdoAdo Dec 30, 2025
45236d8
fix missing storer unit
AdoAdoAdo Dec 30, 2025
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
20 changes: 17 additions & 3 deletions cmd/node/config/economics.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,36 @@
Denomination = 18 # represents the smallest eGLD subdivision (10^-X eGLD for a denomination of X)
GenesisMintingSenderAddress = "erd17rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rcqqkhty3"

[GlobalSettings.TailInflation]
EnableEpoch = 1
StartYearInflation = 0.08757
DecayPercentage = 0.0025
MinimumInflation = 0.02

[RewardsSettings]
[[RewardsSettings.RewardsConfigByEpoch]]
EpochEnable = 0
LeaderPercentage = 0.1 #fraction of value 0.1 - 10%
DeveloperPercentage = 0.3 #fraction of value 0.3 - 30%
ProtocolSustainabilityPercentage = 0.1 #fraction of value 0.1 - 10%
ProtocolSustainabilityAddress = "erd1j25xk97yf820rgdp3mj5scavhjkn6tjyn0t63pmv5qyjj7wxlcfqqe2rw5"
TopUpGradientPoint = "3000000000000000000000000" # 3MIL eGLD (eligible topUp)
TopUpFactor = 0.25 # fraction of value 0.25 - 25%
ProtocolSustainabilityAddress = "erd1e5cw5pegj9w2zfpzeq94wf3d5tp6g943xuhgnyysdwyr63rlkspqr0u05s"
EcosystemGrowthPercentage = 0.0
EcosystemGrowthAddress = "erd1k8d58eve7aa64wjad35sx6z8ckgr738wl7jyz54pez0t4zr98fuqz6hxvs"
GrowthDividendPercentage = 0.0
GrowthDividendAddress = "erd1enva49yfy9ja0e4ttncfmzr0vjv9k9rawuyg2h2g8nepqwmz8ltssvkglr"
TopUpGradientPoint = "2000000000000000000000000" # 2MIL eGLD (eligible topUp)
TopUpFactor = 0.5 # fraction of value 0.5 - 50%

[[RewardsSettings.RewardsConfigByEpoch]]
EpochEnable = 1
LeaderPercentage = 0.1 #fraction of value 0.1 - 10%
DeveloperPercentage = 0.3 #fraction of value 0.3 - 30%
ProtocolSustainabilityPercentage = 0.1 #fraction of value 0.1 - 10%
ProtocolSustainabilityAddress = "erd1e5cw5pegj9w2zfpzeq94wf3d5tp6g943xuhgnyysdwyr63rlkspqr0u05s"
EcosystemGrowthPercentage = 0.2 #fraction of value 0.2 - 20%
EcosystemGrowthAddress = "erd1k8d58eve7aa64wjad35sx6z8ckgr738wl7jyz54pez0t4zr98fuqz6hxvs"
GrowthDividendPercentage = 0.2 #fraction of value 0.2 - 20%
GrowthDividendAddress = "erd1enva49yfy9ja0e4ttncfmzr0vjv9k9rawuyg2h2g8nepqwmz8ltssvkglr"
TopUpGradientPoint = "2000000000000000000000000" # 2MIL eGLD (eligible topUp)
TopUpFactor = 0.5 # fraction of value 0.5 - 50%

Expand Down
13 changes: 13 additions & 0 deletions config/economicsConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ type GlobalSettings struct {
YearSettings []*YearSetting
Denomination int
GenesisMintingSenderAddress string
TailInflation TailInflationSettings
}

// TailInflationSettings will hold the tail inflation settings
type TailInflationSettings struct {
EnableEpoch uint32
StartYearInflation float64
DecayPercentage float64
MinimumInflation float64
}

// YearSetting will hold the maximum inflation rate for year
Expand All @@ -26,6 +35,10 @@ type EpochRewardSettings struct {
DeveloperPercentage float64
ProtocolSustainabilityPercentage float64
ProtocolSustainabilityAddress string
EcosystemGrowthPercentage float64
EcosystemGrowthAddress string
GrowthDividendPercentage float64
GrowthDividendAddress string
TopUpGradientPoint string
TopUpFactor float64
EpochEnable uint32
Expand Down
13 changes: 10 additions & 3 deletions epochStart/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (

"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-core-go/data/block"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"

"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/state"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
)

// TriggerHandler defines the functionalities for an start of epoch trigger
Expand Down Expand Up @@ -186,11 +185,19 @@ type EpochEconomicsDataProvider interface {
SetLeadersFees(fees *big.Int)
SetRewardsToBeDistributed(rewards *big.Int)
SetRewardsToBeDistributedForBlocks(rewards *big.Int)
SetRewardsForProtocolSustainability(rewards *big.Int)
SetRewardsForEcosystemGrowth(rewards *big.Int)
SetRewardsForGrowthDividend(rewards *big.Int)
NumberOfBlocks() uint64
NumberOfBlocksPerShard() map[uint32]uint64
LeaderFees() *big.Int
RewardsToBeDistributed() *big.Int
RewardsToBeDistributedForBlocks() *big.Int
RewardsForProtocolSustainability() *big.Int
RewardsForEcosystemGrowth() *big.Int
RewardsForGrowthDividend() *big.Int
RewardsForAccelerator() *big.Int
Clean()
IsInterfaceNil() bool
}

Expand All @@ -208,7 +215,7 @@ type RewardsCreator interface {
computedEconomics *block.Economics,
prevBlockExecutionResults data.BaseMetaExecutionResultHandler,
) (block.MiniBlockSlice, error)
GetProtocolSustainabilityRewards() *big.Int
GetAcceleratorRewards() *big.Int
GetLocalTxCache() TransactionCacher
CreateMarshalledData(body *block.Body) map[string][][]byte
GetRewardsTxs(body *block.Body) map[string]data.TransactionHandler
Expand Down
36 changes: 16 additions & 20 deletions epochStart/metachain/baseRewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type BaseRewardsCreatorArgs struct {
EnableEpochsHandler common.EnableEpochsHandler
ExecutionOrderHandler common.TxExecutionOrderHandler
RewardsHandler process.RewardsHandler
EconomicsData epochStart.EpochEconomicsDataProvider
}

type baseRewardsCreator struct {
Expand All @@ -56,7 +57,6 @@ type baseRewardsCreator struct {
dataPool dataRetriever.PoolsHolder
mapBaseRewardsPerBlockPerValidator map[uint32]*big.Int
accumulatedRewards *big.Int
protocolSustainabilityValue *big.Int
flagDelegationSystemSCEnabled atomic.Flag // nolint
userAccountsDB state.AccountsAdapter
enableEpochsHandler common.EnableEpochsHandler
Expand Down Expand Up @@ -84,7 +84,6 @@ func NewBaseRewardsCreator(args BaseRewardsCreatorArgs) (*baseRewardsCreator, er
dataPool: args.DataPool,
nodesConfigProvider: args.NodesConfigProvider,
accumulatedRewards: big.NewInt(0),
protocolSustainabilityValue: big.NewInt(0),
userAccountsDB: args.UserAccountsDB,
mapBaseRewardsPerBlockPerValidator: make(map[uint32]*big.Int),
enableEpochsHandler: args.EnableEpochsHandler,
Expand All @@ -95,14 +94,6 @@ func NewBaseRewardsCreator(args BaseRewardsCreatorArgs) (*baseRewardsCreator, er
return brc, nil
}

// GetProtocolSustainabilityRewards returns the sum of all rewards
func (brc *baseRewardsCreator) GetProtocolSustainabilityRewards() *big.Int {
brc.mutRewardsData.RLock()
defer brc.mutRewardsData.RUnlock()

return brc.protocolSustainabilityValue
}

// GetLocalTxCache returns the local tx cache which holds all the rewards
func (brc *baseRewardsCreator) GetLocalTxCache() epochStart.TransactionCacher {
return brc.currTxs
Expand Down Expand Up @@ -321,7 +312,6 @@ func (brc *baseRewardsCreator) clean() {
brc.mapBaseRewardsPerBlockPerValidator = make(map[uint32]*big.Int)
brc.currTxs.Clean()
brc.accumulatedRewards = big.NewInt(0)
brc.protocolSustainabilityValue = big.NewInt(0)
}

func (brc *baseRewardsCreator) isSystemDelegationSC(address []byte) bool {
Expand All @@ -346,14 +336,14 @@ func (brc *baseRewardsCreator) isSystemDelegationSC(address []byte) bool {
func (brc *baseRewardsCreator) createProtocolSustainabilityRewardTransaction(
epoch uint32,
round uint64,
computedEconomics *block.Economics,
protocolSustainability *big.Int,
) (*rewardTx.RewardTx, uint32, error) {

protocolSustainabilityAddressForEpoch := brc.rewardsHandler.ProtocolSustainabilityAddressInEpoch(epoch)
protocolSustainabilityShardID := brc.shardCoordinator.ComputeId([]byte(protocolSustainabilityAddressForEpoch))
protocolSustainabilityRwdTx := &rewardTx.RewardTx{
Round: round,
Value: big.NewInt(0).Set(computedEconomics.RewardsForProtocolSustainability),
Value: big.NewInt(0).Set(protocolSustainability),
RcvAddr: []byte(protocolSustainabilityAddressForEpoch),
Epoch: epoch,
}
Expand Down Expand Up @@ -404,19 +394,25 @@ func (brc *baseRewardsCreator) initializeRewardsMiniBlocks() block.MiniBlockSlic
return miniBlocks
}

func (brc *baseRewardsCreator) addProtocolRewardToMiniBlocks(
protocolSustainabilityRwdTx *rewardTx.RewardTx,
func (brc *baseRewardsCreator) addAcceleratorRewardToMiniBlocks(
acceleratorRewardTx *rewardTx.RewardTx,
miniBlocks block.MiniBlockSlice,
protocolSustainabilityShardId uint32,
shardID uint32,
) error {
protocolSustainabilityRwdHash, errHash := core.CalculateHash(brc.marshalizer, brc.hasher, protocolSustainabilityRwdTx)
acceleratorRwdHash, errHash := core.CalculateHash(brc.marshalizer, brc.hasher, acceleratorRewardTx)
if errHash != nil {
return errHash
}
if acceleratorRewardTx.Value.Cmp(zero) < 0 {
return errNegativeAcceleratorReward
}
if acceleratorRewardTx.Value.Cmp(zero) == 0 {
// do not add to the miniblock
return nil
}

brc.currTxs.AddTx(protocolSustainabilityRwdHash, protocolSustainabilityRwdTx)
miniBlocks[protocolSustainabilityShardId].TxHashes = append(miniBlocks[protocolSustainabilityShardId].TxHashes, protocolSustainabilityRwdHash)
brc.protocolSustainabilityValue.Set(protocolSustainabilityRwdTx.Value)
brc.currTxs.AddTx(acceleratorRwdHash, acceleratorRewardTx)
miniBlocks[shardID].TxHashes = append(miniBlocks[shardID].TxHashes, acceleratorRwdHash)

return nil
}
Expand Down
23 changes: 4 additions & 19 deletions epochStart/metachain/baseRewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,12 @@ func TestBaseRewardsCreator_clean(t *testing.T) {
require.Nil(t, err)

rwd.accumulatedRewards = big.NewInt(1000)
rwd.protocolSustainabilityValue = big.NewInt(100)
rwd.mapBaseRewardsPerBlockPerValidator[0] = big.NewInt(10)
txHash := []byte("txHash")
rwd.currTxs.AddTx(txHash, &rewardTx.RewardTx{})

rwd.clean()
require.Equal(t, big.NewInt(0), rwd.accumulatedRewards)
require.Equal(t, big.NewInt(0), rwd.protocolSustainabilityValue)
require.Equal(t, 0, len(rwd.mapBaseRewardsPerBlockPerValidator))
tx, err := rwd.currTxs.GetTx(txHash)
require.Nil(t, tx)
Expand Down Expand Up @@ -220,28 +218,15 @@ func TestBaseRewardsCreator_GetLocalTxCache(t *testing.T) {
require.False(t, check.IfNil(txCache))
}

func TestBaseRewardsCreator_GetProtocolSustainabilityRewards(t *testing.T) {
func TestBaseRewardsCreator_addAcceleratorRewardToMiniBlocks(t *testing.T) {
t.Parallel()

args := getBaseRewardsArguments()
rwd, err := NewBaseRewardsCreator(args)
require.Nil(t, err)
require.NotNil(t, rwd)

// should return 0 as just initialized
rewards := rwd.GetProtocolSustainabilityRewards()
require.Zero(t, big.NewInt(0).Cmp(rewards))
}

func TestBaseRewardsCreator_addProtocolRewardToMiniblocks(t *testing.T) {
t.Parallel()

args := getBaseRewardsArguments()
rwd, err := NewBaseRewardsCreator(args)
require.Nil(t, err)
require.NotNil(t, rwd)

initialProtRewardValue := big.NewInt(-100)
initialProtRewardValue := big.NewInt(100)
protRwAddr, _ := args.PubkeyConverter.Decode(args.RewardsHandler.ProtocolSustainabilityAddressInEpoch(0))
protRwTx := &rewardTx.RewardTx{
Round: 100,
Expand All @@ -257,7 +242,7 @@ func TestBaseRewardsCreator_addProtocolRewardToMiniblocks(t *testing.T) {

protRwShard := args.ShardCoordinator.ComputeId(protRwAddr)
mbSlice := createDefaultMiniBlocksSlice()
err = rwd.addProtocolRewardToMiniBlocks(protRwTx, mbSlice, protRwShard)
err = rwd.addAcceleratorRewardToMiniBlocks(protRwTx, mbSlice, protRwShard)
require.Nil(t, err)

found := false
Expand Down Expand Up @@ -898,7 +883,7 @@ func TestBaseRewardsCreator_createProtocolSustainabilityRewardTransaction(t *tes
DevFeesInEpoch: big.NewInt(0),
}

rwTx, _, err := rwd.createProtocolSustainabilityRewardTransaction(metaBlk.GetEpoch(), metaBlk.GetRound(), &metaBlk.EpochStart.Economics)
rwTx, _, err := rwd.createProtocolSustainabilityRewardTransaction(metaBlk.GetEpoch(), metaBlk.GetRound(), metaBlk.EpochStart.Economics.GetRewardsForProtocolSustainability())
require.Nil(t, err)
require.NotNil(t, rwTx)
require.Equal(t, metaBlk.EpochStart.Economics.RewardsForProtocolSustainability, rwTx.Value)
Expand Down
Loading
Loading