Skip to content

Commit

Permalink
chore: upgrade to beta-5 (#1495)
Browse files Browse the repository at this point in the history
* chore: upgrade to beta-5

* updates

* rebase origin/develop

* update tests

* clippy

* updates

* Update Sway contract; comment out broken tests

* Fix TRYBUILD

* Switch to failable coversion of numeric types to usize for SQL values

---------

Co-authored-by: ra0x3 <spam.rashad@protonmail.com>
Co-authored-by: Alexander <alex@deekerno.com>
  • Loading branch information
3 people committed Jan 30, 2024
1 parent c2015e2 commit 6d214c1
Show file tree
Hide file tree
Showing 44 changed files with 999 additions and 1,296 deletions.
1,313 changes: 611 additions & 702 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ fuel-indexer-postgres = { version = "0.24.3", path = "./packages/fuel-indexer-da
fuel-indexer-schema = { version = "0.24.3", path = "./packages/fuel-indexer-schema", default-features = false }
fuel-indexer-types = { version = "0.24.3", path = "./packages/fuel-indexer-types" }
fuel-indexer-utils = { version = "0.24.3", 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-crypto = { version = "0.43", 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
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ enum PanicReason {
InvalidMetadataIdentifier
MalformedCallStructure
ReservedRegisterNotWritable
ErrorFlag
InvalidImmediateValue
ExpectedCoinInput
MaxMemoryAccess
MemoryWriteOverlap
ContractNotInInputs
InternalBalanceOverflow
Expand All @@ -58,7 +56,6 @@ enum PanicReason {
TransferAmountCannotBeZero
ExpectedOutputVariable
ExpectedParentInternalContext
IllegalJump
ContractIdAlreadyDeployed
Unknown
}
Expand Down Expand Up @@ -463,7 +460,6 @@ union Output =
type CreateTransaction @entity {
id: ID!
gas_price: U64!
gas_limit: U64!
maturity: U32!
bytecode_length: U64!
bytecode_witness_index: U8!
Expand All @@ -482,7 +478,6 @@ type CreateTransaction @entity {
type ScriptTransaction @entity {
id: ID!
gas_price: U64!
gas_limit: U64!
maturity: U32!
script: Bytes!
script_data: Bytes!
Expand All @@ -500,7 +495,6 @@ type ScriptTransaction @entity {
type MintTransaction @entity {
id: ID!
tx_pointer: TxPointer!
outputs: [Output!]
metadata: Json
is_mint: Boolean!
receipts: [Receipt!]
Expand Down
14 changes: 0 additions & 14 deletions examples/fuel-explorer/fuel-explorer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ impl From<fuel::ClientPanicReason> for PanicReason {
fuel::ClientPanicReason::ReservedRegisterNotWritable => {
PanicReason::ReservedRegisterNotWritable
}
fuel::ClientPanicReason::ErrorFlag => PanicReason::ErrorFlag,
fuel::ClientPanicReason::InvalidImmediateValue => {
PanicReason::InvalidImmediateValue
}
fuel::ClientPanicReason::ExpectedCoinInput => PanicReason::ExpectedCoinInput,
fuel::ClientPanicReason::MaxMemoryAccess => PanicReason::MaxMemoryAccess,
fuel::ClientPanicReason::MemoryWriteOverlap => {
PanicReason::MemoryWriteOverlap
}
Expand All @@ -88,7 +86,6 @@ impl From<fuel::ClientPanicReason> for PanicReason {
fuel::ClientPanicReason::ExpectedParentInternalContext => {
PanicReason::ExpectedParentInternalContext
}
fuel::ClientPanicReason::IllegalJump => PanicReason::IllegalJump,
fuel::ClientPanicReason::ContractIdAlreadyDeployed => {
PanicReason::ContractIdAlreadyDeployed
}
Expand Down Expand Up @@ -728,7 +725,6 @@ impl From<fuel::TransactionData> for Transaction {
let tx_status = TransactionStatus::from(transaction.status.clone());
match transaction.transaction {
fuel::Transaction::Script(fuel::Script {
gas_limit,
gas_price,
maturity,
script,
Expand Down Expand Up @@ -762,7 +758,6 @@ impl From<fuel::TransactionData> for Transaction {
.collect::<Vec<_>>();

let script_tx = ScriptTransaction::new(
gas_limit,
gas_price,
*maturity,
script.to_owned().into(),
Expand All @@ -781,7 +776,6 @@ impl From<fuel::TransactionData> for Transaction {
Self::from(script_tx).get_or_create()
}
fuel::Transaction::Create(fuel::Create {
gas_limit,
gas_price,
maturity,
bytecode_length,
Expand Down Expand Up @@ -821,7 +815,6 @@ impl From<fuel::TransactionData> for Transaction {
.collect::<Vec<_>>();

let create_tx = CreateTransaction::new(
gas_limit,
gas_price,
*maturity,
bytecode_length,
Expand All @@ -842,15 +835,9 @@ impl From<fuel::TransactionData> for Transaction {
}
fuel::Transaction::Mint(fuel::Mint {
tx_pointer,
outputs,
metadata,
}) => {
let tx_pointer = TxPointer::from(tx_pointer.to_owned());
let outputs = outputs
.iter()
.map(|o| Output::from(o.to_owned()))
.map(|o| o.id)
.collect::<Vec<UID>>();
let receipts = transaction
.receipts
.iter()
Expand All @@ -859,7 +846,6 @@ impl From<fuel::TransactionData> for Transaction {

let mint_tx = MintTransaction::new(
tx_pointer.id,
Some(outputs),
metadata.to_owned().map(|m| m.into()),
true,
Some(receipts),
Expand Down
2 changes: 1 addition & 1 deletion examples/greetings/greetings-data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fuel-indexer-lib = { workspace = true }
fuel-indexer-tests = { version = "0.0.0", path = "./../../../packages/fuel-indexer-tests" }
fuel-tx = { workspace = true }
fuel-types = { workspace = true }
fuels = { version = "0.50" }
fuels = { version = "0.53" }
rand = "0.8"
thiserror = { workspace = true }
tokio = { features = ["macros", "rt-multi-thread"], workspace = true }
7 changes: 4 additions & 3 deletions examples/greetings/greetings-data/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use clap::Parser;
use fuel_indexer_tests::{defaults, fixtures::tx_params};
use fuel_indexer_tests::defaults;
use fuels::accounts::wallet::WalletUnlocked;
use fuels::macros::abigen;
use fuels::{
prelude::{Bech32ContractId, Contract, LoadConfiguration, Provider},
prelude::{Bech32ContractId, CallParameters, Contract, LoadConfiguration, Provider},
types::SizedAsciiString,
};
use rand::{seq::SliceRandom, Rng};
Expand Down Expand Up @@ -115,7 +115,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _ = contract
.methods()
.new_greeting(id, greeting, name)
.tx_params(tx_params())
.call_params(CallParameters::default())
.unwrap()
.call()
.await
.unwrap();
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-api-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async-graphql-axum = "5.0.7"
async-std = "1"
axum = { version = "0.6", features = ["multipart", "macros"] }
clap = { features = ["cargo", "derive", "env"], workspace = true }
fuel-crypto = { version = "=0.35.4", features = ["std"] }
fuel-crypto = { workspace = true, features = ["std"] }
fuel-indexer-database = { workspace = true }
fuel-indexer-graphql = { workspace = true }
fuel-indexer-lib = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-indexer-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ chrono = { version = "0.4", features = ["serde"] }
clap = { workspace = true }
criterion = { version = "0.5.1", features = ["html_reports", "async_tokio"] }
duct = "0.13"
fuel-core-client = "0.20"
fuel-core-client = "0.21"
fuel-indexer = { workspace = true }
fuel-indexer-database = { workspace = true }
fuel-indexer-graphql = { workspace = true }
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 @@ -378,13 +378,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 @@ -395,6 +397,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 @@ -589,7 +592,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
Loading

0 comments on commit 6d214c1

Please sign in to comment.