Skip to content

Commit

Permalink
Merge branch 'tablelandnetwork:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zer0stars authored Apr 25, 2024
2 parents e8c46d4 + 9fe8b45 commit 4e8f9c0
Show file tree
Hide file tree
Showing 31 changed files with 395 additions and 150 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ There are two prerequisites for running a validator:
Tableland has two separate networks:

- `mainnet`: this network syncs mainnet EVM chains (e.g., Ethereum mainnet, Arbitrum mainnet, etc.).
- `testnet`: this network is syncing testnet EVM chains (e.g., Ethereum Sepolia, Arbitrum Goerli, etc.).
- `testnet`: this network is syncing testnet EVM chains (e.g., Ethereum Sepolia, Arbitrum Sepolia, etc.).

This guide will focus on running the validator in the `mainnet` network.

Expand Down Expand Up @@ -298,7 +298,7 @@ The validator configuration is done via a JSON file located at `deployed/mainnet

This file contains general and chain-specific configuration, such as desired listening ports, gateway configuration, log level configuration, and chain-specific configuration, including name, chain ID, contract address, wallet private keys, and EVM node API endpoints.

The provided configurations in each `deployed/<environment>` already have everything needed for the environment and other recommended values. The environment variable expansion parts of the `config.json` file, such as secrets and other attributes in the `.env_validator` file, were explained in the [secret configuration section](2-configure-your-secrets-in-env-files) above. For example, the `VALIDATOR_ALCHEMY_ETHEREUM_MAINNET_API_KEY` variable configured in `.env_validator` expands a `${VALIDATOR_ALCHEMY_ETHEREUM_MAINNET_API_KEY}` present in the `config.json` file. If you want to use a self-hosted Ethereum mainnet node API or another provider, you can edit the `config.json` file in the `EthEndpoint` endpoint. This same logic applies to every possible configuration in the validator.
The provided configurations in each `deployed/<environment>` already have everything needed for the environment and other recommended values. The environment variable expansion parts of the `config.json` file, such as secrets and other attributes in the `.env_validator` file, were explained in the [secret configuration section](#2-configure-your-secrets-in-env-files) above. For example, the `VALIDATOR_ALCHEMY_ETHEREUM_MAINNET_API_KEY` variable configured in `.env_validator` expands a `${VALIDATOR_ALCHEMY_ETHEREUM_MAINNET_API_KEY}` present in the `config.json` file. If you want to use a self-hosted Ethereum mainnet node API or another provider, you can edit the `config.json` file in the `EthEndpoint` endpoint. This same logic applies to every possible configuration in the validator.

#### Observability stack

Expand Down Expand Up @@ -336,18 +336,16 @@ CREATE TABLE healthbot_{chainID} (counter INTEGER);
This would result in having four tables—one per chain:

- `healthbot_11155111_{tableID}` (Ethereum Sepolia)
- `healthbot_420_{tableID}` (Optimism Goerli)
- `healthbot_421613_{tableID}` (Arbitrum Goerli)
- `healthbot_80001_{tableID}` (Polygon Mumbai)
- `healthbot_11155420_{tableID}` (Optimism Sepolia)
- `healthbot_421614_{tableID}` (Arbitrum Sepolia)
- `healthbot_314159_{tableID}` (Filecoin Calibration)

You should create a file `.env_healthbot` in the `docker/deployed/testnet/healthbot` folder with the following content (an example is provided with `.env_healthbot.example`):

```txt
HEALTHBOT_ETHEREUM_SEPOLIA_TABLE=healthbot_11155111_{tableID}
HEALTHBOT_OPTIMISM_GOERLI_TABLE=healthbot_420_{tableID}
HEALTHBOT_ARBITRUM_GOERLI_TABLE=healthbot_421613_{tableID}
HEALTHBOT_POLYGON_MUMBAI_TABLE=healthbot_80001_{tableID}
HEALTHBOT_OPTIMISM_SEPOLIA_TABLE=healthbot_11155420_{tableID}
HEALTHBOT_ARBITRUM_SEPOLIA_TABLE=healthbot_421614_{tableID}
HEALTHBOT_FILECOIN_CALIBRATION_TABLE=healthbot_314159_{tableID}
```

Expand Down Expand Up @@ -473,4 +471,4 @@ Small note: If editing the README, please conform to the

## License

MIT AND Apache-2.0, © 2021-2023 Tableland Network Contributors
MIT AND Apache-2.0, © 2021-2024 Tableland Network Contributors
2 changes: 1 addition & 1 deletion cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ func createAPIServer(
server := &http.Server{
Addr: ":" + httpConfig.Port,
ReadTimeout: 10 * time.Second,
WriteTimeout: 20 * time.Second,
WriteTimeout: 60 * time.Second,
IdleTimeout: 120 * time.Second,
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){},
Handler: router.Handler(),
Expand Down
3 changes: 1 addition & 2 deletions docker/deployed/staging/api/.env_validator.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY=
VALIDATOR_OPTIMISM_GOERLI_SIGNER_PRIVATE_KEY=
VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY=
METRICS_HUB_API_KEY=
8 changes: 4 additions & 4 deletions docker/deployed/staging/api/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
},
"Chains": [
{
"Name": "Optimism Goerli",
"ChainID": 420,
"Name": "Optimism Sepolia",
"ChainID": 11155420,
"Registry": {
"EthEndpoint": "wss://opt-goerli.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY}",
"ContractAddress": "0xfe79824f6E5894a3DD86908e637B7B4AF57eEE28"
"EthEndpoint": "wss://eth-sepolia.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY}",
"ContractAddress": "0xd39a346e8299F4e3685f3D44215e0c9328e73439"
},
"EventFeed": {
"ChainAPIBackoff": "15s",
Expand Down
6 changes: 3 additions & 3 deletions docker/deployed/staging/healthbot/.env_healthbot.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEALTHBOT_OPTIMISM_GOERLI_PRIVATE_KEY=
HEALTHBOT_OPTIMISM_GOERLI_API_KEY=
HEALTHBOT_OPTIMISM_GOERLI_TABLE=
HEALTHBOT_OPTIMISM_SEPOLIA_PRIVATE_KEY=
HEALTHBOT_OPTIMISM_SEPOLIA_API_KEY=
HEALTHBOT_OPTIMISM_SEPOLIA_TABLE=

6 changes: 3 additions & 3 deletions docker/deployed/staging/healthbot/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"Chains": [
{
"ChainID": 420,
"WalletPrivateKey": "${HEALTHBOT_OPTIMISM_GOERLI_PRIVATE_KEY}",
"AlchemyAPIKey": "${HEALTHBOT_OPTIMISM_GOERLI_API_KEY}",
"WalletPrivateKey": "${HEALTHBOT_OPTIMISM_SEPOLIA_PRIVATE_KEY}",
"AlchemyAPIKey": "${HEALTHBOT_OPTIMISM_SEPOLIA_API_KEY}",
"Probe": {
"CheckInterval": "360s",
"ReceiptTimeout": "20s",
"Tablename": "${HEALTHBOT_OPTIMISM_GOERLI_TABLE}"
"Tablename": "${HEALTHBOT_OPTIMISM_SEPOLIA_TABLE}"
},
"OverrideClient" : {
"GatewayEndpoint": "https://staging.tableland.network",
Expand Down
7 changes: 3 additions & 4 deletions docker/deployed/testnet/api/.env_validator.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
VALIDATOR_ALCHEMY_ETHEREUM_SEPOLIA_API_KEY=
VALIDATOR_GLIF_FILECOIN_CALIBRATION_API_KEY=
VALIDATOR_ALCHEMY_POLYGON_MUMBAI_API_KEY=
VALIDATOR_ALCHEMY_ETHEREUM_GOERLI_API_KEY=
VALIDATOR_ALCHEMY_ARBITRUM_GOERLI_API_KEY=
VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY=
VALIDATOR_ALCHEMY_POLYGON_AMOY_API_KEY=
VALIDATOR_ALCHEMY_ARBITRUM_SEPOLIA_API_KEY=
VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY=
METRICS_HUB_API_KEY=
43 changes: 12 additions & 31 deletions docker/deployed/testnet/api/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,6 @@
"ChainStackCollectFrequency": "15m"
},
"Chains": [
{
"Name": "Ethereum Goerli",
"ChainID": 5,
"Registry": {
"EthEndpoint": "wss://eth-goerli.alchemyapi.io/v2/${VALIDATOR_ALCHEMY_ETHEREUM_GOERLI_API_KEY}",
"ContractAddress": "0xDA8EA22d092307874f30A1F277D1388dca0BA97a"
},
"EventFeed": {
"ChainAPIBackoff": "15s",
"NewBlockPollFreq": "10s",
"MinBlockDepth": 1,
"PersistEvents": true
},
"EventProcessor": {
"BlockFailedExecutionBackoff": "10s",
"DedupExecutedTxns": true
},
"HashCalculationStep": 150
},
{
"Name": "Ethereum Sepolia",
"ChainID": 11155111,
Expand All @@ -91,11 +72,11 @@
"HashCalculationStep": 150
},
{
"Name": "Polygon Mumbai",
"ChainID": 80001,
"Name": "Polygon Amoy",
"ChainID": 80002,
"Registry": {
"EthEndpoint": "wss://polygon-mumbai.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_POLYGON_MUMBAI_API_KEY}",
"ContractAddress": "0x4b48841d4b32C4650E4ABc117A03FE8B51f38F68"
"EthEndpoint": "wss://polygon-amoy.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_POLYGON_AMOY_API_KEY}",
"ContractAddress": "0x170fb206132b693e38adFc8727dCfa303546Cec1"
},
"EventFeed": {
"ChainAPIBackoff": "15s",
Expand All @@ -110,11 +91,11 @@
"HashCalculationStep": 360
},
{
"Name": "Arbitrum Goerli",
"ChainID": 421613,
"Name": "Arbitrum Sepolia",
"ChainID": 421614,
"Registry": {
"EthEndpoint": "wss://arb-goerli.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_ARBITRUM_GOERLI_API_KEY}",
"ContractAddress": "0x033f69e8d119205089Ab15D340F5b797732f646b"
"EthEndpoint": "wss://arb-sepolia.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_ARBITRUM_SEPOLIA_API_KEY}",
"ContractAddress": "0x223A74B8323914afDC3ff1e5005564dC17231d6e"
},
"EventFeed": {
"ChainAPIBackoff": "15s",
Expand All @@ -129,11 +110,11 @@
"HashCalculationStep": 360
},
{
"Name": "Optimism Goerli",
"ChainID": 420,
"Name": "Optimism Sepolia",
"ChainID": 11155420,
"Registry": {
"EthEndpoint": "wss://opt-goerli.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY}",
"ContractAddress": "0xC72E8a7Be04f2469f8C2dB3F1BdF69A7D516aBbA"
"EthEndpoint": "wss://opt-sepolia.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY}",
"ContractAddress": "0x68A2f4423ad3bf5139Db563CF3bC80aA09ed7079"
},
"EventFeed": {
"ChainAPIBackoff": "15s",
Expand Down
3 changes: 0 additions & 3 deletions docker/deployed/testnet/healthbot/.env_healthbot.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ HEALTHBOT_FILECOIN_HYPERSPACE_TABLE=
HEALTHBOT_ETHEREUM_GOERLI_PRIVATE_KEY=
HEALTHBOT_ALCHEMY_ETHEREUM_GOERLI_API_KEY=
HEALTHBOT_ETHEREUM_GOERLI_TABLE=
HEALTHBOT_POLYGON_MUMBAI_PRIVATE_KEY=
HEALTHBOT_ALCHEMY_POLYGON_MUMBAI_API_KEY=
HEALTHBOT_POLYGON_MUMBAI_TABLE=
HEALTHBOT_ARBITRUM_GOERLI_PRIVATE_KEY=
HEALTHBOT_ALCHEMY_ARBITRUM_GOERLI_API_KEY=
HEALTHBOT_ARBITRUM_GOERLI_TABLE=
Expand Down
10 changes: 0 additions & 10 deletions docker/deployed/testnet/healthbot/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@
"EstimatedGasLimitMultiplier": 1.1
}
},
{
"ChainID": 80001,
"WalletPrivateKey": "${HEALTHBOT_POLYGON_MUMBAI_PRIVATE_KEY}",
"AlchemyAPIKey": "${HEALTHBOT_ALCHEMY_POLYGON_MUMBAI_API_KEY}",
"Probe": {
"CheckInterval": "240s",
"ReceiptTimeout": "40s",
"Tablename": "${HEALTHBOT_POLYGON_MUMBAI_TABLE}"
}
},
{
"ChainID": 314159,
"WalletPrivateKey": "${HEALTHBOT_FILECOIN_CALIBRATION_PRIVATE_KEY}",
Expand Down
4 changes: 2 additions & 2 deletions internal/router/controllers/apiv1/api_health.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Tableland Validator - OpenAPI 3.0
*
* In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities: - Listen to on-chain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default). - Serve read-queries (e.g: SELECT * FROM foo_69_1) to the external world. - Serve state queries (e.g. list tables, get receipts, etc) to the external world. In the 1.0.0 release of the Tableland Validator API, we've switched to a design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
* In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities: - Listen to onchain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default). - Serve read-queries (e.g., SELECT * FROM foo_69_1) to the external world. - Serve state queries (e.g., list tables, get receipts, etc) to the external world. In the 1.0.0 release of the Tableland Validator API, we've switched to a design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. The API includes the following endpoints: - `/health`: Returns OK if the validator considers itself healthy. - `/version`: Returns version information about the validator daemon. - `/query`: Returns the results of a SQL read query against the Tableland network. - `/receipt/{chainId}/{transactionHash}`: Returns the status of a given transaction receipt by hash. - `/tables/{chainId}/{tableId}`: Returns information about a single table, including schema information.
*
* API version: 1.0.0
* API version: 1.1.0
* Contact: [email protected]
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
Expand Down
9 changes: 7 additions & 2 deletions internal/router/controllers/apiv1/api_query.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Tableland Validator - OpenAPI 3.0
*
* In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities: - Listen to on-chain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default). - Serve read-queries (e.g: SELECT * FROM foo_69_1) to the external world. - Serve state queries (e.g. list tables, get receipts, etc) to the external world. In the 1.0.0 release of the Tableland Validator API, we've switched to a design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
* In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities: - Listen to onchain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default). - Serve read-queries (e.g., SELECT * FROM foo_69_1) to the external world. - Serve state queries (e.g., list tables, get receipts, etc) to the external world. In the 1.0.0 release of the Tableland Validator API, we've switched to a design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. The API includes the following endpoints: - `/health`: Returns OK if the validator considers itself healthy. - `/version`: Returns version information about the validator daemon. - `/query`: Returns the results of a SQL read query against the Tableland network. - `/receipt/{chainId}/{transactionHash}`: Returns the status of a given transaction receipt by hash. - `/tables/{chainId}/{tableId}`: Returns information about a single table, including schema information.
*
* API version: 1.0.0
* API version: 1.1.0
* Contact: [email protected]
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
Expand All @@ -17,3 +17,8 @@ func QueryByStatement(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}

func QueryByStatementPost(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}
4 changes: 2 additions & 2 deletions internal/router/controllers/apiv1/api_receipt.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Tableland Validator - OpenAPI 3.0
*
* In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities: - Listen to on-chain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default). - Serve read-queries (e.g: SELECT * FROM foo_69_1) to the external world. - Serve state queries (e.g. list tables, get receipts, etc) to the external world. In the 1.0.0 release of the Tableland Validator API, we've switched to a design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
* In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities: - Listen to onchain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default). - Serve read-queries (e.g., SELECT * FROM foo_69_1) to the external world. - Serve state queries (e.g., list tables, get receipts, etc) to the external world. In the 1.0.0 release of the Tableland Validator API, we've switched to a design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. The API includes the following endpoints: - `/health`: Returns OK if the validator considers itself healthy. - `/version`: Returns version information about the validator daemon. - `/query`: Returns the results of a SQL read query against the Tableland network. - `/receipt/{chainId}/{transactionHash}`: Returns the status of a given transaction receipt by hash. - `/tables/{chainId}/{tableId}`: Returns information about a single table, including schema information.
*
* API version: 1.0.0
* API version: 1.1.0
* Contact: [email protected]
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
Expand Down
4 changes: 2 additions & 2 deletions internal/router/controllers/apiv1/api_tables.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Tableland Validator - OpenAPI 3.0
*
* In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities: - Listen to on-chain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default). - Serve read-queries (e.g: SELECT * FROM foo_69_1) to the external world. - Serve state queries (e.g. list tables, get receipts, etc) to the external world. In the 1.0.0 release of the Tableland Validator API, we've switched to a design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
* In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities: - Listen to onchain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default). - Serve read-queries (e.g., SELECT * FROM foo_69_1) to the external world. - Serve state queries (e.g., list tables, get receipts, etc) to the external world. In the 1.0.0 release of the Tableland Validator API, we've switched to a design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. The API includes the following endpoints: - `/health`: Returns OK if the validator considers itself healthy. - `/version`: Returns version information about the validator daemon. - `/query`: Returns the results of a SQL read query against the Tableland network. - `/receipt/{chainId}/{transactionHash}`: Returns the status of a given transaction receipt by hash. - `/tables/{chainId}/{tableId}`: Returns information about a single table, including schema information.
*
* API version: 1.0.0
* API version: 1.1.0
* Contact: [email protected]
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
Expand Down
Loading

0 comments on commit 4e8f9c0

Please sign in to comment.