Skip to content

Commit 92d5b25

Browse files
authored
Merge pull request #510 from etclabscore/merge/foundation-release/1.10.26
Merge/foundation release/1.10.26
2 parents 83fb902 + 9a48b9c commit 92d5b25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+902
-524
lines changed

.github/workflows/evmc.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88

99
jobs:
1010

11-
build-ewasm:
12-
name: EWASM State Tests
11+
build-evmc:
12+
name: EVMC/EVM+EWASM State Tests
1313
runs-on: ubuntu-latest
1414
steps:
1515

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

25+
- name: Install cmake
26+
run: |
27+
sudo apt-get update -y
28+
sudo apt-get upgrade -y
29+
sudo apt-get install -y cmake
30+
cmake --version
31+
32+
- name: Install necessary GLIBCXX version
33+
run: |
34+
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
35+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
36+
sudo apt-get update -y
37+
sudo apt-get install -y gcc-9 g++-9
38+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90
39+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90
40+
g++ --version
41+
gcc --version
42+
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
43+
2544
- name: Get dependencies
2645
run: |
2746
go get -v -t -d ./...
47+
git config --global --add safe.directory $(pwd)/tests/evm-benchmarks
48+
git config --global --add safe.directory $(pwd)/tests/testdata
49+
git config --global --add safe.directory $(pwd)/tests/testdata/LegacyTests
2850
git submodule update --init --recursive
2951
export GOBIN=${HOME}/go/bin
3052
mkdir -p "${GOBIN}"
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Developer helper
2+
on: pull_request
3+
env:
4+
# GENERATE_EXCEPTIONS are exceptions made to the 'go generate' command.
5+
# These patterns are matched (negatively) against 'go list' output.
6+
#
7+
# - trezor: Ignore generating trezor package based on this comment:
8+
# https://github.com/ethereum/go-ethereum/blob/master/accounts/usbwallet/trezor/trezor.go#L21-L43
9+
GENERATE_EXCEPTIONS: |
10+
trezor
11+
jobs:
12+
go-generate-check:
13+
name: Check if "go generate" has been run
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Set up Go 1.x
17+
id: go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: ^1.16
21+
- name: Check out code into the Go module directory
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
- name: Install deps
26+
id: install-deps
27+
run: |
28+
SOLC_BIN=solc-linux-amd64-v0.6.0+commit.26b70077
29+
curl -OL https://binaries.soliditylang.org/linux-amd64/$SOLC_BIN
30+
sudo mv $SOLC_BIN /usr/bin/solc
31+
sudo chmod +x /usr/bin/solc
32+
33+
shell: bash
34+
- name: Install devtools
35+
id: install-devtools
36+
run: make devtools
37+
- name: Run go:generate
38+
id: go-generate
39+
run: |
40+
list="$(go list ./...)"
41+
for pattern in ${GENERATE_EXCEPTIONS[@]}; do
42+
list="$(grep -v "$pattern" <<< "$list")"
43+
done
44+
go generate "$list"
45+
- name: Revert custom generated files modifications before comparing them
46+
id: revert-custom-generated-modifications
47+
run: |
48+
# NOTE to developers checking what triggered this alert.
49+
# This script is meant to alert you if some files have to be regenerated using `go generate`.
50+
# 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.
51+
52+
git config user.name github-actions
53+
git config user.email [email protected]
54+
55+
# Intentionally revert this commit which has a custom modification to the genesis unmarshaling,
56+
# with regards reading different genesis formats origniating from different clients
57+
# This way, this script can alert us on any code changes that have to be applied on if file gets changed.
58+
git revert --no-edit 4b2cf83737ffe7c46c334a11414d151de049e0b3
59+
60+
- name: Check for modified files
61+
id: git-check
62+
run: |
63+
if ! git diff-index --quiet HEAD --; then
64+
echo "🔴 ERROR: There are modified files after running 'go generate'"
65+
git status
66+
exit 1
67+
fi

.gitmodules

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[submodule "tests"]
22
path = tests/testdata
3-
url = https://github.com/etclabscore/tests
3+
url = https://github.com/ethereum/tests
44
shallow = true
55
[submodule "evm-benchmarks"]
66
path = tests/evm-benchmarks
77
url = https://github.com/ipsilon/evm-benchmarks
88
shallow = true
99
[submodule "tests-etc"]
1010
path = tests/testdata-etc
11-
url = https://github.com/etclabscore/tests-etc
11+
url = https://github.com/etclabscore/tests
12+
shallow = true

Makefile

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ios:
3030
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
3131

3232
test:
33-
$(GORUN) build/ci.go test
33+
$(GORUN) build/ci.go test -timeout 20m
3434

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

51-
ssvm:
52-
./build/ssvm.sh
53-
5451
evmone:
5552
./build/evmone.sh
5653

57-
aleth-interpreter:
58-
./build/aleth-interpreter.sh
59-
6054
# Test EVMC support against various external interpreters.
61-
test-evmc: hera ssvm evmone aleth-interpreter
55+
test-evmc: hera evmone
6256
go test -count 1 ./tests -run TestState -evmc.ewasm=$(ROOT_DIR)/build/_workspace/hera/build/src/libhera.so
63-
go test -count 1 ./tests -run TestState -evmc.ewasm=$(ROOT_DIR)/build/_workspace/SSVM/build/tools/ssvm-evmc/libssvmEVMC.so
6457
go test -count 1 ./tests -run TestState -evmc.evm=$(ROOT_DIR)/build/_workspace/evmone/lib/libevmone.so
65-
go test -count 1 ./tests -run TestState -evmc.evm=$(ROOT_DIR)/build/_workspace/aleth/lib/libaleth-interpreter.so
6658

6759
clean-evmc:
68-
rm -rf ./build/_workspace/hera ./build/_workspace/SSVM ./build/_workspace/evmone ./build/_workspace/aleth
60+
rm -rf ./build/_workspace/hera ./build/_workspace/evmone
6961

7062
test-coregeth-features: \
7163
test-coregeth-features-coregeth \

build/aleth-interpreter.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

build/ci.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ var (
138138
"focal": "golang-go", // EOL: 04/2030
139139
"impish": "golang-go", // EOL: 07/2022
140140
"jammy": "golang-go", // EOL: 04/2032
141-
//"kinetic": "golang-go", // EOL: 07/2023
141+
// "kinetic": "golang-go", // EOL: 07/2023
142142
}
143143

144144
debGoBootPaths = map[string]string{
@@ -349,7 +349,7 @@ func doLint(cmdline []string) {
349349
}
350350

351351
linter := downloadLinter(*cachedir)
352-
lflags := []string{"run", "--timeout", "3m0s", "--config", ".golangci.yml"}
352+
lflags := []string{"run", "--timeout", "5m0s", "--config", ".golangci.yml"}
353353
build.MustRunCommand(linter, append(lflags, packages...)...)
354354
fmt.Println("You have achieved perfection.")
355355
}

build/evmone.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ if [[ "$OSTYPE" != "linux"* ]]; then
88
fi
99

1010
mkdir -p build/_workspace/evmone
11-
[[ -f build/_workspace/evmone/evmone-0.5.0-linux-x86_64.tar.gz ]] && exit 0
12-
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
13-
tar xzvf build/_workspace/evmone/evmone-0.5.0-linux-x86_64.tar.gz -C build/_workspace/evmone/
11+
[[ -f build/_workspace/evmone/evmone-0.9.1-linux-x86_64.tar.gz ]] && exit 0
12+
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
13+
tar xzvf build/_workspace/evmone/evmone-0.9.1-linux-x86_64.tar.gz -C build/_workspace/evmone/

build/hera.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ main() {
1616
mkdir -p build/_workspace
1717
[ ! -d build/_workspace/hera ] && git clone https://github.com/ewasm/hera build/_workspace/hera || echo "Hera exists."
1818
cd build/_workspace/hera
19-
git checkout v0.3.2
19+
git checkout v0.6.0
2020
git submodule update --init
2121
mkdir -p build
2222
cd build

build/ssvm.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

cmd/devp2p/internal/ethtest/suite_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var (
3636
)
3737

3838
func TestEthSuite(t *testing.T) {
39-
geth, err := runGeth()
39+
geth, err := runGeth(t)
4040
if err != nil {
4141
t.Fatalf("could not run geth: %v", err)
4242
}
@@ -48,6 +48,7 @@ func TestEthSuite(t *testing.T) {
4848
}
4949
for _, test := range suite.EthTests() {
5050
t.Run(test.Name, func(t *testing.T) {
51+
time.Sleep(time.Second)
5152
result := utesting.RunTAP([]utesting.Test{{Name: test.Name, Fn: test.Fn}}, os.Stdout)
5253
if result[0].Failed {
5354
t.Fatal()
@@ -57,7 +58,7 @@ func TestEthSuite(t *testing.T) {
5758
}
5859

5960
func TestSnapSuite(t *testing.T) {
60-
geth, err := runGeth()
61+
geth, err := runGeth(t)
6162
if err != nil {
6263
t.Fatalf("could not run geth: %v", err)
6364
}
@@ -69,6 +70,7 @@ func TestSnapSuite(t *testing.T) {
6970
}
7071
for _, test := range suite.SnapTests() {
7172
t.Run(test.Name, func(t *testing.T) {
73+
time.Sleep(time.Second)
7274
result := utesting.RunTAP([]utesting.Test{{Name: test.Name, Fn: test.Fn}}, os.Stdout)
7375
if result[0].Failed {
7476
t.Fatal()
@@ -78,7 +80,8 @@ func TestSnapSuite(t *testing.T) {
7880
}
7981

8082
// runGeth creates and starts a geth node
81-
func runGeth() (*node.Node, error) {
83+
func runGeth(t *testing.T) (*node.Node, error) {
84+
t.Helper()
8285
stack, err := node.New(&node.Config{
8386
P2P: p2p.Config{
8487
ListenAddr: "127.0.0.1:0",
@@ -100,6 +103,7 @@ func runGeth() (*node.Node, error) {
100103
stack.Close()
101104
return nil, err
102105
}
106+
103107
return stack, nil
104108
}
105109

cmd/echainspec/util.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"os"
88
"strings"
99

@@ -15,9 +15,9 @@ import (
1515

1616
func readInputData(ctx *cli.Context) ([]byte, error) {
1717
if !ctx.GlobalIsSet(fileInFlag.Name) {
18-
return ioutil.ReadAll(os.Stdin)
18+
return io.ReadAll(os.Stdin)
1919
}
20-
return ioutil.ReadFile(ctx.GlobalString(fileInFlag.Name))
20+
return os.ReadFile(ctx.GlobalString(fileInFlag.Name))
2121
}
2222

2323
func unmarshalChainSpec(format string, data []byte) (conf ctypes.Configurator, err error) {

cmd/evm/internal/t8ntool/execution.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type ExecutionResult struct {
5858
Rejected []*rejectedTx `json:"rejected,omitempty"`
5959
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
6060
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
61+
BaseFee *math.HexOrDecimal256 `json:"currentBaseFee,omitempty"`
6162
}
6263

6364
type ommer struct {
@@ -273,6 +274,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig ctypes.ChainConfigura
273274
Rejected: rejectedTxs,
274275
Difficulty: (*math.HexOrDecimal256)(vmContext.Difficulty),
275276
GasUsed: (math.HexOrDecimal64)(gasUsed),
277+
BaseFee: (*math.HexOrDecimal256)(vmContext.BaseFee),
276278
}
277279
return statedb, execRs, nil
278280
}

cmd/evm/internal/t8ntool/transition.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"path"
2727
"strings"
2828

29+
"github.com/ethereum/go-ethereum/cmd/utils"
2930
"github.com/ethereum/go-ethereum/common"
3031
"github.com/ethereum/go-ethereum/common/hexutil"
3132
"github.com/ethereum/go-ethereum/core/state"
@@ -178,9 +179,20 @@ func Transition(ctx *cli.Context) error {
178179
prestate.Env = *inputData.Env
179180

180181
vmConfig := vm.Config{
181-
Tracer: tracer,
182-
Debug: (tracer != nil),
182+
Tracer: tracer,
183+
Debug: (tracer != nil),
184+
EVMInterpreter: ctx.String(utils.EVMInterpreterFlag.Name),
185+
EWASMInterpreter: ctx.String(utils.EWASMInterpreterFlag.Name),
183186
}
187+
188+
if vmConfig.EVMInterpreter != "" {
189+
vm.InitEVMCEVM(vmConfig.EVMInterpreter)
190+
}
191+
192+
if vmConfig.EWASMInterpreter != "" {
193+
vm.InitEVMCEwasm(vmConfig.EWASMInterpreter)
194+
}
195+
184196
// Construct the chainconfig
185197
var chainConfig ctypes.ChainConfigurator
186198
if cConf, extraEips, err := tests.GetChainConfig(ctx.String(ForknameFlag.Name)); err != nil {

cmd/evm/main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"os"
2424

2525
"github.com/ethereum/go-ethereum/cmd/evm/internal/t8ntool"
26+
"github.com/ethereum/go-ethereum/cmd/utils"
2627
"github.com/ethereum/go-ethereum/internal/flags"
2728
"github.com/urfave/cli/v2"
2829
)
@@ -132,11 +133,6 @@ var (
132133
Value: true,
133134
Usage: "enable return data output",
134135
}
135-
EVMInterpreterFlag = &cli.StringFlag{
136-
Name: "vm.evm",
137-
Usage: "External EVM configuration (default = built-in interpreter)",
138-
Value: "",
139-
}
140136
)
141137

142138
var stateTransitionCommand = &cli.Command{
@@ -162,6 +158,8 @@ var stateTransitionCommand = &cli.Command{
162158
t8ntool.ChainIDFlag,
163159
t8ntool.RewardFlag,
164160
t8ntool.VerbosityFlag,
161+
utils.EVMInterpreterFlag,
162+
utils.EWASMInterpreterFlag,
165163
},
166164
}
167165

@@ -222,7 +220,7 @@ func init() {
222220
DisableStackFlag,
223221
DisableStorageFlag,
224222
DisableReturnDataFlag,
225-
EVMInterpreterFlag,
223+
utils.EVMInterpreterFlag,
226224
}
227225
app.Commands = []*cli.Command{
228226
compileCommand,

cmd/evm/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func runCmd(ctx *cli.Context) error {
217217
EVMConfig: vm.Config{
218218
Tracer: tracer,
219219
Debug: ctx.Bool(DebugFlag.Name) || ctx.Bool(MachineFlag.Name),
220-
EVMInterpreter: ctx.String(EVMInterpreterFlag.Name),
220+
EVMInterpreter: ctx.String(utils.EVMInterpreterFlag.Name),
221221
},
222222
}
223223

0 commit comments

Comments
 (0)