From 73e3a46f23d6633de7c7729d8275939684096a23 Mon Sep 17 00:00:00 2001 From: Vyacheslav Date: Wed, 16 Aug 2023 14:34:16 +0300 Subject: [PATCH] create default method group to easily disable all methods (#282) --- docs/04-upstream-config.adoc | 21 +++++++++++++++++++ .../upstream/calls/DefaultEthereumMethods.kt | 1 + 2 files changed, 22 insertions(+) diff --git a/docs/04-upstream-config.adoc b/docs/04-upstream-config.adoc index 54850a683..e27af5924 100644 --- a/docs/04-upstream-config.adoc +++ b/docs/04-upstream-config.adoc @@ -312,6 +312,27 @@ upstreams: Such configuration option allows executing method `trace_transaction` and also disables `eth_getBlockByNumber` on that particular upstream. If a client requests to execute method `trace_transaction` then it will be scheduled to that upstream (or any upstream with such method enabled). +There are also method groups to more easily manage methods in batches, currently there are several groups: + +- https://github.com/p2p-org/dshackle/blob/master/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt#L53[trace] +- https://github.com/p2p-org/dshackle/blob/master/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt#L65[debug] +- https://github.com/p2p-org/dshackle/blob/master/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt#L41[filter] +- default, all methods that are enabled by default +[source, yaml] +---- +upstreams: + - id: my-node + chain: ethereum + labels: + archive: true + method-groups: + enabled: + - trace + disabled: + - default +---- +This config allows you to ONLY enable trace methods and disable everything else. + NOTE: It's especially useful when used together with upstream labels.If an archive upstream has label `archive: true` it's possible to specify that the client wants to execute method `trace_transaction` only on an archive node(s), which has complete historical data for tracing. ==== eth_subscribe ethereum methods 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 8fbf2544b..acaafd8c6 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt @@ -344,6 +344,7 @@ class DefaultEthereumMethods( "filter" -> filterMethods "trace" -> traceMethods "debug" -> debugMethods + "default" -> getSupportedMethods() else -> emptyList() }.toSet()