Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capella: add withdrawal boost factor constant #3073

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions presets/mainnet/capella.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# ---------------------------------------------------------------
# 2**8 (= 256) withdrawals
MAX_PARTIAL_WITHDRAWALS_PER_EPOCH: 256
# 1
WITHDRAWAL_BOOST_FACTOR: 1


# State list lengths
Expand Down
2 changes: 2 additions & 0 deletions presets/minimal/capella.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# ---------------------------------------------------------------
# [customized] 16 for more interesting tests at low validator count
MAX_PARTIAL_WITHDRAWALS_PER_EPOCH: 16
# [customized] 10 for more interesting tests ;)
WITHDRAWAL_BOOST_FACTOR: 10


# State list lengths
Expand Down
3 changes: 3 additions & 0 deletions specs/capella/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ We define the following Python custom types for type hinting and readability:
| Name | Value |
| - | - |
| `MAX_PARTIAL_WITHDRAWALS_PER_EPOCH` | `uint64(2**8)` (= 256) |
| `WITHDRAWAL_BOOST_FACTOR` | `1` |

### State list lengths

Expand Down Expand Up @@ -256,6 +257,8 @@ class BeaconState(Container):
def withdraw_balance(state: BeaconState, validator_index: ValidatorIndex, amount: Gwei) -> None:
# Decrease the validator's balance
decrease_balance(state, validator_index, amount)
# Apply the boost factor for custom network configurations
amount *= WITHDRAWAL_BOOST_FACTOR
# Create a corresponding withdrawal receipt
withdrawal = Withdrawal(
index=state.next_withdrawal_index,
Expand Down