Conversation
There was a problem hiding this comment.
Code Review
This pull request expands the Espresso API by implementing the Data and Consensus APIs for v2 and the Availability API for v1. These changes introduce endpoints for retrieving namespace proofs, incorrect encoding proofs, state certificates, and stake tables, along with their corresponding proto definitions and Axum routing logic. The review feedback identifies a critical recurring logic error across several new handlers in crates/espresso/node/src/api/state.rs, where the join! macro is used twice on the same set of futures. This pattern is invalid as the first join! resolves the futures, causing subsequent calls to with_timeout or a second join! to fail during compilation.
|
Unable to build without Cargo.lock file. This means that after this change 3rd party projects may have For the first failing build see: https://github.com/EspressoSystems/espresso-network/actions/runs/24975975015 To reproduce locally run This PR can still be merged. |
| .await | ||
| .map(Json) | ||
| .map_err(ApiError::Internal) | ||
| }; |
There was a problem hiding this comment.
this part here feels a bit verbose and could probably be condensed. exploring options in the next PR.
|
|
||
| // Fetch block and VID common data | ||
| let ds = &*self.data_source; | ||
| let timeout = std::time::Duration::from_millis(500); |
There was a problem hiding this comment.
this seems a bit weird, but the existing incorrect_encoding_proof path uses get_block_for_ns_proof which (I believe) does essentially the same thing
| })?; | ||
|
|
||
| // Store the fetched certificate | ||
| ds.insert_state_cert(epoch, cert.clone()).await?; |
There was a problem hiding this comment.
this mirrors the existing get_state_cert in espresso/node/src/api/endpoints/availability.rs, though maybe we should revisit the behaviour
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
This PR migrates the
availabilityendpoint to Axum, with a copy of the old endpoint served atv1/availabilityand newer protobuf-specified endpoints served atv2/dataandv2/consensus.You can skip
test_api.rs(this is just to render an example UI without having to compileespresso-node) andespresso.api.v2.rs(this is automatically generated).