Skip to content

Commit 4dba98b

Browse files
shemnongconnect
authored andcommitted
EVMTool Docker Support (besu-eth#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> Signed-off-by: gconnect <agatevureglory@gmail.com>
1 parent a9eef5a commit 4dba98b

File tree

7 files changed

+62
-3
lines changed

7 files changed

+62
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- In process RPC service [#7395](https://github.com/hyperledger/besu/pull/7395)
1818

1919
### Bug fixes
20+
- Correct entrypoint in Docker evmtool [#7430](https://github.com/hyperledger/besu/pull/7430)
2021

2122
## 24.7.1
2223

ethereum/evmtool/src/main/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ WORKDIR /opt/besu-evmtool
2424
COPY --chown=besu:besu besu-evmtool /opt/besu-evmtool/
2525

2626
ENV PATH="/opt/besu-evmtool/bin:${PATH}"
27-
ENTRYPOINT ["evm"]
27+
ENTRYPOINT ["evmtool"]
2828

2929
# Build-time metadata as defined at http://label-schema.org
3030
ARG BUILD_DATE

ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EvmTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public EvmTool() {}
2828
* @param args The command line arguments.
2929
*/
3030
public static void main(final String... args) {
31-
LogConfigurator.setLevel("", "DEBUG");
31+
LogConfigurator.setLevel("", "OFF");
3232
final EvmToolCommand evmToolCommand = new EvmToolCommand();
3333

3434
evmToolCommand.execute(args);

ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/EvmToolCommand.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.hyperledger.besu.evmtool;
1616

1717
import static java.nio.charset.StandardCharsets.UTF_8;
18+
import static org.hyperledger.besu.evm.code.EOFLayout.EOFContainerMode.INITCODE;
1819
import static picocli.CommandLine.ScopeType.INHERIT;
1920

2021
import org.hyperledger.besu.cli.config.NetworkName;
@@ -34,6 +35,7 @@
3435
import org.hyperledger.besu.evm.EVM;
3536
import org.hyperledger.besu.evm.EvmSpecVersion;
3637
import org.hyperledger.besu.evm.code.CodeInvalid;
38+
import org.hyperledger.besu.evm.code.CodeV1;
3739
import org.hyperledger.besu.evm.frame.MessageFrame;
3840
import org.hyperledger.besu.evm.log.LogsBloomFilter;
3941
import org.hyperledger.besu.evm.tracing.OperationTracer;
@@ -418,11 +420,21 @@ public void run() {
418420
if (codeBytes.isEmpty() && !createTransaction) {
419421
codeBytes = component.getWorldState().get(receiver).getCode();
420422
}
421-
Code code = evm.getCodeForCreation(codeBytes);
423+
Code code =
424+
createTransaction ? evm.getCodeForCreation(codeBytes) : evm.getCodeUncached(codeBytes);
422425
if (!code.isValid()) {
423426
out.println(((CodeInvalid) code).getInvalidReason());
424427
return;
428+
} else if (code.getEofVersion() == 1
429+
&& createTransaction
430+
!= INITCODE.equals(((CodeV1) code).getEofLayout().containerMode().get())) {
431+
out.println(
432+
createTransaction
433+
? "--create requires EOF in INITCODE mode"
434+
: "To evaluate INITCODE mode EOF code use the --create flag");
435+
return;
425436
}
437+
426438
final Stopwatch stopwatch = Stopwatch.createUnstarted();
427439
long lastTime = 0;
428440
do {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"cli": [
3+
"--notime",
4+
"--json",
5+
"--create",
6+
"--code",
7+
"ef00010100040200010001040000000080000000c0de471fe5",
8+
"--coinbase",
9+
"4444588443C3A91288C5002483449ABA1054192B",
10+
"--fork",
11+
"CancunEOF"
12+
],
13+
"stdin": "",
14+
"stdout": "EOF Code Invalid : STOP is only a valid opcode in containers used for runtime operations.\n"
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"cli": [
3+
"--notime",
4+
"--json",
5+
"--code",
6+
"ef00010100040200010001040000000080000000",
7+
"--coinbase",
8+
"4444588443C3A91288C5002483449ABA1054192B",
9+
"--fork",
10+
"CancunEOF"
11+
],
12+
"stdin": "",
13+
"stdout": [
14+
{"pc":0,"section":0,"op":0,"gas":"0x2540be400","gasCost":"0x0","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"},
15+
{"gasUser":"0x0","gasTotal":"0x0","output":"0x"}
16+
]
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"cli": [
3+
"--notime",
4+
"--json",
5+
"--code",
6+
"ef00010100040200010009030001001404000000008000035f355f5fa15f5fee00ef00010100040200010001040000000080000000",
7+
"--coinbase",
8+
"4444588443C3A91288C5002483449ABA1054192B",
9+
"--fork",
10+
"CancunEOF"
11+
],
12+
"stdin": "",
13+
"stdout": "To evaluate INITCODE mode EOF code use the --create flag\n"
14+
}

0 commit comments

Comments
 (0)