From 207a18b9a253f985e2fe7b5778ae92f5157fcbba Mon Sep 17 00:00:00 2001 From: avichalp Date: Tue, 14 Nov 2023 16:02:57 +0530 Subject: [PATCH 01/17] migrate arbitrum from goerli to sepolia Signed-off-by: avichalp --- .../deployed/testnet/api/.env_validator.example | 2 +- docker/deployed/testnet/api/config.json | 8 ++++---- pkg/client/chains.go | 15 +++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/docker/deployed/testnet/api/.env_validator.example b/docker/deployed/testnet/api/.env_validator.example index 4ca70005..b2e2e033 100644 --- a/docker/deployed/testnet/api/.env_validator.example +++ b/docker/deployed/testnet/api/.env_validator.example @@ -2,6 +2,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_ARBITRUM_SEPOLIA_API_KEY= VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY= METRICS_HUB_API_KEY= diff --git a/docker/deployed/testnet/api/config.json b/docker/deployed/testnet/api/config.json index 82b88f0d..47e7cfe1 100644 --- a/docker/deployed/testnet/api/config.json +++ b/docker/deployed/testnet/api/config.json @@ -110,11 +110,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", diff --git a/pkg/client/chains.go b/pkg/client/chains.go index aebbfb33..d41b3ebc 100644 --- a/pkg/client/chains.go +++ b/pkg/client/chains.go @@ -24,7 +24,7 @@ var ChainIDs = struct { EthereumGoerli ChainID EthereumSepolia ChainID OptimismGoerli ChainID - ArbitrumGoerli ChainID + ArbitrumSepolia ChainID FilecoinCalibration ChainID PolygonMumbai ChainID Local ChainID @@ -38,7 +38,7 @@ var ChainIDs = struct { EthereumGoerli: 5, EthereumSepolia: 11155111, OptimismGoerli: 420, - ArbitrumGoerli: 421613, + ArbitrumSepolia: 421614, FilecoinCalibration: 314159, PolygonMumbai: 80001, Local: 31337, @@ -108,11 +108,11 @@ var Chains = map[ChainID]Chain{ Name: "Optimism Goerli", ContractAddr: common.HexToAddress("0xC72E8a7Be04f2469f8C2dB3F1BdF69A7D516aBbA"), }, - ChainIDs.ArbitrumGoerli: { + ChainIDs.ArbitrumSepolia: { Endpoint: testnetURL, - ID: ChainIDs.ArbitrumGoerli, - Name: "Arbitrum Goerli", - ContractAddr: common.HexToAddress("0x033f69e8d119205089Ab15D340F5b797732f646b"), + ID: ChainIDs.ArbitrumSepolia, + Name: "Arbitrum Sepolia", + ContractAddr: common.HexToAddress("0x223A74B8323914afDC3ff1e5005564dC17231d6e"), }, ChainIDs.FilecoinCalibration: { Endpoint: testnetURL, @@ -140,7 +140,6 @@ var InfuraURLs = map[ChainID]string{ ChainIDs.Ethereum: "https://mainnet.infura.io/v3/%s", ChainIDs.OptimismGoerli: "https://optimism-goerli.infura.io/v3/%s", ChainIDs.Optimism: "https://optimism-mainnet.infura.io/v3/%s", - ChainIDs.ArbitrumGoerli: "https://arbitrum-goerli.infura.io/v3/%s", ChainIDs.Arbitrum: "https://arbitrum-mainnet.infura.io/v3/%s", ChainIDs.PolygonMumbai: "https://polygon-mumbai.infura.io/v3/%s", ChainIDs.Polygon: "https://polygon-mainnet.infura.io/v3/%s", @@ -153,7 +152,7 @@ var AlchemyURLs = map[ChainID]string{ ChainIDs.Ethereum: "https://eth-mainnet.g.alchemy.com/v2/%s", ChainIDs.OptimismGoerli: "https://opt-goerli.g.alchemy.com/v2/%s", ChainIDs.Optimism: "https://opt-mainnet.g.alchemy.com/v2/%s", - ChainIDs.ArbitrumGoerli: "https://arb-goerli.g.alchemy.com/v2/%s", + ChainIDs.ArbitrumSepolia: "https://arb-sepolia.g.alchemy.com/v2/%s", ChainIDs.Arbitrum: "https://arb-mainnet.g.alchemy.com/v2/%s", ChainIDs.PolygonMumbai: "https://polygon-mumbai.g.alchemy.com/v2/%s", ChainIDs.Polygon: "https://polygon-mainnet.g.alchemy.com/v2/%s", From 2d164f7b6c3293ca41a9264791a16c8346398a0c Mon Sep 17 00:00:00 2001 From: avichalp Date: Tue, 14 Nov 2023 18:46:38 +0530 Subject: [PATCH 02/17] add goerli back for safe migration Signed-off-by: avichalp --- .../testnet/api/.env_validator.example | 1 + docker/deployed/testnet/api/config.json | 19 +++++++++++++++++++ pkg/client/chains.go | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/docker/deployed/testnet/api/.env_validator.example b/docker/deployed/testnet/api/.env_validator.example index b2e2e033..212c331c 100644 --- a/docker/deployed/testnet/api/.env_validator.example +++ b/docker/deployed/testnet/api/.env_validator.example @@ -2,6 +2,7 @@ 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_ARBITRUM_SEPOLIA_API_KEY= VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY= METRICS_HUB_API_KEY= diff --git a/docker/deployed/testnet/api/config.json b/docker/deployed/testnet/api/config.json index 47e7cfe1..140bc9d5 100644 --- a/docker/deployed/testnet/api/config.json +++ b/docker/deployed/testnet/api/config.json @@ -109,6 +109,25 @@ }, "HashCalculationStep": 360 }, + { + "Name": "Arbitrum Goerli", + "ChainID": 421613, + "Registry": { + "EthEndpoint": "wss://arb-goerli.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_ARBITRUM_GOERLI_API_KEY}", + "ContractAddress": "0x033f69e8d119205089Ab15D340F5b797732f646b" + }, + "EventFeed": { + "ChainAPIBackoff": "15s", + "NewBlockPollFreq": "5s", + "MinBlockDepth": 0, + "PersistEvents": true + }, + "EventProcessor": { + "BlockFailedExecutionBackoff": "10s", + "DedupExecutedTxns": true + }, + "HashCalculationStep": 360 + }, { "Name": "Arbitrum Sepolia", "ChainID": 421614, diff --git a/pkg/client/chains.go b/pkg/client/chains.go index d41b3ebc..69d2975f 100644 --- a/pkg/client/chains.go +++ b/pkg/client/chains.go @@ -24,6 +24,7 @@ var ChainIDs = struct { EthereumGoerli ChainID EthereumSepolia ChainID OptimismGoerli ChainID + ArbitrumGoerli ChainID ArbitrumSepolia ChainID FilecoinCalibration ChainID PolygonMumbai ChainID @@ -38,6 +39,7 @@ var ChainIDs = struct { EthereumGoerli: 5, EthereumSepolia: 11155111, OptimismGoerli: 420, + ArbitrumGoerli: 421613, ArbitrumSepolia: 421614, FilecoinCalibration: 314159, PolygonMumbai: 80001, @@ -108,6 +110,12 @@ var Chains = map[ChainID]Chain{ Name: "Optimism Goerli", ContractAddr: common.HexToAddress("0xC72E8a7Be04f2469f8C2dB3F1BdF69A7D516aBbA"), }, + ChainIDs.ArbitrumGoerli: { + Endpoint: testnetURL, + ID: ChainIDs.ArbitrumGoerli, + Name: "Arbitrum Goerli", + ContractAddr: common.HexToAddress("0x033f69e8d119205089Ab15D340F5b797732f646b"), + }, ChainIDs.ArbitrumSepolia: { Endpoint: testnetURL, ID: ChainIDs.ArbitrumSepolia, @@ -152,6 +160,7 @@ var AlchemyURLs = map[ChainID]string{ ChainIDs.Ethereum: "https://eth-mainnet.g.alchemy.com/v2/%s", ChainIDs.OptimismGoerli: "https://opt-goerli.g.alchemy.com/v2/%s", ChainIDs.Optimism: "https://opt-mainnet.g.alchemy.com/v2/%s", + ChainIDs.ArbitrumGoerli: "https://arb-goerli.g.alchemy.com/v2/%s", ChainIDs.ArbitrumSepolia: "https://arb-sepolia.g.alchemy.com/v2/%s", ChainIDs.Arbitrum: "https://arb-mainnet.g.alchemy.com/v2/%s", ChainIDs.PolygonMumbai: "https://polygon-mumbai.g.alchemy.com/v2/%s", From 733747ba5b37b35d8dcb0a3aa9285954d355cad4 Mon Sep 17 00:00:00 2001 From: avichalp Date: Thu, 16 Nov 2023 16:37:58 +0530 Subject: [PATCH 03/17] remove arb and eth goerli networks Signed-off-by: avichalp --- .../testnet/api/.env_validator.example | 2 - docker/deployed/testnet/api/config.json | 40 +------------------ pkg/client/chains.go | 17 -------- 3 files changed, 1 insertion(+), 58 deletions(-) diff --git a/docker/deployed/testnet/api/.env_validator.example b/docker/deployed/testnet/api/.env_validator.example index 212c331c..273dfb66 100644 --- a/docker/deployed/testnet/api/.env_validator.example +++ b/docker/deployed/testnet/api/.env_validator.example @@ -1,8 +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_ARBITRUM_SEPOLIA_API_KEY= VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY= METRICS_HUB_API_KEY= diff --git a/docker/deployed/testnet/api/config.json b/docker/deployed/testnet/api/config.json index 140bc9d5..b18c8aa1 100644 --- a/docker/deployed/testnet/api/config.json +++ b/docker/deployed/testnet/api/config.json @@ -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, @@ -108,26 +89,7 @@ "DedupExecutedTxns": true }, "HashCalculationStep": 360 - }, - { - "Name": "Arbitrum Goerli", - "ChainID": 421613, - "Registry": { - "EthEndpoint": "wss://arb-goerli.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_ARBITRUM_GOERLI_API_KEY}", - "ContractAddress": "0x033f69e8d119205089Ab15D340F5b797732f646b" - }, - "EventFeed": { - "ChainAPIBackoff": "15s", - "NewBlockPollFreq": "5s", - "MinBlockDepth": 0, - "PersistEvents": true - }, - "EventProcessor": { - "BlockFailedExecutionBackoff": "10s", - "DedupExecutedTxns": true - }, - "HashCalculationStep": 360 - }, + }, { "Name": "Arbitrum Sepolia", "ChainID": 421614, diff --git a/pkg/client/chains.go b/pkg/client/chains.go index 69d2975f..6b6cc982 100644 --- a/pkg/client/chains.go +++ b/pkg/client/chains.go @@ -36,10 +36,8 @@ var ChainIDs = struct { Arbitrum: 42161, ArbitrumNova: 42170, Filecoin: 314, - EthereumGoerli: 5, EthereumSepolia: 11155111, OptimismGoerli: 420, - ArbitrumGoerli: 421613, ArbitrumSepolia: 421614, FilecoinCalibration: 314159, PolygonMumbai: 80001, @@ -92,12 +90,6 @@ var Chains = map[ChainID]Chain{ Name: "Filecoin", ContractAddr: common.HexToAddress("0x59EF8Bf2d6c102B4c42AEf9189e1a9F0ABfD652d"), }, - ChainIDs.EthereumGoerli: { - Endpoint: testnetURL, - ID: ChainIDs.EthereumGoerli, - Name: "Ethereum Goerli", - ContractAddr: common.HexToAddress("0xDA8EA22d092307874f30A1F277D1388dca0BA97a"), - }, ChainIDs.EthereumSepolia: { Endpoint: testnetURL, ID: ChainIDs.EthereumSepolia, @@ -110,12 +102,6 @@ var Chains = map[ChainID]Chain{ Name: "Optimism Goerli", ContractAddr: common.HexToAddress("0xC72E8a7Be04f2469f8C2dB3F1BdF69A7D516aBbA"), }, - ChainIDs.ArbitrumGoerli: { - Endpoint: testnetURL, - ID: ChainIDs.ArbitrumGoerli, - Name: "Arbitrum Goerli", - ContractAddr: common.HexToAddress("0x033f69e8d119205089Ab15D340F5b797732f646b"), - }, ChainIDs.ArbitrumSepolia: { Endpoint: testnetURL, ID: ChainIDs.ArbitrumSepolia, @@ -144,7 +130,6 @@ var Chains = map[ChainID]Chain{ // InfuraURLs contains the URLs for supported chains for Infura. var InfuraURLs = map[ChainID]string{ - ChainIDs.EthereumGoerli: "https://goerli.infura.io/v3/%s", ChainIDs.Ethereum: "https://mainnet.infura.io/v3/%s", ChainIDs.OptimismGoerli: "https://optimism-goerli.infura.io/v3/%s", ChainIDs.Optimism: "https://optimism-mainnet.infura.io/v3/%s", @@ -155,12 +140,10 @@ var InfuraURLs = map[ChainID]string{ // AlchemyURLs contains the URLs for supported chains for Alchemy. var AlchemyURLs = map[ChainID]string{ - ChainIDs.EthereumGoerli: "https://eth-goerli.g.alchemy.com/v2/%s", ChainIDs.EthereumSepolia: "https://eth-sepolia.g.alchemy.com/v2/%s", ChainIDs.Ethereum: "https://eth-mainnet.g.alchemy.com/v2/%s", ChainIDs.OptimismGoerli: "https://opt-goerli.g.alchemy.com/v2/%s", ChainIDs.Optimism: "https://opt-mainnet.g.alchemy.com/v2/%s", - ChainIDs.ArbitrumGoerli: "https://arb-goerli.g.alchemy.com/v2/%s", ChainIDs.ArbitrumSepolia: "https://arb-sepolia.g.alchemy.com/v2/%s", ChainIDs.Arbitrum: "https://arb-mainnet.g.alchemy.com/v2/%s", ChainIDs.PolygonMumbai: "https://polygon-mumbai.g.alchemy.com/v2/%s", From 10f92493bd80ab2f3e8aebffacb15460bfa1b519 Mon Sep 17 00:00:00 2001 From: Dan Buchholz Date: Thu, 16 Nov 2023 16:17:06 -0800 Subject: [PATCH 04/17] docs: update README with arb goerli to sepolia --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2f4507a8..7b16555d 100644 --- a/README.md +++ b/README.md @@ -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. @@ -337,7 +337,7 @@ 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_421614_{tableID}` (Arbitrum Sepolia) - `healthbot_80001_{tableID}` (Polygon Mumbai) - `healthbot_314159_{tableID}` (Filecoin Calibration) @@ -346,7 +346,7 @@ You should create a file `.env_healthbot` in the `docker/deployed/testnet/health ```txt HEALTHBOT_ETHEREUM_SEPOLIA_TABLE=healthbot_11155111_{tableID} HEALTHBOT_OPTIMISM_GOERLI_TABLE=healthbot_420_{tableID} -HEALTHBOT_ARBITRUM_GOERLI_TABLE=healthbot_421613_{tableID} +HEALTHBOT_ARBITRUM_SEPOLIA_TABLE=healthbot_421614_{tableID} HEALTHBOT_POLYGON_MUMBAI_TABLE=healthbot_80001_{tableID} HEALTHBOT_FILECOIN_CALIBRATION_TABLE=healthbot_314159_{tableID} ``` From 6e43c28fb5806b34cf79c694a6a7c99e95a6d0c4 Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Wed, 22 Nov 2023 13:37:01 -0300 Subject: [PATCH 05/17] adds new message to check from filter logs error Signed-off-by: Bruno Calza --- pkg/eventprocessor/eventfeed/impl/eventfeed.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/eventprocessor/eventfeed/impl/eventfeed.go b/pkg/eventprocessor/eventfeed/impl/eventfeed.go index bf47d0c1..a0b5593f 100644 --- a/pkg/eventprocessor/eventfeed/impl/eventfeed.go +++ b/pkg/eventprocessor/eventfeed/impl/eventfeed.go @@ -177,6 +177,7 @@ func (ef *EventFeed) Start( strings.Contains(err.Error(), "Log response size exceeded") || strings.Contains(err.Error(), "is greater than the limit") || strings.Contains(err.Error(), "eth_getLogs and eth_newFilter are limited to a 10,000 blocks range") || + strings.Contains(err.Error(), "eth_getLogs and eth_newFilter are limited to a 10000 blocks range") || strings.Contains(err.Error(), "range between to and from blocks is too large") || strings.Contains(err.Error(), "block range is too wide") { ef.maxBlocksFetchSize = ef.maxBlocksFetchSize * 80 / 100 From d8cc854404d49ed5d2ffb20c2d7faadb5029c316 Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Tue, 28 Nov 2023 15:46:00 -0300 Subject: [PATCH 06/17] adds new message to filter logs check Signed-off-by: Bruno Calza --- pkg/eventprocessor/eventfeed/impl/eventfeed.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/eventprocessor/eventfeed/impl/eventfeed.go b/pkg/eventprocessor/eventfeed/impl/eventfeed.go index a0b5593f..a0d6dda5 100644 --- a/pkg/eventprocessor/eventfeed/impl/eventfeed.go +++ b/pkg/eventprocessor/eventfeed/impl/eventfeed.go @@ -179,6 +179,7 @@ func (ef *EventFeed) Start( strings.Contains(err.Error(), "eth_getLogs and eth_newFilter are limited to a 10,000 blocks range") || strings.Contains(err.Error(), "eth_getLogs and eth_newFilter are limited to a 10000 blocks range") || strings.Contains(err.Error(), "range between to and from blocks is too large") || + strings.Contains(err.Error(), "getMultipleAccounts, eth_getLogs, and eth_newFilter are limited to a 5 range") || strings.Contains(err.Error(), "block range is too wide") { ef.maxBlocksFetchSize = ef.maxBlocksFetchSize * 80 / 100 } else { From 48d85ae57f0111d6db83155a823aed55982139c2 Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Wed, 21 Feb 2024 13:37:45 -0300 Subject: [PATCH 07/17] implements POST /query [stagingdeploy] Signed-off-by: Bruno Calza --- Makefile | 2 +- .../router/controllers/apiv1/api_health.go | 4 +- .../router/controllers/apiv1/api_query.go | 9 +- .../router/controllers/apiv1/api_receipt.go | 4 +- .../router/controllers/apiv1/api_tables.go | 4 +- .../router/controllers/apiv1/api_version.go | 4 +- internal/router/controllers/apiv1/logger.go | 4 +- .../router/controllers/apiv1/model_column.go | 4 +- .../model_one_of_table_attributes_value.go | 4 +- .../router/controllers/apiv1/model_query.go | 21 +++ .../router/controllers/apiv1/model_schema.go | 4 +- .../router/controllers/apiv1/model_table.go | 4 +- .../apiv1/model_table_attributes.go | 4 +- .../apiv1/model_transaction_receipt.go | 6 +- .../controllers/apiv1/model_version_info.go | 5 +- internal/router/controllers/apiv1/routers.go | 11 +- internal/router/controllers/controller.go | 66 ++++++- .../router/controllers/controller_test.go | 174 +++++++++++++++++- internal/router/router.go | 40 +++- 19 files changed, 332 insertions(+), 42 deletions(-) create mode 100644 internal/router/controllers/apiv1/model_query.go diff --git a/Makefile b/Makefile index 0d833cfa..822a427b 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ lint: .PHONY: lint # OpenAPI -SPEC_URL=https://raw.githubusercontent.com/tablelandnetwork/docs/main/specs/validator/tableland-openapi-spec.yaml +SPEC_URL=https://raw.githubusercontent.com/tablelandnetwork/docs/bcalza/postquery/specs/validator/tableland-openapi-spec.yaml APIV1=${PWD}/internal/router/controllers/apiv1 gen-api-v1: mkdir -p ${APIV1} diff --git a/internal/router/controllers/apiv1/api_health.go b/internal/router/controllers/apiv1/api_health.go index c1a4e465..c060b02b 100644 --- a/internal/router/controllers/apiv1/api_health.go +++ b/internal/router/controllers/apiv1/api_health.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/api_query.go b/internal/router/controllers/apiv1/api_query.go index 0d2ccd80..3fd7d41f 100644 --- a/internal/router/controllers/apiv1/api_query.go +++ b/internal/router/controllers/apiv1/api_query.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ @@ -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) +} diff --git a/internal/router/controllers/apiv1/api_receipt.go b/internal/router/controllers/apiv1/api_receipt.go index 81177b33..9baf8b23 100644 --- a/internal/router/controllers/apiv1/api_receipt.go +++ b/internal/router/controllers/apiv1/api_receipt.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/api_tables.go b/internal/router/controllers/apiv1/api_tables.go index fced67cc..855adf0a 100644 --- a/internal/router/controllers/apiv1/api_tables.go +++ b/internal/router/controllers/apiv1/api_tables.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/api_version.go b/internal/router/controllers/apiv1/api_version.go index 3f4aa476..8bb58d92 100644 --- a/internal/router/controllers/apiv1/api_version.go +++ b/internal/router/controllers/apiv1/api_version.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/logger.go b/internal/router/controllers/apiv1/logger.go index ed473ba0..d404d512 100644 --- a/internal/router/controllers/apiv1/logger.go +++ b/internal/router/controllers/apiv1/logger.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/model_column.go b/internal/router/controllers/apiv1/model_column.go index 56b9e071..f105c6ac 100644 --- a/internal/router/controllers/apiv1/model_column.go +++ b/internal/router/controllers/apiv1/model_column.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/model_one_of_table_attributes_value.go b/internal/router/controllers/apiv1/model_one_of_table_attributes_value.go index b0bf2f62..477f613b 100644 --- a/internal/router/controllers/apiv1/model_one_of_table_attributes_value.go +++ b/internal/router/controllers/apiv1/model_one_of_table_attributes_value.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/model_query.go b/internal/router/controllers/apiv1/model_query.go new file mode 100644 index 00000000..339834e7 --- /dev/null +++ b/internal/router/controllers/apiv1/model_query.go @@ -0,0 +1,21 @@ +/* + * Tableland Validator - OpenAPI 3.0 + * + * 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.1.0 + * Contact: carson@textile.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package apiv1 + +type Query struct { + // The SQL read query statement + Statement string `json:"statement,omitempty"` + // The requested response format: * `objects` - Returns the query results as a JSON array of JSON objects. * `table` - Return the query results as a JSON object with columns and rows properties. + Format string `json:"format,omitempty"` + // Whether to extract the JSON object from the single property of the surrounding JSON object. + Extract bool `json:"extract,omitempty"` + // Whether to unwrap the returned JSON objects from their surrounding array. + Unwrap bool `json:"unwrap,omitempty"` +} diff --git a/internal/router/controllers/apiv1/model_schema.go b/internal/router/controllers/apiv1/model_schema.go index 83060b06..6f3fe078 100644 --- a/internal/router/controllers/apiv1/model_schema.go +++ b/internal/router/controllers/apiv1/model_schema.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/model_table.go b/internal/router/controllers/apiv1/model_table.go index 08a21d59..6dcd7f7b 100644 --- a/internal/router/controllers/apiv1/model_table.go +++ b/internal/router/controllers/apiv1/model_table.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/model_table_attributes.go b/internal/router/controllers/apiv1/model_table_attributes.go index e519d6b6..f079b750 100644 --- a/internal/router/controllers/apiv1/model_table_attributes.go +++ b/internal/router/controllers/apiv1/model_table_attributes.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ diff --git a/internal/router/controllers/apiv1/model_transaction_receipt.go b/internal/router/controllers/apiv1/model_transaction_receipt.go index 6b3c7e8b..b79011f6 100644 --- a/internal/router/controllers/apiv1/model_transaction_receipt.go +++ b/internal/router/controllers/apiv1/model_transaction_receipt.go @@ -1,16 +1,16 @@ /* * 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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package apiv1 type TransactionReceipt struct { - + // This field is deprecated TableId string `json:"table_id,omitempty"` TableIds []string `json:"table_ids,omitempty"` diff --git a/internal/router/controllers/apiv1/model_version_info.go b/internal/router/controllers/apiv1/model_version_info.go index d460bc98..fbd9deed 100644 --- a/internal/router/controllers/apiv1/model_version_info.go +++ b/internal/router/controllers/apiv1/model_version_info.go @@ -1,16 +1,15 @@ /* * 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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package apiv1 type VersionInfo struct { - Version int32 `json:"version,omitempty"` GitCommit string `json:"git_commit,omitempty"` diff --git a/internal/router/controllers/apiv1/routers.go b/internal/router/controllers/apiv1/routers.go index f61e6894..598aefd8 100644 --- a/internal/router/controllers/apiv1/routers.go +++ b/internal/router/controllers/apiv1/routers.go @@ -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: carson@textile.io * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ @@ -69,6 +69,13 @@ var routes = Routes{ QueryByStatement, }, + Route{ + "QueryByStatementPost", + strings.ToUpper("Post"), + "/api/v1/query", + QueryByStatementPost, + }, + Route{ "ReceiptByTransactionHash", strings.ToUpper("Get"), diff --git a/internal/router/controllers/controller.go b/internal/router/controllers/controller.go index 073d256a..699befdf 100644 --- a/internal/router/controllers/controller.go +++ b/internal/router/controllers/controller.go @@ -150,7 +150,7 @@ func (c *Controller) GetReceiptByTransactionHash(rw http.ResponseWriter, r *http _ = json.NewEncoder(rw).Encode(receiptResponse) } -// GetTable handles the GET /chain/{chainID}/tables/{tableId} call. +// GetTable handles the GET /tables/{chainID}/{tableId} call. func (c *Controller) GetTable(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() vars := mux.Vars(r) @@ -256,6 +256,11 @@ func (c *Controller) GetTableQuery(rw http.ResponseWriter, r *http.Request) { return } + if len(formatted) == 0 { + rw.WriteHeader(http.StatusNotFound) + return + } + collectReadQueryMetric(r.Context(), stm, config, took) rw.WriteHeader(http.StatusOK) @@ -265,6 +270,65 @@ func (c *Controller) GetTableQuery(rw http.ResponseWriter, r *http.Request) { _, _ = rw.Write(formatted) } +// PostTableQuery handles the POST /query call. +func (c *Controller) PostTableQuery(rw http.ResponseWriter, r *http.Request) { + rw.Header().Set("Content-Type", "application/json") + + // setting a default body because these options could be missing from JSON + body := &apiv1.Query{ + Format: string(formatter.Objects), + Extract: false, + Unwrap: false, + } + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + rw.WriteHeader(http.StatusBadRequest) + msg := fmt.Sprintf("Error parsing the body request: %v", err) + log.Ctx(r.Context()).Error().Err(err).Msg(msg) + _ = json.NewEncoder(rw).Encode(errors.ServiceError{Message: msg}) + return + } + _ = r.Body.Close() + + start := time.Now() + res, ok := c.runReadRequest(r.Context(), body.Statement, rw) + if !ok { + return + } + took := time.Since(start) + + var opts []formatter.FormatOption + output, ok := formatter.OutputFromString(body.Format) + if !ok { + log.Ctx(r.Context()).Error().Msg("bad output query parameter") + _ = json.NewEncoder(rw).Encode(errors.ServiceError{Message: "bad output query parameter"}) + } + opts = append(opts, formatter.WithOutput(output)) + opts = append(opts, formatter.WithExtract(body.Extract)) + opts = append(opts, formatter.WithUnwrap(body.Unwrap)) + + formatted, config, err := formatter.Format(res, opts...) + if err != nil { + rw.WriteHeader(http.StatusInternalServerError) + msg := fmt.Sprintf("Error formatting data: %v", err) + _ = json.NewEncoder(rw).Encode(errors.ServiceError{Message: msg}) + log.Ctx(r.Context()).Error().Err(err).Msg(msg) + return + } + + if len(formatted) == 0 { + rw.WriteHeader(http.StatusNotFound) + return + } + + collectReadQueryMetric(r.Context(), body.Statement, config, took) + + rw.WriteHeader(http.StatusOK) + if config.Unwrap && len(res.Rows) > 1 { + rw.Header().Set("Content-Type", "application/jsonl+json") + } + _, _ = rw.Write(formatted) +} + func (c *Controller) runReadRequest( ctx context.Context, stm string, diff --git a/internal/router/controllers/controller_test.go b/internal/router/controllers/controller_test.go index 1a2cce68..5cd20b79 100644 --- a/internal/router/controllers/controller_test.go +++ b/internal/router/controllers/controller_test.go @@ -1,7 +1,9 @@ package controllers import ( + "bytes" "context" + "encoding/json" "errors" "fmt" "math/big" @@ -90,6 +92,105 @@ func TestQuery(t *testing.T) { } } +func TestPostQuery(t *testing.T) { + r := mocks.NewGateway(t) + r.EXPECT().RunReadQuery(mock.Anything, mock.AnythingOfType("string")).Return( + &gateway.TableData{ + Columns: []gateway.Column{ + {Name: "id"}, + {Name: "eyes"}, + {Name: "mouth"}, + }, + Rows: [][]*gateway.ColumnValue{ + { + gateway.OtherColValue(1), + gateway.OtherColValue("Big"), + gateway.OtherColValue("Surprised"), + }, + { + gateway.OtherColValue(2), + gateway.OtherColValue("Medium"), + gateway.OtherColValue("Sad"), + }, + { + gateway.OtherColValue(3), + gateway.OtherColValue("Small"), + gateway.OtherColValue("Happy"), + }, + }, + }, + nil, + ) + + ctrl := NewController(r) + + router := mux.NewRouter() + router.HandleFunc("/query", ctrl.PostTableQuery) + + ctx := context.WithValue(context.Background(), middlewares.ContextIPAddress, strconv.Itoa(1)) + + // Table format + body, err := json.Marshal(struct { + Statement string + Format string + }{ + Statement: "select * from foo", + Format: "table", + }) + require.NoError(t, err) + + req, err := http.NewRequestWithContext(ctx, "POST", "/query", bytes.NewReader(body)) + require.NoError(t, err) + rr := httptest.NewRecorder() + router.ServeHTTP(rr, req) + require.Equal(t, http.StatusOK, rr.Code) + exp := `{"columns":[{"name":"id"},{"name":"eyes"},{"name":"mouth"}],"rows":[[1,"Big","Surprised"],[2,"Medium","Sad"],[3,"Small","Happy"]]}` // nolint + require.JSONEq(t, exp, rr.Body.String()) + + // Object format + body, err = json.Marshal(struct { + Statement string + Format string + }{ + Statement: "select * from foo", + Format: "objects", + }) + require.NoError(t, err) + + req, err = http.NewRequestWithContext(ctx, "POST", "/query", bytes.NewReader(body)) + require.NoError(t, err) + rr = httptest.NewRecorder() + router.ServeHTTP(rr, req) + require.Equal(t, http.StatusOK, rr.Code) + exp = `[{"eyes":"Big","id":1,"mouth":"Surprised"},{"eyes":"Medium","id":2,"mouth":"Sad"},{"eyes":"Small","id":3,"mouth":"Happy"}]` // nolint + require.JSONEq(t, exp, rr.Body.String()) + + // Unwrapped object format + body, err = json.Marshal(struct { + Statement string + Format string + Unwrap bool + }{ + Statement: "select * from foo", + Format: "objects", + Unwrap: true, + }) + require.NoError(t, err) + + req, err = http.NewRequestWithContext(ctx, "POST", "/query", bytes.NewReader(body)) + require.NoError(t, err) + rr = httptest.NewRecorder() + router.ServeHTTP(rr, req) + require.Equal(t, http.StatusOK, rr.Code) + exp = "{\"eyes\":\"Big\",\"id\":1,\"mouth\":\"Surprised\"}\n{\"eyes\":\"Medium\",\"id\":2,\"mouth\":\"Sad\"}\n{\"eyes\":\"Small\",\"id\":3,\"mouth\":\"Happy\"}\n" // nolint + wantStrings := parseJSONLString(exp) + gotStrings := parseJSONLString(rr.Body.String()) + require.Equal(t, len(wantStrings), len(gotStrings)) + for i, wantString := range wantStrings { + require.JSONEq(t, wantString, gotStrings[i]) + } +} + func TestQueryEmptyTable(t *testing.T) { r := mocks.NewGateway(t) r.EXPECT().RunReadQuery(mock.Anything, mock.AnythingOfType("string")).Return( @@ -123,11 +224,7 @@ func TestQueryEmptyTable(t *testing.T) { require.NoError(t, err) rr = httptest.NewRecorder() router.ServeHTTP(rr, req) - require.Equal(t, http.StatusOK, rr.Code) - exp = "" - wantString := parseJSONLString(exp) - gotString := parseJSONLString(rr.Body.String()) - require.Equal(t, wantString, gotString) + require.Equal(t, http.StatusNotFound, rr.Code) } func TestQueryExtracted(t *testing.T) { @@ -177,6 +274,73 @@ func TestQueryExtracted(t *testing.T) { } } +func TestPostQueryExtracted(t *testing.T) { + r := mocks.NewGateway(t) + r.EXPECT().RunReadQuery(mock.Anything, mock.AnythingOfType("string")).Return( + &gateway.TableData{ + Columns: []gateway.Column{{Name: "name"}}, + Rows: [][]*gateway.ColumnValue{ + {gateway.OtherColValue("bob")}, + {gateway.OtherColValue("jane")}, + {gateway.OtherColValue("alex")}, + }, + }, + nil, + ) + + ctrl := NewController(r) + + router := mux.NewRouter() + router.HandleFunc("/query", ctrl.PostTableQuery) + + // Extracted object format + body, err := json.Marshal(struct { + Statement string + Format string + Extract bool + }{ + Statement: "select * from foo", + Format: "objects", + Extract: true, + }) + require.NoError(t, err) + + req, err := http.NewRequestWithContext(context.Background(), "POST", "/query", bytes.NewReader(body)) + require.NoError(t, err) + rr := httptest.NewRecorder() + router.ServeHTTP(rr, req) + require.Equal(t, http.StatusOK, rr.Code) + exp := `["bob","jane","alex"]` + require.JSONEq(t, exp, rr.Body.String()) + + // Extracted unwrapped object format + body, err = json.Marshal(struct { + Statement string + Format string + Extract bool + Unwrap bool + }{ + Statement: "select * from foo", + Format: "objects", + Extract: true, + Unwrap: true, + }) + require.NoError(t, err) + + req, err = http.NewRequestWithContext(context.Background(), "POST", "/query", bytes.NewReader(body)) + require.NoError(t, err) + rr = httptest.NewRecorder() + router.ServeHTTP(rr, req) + require.Equal(t, http.StatusOK, rr.Code) + exp = "\"bob\"\n\"jane\"\n\"alex\"\n" + wantStrings := parseJSONLString(exp) + gotStrings := parseJSONLString(rr.Body.String()) + require.Equal(t, len(wantStrings), len(gotStrings)) + for i, wantString := range wantStrings { + require.JSONEq(t, wantString, gotStrings[i]) + } +} + func TestGetTablesByMocked(t *testing.T) { t.Parallel() diff --git a/internal/router/router.go b/internal/router/router.go index 17546c21..13cd109b 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -61,6 +61,10 @@ func configureAPIV1Routes( userCtrl.GetTableQuery, []mux.MiddlewareFunc{middlewares.WithLogging, rateLim}, }, + "QueryByStatementPost": { + userCtrl.PostTableQuery, + []mux.MiddlewareFunc{middlewares.WithLogging, rateLim}, + }, "ReceiptByTransactionHash": { userCtrl.GetReceiptByTransactionHash, []mux.MiddlewareFunc{middlewares.WithLogging, middlewares.RESTChainID(supportedChainIDs), rateLim}, @@ -97,11 +101,30 @@ func configureAPIV1Routes( return fmt.Errorf("get path template: %s", err) } - router.get( - pathTemplate, - endpoint.handler, - append([]mux.MiddlewareFunc{middlewares.OtelHTTP(routeName)}, endpoint.middlewares...)..., - ) + methods, err := route.GetMethods() + if err != nil { + return fmt.Errorf("get method: %s", err) + } + + for _, method := range methods { + switch method { + case "GET": + router.get( + pathTemplate, + endpoint.handler, + append([]mux.MiddlewareFunc{middlewares.OtelHTTP(routeName)}, endpoint.middlewares...)..., + ) + case "POST": + router.post( + pathTemplate, + endpoint.handler, + append([]mux.MiddlewareFunc{middlewares.OtelHTTP(routeName)}, endpoint.middlewares...)..., + ) + default: + return fmt.Errorf("unknown method") + } + } + return nil }); err != nil { return fmt.Errorf("configuring api v1 router: %s", err) @@ -132,6 +155,13 @@ func (r *Router) get(uri string, f http.HandlerFunc, mid ...mux.MiddlewareFunc) sub.Use(mid...) } +// post creates a subroute on the specified URI that only accepts POST. You can provide specific middlewares. +func (r *Router) post(uri string, f http.HandlerFunc, mid ...mux.MiddlewareFunc) { + sub := r.r.Path(uri).Subrouter() + sub.HandleFunc("", f).Methods(http.MethodPost) + sub.Use(mid...) +} + // use adds middlewares to all routes. Should be used when a middleware should be execute all all routes (e.g. CORS). func (r *Router) use(mid ...mux.MiddlewareFunc) { r.r.Use(mid...) From 4166d3e2b0077d05965bb6378d38b087a44d5e57 Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Thu, 22 Feb 2024 11:53:44 -0300 Subject: [PATCH 08/17] points spec file to main Signed-off-by: Bruno Calza --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 822a427b..0d833cfa 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ lint: .PHONY: lint # OpenAPI -SPEC_URL=https://raw.githubusercontent.com/tablelandnetwork/docs/bcalza/postquery/specs/validator/tableland-openapi-spec.yaml +SPEC_URL=https://raw.githubusercontent.com/tablelandnetwork/docs/main/specs/validator/tableland-openapi-spec.yaml APIV1=${PWD}/internal/router/controllers/apiv1 gen-api-v1: mkdir -p ${APIV1} From 230a8408389ac5cba8203d561237bdc20b114b92 Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Sun, 25 Feb 2024 14:05:45 -0300 Subject: [PATCH 09/17] adds new eth log message Signed-off-by: Bruno Calza --- pkg/eventprocessor/eventfeed/impl/eventfeed.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/eventprocessor/eventfeed/impl/eventfeed.go b/pkg/eventprocessor/eventfeed/impl/eventfeed.go index a0d6dda5..7a7a9821 100644 --- a/pkg/eventprocessor/eventfeed/impl/eventfeed.go +++ b/pkg/eventprocessor/eventfeed/impl/eventfeed.go @@ -180,6 +180,7 @@ func (ef *EventFeed) Start( strings.Contains(err.Error(), "eth_getLogs and eth_newFilter are limited to a 10000 blocks range") || strings.Contains(err.Error(), "range between to and from blocks is too large") || strings.Contains(err.Error(), "getMultipleAccounts, eth_getLogs, and eth_newFilter are limited to a 5 range") || + strings.Contains(err.Error(), "eth_getLogs is limited to a 5 range") || strings.Contains(err.Error(), "block range is too wide") { ef.maxBlocksFetchSize = ef.maxBlocksFetchSize * 80 / 100 } else { From 09a79c031b940958aadfb4ed73651e7b3a5ae787 Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Mon, 26 Feb 2024 16:45:16 -0300 Subject: [PATCH 10/17] adds new eth logs check Signed-off-by: Bruno Calza --- pkg/eventprocessor/eventfeed/impl/eventfeed.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/eventprocessor/eventfeed/impl/eventfeed.go b/pkg/eventprocessor/eventfeed/impl/eventfeed.go index 7a7a9821..bd2694a1 100644 --- a/pkg/eventprocessor/eventfeed/impl/eventfeed.go +++ b/pkg/eventprocessor/eventfeed/impl/eventfeed.go @@ -181,6 +181,7 @@ func (ef *EventFeed) Start( strings.Contains(err.Error(), "range between to and from blocks is too large") || strings.Contains(err.Error(), "getMultipleAccounts, eth_getLogs, and eth_newFilter are limited to a 5 range") || strings.Contains(err.Error(), "eth_getLogs is limited to a 5 range") || + strings.Contains(err.Error(), "eth_getLogs is limited to a 10,000 range") || strings.Contains(err.Error(), "block range is too wide") { ef.maxBlocksFetchSize = ef.maxBlocksFetchSize * 80 / 100 } else { From d1990bf8744fef9cfbac85e3ade51dee61679645 Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Fri, 1 Mar 2024 11:01:01 -0300 Subject: [PATCH 11/17] increase http write timeout [testnetdeploy] Signed-off-by: Bruno Calza --- cmd/api/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/api/main.go b/cmd/api/main.go index 611ac712..62480ab8 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -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(), From cf48873efc9b76a0ebfb1532b9cc67dc7dac726b Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Wed, 6 Mar 2024 15:10:47 -0300 Subject: [PATCH 12/17] adds support to optimism sepolia [testnetdeploy] Signed-off-by: Bruno Calza --- .../staging/api/.env_validator.example | 2 +- docker/deployed/staging/api/config.json | 19 +++++++++++++++++++ .../testnet/api/.env_validator.example | 1 + docker/deployed/testnet/api/config.json | 19 +++++++++++++++++++ pkg/client/chains.go | 9 +++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/docker/deployed/staging/api/.env_validator.example b/docker/deployed/staging/api/.env_validator.example index c38fc499..6c29ad27 100644 --- a/docker/deployed/staging/api/.env_validator.example +++ b/docker/deployed/staging/api/.env_validator.example @@ -1,3 +1,3 @@ VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY= -VALIDATOR_OPTIMISM_GOERLI_SIGNER_PRIVATE_KEY= +VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY= METRICS_HUB_API_KEY= \ No newline at end of file diff --git a/docker/deployed/staging/api/config.json b/docker/deployed/staging/api/config.json index d516576d..a91278c3 100644 --- a/docker/deployed/staging/api/config.json +++ b/docker/deployed/staging/api/config.json @@ -51,6 +51,25 @@ "ChainStackCollectFrequency": "15m" }, "Chains": [ + { + "Name": "Optimism Sepolia", + "ChainID": 11155420, + "Registry": { + "EthEndpoint": "wss://eth-sepolia.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY}", + "ContractAddress": "0xd39a346e8299F4e3685f3D44215e0c9328e73439" + }, + "EventFeed": { + "ChainAPIBackoff": "15s", + "NewBlockPollFreq": "10s", + "MinBlockDepth": 0, + "PersistEvents": false + }, + "EventProcessor": { + "BlockFailedExecutionBackoff": "10s", + "DedupExecutedTxns": true + }, + "HashCalculationStep": 100 + }, { "Name": "Optimism Goerli", "ChainID": 420, diff --git a/docker/deployed/testnet/api/.env_validator.example b/docker/deployed/testnet/api/.env_validator.example index 273dfb66..561a6ec2 100644 --- a/docker/deployed/testnet/api/.env_validator.example +++ b/docker/deployed/testnet/api/.env_validator.example @@ -3,4 +3,5 @@ VALIDATOR_GLIF_FILECOIN_CALIBRATION_API_KEY= VALIDATOR_ALCHEMY_POLYGON_MUMBAI_API_KEY= VALIDATOR_ALCHEMY_ARBITRUM_SEPOLIA_API_KEY= VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY= +VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY= METRICS_HUB_API_KEY= diff --git a/docker/deployed/testnet/api/config.json b/docker/deployed/testnet/api/config.json index b18c8aa1..fb8792ea 100644 --- a/docker/deployed/testnet/api/config.json +++ b/docker/deployed/testnet/api/config.json @@ -128,6 +128,25 @@ }, "HashCalculationStep": 1800 }, + { + "Name": "Optimism Sepolia", + "ChainID": 11155420, + "Registry": { + "EthEndpoint": "wss://opt-sepolia.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY}", + "ContractAddress": "0x68A2f4423ad3bf5139Db563CF3bC80aA09ed7079" + }, + "EventFeed": { + "ChainAPIBackoff": "15s", + "NewBlockPollFreq": "5s", + "MinBlockDepth": 0, + "PersistEvents": true + }, + "EventProcessor": { + "BlockFailedExecutionBackoff": "10s", + "DedupExecutedTxns": true + }, + "HashCalculationStep": 1800 + }, { "Name": "Filecoin Calibration", "ChainID": 314159, diff --git a/pkg/client/chains.go b/pkg/client/chains.go index 6b6cc982..48b32ba8 100644 --- a/pkg/client/chains.go +++ b/pkg/client/chains.go @@ -24,6 +24,7 @@ var ChainIDs = struct { EthereumGoerli ChainID EthereumSepolia ChainID OptimismGoerli ChainID + OptimismSepolia ChainID ArbitrumGoerli ChainID ArbitrumSepolia ChainID FilecoinCalibration ChainID @@ -38,6 +39,7 @@ var ChainIDs = struct { Filecoin: 314, EthereumSepolia: 11155111, OptimismGoerli: 420, + OptimismSepolia: 11155420, ArbitrumSepolia: 421614, FilecoinCalibration: 314159, PolygonMumbai: 80001, @@ -102,6 +104,12 @@ var Chains = map[ChainID]Chain{ Name: "Optimism Goerli", ContractAddr: common.HexToAddress("0xC72E8a7Be04f2469f8C2dB3F1BdF69A7D516aBbA"), }, + ChainIDs.OptimismSepolia: { + Endpoint: testnetURL, + ID: ChainIDs.OptimismSepolia, + Name: "Optimism Sepolia", + ContractAddr: common.HexToAddress("0x68A2f4423ad3bf5139Db563CF3bC80aA09ed7079"), + }, ChainIDs.ArbitrumSepolia: { Endpoint: testnetURL, ID: ChainIDs.ArbitrumSepolia, @@ -143,6 +151,7 @@ var AlchemyURLs = map[ChainID]string{ ChainIDs.EthereumSepolia: "https://eth-sepolia.g.alchemy.com/v2/%s", ChainIDs.Ethereum: "https://eth-mainnet.g.alchemy.com/v2/%s", ChainIDs.OptimismGoerli: "https://opt-goerli.g.alchemy.com/v2/%s", + ChainIDs.OptimismSepolia: "https://opt-sepolia.g.alchemy.com/v2/%s", ChainIDs.Optimism: "https://opt-mainnet.g.alchemy.com/v2/%s", ChainIDs.ArbitrumSepolia: "https://arb-sepolia.g.alchemy.com/v2/%s", ChainIDs.Arbitrum: "https://arb-mainnet.g.alchemy.com/v2/%s", From 20afd9e98814b05ff0b5ae1a09260e716b229158 Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Wed, 6 Mar 2024 17:50:03 -0300 Subject: [PATCH 13/17] drop optimism goerli support Signed-off-by: Bruno Calza --- README.md | 4 ++-- .../staging/api/.env_validator.example | 1 - docker/deployed/staging/api/config.json | 19 ---------------- .../staging/healthbot/.env_healthbot.example | 6 ++--- docker/deployed/staging/healthbot/config.json | 6 ++--- .../testnet/api/.env_validator.example | 1 - docker/deployed/testnet/api/config.json | 19 ---------------- pkg/client/chains.go | 22 +++++-------------- 8 files changed, 13 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 7b16555d..0b9def1a 100644 --- a/README.md +++ b/README.md @@ -336,7 +336,7 @@ 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_11155420_{tableID}` (Optimism Sepolia) - `healthbot_421614_{tableID}` (Arbitrum Sepolia) - `healthbot_80001_{tableID}` (Polygon Mumbai) - `healthbot_314159_{tableID}` (Filecoin Calibration) @@ -345,7 +345,7 @@ You should create a file `.env_healthbot` in the `docker/deployed/testnet/health ```txt HEALTHBOT_ETHEREUM_SEPOLIA_TABLE=healthbot_11155111_{tableID} -HEALTHBOT_OPTIMISM_GOERLI_TABLE=healthbot_420_{tableID} +HEALTHBOT_OPTIMISM_SEPOLIA_TABLE=healthbot_11155420_{tableID} HEALTHBOT_ARBITRUM_SEPOLIA_TABLE=healthbot_421614_{tableID} HEALTHBOT_POLYGON_MUMBAI_TABLE=healthbot_80001_{tableID} HEALTHBOT_FILECOIN_CALIBRATION_TABLE=healthbot_314159_{tableID} diff --git a/docker/deployed/staging/api/.env_validator.example b/docker/deployed/staging/api/.env_validator.example index 6c29ad27..c9a4e7fa 100644 --- a/docker/deployed/staging/api/.env_validator.example +++ b/docker/deployed/staging/api/.env_validator.example @@ -1,3 +1,2 @@ -VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY= VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY= METRICS_HUB_API_KEY= \ No newline at end of file diff --git a/docker/deployed/staging/api/config.json b/docker/deployed/staging/api/config.json index a91278c3..76d49c63 100644 --- a/docker/deployed/staging/api/config.json +++ b/docker/deployed/staging/api/config.json @@ -69,25 +69,6 @@ "DedupExecutedTxns": true }, "HashCalculationStep": 100 - }, - { - "Name": "Optimism Goerli", - "ChainID": 420, - "Registry": { - "EthEndpoint": "wss://opt-goerli.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY}", - "ContractAddress": "0xfe79824f6E5894a3DD86908e637B7B4AF57eEE28" - }, - "EventFeed": { - "ChainAPIBackoff": "15s", - "NewBlockPollFreq": "10s", - "MinBlockDepth": 0, - "PersistEvents": false - }, - "EventProcessor": { - "BlockFailedExecutionBackoff": "10s", - "DedupExecutedTxns": true - }, - "HashCalculationStep": 100 } ] } \ No newline at end of file diff --git a/docker/deployed/staging/healthbot/.env_healthbot.example b/docker/deployed/staging/healthbot/.env_healthbot.example index 74618d74..9939b7cf 100644 --- a/docker/deployed/staging/healthbot/.env_healthbot.example +++ b/docker/deployed/staging/healthbot/.env_healthbot.example @@ -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= diff --git a/docker/deployed/staging/healthbot/config.json b/docker/deployed/staging/healthbot/config.json index e4dbbfb6..1a335556 100644 --- a/docker/deployed/staging/healthbot/config.json +++ b/docker/deployed/staging/healthbot/config.json @@ -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", diff --git a/docker/deployed/testnet/api/.env_validator.example b/docker/deployed/testnet/api/.env_validator.example index 561a6ec2..e3919bda 100644 --- a/docker/deployed/testnet/api/.env_validator.example +++ b/docker/deployed/testnet/api/.env_validator.example @@ -2,6 +2,5 @@ VALIDATOR_ALCHEMY_ETHEREUM_SEPOLIA_API_KEY= VALIDATOR_GLIF_FILECOIN_CALIBRATION_API_KEY= VALIDATOR_ALCHEMY_POLYGON_MUMBAI_API_KEY= VALIDATOR_ALCHEMY_ARBITRUM_SEPOLIA_API_KEY= -VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY= VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY= METRICS_HUB_API_KEY= diff --git a/docker/deployed/testnet/api/config.json b/docker/deployed/testnet/api/config.json index fb8792ea..102c7512 100644 --- a/docker/deployed/testnet/api/config.json +++ b/docker/deployed/testnet/api/config.json @@ -109,25 +109,6 @@ }, "HashCalculationStep": 360 }, - { - "Name": "Optimism Goerli", - "ChainID": 420, - "Registry": { - "EthEndpoint": "wss://opt-goerli.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_OPTIMISM_GOERLI_API_KEY}", - "ContractAddress": "0xC72E8a7Be04f2469f8C2dB3F1BdF69A7D516aBbA" - }, - "EventFeed": { - "ChainAPIBackoff": "15s", - "NewBlockPollFreq": "5s", - "MinBlockDepth": 0, - "PersistEvents": true - }, - "EventProcessor": { - "BlockFailedExecutionBackoff": "10s", - "DedupExecutedTxns": true - }, - "HashCalculationStep": 1800 - }, { "Name": "Optimism Sepolia", "ChainID": 11155420, diff --git a/pkg/client/chains.go b/pkg/client/chains.go index 48b32ba8..8b31db57 100644 --- a/pkg/client/chains.go +++ b/pkg/client/chains.go @@ -21,11 +21,8 @@ var ChainIDs = struct { Arbitrum ChainID ArbitrumNova ChainID Filecoin ChainID - EthereumGoerli ChainID EthereumSepolia ChainID - OptimismGoerli ChainID OptimismSepolia ChainID - ArbitrumGoerli ChainID ArbitrumSepolia ChainID FilecoinCalibration ChainID PolygonMumbai ChainID @@ -38,7 +35,6 @@ var ChainIDs = struct { ArbitrumNova: 42170, Filecoin: 314, EthereumSepolia: 11155111, - OptimismGoerli: 420, OptimismSepolia: 11155420, ArbitrumSepolia: 421614, FilecoinCalibration: 314159, @@ -98,12 +94,6 @@ var Chains = map[ChainID]Chain{ Name: "Ethereum Sepolia", ContractAddr: common.HexToAddress("0xc50C62498448ACc8dBdE43DA77f8D5D2E2c7597D"), }, - ChainIDs.OptimismGoerli: { - Endpoint: testnetURL, - ID: ChainIDs.OptimismGoerli, - Name: "Optimism Goerli", - ContractAddr: common.HexToAddress("0xC72E8a7Be04f2469f8C2dB3F1BdF69A7D516aBbA"), - }, ChainIDs.OptimismSepolia: { Endpoint: testnetURL, ID: ChainIDs.OptimismSepolia, @@ -138,19 +128,17 @@ var Chains = map[ChainID]Chain{ // InfuraURLs contains the URLs for supported chains for Infura. var InfuraURLs = map[ChainID]string{ - ChainIDs.Ethereum: "https://mainnet.infura.io/v3/%s", - ChainIDs.OptimismGoerli: "https://optimism-goerli.infura.io/v3/%s", - ChainIDs.Optimism: "https://optimism-mainnet.infura.io/v3/%s", - ChainIDs.Arbitrum: "https://arbitrum-mainnet.infura.io/v3/%s", - ChainIDs.PolygonMumbai: "https://polygon-mumbai.infura.io/v3/%s", - ChainIDs.Polygon: "https://polygon-mainnet.infura.io/v3/%s", + ChainIDs.Ethereum: "https://mainnet.infura.io/v3/%s", + ChainIDs.Optimism: "https://optimism-mainnet.infura.io/v3/%s", + ChainIDs.Arbitrum: "https://arbitrum-mainnet.infura.io/v3/%s", + ChainIDs.PolygonMumbai: "https://polygon-mumbai.infura.io/v3/%s", + ChainIDs.Polygon: "https://polygon-mainnet.infura.io/v3/%s", } // AlchemyURLs contains the URLs for supported chains for Alchemy. var AlchemyURLs = map[ChainID]string{ ChainIDs.EthereumSepolia: "https://eth-sepolia.g.alchemy.com/v2/%s", ChainIDs.Ethereum: "https://eth-mainnet.g.alchemy.com/v2/%s", - ChainIDs.OptimismGoerli: "https://opt-goerli.g.alchemy.com/v2/%s", ChainIDs.OptimismSepolia: "https://opt-sepolia.g.alchemy.com/v2/%s", ChainIDs.Optimism: "https://opt-mainnet.g.alchemy.com/v2/%s", ChainIDs.ArbitrumSepolia: "https://arb-sepolia.g.alchemy.com/v2/%s", From 563148fed6d9add0d2ae9f457cd1633060a5aeec Mon Sep 17 00:00:00 2001 From: Dan Buchholz Date: Thu, 7 Mar 2024 10:35:16 -0800 Subject: [PATCH 14/17] docs: update broken readme anchor --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0b9def1a..6beca6a7 100644 --- a/README.md +++ b/README.md @@ -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/` 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/` 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 @@ -473,4 +473,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 From 4ed4f1d456ae933a55128013ce27eab755661c41 Mon Sep 17 00:00:00 2001 From: avichalp Date: Thu, 11 Apr 2024 16:02:35 +0800 Subject: [PATCH 15/17] drop polygon mumbai Signed-off-by: avichalp --- README.md | 2 -- .../testnet/api/.env_validator.example | 1 - docker/deployed/testnet/api/config.json | 19 ------------------- .../testnet/healthbot/.env_healthbot.example | 3 --- pkg/client/chains.go | 18 ++++-------------- pkg/client/v1/client.go | 2 +- 6 files changed, 5 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 6beca6a7..4d7d4c86 100644 --- a/README.md +++ b/README.md @@ -338,7 +338,6 @@ This would result in having four tables—one per chain: - `healthbot_11155111_{tableID}` (Ethereum Sepolia) - `healthbot_11155420_{tableID}` (Optimism Sepolia) - `healthbot_421614_{tableID}` (Arbitrum Sepolia) -- `healthbot_80001_{tableID}` (Polygon Mumbai) - `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`): @@ -347,7 +346,6 @@ You should create a file `.env_healthbot` in the `docker/deployed/testnet/health HEALTHBOT_ETHEREUM_SEPOLIA_TABLE=healthbot_11155111_{tableID} HEALTHBOT_OPTIMISM_SEPOLIA_TABLE=healthbot_11155420_{tableID} HEALTHBOT_ARBITRUM_SEPOLIA_TABLE=healthbot_421614_{tableID} -HEALTHBOT_POLYGON_MUMBAI_TABLE=healthbot_80001_{tableID} HEALTHBOT_FILECOIN_CALIBRATION_TABLE=healthbot_314159_{tableID} ``` diff --git a/docker/deployed/testnet/api/.env_validator.example b/docker/deployed/testnet/api/.env_validator.example index e3919bda..a8b54cca 100644 --- a/docker/deployed/testnet/api/.env_validator.example +++ b/docker/deployed/testnet/api/.env_validator.example @@ -1,6 +1,5 @@ VALIDATOR_ALCHEMY_ETHEREUM_SEPOLIA_API_KEY= VALIDATOR_GLIF_FILECOIN_CALIBRATION_API_KEY= -VALIDATOR_ALCHEMY_POLYGON_MUMBAI_API_KEY= VALIDATOR_ALCHEMY_ARBITRUM_SEPOLIA_API_KEY= VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY= METRICS_HUB_API_KEY= diff --git a/docker/deployed/testnet/api/config.json b/docker/deployed/testnet/api/config.json index 102c7512..2b23d75d 100644 --- a/docker/deployed/testnet/api/config.json +++ b/docker/deployed/testnet/api/config.json @@ -71,25 +71,6 @@ }, "HashCalculationStep": 150 }, - { - "Name": "Polygon Mumbai", - "ChainID": 80001, - "Registry": { - "EthEndpoint": "wss://polygon-mumbai.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_POLYGON_MUMBAI_API_KEY}", - "ContractAddress": "0x4b48841d4b32C4650E4ABc117A03FE8B51f38F68" - }, - "EventFeed": { - "ChainAPIBackoff": "15s", - "NewBlockPollFreq": "5s", - "MinBlockDepth": 1, - "PersistEvents": true - }, - "EventProcessor": { - "BlockFailedExecutionBackoff": "10s", - "DedupExecutedTxns": true - }, - "HashCalculationStep": 360 - }, { "Name": "Arbitrum Sepolia", "ChainID": 421614, diff --git a/docker/deployed/testnet/healthbot/.env_healthbot.example b/docker/deployed/testnet/healthbot/.env_healthbot.example index d3b1fb6c..8dccf636 100644 --- a/docker/deployed/testnet/healthbot/.env_healthbot.example +++ b/docker/deployed/testnet/healthbot/.env_healthbot.example @@ -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= diff --git a/pkg/client/chains.go b/pkg/client/chains.go index 8b31db57..c74ee2ac 100644 --- a/pkg/client/chains.go +++ b/pkg/client/chains.go @@ -25,7 +25,6 @@ var ChainIDs = struct { OptimismSepolia ChainID ArbitrumSepolia ChainID FilecoinCalibration ChainID - PolygonMumbai ChainID Local ChainID }{ Ethereum: 1, @@ -38,7 +37,6 @@ var ChainIDs = struct { OptimismSepolia: 11155420, ArbitrumSepolia: 421614, FilecoinCalibration: 314159, - PolygonMumbai: 80001, Local: 31337, } @@ -112,12 +110,6 @@ var Chains = map[ChainID]Chain{ Name: "Filecoin Calibration", ContractAddr: common.HexToAddress("0x030BCf3D50cad04c2e57391B12740982A9308621"), }, - ChainIDs.PolygonMumbai: { - Endpoint: testnetURL, - ID: ChainIDs.PolygonMumbai, - Name: "Polygon Mumbai", - ContractAddr: common.HexToAddress("0x4b48841d4b32C4650E4ABc117A03FE8B51f38F68"), - }, ChainIDs.Local: { Endpoint: localURL, ID: ChainIDs.Local, @@ -128,11 +120,10 @@ var Chains = map[ChainID]Chain{ // InfuraURLs contains the URLs for supported chains for Infura. var InfuraURLs = map[ChainID]string{ - ChainIDs.Ethereum: "https://mainnet.infura.io/v3/%s", - ChainIDs.Optimism: "https://optimism-mainnet.infura.io/v3/%s", - ChainIDs.Arbitrum: "https://arbitrum-mainnet.infura.io/v3/%s", - ChainIDs.PolygonMumbai: "https://polygon-mumbai.infura.io/v3/%s", - ChainIDs.Polygon: "https://polygon-mainnet.infura.io/v3/%s", + ChainIDs.Ethereum: "https://mainnet.infura.io/v3/%s", + ChainIDs.Optimism: "https://optimism-mainnet.infura.io/v3/%s", + ChainIDs.Arbitrum: "https://arbitrum-mainnet.infura.io/v3/%s", + ChainIDs.Polygon: "https://polygon-mainnet.infura.io/v3/%s", } // AlchemyURLs contains the URLs for supported chains for Alchemy. @@ -143,7 +134,6 @@ var AlchemyURLs = map[ChainID]string{ ChainIDs.Optimism: "https://opt-mainnet.g.alchemy.com/v2/%s", ChainIDs.ArbitrumSepolia: "https://arb-sepolia.g.alchemy.com/v2/%s", ChainIDs.Arbitrum: "https://arb-mainnet.g.alchemy.com/v2/%s", - ChainIDs.PolygonMumbai: "https://polygon-mumbai.g.alchemy.com/v2/%s", ChainIDs.Polygon: "https://polygon-mainnet.g.alchemy.com/v2/%s", } diff --git a/pkg/client/v1/client.go b/pkg/client/v1/client.go index 72be9293..203b00c6 100644 --- a/pkg/client/v1/client.go +++ b/pkg/client/v1/client.go @@ -20,7 +20,7 @@ import ( "github.com/textileio/go-tableland/pkg/wallet" ) -var defaultChain = client.Chains[client.ChainIDs.PolygonMumbai] +var defaultChain = client.Chains[client.ChainIDs.EthereumSepolia] // Client is the Tableland client. type Client struct { From 0bcf87313e504587cc8cfaa3ca1e1f7b36093573 Mon Sep 17 00:00:00 2001 From: avichalp Date: Sat, 13 Apr 2024 00:03:28 +0800 Subject: [PATCH 16/17] Remove polygon mumbai from healthbot config Signed-off-by: avichalp --- docker/deployed/testnet/healthbot/config.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docker/deployed/testnet/healthbot/config.json b/docker/deployed/testnet/healthbot/config.json index 088f3a61..d7faaff1 100644 --- a/docker/deployed/testnet/healthbot/config.json +++ b/docker/deployed/testnet/healthbot/config.json @@ -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}", From 2790fbe219a8ca1dcdd1720a0e1fdbbf763730f7 Mon Sep 17 00:00:00 2001 From: avichalp Date: Tue, 16 Apr 2024 18:51:49 +0800 Subject: [PATCH 17/17] Add polygon amoy config Signed-off-by: avichalp --- .../testnet/api/.env_validator.example | 1 + docker/deployed/testnet/api/config.json | 19 +++++++++++++++++++ pkg/client/chains.go | 9 +++++++++ pkg/client/v1/client.go | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docker/deployed/testnet/api/.env_validator.example b/docker/deployed/testnet/api/.env_validator.example index a8b54cca..3db2d265 100644 --- a/docker/deployed/testnet/api/.env_validator.example +++ b/docker/deployed/testnet/api/.env_validator.example @@ -1,5 +1,6 @@ VALIDATOR_ALCHEMY_ETHEREUM_SEPOLIA_API_KEY= VALIDATOR_GLIF_FILECOIN_CALIBRATION_API_KEY= +VALIDATOR_ALCHEMY_POLYGON_AMOY_API_KEY= VALIDATOR_ALCHEMY_ARBITRUM_SEPOLIA_API_KEY= VALIDATOR_ALCHEMY_OPTIMISM_SEPOLIA_API_KEY= METRICS_HUB_API_KEY= diff --git a/docker/deployed/testnet/api/config.json b/docker/deployed/testnet/api/config.json index 2b23d75d..cde855dd 100644 --- a/docker/deployed/testnet/api/config.json +++ b/docker/deployed/testnet/api/config.json @@ -71,6 +71,25 @@ }, "HashCalculationStep": 150 }, + { + "Name": "Polygon Amoy", + "ChainID": 80002, + "Registry": { + "EthEndpoint": "wss://polygon-amoy.g.alchemy.com/v2/${VALIDATOR_ALCHEMY_POLYGON_AMOY_API_KEY}", + "ContractAddress": "0x170fb206132b693e38adFc8727dCfa303546Cec1" + }, + "EventFeed": { + "ChainAPIBackoff": "15s", + "NewBlockPollFreq": "5s", + "MinBlockDepth": 1, + "PersistEvents": true + }, + "EventProcessor": { + "BlockFailedExecutionBackoff": "10s", + "DedupExecutedTxns": true + }, + "HashCalculationStep": 360 + }, { "Name": "Arbitrum Sepolia", "ChainID": 421614, diff --git a/pkg/client/chains.go b/pkg/client/chains.go index c74ee2ac..4cf0abd7 100644 --- a/pkg/client/chains.go +++ b/pkg/client/chains.go @@ -25,6 +25,7 @@ var ChainIDs = struct { OptimismSepolia ChainID ArbitrumSepolia ChainID FilecoinCalibration ChainID + PolygonAmoy ChainID Local ChainID }{ Ethereum: 1, @@ -37,6 +38,7 @@ var ChainIDs = struct { OptimismSepolia: 11155420, ArbitrumSepolia: 421614, FilecoinCalibration: 314159, + PolygonAmoy: 80002, Local: 31337, } @@ -110,6 +112,12 @@ var Chains = map[ChainID]Chain{ Name: "Filecoin Calibration", ContractAddr: common.HexToAddress("0x030BCf3D50cad04c2e57391B12740982A9308621"), }, + ChainIDs.PolygonAmoy: { + Endpoint: testnetURL, + ID: ChainIDs.PolygonAmoy, + Name: "Polygon Amoy", + ContractAddr: common.HexToAddress("0x170fb206132b693e38adFc8727dCfa303546Cec1"), + }, ChainIDs.Local: { Endpoint: localURL, ID: ChainIDs.Local, @@ -134,6 +142,7 @@ var AlchemyURLs = map[ChainID]string{ ChainIDs.Optimism: "https://opt-mainnet.g.alchemy.com/v2/%s", ChainIDs.ArbitrumSepolia: "https://arb-sepolia.g.alchemy.com/v2/%s", ChainIDs.Arbitrum: "https://arb-mainnet.g.alchemy.com/v2/%s", + ChainIDs.PolygonAmoy: "https://polygon-amoy.g.alchemy.com/v2/%s", ChainIDs.Polygon: "https://polygon-mainnet.g.alchemy.com/v2/%s", } diff --git a/pkg/client/v1/client.go b/pkg/client/v1/client.go index 203b00c6..a63db319 100644 --- a/pkg/client/v1/client.go +++ b/pkg/client/v1/client.go @@ -20,7 +20,7 @@ import ( "github.com/textileio/go-tableland/pkg/wallet" ) -var defaultChain = client.Chains[client.ChainIDs.EthereumSepolia] +var defaultChain = client.Chains[client.ChainIDs.PolygonAmoy] // Client is the Tableland client. type Client struct {