Open lrettig opened 3 years ago
Thank you everyone for your helpful feedback on today's R&D call. Here are some followup items:
smoothing_distance
layers, but as Tal pointed out, we might choose a different strategy where we, e.g., group layers into "chunks", or align smoothing with epoch boundaries.
smoothing_distance
is a parameter and that choosing epoch-wide or layer-wide smoothing doesn't make much difference from the perspective of implementation, but I think Tal disagrees. I'm hoping to better understand why.max_fee
), but in future fees may be vectorized and we need to be careful how we scalarize and sort them. Tal suggests a "fee per unit density" construction that sounds reasonable.Moving this over here from #50, need to find a place for it in this SMIP or another:
Initially no change to incentives is necessary. Dishonest miners may submit empty content blocks, no content blocks, or duplicate content blocks but this will have little or no impact on the superblock produced for each layer. In any case, the degree of harm that dishonest miners can cause under this proposal is no greater than in Spacemesh 0.1, where they could engage in the same behavior. (In fact, there's less harm, since they cannot cause bloat in the mesh due to many duplicate transactions in a layer.)
If we're concerned about high fee paying transactions not being included in layers due to Byzantine behavior by a dishonest minority of miners in scenarios where the mempool contains many pending transactions, we could increase redundancy of these transactions by having multiple miners include such transactions in their proposed content blocks (at the cost of total throughput). See Coupon collector's problem for one probabilistic approach to solving this problem.
We should continue to research ways to better align incentives, such as by punishing miners (or withholding incentives from miners) who submit content blocks that are less than full, or contain many duplicate transactions.
Overview
The Spacemesh system needs to reward nodes that perform objectively valuable actions for the network such as mining new transactions into blocks, executing and validating the transactions in those blocks, and participating in Hare consensus.
For background see these forum threads:
Goals and motivation
See https://community.spacemesh.io/t/preliminary-proposal-for-incentives-rewards/121/1
High-level design
This design is based on EIP-1559, modified to work for a mesh rather than a chain. We introduce a
base_fee
in each layer, which all transactions in blocks in that layer must pay. Rewards collected in a layer and distributed to miners are smoothed over all blocks and transactions in a configurable number of layers. We also add reward maturation, so that a reward earned by a miner in a given layer isn't spendable until a configurable number of layers later.Proposed implementation
smoothing_distance
: the number of layers over which rewards are smoothed (0 = no smoothing, 1 = layer-wide smoothing, etc.). Note that this must be hardcoded in genesis for a given net/mesh and cannot change later.maturation_distance
: the number of layers that must pass before a reward earned by a miner is spendablemax_adjust
: the maximum ratio by which we allow thebase_fee
to change from layer to layermin_gas
: the minimum total fee that a miner accepts to mine a transaction into a block. This is not in consensus and will differ from miner to miner. It should represent something close to a miner's actual variable cost of including an additional transaction in a block.GasLimit
(already present),MaxFeePerGas
(max base fee tx is willing to pay) andMaxTipPerGas
base_fee
base_fee
for the current layer (based on votes in the previous layer), determine which transactions in the txpool pay at least this fee, and select transactions randomly from the set that are above this thresholdbase_fee
(based on layer capacity, to take effect in the following layer) and include their explicit vote forbase_fee
in blocks they publish in this layerbase_fee
for a given layermaturation_distance
has passedImplementation plan
smoothing_distance
paramsmoothing_distance
layers in each new layer, and whether we need to cache these values in memory. Build a cache if necessary.maturation_distance
layers behind the latest confirmed layer, whenever a new layer is confirmed (same as now).Questions
Ongoing work
This proposal only includes the barebones design and implementation required for a functional reward system for genesis. In particular, only mining is rewarded. Other useful behaviors such as transaction validation and participation in Hare are not covered by this design and are left for follow-on designs.
Dependencies and interactions
Stakeholders and reviewers
These changes touch several core go-spacemesh components. Reviews will be requested from the folks most familiar with the components that are changed.
Testing and performance
Tests will be added for all new and changed code.
Performance considerations:
smoothing_distance
is great. We may need a cache for this.