web3j-unit icon indicating copy to clipboard operation
web3j-unit copied to clipboard

java.lang.UnsupportedOperationException: eth_newFilter

Open r-peter opened this issue 10 months ago • 0 comments

I am using the below dependencies along with openjdk-21.0.6:

    <dependency>
        <groupId>org.web3j</groupId>
        <artifactId>core</artifactId>
        <version>4.14.0</version>
    </dependency>

    <dependency>
        <groupId>org.web3j</groupId>
        <artifactId>web3j-unit</artifactId>
        <version>4.13.0</version>
        <scope>test</scope>
    </dependency>

Is there an option to use web3j-unit in a test annotated with @EVMTest(type = NodeType.EMBEDDED) and consume events emitted from a Smart contract as a Flowable?

I noticed that we can consume events inside the static method as explained here: https://github.com/LFDT-web3j/web3j-unit/issues/54

However, when I try to consume the events as a Flowable inside my test class, I see the following Exception:

22:59:27.906 [main] INFO org.hyperledger.besu.ethereum.mainnet.ProtocolScheduleBuilder -- Protocol schedule created with milestones: [Petersburg:0, London:1] java.lang.UnsupportedOperationException: eth_newFilter at org.web3j.evm.EmbeddedWeb3jService.send(EmbeddedWeb3jService.kt:102) at org.web3j.evm.EmbeddedWeb3jService.send(EmbeddedWeb3jService.kt:57) at org.web3j.protocol.core.Request.send(Request.java:84) at org.web3j.protocol.core.filters.LogFilter.sendRequest(LogFilter.java:41) at org.web3j.protocol.core.filters.Filter.run(Filter.java:62) at org.web3j.protocol.rx.JsonRpc2_0Rx.run(JsonRpc2_0Rx.java:89) at org.web3j.protocol.rx.JsonRpc2_0Rx.lambda$ethLogFlowable$2(JsonRpc2_0Rx.java:79) at io.reactivex.internal.operators.flowable.FlowableCreate.subscribeActual(FlowableCreate.java:71) at io.reactivex.Flowable.subscribe(Flowable.java:14935) at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37) at io.reactivex.Flowable.subscribe(Flowable.java:14935) at io.reactivex.Flowable.subscribe(Flowable.java:14872) at io.reactivex.Flowable.subscribe(Flowable.java:14826) at org.web3j.model.SimpleStorageTest.testEventsFLowable(SimpleStorageTest.java:88)

r-peter avatar Apr 15 '25 03:04 r-peter