Skip to content

Commit

Permalink
Add offset prefixes to EpochRewards
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Mar 4, 2024
1 parent df1b7f1 commit feeb48e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions proposals/0118-partitioned-epoch-reward-distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,28 +147,29 @@ include: the parameters needed to recalculate the reward partitions, the total
rewards to be distributed, and the amount of rewards distributed so far.

The layout of `EpochRewards` sysvar is shown in the following pseudo code.
Prefixes indidate the offset of each field, and padding bytes are always zero.

```
#[repr(C)] // C representation, ie. 8-byte alignment
#[repr(C)] // C representation, 8-byte alignment
struct EpochRewards{
// whether the rewards period (calculation and distribution) is active
active: bool, // byte. false: 0x00, true: 0x01
/* 0x00 */ active: bool, // byte. false: 0x00, true: 0x01
distribution_starting_block_height: u64, // little-endian unsigned 64-bit integer
/* 0x08 */ distribution_starting_block_height: u64, // little-endian unsigned 64-bit integer

Check failure on line 158 in proposals/0118-partitioned-epoch-reward-distribution.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Line length [Expected: 80; Actual: 95]

proposals/0118-partitioned-epoch-reward-distribution.md:158:81 MD013/line-length Line length [Expected: 80; Actual: 95]
num_partitions: u64, // little-endian unsigned 64-bit integer
/* 0x10 */ num_partitions: u64, // little-endian unsigned 64-bit integer
parent_blockhash: Hash, // byte-array of length 32
/* 0x18 */ parent_blockhash: Hash, // byte-array of length 32
// total points calculated for the current epoch, where points equals the sum
// of delegated stake * credits observed for all delegations
total_points: u128, // little-endian unsigned 128-bit integer
/* 0x38 */ total_points: u128, // little-endian unsigned 128-bit integer
// total rewards for the current epoch, in lamports
total_rewards: u64, // little-endian unsigned 64-bit integer
/* 0x48 */ total_rewards: u64, // little-endian unsigned 64-bit integer
// distributed rewards for the current epoch, in lamports
distributed_rewards: u64, // little-endian unsigned 64-bit integer
/* 0x50 */ distributed_rewards: u64, // little-endian unsigned 64-bit integer
}
```

Expand Down

0 comments on commit feeb48e

Please sign in to comment.