Starts a block build directly against the execution layer.
(
&mut self,
client: Arc<EngineClient_>,
config: Arc<RollupConfig>,
attributes: AttributesWithParent,
)
| 82 | |
| 83 | /// Starts a block build directly against the execution layer. |
| 84 | pub async fn build( |
| 85 | &mut self, |
| 86 | client: Arc<EngineClient_>, |
| 87 | config: Arc<RollupConfig>, |
| 88 | attributes: AttributesWithParent, |
| 89 | ) -> Result<PayloadId, BuildTaskError> { |
| 90 | let _task_timer = |
| 91 | base_metrics::timed!(Metrics::engine_task_duration(Metrics::BUILD_TASK_LABEL)); |
| 92 | |
| 93 | match Self::build_with_state(&self.state, client.as_ref(), config.as_ref(), attributes) |
| 94 | .await |
| 95 | { |
| 96 | Ok(payload_id) => { |
| 97 | Metrics::engine_task_count(Metrics::BUILD_TASK_LABEL).increment(1); |
| 98 | Ok(payload_id) |
| 99 | } |
| 100 | Err(err) => { |
| 101 | let severity = err.severity(); |
| 102 | Metrics::engine_task_failure(Metrics::BUILD_TASK_LABEL, severity.as_label()) |
| 103 | .increment(1); |
| 104 | |
| 105 | match severity { |
| 106 | EngineTaskErrorSeverity::Temporary => { |
| 107 | trace!(target: "engine", error = %err, "Temporary engine error"); |
| 108 | } |
| 109 | EngineTaskErrorSeverity::Critical => { |
| 110 | error!(target: "engine", error = %err, "Critical engine error"); |
| 111 | } |
| 112 | EngineTaskErrorSeverity::Reset => { |
| 113 | warn!(target: "engine", "Engine requested derivation reset"); |
| 114 | } |
| 115 | EngineTaskErrorSeverity::Flush => { |
| 116 | warn!(target: "engine", "Engine requested derivation flush"); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | Err(err) |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | /// Starts a block build using the provided engine state. |
| 126 | pub async fn build_with_state( |