From b4de502fe4f50d06c257e36c7d9ceb3646ae21f7 Mon Sep 17 00:00:00 2001 From: hanabi1224 Date: Mon, 9 Feb 2026 22:04:00 +0800 Subject: [PATCH 1/3] test: add lotus-gateway parity test --- scripts/tests/api_compare/.env | 1 + scripts/tests/api_compare/docker-compose.yml | 93 ++++++++++++++++++- scripts/tests/api_compare/filter-list-gateway | 65 +++++++++++++ 3 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 scripts/tests/api_compare/filter-list-gateway diff --git a/scripts/tests/api_compare/.env b/scripts/tests/api_compare/.env index 884c1cd93dd4..9bad1be40e19 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 6ac3957b9966..c44fc2a8ef47 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: @@ -246,9 +269,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..1f92634d3649 --- /dev/null +++ b/scripts/tests/api_compare/filter-list-gateway @@ -0,0 +1,65 @@ +# 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.EthGetBalance +!Filecoin.EthGetBlockReceipts +!Filecoin.EthGetBlockReceiptsLimited +!Filecoin.EthGetFilterLogs +!Filecoin.EthGetTransactionByHash +!Filecoin.EthGetTransactionReceipt +!Filecoin.StateSearchMsg +!Filecoin.StateWaitMsg From 45cccab1cad94c288a1a1f007c0fd189f3ee2965 Mon Sep 17 00:00:00 2001 From: hanabi1224 Date: Tue, 10 Feb 2026 13:40:29 +0800 Subject: [PATCH 2/3] no need to wait for f3 --- scripts/tests/api_compare/.env | 2 +- scripts/tests/api_compare/docker-compose.yml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/tests/api_compare/.env b/scripts/tests/api_compare/.env index 9bad1be40e19..b5853de78944 100644 --- a/scripts/tests/api_compare/.env +++ b/scripts/tests/api_compare/.env @@ -1,6 +1,6 @@ # Note: this should be a `fat` image so that it contains the pre-downloaded filecoin proof parameters FOREST_IMAGE=ghcr.io/chainsafe/forest:edge-fat -LOTUS_IMAGE=filecoin/lotus-all-in-one:v1.34.4-rc1-calibnet +LOTUS_IMAGE=filecoin/lotus-all-in-one:v1.34.4-calibnet FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters LOTUS_RPC_PORT=1234 FOREST_RPC_PORT=2345 diff --git a/scripts/tests/api_compare/docker-compose.yml b/scripts/tests/api_compare/docker-compose.yml index c44fc2a8ef47..92416fa7039d 100644 --- a/scripts/tests/api_compare/docker-compose.yml +++ b/scripts/tests/api_compare/docker-compose.yml @@ -221,10 +221,6 @@ services: lotus sync wait # After the sync is done, import the wallet for signing blocks. It might be already there, which will return an error. We ignore it. echo $MINER_WORKER_KEY | lotus wallet import || true - # Wait until F3 certificate instance 100 is available - until lotus f3 c get 100; do - sleep 5s; - done api-compare: depends_on: lotus-sync-wait: From f4e504b8db1bbaffd533aeba445f4994e00427e0 Mon Sep 17 00:00:00 2001 From: hanabi1224 Date: Tue, 10 Feb 2026 13:59:46 +0800 Subject: [PATCH 3/3] update filter-list-gateway --- scripts/tests/api_compare/filter-list-gateway | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/tests/api_compare/filter-list-gateway b/scripts/tests/api_compare/filter-list-gateway index 1f92634d3649..92725b45d11b 100644 --- a/scripts/tests/api_compare/filter-list-gateway +++ b/scripts/tests/api_compare/filter-list-gateway @@ -55,6 +55,7 @@ !Filecoin.WalletVerify # broken +!Filecoin.EthCall !Filecoin.EthGetBalance !Filecoin.EthGetBlockReceipts !Filecoin.EthGetBlockReceiptsLimited @@ -63,3 +64,4 @@ !Filecoin.EthGetTransactionReceipt !Filecoin.StateSearchMsg !Filecoin.StateWaitMsg +!Filecoin.EthSyncing