fix specific methods
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -92,13 +92,6 @@ class DefaultEthereumMethods(
|
||||
"eth_chainId"
|
||||
)
|
||||
|
||||
private val bscFilterMethods = listOf(
|
||||
"shh_newFilter",
|
||||
"shh_uninstallFilter",
|
||||
"shh_getFilterChanges",
|
||||
"shh_getMessages",
|
||||
)
|
||||
|
||||
private val allowedMethods: List<String>
|
||||
|
||||
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<String> {
|
||||
if (chain == Chain.OPTIMISM) {
|
||||
return setOf("eth_getAccounts", "eth_sendTransaction")
|
||||
return setOf("eth_getAccounts")
|
||||
}
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user