Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
chore: upgrade to beta-5
Browse files Browse the repository at this point in the history
  • Loading branch information
ra0x3 committed Dec 4, 2023
1 parent 118b6bd commit 65755a7
Show file tree
Hide file tree
Showing 23 changed files with 605 additions and 135 deletions.
613 changes: 531 additions & 82 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ fuel-indexer-postgres = { version = "0.24.1", path = "./packages/fuel-indexer-da
fuel-indexer-schema = { version = "0.24.1", path = "./packages/fuel-indexer-schema", default-features = false }
fuel-indexer-types = { version = "0.24.1", path = "./packages/fuel-indexer-types" }
fuel-indexer-utils = { version = "0.24.1", path = "./packages/fuel-indexer-utils" }
fuel-tx = { version = "=0.35.4", default-features = false }
fuel-types = { version = "=0.35.4", default-features = false, features = ["serde"] }
fuel-vm = { version = "=0.35.4", default-features = false }
fuels = { version = "0.50", default-features = false }
fuels-code-gen = { version = "0.49", default-features = false }
fuel-tx = { version = "0.43", default-features = false }
fuel-types = { version = "0.43", default-features = false, features = ["serde"] }
fuel-vm = { version = "0.43", default-features = false }
fuels = { version = "0.53", default-features = false }
fuels-code-gen = { version = "0.53", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false }
thiserror = "1.0"
Expand Down
6 changes: 3 additions & 3 deletions docs/src/authentication/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ The new authentication functionality offers a flexible and secure way for users

## Usage

Below is a demonstration of basic JWT authentication using an indexer operator at "https://beta-4-indexer.fuel.network"
Below is a demonstration of basic JWT authentication using an indexer operator at "https://beta-5-indexer.fuel.network"

```bash
forc index auth --url https://beta-4-indexer.fuel.network:29987
forc index auth --url https://beta-5-indexer.fuel.network:29987
```

You will first be prompted for the password for your wallet:
Expand All @@ -25,7 +25,7 @@ Please enter your wallet password:
After successfully entering your wallet password you should be presented with your new JWT token.

```text
✅ Successfully authenticated at https://beta-4-indexer.fuel.network:29987/api/auth/signature.
✅ Successfully authenticated at https://beta-5-indexer.fuel.network:29987/api/auth/signature.
Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiODNlNjhiOTFmNDhjYWM4M....
```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/forc-index/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Deploy an indexer to an indexer service.

```bash
forc index deploy --url https://beta-4-indexer.fuel.network
forc index deploy --url https://beta-5-indexer.fuel.network
```

```text
Expand Down
2 changes: 1 addition & 1 deletion docs/src/forc-index/remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Stop and remove a running indexer.

```bash
forc index remove --url https://beta-4-indexer.fuel.network
forc index remove --url https://beta-5-indexer.fuel.network
```

```text
Expand Down
2 changes: 1 addition & 1 deletion docs/src/forc-index/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ OPTIONS:
Use Prometheus metrics reporting.
--network <NETWORK>
Use a network alias when connecting to a Fuel client. [default: beta-3 beta-4 beta-5]
Use a network alias when connecting to a Fuel client. [default: beta-3 beta-5 beta-5]
--postgres-database <POSTGRES_DATABASE>
Postgres database.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/forc-index/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Check the status of a registered indexer.

```bash
forc index status --url https://beta-4-indexer.fuel.network
forc index status --url https://beta-5-indexer.fuel.network
```

```text
Expand Down
4 changes: 2 additions & 2 deletions docs/src/getting-started/indexer-service-infrastructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ OPTIONS:
Use Prometheus metrics reporting.
--network <NETWORK>
Use a network alias when connecting to a Fuel client. [possible values: beta-3, beta-4,
Use a network alias when connecting to a Fuel client. [possible values: beta-3, beta-5,
beta-5]
--postgres-database <POSTGRES_DATABASE>
Expand Down Expand Up @@ -250,7 +250,7 @@ OPTIONS:
Use Prometheus metrics reporting.
--network <NETWORK>
Use a network alias when connecting to a Fuel client. [possible values: beta-3, beta-4,
Use a network alias when connecting to a Fuel client. [possible values: beta-3, beta-5,
beta-5]
--postgres-database <POSTGRES_DATABASE>
Expand Down
8 changes: 4 additions & 4 deletions docs/src/getting-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
In this tutorial you will:

1. Bootstrap your development environment.
2. Create, build, and deploy an indexer to an indexer service hooked up to Fuel's `beta-4` testnet.
2. Create, build, and deploy an indexer to an indexer service hooked up to Fuel's `beta-5` testnet.
3. Query your indexer's newly created index for data using GraphQL.

---
Expand Down Expand Up @@ -109,20 +109,20 @@ We can quickly create a bootstrapped database and start the Fuel indexer service
> If you find that `--embedded-database` isn't working on your machine (for whatever reason), we strongly recommend that you simply used the Dockerized Fuel indexer components included in the project by using the `docker compose` script [included in the project](https://github.com/FuelLabs/fuel-indexer/blob/develop/scripts/docker-compose.yaml).
```bash
forc index start --network beta-4 --run-migrations --postgres-host postgresql
forc index start --network beta-5 --run-migrations --postgres-host postgresql
```

You should see output indicating the successful creation of a database and start of the indexer service; there may be much more content in your session, but it should generally contain output similar to the following lines:

```text
✅ Successfully started the indexer service at PID 39407
2023-07-31T15:57:28.942954Z INFO fuel_indexer::commands::run: 109: Configuration: IndexerConfig { metering_points: Some(30000000000), log_level: "info", verbose: false, local_fuel_node: false, indexer_net_config: false, fuel_node: FuelClientConfig { host: "beta-4.fuel.network", port: "80" }, web_api: WebApiConfig { host: "localhost", port: "29987", max_body_size: 5242880 }, database: PostgresConfig { user: "postgres", password: "XXXX", host: "localhost", port: "5432", database: "postgres", verbose: "false" }, metrics: false, stop_idle_indexers: false, run_migrations: true, authentication: AuthenticationConfig { enabled: false, strategy: None, jwt_secret: "XXXX", jwt_issuer: None, jwt_expiry: None }, rate_limit: RateLimitConfig { enabled: false, request_count: None, window_size: None }, replace_indexer: false, accept_sql_queries: false }
2023-07-31T15:57:28.942954Z INFO fuel_indexer::commands::run: 109: Configuration: IndexerConfig { metering_points: Some(30000000000), log_level: "info", verbose: false, local_fuel_node: false, indexer_net_config: false, fuel_node: FuelClientConfig { host: "beta-5.fuel.network", port: "80" }, web_api: WebApiConfig { host: "localhost", port: "29987", max_body_size: 5242880 }, database: PostgresConfig { user: "postgres", password: "XXXX", host: "localhost", port: "5432", database: "postgres", verbose: "false" }, metrics: false, stop_idle_indexers: false, run_migrations: true, authentication: AuthenticationConfig { enabled: false, strategy: None, jwt_secret: "XXXX", jwt_issuer: None, jwt_expiry: None }, rate_limit: RateLimitConfig { enabled: false, request_count: None, window_size: None }, replace_indexer: false, accept_sql_queries: false }
2023-07-31T15:57:28.948657Z INFO sqlx::postgres::notice: 157: relation "_sqlx_migrations" already exists, skipping
2023-07-31T15:57:28.976258Z INFO fuel_indexer::service: 378: Resuming Indexer(fuel.indexer_test) from block 81188
2023-07-31T15:57:29.077928Z INFO fuel_indexer::database: 187: Loading schema for Indexer(fuel.indexer_test) with Version(2738d221cf1e926d28e62bc93604a96ec6f7c5093e766f45a4555ed06e437b7f).
2023-07-31T15:57:29.081302Z WARN fuel_indexer::executor: 87: No end_block specified in manifest. Indexer will run forever.
2023-07-31T15:57:29.081311Z INFO fuel_indexer::executor: 109: Indexer(fuel.indexer_test) subscribing to Fuel node at beta-4.fuel.network:80
2023-07-31T15:57:29.081311Z INFO fuel_indexer::executor: 109: Indexer(fuel.indexer_test) subscribing to Fuel node at beta-5.fuel.network:80
2023-07-31T15:57:29.081424Z INFO fuel_indexer::service: 194: Registered Indexer(fuel.indexer_test)
2023-07-31T15:57:29.082150Z INFO fuel_indexer_lib::utils: 132: Parsed SocketAddr '127.0.0.1:29987' from 'localhost:29987
```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/project-components/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Create, deploy, and check the status of a new indexer.

```bash
fuel-indexer run \
--network beta-4 \
--network beta-5 \
--run-migrations \
--accept-sql-queries \
--replace-indexer
Expand Down
2 changes: 1 addition & 1 deletion docs/src/project-components/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Below is a sample indexer manifest file
```yaml
namespace: fuellabs
identifier: order_book_v1
fuel_client: beta-4.fuel.network:80
fuel_client: beta-5.fuel.network:80
abi: path/to/my/contract-abi.json
contract_id: "fuels0x39150017c9e38e5e280432d546fae345d6ce6d8fe4710162c2e3a95a6faff051"
graphql_schema: path/to/my/schema.graphql
Expand Down
2 changes: 1 addition & 1 deletion docs/src/querying/full-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Finally, let's combine nested entities, filtering, and pagination into one complete example.

Sticking with the same block explorer example, let's say that we are looking for a particular transaction and its containing block, but we don't remember either of the hashes. All we know is that the total value of the transaction is greater than zero, it was sometime after the start of the `beta-4` testnet, and it was included as part of the first fifty blocks. Additionally, we don't want to parse through all the results at once, so we only want to look at two records at a time. Finally, we think that it may have been on the more recent side, so we want to check them in reverse chronological order.
Sticking with the same block explorer example, let's say that we are looking for a particular transaction and its containing block, but we don't remember either of the hashes. All we know is that the total value of the transaction is greater than zero, it was sometime after the start of the `beta-5` testnet, and it was included as part of the first fifty blocks. Additionally, we don't want to parse through all the results at once, so we only want to look at two records at a time. Finally, we think that it may have been on the more recent side, so we want to check them in reverse chronological order.

Putting all of that together, we get the following query:

Expand Down
2 changes: 1 addition & 1 deletion examples/fuel-explorer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
start_period: 80s
fuel-indexer:
image: ghcr.io/fuellabs/fuel-indexer:latest
command: bash -c "sleep 2 && ./fuel-indexer run --network beta-4 --postgres-host postgres --postgres-password postgres --web-api-host 0.0.0.0 --run-migrations"
command: bash -c "sleep 2 && ./fuel-indexer run --network beta-5 --postgres-host postgres --postgres-password postgres --web-api-host 0.0.0.0 --run-migrations"
ports:
- "29987:29987"
volumes:
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
start_period: 80s
fuel-indexer:
image: ghcr.io/fuellabs/fuel-indexer:latest
command: bash -c "sleep 2 && ./fuel-indexer run --network beta-4 --postgres-host postgres --postgres-password postgres --web-api-host 0.0.0.0 --run-migrations"
command: bash -c "sleep 2 && ./fuel-indexer run --network beta-5 --postgres-host postgres --postgres-password postgres --web-api-host 0.0.0.0 --run-migrations"
ports:
- "29987:29987"
volumes:
Expand Down
2 changes: 1 addition & 1 deletion helm/fuel-indexer/sample.values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app:
fuel_node_host: beta-4.fuel.network
fuel_node_host: beta-5.fuel.network
fuel_node_port: 80
volume:
storageclass: gp3-generic
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-indexer-benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runs in `target/criterion`. Additionally, an HTML file with plots and statistics
### QA suite

```bash
cargo run -p fuel-indexer-benchmarks --bin qa -- --network beta-4.fuel.network
cargo run -p fuel-indexer-benchmarks --bin qa -- --network beta-5.fuel.network
```

### Comparing Branches
Expand Down
5 changes: 4 additions & 1 deletion packages/fuel-indexer-benchmarks/src/bin/qa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,15 @@ struct BlockHeightRequest {
#[derive(Debug)]
enum Network {
Beta4,
Beta5,
Mainnet,
}

impl From<String> for Network {
fn from(s: String) -> Self {
match s.as_str() {
"beta-4.fuel.network" => Network::Beta4,
"beta-5.fuel.network" => Network::Beta5,
"mainnet" => Network::Mainnet,
_ => panic!("Invalid network"),
}
Expand All @@ -382,6 +384,7 @@ impl Display for Network {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Network::Beta4 => write!(f, "beta-4.fuel.network"),
Network::Beta5 => write!(f, "beta-5.fuel.network"),
Network::Mainnet => write!(f, "mainnet"),
}
}
Expand Down Expand Up @@ -538,7 +541,7 @@ async fn main() {
.arg("start")
.arg("--run-migrations")
.arg("--fuel-node-host")
.arg("beta-4.fuel.network")
.arg("beta-5.fuel.network")
.arg("--fuel-node-port")
.arg("80")
.arg("--replace-indexer")
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-indexer-benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use fuel_indexer_tests::fixtures::TestPostgresDb;
use std::str::FromStr;

/// Location of Fuel node to be used for block retrieval.
pub const NODE_URL: &str = "beta-4.fuel.network:80";
pub const NODE_URL: &str = "beta-5.fuel.network:80";

/// Cargo workspace root; used to ensure correct file paths.
pub const WORKSPACE_ROOT: &str = env!("CARGO_MANIFEST_DIR");
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-indexer-lib/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@ pub const ALLOW_NON_SEQUENTIAL_BLOCKS: bool = false;
pub const DISABLE_TOOLCHAIN_VERSION_CHECK: bool = false;

/// Default Fuel network to use.
pub const NETWORK: &str = "beta-4";
pub const NETWORK: &str = "beta-5";
54 changes: 33 additions & 21 deletions packages/fuel-indexer-tests/src/fixtures.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use crate::{
assets, defaults, utils::update_test_manifest_asset_paths, TestError, WORKSPACE_ROOT,
};
use crate::{assets, defaults, TestError, WORKSPACE_ROOT};
use actix_service::Service;
use actix_web::test;
use axum::routing::Router;
Expand Down Expand Up @@ -40,8 +38,8 @@ use tokio::{
use tracing_subscriber::filter::EnvFilter;

abigen!(Contract(
name = "FuelIndexerTest",
abi = "packages/fuel-indexer-tests/contracts/fuel-indexer-test/out/debug/fuel-indexer-test-abi.json"
name = "FuelIndexer",
abi = "packages/fuel-indexer-tests/sway/test-contract1/out/debug/test-contract1-abi.json"
));

pub struct TestPostgresDb {
Expand Down Expand Up @@ -93,8 +91,7 @@ pub async fn setup_indexing_test_components(
let db = TestPostgresDb::new().await.unwrap();
let mut service = indexer_service_postgres(Some(&db.url), config).await;

let mut manifest = Manifest::try_from(assets::FUEL_INDEXER_TEST_MANIFEST).unwrap();
update_test_manifest_asset_paths(&mut manifest);
let manifest = assets::test_indexer_updated_manifest();

service
.register_indexer_from_manifest(
Expand All @@ -119,8 +116,7 @@ pub async fn setup_web_test_components(
let db = TestPostgresDb::new().await.unwrap();
let mut service = indexer_service_postgres(Some(&db.url), config.clone()).await;

let mut manifest = Manifest::try_from(assets::FUEL_INDEXER_TEST_MANIFEST).unwrap();
update_test_manifest_asset_paths(&mut manifest);
let manifest = assets::test_indexer_updated_manifest();

service
.register_indexer_from_manifest(
Expand Down Expand Up @@ -346,22 +342,22 @@ pub async fn setup_example_test_fuel_node() -> Result<(), ()> {
let wallet_path = Path::new(WORKSPACE_ROOT).join("test-chain-config.json");

let contract_bin_path = Path::new(WORKSPACE_ROOT)
.join("contracts")
.join("fuel-indexer-test")
.join("sway")
.join("test-contract1")
.join("out")
.join("debug")
.join("fuel-indexer-test.bin");
.join("test-contract1.bin");

setup_test_fuel_node(wallet_path, Some(contract_bin_path), None).await
}

pub fn get_test_contract_id() -> Bech32ContractId {
let contract_bin_path = Path::new(WORKSPACE_ROOT)
.join("contracts")
.join("fuel-indexer-test")
.join("sway")
.join("test-contract1")
.join("out")
.join("debug")
.join("fuel-indexer-test.bin");
.join("test-contract1.bin");

let loaded_contract = Contract::load_from(
contract_bin_path.as_os_str().to_str().unwrap(),
Expand Down Expand Up @@ -413,7 +409,7 @@ pub async fn indexer_service_postgres(
}

pub async fn connect_to_deployed_contract(
) -> Result<FuelIndexerTest<WalletUnlocked>, Box<dyn std::error::Error>> {
) -> Result<FuelIndexer<WalletUnlocked>, Box<dyn std::error::Error>> {
let wallet_path = Path::new(WORKSPACE_ROOT).join("test-chain-config.json");
let wallet_path_str = wallet_path.as_os_str().to_str().unwrap();
let mut wallet =
Expand All @@ -433,7 +429,7 @@ pub async fn connect_to_deployed_contract(
let contract_id: Bech32ContractId =
Bech32ContractId::from(fuels::types::ContractId::from(get_test_contract_id()));

let contract = FuelIndexerTest::new(contract_id.clone(), wallet);
let contract = FuelIndexer::new(contract_id.clone(), wallet);

println!("Using contract at {contract_id}");

Expand All @@ -454,7 +450,7 @@ pub mod test_web {
use fuels::types::bech32::Bech32ContractId;
use std::path::Path;

use super::{tx_params, FuelIndexerTest};
use super::{tx_params, FuelIndexer};

async fn fuel_indexer_test_blocks(state: web::Data<Arc<AppState>>) -> impl Responder {
let _ = state
Expand Down Expand Up @@ -839,12 +835,28 @@ pub mod test_web {
HttpResponse::Ok()
}

async fn trigger_predicate_witness_data(
state: web::Data<Arc<AppState>>,
) -> impl Responder {
let data = vec![1u8];
let _ = state
.contract
.methods()
.trigger_find()
.tx_params(tx_params())
.call()
.await
.unwrap();

HttpResponse::Ok()
}

pub struct AppState {
pub contract: FuelIndexerTest<WalletUnlocked>,
pub contract: FuelIndexer<WalletUnlocked>,
}

pub fn app(
contract: FuelIndexerTest<WalletUnlocked>,
contract: FuelIndexer<WalletUnlocked>,
) -> App<
impl ServiceFactory<
ServiceRequest,
Expand Down Expand Up @@ -944,7 +956,7 @@ pub mod test_web {
println!("Starting server at {}", defaults::WEB_API_ADDR);

let _ = HttpServer::new(move || {
app(FuelIndexerTest::new(contract_id.clone(), wallet.clone()))
app(FuelIndexer::new(contract_id.clone(), wallet.clone()))
})
.bind(defaults::WEB_API_ADDR)
.unwrap()
Expand Down
8 changes: 7 additions & 1 deletion packages/fuel-indexer-tests/tests/indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{collections::HashSet, str::FromStr};

const REVERT_VM_CODE: u64 = 0x0004;
const EXPECTED_CONTRACT_ID: &str =
"5805ad6fc1543e317cc86d4da1185b8e122c183861bf9e151a3819ac3e26103d";
"60ddf75280b60e644e90fca5febaffb024882f0203b04ed8c7e9df8aa961060e";
const TRANSFER_BASE_ASSET_ID: &str =
"0000000000000000000000000000000000000000000000000000000000000000";

Expand Down Expand Up @@ -773,3 +773,9 @@ async fn test_find() {
.get::<&str, usize>(2)
.contains("called `Option::unwrap()` on a `None` value"));
}


#[actix_web::test]
async fn test_signal_predicate_witness_data() {

}
Loading

0 comments on commit 65755a7

Please sign in to comment.