Skip to content

Commit

Permalink
Merge pull request #510 from etclabscore/merge/foundation-release/1.1…
Browse files Browse the repository at this point in the history
…0.26

Merge/foundation release/1.10.26
  • Loading branch information
meowsbits authored Jan 19, 2023
2 parents 83fb902 + 9a48b9c commit 92d5b25
Show file tree
Hide file tree
Showing 79 changed files with 902 additions and 524 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/evmc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

jobs:

build-ewasm:
name: EWASM State Tests
build-evmc:
name: EVMC/EVM+EWASM State Tests
runs-on: ubuntu-latest
steps:

Expand All @@ -22,9 +22,31 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Install cmake
run: |
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y cmake
cmake --version
- name: Install necessary GLIBCXX version
run: |
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install -y gcc-9 g++-9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90
g++ --version
gcc --version
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
- name: Get dependencies
run: |
go get -v -t -d ./...
git config --global --add safe.directory $(pwd)/tests/evm-benchmarks
git config --global --add safe.directory $(pwd)/tests/testdata
git config --global --add safe.directory $(pwd)/tests/testdata/LegacyTests
git submodule update --init --recursive
export GOBIN=${HOME}/go/bin
mkdir -p "${GOBIN}"
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/go-generate-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Developer helper
on: pull_request
env:
# GENERATE_EXCEPTIONS are exceptions made to the 'go generate' command.
# These patterns are matched (negatively) against 'go list' output.
#
# - trezor: Ignore generating trezor package based on this comment:
# https://github.com/ethereum/go-ethereum/blob/master/accounts/usbwallet/trezor/trezor.go#L21-L43
GENERATE_EXCEPTIONS: |
trezor
jobs:
go-generate-check:
name: Check if "go generate" has been run
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
id: go
uses: actions/setup-go@v2
with:
go-version: ^1.16
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install deps
id: install-deps
run: |
SOLC_BIN=solc-linux-amd64-v0.6.0+commit.26b70077
curl -OL https://binaries.soliditylang.org/linux-amd64/$SOLC_BIN
sudo mv $SOLC_BIN /usr/bin/solc
sudo chmod +x /usr/bin/solc
shell: bash
- name: Install devtools
id: install-devtools
run: make devtools
- name: Run go:generate
id: go-generate
run: |
list="$(go list ./...)"
for pattern in ${GENERATE_EXCEPTIONS[@]}; do
list="$(grep -v "$pattern" <<< "$list")"
done
go generate "$list"
- name: Revert custom generated files modifications before comparing them
id: revert-custom-generated-modifications
run: |
# NOTE to developers checking what triggered this alert.
# This script is meant to alert you if some files have to be regenerated using `go generate`.
# If this happens, you have to run `go generate ./...` and then check the below commits that are being reverted and reapply them, after considering if they are needed.
git config user.name github-actions
git config user.email [email protected]
# Intentionally revert this commit which has a custom modification to the genesis unmarshaling,
# with regards reading different genesis formats origniating from different clients
# This way, this script can alert us on any code changes that have to be applied on if file gets changed.
git revert --no-edit 4b2cf83737ffe7c46c334a11414d151de049e0b3
- name: Check for modified files
id: git-check
run: |
if ! git diff-index --quiet HEAD --; then
echo "🔴 ERROR: There are modified files after running 'go generate'"
git status
exit 1
fi
5 changes: 3 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[submodule "tests"]
path = tests/testdata
url = https://github.com/etclabscore/tests
url = https://github.com/ethereum/tests
shallow = true
[submodule "evm-benchmarks"]
path = tests/evm-benchmarks
url = https://github.com/ipsilon/evm-benchmarks
shallow = true
[submodule "tests-etc"]
path = tests/testdata-etc
url = https://github.com/etclabscore/tests-etc
url = https://github.com/etclabscore/tests
shallow = true
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ios:
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."

test:
$(GORUN) build/ci.go test
$(GORUN) build/ci.go test -timeout 20m

# DEPRECATED.
# No attempt will be made after the Istanbul fork to maintain
Expand All @@ -48,24 +48,16 @@ test-coregeth: \
hera:
./build/hera.sh

ssvm:
./build/ssvm.sh

evmone:
./build/evmone.sh

aleth-interpreter:
./build/aleth-interpreter.sh

# Test EVMC support against various external interpreters.
test-evmc: hera ssvm evmone aleth-interpreter
test-evmc: hera evmone
go test -count 1 ./tests -run TestState -evmc.ewasm=$(ROOT_DIR)/build/_workspace/hera/build/src/libhera.so
go test -count 1 ./tests -run TestState -evmc.ewasm=$(ROOT_DIR)/build/_workspace/SSVM/build/tools/ssvm-evmc/libssvmEVMC.so
go test -count 1 ./tests -run TestState -evmc.evm=$(ROOT_DIR)/build/_workspace/evmone/lib/libevmone.so
go test -count 1 ./tests -run TestState -evmc.evm=$(ROOT_DIR)/build/_workspace/aleth/lib/libaleth-interpreter.so

clean-evmc:
rm -rf ./build/_workspace/hera ./build/_workspace/SSVM ./build/_workspace/evmone ./build/_workspace/aleth
rm -rf ./build/_workspace/hera ./build/_workspace/evmone

test-coregeth-features: \
test-coregeth-features-coregeth \
Expand Down
14 changes: 0 additions & 14 deletions build/aleth-interpreter.sh

This file was deleted.

4 changes: 2 additions & 2 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ var (
"focal": "golang-go", // EOL: 04/2030
"impish": "golang-go", // EOL: 07/2022
"jammy": "golang-go", // EOL: 04/2032
//"kinetic": "golang-go", // EOL: 07/2023
// "kinetic": "golang-go", // EOL: 07/2023
}

debGoBootPaths = map[string]string{
Expand Down Expand Up @@ -349,7 +349,7 @@ func doLint(cmdline []string) {
}

linter := downloadLinter(*cachedir)
lflags := []string{"run", "--timeout", "3m0s", "--config", ".golangci.yml"}
lflags := []string{"run", "--timeout", "5m0s", "--config", ".golangci.yml"}
build.MustRunCommand(linter, append(lflags, packages...)...)
fmt.Println("You have achieved perfection.")
}
Expand Down
6 changes: 3 additions & 3 deletions build/evmone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ if [[ "$OSTYPE" != "linux"* ]]; then
fi

mkdir -p build/_workspace/evmone
[[ -f build/_workspace/evmone/evmone-0.5.0-linux-x86_64.tar.gz ]] && exit 0
wget -O build/_workspace/evmone/evmone-0.5.0-linux-x86_64.tar.gz https://github.com/ethereum/evmone/releases/download/v0.5.0/evmone-0.5.0-linux-x86_64.tar.gz
tar xzvf build/_workspace/evmone/evmone-0.5.0-linux-x86_64.tar.gz -C build/_workspace/evmone/
[[ -f build/_workspace/evmone/evmone-0.9.1-linux-x86_64.tar.gz ]] && exit 0
wget -O build/_workspace/evmone/evmone-0.9.1-linux-x86_64.tar.gz https://github.com/ethereum/evmone/releases/download/v0.9.1/evmone-0.9.1-linux-x86_64.tar.gz
tar xzvf build/_workspace/evmone/evmone-0.9.1-linux-x86_64.tar.gz -C build/_workspace/evmone/
2 changes: 1 addition & 1 deletion build/hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ main() {
mkdir -p build/_workspace
[ ! -d build/_workspace/hera ] && git clone https://github.com/ewasm/hera build/_workspace/hera || echo "Hera exists."
cd build/_workspace/hera
git checkout v0.3.2
git checkout v0.6.0
git submodule update --init
mkdir -p build
cd build
Expand Down
13 changes: 0 additions & 13 deletions build/ssvm.sh

This file was deleted.

10 changes: 7 additions & 3 deletions cmd/devp2p/internal/ethtest/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
)

func TestEthSuite(t *testing.T) {
geth, err := runGeth()
geth, err := runGeth(t)
if err != nil {
t.Fatalf("could not run geth: %v", err)
}
Expand All @@ -48,6 +48,7 @@ func TestEthSuite(t *testing.T) {
}
for _, test := range suite.EthTests() {
t.Run(test.Name, func(t *testing.T) {
time.Sleep(time.Second)
result := utesting.RunTAP([]utesting.Test{{Name: test.Name, Fn: test.Fn}}, os.Stdout)
if result[0].Failed {
t.Fatal()
Expand All @@ -57,7 +58,7 @@ func TestEthSuite(t *testing.T) {
}

func TestSnapSuite(t *testing.T) {
geth, err := runGeth()
geth, err := runGeth(t)
if err != nil {
t.Fatalf("could not run geth: %v", err)
}
Expand All @@ -69,6 +70,7 @@ func TestSnapSuite(t *testing.T) {
}
for _, test := range suite.SnapTests() {
t.Run(test.Name, func(t *testing.T) {
time.Sleep(time.Second)
result := utesting.RunTAP([]utesting.Test{{Name: test.Name, Fn: test.Fn}}, os.Stdout)
if result[0].Failed {
t.Fatal()
Expand All @@ -78,7 +80,8 @@ func TestSnapSuite(t *testing.T) {
}

// runGeth creates and starts a geth node
func runGeth() (*node.Node, error) {
func runGeth(t *testing.T) (*node.Node, error) {
t.Helper()
stack, err := node.New(&node.Config{
P2P: p2p.Config{
ListenAddr: "127.0.0.1:0",
Expand All @@ -100,6 +103,7 @@ func runGeth() (*node.Node, error) {
stack.Close()
return nil, err
}

return stack, nil
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/echainspec/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"os"
"strings"

Expand All @@ -15,9 +15,9 @@ import (

func readInputData(ctx *cli.Context) ([]byte, error) {
if !ctx.GlobalIsSet(fileInFlag.Name) {
return ioutil.ReadAll(os.Stdin)
return io.ReadAll(os.Stdin)
}
return ioutil.ReadFile(ctx.GlobalString(fileInFlag.Name))
return os.ReadFile(ctx.GlobalString(fileInFlag.Name))
}

func unmarshalChainSpec(format string, data []byte) (conf ctypes.Configurator, err error) {
Expand Down
2 changes: 2 additions & 0 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type ExecutionResult struct {
Rejected []*rejectedTx `json:"rejected,omitempty"`
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
BaseFee *math.HexOrDecimal256 `json:"currentBaseFee,omitempty"`
}

type ommer struct {
Expand Down Expand Up @@ -273,6 +274,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig ctypes.ChainConfigura
Rejected: rejectedTxs,
Difficulty: (*math.HexOrDecimal256)(vmContext.Difficulty),
GasUsed: (math.HexOrDecimal64)(gasUsed),
BaseFee: (*math.HexOrDecimal256)(vmContext.BaseFee),
}
return statedb, execRs, nil
}
Expand Down
16 changes: 14 additions & 2 deletions cmd/evm/internal/t8ntool/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"path"
"strings"

"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/state"
Expand Down Expand Up @@ -178,9 +179,20 @@ func Transition(ctx *cli.Context) error {
prestate.Env = *inputData.Env

vmConfig := vm.Config{
Tracer: tracer,
Debug: (tracer != nil),
Tracer: tracer,
Debug: (tracer != nil),
EVMInterpreter: ctx.String(utils.EVMInterpreterFlag.Name),
EWASMInterpreter: ctx.String(utils.EWASMInterpreterFlag.Name),
}

if vmConfig.EVMInterpreter != "" {
vm.InitEVMCEVM(vmConfig.EVMInterpreter)
}

if vmConfig.EWASMInterpreter != "" {
vm.InitEVMCEwasm(vmConfig.EWASMInterpreter)
}

// Construct the chainconfig
var chainConfig ctypes.ChainConfigurator
if cConf, extraEips, err := tests.GetChainConfig(ctx.String(ForknameFlag.Name)); err != nil {
Expand Down
10 changes: 4 additions & 6 deletions cmd/evm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"

"github.com/ethereum/go-ethereum/cmd/evm/internal/t8ntool"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/internal/flags"
"github.com/urfave/cli/v2"
)
Expand Down Expand Up @@ -132,11 +133,6 @@ var (
Value: true,
Usage: "enable return data output",
}
EVMInterpreterFlag = &cli.StringFlag{
Name: "vm.evm",
Usage: "External EVM configuration (default = built-in interpreter)",
Value: "",
}
)

var stateTransitionCommand = &cli.Command{
Expand All @@ -162,6 +158,8 @@ var stateTransitionCommand = &cli.Command{
t8ntool.ChainIDFlag,
t8ntool.RewardFlag,
t8ntool.VerbosityFlag,
utils.EVMInterpreterFlag,
utils.EWASMInterpreterFlag,
},
}

Expand Down Expand Up @@ -222,7 +220,7 @@ func init() {
DisableStackFlag,
DisableStorageFlag,
DisableReturnDataFlag,
EVMInterpreterFlag,
utils.EVMInterpreterFlag,
}
app.Commands = []*cli.Command{
compileCommand,
Expand Down
2 changes: 1 addition & 1 deletion cmd/evm/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func runCmd(ctx *cli.Context) error {
EVMConfig: vm.Config{
Tracer: tracer,
Debug: ctx.Bool(DebugFlag.Name) || ctx.Bool(MachineFlag.Name),
EVMInterpreter: ctx.String(EVMInterpreterFlag.Name),
EVMInterpreter: ctx.String(utils.EVMInterpreterFlag.Name),
},
}

Expand Down
Loading

0 comments on commit 92d5b25

Please sign in to comment.