Conversation
Signed-off-by: Rez <rez@berachain.com>
Signed-off-by: Rez <rez@berachain.com>
Signed-off-by: Rez <rez@berachain.com>
Signed-off-by: Rez <rez@berachain.com>
There was a problem hiding this comment.
would probably note that this is for the first Electra hardfork on berachain (electra0 / "0x05000000"). We may activate 6110 or parts of 7691 in future Electra hardforks on berachain mainnet (electra1, etc.)
| | `WITHDRAWAL_REQUEST_TYPE` | `Bytes1('0x01')` | | ||
| | `CONSOLIDATION_REQUEST_TYPE` | `Bytes1('0x02')` | | ||
|
|
||
| @BERA: We introduce all of these fields, however, the Consensus Layer will only process `WITHDRAWAL_REQUEST_TYPE`. This means that if a user attempts to submit a `CONSOLIDATION_REQUEST_TYPE` or `DEPOSIT_REQUEST_TYPE`, they should expect to see no change to the system. However, their transaction will still be accepted on the execution layer. |
There was a problem hiding this comment.
would note that DEPOSIT_REQUEST_TYPE EL requests should not occur on Berachain as the unforked EL clients should not find Deposit Contract events to form as CL requests. (because the event signature in Berachain's deposit contract is different)
| | `MIN_ACTIVATION_BALANCE` | `Gwei(2**5 * 10**9)` (= 32,000,000,000) | *[New in Electra:EIP7251]* Minimum balance for a validator to become active | | ||
| | `MAX_EFFECTIVE_BALANCE_ELECTRA` | `Gwei(2**11 * 10**9)` (= 2048,000,000,000) | *[New in Electra:EIP7251]* Maximum effective balance for a compounding validator | | ||
|
|
||
| @BERA: In Berachain, `MIN_ACTIVATION_BALANCE` will be set to reflected as 250K Bera and `MAX_EFFECTIVE_BALANCE_ELECTRA` will be reflected as 10_000_000 BERA. |
There was a problem hiding this comment.
How will this play out with our already EjectionBalance? Asking this because we actually set our EjectionBalance on mainnet to 240k BERA. And then we handle that in processing the val set updates by adding back the 10k BERA increment here.
There was a problem hiding this comment.
This is now consolidated in MinActivationBalance
| return withdrawals, processed_partial_withdrawals_count | ||
| ``` | ||
|
|
||
| @BERA: We need to extend our implementation to handle `pending_partial_withdrawals`. |
There was a problem hiding this comment.
should we explain how we are using this list here?
There was a problem hiding this comment.
I don't see any reason to deviate from spec here
Co-authored-by: Cal Bera <calbera@berachain.com> Signed-off-by: Rez <rez@berachain.com>
| | ------------------------------- | ---------------- | ----------------------------------------------------------------------------------- | | ||
| | `COMPOUNDING_WITHDRAWAL_PREFIX` | `Bytes1('0x02')` | *[New in Electra:EIP7251]* Withdrawal credential prefix for a compounding validator | | ||
|
|
||
| @BERA: In Ethereum, compounding validators are those can have a balance higher than 32 ETH, introduced as part of EIP-7251. In Berachain, all validators are considered 'compounding validators' as they can all have a balance above 250k BERA. As such, we skip distinguishing between compounding and non-compounding validators. |
There was a problem hiding this comment.
| withdrawable_epoch: Epoch | ||
| ``` | ||
|
|
||
| @BERA: Must be introduced to support the withdrawals logic. |
There was a problem hiding this comment.
| index: uint64 | ||
| ``` | ||
|
|
||
| @BERA: Introduced for parity in ExecutionRequestsRoot calculation but unused. |
There was a problem hiding this comment.
| @BERA: Introduced for parity in ExecutionRequestsRoot calculation but unused. | ||
|
|
There was a problem hiding this comment.
| execution_requests: ExecutionRequests # [New in Electra] | ||
| ``` | ||
|
|
||
| @BERA: We extend the beacon block body with `execution_requests`. |
There was a problem hiding this comment.
| earliest_consolidation_epoch: Epoch # [New in Electra:EIP7251] @BERA: Unused | ||
| pending_deposits: List[PendingDeposit, PENDING_DEPOSITS_LIMIT] # [New in Electra:EIP7251] @BERA: Unused | ||
| # [New in Electra:EIP7251] | ||
| pending_partial_withdrawals: List[PendingPartialWithdrawal, PENDING_PARTIAL_WITHDRAWALS_LIMIT] |
There was a problem hiding this comment.
| ) | ||
| ``` | ||
|
|
||
| @BERA: Effectively already implemented as we have `v.EffectiveBalance >= threshold`, where `threshold` is equivalent to `MIN_ACTIVATION_BALANCE`. |
There was a problem hiding this comment.
| return is_compounding_withdrawal_credential(validator.withdrawal_credentials) | ||
| ``` | ||
|
|
||
| @BERA: `has_compounding_withdrawal_credential` but always returns true. See reasoning in `is_compounding_withdrawal_credential`. |
There was a problem hiding this comment.
| @BERA: Berachain only supports 0x01 credentials, so all validators should have this return true. We modify the implementation as below since `has_compounding_withdrawal_credential` will always returns true: | ||
|
|
||
| ```go | ||
| func (v Validator) HasExecutionWithdrawalCredential() bool { | ||
| return v.HasEth1WithdrawalCredentials() | ||
| } | ||
| ``` |
There was a problem hiding this comment.
| ) | ||
| ``` | ||
|
|
||
| @BERA: We do not need to deviate from this. |
There was a problem hiding this comment.
| return MIN_ACTIVATION_BALANCE | ||
| ``` | ||
|
|
||
| @BERA: This will always return 10_000_000 million on Berachain. |
There was a problem hiding this comment.
| ) | ||
| ``` | ||
|
|
||
| @BERA: Introduced and used in `process_withdrawal_request`. |
There was a problem hiding this comment.
| validator.SetExitEpoch(exitQueueEpoch) | ||
| validator.SetWithdrawableEpoch(withdrawableEpoch) | ||
| ``` | ||
|
|
There was a problem hiding this comment.
| We continue to ignore this case as there is not forseeable way for a validator's balance to fall below the EJECTION_BALANCE balance, without it directly initiating a validator exit. | ||
|
|
||
| For example, post-electra, if a Partial Withdrawal Request is made, the balance must remain above `MIN_ACTIVATION_BALANCE`. A Full Withdrawal Request will remove the entire balance and initiate a validator | ||
|
|
There was a problem hiding this comment.
| execution_requests: ExecutionRequests # [New in Electra] | ||
| ``` | ||
|
|
||
| @BERA: Implemented. |
There was a problem hiding this comment.
| ... | ||
| ``` | ||
|
|
||
| @BERA: Implemented. |
There was a problem hiding this comment.
| ... | ||
| ``` | ||
|
|
||
| @BERA: Implemented. |
There was a problem hiding this comment.
| @BERA: We modify: | ||
|
|
||
| - `process_withdrawals` - Update pending partial withdrawals | ||
| - `process_execution_payload` - Implemented. | ||
| - `process_operations` - Call `process_withdrawal_request` in `process_operations` | ||
|
|
There was a problem hiding this comment.
| ``` | ||
|
|
||
| @BERA: We need to extend our implementation to handle `pending_partial_withdrawals`. | ||
|
|
There was a problem hiding this comment.
New Logic in get_expected_withdrawals
| state.next_withdrawal_validator_index = next_validator_index | ||
| ``` | ||
|
|
||
| @BERA: We adopt the change around `processed_partial_withdrawals_count`. |
There was a problem hiding this comment.
| ] | ||
| ``` | ||
|
|
||
| @BERA: Implemented. |
There was a problem hiding this comment.
| ) | ||
| ``` | ||
|
|
||
| @BERA: Implemented. |
There was a problem hiding this comment.
Implicitly passed as part of the beacon block
| return validator | ||
| ``` | ||
|
|
||
| @BERA: In Berachain, the implementation can be found in `NewValidatorFromDeposit`. No change is required. |
There was a problem hiding this comment.
| 1. `initiate_validator_exit` does not rely on churn. | ||
| 2. `has_compounding_withdrawal_credential` will always be true. | ||
| 3. Partial withdrawals will not rely on churn to calculate the exit and withdrawable epochs. | ||
|
|
There was a problem hiding this comment.
particular care needs to be taken to ensure we're doing correct erorr handling
| return post | ||
| ``` | ||
|
|
||
| @BERA: We need to update the BeaconState fork version and set `pending_partial_withdrawals=[]`. |
There was a problem hiding this comment.
The PR annotates the pectra specification with the relevant changes for Berachain.