Skip to content

Commit

Permalink
Make EvmTool CLI to the main distribution (#1465)
Browse files Browse the repository at this point in the history
This adds EvmTool to the standard distributions.

In addition, add a property flag that disables the secpk256k1
auto-randomization for just the EvmTool to speed up invocation.
(fixes #1464)

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
  • Loading branch information
shemnon committed Oct 19, 2020
1 parent 112e753 commit 15d1789
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Changelog

## 20.10.1

### Additions and Improvements
* `--random-peer-priority-enabled` flag added. Allows for incoming connections to be prioritized randomly. This will prevent (typically small, stable) networks from forming impenetrable peer cliques. [#1440](https://github.com/hyperledger/besu/pull/1440)
* Hide deprecated `--host-whitelist` option. [\#1444](https://github.com/hyperledger/besu/pull/1444)
* Prioritize high gas prices during mining. Previously we ordered only by the order in which the transactions were received. This will increase expected profit when mining. [\#1449](https://github.com/hyperledger/besu/pull/1449)
* Added support for the updated smart contract-based [node permissioning EEA interface](https://entethalliance.github.io/client-spec/spec.html#dfn-connectionallowed). [\#1435](https://github.com/hyperledger/besu/pull/1435)
* Added EvmTool binary to the distribution. EvmTool is a CLI that can execute EVM bytecode and execute ethereum state tests. [\#1465](https://github.com/hyperledger/besu/pull/1465)

## Deprecated and Scheduled for removal in _Next_ Release

Expand Down
67 changes: 44 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import groovy.transform.Memoized
import net.ltgt.gradle.errorprone.CheckSeverity

import java.nio.file.Paths
import java.text.SimpleDateFormat

plugins {
Expand Down Expand Up @@ -494,38 +493,59 @@ run {
}
}

startScripts {

def tweakStartScript(createScriptTask) {
def shortenWindowsClasspath = { line ->
line = line.replaceAll(/^set CLASSPATH=.*$/, "set CLASSPATH=%APP_HOME%/lib/*")
line.replaceAll(/^set CLASSPATH=.*$/, "set CLASSPATH=%APP_HOME%/lib/*")
}

doLast {
unixScript.text = unixScript.text.replace('BESU_HOME', '\$APP_HOME')
windowsScript.text = windowsScript.text.replace('BESU_HOME', '%~dp0..')
// OpenTelemetry Wiring for unix scripts
def agentFileName = configurations.javaAgent.singleFile.toPath().getFileName()
def unixRegex = $/exec "$$JAVACMD" /$
def forwardSlash = "/"
def unixReplacement = $/if [ -n "$$TRACING" ];then
createScriptTask.unixScript.text = createScriptTask.unixScript.text.replace('BESU_HOME', '\$APP_HOME')
createScriptTask.windowsScript.text = createScriptTask.windowsScript.text.replace('BESU_HOME', '%~dp0..')
// OpenTelemetry Wiring for unix scripts
def agentFileName = configurations.javaAgent.singleFile.toPath().getFileName()
def unixRegex = $/exec "$$JAVACMD" /$
def forwardSlash = "/"
def unixReplacement = $/if [ -n "$$TRACING" ];then
TRACING_AGENT="-javaagent:$$APP_HOME/agent${forwardSlash}${agentFileName}"
fi
exec "$$JAVACMD" $$TRACING_AGENT /$
unixScript.text = unixScript.text.replace(unixRegex, unixReplacement)
// OpenTelemetry Wiring for windows scripts
def windowsRegex = $/"%JAVA_EXE%" %DEFAULT_JVM_OPTS%/$
def windowsReplacement = $/if Defined TRACING (TRACING_AGENT="-javaagent:"%APP_HOME%\agent\/$ + agentFileName + '")\r\n"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %TRACING_AGENT%'
windowsScript.text = windowsScript.text.replace(windowsRegex, windowsReplacement)
createScriptTask.unixScript.text = createScriptTask.unixScript.text.replace(unixRegex, unixReplacement)
// OpenTelemetry Wiring for windows scripts
def windowsRegex = $/"%JAVA_EXE%" %DEFAULT_JVM_OPTS%/$
def windowsReplacement = $/if Defined TRACING (TRACING_AGENT="-javaagent:"%APP_HOME%\agent\/$ + agentFileName + '")\r\n"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %TRACING_AGENT%'
createScriptTask.windowsScript.text = createScriptTask.windowsScript.text.replace(windowsRegex, windowsReplacement)
// Prevent the error originating from the 8191 chars limit on Windows
createScriptTask.windowsScript.text =
createScriptTask.windowsScript
.readLines()
.collect(shortenWindowsClasspath)
.join('\r\n')
}

// Prevent the error originating from the 8191 chars limit on Windows
windowsScript.text =
windowsScript
.readLines()
.collect(shortenWindowsClasspath)
.join('\r\n')
startScripts {
doLast {
tweakStartScript(startScripts)
}
}

task evmToolStartScripts(type: CreateStartScripts) {
mainClassName = 'org.hyperledger.besu.evmtool.EvmTool'
classpath = startScripts.classpath
outputDir = startScripts.outputDir
applicationName = 'evm'
defaultJvmOpts = [
"-Dsecp256k1.randomize=false"
]
doLast {
tweakStartScript(evmToolStartScripts)
}
}

// Include the additional start scripts in the distribution
applicationDistribution.into("bin") {
from(tasks.withType(CreateStartScripts))
fileMode = 0755
}

installDist { dependsOn checkLicenses }

Expand Down Expand Up @@ -777,6 +797,7 @@ configurations {

dependencies {
implementation project(':besu')
implementation project(':ethereum:evmtool')
javaAgent group: 'io.opentelemetry.instrumentation.auto', name: 'opentelemetry-javaagent', classifier: 'all'
errorprone 'com.google.errorprone:error_prone_core'
}
Expand Down
3 changes: 3 additions & 0 deletions ethereum/evmtool/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ mainClassName = 'org.hyperledger.besu.evmtool.EvmTool'

startScripts {
applicationName = 'evm'
defaultJvmOpts = [
"-Dsecp256k1.randomize=false"
]
doLast {
unixScript.text = unixScript.text.replace('BESU_HOME', '\$APP_HOME')
windowsScript.text = windowsScript.text.replace('BESU_HOME', '%~dp0..')
Expand Down

0 comments on commit 15d1789

Please sign in to comment.