diff --git a/scripts/tests/api_compare/.env b/scripts/tests/api_compare/.env index 9526b69b1e5c..b5853de78944 100644 --- a/scripts/tests/api_compare/.env +++ b/scripts/tests/api_compare/.env @@ -5,6 +5,7 @@ FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters LOTUS_RPC_PORT=1234 FOREST_RPC_PORT=2345 FOREST_OFFLINE_RPC_PORT=3456 +FOREST_VIA_GATEWAY_RPC_PORT=4567 FOREST_HEALTHZ_RPC_PORT=2346 CHAIN=calibnet diff --git a/scripts/tests/api_compare/docker-compose.yml b/scripts/tests/api_compare/docker-compose.yml index 758349612a84..92416fa7039d 100644 --- a/scripts/tests/api_compare/docker-compose.yml +++ b/scripts/tests/api_compare/docker-compose.yml @@ -140,6 +140,29 @@ services: timeout: 3s retries: 3 start_period: 10m + forest-via-gateway: + depends_on: + forest-rpc-ready: + condition: service_completed_successfully + image: ${LOTUS_IMAGE} + volumes: + - node-data:/data + networks: + - api-tests + entrypoint: ["/bin/bash", "-c"] + command: + - | + set -euxo pipefail + export FULLNODE_API_INFO="$(cat /data/forest-token):/dns/forest/tcp/${FOREST_RPC_PORT}/http" + lotus-gateway run --api-max-lookback 72000h --listen 0.0.0.0:${FOREST_VIA_GATEWAY_RPC_PORT} + healthcheck: + test: | + export FULLNODE_API_INFO="/dns/forest-via-gateway/tcp/${FOREST_VIA_GATEWAY_RPC_PORT}/http" + lotus chain head || exit 1 + interval: 10s + retries: 10 + start_period: 30s + timeout: 5s lotus: depends_on: init: @@ -242,9 +265,77 @@ services: status=$$? echo "==== API Compare Report ====" cat /data/api-compare-report/*.json || echo "(Report file not accessible)" - FULLNODE_API_INFO=$$FOREST_API_INFO forest-cli shutdown --force exit $$status + api-compare-gateway: + depends_on: + lotus-sync-wait: + condition: service_completed_successfully + forest-via-gateway: + condition: service_healthy + forest-wallet-import: + condition: service_completed_successfully + build: + context: ../../../. + dockerfile: ${FOREST_DOCKERFILE_OVERRIDE:-Dockerfile} + volumes: + - node-data:/data + - ./filter-list-gateway:/data/filter-list-gateway + networks: + - api-tests + environment: + - RUST_LOG=info,forest::tool::subcommands=debug + - FOREST_RPC_DEFAULT_TIMEOUT=120 + - FIL_PROOFS_PARAMETER_CACHE=${FIL_PROOFS_PARAMETER_CACHE} + entrypoint: ["/bin/bash", "-c"] + user: 0:0 + command: + - | + set -uxo pipefail + # Test against websocket endpoint for online server + LOTUS_API_INFO="$(cat /data/lotus-token):/dns/lotus/tcp/${LOTUS_RPC_PORT}/ws" + FOREST_API_INFO="$(cat /data/forest-token):/dns/forest-via-gateway/tcp/${FOREST_VIA_GATEWAY_RPC_PORT}/ws" + forest-tool api compare $(ls /data/*.car.zst | tail -n 1) \ + --forest $$FOREST_API_INFO \ + --lotus $$LOTUS_API_INFO \ + --n-tipsets 5 \ + --test-criteria-overrides=valid-and-timeout,timeout-and-timeout \ + --filter-file /data/filter-list-gateway \ + --miner-address ${MINER_ADDRESS} \ + --worker-address ${MINER_WORKER_ADDRESS} \ + --report-mode=failure-only \ + --report-dir=/data/api-compare-gateway-report + + status=$$? + echo "==== Gateway API Compare Report ====" + cat /data/api-compare-gateway-report/*.json || echo "(Report file not accessible)" + exit $$status + + forest-shutdown: + depends_on: + api-compare: + condition: service_completed_successfully + api-compare-gateway: + condition: service_completed_successfully + build: + context: ../../../. + dockerfile: ${FOREST_DOCKERFILE_OVERRIDE:-Dockerfile} + volumes: + - node-data:/data + networks: + - api-tests + environment: + - RUST_LOG=info,forest::tool::subcommands=debug + - FOREST_RPC_DEFAULT_TIMEOUT=120 + - FIL_PROOFS_PARAMETER_CACHE=${FIL_PROOFS_PARAMETER_CACHE} + entrypoint: ["/bin/bash", "-c"] + user: 0:0 + command: + - | + set -uxo pipefail + export FULLNODE_API_INFO="$(cat /data/forest-token):/dns/forest/tcp/${FOREST_RPC_PORT}/http" + forest-cli shutdown --force + api-compare-offline: profiles: - include-offline-rpc diff --git a/scripts/tests/api_compare/filter-list-gateway b/scripts/tests/api_compare/filter-list-gateway new file mode 100644 index 000000000000..92725b45d11b --- /dev/null +++ b/scripts/tests/api_compare/filter-list-gateway @@ -0,0 +1,67 @@ +# This list contains methods that are either broken or not supported by `lotus-gateway`. + +# not supported + +!Filecoin.AuthNew +!Filecoin.BeaconGetEntry +!Filecoin.ChainSetHead +!Filecoin.ChainStatObj +!Filecoin.ChainTipSetWeight +!Filecoin.F3 +!Filecoin.GasEstimateGasLimit +!Filecoin.MinerCreateBlock +!Filecoin.MpoolSelect +!Filecoin.NetAddrsListen +!Filecoin.NetAgentVersion +!Filecoin.NetAutoNatStatus +!Filecoin.NetPeers +!Filecoin.NetProtectAdd +!Filecoin.NetProtectList +!Filecoin.NetProtectRemove +!Filecoin.Session +!Filecoin.StartTime +!Filecoin.StateCirculatingSupply +!Filecoin.StateCompute +!Filecoin.StateGetAllAllocations +!Filecoin.StateGetAllClaims +!Filecoin.StateGetAllocationIdForPendingDeal +!Filecoin.StateGetBeaconEntry +!Filecoin.StateGetRandomnessDigestFromTickets +!Filecoin.StateGetRandomnessFromBeacon +!Filecoin.StateGetRandomnessFromTickets +!Filecoin.StateListActors +!Filecoin.StateListMessages +!Filecoin.StateLookupRobustAddress +!Filecoin.StateMarketDeals +!Filecoin.StateMarketParticipants +!Filecoin.StateMinerActiveSectors +!Filecoin.StateMinerAllocated +!Filecoin.StateMinerAvailableBalance +!Filecoin.StateMinerFaults +!Filecoin.StateMinerInitialPledgeForSector +!Filecoin.StateMinerPartitions +!Filecoin.StateMinerRecoveries +!Filecoin.StateMinerSectorAllocated +!Filecoin.StateMinerSectors +!Filecoin.StateSearchMsgLimited +!Filecoin.StateSectorExpiration +!Filecoin.StateSectorPartition +!Filecoin.StateSectorPreCommitInfo +!Filecoin.StateVMCirculatingSupplyInternal +!Filecoin.StateVerifiedRegistryRootKey +!Filecoin.WalletSign +!Filecoin.WalletSignMessage +!Filecoin.WalletValidateAddress +!Filecoin.WalletVerify + +# broken +!Filecoin.EthCall +!Filecoin.EthGetBalance +!Filecoin.EthGetBlockReceipts +!Filecoin.EthGetBlockReceiptsLimited +!Filecoin.EthGetFilterLogs +!Filecoin.EthGetTransactionByHash +!Filecoin.EthGetTransactionReceipt +!Filecoin.StateSearchMsg +!Filecoin.StateWaitMsg +!Filecoin.EthSyncing