(
context: R,
cfg: FinalizerConfig<C, O, V>,
)
| 126 | .generate_removed_validator_proof(*index) |
| 127 | .map(|field| StateProofEntry { field, key: None }), |
| 128 | }) |
| 129 | .collect() |
| 130 | } |
| 131 | |
| 132 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 133 | enum DepositRejectionReason { |
| 134 | Refund, |
| 135 | InvalidSignature, |
| 136 | /// Deposit chunk's Ed25519 / BLS key bytes did not decode. A single |
| 137 | /// malformed chunk in a grouped EIP-7685 deposit entry must not poison |
| 138 | /// the valid chunks alongside it. Routing this through the same refund |
| 139 | /// branch as `InvalidSignature` keeps the malformed chunk's depositor |
| 140 | /// whole. |
| 141 | MalformedKey, |
| 142 | } |
| 143 | |
| 144 | fn deposit_refund_key(domain_tag: u8, withdrawal_address: Address, deposit_index: u64) -> [u8; 32] { |
| 145 | let mut key = [0u8; 32]; |
| 146 | key[0] = domain_tag; |
| 147 | key[1..9].copy_from_slice(&deposit_index.to_le_bytes()); |
| 148 | key[12..32].copy_from_slice(withdrawal_address.as_ref()); |
| 149 | key |
| 150 | } |
| 151 | |
| 152 | fn refunded_deposit_key(withdrawal_address: Address, deposit_index: u64) -> [u8; 32] { |
| 153 | deposit_refund_key(0xFE, withdrawal_address, deposit_index) |
| 154 | } |
| 155 | |
| 156 | fn invalid_signature_refund_key(withdrawal_address: Address, deposit_index: u64) -> [u8; 32] { |
| 157 | deposit_refund_key(0xFF, withdrawal_address, deposit_index) |
| 158 | } |
| 159 | |
| 160 | fn invalid_deposit_tax_key(treasury_address: Address, deposit_index: u64) -> [u8; 32] { |
| 161 | deposit_refund_key(0xFD, treasury_address, deposit_index) |
| 162 | } |
| 163 | |
| 164 | fn push_invalid_deposit_withdrawals( |
| 165 | state: &mut ConsensusState, |
| 166 | withdrawal_credentials: Address, |
| 167 | refund_pubkey: [u8; 32], |
| 168 | deposit_index: u64, |
| 169 | amount: u64, |
| 170 | withdrawal_epoch: u64, |
| 171 | ) { |
| 172 | let (refund_amount, tax_amount) = |
| 173 | invalid_deposit_refund_split(amount, state.get_invalid_deposit_tax()); |
| 174 | |
| 175 | if refund_amount > 0 { |
| 176 | state.push_refund_withdrawal_request( |
| 177 | WithdrawalRequest { |
| 178 | source_address: withdrawal_credentials, |
| 179 | validator_pubkey: refund_pubkey, |
| 180 | amount: refund_amount, |
| 181 | }, |
| 182 | withdrawal_epoch, |
| 183 | 0, // deposit was never credited to balance |
| 184 | ); |
| 185 | } |
nothing calls this directly
no test coverage detected