Skip to content

Commit

Permalink
run f3 sidecar with FFI
Browse files Browse the repository at this point in the history
  • Loading branch information
hanabi1224 committed Sep 5, 2024
1 parent 356ceb3 commit 6ebb17e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
25 changes: 3 additions & 22 deletions scripts/devnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ services:
environment:
- FIL_PROOFS_PARAMETER_CACHE=${FIL_PROOFS_PARAMETER_CACHE}
- RUST_LOG=info,forest_filecoin::blocks::header=trace
- FOREST_F3_SIDECAR_FFI_ENABLED=1
- FOREST_F3_FINALITY=${F3_FINALITY}
- FOREST_F3_PERMANENT_PARTICIPATING_MINER_ADDRESSES=${MINER_ACTOR_ADDRESS}
- FOREST_F3_SIDECAR_RPC_ENDPOINT=f3:${F3_RPC_PORT}
- FOREST_F3_SIDECAR_RPC_ENDPOINT=127.0.0.1:${F3_RPC_PORT}
- FOREST_GENESIS_NETWORK_VERSION=${GENESIS_NETWORK_VERSION}
- FOREST_SHARK_HEIGHT=${SHARK_HEIGHT}
- FOREST_HYGGE_HEIGHT=${HYGGE_HEIGHT}
Expand Down Expand Up @@ -275,27 +277,6 @@ services:
export FULLNODE_API_INFO=$$TOKEN:/dns/forest/tcp/${FOREST_RPC_PORT}/http
forest-wallet --remote-wallet import ${LOTUS_DATA_DIR}/genesis-sectors/pre-seal-${MINER_ACTOR_ADDRESS}.key || true
forest-cli net connect /dns/lotus/tcp/${LOTUS_P2P_PORT}/p2p/$$(cat ${LOTUS_DATA_DIR}/PEER_ID)
f3:
user: root
depends_on:
forest_connecter:
condition: service_completed_successfully
build:
context: ../../f3-sidecar
dockerfile: Dockerfile
container_name: f3
volumes:
- lotus-data:${LOTUS_DATA_DIR}
- forest-data:${FOREST_DATA_DIR}
ports:
- ${F3_RPC_PORT}:${F3_RPC_PORT}
networks:
- devnet
entrypoint: ["/bin/bash", "-c" ]
command:
- |
set -euxo pipefail
f3-sidecar -finality ${F3_FINALITY} -rpc http://forest:${FOREST_RPC_PORT}/rpc/v1 -f3-rpc 0.0.0.0:${F3_RPC_PORT}
volumes:
# Shared proof parameter files. It is re-used by both Lotus and Forest.
Expand Down
17 changes: 16 additions & 1 deletion src/daemon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,22 @@ pub(super) async fn start(
.await
});

let finality = chain_config.policy.chain_finality;
let finality = std::env::var("FOREST_F3_FINALITY")
.ok()
.and_then(|finality| {
finality.parse().ok().and_then(|f| {
if f > 0 {
tracing::warn!("F3 finality is set to {f} via FOREST_F3_FINALITY");
Some(f)
} else {
tracing::error!(
"F3 finality {f} set via FOREST_F3_FINALITY is invalid, a positive integer is expected."
);
None
}
})
})
.unwrap_or(chain_config.policy.chain_finality);
let chain = config.chain.to_string();
services.spawn_blocking(move || {
crate::f3::run_f3_sidecar_if_enabled(
Expand Down

0 comments on commit 6ebb17e

Please sign in to comment.