Skip to content

Commit

Permalink
create default method group to easily disable all methods (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
Termina1 authored Aug 16, 2023
1 parent e0cce9a commit 73e3a46
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/04-upstream-config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ class DefaultEthereumMethods(
"filter" -> filterMethods
"trace" -> traceMethods
"debug" -> debugMethods
"default" -> getSupportedMethods()
else -> emptyList()
}.toSet()

Expand Down

0 comments on commit 73e3a46

Please sign in to comment.