hyperledger / besu

An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
https://www.hyperledger.org/projects/besu
Apache License 2.0
1.52k stars 840 forks source link

Error between besu and tessera for mutil tenancy #7425

Open YouHaveToDo opened 3 months ago

YouHaveToDo commented 3 months ago

Description

hello, I have a question!

When I send a FindPrivGroupId request through besu's API, a problem occurs while exchanging a response with tessera. The reason is that the type of PrivacyGroup created by Tessera is the "Resident" type, but the type of "Resident" does not exist in Besu's PrivacyGroup type. How can I solve the problem? Doesn’t multi-tenancy now support this?

Even if you obtain the GroupId by sending a request directly to Tessera, the IDs of the groups created in advance for the multi-tenancy function are 3 or 4 bytes, not 32 bytes. GroupId, required as a parameter for the API provided by Besu, requires 32 bytes. GroupId received directly from Tessera cannot be used as a parameter for other APIs in the future. I would appreciate it if you could introduce a solution.

I tried to force the 4 bytes to increase to 32 bytes, but I couldn't find the group in Tessera with that ID.

Steps to Reproduce (Bug)

  1. set tessera multi tenancy env (multi tenancy property & regident privacy group before besu and tessera start and ....)
  2. request getPrivacyGroup to besu netwrok
  3. code to call the method
public List<PrivacyGroup> findPrivacyGroup(String[] addresses, String institution) throws Exception {
        List<Base64String> members = new ArrayList<>();
        for (String address : addresses) {
            members.add(Base64String.wrap(address));
        }

        // getBesu(institution) is a method to get Besu instance
        PrivFindPrivacyGroup groups = getBesu(institution).privFindPrivacyGroup(members)
            .send();

        if (groups.hasError()) {
            log.error("find privacy group fail : " + groups.getError().getMessage());
            throw new Exception("find privacy group fail : " + groups.getError().getMessage());
        }

        if (groups.getGroups().isEmpty()) {
            return new ArrayList<>();
        } else {
            return groups.getGroups();
        }
    }

Logs (if a bug)

2024-07-26 10:37:32 2024-07-26 01:37:32.816+00:00 | vert.x-worker-thread-6 | ERROR | PrivFindPrivacyGroup | Failed to fetch privacy group
2024-07-26 10:37:32 org.hyperledger.besu.enclave.EnclaveIOException: Enclave Communication Failed
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.VertxRequestTransmitter.sendRequest(VertxRequestTransmitter.java:138)
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.VertxRequestTransmitter.post(VertxRequestTransmitter.java:52)
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.Enclave.post(Enclave.java:218)
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.Enclave.findPrivacyGroup(Enclave.java:184)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.privacy.RestrictedDefaultPrivacyController.findPrivacyGroupByMembers(RestrictedDefaultPrivacyController.java:106)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.privacy.MultiTenancyPrivacyController.findPrivacyGroupByMembers(MultiTenancyPrivacyController.java:84)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv.PrivFindPrivacyGroup.response(PrivFindPrivacyGroup.java:66)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.MultiTenancyRpcMethodDecorator.response(MultiTenancyRpcMethodDecorator.java:54)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.jsonrpc.execution.BaseJsonRpcProcessor.process(BaseJsonRpcProcessor.java:44)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.jsonrpc.execution.TracedJsonRpcProcessor.process(TracedJsonRpcProcessor.java:41)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.jsonrpc.execution.TimedJsonRpcProcessor.process(TimedJsonRpcProcessor.java:45)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.jsonrpc.execution.AuthenticatedJsonRpcProcessor.process(AuthenticatedJsonRpcProcessor.java:51)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.jsonrpc.execution.JsonRpcExecutor.execute(JsonRpcExecutor.java:92)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.handlers.AbstractJsonRpcExecutor.executeRequest(AbstractJsonRpcExecutor.java:87)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.handlers.JsonRpcObjectExecutor.execute(JsonRpcObjectExecutor.java:57)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.handlers.JsonRpcExecutorHandler.lambda$handler$0(JsonRpcExecutorHandler.java:57)
2024-07-26 10:37:32     at java.base/java.util.Optional.ifPresentOrElse(Optional.java:196)
2024-07-26 10:37:32     at org.hyperledger.besu.ethereum.api.handlers.JsonRpcExecutorHandler.lambda$handler$2(JsonRpcExecutorHandler.java:54)
2024-07-26 10:37:32     at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
2024-07-26 10:37:32     at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
2024-07-26 10:37:32     at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
2024-07-26 10:37:32     at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
2024-07-26 10:37:32     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
2024-07-26 10:37:32     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
2024-07-26 10:37:32     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2024-07-26 10:37:32     at java.base/java.lang.Thread.run(Thread.java:840)
2024-07-26 10:37:32 Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unhandled response type.
2024-07-26 10:37:32     at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
2024-07-26 10:37:32     at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.VertxRequestTransmitter.sendRequest(VertxRequestTransmitter.java:131)
2024-07-26 10:37:32     ... 25 more
2024-07-26 10:37:32 Caused by: java.lang.RuntimeException: Unhandled response type.
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.Enclave.processTesseraError(Enclave.java:260)
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.Enclave.parseResponse(Enclave.java:244)
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.Enclave.handleJsonResponse(Enclave.java:225)
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.Enclave.lambda$findPrivacyGroup$6(Enclave.java:188)
2024-07-26 10:37:32     at org.hyperledger.besu.enclave.VertxRequestTransmitter.lambda$handleResponse$3(VertxRequestTransmitter.java:150)
2024-07-26 10:37:32     at io.vertx.core.impl.future.FutureImpl$1.onSuccess(FutureImpl.java:91)
2024-07-26 10:37:32     at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
2024-07-26 10:37:32     at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:86)
2024-07-26 10:37:32     at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:163)
2024-07-26 10:37:32     at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:51)
2024-07-26 10:37:32     at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
2024-07-26 10:37:32     at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
2024-07-26 10:37:32     at io.vertx.core.http.impl.HttpEventHandler.handleEnd(HttpEventHandler.java:79)
2024-07-26 10:37:32     at io.vertx.core.http.impl.HttpClientResponseImpl.handleEnd(HttpClientResponseImpl.java:250)
2024-07-26 10:37:32     at io.vertx.core.http.impl.Http1xClientConnection$StreamImpl.lambda$new$0(Http1xClientConnection.java:398)
2024-07-26 10:37:32     at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:239)
2024-07-26 10:37:32     at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:129)
2024-07-26 10:37:32     at io.vertx.core.http.impl.Http1xClientConnection$StreamImpl.handleEnd(Http1xClientConnection.java:645)
2024-07-26 10:37:32     at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:76)
2024-07-26 10:37:32     at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:153)
2024-07-26 10:37:32     at io.vertx.core.http.impl.Http1xClientConnection.handleResponseEnd(Http1xClientConnection.java:879)
2024-07-26 10:37:32     at io.vertx.core.http.impl.Http1xClientConnection.handleHttpMessage(Http1xClientConnection.java:751)
2024-07-26 10:37:32     at io.vertx.core.http.impl.Http1xClientConnection.handleMessage(Http1xClientConnection.java:715)
2024-07-26 10:37:32     at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:157)
2024-07-26 10:37:32     at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153)
2024-07-26 10:37:32     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
2024-07-26 10:37:32     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
2024-07-26 10:37:32     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
2024-07-26 10:37:32     at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
2024-07-26 10:37:32     at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
2024-07-26 10:37:32     at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
2024-07-26 10:37:32     at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
2024-07-26 10:37:32     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
2024-07-26 10:37:32     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
2024-07-26 10:37:32     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
2024-07-26 10:37:32     at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
2024-07-26 10:37:32     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
2024-07-26 10:37:32     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
2024-07-26 10:37:32     at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
2024-07-26 10:37:32     at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)
2024-07-26 10:37:32     at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509)
2024-07-26 10:37:32     at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)
2024-07-26 10:37:32     at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
2024-07-26 10:37:32     at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2024-07-26 10:37:32     ... 2 more

Versions (Add all that apply)

Additional Information (Add any of the following or anything else that may be relevant)

스크린샷 2024-07-29 오후 6 23 13 스크린샷 2024-07-29 오후 6 23 16 discord issue link

jframe commented 3 months ago

@NickSneo @gtebrean Any thoughts on this?