EVMTool Docker Support (#7430)

A few fixes that re-enable docker support for evm tool
* evmtool is the entrypoint
* turn off some noisy logging
* ensure EOF respects the create flag

Signed-off-by: Danno Ferrin <danno@numisight.com>
pull/7438/head
Danno Ferrin 4 months ago committed by GitHub
parent 7433c8c25a
commit a92fdbb44c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 2
      ethereum/evmtool/src/main/docker/Dockerfile
  3. 2
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EvmTool.java
  4. 14
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EvmToolCommand.java
  5. 15
      ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/create-eof-error.json
  6. 17
      ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/eof.json
  7. 14
      ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/trace/initcode-error.json

@ -17,6 +17,7 @@
- In process RPC service [#7395](https://github.com/hyperledger/besu/pull/7395)
### Bug fixes
- Correct entrypoint in Docker evmtool [#7430](https://github.com/hyperledger/besu/pull/7430)
## 24.7.1

@ -24,7 +24,7 @@ WORKDIR /opt/besu-evmtool
COPY --chown=besu:besu besu-evmtool /opt/besu-evmtool/
ENV PATH="/opt/besu-evmtool/bin:${PATH}"
ENTRYPOINT ["evm"]
ENTRYPOINT ["evmtool"]
# Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE

@ -28,7 +28,7 @@ public final class EvmTool {
* @param args The command line arguments.
*/
public static void main(final String... args) {
LogConfigurator.setLevel("", "DEBUG");
LogConfigurator.setLevel("", "OFF");
final EvmToolCommand evmToolCommand = new EvmToolCommand();
evmToolCommand.execute(args);

@ -15,6 +15,7 @@
package org.hyperledger.besu.evmtool;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hyperledger.besu.evm.code.EOFLayout.EOFContainerMode.INITCODE;
import static picocli.CommandLine.ScopeType.INHERIT;
import org.hyperledger.besu.cli.config.NetworkName;
@ -34,6 +35,7 @@ import org.hyperledger.besu.evm.Code;
import org.hyperledger.besu.evm.EVM;
import org.hyperledger.besu.evm.EvmSpecVersion;
import org.hyperledger.besu.evm.code.CodeInvalid;
import org.hyperledger.besu.evm.code.CodeV1;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.log.LogsBloomFilter;
import org.hyperledger.besu.evm.tracing.OperationTracer;
@ -418,11 +420,21 @@ public class EvmToolCommand implements Runnable {
if (codeBytes.isEmpty() && !createTransaction) {
codeBytes = component.getWorldState().get(receiver).getCode();
}
Code code = evm.getCodeForCreation(codeBytes);
Code code =
createTransaction ? evm.getCodeForCreation(codeBytes) : evm.getCodeUncached(codeBytes);
if (!code.isValid()) {
out.println(((CodeInvalid) code).getInvalidReason());
return;
} else if (code.getEofVersion() == 1
&& createTransaction
!= INITCODE.equals(((CodeV1) code).getEofLayout().containerMode().get())) {
out.println(
createTransaction
? "--create requires EOF in INITCODE mode"
: "To evaluate INITCODE mode EOF code use the --create flag");
return;
}
final Stopwatch stopwatch = Stopwatch.createUnstarted();
long lastTime = 0;
do {

@ -0,0 +1,15 @@
{
"cli": [
"--notime",
"--json",
"--create",
"--code",
"ef00010100040200010001040000000080000000c0de471fe5",
"--coinbase",
"4444588443C3A91288C5002483449ABA1054192B",
"--fork",
"CancunEOF"
],
"stdin": "",
"stdout": "EOF Code Invalid : STOP is only a valid opcode in containers used for runtime operations.\n"
}

@ -0,0 +1,17 @@
{
"cli": [
"--notime",
"--json",
"--code",
"ef00010100040200010001040000000080000000",
"--coinbase",
"4444588443C3A91288C5002483449ABA1054192B",
"--fork",
"CancunEOF"
],
"stdin": "",
"stdout": [
{"pc":0,"section":0,"op":0,"gas":"0x2540be400","gasCost":"0x0","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"},
{"gasUser":"0x0","gasTotal":"0x0","output":"0x"}
]
}

@ -0,0 +1,14 @@
{
"cli": [
"--notime",
"--json",
"--code",
"ef00010100040200010009030001001404000000008000035f355f5fa15f5fee00ef00010100040200010001040000000080000000",
"--coinbase",
"4444588443C3A91288C5002483449ABA1054192B",
"--fork",
"CancunEOF"
],
"stdin": "",
"stdout": "To evaluate INITCODE mode EOF code use the --create flag\n"
}
Loading…
Cancel
Save