tessera icon indicating copy to clipboard operation
tessera copied to clipboard

Tessera using the wrong address when config is set to port 0

Open Gabriel-Trintinalia opened this issue 2 years ago • 1 comments

Description

As a user, I want Tessera to use the correct port when I set the port to 0 in the config.

Steps to Reproduce (Bug)

  1. Set the p2p server address to http://localhost:0
  2. The server starts with a different port. It saves it correctly to a file if -XoutputServerURIPath is set.

Expected behavior: Tessera to use and propagate the correct server address.

Actual behavior:

However, tessera does not seem to use the correct port:

INFO c.q.t.q.i.RestPayloadPublisher - Publishing message to http://localhost:0/

2022-10-06 10:59:23.296 [pool-4-thread-1] DEBUG c.q.t.d.internal.DefaultNetworkStore - Fetching active nodes [ActiveNode{keys=[PublicKey[Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=]], uri=NodeUri{http://localhost:0/}, supportedVersions=[v1, v2, 2.1, 3.0, 4.0, 5.0]}]
2022-10-06 10:59:23.303 [pool-4-thread-1] DEBUG c.q.t.d.internal.DiscoveryHelperImpl - Built nodeinfo NodeInfo[url: http://localhost:0/ ,recipients: [Recipient{key=PublicKey[Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=], url='http://localhost:0/'}]]
2022-10-06 10:59:23.304 [pool-4-thread-1] DEBUG c.q.t.p.p.PartyInfoBroadcaster - Contacting following peers with PartyInfo: [Party{url=http://localhost:0/}]

Gabriel-Trintinalia avatar Oct 06 '22 00:10 Gabriel-Trintinalia

I believe that Tessera is creating the client from the config instead of the actual server:

public class RuntimeContextProvider {
...
    List<ServerConfig> servers = config.getServerConfigs();

    ServerConfig p2pServerContext =
        servers.stream()
            .filter(s -> s.getApp() == AppType.P2P)
            .findFirst()
            .orElseThrow(() -> new IllegalStateException("No P2P server configured"));

    Client p2pClient = RestClientFactory.create().buildFrom(p2pServerContext);
...
}

Gabriel-Trintinalia avatar Oct 06 '22 00:10 Gabriel-Trintinalia

Tessera needs java 17 now so this can't be tested locally until Besu has a java 17 docker image

macfarla avatar Nov 21 '22 23:11 macfarla