Skip to content

Commit 82b17db

Browse files
authored
Merge pull request #41 from aeternity/fork_resolution
Update with new fork resolution and reward distribution.
2 parents 6013c50 + cbb4883 commit 82b17db

File tree

2 files changed

+64
-102
lines changed

2 files changed

+64
-102
lines changed

Periodically-Syncing-HyperChains.md

Lines changed: 16 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,14 @@ below `MINIMUM_STAKE`.)
675675

676676
### Consensus Details
677677

678+
For hyperchains we calculate the "difficulty" of a normal block as the difficulty of the preceding
679+
block + 1. The difficulty of a hole is the same as the difficulty of the preceding block.
680+
Choosing the best fork is done by choosing the block with the highest difficulty.
681+
The block with the highest height is better for blocks with the same difficulty.
682+
683+
When a vote for a fork gets 2/3 of the stake the difficulty of the block containing that vote will be
684+
updated so that difficulty is set to the height.
685+
678686
#### Producer diagram
679687

680688
```mermaid
@@ -777,7 +785,7 @@ graph TD
777785
penalty["Prepare proof of all 'double' blocks in same slot.
778786
Post proof of missconduct.
779787
Fill all 'double' blocks with 'holes' "]
780-
n21["Prefer chain with holes late"]
788+
n21["Prefer chain with holes early"]
781789
done["pick that fork"]
782790
783791
@@ -791,65 +799,6 @@ graph TD
791799
```
792800

793801

794-
#### More...
795-
```mermaid
796-
graph TD
797-
n13["Unsolved or un-placed problems"]
798-
n14["Gossiped block is too late"]
799-
n15["Network split?"]
800-
n16["Lasting multiple epochs?"]
801-
n17["No majority can't finish the epoch"]
802-
n18["Malicious or bad nodes"]
803-
n19["How to choose the best fork?"]
804-
n20["Pick 1 with fewest holes"]
805-
n21["Prefer chain with holes late"]
806-
n22["Can a producer do multiple blocks in a slot\nNO!"]
807-
n23["How to detect?"]
808-
n24["Act?"]
809-
n25["Producer timing Design decisions"]
810-
n26["How long to wait?"]
811-
n27["Prefer to gossip early?"]
812-
n28["But prefer to build complete chain!\nHow to incentivize?"]
813-
814-
815-
816-
n13 --> n14
817-
n13 --> n15
818-
n15 --> n16
819-
n15 --> n17
820-
n13 --> n18
821-
n10 --> n19
822-
n19 --> n20
823-
n19 --> n21
824-
n13 --> n22
825-
n15 --> n23
826-
n15 --> n24
827-
n8 --> n25
828-
n25 --> n26
829-
n25 --> n27
830-
n27 --> n28
831-
832-
```
833-
834-
```mermaid
835-
graph TD
836-
837-
n29["Attacks?"]
838-
n30["Double spend"]
839-
n31["Halt"]
840-
n32["Take over\n* Force majority while not having majority stake"]
841-
n34["Penalties\nhttps://ethereum.org/en/developers/docs/consensus-mechanisms/pos/#crypto-economic-security"]
842-
n35["Extra end of epoch logic"]
843-
844-
845-
n29 --> n30
846-
n29 --> n31
847-
n29 --> n32
848-
n13 --> n34
849-
n13 --> n35
850-
```
851-
852-
853802
### End of Epoch Fork Resolution
854803

855804
A Byzantine Fault Tolerant (BFT) voting mechanism is proposed to allow producers to reach consensus on the correct fork.
@@ -1056,18 +1005,16 @@ Penalties are enforced to deter malicious actions or protocol violations. Slasha
10561005
- **Definition**: A validator casts multiple votes for different forks or outcomes in a single voting phase. This action is considered malicious and undermines the voting process.
10571006
- **Penalty**: The validator's stake is slashed, and their voting rights are suspended for one or more epochs. The network may also distribute the slashed amount among honest validators as a reward for maintaining integrity.
10581007

1059-
3. **Ignoring Votes:**
1060-
1061-
- **Definition**: A validator deliberately ignores valid votes when creating a "Finalize" transaction, attempting to force a minority or incorrect outcome. This is only an offense if the ignored votes
1062-
would change the outcome. This is so that it is not an attack to send in a late vote for the majority
1063-
outcome and then slash the validator for not including it.
1064-
- **Penalty**: The validator's stake is partially slashed, and they are penalized with a temporary ban from participating in leader elections or block production if their deposit stakes fall below the minimum.
1008+
3. **Not producing blocks:**
10651009

1066-
4. **Submitting an incorrect block, or not submitting a block in time**: If a block producer's block has been replaced by holes more than 50% of the time during one epoch.
1010+
- **Definition**: A validator that was chosen leader but that does not produce any
1011+
valid or in time blocks during an epoch.
1012+
- **Penalty**: The validator's stake is partially slashed down below minimum stake,
1013+
causing a temporary ban from participating in leader elections and block production.
10671014

1068-
5. **Ignoring the finalize_epoch fork**: This is a minor event just as any other incorrect block. It should probably just be ignored with no penalty.
1015+
4. **Ignoring the finalize_epoch fork**: This is a minor event just as any other incorrect block. It should probably just be ignored with no penalty.
10691016

1070-
6. **Ignoring a correctly pinned fork**: This is a minor event just as any other incorrect block. It should probably just be ignored with no penalty.
1017+
5. **Ignoring a correctly pinned fork**: This is a minor event just as any other incorrect block. It should probably just be ignored with no penalty.
10711018

10721019

10731020
#### Submitting Proof of Wrongdoings

staking.md

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ the whole locking period.
424424
- Serves as a placeholder to maintain the continuity of the blockchain.
425425
- **No Rewards for Holes**:
426426
- Validators producing holes do **not** receive any rewards for these blocks.
427-
- The missed block's potential rewards are effectively forfeited, including the award of fees for following the previous block.
427+
- The missed block's potential rewards are effectively forfeited, including the award of fees for following the previous block, and for the following block.
428428
429429
430430
## Reward Distribution for Correct Blocks
@@ -439,34 +439,43 @@ When a validator successfully produces a block on time, the rewards are distribu
439439
### Distribution Breakdown
440440
441441
- **Block Producer (Current Validator)**:
442-
- Receives **X% of the block fees**, X defaults to 75% but is configurable in genesis.
442+
- Receives **X% of the block fees**, X defaults to 40% but is configurable in genesis.
443443
- Receives the **full epoch coinbase reward**.
444444
- **Incentive**: Encourages validators to produce blocks promptly and include transactions to maximize fees.
445445
446446
- **Next Validator (Following Validator)**:
447-
- Receives **(100-X)% of the block fees** from the previous block.
447+
- Receives **Y% of the block fees**, Y defaults to 30% from the previous block.
448448
- **Role**:
449449
- Validates the correctness of the previous block.
450450
- Builds upon it by producing the next block in the chain.
451451
- **Incentive**: Motivates validators to participate actively in the validation process and ensures they have a stake in the accuracy of preceding blocks.
452452
453+
- **Previous Producer (Preceding Validator)**:
454+
- Receives **(100-(X+Y))% of the block fees** from the following block.
455+
- **Role**:
456+
- Validates the correctness of the previous block.
457+
- Is encouraged to produce the block in time so that the next validator builds on top of it.
458+
- **Incentive**: Motivates validators to produce blocks in a timely manner.
459+
460+
453461
### Visualization of Reward Flow
454462
455463
```plaintext
456-
+-----------------------+ +-----------------------+
457-
| | | |
458-
| Validator A | | Validator B |
459-
| (Block Producer) | | (Next Validator) |
460-
| | | |
461-
| - Validates Block N-1 | | - Validates Block N |
462-
| - Produces Block N | | - Builds Block N+1 |
463-
| - Receives: | | - Receives: |
464-
| * 25% of N-1 Fees | | * 75% of Block N+1 |
465-
| * 75% of Block |------------------>| * 25% of N-1 Fees |
466-
| N Fees | | |
467-
| * Epoch Coinbase | | * Epoch Coinbase |
468-
| | | |
469-
+-----------------------+ +-----------------------+
464+
+-----------------------+ +-----------------------+ +-----------------------+
465+
| | | | | |
466+
| Validator: A | | Validator B | | Validator C |
467+
| Block: N-1 | | Block: N | | Block: N+1 |
468+
| (Previous Producer) | | (Block Producer) | | (Next Validator) |
469+
| | | | | |
470+
| - Validates Block N-2 | | - Validates Block N-1 | | - Validates Block N |
471+
| - Produces Block N-1 | | - Produces Block N | | - Builds Block N+1 |
472+
| - Receives Fees: | | - Receives Fees: | | - Receives Fees: |
473+
| * 30% of N-2 | | * 30% of N-1 | | * 30% of N |
474+
| * 40% of N-1 |-------->| * 40% of N |------->| * 40% of N+1 |
475+
| * 30% of N | | * 30% of N+1 | | * 30% of N+2 |
476+
| * Epoch Coinbase | | * Epoch Coinbase | | * Epoch Coinbase |
477+
| | | | | |
478+
+-----------------------+ +-----------------------+ +-----------------------+
470479
```
471480

472481
## Fee Payout Timing
@@ -489,9 +498,9 @@ When a validator successfully produces a block on time, the rewards are distribu
489498

490499
### Configurable Parameters
491500

492-
- **75/25 Fee Split**:
501+
- **30/40/30 Fee Split**:
493502
- The proportion of fees allocated to the block producer and the next validator is **configurable** for a Hyperchain.
494-
- Networks can adjust the split (e.g., 80/20, 70/30) based on governance decisions or to incentivize certain behaviors.
503+
- Networks can adjust the split (e.g., 10/70/20, 20/30/50) based on governance decisions or to incentivize certain behaviors.
495504

496505
- **Epoch Coinbase Amount**:
497506
- The coinbase reward (newly minted tokens) per epoch is **configurable** per chain.
@@ -523,36 +532,43 @@ When a validator successfully produces a block on time, the rewards are distribu
523532

524533
### Assumptions
525534

526-
- **Fee Split**: 75% to block producer, 25% to next validator.
535+
- **Fee Split**: 30% previous produer, 40% to block producer, 30% to next validator.
527536
- **Epoch Coinbase**: 10 tokens per epoch.
528537
- **Block Fees**: Varies per block.
529538

530539
### Block Production Sequence
531540

532-
1. **Validator A** produces Block N on time.
533-
2. **Validator B** is scheduled to produce Block N+1.
541+
1. **Validator A** has produced Block N-1 on time.
542+
2. **Validator B** produces Block N on time.
543+
2. **Validator C** is scheduled to produce Block N+1.
534544

535545
### Reward Distribution
536546

537-
- **Validator A (Block N Producer)**:
547+
- **Validator A (Block N-1 Producer)**:
548+
- Receives:
549+
- **30% of Block N Fees**.
550+
- **Epoch Coinbase** (10 tokens).
551+
552+
553+
- **Validator B (Block N Producer)**:
538554
- Receives:
539-
- **75% of Block N Fees**.
555+
- **40% of Block N Fees**.
540556
- **Epoch Coinbase** (10 tokens).
541557

542-
- **Validator B (Block N+1 Producer)**:
558+
- **Validator C (Block N+1 Producer)**:
543559
- Receives:
544-
- **25% of Block N Fees** (for validating and building upon Block N).
560+
- **30% of Block N Fees** (for validating and building upon Block N).
545561
- Their own rewards for producing Block N+1 when applicable.
546562

547563
### Missed Block Scenario
548564

549-
- If **Validator A** fails to produce Block N:
550-
- **Validator B** produces a **hole** instead.
565+
- If **Validator B** fails to produce Block N:
566+
- **Validator C** produces a **hole** instead.
551567
- **No Rewards**:
552-
- Validator B receives **no rewards** for the hole.
553-
- Validator A forfeits potential rewards for Block N.
568+
- Validator C receives **no rewards** for the hole.
569+
- Validator B forfeits potential rewards for Block N.
554570
- **Continued Operation**:
555-
- **Validator B** continues with Block N+1.
571+
- **Validator C** continues with Block N+1.
556572

557573
---
558574

@@ -579,8 +595,7 @@ Penalties are enforced to deter malicious actions or protocol violations. **Slas
579595

580596
1. **Producing Two Versions of a Block at a Specific Height (Double-Spending Attack)**
581597
2. **Double Voting**
582-
3. **Ignoring Votes**
583-
4. **Consistently Failing to Submit Blocks on Time**
598+
3. **Consistently Failing to Submit Blocks on Time**
584599

585600
### Minor Offenses
586601
1. **Ignoring the `finalize_epoch` Fork**

0 commit comments

Comments
 (0)