(
&self,
attributes: &Types::PayloadAttributes,
header: &<Self::Block as Block>::Header,
)
| 222 | } |
| 223 | |
| 224 | fn validate_payload_attributes_against_header( |
| 225 | &self, |
| 226 | attributes: &Types::PayloadAttributes, |
| 227 | header: &<Self::Block as Block>::Header, |
| 228 | ) -> Result<(), InvalidPayloadAttributesError> { |
| 229 | let timestamp = attributes.timestamp(); |
| 230 | if !self.chain_spec().is_denim_active_at_timestamp(timestamp) { |
| 231 | return (timestamp > header.timestamp()) |
| 232 | .then_some(()) |
| 233 | .ok_or(InvalidPayloadAttributesError::InvalidTimestamp); |
| 234 | } |
| 235 | |
| 236 | let invalid_metadata = |error: BaseTimeMetadataError| { |
| 237 | InvalidPayloadAttributesError::InvalidParams(Box::new(error)) |
| 238 | }; |
| 239 | let transaction = attributes |
| 240 | .sequencer_transactions() |
| 241 | .get(1) |
| 242 | .ok_or_else(|| invalid_metadata(BaseTimeMetadataError::Missing))?; |
| 243 | let deposit = transaction |
| 244 | .value() |
| 245 | .as_deposit() |
| 246 | .ok_or_else(|| invalid_metadata(BaseTimeMetadataError::NotDeposit))?; |
| 247 | BaseTimeUpdateTx::validate_deposit(deposit, header.number() + 1) |
| 248 | .map_err(invalid_metadata)?; |
| 249 | |
| 250 | // The parent header does not contain its millisecond component, so only whole-second |
| 251 | // ordering can be checked here. |
| 252 | (timestamp >= header.timestamp()) |
| 253 | .then_some(()) |
| 254 | .ok_or(InvalidPayloadAttributesError::InvalidTimestamp) |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | impl<Types, Tx, ChainSpec> EngineApiValidator<Types> for BaseEngineValidator<Tx, ChainSpec> |
nothing calls this directly
no test coverage detected