ethereum call selector and passthrough interaction: keep same upstream matcher
This commit is contained in:
@@ -80,12 +80,10 @@ open class NativeCall(
|
||||
|
||||
@EventListener
|
||||
fun onUpstreamChangeEvent(event: UpstreamChangeEvent) {
|
||||
if (!passthrough) {
|
||||
casting[BlockchainType.from(event.chain)]?.let { cast ->
|
||||
multistreamHolder.getUpstream(event.chain).let { up ->
|
||||
val reader = up.cast(cast).getReader()
|
||||
ethereumCallSelectors.putIfAbsent(event.chain, EthereumCallSelector(reader.heightByHash()))
|
||||
}
|
||||
casting[BlockchainType.from(event.chain)]?.let { cast ->
|
||||
multistreamHolder.getUpstream(event.chain).let { up ->
|
||||
val reader = up.cast(cast).getReader()
|
||||
ethereumCallSelectors.putIfAbsent(event.chain, EthereumCallSelector(reader.heightByHash()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,7 +225,7 @@ open class NativeCall(
|
||||
// for ethereum the actual block needed for the call may be specified in the call parameters
|
||||
val callSpecificMatcher: Mono<Selector.Matcher> =
|
||||
if (BlockchainType.from(upstream.chain) == BlockchainType.EVM_POS || BlockchainType.from(upstream.chain) == BlockchainType.EVM_POW) {
|
||||
ethereumCallSelectors[chain]?.getMatcher(method, params, upstream.getHead())
|
||||
ethereumCallSelectors[chain]?.getMatcher(method, params, upstream.getHead(), passthrough)
|
||||
} else {
|
||||
null
|
||||
} ?: Mono.empty()
|
||||
|
||||
@@ -53,10 +53,10 @@ class EthereumCallSelector(
|
||||
* @param method JSON RPC name
|
||||
* @param params JSON-encoded list of parameters for the method
|
||||
*/
|
||||
fun getMatcher(method: String, params: String, head: Head): Mono<Selector.Matcher> {
|
||||
if (Collections.binarySearch(TAG_METHODS, method) >= 0) {
|
||||
fun getMatcher(method: String, params: String, head: Head, passthrough: Boolean): Mono<Selector.Matcher> {
|
||||
if (!passthrough && Collections.binarySearch(TAG_METHODS, method) >= 0) {
|
||||
return blockTagSelector(params, 1, head)
|
||||
} else if (method == "eth_getStorageAt") {
|
||||
} else if (!passthrough && method == "eth_getStorageAt") {
|
||||
return blockTagSelector(params, 2, head)
|
||||
} else if (method in DefaultEthereumMethods.withFilterIdMethods) {
|
||||
return sameUpstreamMatcher(params)
|
||||
|
||||
Reference in New Issue
Block a user