-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(consensus)!: add exhaust burn per transaction, fix block fee mall…
…eability (#942) Description --- ~~fix(consensus)!: calculate fees per block~~ fix(consensus)!: immalleable block fee feat(consensus)!: enable fixed exhaust of 5% Motivation and Context --- ~~Previously, fees and exhaust burns were calculated per transaction. This increases the deviation caused by rounding and isa little more complex implementation-wise. This PR sums up fees for a block and then computes the leader fee and exhaust burn.~~ The leader fee calculation is improved to better account for burnt fees due to the remainder when dividing the fees by the number of involved shards. This PR enables the exhaust at a fixed rate of 5% - this number is not finalized and will change but is enabled to allow for better testing. The fee field in the block was previously malleable, this PR includes the fees in the block hash, and therefore block signature. How Has This Been Tested? --- New unit test, manually checked that fee agreement is maintained What process can a PR reviewer use to test or verify this change? --- Check the expected fee and burn rate in VN database Breaking Changes --- - [ ] None - [x] Requires data directory to be deleted - [ ] Other - Please specify
- Loading branch information
Showing
23 changed files
with
332 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. | ||
|
||
export interface LeaderFee { | ||
fee: number; | ||
global_exhaust_burn: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. | ||
import type { Decision } from "./Decision"; | ||
import type { Evidence } from "./Evidence"; | ||
import type { LeaderFee } from "./LeaderFee"; | ||
|
||
export interface TransactionAtom { | ||
id: string; | ||
decision: Decision; | ||
evidence: Evidence; | ||
transaction_fee: number; | ||
leader_fee: number; | ||
leader_fee: LeaderFee | null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.