Closed Michi03 closed 2 years ago
Small side-note: If you're using docker-compose, passing 127.0.0.1:8545 as ETHEREUM_HOST won't work, so you'll have to pass the name of the container, instead. This also means that, you'll have to then change it inside the registry property file that's copied from the las2peer container.
Addendum: The issue is, as far as I can tell unrelated to Java 17 and the mentioned error related to the function "i5.las2peer.persistency.SharedStorage.fetchEnvelope(String, long)"
, since when using Java 14 the error isn't displayed but the service announcement fails, nevertheless.
Using the web-connector, seemingly the same error occurs, but a complete stack trace is thrown:
i5.las2peer.registry.exceptions.EthereumException: Failed to register service
at i5.las2peer.registry.ReadWriteRegistryClient.registerService(ReadWriteRegistryClient.java:318)
at i5.las2peer.p2p.EthereumNode.registerServiceName(EthereumNode.java:387)
at i5.las2peer.p2p.EthereumNode.registerServiceInBlockchain(EthereumNode.java:353)
at i5.las2peer.tools.PackageUploader.registerService(PackageUploader.java:198)
at i5.las2peer.tools.PackageUploader.uploadServicePackage(PackageUploader.java:183)
at i5.las2peer.tools.PackageUploader.uploadServicePackage(PackageUploader.java:142)
at i5.las2peer.connectors.webConnector.handler.ServicesHandler.handleServicePackageUpload(ServicesHandler.java:161)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:475)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:397)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)
at org.glassfish.jersey.jdkhttp.JdkHttpHandlerContainer.handle(JdkHttpHandlerContainer.java:135)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:95)
at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:98)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:728)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:95)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:695)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.util.concurrent.ExecutionException: org.web3j.protocol.exceptions.TransactionException: Transaction has failed with status: 0x0. Gas used: 46431. (not-enough gas?)
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at i5.las2peer.registry.ReadWriteRegistryClient.registerService(ReadWriteRegistryClient.java:316)
... 37 more
Caused by: org.web3j.protocol.exceptions.TransactionException: Transaction has failed with status: 0x0. Gas used: 46431. (not-enough gas?)
at org.web3j.tx.Contract.executeTransaction(Contract.java:372)
at org.web3j.tx.Contract.executeTransaction(Contract.java:345)
at org.web3j.tx.Contract.executeTransaction(Contract.java:339)
at org.web3j.tx.Contract.executeTransaction(Contract.java:334)
at org.web3j.tx.Contract.lambda$executeRemoteCallTransaction$3(Contract.java:399)
at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:42)
at org.web3j.utils.Async.lambda$run$1(Async.java:38)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
... 3 more
Ok, figured it out... So during the truffle migration, the following message is logged:
las2peer_1 | Replacing 'ServiceRegistry'
las2peer_1 | ---------------------------
las2peer_1 | > transaction hash: 0xb5792f745364bf7ae2bd7b540b725fa913a09ac4deae396bbf68301988ad8410
las2peer_1 | - Blocks: 0 Seconds: 0
las2peer_1 | > Blocks: 0 Seconds: 0
las2peer_1 | > contract address: 0xdD76D242AAe1C3251DaE4f90EB0021215e62AFc4
las2peer_1 | > account: 0xb5A66D27457Af8be2a09F17adD73c2ae46520e69
las2peer_1 | > balance: 71
las2peer_1 | > gas used: 2778195
las2peer_1 | > gas price: 20 gwei
las2peer_1 | > value sent: 0 ETH
las2peer_1 | > total cost: 0.0555639 ETH
The printed contract address (0xdD76D242AAe1C3251DaE4f90EB0021215e62AFc4) is thus written to the migration.log
file and this way ends up in the i5.las2peer.registry.data.RegistryConfiguration.properties
file (although the actual address of the Service Registry is still present in the property file as well, either the wrong or none of the two values for the serviceRegistryAddress
property is selected).
The problem is thus fixed by removing this additional (incorrect) address for the service registry stored in the etc/i5.las2peer.registry.data.RegistryConfiguration.properties
file before starting the node.
Summary - My local las2peer node seems to connect to the Ethereum blockchain, running locally inside a docker container, correctly, but is unable to announce the service I'm trying to deploy. The specific setup is described in more detail below, however it closely follows the setup described here. The only notable difference (I can think of) is that this step of hosting the network configuration is not performed, since only one node is started. After starting the node and web-connector, the service is deployed to the network properly but the blockchain announcement fails with the following error message:
Other transactions are executed correctly, it is e.g., possible to create OIDC agents and they are stored correctly in both the las2peer network and on the blockchain, so this seems to be a problem specifically with the service registry.
Bug Details - A detailed explanation of the issue, structured in subsections:
0x0
.startService('i5.las2peer.services.hyeYouTubeProxy.YouTubeProxy@0.1')
/app/las2peer/etc/i5.las2peer.registry.data.RegistryConfiguration.properties
to a local path../node_modules/.bin/truffle migrate 2>&1 | tee migration.log
ConsentRegistry > contract address:
into the the service's property filejava --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -cp "core/src/main/resources/:core/export/jars/*:restmapper/export/jars/*:webconnector/export/jars/*:core/lib/*:restmapper/lib/*:webconnector/lib/*" i5.las2peer.tools.L2pNodeLauncher --port 9080 --service-directory service --node-id-seed 1 --ethereum-mnemonic "differ employ cook sport clinic wedding melody column pave stuff oak price" startWebConnector "node=getNodeAsEthereumNode()" "registry=node.getRegistryClient()" "n=getNodeAsEthereumNode()" "r=n.getRegistryClient()" interactive
startService('i5.las2peer.services.hyeYouTubeProxy.YouTubeProxy@0.1')
(Optional) Fixed state - Upon startup, the las2peer node logs the following:
I am not sure, but maybe the shared storage error relates to this issue somehow. This error does not occur when starting the las2peer node from the docker image. However, since the docker image builds an older version, not supporting the version of my service built with Java 17, I can unfortunately not use this node without first downgrading my build (which is why I uncommented the command in the start script and use a local node outside docker, instead).
I could also imagine that my method of deploying the consent registry contracts might be faulty. However, running the truffle migration from inside my registry contracts directory fails with the following error message:
Therefore, I copy my scripts to the las2peer-registry-contracts repo and perform the truffle migration from there, which works.