Skip to content

Commit

Permalink
example running indexer in parallel with vm
Browse files Browse the repository at this point in the history
  • Loading branch information
willemolding committed Apr 13, 2024
1 parent 5ccdafd commit 5586cbe
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 6 deletions.
95 changes: 95 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ cartezcash-lightwalletd = { path = "cartezcash-lightwalletd", optional = true }
tower-cartesi = { path = "tower-cartesi" }

[features]
default = []
default = ["listen-http"]
lightwalletd = ["dep:cartezcash-lightwalletd", "dep:tonic", "dep:zebra-state"]
preinitialize-halo2 = []
listen-http = []
listen-graphql = []

[workspace]
members = [ "cartezcash-lightwalletd", "tiny-cash", "tower-cartesi"]
Expand Down
10 changes: 7 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ run:
run-local:
ROLLUP_HTTP_SERVER_URL=http://127.0.0.1:8080/host-runner GRPC_SERVER_URL="[::1]:50051" cargo run --features lightwalletd

run-local-graphql:
ROLLUP_HTTP_SERVER_URL=http://127.0.0.1:8080/graphql GRPC_SERVER_URL="[::1]:50051" cargo run --no-default-features --features listen-graphql,lightwalletd


sunodo-nobackend:
sunodo run --no-backend

##### Interact with dApp via sunodo

@deposit address amount:
sunodo send ether --execLayerData=$1 --amount=$2 --rpc-url=http://127.0.0.1:8545 --chain-id=31337 --dapp=0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C
sunodo send ether --execLayerData=$1 --amount=$2 --rpc-url=http://127.0.0.1:8545 --chain-id=31337 --dapp=0xab7528bb862fB57E8A2BCd567a2e929a0Be56a5e

@send txn_hex:
sunodo send generic --input="0x$2" --rpc-url=http://127.0.0.1:8545 --chain-id=31337 --dapp=0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C
sunodo send generic --input="0x$2" --rpc-url=http://127.0.0.1:8545 --chain-id=31337 --dapp=0xab7528bb862fB57E8A2BCd567a2e929a0Be56a5e

execute_voucher:
cast send 0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C "executeVoucher(address, bytes, struct Proof _proof)"
cast send 0xab7528bb862fB57E8A2BCd567a2e929a0Be56a5e "executeVoucher(address, bytes, struct Proof _proof)"

##### wallet related commands

Expand Down
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use tower::{buffer::Buffer, util::BoxService, BoxError, Service, ServiceExt};
use tower_cartesi::{listen_http, Request as RollAppRequest, Response};
use tower_cartesi::{Request as RollAppRequest, Response};

use futures_util::future::FutureExt;

Expand Down Expand Up @@ -79,7 +79,13 @@ async fn main() -> Result<(), anyhow::Error> {
tracing::info!("wallet GRPC server listening on {}", addr);
}

listen_http(&mut cartezcash_app, &server_addr)
#[cfg(feature = "listen-http")]
tower_cartesi::listen_http(&mut cartezcash_app, &server_addr)
.await
.expect("Failed to start the rollup server");

#[cfg(feature = "listen-graphql")]
tower_cartesi::listen_graphql(&mut cartezcash_app, &server_addr, 10)
.await
.expect("Failed to start the rollup server");

Expand Down

0 comments on commit 5586cbe

Please sign in to comment.