diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d811559..3a82ffc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Run clippy run: cargo clippy --all-targets --all-features -- -D warnings - integration-test: + foc-start-test: runs-on: ["self-hosted", "linux", "x64", "16xlarge+gpu"] timeout-minutes: 60 diff --git a/README.md b/README.md index 2a018acd..06126cb8 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,19 @@ This will: ### Step 4: Use the Network -See [examples/README.md](examples/README.md) for how you can easily consume network addresses, parameters, etc. and hook them into Synapse, etc. +After startup, `USER_1` is fully configured for FOC: USDFC deposited into FilecoinPay and FWSS approved as an operator. You can use it immediately with synapse-sdk: + +```bash +NETWORK=devnet node utils/example-storage-e2e.js +``` + +All connection details (contract addresses, user keys, SP endpoints) are exported to `devnet-info.json`: + +```bash +cat ~/.foc-devnet/state/latest/devnet-info.json +``` + +See [examples/README.md](examples/README.md) for more usage examples. --- diff --git a/README_ADVANCED.md b/README_ADVANCED.md index a74aecdc..58375405 100644 --- a/README_ADVANCED.md +++ b/README_ADVANCED.md @@ -969,9 +969,12 @@ Steps run sequentially by default, or in parallel when using the `--parallel` fl - Approve authorized SPs - Save provider IDs -**Synapse E2E Test Step:** - - Run end-to-end verification - - Test deal flow (unless `--notest` flag is used) +**Synapse E2E Test Step:** (skipped with `--notest`) + - Set up USER_1 for FOC: approve and deposit USDFC into FilecoinPay, approve FWSS as operator + - Export `devnet-info.json` to `~/.foc-devnet/run//devnet-info.json` + - Run synapse-sdk storage E2E test to verify the full deal flow + - After this step, USER_1 can interact with FOC storage services via synapse-sdk + - USER_2 and USER_3 are funded with USDFC but not configured for FOC #### Post Start Steps - Save step context diff --git a/scripts/cache-artifacts.sh b/scripts/cache-artifacts.sh deleted file mode 100755 index c87bd9d0..00000000 --- a/scripts/cache-artifacts.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# cache-artifacts.sh - Helper script to cache large artifacts for fast development iteration -# -# This script copies pre-downloaded artifacts from ~/stash/ to ~/.foc-devnet/artifacts/ -# to avoid re-downloading them during init. - -set -e - -STASH_DIR="${STASH_DIR:-$HOME/stash}" -FOC_ARTIFACTS="$HOME/.foc-devnet/artifacts" -FOC_VOLUMES="$FOC_ARTIFACTS/docker/volumes" - -echo "🚀 Caching artifacts for fast init..." -echo - -# Check if stash directory exists -if [ ! -d "$STASH_DIR" ]; then - echo "❌ Error: Stash directory not found at $STASH_DIR" - echo " Set STASH_DIR environment variable if it's in a different location." - exit 1 -fi - -# Create artifacts directory -mkdir -p "$FOC_ARTIFACTS" -echo "✅ Created artifacts directory: $FOC_ARTIFACTS" - -# Cache Yugabyte tarball -echo -echo "📦 Caching Yugabyte tarball..." - -# Detect architecture for YugabyteDB -ARCH=$(uname -m) -if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then - YUGABYTE_ARCH_SUFFIX="el8-aarch64" -else - YUGABYTE_ARCH_SUFFIX="linux-x86_64" -fi -YUGABYTE_TARBALL="yugabyte-2.25.1.0-b381-${YUGABYTE_ARCH_SUFFIX}.tar.gz" - -if [ -f "$STASH_DIR/yugabyte/$YUGABYTE_TARBALL" ]; then - cp "$STASH_DIR/yugabyte/$YUGABYTE_TARBALL" "$FOC_ARTIFACTS/" - echo "✅ Yugabyte cached ($YUGABYTE_ARCH_SUFFIX, ~422 MB)" -else - echo "⚠️ Warning: Yugabyte tarball not found: $STASH_DIR/yugabyte/$YUGABYTE_TARBALL" - echo " This will be downloaded during init (~422 MB)" -fi - -# Cache proof parameters (only if volumes directory exists) -echo -echo "📦 Caching Filecoin proof parameters..." -if [ -d "$STASH_DIR/filecoin-proof-parameters" ]; then - if [ -d "$FOC_VOLUMES" ]; then - mkdir -p "$FOC_VOLUMES/filecoin-proof-parameters" - echo " Copying proof parameters (~2 GB, this may take a minute)..." - cp -r "$STASH_DIR/filecoin-proof-parameters/"* "$FOC_VOLUMES/filecoin-proof-parameters/" - echo "✅ Proof parameters cached (~2 GB)" - else - echo "⚠️ Skipping proof parameters (volumes directory doesn't exist yet)" - echo " Run this script again after 'cargo run init' completes" - echo " Or manually copy with:" - echo " mkdir -p $FOC_VOLUMES/filecoin-proof-parameters" - echo " cp -r $STASH_DIR/filecoin-proof-parameters/* $FOC_VOLUMES/filecoin-proof-parameters/" - fi -else - echo "⚠️ Warning: Proof parameters not found in $STASH_DIR/filecoin-proof-parameters/" - echo " These will be downloaded during first build (~2 GB)" -fi - -echo -echo "✅ Artifact caching complete!" -echo -echo "💡 Quick init command with local repositories:" -echo " cargo run init \\" -echo " --curio local:$HOME/code/curio \\" -echo " --filecoin-services local:$HOME/code/filecoin-services \\" -echo " --lotus local:$HOME/code/lotus" -echo diff --git a/scripts/deploy-mock-usdfc.sh b/scripts/deploy-mock-usdfc.sh deleted file mode 100755 index b3eb04c2..00000000 --- a/scripts/deploy-mock-usdfc.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# Deploy MockUSDFC token using cast/forge -# -# This script deploys a simple ERC-20 token for local testing. -# It requires the following environment variables: -# - ETH_RPC_URL: Ethereum RPC endpoint (e.g., http://localhost:1234/rpc/v1) -# - DEPLOYER_ADDRESS: Ethereum address of the deployer -# - INITIAL_SUPPLY: Initial token supply (in wei, 18 decimals) - -set -e - -if [ -z "$ETH_RPC_URL" ]; then - echo "Error: ETH_RPC_URL not set" - exit 1 -fi - -if [ -z "$DEPLOYER_ADDRESS" ]; then - echo "Error: DEPLOYER_ADDRESS not set" - exit 1 -fi - -INITIAL_SUPPLY=${INITIAL_SUPPLY:-"1000000000000000000000000"} # 1 million tokens - -echo "Deploying MockUSDFC token..." -echo " RPC URL: $ETH_RPC_URL" -echo " Deployer: $DEPLOYER_ADDRESS" -echo " Initial Supply: $INITIAL_SUPPLY" - -# Solidity bytecode for a simple ERC-20 token -# This is a minimal implementation for testing -# In production, you'd compile from source using solc/forge - -# For now, we'll use a simple approach: -# 1. Check if forge is available -# 2. If yes, compile and deploy MockUSDFC.sol -# 3. If no, use a pre-compiled minimal ERC-20 bytecode - -if command -v forge &> /dev/null; then - echo "Using forge to compile and deploy..." - - # Compile the contract - SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" - CONTRACT_PATH="$SCRIPT_DIR/../contracts/MockUSDFC.sol" - - if [ ! -f "$CONTRACT_PATH" ]; then - echo "Error: MockUSDFC.sol not found at $CONTRACT_PATH" - exit 1 - fi - - # Deploy using forge create - # Note: This assumes the deployer's private key is available - # For now, we'll use eth_sendTransaction which requires the account to be unlocked - - forge create "$CONTRACT_PATH:MockUSDFC" \ - --rpc-url "$ETH_RPC_URL" \ - --constructor-args "$INITIAL_SUPPLY" \ - --json -else - echo "Warning: forge not available" - echo "Skipping actual deployment - using placeholder address" - echo "{" - echo " \"deployedTo\": \"0x0000000000000000000000000000000000000000\"," - echo " \"transactionHash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\"" - echo "}" -fi diff --git a/scripts/patch-lotus-buildconstants.sh b/scripts/patch-lotus-buildconstants.sh deleted file mode 100755 index dac4a4a2..00000000 --- a/scripts/patch-lotus-buildconstants.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/bash -# Patch Lotus buildconstants to make timing parameters settable via linker flags - -LOTUS_DIR="${1:-$HOME/code/lotus}" -PARAMS_FILE="$LOTUS_DIR/build/buildconstants/params_localnet.go" - -if [ ! -f "$PARAMS_FILE" ]; then - echo "Error: $PARAMS_FILE not found" - exit 1 -fi - -# Check if already patched -if grep -q "blockDelaySecsStr" "$PARAMS_FILE"; then - echo "Already patched" - exit 0 -fi - -echo "Patching $PARAMS_FILE to support linker flags..." - -# Create a backup -cp "$PARAMS_FILE" "$PARAMS_FILE.backup" - -# Use sed to replace the variable declarations with linker-flag-compatible versions -cat > "$PARAMS_FILE" << 'EOF' -//go:build localnet -// +build localnet - -package buildconstants - -import ( - _ "embed" - "strconv" - - "github.com/ipfs/go-cid" - - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/network" - builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" - - "github.com/filecoin-project/lotus/chain/actors/builtin" -) - -var NetworkBundle = "localnet" -var ActorDebugging = true - -const BootstrappersFile = "" -const GenesisFile = "" - -const GenesisNetworkVersion = network.Version0 - -var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ - 0: DrandQuicknet, -} - -var UpgradeBreezeHeight = abi.ChainEpoch(-1) - -const BreezeGasTampingDuration = 0 - -var UpgradeSmokeHeight = abi.ChainEpoch(-1) -var UpgradeIgnitionHeight = abi.ChainEpoch(-2) -var UpgradeRefuelHeight = abi.ChainEpoch(-3) -var UpgradeTapeHeight = abi.ChainEpoch(-4) -var UpgradeAssemblyHeight = abi.ChainEpoch(-5) -var UpgradeLiftoffHeight = abi.ChainEpoch(-6) -var UpgradeKumquatHeight = abi.ChainEpoch(-7) -var UpgradeCalicoHeight = abi.ChainEpoch(-9) -var UpgradePersianHeight = abi.ChainEpoch(-10) -var UpgradeOrangeHeight = abi.ChainEpoch(-11) -var UpgradeClausHeight = abi.ChainEpoch(-12) -var UpgradeTrustHeight = abi.ChainEpoch(-13) -var UpgradeNorwegianHeight = abi.ChainEpoch(-14) -var UpgradeTurboHeight = abi.ChainEpoch(-15) -var UpgradeHyperdriveHeight = abi.ChainEpoch(-16) -var UpgradeChocolateHeight = abi.ChainEpoch(-17) -var UpgradeOhSnapHeight = abi.ChainEpoch(-18) -var UpgradeSkyrHeight = abi.ChainEpoch(-19) -var UpgradeSharkHeight = abi.ChainEpoch(-20) -var UpgradeHyggeHeight = abi.ChainEpoch(-21) -var UpgradeLightningHeight = abi.ChainEpoch(-22) -var UpgradeThunderHeight = abi.ChainEpoch(-23) -var UpgradeWatermelonHeight = abi.ChainEpoch(-24) -var UpgradeDragonHeight = abi.ChainEpoch(-25) -var UpgradePhoenixHeight = abi.ChainEpoch(-26) -var UpgradeWaffleHeight = abi.ChainEpoch(-27) -var UpgradeTeepInitialFilReserved = InitialFilReserved - -var UpgradeTuktukHeight = abi.ChainEpoch(-31) - -var UpgradeTuktukPowerRampDurationEpochs = uint64(builtin.EpochsInDay * 3) - -const UpgradeTeepHeight abi.ChainEpoch = -32 - -var UpgradeTockHeight abi.ChainEpoch = UpgradeTeepHeight + builtin.EpochsInDay*7 - -const UpgradeTockFixHeight abi.ChainEpoch = -33 - -const UpgradeGoldenWeekHeight abi.ChainEpoch = -34 - -// This fix upgrade only ran on calibrationnet -var UpgradeWatermelonFixHeight = abi.ChainEpoch(-28) - -// This fix upgrade only ran on calibrationnet -var UpgradeWatermelonFix2Height = abi.ChainEpoch(-29) - -// This fix upgrade only ran on calibrationnet -var UpgradeCalibrationDragonFixHeight = abi.ChainEpoch(-30) - -var ConsensusMinerMinPower = abi.NewStoragePower(2048) -var PreCommitChallengeDelay = abi.ChainEpoch(10) - -// Make timing parameters configurable via linker flags -// These are string variables that get parsed to uint64 at init time -var blockDelaySecsStr = "30" -var propagationDelaySecsStr = "6" -var equivocationDelaySecsStr = "2" - -var BlockDelaySecs uint64 -var PropagationDelaySecs uint64 -var EquivocationDelaySecs uint64 - -func init() { - // Parse string values set by linker flags - var err error - BlockDelaySecs, err = strconv.ParseUint(blockDelaySecsStr, 10, 64) - if err != nil { - BlockDelaySecs = uint64(builtin2.EpochDurationSeconds) - } - PropagationDelaySecs, err = strconv.ParseUint(propagationDelaySecsStr, 10, 64) - if err != nil { - PropagationDelaySecs = 6 - } - EquivocationDelaySecs, err = strconv.ParseUint(equivocationDelaySecsStr, 10, 64) - if err != nil { - EquivocationDelaySecs = 2 - } -} - -const BootstrapPeerThreshold = 1 - -// ChainId defines the chain ID used in the Ethereum JSON-RPC endpoint. -// As per https://github.com/ethereum-lists/chains -const Eip155ChainId = 31415926 - -var WhitelistedBlock = cid.Undef - -const F3Enabled = false - -var F3ManifestBytes []byte - -func init() { - BuildType |= BuildLocalnet - SetAddressNetwork(address.Testnet) - Devnet = true -} -EOF - -echo "Patch complete! Backup saved to $PARAMS_FILE.backup" -echo "Now the timing parameters can be set via linker flags:" -echo " -X github.com/filecoin-project/lotus/build/buildconstants.blockDelaySecsStr=2" -echo " -X github.com/filecoin-project/lotus/build/buildconstants.propagationDelaySecsStr=1" -echo " -X github.com/filecoin-project/lotus/build/buildconstants.equivocationDelaySecsStr=0" diff --git a/src/cli.rs b/src/cli.rs index 62995742..993301dc 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -18,9 +18,6 @@ pub enum Commands { /// Run steps in parallel where possible (experimental) #[arg(long)] parallel: bool, - /// Skip the end-to-end tests - #[arg(long)] - notest: bool, }, /// Stop the local cluster Stop, @@ -35,9 +32,6 @@ pub enum Commands { /// Filecoin Services source location (e.g., 'gittag:v1.0.0', 'gittag:url:tag', 'gitcommit:abc123', 'gitcommit:url:commit', 'gitbranch:main', 'gitbranch:url:main', 'local:/path/to/filecoin-services') #[arg(long)] filecoin_services: Option, - /// Synapse SDK source location (e.g., 'gittag:synapse-sdk-v0.36.1', 'gittag:url:tag', 'gitcommit:abc123', 'gitcommit:url:commit', 'gitbranch:main', 'gitbranch:url:branch', 'local:/path/to/synapse-sdk') - #[arg(long)] - synapse_sdk: Option, /// Yugabyte download URL #[arg(long)] yugabyte_url: Option, diff --git a/src/commands/init/config.rs b/src/commands/init/config.rs index 03e5b152..82966f3f 100644 --- a/src/commands/init/config.rs +++ b/src/commands/init/config.rs @@ -15,13 +15,12 @@ use crate::paths::foc_devnet_config; /// configuration directory. If the file already exists and `force` is false, /// it skips generation. If `force` is true, it overwrites the existing file. /// -/// Location overrides can be provided for Curio, Lotus, Filecoin Services, Synapse SDK, and Yugabyte URL. +/// Location overrides can be provided for Curio, Lotus, Filecoin Services, and Yugabyte URL. /// /// # Arguments /// * `curio_location` - Optional override for Curio repository location /// * `lotus_location` - Optional override for Lotus repository location /// * `filecoin_services_location` - Optional override for Filecoin Services repository location -/// * `synapse_sdk_location` - Optional override for Synapse SDK repository location /// * `yugabyte_url` - Optional override for Yugabyte download URL /// * `force` - Whether to force regeneration of config file /// @@ -31,7 +30,6 @@ pub fn generate_default_config( curio_location: Option, lotus_location: Option, filecoin_services_location: Option, - synapse_sdk_location: Option, yugabyte_url: Option, force: bool, ) -> Result<(), Box> { @@ -68,11 +66,6 @@ pub fn generate_default_config( filecoin_services_location, "https://github.com/FilOzone/filecoin-services.git", )?; - apply_location_override( - &mut config.synapse_sdk, - synapse_sdk_location, - "git@github.com:FilOzone/synapse-sdk.git", - )?; // Override yugabyte URL if provided if let Some(url) = yugabyte_url { diff --git a/src/commands/init/mod.rs b/src/commands/init/mod.rs index 4ee9b348..25b0932e 100644 --- a/src/commands/init/mod.rs +++ b/src/commands/init/mod.rs @@ -127,7 +127,6 @@ pub struct InitOptions { pub curio_location: Option, pub lotus_location: Option, pub filecoin_services_location: Option, - pub synapse_sdk_location: Option, pub yugabyte_url: Option, pub yugabyte_archive: Option, pub proof_params_dir: Option, @@ -151,7 +150,6 @@ pub fn init_environment(options: InitOptions) -> Result<(), Box Result<(), Box> { // Download multicall3 repository if Git-based download_repository("multicall3", &config.multicall3)?; - // Download synapse-sdk repository if Git-based - download_repository("synapse-sdk", &config.synapse_sdk)?; - info!("Code repositories are now available."); Ok(()) } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 754ff77e..6b9c7c05 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -19,10 +19,6 @@ pub use requirements::check_requirements; pub use status::status; pub use stop::stop_cluster; -pub fn start_cluster( - parallel: bool, - run_id: String, - notest: bool, -) -> Result<(), Box> { - start::start_cluster(parallel, run_id, notest) +pub fn start_cluster(parallel: bool, run_id: String) -> Result<(), Box> { + start::start_cluster(parallel, run_id) } diff --git a/src/commands/start/mod.rs b/src/commands/start/mod.rs index b4bfd417..ad743144 100644 --- a/src/commands/start/mod.rs +++ b/src/commands/start/mod.rs @@ -12,9 +12,9 @@ mod multicall3_deploy; mod pdp_service_provider; pub mod prerequisites_check; pub mod step; -mod synapse_test_e2e; mod usdfc_deploy; mod usdfc_funding; +mod user_setup; mod yugabyte; use curio::CurioStep; @@ -28,8 +28,8 @@ use multicall3_deploy::MultiCall3DeployStep; use pdp_service_provider::PdpSpRegistrationStep; use prerequisites_check::PrerequisitesCheckStep; pub use step::{execute_steps, execute_steps_parallel, SetupContext, Step}; -use synapse_test_e2e::SynapseTestE2EStep; use usdfc_deploy::USDFCDeployStep; +use user_setup::UserSetupStep; use yugabyte::YugabyteStep; use crate::commands::start::usdfc_funding::USDFCFundingStep; @@ -262,12 +262,7 @@ fn load_and_validate_config() -> Result> { } /// Create all the step instances for the cluster startup sequence. -fn create_steps( - volumes_dir: &Path, - run_dir: &Path, - config: &Config, - notest: bool, -) -> Vec> { +fn create_steps(volumes_dir: &Path, run_dir: &Path, config: &Config) -> Vec> { let lotus_step = LotusStep::new(volumes_dir.to_path_buf(), run_dir.to_path_buf()); let lotus_miner_step = LotusMinerStep::new(volumes_dir.to_path_buf(), run_dir.to_path_buf()); let eth_acc_funding_step = @@ -294,14 +289,13 @@ fn create_steps( run_dir.to_path_buf(), config.active_pdp_sp_count, ); - let synapse_test_step = - SynapseTestE2EStep::new(volumes_dir.to_path_buf(), run_dir.to_path_buf(), notest); let endorsement_step = EndorsementStep::new( volumes_dir.to_path_buf(), run_dir.to_path_buf(), config.endorsed_pdp_sp_count, config.active_pdp_sp_count, ); + let user_setup_step = UserSetupStep::new(volumes_dir.to_path_buf(), run_dir.to_path_buf()); // Execute all steps // Note: PDP SP registration MUST happen after Curio because it needs @@ -318,7 +312,7 @@ fn create_steps( Box::new(curio_step), Box::new(pdp_sp_reg_step), Box::new(endorsement_step), - Box::new(synapse_test_step), + Box::new(user_setup_step), ] } @@ -337,12 +331,12 @@ fn create_steps( /// - Epoch 6: FOC Deploy + MockUSDFC Funding + Yugabyte (can be parallelized, needs USDFC deployed) /// - Epoch 7: Curio daemons (needs Yugabyte) /// - Epoch 8: PDP SP Registration (needs Curio running, for port information) -/// - Epoch 9: Synapse E2E Test (final validation) +/// - Epoch 9: Endorse PDP SPs (final step) +/// - Epoch 10: USER_1 payment setup (depends on FOC contracts + Lotus) fn create_step_epochs( volumes_dir: &Path, run_dir: &Path, config: &Config, - notest: bool, ) -> Vec>> { let prerequisites_check_step = PrerequisitesCheckStep::new(); let lotus_step = LotusStep::new(volumes_dir.to_path_buf(), run_dir.to_path_buf()); @@ -371,14 +365,13 @@ fn create_step_epochs( config.active_pdp_sp_count, config.approved_pdp_sp_count, ); - let synapse_test_step = - SynapseTestE2EStep::new(volumes_dir.to_path_buf(), run_dir.to_path_buf(), notest); let endorsement_step = EndorsementStep::new( volumes_dir.to_path_buf(), run_dir.to_path_buf(), config.endorsed_pdp_sp_count, config.active_pdp_sp_count, ); + let user_setup_step = UserSetupStep::new(volumes_dir.to_path_buf(), run_dir.to_path_buf()); vec![ // Epoch 1: Prerequisites check (binaries & Docker images - must run first) @@ -406,8 +399,8 @@ fn create_step_epochs( vec![Box::new(pdp_sp_reg_step)], // Epoch 9: Endorse PDP SPs (needs registration complete) vec![Box::new(endorsement_step)], - // Epoch 10: Run Synapse E2E Test - vec![Box::new(synapse_test_step)], + // Epoch 10: USER_1 payment setup (needs FOC contracts deployed) + vec![Box::new(user_setup_step)], ] } @@ -419,7 +412,6 @@ fn execute_cluster_steps( config: &Config, parallel: bool, portainer_port: u16, - notest: bool, ) -> Result> { // Ensure genesis prerequisites are ready (one-time setup, needs config for sector count) ensure_genesis_prerequisites(config.active_pdp_sp_count, run_id)?; @@ -454,7 +446,7 @@ fn execute_cluster_steps( if parallel { info!("Execution mode: PARALLEL (experimental)"); - let step_epochs = create_step_epochs(volumes_dir, run_dir, config, notest); + let step_epochs = create_step_epochs(volumes_dir, run_dir, config); // Convert Vec>> to Vec> let epoch_refs: Vec> = step_epochs @@ -466,7 +458,7 @@ fn execute_cluster_steps( Ok(context) } else { info!("Execution mode: SEQUENTIAL"); - let steps = create_steps(volumes_dir, run_dir, config, notest); + let steps = create_steps(volumes_dir, run_dir, config); let context = execute_steps( steps.iter().map(|s| s.as_ref()).collect::>(), @@ -477,11 +469,7 @@ fn execute_cluster_steps( } /// Start the local Filecoin network cluster. -pub fn start_cluster( - parallel: bool, - run_id: String, - notest: bool, -) -> Result<(), Box> { +pub fn start_cluster(parallel: bool, run_id: String) -> Result<(), Box> { // Check host.docker.internal resolution first (required for SP-to-SP fetch) check_host_docker_internal()?; @@ -523,7 +511,6 @@ pub fn start_cluster( &config, parallel, portainer_port, - notest, ); // Always run post-start teardown: persist logs, cleanup dead containers, write status diff --git a/src/commands/start/synapse_test_e2e/mod.rs b/src/commands/start/synapse_test_e2e/mod.rs deleted file mode 100644 index edb7f724..00000000 --- a/src/commands/start/synapse_test_e2e/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! Synapse E2E Test Step -//! -//! This module contains the step for running end-to-end tests using the Synapse SDK. - -pub mod synapse_test_step; - -pub use synapse_test_step::SynapseTestE2EStep; diff --git a/src/commands/start/synapse_test_e2e/synapse_test_step.rs b/src/commands/start/synapse_test_e2e/synapse_test_step.rs deleted file mode 100644 index 1a63f518..00000000 --- a/src/commands/start/synapse_test_e2e/synapse_test_step.rs +++ /dev/null @@ -1,383 +0,0 @@ -use crate::commands::init::keys::{load_keys, KeyInfo}; -use crate::commands::start::step::{SetupContext, Step}; -use crate::constants::BUILDER_DOCKER_IMAGE; -use crate::docker::core::docker_command; -use crate::paths::{ - contract_addresses_file, foc_devnet_docker_volumes_cache, foc_devnet_keys, - foc_devnet_synapse_sdk_repo, -}; -use rand::Rng; -use std::error::Error; -use std::fs::File; -use std::io::Write; -use std::path::{Path, PathBuf}; -use tracing::{info, warn}; - -const POST_DEPLOY_WAIT_SECONDS: u64 = 5; - -/// Type alias for extracted contract addresses and keys -pub type ContractAddresses = (String, String, String, String, String, String); - -/// Parameters for Docker test execution -struct DockerTestParams<'a> { - run_id: &'a str, - synapse_sdk_path: &'a Path, - builder_volumes_dir: &'a Path, - random_file_path: &'a Path, - script: &'a str, - user_key: &'a str, - lotus_rpc_url: &'a str, - warm_storage_addr: &'a str, - multicall3_addr: &'a str, - usdfc_addr: &'a str, - sp_registry_addr: &'a str, - endorsements_addr: &'a str, -} - -pub struct SynapseTestE2EStep { - #[allow(dead_code)] - volumes_dir: PathBuf, - run_dir: PathBuf, - notest: bool, -} - -impl SynapseTestE2EStep { - pub fn new(volumes_dir: PathBuf, run_dir: PathBuf, notest: bool) -> Self { - Self { - volumes_dir, - run_dir, - notest, - } - } -} - -impl Step for SynapseTestE2EStep { - fn name(&self) -> &str { - "Synapse E2E Test" - } - - fn pre_execute(&self, _context: &SetupContext) -> Result<(), Box> { - if self.notest { - info!("Skipping Synapse E2E Test (--notest flag set)"); - return Ok(()); - } - - let synapse_sdk_path = foc_devnet_synapse_sdk_repo(); - if !synapse_sdk_path.exists() { - return Err(format!( - "synapse-sdk repository not found at {}. Please run 'foc-devnet init' to clone it.", - synapse_sdk_path.display() - ) - .into()); - } - info!( - "synapse-sdk repository found at {}", - synapse_sdk_path.display() - ); - - Ok(()) - } - - fn execute(&self, context: &SetupContext) -> Result<(), Box> { - if self.notest { - return Ok(()); - } - - info!("Running Synapse E2E Test..."); - - let run_id = context.run_id(); - let synapse_sdk_path = foc_devnet_synapse_sdk_repo(); - let builder_volumes_dir = - foc_devnet_docker_volumes_cache().join(crate::constants::BUILDER_CONTAINER); - - // Load contract addresses and keys - let addresses = load_contract_addresses(run_id)?; - let keys = load_wallet_keys()?; - - // Extract required addresses and keys - let ( - user_key, - warm_storage_addr, - usdfc_addr, - multicall3_addr, - sp_registry_addr, - endorsements_addr, - ) = extract_required_addresses(&addresses, &keys)?; - - let lotus_rpc_url = crate::commands::start::lotus_utils::get_lotus_rpc_url(context)?; - - // Create random test file - let random_file_path = create_random_test_file(&self.run_dir)?; - - // Generate the test script - let script = generate_test_script( - &lotus_rpc_url, - &warm_storage_addr, - &multicall3_addr, - &usdfc_addr, - &sp_registry_addr, - ); - - // Build and execute docker command - execute_docker_test(&DockerTestParams { - run_id, - synapse_sdk_path: &synapse_sdk_path, - builder_volumes_dir: &builder_volumes_dir, - random_file_path: &random_file_path, - script: &script, - user_key: &user_key, - lotus_rpc_url: &lotus_rpc_url, - warm_storage_addr: &warm_storage_addr, - multicall3_addr: &multicall3_addr, - usdfc_addr: &usdfc_addr, - sp_registry_addr: &sp_registry_addr, - endorsements_addr: &endorsements_addr, - }) - } - - fn post_execute(&self, _context: &SetupContext) -> Result<(), Box> { - Ok(()) - } -} - -/// Build and execute docker test container. -fn execute_docker_test(params: &DockerTestParams) -> Result<(), Box> { - let docker_args = build_docker_command(params)?; - - let args_ref: Vec<&str> = docker_args.iter().map(|s| s.as_str()).collect(); - - info!("Executing test script in container..."); - let output = docker_command(&args_ref)?; - - if !output.status.success() { - let stdout = String::from_utf8_lossy(&output.stdout); - let stderr = String::from_utf8_lossy(&output.stderr); - warn!("Synapse E2E Test failed!"); - warn!("Stdout:\n{}", stdout); - warn!("Stderr:\n{}", stderr); - return Err("Synapse E2E Test failed".into()); - } - - info!("✓ Synapse E2E Test completed successfully"); - Ok(()) -} - -/// Build docker command arguments for test execution. -fn build_docker_command(params: &DockerTestParams) -> Result, Box> { - let mut docker_args = vec![ - "run".to_string(), - "--name".to_string(), - format!("foc-{}-synapse-test", params.run_id), - "--network".to_string(), - "host".to_string(), - "-u".to_string(), - "root".to_string(), - ]; - - // Add environment variables required by synapse-sdk scripts - // Note: example-storage-e2e.js uses env vars, not CLI flags - let env_vars = vec![ - ("CLIENT_PRIVATE_KEY", params.user_key.to_string()), - ("PRIVATE_KEY", params.user_key.to_string()), - ("RPC_URL", params.lotus_rpc_url.to_string()), - ("WARM_STORAGE_ADDRESS", params.warm_storage_addr.to_string()), - ("MULTICALL3_ADDRESS", params.multicall3_addr.to_string()), - ("USDFC_ADDRESS", params.usdfc_addr.to_string()), - ("SP_REGISTRY_ADDRESS", params.sp_registry_addr.to_string()), - ("ENDORSEMENTS_ADDRESS", params.endorsements_addr.to_string()), - ("CI", "true".to_string()), - ]; - - for (key, value) in env_vars { - docker_args.push("-e".to_string()); - docker_args.push(format!("{}={}", key, value)); - } - - // Mount synapse-sdk - let synapse_sdk_real_path = params - .synapse_sdk_path - .canonicalize() - .unwrap_or_else(|_| params.synapse_sdk_path.to_path_buf()); - docker_args.push("-v".to_string()); - docker_args.push(format!("{}:/synapse-sdk", synapse_sdk_real_path.display())); - - // Mount random test file - docker_args.push("-v".to_string()); - docker_args.push(format!( - "{}:/tmp/random_test_file.txt", - params.random_file_path.display() - )); - - // Mount cargo cache - docker_args.push("-v".to_string()); - docker_args.push(format!( - "{}:/root/.cargo", - params.builder_volumes_dir.join("cargo").display() - )); - - // Add image and command - docker_args.push(BUILDER_DOCKER_IMAGE.to_string()); - docker_args.push("/bin/bash".to_string()); - docker_args.push("-c".to_string()); - docker_args.push(params.script.to_string()); - - Ok(docker_args) -} - -/// Load contract addresses from file. -fn load_contract_addresses(run_id: &str) -> Result> { - let addresses_path = contract_addresses_file(run_id); - let addresses_file = File::open(&addresses_path)?; - let addresses: serde_json::Value = serde_json::from_reader(addresses_file)?; - Ok(addresses) -} - -/// Load wallet keys from the generated addresses file. -fn load_wallet_keys() -> Result, Box> { - let keys_file = foc_devnet_keys().join("addresses.json"); - if !keys_file.exists() { - return Err(format!("Keys file not found at {}", keys_file.display()).into()); - } - - load_keys() -} - -/// Extract required addresses and keys from loaded data. -fn extract_required_addresses( - addresses: &serde_json::Value, - keys: &[KeyInfo], -) -> Result> { - let user_key = keys - .iter() - .find(|k| k.name == "USER_1") - .ok_or("USER_1 key not found in addresses.json")? - .private_key - .clone(); - let user_key_prefixed = format!("0x{}", user_key); - - // Extract contract addresses - let warm_storage_addr = addresses["foc_contracts"]["filecoin_warm_storage_service_proxy"] - .as_str() - .ok_or("Warm storage address not found in contract_addresses.json")? - .to_string(); - let usdfc_addr = addresses["contracts"]["usdfc"] - .as_str() - .ok_or("USDFC address not found in contract_addresses.json")? - .to_string(); - let multicall3_addr = addresses["contracts"]["multicall"] - .as_str() - .ok_or("Multicall3 address not found in contract_addresses.json")? - .to_string(); - let sp_registry_addr = addresses["foc_contracts"]["service_provider_registry_proxy"] - .as_str() - .ok_or("SP Registry address not found in contract_addresses.json")? - .to_string(); - let endorsements_addr = addresses["foc_contracts"]["endorsements"] - .as_str() - .ok_or("Endorsements address not found in contract_addresses.json")? - .to_string(); - - Ok(( - user_key_prefixed, - warm_storage_addr, - usdfc_addr, - multicall3_addr, - sp_registry_addr, - endorsements_addr, - )) -} - -/// Create a random test file for the E2E test. -fn create_random_test_file(run_dir: &Path) -> Result> { - let random_file_path = run_dir.join("random_test_file.txt"); - let mut file = File::create(&random_file_path)?; - let mut rng = rand::thread_rng(); - let data: Vec = (0..912).map(|_| rng.gen()).collect(); - file.write_all(&data)?; - info!("Created random test file at {}", random_file_path.display()); - Ok(random_file_path) -} - -/// Generate the shell script for synapse-sdk E2E testing. -fn generate_test_script( - lotus_rpc_url: &str, - warm_storage_addr: &str, - multicall3_addr: &str, - usdfc_addr: &str, - sp_registry_addr: &str, -) -> String { - let mut lines = Vec::new(); - lines.extend(bootstrap_commands()); - lines.push(build_post_deploy_command( - lotus_rpc_url, - warm_storage_addr, - multicall3_addr, - usdfc_addr, - sp_registry_addr, - )); - lines.extend(wait_commands()); - lines.push(build_storage_e2e_command()); - - lines.join("\n") -} - -/// Steps to install and build the SDK inside the container. -fn bootstrap_commands() -> Vec { - vec![ - "set -e".to_string(), - "cd /synapse-sdk".to_string(), - "echo \"Installing dependencies...\"".to_string(), - "pnpm install".to_string(), - "".to_string(), - "echo \"Building SDK...\"".to_string(), - "pnpm build".to_string(), - "".to_string(), - ] -} - -/// CLI invocation for post-deploy setup. -fn build_post_deploy_command( - lotus_rpc_url: &str, - warm_storage_addr: &str, - multicall3_addr: &str, - usdfc_addr: &str, - sp_registry_addr: &str, -) -> String { - [ - "echo \"Running post-deploy setup...\"".to_string(), - format!( - concat!( - "node utils/post-deploy-setup.js \\\n", - " --mode client \\\n", - " --network devnet \\\n", - " --rpc-url {} \\\n", - " --warm-storage {} \\\n", - " --multicall3 {} \\\n", - " --usdfc {} \\\n", - " --sp-registry {}", - ), - lotus_rpc_url, warm_storage_addr, multicall3_addr, usdfc_addr, sp_registry_addr, - ), - ] - .join("\n") -} - -/// Simple wait between setup and test to allow on-chain activation. -fn wait_commands() -> Vec { - vec![ - format!( - "echo \"Waiting for {} seconds...\"", - POST_DEPLOY_WAIT_SECONDS - ), - format!("sleep {}", POST_DEPLOY_WAIT_SECONDS), - "".to_string(), - ] -} - -/// CLI invocation for the storage E2E test. -/// The script uses environment variables for configuration (set via Docker -e flags). -fn build_storage_e2e_command() -> String { - "echo \"Running storage E2E test...\"\n\ -node utils/example-storage-e2e.js /tmp/random_test_file.txt" - .to_string() -} diff --git a/src/commands/start/user_setup/constants.rs b/src/commands/start/user_setup/constants.rs new file mode 100644 index 00000000..113d7781 --- /dev/null +++ b/src/commands/start/user_setup/constants.rs @@ -0,0 +1,27 @@ +//! Constants for user payment setup operations. + +/// Container name suffix for ERC20 approve transaction. +pub const CONTAINER_ERC20_APPROVE: &str = "user-erc20-approve"; + +/// Container name suffix for FilecoinPay deposit transaction. +pub const CONTAINER_FP_DEPOSIT: &str = "user-fp-deposit"; + +/// Container name suffix for FilecoinPay operator approval transaction. +pub const CONTAINER_FP_APPROVE_OPERATOR: &str = "user-fp-approve-operator"; + +/// Gas limit for cast send transactions on Filecoin FEVM. +pub const CAST_GAS_LIMIT: &str = "100000000"; + +/// 1 USDFC expressed in the token's 18-decimal base unit. +pub const USDFC_DEPOSIT_AMOUNT: &str = "1000000000000000000"; + +/// uint256 max value, used for unlimited operator approval allowances. +pub const MAX_UINT256: &str = + "115792089237316195423570985008687907853269984665640564039457584007913129639935"; + +/// 30-day lockup period expressed in Filecoin epochs (2880 epochs/day * 30 days). +pub const LOCKUP_PERIOD_EPOCHS: &str = "86400"; + +/// Seconds to wait after on-chain payment setup before completing the step, +/// allowing transactions to be included in a block. +pub const POST_SETUP_WAIT_SECONDS: u64 = 5; diff --git a/src/commands/start/user_setup/mod.rs b/src/commands/start/user_setup/mod.rs new file mode 100644 index 00000000..040004c0 --- /dev/null +++ b/src/commands/start/user_setup/mod.rs @@ -0,0 +1,10 @@ +//! USER_1 payment setup step. +//! +//! Configures USER_1's wallet for FOC storage services after contracts are +//! deployed, using on-chain cast transactions rather than JS scripts. + +mod constants; +mod operations; +mod user_setup_step; + +pub use user_setup_step::UserSetupStep; diff --git a/src/commands/start/user_setup/operations.rs b/src/commands/start/user_setup/operations.rs new file mode 100644 index 00000000..ce12212d --- /dev/null +++ b/src/commands/start/user_setup/operations.rs @@ -0,0 +1,138 @@ +//! Business logic for USER_1 payment setup operations. +//! +//! Sets up USER_1's wallet for FOC usage via three on-chain transactions: +//! 1. ERC20 approve – grant FilecoinPay allowance to spend USDFC +//! 2. FilecoinPay deposit – deposit USDFC into FilecoinPay on behalf of USER_1 +//! 3. FilecoinPay setOperatorApproval – approve FWSS as a payment operator + +use super::constants::{ + CAST_GAS_LIMIT, CONTAINER_ERC20_APPROVE, CONTAINER_FP_APPROVE_OPERATOR, CONTAINER_FP_DEPOSIT, + LOCKUP_PERIOD_EPOCHS, MAX_UINT256, USDFC_DEPOSIT_AMOUNT, +}; +use crate::commands::init::keys::load_keys; +use crate::commands::start::step::SetupContext; +use crate::constants::BUILDER_DOCKER_IMAGE; +use crate::docker::command_logger::run_and_log_command_strings; +use std::error::Error; +use tracing::info; + +/// Load the USER_1 private key (hex-prefixed) from the generated keys file. +pub fn load_user_private_key() -> Result> { + let keys = load_keys()?; + let user_key = keys + .iter() + .find(|k| k.name == "USER_1") + .ok_or("USER_1 key not found in addresses.json")?; + Ok(format!("0x{}", user_key.private_key)) +} + +/// Set up USER_1's wallet for FOC usage. +/// +/// Runs three sequential cast send transactions: +/// - ERC20 approve: allow FilecoinPay to spend USDFC on USER_1's behalf +/// - FilecoinPay deposit: deposit USDFC into FilecoinPay for USER_1 +/// - setOperatorApproval: approve FWSS as an operator with unlimited allowances +pub fn setup_client_payments(context: &SetupContext, user_key: &str) -> Result<(), Box> { + let run_id = context.run_id(); + let lotus_rpc_url = build_lotus_rpc_url(context)?; + let usdfc_addr = get_ctx(context, "mockusdfc_contract_address")?; + let pay_addr = get_ctx(context, "foc_contract_filecoin_pay_v1_contract")?; + let fwss_addr = get_ctx(context, "foc_contract_filecoin_warm_storage_service_proxy")?; + let user_eth_addr = get_ctx(context, "user_1_eth_address")?; + + info!("Approving FilecoinPay to spend USDFC..."); + cast_send_payment( + context, + &format!("foc-{}-{}", run_id, CONTAINER_ERC20_APPROVE), + &format!( + "cast send {} 'approve(address,uint256)' {} {} \ + --rpc-url {} --private-key {} --gas-limit {}", + usdfc_addr, pay_addr, USDFC_DEPOSIT_AMOUNT, lotus_rpc_url, user_key, CAST_GAS_LIMIT + ), + "user_erc20_approve", + )?; + + info!("Depositing USDFC into FilecoinPay..."); + cast_send_payment( + context, + &format!("foc-{}-{}", run_id, CONTAINER_FP_DEPOSIT), + &format!( + "cast send {} 'deposit(address,address,uint256)' {} {} {} \ + --rpc-url {} --private-key {} --gas-limit {}", + pay_addr, + usdfc_addr, + user_eth_addr, + USDFC_DEPOSIT_AMOUNT, + lotus_rpc_url, + user_key, + CAST_GAS_LIMIT + ), + "user_fp_deposit", + )?; + + info!("Approving FWSS as payment operator..."); + cast_send_payment( + context, + &format!("foc-{}-{}", run_id, CONTAINER_FP_APPROVE_OPERATOR), + &format!( + "cast send {} \ + 'setOperatorApproval(address,address,bool,uint256,uint256,uint256)' \ + {} {} true {} {} {} \ + --rpc-url {} --private-key {} --gas-limit {}", + pay_addr, + usdfc_addr, + fwss_addr, + MAX_UINT256, + MAX_UINT256, + LOCKUP_PERIOD_EPOCHS, + lotus_rpc_url, + user_key, + CAST_GAS_LIMIT + ), + "user_fp_approve_operator", + )?; + + info!("USER_1 client payment setup complete"); + Ok(()) +} + +/// Run a single cast send inside the builder container and log its output. +fn cast_send_payment( + context: &SetupContext, + container_name: &str, + cast_cmd: &str, + log_key: &str, +) -> Result<(), Box> { + let args: Vec = vec![ + "run".to_string(), + "--name".to_string(), + container_name.to_string(), + "--network".to_string(), + "host".to_string(), + BUILDER_DOCKER_IMAGE.to_string(), + "bash".to_string(), + "-c".to_string(), + cast_cmd.to_string(), + ]; + + let output = run_and_log_command_strings("docker", &args, context, log_key)?; + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + return Err(format!("Cast command '{}' failed: {}", log_key, stderr).into()); + } + Ok(()) +} + +/// Build Lotus JSON-RPC URL from the context's dynamic port. +fn build_lotus_rpc_url(context: &SetupContext) -> Result> { + let port = get_ctx(context, "lotus_api_port")?; + Ok(format!("http://localhost:{}/rpc/v1", port)) +} + +/// Retrieve a required string value from the setup context. +fn get_ctx(context: &SetupContext, key: &str) -> Result> { + context + .get(key) + .ok_or_else(|| format!("{} not found in context", key).into()) +} diff --git a/src/commands/start/user_setup/user_setup_step.rs b/src/commands/start/user_setup/user_setup_step.rs new file mode 100644 index 00000000..e007a6fa --- /dev/null +++ b/src/commands/start/user_setup/user_setup_step.rs @@ -0,0 +1,80 @@ +//! USER_1 payment setup step implementation. +//! +//! After FOC contracts are deployed, this step configures USER_1's wallet for +//! interacting with FOC storage services: +//! - ERC20 approve (USDFC → FilecoinPay) +//! - FilecoinPay deposit +//! - FilecoinPay setOperatorApproval (FWSS as operator) +//! +//! USER_2 and USER_3 are funded with USDFC but not configured for FOC. + +use super::constants::POST_SETUP_WAIT_SECONDS; +use super::operations::{load_user_private_key, setup_client_payments}; +use crate::commands::start::step::{SetupContext, Step}; +use crate::docker::containers::lotus_container_name; +use crate::docker::core::container_is_running; +use std::error::Error; +use std::path::PathBuf; +use std::thread; +use std::time::Duration; +use tracing::info; + +/// Step that sets up USER_1's wallet for FOC usage via on-chain cast transactions. +pub struct UserSetupStep { + #[allow(dead_code)] + volumes_dir: PathBuf, + #[allow(dead_code)] + run_dir: PathBuf, +} + +impl UserSetupStep { + /// Create a new UserSetupStep. + pub fn new(volumes_dir: PathBuf, run_dir: PathBuf) -> Self { + Self { + volumes_dir, + run_dir, + } + } + + /// Verify that the Lotus container is still running before attempting cast calls. + fn check_lotus_running(context: &SetupContext) -> Result<(), Box> { + let container = lotus_container_name(context.run_id()); + if !container_is_running(&container)? { + return Err("Lotus container is not running; cannot perform user setup.".into()); + } + Ok(()) + } +} + +impl Step for UserSetupStep { + fn name(&self) -> &str { + "USER_1 Payment Setup" + } + + fn pre_execute(&self, context: &SetupContext) -> Result<(), Box> { + info!("Pre-checking {}", self.name()); + Self::check_lotus_running(context)?; + info!("Lotus is running"); + Ok(()) + } + + fn execute(&self, context: &SetupContext) -> Result<(), Box> { + info!("Running {}...", self.name()); + + let user_key = load_user_private_key()?; + setup_client_payments(context, &user_key)?; + + info!( + "Waiting {} seconds for on-chain activation...", + POST_SETUP_WAIT_SECONDS + ); + thread::sleep(Duration::from_secs(POST_SETUP_WAIT_SECONDS)); + + info!("{} completed", self.name()); + Ok(()) + } + + fn post_execute(&self, _context: &SetupContext) -> Result<(), Box> { + Ok(()) + } +} diff --git a/src/commands/status/code_version.rs b/src/commands/status/code_version.rs index d91ccade..b122fef7 100644 --- a/src/commands/status/code_version.rs +++ b/src/commands/status/code_version.rs @@ -16,8 +16,8 @@ use super::git::{format_location_info, get_git_info, get_repo_path_from_config}; /// Print code version information in tabular format. /// -/// This function displays version information for Lotus, Curio, Filecoin-Services, -/// and Synapse-SDK repositories, including their source types, current versions, +/// This function displays version information for Lotus, Curio, and Filecoin-Services +/// repositories, including their source types, current versions, /// commit hashes, and readiness status. /// /// # Examples @@ -77,17 +77,6 @@ pub fn print_code_version() -> Result<(), Box> { &fc_services_repo_path, ); - // Get git information for Synapse-SDK - let synapse_sdk_repo_path = get_repo_path_from_config(&config.synapse_sdk, "synapse-sdk"); - let synapse_sdk_git_info = get_git_info(&synapse_sdk_repo_path)?; - - let (synapse_sdk_source_type, synapse_sdk_version, synapse_sdk_commit, synapse_sdk_status) = - format_location_info( - &config.synapse_sdk, - &synapse_sdk_git_info, - &synapse_sdk_repo_path, - ); - // Print log-style output info!( "Lotus: [{},{},{}] {}", @@ -101,10 +90,6 @@ pub fn print_code_version() -> Result<(), Box> { "Filecoin-Services: [{},{},{}] {}", fc_services_source_type, fc_services_version, fc_services_commit, fc_services_status ); - info!( - "Synapse-SDK: [{},{},{}] {}", - synapse_sdk_source_type, synapse_sdk_version, synapse_sdk_commit, synapse_sdk_status - ); Ok(()) } diff --git a/src/commands/status/mod.rs b/src/commands/status/mod.rs index d113569b..52cc9a30 100644 --- a/src/commands/status/mod.rs +++ b/src/commands/status/mod.rs @@ -3,7 +3,7 @@ //! This module provides comprehensive status reporting for the FOC DevNet system. //! //! The status command displays information about: -//! - Code versions and git status for repositories (Lotus, Curio, Filecoin-Services, Synapse-SDK) +//! - Code versions and git status for repositories (Lotus, Curio, Filecoin-Services) //! - Build status of system binaries //! - Proof parameters availability and validation //! - Running status of Docker containers and services diff --git a/src/config.rs b/src/config.rs index d1a42fcd..85b3e822 100644 --- a/src/config.rs +++ b/src/config.rs @@ -163,13 +163,6 @@ pub struct Config { /// See [`Location`] for available options. pub multicall3: Location, - /// Location specification for the synapse-sdk repository. - /// - /// Defines how to obtain the synapse-sdk code, which provides - /// SDK functionality for Filecoin integration. - /// See [`Location`] for available options. - pub synapse_sdk: Location, - /// URL to download Yugabyte database tarball. /// /// This is the direct link to the Yugabyte tarball required for running curio. @@ -233,10 +226,6 @@ impl Default for Config { url: "https://github.com/mds1/multicall3.git".to_string(), tag: "v3.1.0".to_string(), }, - synapse_sdk: Location::GitCommit { - url: "https://github.com/FilOzone/synapse-sdk.git".to_string(), - commit: "3bc6a7fd2d0b66119163c6759241a6ff74ac03e1".to_string(), - }, yugabyte_download_url: Self::get_default_yugabyte_url(), approved_pdp_sp_count: 2, endorsed_pdp_sp_count: 1, diff --git a/src/external_api/devnet_info.rs b/src/external_api/devnet_info.rs index 64326e3e..7adfafcf 100644 --- a/src/external_api/devnet_info.rs +++ b/src/external_api/devnet_info.rs @@ -40,6 +40,11 @@ pub struct DevnetInfoV1 { } /// Information about a user account. +/// +/// All users are funded with FIL and MockUSDFC tokens. When the synapse E2E test +/// step runs, USER_1 is additionally set up for FOC usage: USDFC deposited into +/// FilecoinPay and FWSS approved as an operator. Other users have tokens but are +/// not configured for FOC services. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct UserInfo { /// User identifier (e.g., "USER_1") diff --git a/src/external_api/export.rs b/src/external_api/export.rs index 5335fd39..6e792654 100644 --- a/src/external_api/export.rs +++ b/src/external_api/export.rs @@ -42,7 +42,7 @@ fn build_devnet_info(ctx: &SetupContext) -> Result Result<(), Box> { // Execute the command with poison file protection let result = match cli.command { - Commands::Start { parallel, notest } => { - main_app::command_handlers::handle_start(parallel, run_id, notest) - } + Commands::Start { parallel } => main_app::command_handlers::handle_start(parallel, run_id), Commands::Stop => main_app::command_handlers::handle_stop(), Commands::Init { curio, lotus, filecoin_services, - synapse_sdk, yugabyte_url, yugabyte_archive, proof_params_dir, @@ -41,7 +38,6 @@ fn main() -> Result<(), Box> { curio, lotus, filecoin_services, - synapse_sdk, yugabyte_url, yugabyte_archive, proof_params_dir, diff --git a/src/main_app/command_handlers.rs b/src/main_app/command_handlers.rs index 0117903b..6e8644e6 100644 --- a/src/main_app/command_handlers.rs +++ b/src/main_app/command_handlers.rs @@ -13,13 +13,9 @@ use foc_devnet::paths::foc_devnet_config; use foc_devnet::poison; /// Execute the start command -pub fn handle_start( - parallel: bool, - run_id: String, - notest: bool, -) -> Result<(), Box> { +pub fn handle_start(parallel: bool, run_id: String) -> Result<(), Box> { poison::create_poison("Start")?; - commands::start_cluster(parallel, run_id, notest) + commands::start_cluster(parallel, run_id) } /// Execute the stop command @@ -34,7 +30,6 @@ pub fn handle_init( curio: Option, lotus: Option, filecoin_services: Option, - synapse_sdk: Option, yugabyte_url: Option, yugabyte_archive: Option, proof_params_dir: Option, @@ -47,7 +42,6 @@ pub fn handle_init( curio_location: curio, lotus_location: lotus, filecoin_services_location: filecoin_services, - synapse_sdk_location: synapse_sdk, yugabyte_url, yugabyte_archive, proof_params_dir, diff --git a/src/main_app/version.rs b/src/main_app/version.rs index cf1509d6..a0c6a576 100644 --- a/src/main_app/version.rs +++ b/src/main_app/version.rs @@ -50,7 +50,6 @@ pub fn handle_version() -> Result<(), Box> { &default_config.filecoin_services, ); print_location_info("default:code:multicall3", &default_config.multicall3); - print_location_info("default:code:synapse-sdk", &default_config.synapse_sdk); info!("default:yugabyte: {}", default_config.yugabyte_download_url); Ok(()) diff --git a/src/paths.rs b/src/paths.rs index 0d711f38..18d90a13 100644 --- a/src/paths.rs +++ b/src/paths.rs @@ -134,11 +134,6 @@ pub fn foc_devnet_multicall3_repo() -> PathBuf { foc_devnet_code().join("multicall3") } -/// Returns the path to the "synapse-sdk" repository -pub fn foc_devnet_synapse_sdk_repo() -> PathBuf { - foc_devnet_code().join("synapse-sdk") -} - /// Returns the path to the foc-devnet artifacts directory, e.g., ~/.foc-devnet/artifacts pub fn foc_devnet_artifacts() -> PathBuf { foc_devnet_home().join("artifacts")