Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

besu evmt8n daemon errors out on test data #5934

Closed
winsvega opened this issue Sep 25, 2023 · 15 comments · Fixed by #5960
Closed

besu evmt8n daemon errors out on test data #5934

winsvega opened this issue Sep 25, 2023 · 15 comments · Fixed by #5960
Assignees
Labels
bonsai mainnet TeamChupa GH issues worked on by Chupacabara Team testing

Comments

@winsvega
Copy link

winsvega commented Sep 25, 2023

out=$(curl -s --data-raw $req 'http://localhost:3000')

req

{"state":{"fork":"Berlin","reward":"0","chainid":"1"},"input":{"env":{"currentCoinbase":"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba","currentNumber":"0x01","currentTimestamp":"0x03e8","currentGasLimit":"0xff112233445566","previousHash":"0x7d46f90648e1c009b83cdec706549090f3676e92fb0ca3cb85de687b73148e13","parentTimestamp":"0x00","parentDifficulty":"0x020000","parentUncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","blockHashes":{"0":"0x7d46f90648e1c009b83cdec706549090f3676e92fb0ca3cb85de687b73148e13"}},"alloc":{"0x095e7baea6a6c7c4c2dfeb977efac326af552d87":{"balance":"0x0de0b6b3a7640000","code":"0x600160010160005500","nonce":"0x00","storage":{}},"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba":{"balance":"0x00","code":"0x","nonce":"0x01","storage":{}},"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b":{"balance":"0x0de0b6b3a7640000","code":"0x","nonce":"0x00","storage":{}}},"txs":"0xf865f863800a83061a8094095e7baea6a6c7c4c2dfeb977efac326af552d87830186a0801ba0ffb600e63115a7362e7811894a91d8ba4330e526f22121c994c4692035dfdfd5a06198379fcac8de3dbfac48b165df4bf88e2088f294b61efb9a65fe2281c76e16"}}

.retesteth/besu/setup.sh Besu daemon is listening on port 3000

out

{"error":"World State Root does not match expected value, header 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 calculated 0xcd39e0cdd18f8f811911222ae6779341663d0293e1a3d9501da7ac2f4da9b277","stacktrace":"java.lang.RuntimeException: World State Root does not match expected value, header 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 calculated 0xcd39e0cdd18f8f811911222ae6779341663d0293e1a3d9501da7ac2f4da9b277
	at org.hyperledger.besu.ethereum.bonsai.worldview.BonsaiWorldState.persist(BonsaiWorldState.java:398)
	at org.hyperledger.besu.evmtool.T8nExecutor.runTest(T8nExecutor.java:380)
	at org.hyperledger.besu.evmtool.T8nServerSubCommand.handleT8nRequest(T8nServerSubCommand.java:141)
	at org.hyperledger.besu.evmtool.T8nServerSubCommand.handle(T8nServerSubCommand.java:95)
	at org.hyperledger.besu.evmtool.T8nServerSubCommand.lambda$run$0(T8nServerSubCommand.java:78)
	at io.vertx.core.impl.future.FutureImpl$1.onSuccess(FutureImpl.java:91)
	at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
	at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:86)
	at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:163)
	at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:51)
	at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
	at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
	at io.vertx.core.http.impl.HttpEventHandler.handleEnd(HttpEventHandler.java:79)
	at io.vertx.core.http.impl.Http1xServerRequest.onEnd(Http1xServerRequest.java:581)
	at io.vertx.core.http.impl.Http1xServerRequest.handleEnd(Http1xServerRequest.java:564)
	at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:76)
	at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:153)
	at io.vertx.core.http.impl.Http1xServerConnection.onEnd(Http1xServerConnection.java:191)
	at io.vertx.core.http.impl.Http1xServerConnection.onContent(Http1xServerConnection.java:181)
	at io.vertx.core.http.impl.Http1xServerConnection.handleOther(Http1xServerConnection.java:161)
	at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:149)
	at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:157)
	at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
	at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:109)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)
"}
parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 56, column 1
parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 56, column 1

``
@shemnon
Copy link
Contributor

shemnon commented Sep 25, 2023

This is a regression on the part of Bonasi Tries. @matkt @garyschulte

@matkt
Copy link
Contributor

matkt commented Sep 25, 2023

Maybe we should check the Reference test? @garyschulte

@winsvega
Copy link
Author

It was working before.

It potentially broke 07.19
But could be at later point.

@garyschulte
Copy link
Contributor

garyschulte commented Sep 25, 2023

Previously we were using forest for reference tests and t8n, it might be that we are now seeing it because we are using bonsai for these tests. #5686

@non-fungible-nelson non-fungible-nelson added TeamGroot GH issues worked on by Groot Team TeamChupa GH issues worked on by Chupacabara Team labels Sep 25, 2023
@siladu
Copy link
Contributor

siladu commented Sep 26, 2023

Recreatable with

  1. besu/build/install/besu/bin/evmtool t8n-server
  2. curl -s http://localhost:3000 --data-raw '{"state":{"fork":"Berlin","reward":"0","chainid":"1"},"input":{"env":{"currentCoinbase":"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba","currentNumber":"0x01","currentTimestamp":"0x03e8","currentGasLimit":"0xff112233445566","previousHash":"0x7d46f90648e1c009b83cdec706549090f3676e92fb0ca3cb85de687b73148e13","parentTimestamp":"0x00","parentDifficulty":"0x020000","parentUncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","blockHashes":{"0":"0x7d46f90648e1c009b83cdec706549090f3676e92fb0ca3cb85de687b73148e13"}},"alloc":{"0x095e7baea6a6c7c4c2dfeb977efac326af552d87":{"balance":"0x0de0b6b3a7640000","code":"0x600160010160005500","nonce":"0x00","storage":{}},"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba":{"balance":"0x00","code":"0x","nonce":"0x01","storage":{}},"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b":{"balance":"0x0de0b6b3a7640000","code":"0x","nonce":"0x00","storage":{}}},"txs":"0xf865f863800a83061a8094095e7baea6a6c7c4c2dfeb977efac326af552d87830186a0801ba0ffb600e63115a7362e7811894a91d8ba4330e526f22121c994c4692035dfdfd5a06198379fcac8de3dbfac48b165df4bf88e2088f294b61efb9a65fe2281c76e16"}}'

@matkt
Copy link
Contributor

matkt commented Sep 26, 2023

This issue is related to the reference test PR and this thread https://github.com/hyperledger/besu/pull/5686/files#r1312452175. With the bonsai reference test PR, we need the currentStateRoot of the block we want to import. If we don't add it, the referenceTest part will push a default value (there is also an error here because we put HASH.EMPTY instead of Hash.EMPTY_TRIE_HASH 4b2ef68#diff-4a1474d043a039440241468b27b762a601d190bf160e3128d52affce27cf48c3R131).

So bonsai will expect to have an empty worldstate as final stateroot.

Hash.EMPTY == 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470

If I change the json by passing the currentStateRoot, the test works again.

{"state":{"fork":"Berlin","reward":"0","chainid":"1"},"input":{"env":{"currentCoinbase":"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba","currentNumber":"0x01","currentStateRoot": "0xcd39e0cdd18f8f811911222ae6779341663d0293e1a3d9501da7ac2f4da9b277", "currentTimestamp":"0x03e8","currentGasLimit":"0xff112233445566","previousHash":"0x7d46f90648e1c009b83cdec706549090f3676e92fb0ca3cb85de687b73148e13","parentTimestamp":"0x00","parentDifficulty":"0x020000","parentUncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","blockHashes":{"0":"0x7d46f90648e1c009b83cdec706549090f3676e92fb0ca3cb85de687b73148e13"}},"alloc":{"0x095e7baea6a6c7c4c2dfeb977efac326af552d87":{"balance":"0x0de0b6b3a7640000","code":"0x600160010160005500","nonce":"0x00","storage":{}},"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba":{"balance":"0x00","code":"0x","nonce":"0x01","storage":{}},"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b":{"balance":"0x0de0b6b3a7640000","code":"0x","nonce":"0x00","storage":{}}},"txs":"0xf865f863800a83061a8094095e7baea6a6c7c4c2dfeb977efac326af552d87830186a0801ba0ffb600e63115a7362e7811894a91d8ba4330e526f22121c994c4692035dfdfd5a06198379fcac8de3dbfac48b165df4bf88e2088f294b61efb9a65fe2281c76e16"}}

Is this something we need to change in order to be able to ignore the final stateroot during tests? @shemnon @winsvega

@winsvega
Copy link
Author

winsvega commented Sep 26, 2023

Hm, thats the thing I ask from t8n is to compute the current state root given the account list, txs and evm values.

@matkt
Copy link
Contributor

matkt commented Sep 26, 2023

Yes but in the JSON test there is nothing to validate the State Root obtained from what I see . Afterwards I think it doesn't cost much to remove the check but it seems strange not to give the expected result in the input of the test

@siladu siladu removed their assignment Sep 26, 2023
@siladu siladu removed the TeamGroot GH issues worked on by Groot Team label Sep 26, 2023
@winsvega
Copy link
Author

winsvega commented Sep 27, 2023

what about when we generate the test, I don't know the stateRoot, what should I provide?

@matkt
Copy link
Contributor

matkt commented Sep 27, 2023

Good point 👍 I will see to add a modification to manage this case

@garyschulte
Copy link
Contributor

@winsvega is there a simple way to differentiate between when t8n is being used to generate the test versus run the test so we can disable stateroot verification?

It might be more useful If we just provide a flag like --bonsai-disable-state-root-verification=<boolean> with default false.

@winsvega
Copy link
Author

Usually the state verification is done by test runner tools that use t8n for state transition.

Yes if you disable it by default, that will fit the t8n interface of other clients

@matkt
Copy link
Contributor

matkt commented Sep 27, 2023

It can also be that if we put nothing in the field the check is disabled

@garyschulte
Copy link
Contributor

It can also be that if we put nothing in the field the check is disabled

This behavior, and only in BonsaiReferenceTestWorldState seems to be the right fix.

@winsvega
Copy link
Author

winsvega commented Oct 3, 2023

still get this issue for t8n

.retesteth/besu/setup.sh WARNING: Besu daemon failed to start, will use besu evm t8n instead
/home/ubuntu/.retesteth/besu/start.sh --state.fork Berlin --state.reward 0 --state.chainid 1 --input.alloc /dev/shm/4a92005a-d5cb-4287-b4fe-2d286b62b0dc/alloc.json --input.txs /dev/shm/4a92005a-d5cb-4287-b4fe-2d286b62b0dc/txs.rlp --input.env /dev/shm/4a92005a-d5cb-4287-b4fe-2d286b62b0dc/env.json --output.basedir /dev/shm/4a92005a-d5cb-4287-b4fe-2d286b62b0dc --output.result out.json --output.alloc outAlloc.json --output.errorlog /dev/shm/4a92005a-d5cb-4287-b4fe-2d286b62b0dc/error.json

Res:

RAlloc:

Tool log: 
java.lang.RuntimeException: World State Root does not match expected value, header 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 calculated 0xcd39e0cdd18f8f811911222ae6779341663d0293e1a3d9501da7ac2f4da9b277
	at org.hyperledger.besu.ethereum.bonsai.worldview.BonsaiWorldState.verifyWorldStateRoot(BonsaiWorldState.java:435)
	at org.hyperledger.besu.ethereum.referencetests.BonsaiReferenceTestWorldState.verifyWorldStateRoot(BonsaiReferenceTestWorldState.java:91)
	at org.hyperledger.besu.ethereum.bonsai.worldview.BonsaiWorldState.persist(BonsaiWorldState.java:393)
	at org.hyperledger.besu.evmtool.T8nExecutor.runTest(T8nExecutor.java:380)
	at org.hyperledger.besu.evmtool.T8nSubCommand.run(T8nSubCommand.java:285)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at org.hyperledger.besu.evmtool.EvmToolCommand.execute(EvmToolCommand.java:271)
	at org.hyperledger.besu.evmtool.EvmToolCommand.execute(EvmToolCommand.java:237)
	at org.hyperledger.besu.evmtool.EvmTool.main(EvmTool.java:23)

Tests finished: 1
stExample time: 10.59, cputime: 0.02 (0%), t8ntime: 10.51 (99%)
Error: Tool returned empty file: /dev/shm/4a92005a-d5cb-4287-b4fe-2d286b62b0dc/out.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bonsai mainnet TeamChupa GH issues worked on by Chupacabara Team testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants