Skip to content

Commit 9870fd3

Browse files
authored
Merge pull request #513 from etclabscore/merge/foundation-release/1.10.23-tests-generate-fixes-statefix-difficulty-test-v2
master..merge/foundation release/1.10.23 tests generate fixes statefix difficulty test v2
2 parents b909e85 + 731dec2 commit 9870fd3

File tree

291 files changed

+5568
-3513
lines changed

Some content is hidden

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

291 files changed

+5568
-3513
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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +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
9+
[submodule "tests-etc"]
10+
path = tests/testdata-etc
11+
url = https://github.com/etclabscore/tests
12+
shallow = true

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ COPY go.sum /go-ethereum/
1414
RUN cd /go-ethereum && go mod download
1515

1616
ADD . /go-ethereum
17-
RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth
17+
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
1818

1919
# Pull Geth into a second stage deploy alpine container
2020
FROM alpine:latest

Dockerfile.alltools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ COPY go.sum /go-ethereum/
1414
RUN cd /go-ethereum && go mod download
1515

1616
ADD . /go-ethereum
17-
RUN cd /go-ethereum && go run build/ci.go install
17+
RUN cd /go-ethereum && go run build/ci.go install -static
1818

1919
# Pull all binaries into a second stage deploy alpine container
2020
FROM alpine:latest

Makefile

Lines changed: 11 additions & 15 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 \
@@ -102,15 +94,19 @@ tests-generate-state: ## Generate state tests.
10294
env COREGETH_TESTS_GENERATE_STATE_TESTS=on \
10395
env COREGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_COREGETH=on \
10496
go test -p 1 -v -timeout 60m ./tests -run TestGenStateAll
97+
rm -rf ./tests/testdata-etc/GeneralStateTests
98+
mv ./tests/testdata_generated/GeneralStateTests ./tests/testdata-etc/GeneralStateTests
99+
rm -rf ./tests/testdata-etc/LegacyTests
100+
mv ./tests/testdata_generated/LegacyTests ./tests/testdata-etc/LegacyTests
101+
rm -rf ./tests/testdata_generated
105102

106103
tests-generate-difficulty: ## Generate difficulty tests.
107-
@echo "Generating difficulty tests configs."
108-
env COREGETH_TESTS_GENERATE_DIFFICULTY_TESTS_CONFIGS=on \
109-
go run build/ci.go test -v -timeout 10m ./tests -run TestDifficultyTestConfigGen
110-
111104
@echo "Generating difficulty tests."
112105
env COREGETH_TESTS_GENERATE_DIFFICULTY_TESTS=on \
113106
go run build/ci.go test -v -timeout 10m ./tests -run TestDifficultyGen
107+
rm -rf ./tests/testdata-etc/DifficultyTests
108+
mv ./tests/testdata_generated/DifficultyTests ./tests/testdata-etc/DifficultyTests
109+
rm -rf ./tests/testdata_generated
114110

115111
lint: ## Run linters.
116112
$(GORUN) build/ci.go lint

accounts/abi/abi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (abi ABI) getArguments(name string, data []byte) (Arguments, error) {
9595
args = event.Inputs
9696
}
9797
if args == nil {
98-
return nil, errors.New("abi: could not locate named method or event")
98+
return nil, fmt.Errorf("abi: could not locate named method or event: %s", name)
9999
}
100100
return args, nil
101101
}

accounts/abi/bind/backends/simulated.go

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ type SimulatedBackend struct {
7171
pendingState *state.StateDB // Currently pending state that will be the active on request
7272
pendingReceipts types.Receipts // Currently receipts for the pending block
7373

74-
events *filters.EventSystem // Event system for filtering log events live
74+
events *filters.EventSystem // for filtering log events live
75+
filterSystem *filters.FilterSystem // for filtering database logs
7576

7677
config ctypes.ChainConfigurator
7778
}
@@ -89,7 +90,11 @@ func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc genesisT.Gen
8990
blockchain: blockchain,
9091
config: genesis.Config,
9192
}
92-
backend.events = filters.NewEventSystem(&filterBackend{database, blockchain, backend}, false)
93+
94+
filterBackend := &filterBackend{database, blockchain, backend}
95+
backend.filterSystem = filters.NewFilterSystem(filterBackend, filters.Config{})
96+
backend.events = filters.NewEventSystem(backend.filterSystem, false)
97+
9398
backend.rollback(blockchain.CurrentBlock())
9499
return backend
95100
}
@@ -611,7 +616,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM
611616
// User specified the legacy gas field, convert to 1559 gas typing
612617
call.GasFeeCap, call.GasTipCap = call.GasPrice, call.GasPrice
613618
} else {
614-
// User specified 1559 gas feilds (or none), use those
619+
// User specified 1559 gas fields (or none), use those
615620
if call.GasFeeCap == nil {
616621
call.GasFeeCap = new(big.Int)
617622
}
@@ -691,7 +696,7 @@ func (b *SimulatedBackend) FilterLogs(ctx context.Context, query ethereum.Filter
691696
var filter *filters.Filter
692697
if query.BlockHash != nil {
693698
// Block filter requested, construct a single-shot filter
694-
filter = filters.NewBlockFilter(&filterBackend{b.database, b.blockchain, b}, *query.BlockHash, query.Addresses, query.Topics)
699+
filter = b.filterSystem.NewBlockFilter(*query.BlockHash, query.Addresses, query.Topics)
695700
} else {
696701
// Initialize unset filter boundaries to run from genesis to chain head
697702
from := int64(0)
@@ -703,7 +708,7 @@ func (b *SimulatedBackend) FilterLogs(ctx context.Context, query ethereum.Filter
703708
to = query.ToBlock.Int64()
704709
}
705710
// Construct the range filter
706-
filter = filters.NewRangeFilter(&filterBackend{b.database, b.blockchain, b}, from, to, query.Addresses, query.Topics)
711+
filter = b.filterSystem.NewRangeFilter(from, to, query.Addresses, query.Topics)
707712
}
708713
// Run the filter and return all the logs
709714
logs, err := filter.Logs(ctx)
@@ -856,7 +861,8 @@ type filterBackend struct {
856861
backend *SimulatedBackend
857862
}
858863

859-
func (fb *filterBackend) ChainDb() ethdb.Database { return fb.db }
864+
func (fb *filterBackend) ChainDb() ethdb.Database { return fb.db }
865+
860866
func (fb *filterBackend) EventMux() *event.TypeMux { panic("not supported") }
861867

862868
func (fb *filterBackend) HeaderByNumber(ctx context.Context, block rpc.BlockNumber) (*types.Header, error) {
@@ -882,19 +888,8 @@ func (fb *filterBackend) GetReceipts(ctx context.Context, hash common.Hash) (typ
882888
return rawdb.ReadReceipts(fb.db, hash, *number, fb.bc.Config()), nil
883889
}
884890

885-
func (fb *filterBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
886-
number := rawdb.ReadHeaderNumber(fb.db, hash)
887-
if number == nil {
888-
return nil, nil
889-
}
890-
receipts := rawdb.ReadReceipts(fb.db, hash, *number, fb.bc.Config())
891-
if receipts == nil {
892-
return nil, nil
893-
}
894-
logs := make([][]*types.Log, len(receipts))
895-
for i, receipt := range receipts {
896-
logs[i] = receipt.Logs
897-
}
891+
func (fb *filterBackend) GetLogs(ctx context.Context, hash common.Hash, number uint64) ([][]*types.Log, error) {
892+
logs := rawdb.ReadLogs(fb.db, hash, number, fb.bc.Config())
898893
return logs, nil
899894
}
900895

accounts/abi/reflect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func mustArrayToByteSlice(value reflect.Value) reflect.Value {
9999
func set(dst, src reflect.Value) error {
100100
dstType, srcType := dst.Type(), src.Type()
101101
switch {
102-
case dstType.Kind() == reflect.Interface && dst.Elem().IsValid():
102+
case dstType.Kind() == reflect.Interface && dst.Elem().IsValid() && (dst.Elem().Type().Kind() == reflect.Ptr || dst.Elem().CanSet()):
103103
return set(dst.Elem(), src)
104104
case dstType.Kind() == reflect.Ptr && dstType.Elem() != reflect.TypeOf(big.Int{}):
105105
return set(dst.Elem(), src)

accounts/abi/reflect_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type reflectTest struct {
3232

3333
var reflectTests = []reflectTest{
3434
{
35-
name: "OneToOneCorrespondance",
35+
name: "OneToOneCorrespondence",
3636
args: []string{"fieldA"},
3737
struc: struct {
3838
FieldA int `abi:"fieldA"`

0 commit comments

Comments
 (0)