The Reward actor is an Singleton actor which handles rewards distribution. Its main role is to distribute rewards to the miners, while also updating the neccessary state variables that help computing those said rewards.
Actor Type:
Exported Methods:
type State struct {
CumsumBaseline Spacetime
CumsumRealized Spacetime
EffectiveNetworkTime abi.ChainEpoch
// The reward to be paid in per WinCount to block producers.
// The actual reward total paid out depends on the number of winners in any round.
// This value is recomputed every non-null epoch and used in the next non-null epoch.
ThisEpochReward abi.TokenAmount
// Epoch tracks for which epoch the Reward was computed
Epoch abi.ChainEpoch
}
theta
based on CumsumBaselinePower(theta) == CumsumRealizedPower
. Theta captures the notion of how much the network has progressed in its baseline and in advancing network time.func (a Actor) Constructor(rt vmr.Runtime, currRealizedPower *abi.StoragePower) *adt.EmptyValue
Initializes the RewardActor state.
func (a Actor) AwardBlockReward(rt vmr.Runtime, params *AwardBlockRewardParams) *adt.EmptyValue
Can only be called by the system actor.
On successful execution:
Penalty > 0
is sent to the BurntFunds actor.
type AwardBlockRewardParams struct {
Miner address.Address
Penalty abi.TokenAmount // penalty for including bad messages in a block
GasReward abi.TokenAmount // gas reward from all gas fees in a block
WinCount int64
}
Miner
: The address of the Miner receiving the reward.
Penalty
: The reward sent to the Miner is reduced by this amount.
blockReward
, but it is capped by blockReward
. In this scenario, the Miner
does not receive any rewards.msg.Caller
invalid (not resolvable via init actor table)msg.Caller
has insufficient funds to pay for executionGasReward
: The sum of all gas fees in the block.
WinCount
:
func (a Actor) ThisEpochReward(rt vmr.Runtime, _ *adt.EmptyValue) *abi.TokenAmount
Returns the current epoch reward.
TokenAmount
is the award value used for the current epoch.
type TokenAmount = big.Int
func (a Actor) UpdateNetworkKPI(rt vmr.Runtime, currRealizedPower *abi.StoragePower) *adt.EmptyValue
Invoked by the StoragePower actor at the end of each non-empty tipset. This method updates internal state for each tipset since the last time it was invoked (st.Epoch
to rt.CurrEpoch()
).
When updating internal state for tipsets prior to rt.CurrEpoch()
:
st.CumsumRealized
is increased by the epoch's realized power, up to a maximum of Baseline Power.st.CumsumBaseline
is increased by Baseline Power until it is greater than or equal to st.CumsumRealized
.st.EffectiveNetworkTime
is incremented by 1 for each additional level of Baseline Power added to st.CumsumBaseline
Finally, UpdateNetworkKPI
updates state for rt.CurrEpoch() + 1
, performing the steps described above for rt.CurrEpoch()
, then setting st.ThisEpochReward
.
Once complete, st.Epoch
should be rt.CurrEpoch() + 1
, and st.ThisEpochReward
should contain the epoch reward for the upcoming epoch.
currRealizedPower *abi.StoragePower
currRealizedPower
: The StoragePower actor's recorded st.TotalRawBytePower
.
nil
AwardBlockReward
can the penalty
which is currently initialized here but the initial value is overwritten here. Could it be initialized directly at line 84?params.Penalty
is int
, should it be checked to be >=0
?params.GasReward
is int
, should it be checked to be >=0
?builtin.ExpectedLeadersPerEpoch
value?block gas reward
vs epoch block reward
?RewardActor
?WinCount
?or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing