Skip to content

Commit

Permalink
Fix a bunch of typos and general cleanup. (FuelLabs#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerjohn authored Jul 27, 2022
1 parent 589fd2f commit e34d7eb
Show file tree
Hide file tree
Showing 44 changed files with 610 additions and 585 deletions.
77 changes: 40 additions & 37 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Fuel Core has many dependent repositories. If you need any help or mentoring get

## Code Standards

We use an RFC process to maintain our code standards. They currently live in the RFC repo: https://github.com/FuelLabs/rfcs/tree/master/text/code-standards
We use an RFC process to maintain our code standards. They currently live in the RFC repo: <https://github.com/FuelLabs/rfcs/tree/master/text/code-standards>

## Building and setting up a development workspace

Expand All @@ -16,26 +16,27 @@ Fuel Core is mostly written in Rust, but includes components written in C++ (Roc

To build Fuel Core you'll need to at least have the following installed:

* `git` - version control
* [`rustup`](https://rustup.rs/) - Rust installer and toolchain manager
* [`clang`](http://releases.llvm.org/download.html) - Used to build system libraries (required for rocksdb).
* `git` - version control
* [`rustup`](https://rustup.rs/) - Rust installer and toolchain manager
* [`clang`](http://releases.llvm.org/download.html) - Used to build system libraries (required for rocksdb).

See the [README.md](README.md#system-requirements) for platform specific setup steps.

### Getting the repository

```
```sh
git clone https://github.com/FuelLabs/fuel-core
cd fuel-core
## Future instructions assume you are in this repository
```

### Configuring your Rust toolchain

`rustup` is the official toolchain manager for Rust.
`rustup` is the official toolchain manager for Rust.

We use some additional components such as `rustfmt` and `clippy`, to install those:
```

```sh
rustup component add rustfmt
rustup component add clippy
```
Expand All @@ -45,30 +46,32 @@ rustup component add clippy
Instead of a makefile, Fuel Core uses the `xtask` pattern to manage custom build processes.

You can build Fuel Core:
```

```sh
cargo xtask build
```

This command will run `cargo build` and also dump the latest schema into `/assets/` folder.

Linting is done using rustfmt and clippy, which are each separate commands:

```
```sh
cargo fmt --all --check
```

```
```sh
cargo clippy --all-targets
```

The test suite follows the Rust cargo standards. The GraphQL service will be instantiated by Tower and will emulate a server/client structure.

Testing is simply done using Cargo:
```

```sh
cargo test --all-targets
```

##### Build Options
#### Build Options

For optimal performance, we recommend using native builds. The generated binary will be optimized for your CPU and may contain specific instructions supported only in your hardware.

Expand All @@ -80,33 +83,33 @@ The generated binary will be located in `./target/release/fuel-core`
### Build issues

Due to dependencies on external components such as RocksDb, build times can be large without caching.
Using an in-memory (hashmap) based database is supported for testing purposes, so build times can be improved by disabling
Using an in-memory (hashmap) based database is supported for testing purposes, so build times can be improved by disabling
default features.

```
```sh
cargo build -p fuel-core --no-default-features
```

## Contribution flow

This is a rough outline of what a contributor's workflow looks like:

- Make sure what you want to contribute is already traced as an issue.
* We may discuss the problem and solution in the issue.
- Create a Git branch from where you want to base your work. This is usually master.
- Write code, add test cases, and commit your work.
- Run tests and make sure all tests pass.
- If the PR contains any breaking changes, add the breaking label to your PR.
- If you are part of the FuelLabs Github org, please open a PR from the repository itself.
- Otherwise, push your changes to a branch in your fork of the repository and submit a pull request.
* Make sure mention the issue, which is created at step 1, in the commit message.
- Your PR will be reviewed and some changes may be requested.
* Once you've made changes, your PR must be re-reviewed and approved.
* If the PR becomes out of date, you can use GitHub's 'update branch' button.
* If there are conflicts, you can merge and resolve them locally. Then push to your PR branch.
* Make sure what you want to contribute is already traced as an issue.
* We may discuss the problem and solution in the issue.
* Create a Git branch from where you want to base your work. This is usually master.
* Write code, add test cases, and commit your work.
* Run tests and make sure all tests pass.
* If the PR contains any breaking changes, add the breaking label to your PR.
* If you are part of the FuelLabs Github org, please open a PR from the repository itself.
* Otherwise, push your changes to a branch in your fork of the repository and submit a pull request.
* Make sure mention the issue, which is created at step 1, in the commit message.
* Your PR will be reviewed and some changes may be requested.
* Once you've made changes, your PR must be re-reviewed and approved.
* If the PR becomes out of date, you can use GitHub's 'update branch' button.
* If there are conflicts, you can merge and resolve them locally. Then push to your PR branch.
Any changes to the branch will require a re-review.
- Our CI system (Github Actions) automatically tests all authorized pull requests.
- Use Github to merge the PR once approved.
* Our CI system (Github Actions) automatically tests all authorized pull requests.
* Use Github to merge the PR once approved.

Thanks for your contributions!

Expand All @@ -118,30 +121,30 @@ If you are planning something big, for example, relates to multiple components o

The Client team actively develops and maintains several dependencies used in Fuel Core, which you may be also interested in:

- [fuel-types](https://github.com/FuelLabs/fuel-types)
- [fuel-merkle](https://github.com/FuelLabs/fuel-merkle)
- [fuel-tx](https://github.com/FuelLabs/fuel-tx)
- [fuel-asm](https://github.com/FuelLabs/fuel-asm)
- [fuel-vm](https://github.com/FuelLabs/fuel-vm)
* [fuel-types](https://github.com/FuelLabs/fuel-types)
* [fuel-merkle](https://github.com/FuelLabs/fuel-merkle)
* [fuel-tx](https://github.com/FuelLabs/fuel-tx)
* [fuel-asm](https://github.com/FuelLabs/fuel-asm)
* [fuel-vm](https://github.com/FuelLabs/fuel-vm)

### Linking issues

Pull Requests should be linked to at least one issue in the same repo.

If the pull request resolves the relevant issues, and you want GitHub to close these issues automatically after it merged into the default branch, you can use the syntax (`KEYWORD #ISSUE-NUMBER`) like this:

```
```md
close #123
```

If the pull request links an issue but does not close it, you can use the keyword `ref` like this:

```
```md
ref #456
```

Multiple issues should use full syntax for each issue and separate by a comma, like:

```
```md
close #123, ref #456
```
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,30 @@ If you are interested in contributing to Fuel, see our [CONTRIBUTING.md](CONTRIB
There are several system requirements including clang.

###### MacOS

```bash
brew update
brew install cmake
```

###### Debian

```bash
apt update
apt install -y cmake pkg-config build-essential git clang libclang-dev
```

###### Arch
```bash

```bash
pacman -Syu --needed --noconfirm cmake gcc pkgconf git clang
```

## Building
## Building

We recommend using `xtask` to build fuel-core:

```
```sh
cargo xtask build
```

Expand All @@ -48,7 +51,7 @@ This will run `cargo build` as well as any other custom build processes we have

The service can listen to an arbitrary socket, as specified in the help command:

```
```console
$ ./target/debug/fuel-core --help
fuel-core 0.1.0

Expand All @@ -67,17 +70,19 @@ OPTIONS:

#### Example

```
```console
$ ./target/debug/fuel-core --ip 127.0.0.1 --port 4000
Jul 12 23:28:47.238 INFO fuel_core: Binding GraphQL provider to 127.0.0.1:4000
```

#### Troubleshooting

If you encounter an error such as
```

```console
thread 'main' panicked at 'unable to open database: DatabaseError(Error { message: "Invalid argument: Column families not opened: column-11, column-10, column-9, column-8, column-7, column-6, column-5, column-4, column-3, column-2, column-1, column-0" })', fuel-core/src/main.rs:23:66
```

Clear your local database using: `rm -rf ~/.fuel/db`

#### Log level
Expand All @@ -87,7 +92,8 @@ The service relies on the environment variable `RUST_LOG`. For more information,
Human logging can be disabled with the environment variable `HUMAN_LOGGING=false`

## Docker & Kubernetes
```

```sh
# Create Docker Image
docker build -t fuel-core . -f deployment/Dockerfile

Expand Down Expand Up @@ -118,14 +124,14 @@ The service expects a mutation defined as `submit` that receives a [Transaction]

This example will execute a script that represents the following sequence of [ASM](https://github.com/FuelLabs/fuel-asm):

```
```rs
ADDI(0x10, REG_ZERO, 0xca),
ADDI(0x11, REG_ZERO, 0xba),
LOG(0x10, 0x11, REG_ZERO, REG_ZERO),
RET(REG_ONE),
```

```
```console
$ cargo run --bin fuel-gql-cli -- transaction submit \
"{\"Script\":{\"byte_price\":0,\"gas_price\":0,\"gas_limit\":1000000,\"maturity\":0,\"script\":[80,64,0,202,80,68,0,186,51,65,16,0,36,4,0,0],\"script_data\":[],\"inputs\":[],\"outputs\":[],\"witnesses\":[],\"receipts_root\":\"0x6114142d12e0f58cfb8c72c270cd0535944fb1ba763dce83c17e882c482224a2\"}}"
```
50 changes: 26 additions & 24 deletions deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ In order to stop and remove the fuel-core container, run at your command line:
docker-compose down
```

Note: Linx, Unix, and Windows operating systems are supported for docker-compose deployment option.
Note: Linux, Unix, and Windows operating systems are supported for docker-compose deployment option.

# Fuel Client Deployment on Kubernetes (k8s)
## Fuel Client Deployment on Kubernetes (k8s)

In order to deploy Fuel Client on k8s you must:

1) Deploy [fuel-core helm chart][fuel-helm-chart] to your k8s cluster

## Prerequisites
### Prerequisites

Before proceeding make sure to have these software packages installed on your machine:

Expand All @@ -43,11 +43,13 @@ Before proceeding make sure to have these software packages installed on your ma
4) [gettext][gettext-cli]: Install gettext for your OS

5) AWS (for EKS deployment only):

- [aws cli v2][aws-cli]: Install latest version of aws cli v2

- [aws-iam-authenticator][iam-auth]: Install to authenticate to EKS cluster via AWS IAM

- IAM user(s) with AWS access keys with following IAM access:

```json
{
"Version": "2012-10-17",
Expand Down Expand Up @@ -100,33 +102,33 @@ Before proceeding make sure to have these software packages installed on your ma

Note: Currently only Linux and Unix operating systems are supported for terraform creation of a k8s cluster.

## Deploying to k8s Cluster
### Deploying to k8s Cluster

### k8s Cluster Configuration
#### k8s Cluster Configuration

The current k8s cluster configuration is based on a single [env][env-file] file.

You will need to customize the following environment variables as needed (for variables not needed - keep the defaults):

| ENV Variable | Script Usage | Description |
|--------------------------------|---------------------------|---------------------------------------------------------------------------------------------------|
| k8s_provider | all | your kubernetes provider name, possible options: eks |
| k8s_namespace | fuel-core-deploy | your kubernetes namespace for fuel-core deployment |
| fuel_core_ingress_dns | fuel-core-ingress-deploy | the custom dns address for the fuel-core ingress |
| fuel_core_ingress_http_port | fuel-core-ingress-deploy | the custom port for the fuel-core ingress |
| fuel_core_image_repository | fuel-core-deploy | fuel-core ghcr image registry URI |
| fuel_core_image_tag | fuel-core-deploy | fuel-core ghcr image tag |
| fuel_core_pod_replicas | fuel-core-deploy | number of fuel-core pod replicas |
| pvc_storage_class | fuel-core-deploy | Storage class for the persistent volume |
| pvc_storage_requests | fuel-core-deploy | Th size of the request for the persistent volume |
| ENV Variable | Script Usage | Description |
|-----------------------------|--------------------------|------------------------------------------------------|
| k8s_provider | all | your kubernetes provider name, possible options: eks |
| k8s_namespace | fuel-core-deploy | your kubernetes namespace for fuel-core deployment |
| fuel_core_ingress_dns | fuel-core-ingress-deploy | the custom dns address for the fuel-core ingress |
| fuel_core_ingress_http_port | fuel-core-ingress-deploy | the custom port for the fuel-core ingress |
| fuel_core_image_repository | fuel-core-deploy | fuel-core ghcr image registry URI |
| fuel_core_image_tag | fuel-core-deploy | fuel-core ghcr image tag |
| fuel_core_pod_replicas | fuel-core-deploy | number of fuel-core pod replicas |
| pvc_storage_class | fuel-core-deploy | Storage class for the persistent volume |
| pvc_storage_requests | fuel-core-deploy | Th size of the request for the persistent volume |

Notes:

- fuel-core-deploy refers to [fuel-core-deploy][fuel-deploy-script] script

## Deploying Fuel Client on k8s
### Deploying Fuel Client on k8s

Now that the k8s cluster is setup - you can deploy the fuel-core helm chart via the [fuel-core-deploy][fuel-deploy-script].
Now that the k8s cluster is setup - you can deploy the fuel-core helm chart via the [fuel-core-deploy][fuel-deploy-script].

```bash
./fuel-core-deploy.sh
Expand Down Expand Up @@ -155,9 +157,9 @@ NAME DESIRED CURRENT READY AGE
replicaset.apps/fuel-core-k8s-5f58c6fcbd 1 1 1 131m
```

If the "STATUS" is deployed, the fuel-core helm chart has been deployed successfully.
If the "STATUS" is deployed, the fuel-core helm chart has been deployed successfully.

Having fuel-core pod(s) running and a service associated with an External IP, load balancer DNS address
Having fuel-core pod(s) running and a service associated with an External IP, load balancer DNS address
further means the helm chart was deployed successfully.

If the helm chart deployments fails and/or the fuel-core pod(s) are not healthy, then you will need to delete the helm chart via [fuel-core-delete][fuel-delete-script] script:
Expand All @@ -168,15 +170,15 @@ If the helm chart deployments fails and/or the fuel-core pod(s) are not healthy,

Then re-run the fuel-core-deploy script.

## Deploying Fuel Ingress on k8s
### Deploying Fuel Ingress on k8s

In order to serve external HTTP and/or HTTPS traffic, provide load balancing, and SSL termination to your newly deployed fuel-core pod, an [ingress][ingress-def] k8s object must be deployed.

Before deploying your fuel ingress, you must select a 'fuel_core_ingress_dns' env that will serve as the DNS address for external access of your fuel-core application. The DNS address must be in a DNS domain that you currently own and have access to.

Additionally 'fuel_core_ingress_http_port' env parameter must be selected for the http port, the default is port 80.

In order to support SSL certificate creation for your custom ingress DNS, you must select an 'letsencrypt_email' env which is an email address you have access to renew your letsencrypt certificate when needed. [Certificate manager][cert-manager] is used to issue the custom certificate via letsnencrypt
In order to support SSL certificate creation for your custom ingress DNS, you must select an 'letsencrypt_email' env which is an email address you have access to renew your letsencrypt certificate when needed. [Certificate manager][cert-manager] is used to issue the custom certificate via letsencrypt

For fuel ingress is deployed via [fuel-core-ingress-deploy][fuel-core-ingress-deploy] script:

Expand All @@ -190,7 +192,7 @@ It will take several minutes for ingress to be deployed and an external address
% kubectl get ingress -n fuel-core
NAME CLASS HOSTS ADDRESS PORTS AGE
fuel-core-ingress <none> node.example.io xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.elb.us-east-1.amazonaws.com 80, 443 3d21h
```
```

Create a DNS record based on that ADDRESS value in your DNS registrar and your fuel-core application will now be served at your DNS address.

Expand Down Expand Up @@ -220,4 +222,4 @@ If you need to cleanup your existing ingress resource, run the [fuel-core-ingres
[ingress-controller]: https://github.com/kubernetes/ingress-nginx
[ingress-def]: https://kubernetes.io/docs/concepts/services-networking/ingress/
[kubectl-cli]: https://kubernetes.io/docs/tasks/tools/
[terraform]: https://learn.hashicorp.com/tutorials/terraform/install-cli
[terraform]: https://learn.hashicorp.com/tutorials/terraform/install-cli
2 changes: 1 addition & 1 deletion fuel-block-executor/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Fuel Block Executor
# Fuel Block Executor
2 changes: 1 addition & 1 deletion fuel-block-importer/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Fuel Block Importer
# Fuel Block Importer
Loading

0 comments on commit e34d7eb

Please sign in to comment.