Skip to content

Commit

Permalink
feat(movement-rest): add proof entrypoints
Browse files Browse the repository at this point in the history
Signed-off-by: aeryz <[email protected]>
  • Loading branch information
aeryz committed Oct 1, 2024
1 parent 9854b18 commit 0ab332d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
# rust toolchain
(toolchain pkgs)

# for `hostname -I`
hostname-debian

# build dependencies
llvmPackages.bintools openssl openssl.dev libiconv pkg-config
libclang.lib libz clang pkg-config protobuf rustPlatform.bindgenHook
Expand Down
2 changes: 2 additions & 0 deletions networks/suzuka/suzuka-full-node/src/partial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ where
transaction_ingress_result,
background_task_result,
services_result,
movement_rest_result,
) = try_join!(
tokio::spawn(async move { exec_settle_task.run().await }),
tokio::spawn(async move { transaction_ingress_task.run().await }),
Expand All @@ -68,6 +69,7 @@ where
.and(transaction_ingress_result)
.and(background_task_result)
.and(services_result)
.and(movement_rest_result)
}
}

Expand Down
8 changes: 4 additions & 4 deletions protocol-units/movement-rest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ impl MovementRest {

pub fn try_from_env() -> Result<Self, Error> {
let url = env::var(Self::MOVEMENT_REST_ENV_VAR)
.unwrap_or_else(|_| "http://0.0.0.0:30832".to_string());
.unwrap_or_else(|_| "0.0.0.0:30832".to_string());
Ok(Self { url, context: None })
}

pub fn set_context(&mut self, context: Arc<Context>) {
self.context = Some(context);
}

pub fn run_service(&self) -> impl Future<Output = Result<(), Error>> + Send {
pub fn run_service(&self) -> impl Future<Output = anyhow::Result<()>> + Send {
info!("Starting movement rest service at {}", self.url);
let movement_rest = self.create_routes();
Server::new(TcpListener::bind(self.url.clone()))
Expand All @@ -60,11 +60,11 @@ impl MovementRest {
.at("/movement/v1/state-root-hash/:blockheight", get(state_root_hash))
.at("movement/v1/richard", get(richard))
.at(
"/movement/v1/resource-proof/:table_handle/:key/:blockheight",
"/movement/v1/table-item-with-proof/:table_handle/:key/:blockheight",
get(table_item_with_proof),
)
.at("/movement/v1/state-proof/:blockheight", get(state_proof))
.data(self.context.clone())
.data(self.context.as_ref().unwrap().clone())
.with(Tracing)
}
}
Expand Down

0 comments on commit 0ab332d

Please sign in to comment.