From d379d5df25c45e95eb6bd19b7baa48bf432ff564 Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Thu, 28 Mar 2024 21:21:21 +0000 Subject: [PATCH] solution: support Holesky and Sepolia out of box (#283) --- build.gradle | 3 ++- demo/quick-start/dshackle.yaml | 12 +++--------- docs/06-monitoring.adoc | 4 ++-- docs/reference-configuration.adoc | 2 +- proto/common.proto | 2 ++ src/main/kotlin/io/emeraldpay/dshackle/Global.kt | 4 ++++ .../emeraldpay/dshackle/upstream/ForkWatchFactory.kt | 2 +- .../upstream/calls/DefaultEthereumMethods.kt | 12 ++++++++++++ .../upstream/ethereum/EthereumMultistream.kt | 2 +- .../dshackle/config/MainConfigReaderSpec.groovy | 4 ++-- .../upstream/calls/DefaultEthereumMethodsSpec.groovy | 2 ++ src/test/resources/configs/dshackle-full.yaml | 4 ++-- 12 files changed, 34 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index f7d8f560e..60cd6f0a8 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,7 @@ repositories { maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } maven { url "https://maven.emrld.io" } + maven { url "https://maven-snapshots.emrld.io" } } configurations { @@ -105,7 +106,7 @@ dependencies { implementation "io.emeraldpay.etherjar:etherjar-contract:$etherjarVersion" implementation "io.emeraldpay.etherjar:etherjar-erc20:$etherjarVersion" - implementation "io.emeraldpay:emerald-api:0.12-alpha.7" + implementation "io.emeraldpay:emerald-api:0.13-SNAPSHOT" implementation "org.bitcoinj:bitcoinj-core:0.16.2" diff --git a/demo/quick-start/dshackle.yaml b/demo/quick-start/dshackle.yaml index 45136507d..035643855 100644 --- a/demo/quick-start/dshackle.yaml +++ b/demo/quick-start/dshackle.yaml @@ -13,15 +13,9 @@ cluster: url: "https://mainnet.infura.io/v3/${INFURA_USER}" ws: url: "wss://mainnet.infura.io/ws/v3/${INFURA_USER}" - - id: infura-kovan - chain: kovan + - id: infura-sepolia + chain: sepolia connection: ethereum: rpc: - url: "https://kovan.infura.io/v3/${INFURA_USER}" - - id: infura-goerli - chain: goerli - connection: - ethereum: - rpc: - url: "https://goerli.infura.io/v3/${INFURA_USER}" + url: "https://sepolia.infura.io/v3/${INFURA_USER}" diff --git a/docs/06-monitoring.adoc b/docs/06-monitoring.adoc index a2465c569..17018eac4 100644 --- a/docs/06-monitoring.adoc +++ b/docs/06-monitoring.adoc @@ -130,7 +130,7 @@ The log contains the JSON lines similar to: "id":"c23a5391-1b8c-40b0-a32f-fa736b8175a2", "success":true, "upstream":{ - "id":"goerli", + "id":"sepolia", "channel":"WSJSONRPC", "type":"JSONRPC" }, @@ -143,7 +143,7 @@ The log contains the JSON lines similar to: "method":"eth_getBlockByHash", "id":218 }, - "blockchain":"TESTNET_GOERLI", + "blockchain":"TESTNET_SEPOLIA", "execute":"2022-11-09T01:13:25.540592Z", "complete":"2022-11-09T01:13:25.652683Z", "responseSize":6243, diff --git a/docs/reference-configuration.adoc b/docs/reference-configuration.adoc index 881ab1121..d00bb7e4f 100644 --- a/docs/reference-configuration.adoc +++ b/docs/reference-configuration.adoc @@ -772,7 +772,7 @@ configuration, and may be omitted for most of the situations. | yes | Blockchain which is the provided by the upstream. Cluster may have multiple upstreams for a single blockchain. -Accepted types: `bitcoin`, `bitcoin-testnet`, `ethereum`, `ethereum-classic`, `kovan-testnet`, `rinkeby-testnet`, `ropsten-testnet`, or `goerli-testnet` +Accepted types: `bitcoin`, `bitcoin-testnet`, `ethereum`, `ethereum-classic`, or `sepolia-testnet` | `labels` diff --git a/proto/common.proto b/proto/common.proto index 2a848e761..00b696684 100644 --- a/proto/common.proto +++ b/proto/common.proto @@ -29,6 +29,8 @@ enum ChainRef { CHAIN_GOERLI = 10005; CHAIN_ROPSTEN = 10006; CHAIN_RINKEBY = 10007; + CHAIN_HOLESKY = 10008; + CHAIN_SEPOLIA = 10009; // Non-standard starts from 20_000 } diff --git a/src/main/kotlin/io/emeraldpay/dshackle/Global.kt b/src/main/kotlin/io/emeraldpay/dshackle/Global.kt index 5704c8805..37eb33738 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/Global.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/Global.kt @@ -56,6 +56,10 @@ class Global { "kovan-testnet" to Chain.TESTNET_KOVAN, "goerli" to Chain.TESTNET_GOERLI, "goerli-testnet" to Chain.TESTNET_GOERLI, + "holesky" to Chain.TESTNET_HOLESKY, + "holesky-testnet" to Chain.TESTNET_HOLESKY, + "sepolia" to Chain.TESTNET_SEPOLIA, + "sepolia-testnet" to Chain.TESTNET_SEPOLIA, "rinkeby" to Chain.TESTNET_RINKEBY, "rinkeby-testnet" to Chain.TESTNET_RINKEBY, "ropsten" to Chain.TESTNET_ROPSTEN, diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ForkWatchFactory.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ForkWatchFactory.kt index e6a90b07a..da2e005cf 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ForkWatchFactory.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ForkWatchFactory.kt @@ -39,7 +39,7 @@ class ForkWatchFactory( // at this moment (Aug 2022) it's still a PoW, but upgrade is coming in weeks, so it's better to configure everything in advance Chain.ETHEREUM, // those are upgraded to Merge - Chain.TESTNET_GOERLI, Chain.TESTNET_ROPSTEN + Chain.TESTNET_GOERLI, Chain.TESTNET_ROPSTEN, Chain.TESTNET_HOLESKY, Chain.TESTNET_SEPOLIA ) fun create(chain: Chain): ForkWatch { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt index fe63ff29c..e1cbb013e 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt @@ -143,6 +143,12 @@ class DefaultEthereumMethods( Chain.TESTNET_GOERLI == chain -> { "\"5\"" } + Chain.TESTNET_HOLESKY == chain -> { + "\"17000\"" + } + Chain.TESTNET_SEPOLIA == chain -> { + "\"11155111\"" + } else -> throw RpcException(-32602, "Invalid chain") } } @@ -172,6 +178,12 @@ class DefaultEthereumMethods( Chain.TESTNET_GOERLI == chain -> { "\"0x5\"" } + Chain.TESTNET_HOLESKY == chain -> { + "\"0x4268\"" + } + Chain.TESTNET_SEPOLIA == chain -> { + "\"0xaa36a7\"" + } else -> throw RpcException(-32602, "Invalid chain") } } diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumMultistream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumMultistream.kt index 124ca3e15..c6b311aa0 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumMultistream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumMultistream.kt @@ -68,7 +68,7 @@ open class EthereumMultistream( private var subscribe = EthereumEgressSubscription(this, NoPendingTxes()) private val supportsEIP1559 = when (chain) { - Chain.ETHEREUM, Chain.TESTNET_ROPSTEN, Chain.TESTNET_GOERLI, Chain.TESTNET_RINKEBY -> true + Chain.ETHEREUM, Chain.TESTNET_ROPSTEN, Chain.TESTNET_GOERLI, Chain.TESTNET_HOLESKY, Chain.TESTNET_SEPOLIA, Chain.TESTNET_RINKEBY -> true else -> false } diff --git a/src/test/groovy/io/emeraldpay/dshackle/config/MainConfigReaderSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/config/MainConfigReaderSpec.groovy index 11a359735..372883d1e 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/config/MainConfigReaderSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/config/MainConfigReaderSpec.groovy @@ -70,8 +70,8 @@ class MainConfigReaderSpec extends Specification { blockchain == Chain.TESTNET_GOERLI } with(routes[4]) { - id == "rinkeby" - blockchain == Chain.TESTNET_RINKEBY + id == "sepolia" + blockchain == Chain.TESTNET_SEPOLIA } } with(act.health) { diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy index c6313fce2..2742c3514 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy @@ -43,5 +43,7 @@ class DefaultEthereumMethodsSpec extends Specification { Chain.TESTNET_GOERLI | '"0x5"' Chain.TESTNET_RINKEBY | '"0x4"' Chain.TESTNET_ROPSTEN | '"0x3"' + Chain.TESTNET_SEPOLIA | '"0xaa36a7"' + Chain.TESTNET_HOLESKY | '"0x4268"' } } diff --git a/src/test/resources/configs/dshackle-full.yaml b/src/test/resources/configs/dshackle-full.yaml index a3a9ad8ab..349b6bb52 100644 --- a/src/test/resources/configs/dshackle-full.yaml +++ b/src/test/resources/configs/dshackle-full.yaml @@ -41,8 +41,8 @@ proxy: blockchain: kovan - id: goerli blockchain: goerli - - id: rinkeby - blockchain: rinkeby + - id: sepolia + blockchain: sepolia cluster: defaults: