diff --git a/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt b/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt index d8d02f95..3126254b 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeCall.kt @@ -258,9 +258,6 @@ open class NativeCall( if (method in listOf( "eth_getFilterChanges", "eth_uninstallFilter", - "shh_getFilterChanges", - "shh_uninstallFilter", - "shh_getMessages" ) ) GetFilterUpdatesDecorator() @@ -392,7 +389,6 @@ open class NativeCall( "eth_newFilter", "eth_newBlockFilter", "eth_newPendingTransactionFilter", - "shh_newFilter", ) } override fun processResult(result: QuorumRpcReader.Result): ByteArray { 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 10a8e4b4..b65053b4 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt @@ -92,13 +92,6 @@ class DefaultEthereumMethods( "eth_chainId" ) - private val bscFilterMethods = listOf( - "shh_newFilter", - "shh_uninstallFilter", - "shh_getFilterChanges", - "shh_getMessages", - ) - private val allowedMethods: List init { @@ -130,19 +123,14 @@ class DefaultEthereumMethods( } getChainSpecificMethods(chain).contains(method) -> { - if (bscFilterMethods.contains(method)) { - NotLaggingQuorum(1) - } else { - when (method) { - "eth_getBlockRange" -> NotLaggingQuorum(1) - "bor_getAuthor" -> NotLaggingQuorum(0) - "bor_getCurrentValidators" -> NotLaggingQuorum(0) - "bor_getCurrentProposer" -> NotLaggingQuorum(0) - "bor_getRootHash" -> NotLaggingQuorum(1) - "eth_getRootHash" -> NotLaggingQuorum(1) - "shh_hasIdentity" -> NotLaggingQuorum(1) - else -> AlwaysQuorum() - } + when (method) { + "eth_getBlockRange" -> NotLaggingQuorum(1) + "bor_getAuthor" -> NotLaggingQuorum(0) + "bor_getCurrentValidators" -> NotLaggingQuorum(0) + "bor_getCurrentProposer" -> NotLaggingQuorum(0) + "bor_getRootHash" -> NotLaggingQuorum(1) + "eth_getRootHash" -> NotLaggingQuorum(1) + else -> AlwaysQuorum() } } else -> AlwaysQuorum() @@ -163,20 +151,13 @@ class DefaultEthereumMethods( "bor_getSignersAtHash", "eth_getRootHash" ) - Chain.BSC -> bscFilterMethods + listOf( - "shh_post", - "shh_version", - "shh_newIdentity", - "shh_hasIdentity", - "shh_addToGroup", - ) else -> emptyList() } } private fun chainUnsupportedMethods(chain: Chain): Set { if (chain == Chain.OPTIMISM) { - return setOf("eth_getAccounts", "eth_sendTransaction") + return setOf("eth_getAccounts") } return emptySet() } 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 e58d3baf..2a321e88 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethodsSpec.groovy @@ -44,4 +44,29 @@ class DefaultEthereumMethodsSpec extends Specification { Chain.TESTNET_RINKEBY | '"0x4"' Chain.TESTNET_ROPSTEN | '"0x3"' } + + def "Optimism chain unsupported methods"() { + setup: + def methods = new DefaultEthereumMethods(Chain.OPTIMISM) + when: + def acc = methods.isAvailable("eth_getAccounts") + def trans = methods.isAvailable("eth_sendTransaction") + then: + !acc + !trans + } + + def "Has supported specific methods"() { + expect: + new DefaultEthereumMethods(chain).getSupportedMethods().containsAll(methods) + where: + chain | methods + Chain.POLYGON | ["bor_getAuthor", + "bor_getCurrentValidators", + "bor_getCurrentProposer", + "bor_getRootHash", + "bor_getSignersAtHash", + "eth_getRootHash"] + Chain.OPTIMISM | ["eth_getBlockRange", "rollup_gasPrices"] + } }