Integrate drpc-logs-oracle (#1096) (#335)

* add oracle jar to build (#1096)
* add oracle config (#1096)
* add eth_getLogsEstimate (#1096)
* add scheduler for oracle (#1096)
* fix tests :[ (#1096)
This commit is contained in:
Nikolay G
2023-11-22 13:45:00 +01:00
committed by GitHub
parent a7f74bb71a
commit 5a154ac817
33 changed files with 369 additions and 73 deletions

View File

@@ -398,7 +398,7 @@ class NativeCallSpec extends Specification {
def "Prepare call adds height selector for not-lagging quorum"() {
setup:
def methods = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
["foo_bar"] as Set, [] as Set, [] as Set, [] as Set
)
methods.setQuorum("foo_bar", "not_lagging")
@@ -439,7 +439,7 @@ class NativeCallSpec extends Specification {
def "Prepare call adds decorator for eth_newFilter"() {
setup:
def methods = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
["eth_newFilter"] as Set, [] as Set, [] as Set, [] as Set
)
methods.setQuorum("eth_newFilter", "always")
@@ -470,7 +470,7 @@ class NativeCallSpec extends Specification {
def "Prepare call adds decorator for eth_getFilterChanges"() {
setup:
def methods = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
["eth_getFilterChanges"] as Set, [] as Set, [] as Set, [] as Set
)
def multistream = new MultistreamHolderMock.EthereumMultistreamMock(Chain.ETHEREUM__MAINNET, TestingCommons.upstream())
@@ -500,7 +500,7 @@ class NativeCallSpec extends Specification {
def "Prepare call adds decorator for eth_uninstallFilter"() {
setup:
def methods = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
["eth_uninstallFilter"] as Set, [] as Set, [] as Set, [] as Set
)
def multistream = new MultistreamHolderMock.EthereumMultistreamMock(Chain.ETHEREUM__MAINNET, TestingCommons.upstream())
@@ -600,7 +600,7 @@ class NativeCallSpec extends Specification {
}
def quorum = new AlwaysQuorum()
def methods = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
[] as Set, [] as Set, ["filter"] as Set, [] as Set
)
def multistream = new MultistreamHolderMock.EthereumMultistreamMock(Chain.ETHEREUM__MAINNET, new ArrayList<GenericUpstream>())
@@ -636,7 +636,7 @@ class NativeCallSpec extends Specification {
}
def quorum = new AlwaysQuorum()
def methods = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
[] as Set, [] as Set, ["filter"] as Set, [] as Set
)
def multistream = new MultistreamHolderMock.EthereumMultistreamMock(Chain.ETHEREUM__MAINNET, new ArrayList<GenericUpstream>())

View File

@@ -36,7 +36,7 @@ class GenericUpstreamMock extends GenericUpstream {
static CallMethods allMethods() {
new AggregatedCallMethods([
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
new DefaultBitcoinMethods(),
new DirectCallMethods(["eth_test"])
])

View File

@@ -51,7 +51,8 @@ class MultistreamHolderMock implements MultistreamHolder {
Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(TestingCommons.tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
io.emeraldpay.dshackle.upstream.starknet.StarknetChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic())
io.emeraldpay.dshackle.upstream.starknet.StarknetChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()),
null, Schedulers.immediate()
)
upstreams[chain].addUpstream(up)
} else {
@@ -104,7 +105,7 @@ class MultistreamHolderMock implements MultistreamHolder {
super(chain, Schedulers.immediate(), null, upstreams, caches, Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(new BraveTracer(null, null, null)),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()), null, Schedulers.immediate())
}
EthereumMultistreamMock(@NotNull Chain chain, @NotNull List<GenericUpstream> upstreams) {

View File

@@ -98,6 +98,8 @@ class TestingCommons {
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()),
null,
Schedulers.immediate()
).tap {
it.processUpstreamsEvents(
new UpstreamChangeEvent(Chain.ETHEREUM__MAINNET, up, UpstreamChangeEvent.ChangeType.ADDED)
@@ -124,14 +126,18 @@ class TestingCommons {
return new GenericMultistream(chain, Schedulers.immediate(), null, [], emptyCaches().getCaches(chain), Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()),
null,
Schedulers.immediate())
}
static Multistream multistreamClassicWithoutUpstreams(Chain chain) {
return new GenericMultistream(chain, Schedulers.immediate(), null, [], emptyCaches().getCaches(chain), Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()),
null,
Schedulers.immediate())
}
static FileResolver fileResolver() {

View File

@@ -39,7 +39,7 @@ import static java.util.List.of
class FilteredApisSpec extends Specification {
def ethereumTargets = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def ethereumTargets = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
def "Verifies labels"() {
setup:

View File

@@ -59,7 +59,7 @@ class MultistreamSpec extends Specification {
Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(TestingCommons.tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()), null, Schedulers.immediate())
when:
aggr.onUpstreamsUpdated()
def act = aggr.getMethods()
@@ -194,7 +194,7 @@ class MultistreamSpec extends Specification {
Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(TestingCommons.tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()), null, Schedulers.immediate())
expect:
multistream.getHead(new Selector.LabelMatcher("provider", ["internal"])).is(up1.ethereumHeadMock)
@@ -267,7 +267,7 @@ class MultistreamSpec extends Specification {
Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(TestingCommons.tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()), null, Schedulers.immediate())
when:
ms.processUpstreamsEvents(
new UpstreamChangeEvent(Chain.ETHEREUM__MAINNET, up1, UpstreamChangeEvent.ChangeType.ADDED)
@@ -298,7 +298,7 @@ class MultistreamSpec extends Specification {
Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(TestingCommons.tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()), null, Schedulers.immediate())
def head1 = createBlock(250, "0x0d050c785de17179f935b9b93aca09c442964cc59972c71ae68e74731448401b")
def head2 = createBlock(270, "0x0d050c785de17179f935b9b93aca09c442964cc59972c71ae68e74731448402b")
def head3 = createBlock(100, "0x0d050c785de17179f935b9b93aca09c442964cc59972c71ae68e74731448412b")
@@ -333,7 +333,7 @@ class MultistreamSpec extends Specification {
Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(TestingCommons.tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
EthereumChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()), null, Schedulers.immediate())
multistream.processUpstreamsEvents(
new UpstreamChangeEvent(Chain.ETHEREUM__MAINNET, up1, UpstreamChangeEvent.ChangeType.ADDED)
)
@@ -371,7 +371,7 @@ class MultistreamSpec extends Specification {
Schedulers.boundedElastic(),
EthereumChainSpecific.INSTANCE.makeCachingReaderBuilder(TestingCommons.tracerMock()),
EthereumChainSpecific.INSTANCE.&localReaderBuilder,
StarknetChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()))
StarknetChainSpecific.INSTANCE.subscriptionBuilder(Schedulers.boundedElastic()), null, Schedulers.immediate())
}
@NotNull

View File

@@ -7,7 +7,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "eth_chainId is available"() {
setup:
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
when:
def act = methods.isAvailable("eth_chainId")
then:
@@ -16,7 +16,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "eth_chainId is hardcoded"() {
setup:
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
when:
def act = methods.isHardcoded("eth_chainId")
then:
@@ -25,7 +25,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "eth_chainId is not callable"() {
setup:
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
when:
def act = methods.isCallable("eth_chainId")
then:
@@ -34,7 +34,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "Provides hardcoded correct chainId"() {
expect:
new String(new DefaultEthereumMethods(chain).executeHardcoded("eth_chainId")) == id
new String(new DefaultEthereumMethods(chain, false).executeHardcoded("eth_chainId")) == id
where:
chain | id
Chain.ETHEREUM__MAINNET | '"0x1"'
@@ -44,7 +44,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "Optimism chain unsupported methods"() {
setup:
def methods = new DefaultEthereumMethods(Chain.OPTIMISM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.OPTIMISM__MAINNET, false)
when:
def acc = methods.isAvailable("eth_getAccounts")
def trans = methods.isAvailable("eth_sendTransaction")
@@ -55,7 +55,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "Has supported specific methods"() {
expect:
new DefaultEthereumMethods(chain).getSupportedMethods().containsAll(methods)
new DefaultEthereumMethods(chain, false).getSupportedMethods().containsAll(methods)
where:
chain | methods
Chain.POLYGON__MAINNET | ["bor_getAuthor",
@@ -69,7 +69,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "Has no filter methods by default"() {
setup:
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
when:
def act = methods.getSupportedMethods().findAll { it.containsIgnoreCase("filter") }
then:
@@ -78,7 +78,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "Has no trace methods by default"() {
setup:
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
when:
def act = methods.getSupportedMethods().findAll { it.containsIgnoreCase("trace") }
then:
@@ -87,7 +87,7 @@ class DefaultEthereumMethodsSpec extends Specification {
def "Default eth methods are available"() {
setup:
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
expect:
methods.isAvailable(method)
where:

View File

@@ -94,7 +94,7 @@ class ManagedCallMethodsSpec extends Specification {
def "Use custom quorum if provided"() {
setup:
def managed = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
["eth_test", "eth_foo", "eth_bar"] as Set,
[] as Set,
[] as Set,
@@ -120,7 +120,7 @@ class ManagedCallMethodsSpec extends Specification {
def "Doesn't reuse same instance"() {
def managed = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
["eth_test"] as Set,
[] as Set,
[] as Set,
@@ -145,7 +145,7 @@ class ManagedCallMethodsSpec extends Specification {
def "Test enable method group"() {
setup:
def managed = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
[] as Set,
[] as Set,
["filter"] as Set,
@@ -169,7 +169,7 @@ class ManagedCallMethodsSpec extends Specification {
def "Test enable method group minus one"() {
setup:
def managed = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
[] as Set,
["eth_newPendingTransactionFilter"] as Set,
["filter"] as Set,
@@ -193,7 +193,7 @@ class ManagedCallMethodsSpec extends Specification {
def "Test disabled group not disable enabled method"() {
setup:
def managed = new ManagedCallMethods(
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET),
new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false),
["eth_newPendingTransactionFilter"] as Set,
[] as Set,
[] as Set,

View File

@@ -43,7 +43,7 @@ class EthereumDirectReaderSpec extends Specification {
transactions = []
}
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
Stub(Multistream), Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()
@@ -70,7 +70,7 @@ class EthereumDirectReaderSpec extends Specification {
def "Produce empty result on non-existing block"() {
setup:
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
Stub(Multistream), Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()
@@ -103,7 +103,7 @@ class EthereumDirectReaderSpec extends Specification {
transactions = []
}
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
Stub(Multistream), Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()
@@ -136,7 +136,7 @@ class EthereumDirectReaderSpec extends Specification {
blockHash = BlockHash.from(hash1)
}
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
Stub(Multistream), Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()
@@ -169,7 +169,7 @@ class EthereumDirectReaderSpec extends Specification {
blockHash = BlockHash.from(hash1)
}
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
Stub(Multistream), Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()
@@ -199,7 +199,7 @@ class EthereumDirectReaderSpec extends Specification {
blockHash = BlockHash.from(hash1)
}
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
def caches = Mock(Caches) {
// note that the Caches needs a Height value, otherwise it's not cached
@@ -228,7 +228,7 @@ class EthereumDirectReaderSpec extends Specification {
def "Produce empty on non-existing tx"() {
setup:
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
Stub(Multistream), Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()
@@ -258,7 +258,7 @@ class EthereumDirectReaderSpec extends Specification {
}
}
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
up, Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()
@@ -289,7 +289,7 @@ class EthereumDirectReaderSpec extends Specification {
}
}
def calls = Mock(Factory) {
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
1 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
up, Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()
@@ -323,7 +323,7 @@ class EthereumDirectReaderSpec extends Specification {
transactions = []
}
def calls = Mock(Factory) {
3 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
3 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
def result = Mono.just(
new RpcReader.Result(
@@ -363,7 +363,7 @@ class EthereumDirectReaderSpec extends Specification {
transactions = []
}
def calls = Mock(Factory) {
3 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
3 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
def result = Mono.just(
new RpcReader.Result(
@@ -400,7 +400,7 @@ class EthereumDirectReaderSpec extends Specification {
}
}
def calls = Mock(Factory) {
4 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
4 * create() >> new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
}
EthereumDirectReader reader = new EthereumDirectReader(
up, Caches.default(), new CurrentBlockCache(), calls, TestingCommons.tracerMock()

View File

@@ -21,16 +21,17 @@ class EthereumLocalReaderSpec extends Specification {
def "Calls hardcoded"() {
setup:
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
def router = new EthereumLocalReader(
new EthereumCachingReader(
TestingCommons.multistream(TestingCommons.api()),
Caches.default(),
ConstantFactory.constantFactory(new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)),
ConstantFactory.constantFactory(new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)),
TestingCommons.tracerMock()
),
methods,
new EmptyHead()
new EmptyHead(),
null
)
when:
def act = router.read(new JsonRpcRequest("eth_coinbase", [])).block(Duration.ofSeconds(1))
@@ -40,16 +41,17 @@ class EthereumLocalReaderSpec extends Specification {
def "Returns empty if nonce set"() {
setup:
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
def router = new EthereumLocalReader(
new EthereumCachingReader(
TestingCommons.multistream(TestingCommons.api()),
Caches.default(),
ConstantFactory.constantFactory(new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)),
ConstantFactory.constantFactory(new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)),
TestingCommons.tracerMock()
),
methods,
new EmptyHead()
new EmptyHead(),
null
)
when:
def act = router.read(new JsonRpcRequest("eth_getTransactionByHash", ["test"], 10))
@@ -72,8 +74,8 @@ class EthereumLocalReaderSpec extends Specification {
)
}
}
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def router = new EthereumLocalReader(reader, methods, head)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
def router = new EthereumLocalReader(reader, methods, head, null)
when:
def act = router.getBlockByNumber(["latest", false])
@@ -100,8 +102,8 @@ class EthereumLocalReaderSpec extends Specification {
)
}
}
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def router = new EthereumLocalReader(reader, methods, head)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
def router = new EthereumLocalReader(reader, methods, head, null)
when:
def act = router.getBlockByNumber(["earliest", false])
@@ -128,8 +130,8 @@ class EthereumLocalReaderSpec extends Specification {
)
}
}
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def router = new EthereumLocalReader(reader, methods, head)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
def router = new EthereumLocalReader(reader, methods, head, null)
when:
def act = router.getBlockByNumber(["0x123ef", false])
@@ -152,8 +154,8 @@ class EthereumLocalReaderSpec extends Specification {
_ * txByHashAsCont() >> new EmptyReader<>()
_ * blocksByHeightAsCont() >> new EmptyReader<>()
}
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
def router = new EthereumLocalReader(reader, methods, head)
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
def router = new EthereumLocalReader(reader, methods, head, null)
when:
def act = router.getBlockByNumber(["0x0", true])

View File

@@ -179,6 +179,8 @@ class ReloadConfigTest {
cs.makeCachingReaderBuilder(mock<Tracer>()),
cs::localReaderBuilder,
cs.subscriptionBuilder(Schedulers.boundedElastic()),
null,
Schedulers.fromExecutor(Executors.newFixedThreadPool(6)),
)
}