FuelLabs / fuel-indexer

🗃 The Fuel indexer is a standalone service that can be used to index various components of the Fuel blockchain.
https://docs.fuel.network/docs/indexer/
140 stars 66 forks source link

enhancement: compare fuel-indexer and forc-index versions #1400

Closed lostman closed 11 months ago

lostman commented 11 months ago

Description

Closes #1377.

This PR embeds TOOLCHAIN_VERSION in the indexer's WASM module and adds a check when the indexer is deploys which only permits the indexers whose TOOLCHAIN_VERSION matches the fuel-indexer version.

Testing steps

CI tests should pass.

Manual testing:

  1. Start fuel-indexer:
cargo run -p fuel-indexer -- run --fuel-node-host beta-4.fuel.network --fuel-node-port 80 --replace-indexer
  1. Create and deploy an indexer using an older version of forc-index:
forc-index --version
forc index 0.20.11
forc-index new /tmp/test-indexer
forc-index deploy --path /tmp/some-indexer
▹▸▹▹▹ ⏰ Building indexer...
Finished release [optimized] target(s) in 0.10s
▪▪▪▪▪ ✅ Build succeeded.
Deploying indexer...
▸▹▹▹▹ 🚀 Deploying...
{
  "details": "WASM module toolchain version `unknown` does not match fuel-indexer version `0.21.1`",
  "success": "false"
}

Additionally, run fuel-indexer with --disable-toolchain-version-check to be able to deploy the above indexer anyway.

  1. Deploy one of the indexers in the repository (hence, using the same toolchain version):
cargo run --bin forc-index -- deploy --path examples/fuel-explorer/fuel-explorer/
▹▹▸▹▹ ⏰
Building indexer...
    Finished release [optimized] target(s) in 0.40s
▪▪▪▪▪ ✅ Build succeeded.
Deploying indexer...
▪▪▪▪▪ ✅ Successfully deployed indexer.

Changelog