MCPcopy Create free account
hub / github.com/base/base / execute

Method execute

acceptance/src/runner.rs:173–269  ·  view source on GitHub ↗

Performs the cancellable portion; the caller owns final evidence and teardown.

(
        config: &ScenarioConfig,
        options: &AcceptanceOptions,
        provisioner: &mut Provisioner,
        result: &mut ScenarioResult,
        origin: Instant,
        deadline: Instant,

Source from the content-addressed store, hash-verified

171
172 /// Performs the cancellable portion; the caller owns final evidence and teardown.
173 pub async fn execute(
174 config: &ScenarioConfig,
175 options: &AcceptanceOptions,
176 provisioner: &mut Provisioner,
177 result: &mut ScenarioResult,
178 origin: Instant,
179 deadline: Instant,
180 ) -> Result<()> {
181 let setup = Instant::now();
182 let endpoints = match &options.endpoints {
183 Some(endpoints) => endpoints.clone(),
184 None => provisioner.setup(config, options.build).await?,
185 };
186 let deadline = deadline.min(Instant::now() + config.timeout.0);
187 result.stages.push(Self::stage(
188 "setup",
189 Status::Passed,
190 setup,
191 if options.endpoints.is_some() {
192 "attached read-only; no resources created"
193 } else {
194 "fresh deployment and genesis verified"
195 },
196 ));
197 Self::validate_endpoints(config, &endpoints)?;
198 let needs_forks = config.checks.iter().any(|check| check.start().is_some());
199 if options.endpoints.is_none() || needs_forks || options.rollup.is_some() {
200 let path = match &options.rollup {
201 Some(path) => path.clone(),
202 None if options.endpoints.is_none() => {
203 options.output.join("private/devnet/l2/configs/rollup.json")
204 }
205 None => bail!("fork-window checks in attach mode require --rollup"),
206 };
207 result.forks = config.verified_forks(&path)?;
208 }
209 let observer =
210 RpcObserver::new(config.readiness.request_timeout.0, config.readiness.poll_interval.0)?;
211 let ready = Instant::now();
212 let readiness_deadline = (ready + config.readiness.timeout.0).min(deadline);
213 let readiness = tokio::time::timeout_at(
214 readiness_deadline,
215 Self::wait_ready(&observer, config, &endpoints, readiness_deadline),
216 )
217 .await;
218 let readiness_error = match readiness {
219 Ok(Ok(())) => None,
220 Ok(Err(error)) => Some(error.to_string()),
221 Err(_) => Some("readiness deadline elapsed without identity and progress".into()),
222 };
223 result.stages.push(Self::stage(
224 "readiness",
225 if readiness_error.is_none() { Status::Passed } else { Status::Error },
226 ready,
227 readiness_error
228 .as_deref()
229 .unwrap_or("required endpoints have the expected identity and advance"),
230 ));

Callers

nothing calls this directly

Calls 12

minMethod · 0.80
is_someMethod · 0.80
verified_forksMethod · 0.80
newFunction · 0.50
cloneMethod · 0.45
setupMethod · 0.45
pushMethod · 0.45
iterMethod · 0.45
startMethod · 0.45
as_refMethod · 0.45
findMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected