mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
libevm phase 2: Use libevm statedb from upstream (#1421)
Co-authored-by: Arran Schlosberg <[email protected]> Co-authored-by: Darioush Jalali <[email protected]> Co-authored-by: Michael Kaplan <[email protected]> Co-authored-by: Ceyhun Onur <[email protected]> Co-authored-by: Richard Pringle <[email protected]> Co-authored-by: Quentin McGaw <[email protected]> Co-authored-by: Meaghan FitzGerald <[email protected]> Co-authored-by: Quentin McGaw <[email protected]> Co-authored-by: mountcount <[email protected]> Co-authored-by: chuangjinglu <[email protected]> Co-authored-by: guqicun <[email protected]> Co-authored-by: Dmytrol <[email protected]> fix problematic const name and some typos in comment (#1400) fix some function names in interface comment (#1397) close database on shutdown (#1403) fix some function names in comment (#1405) Fix Typos in Documentation (#1404) fix test generator (#724)
This commit is contained in:
+35
-1
@@ -27,6 +27,40 @@ guidelines:
|
||||
- Commit messages should be prefixed with the package(s) they modify.
|
||||
- E.g. "eth, rpc: make trace configs optional"
|
||||
|
||||
### Mocks
|
||||
|
||||
Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/mockgen) and `//go:generate` commands in the code.
|
||||
|
||||
- To **re-generate all mocks**, use the command below from the root of the project:
|
||||
|
||||
```sh
|
||||
go generate -run "go.uber.org/mock/mockgen" ./...
|
||||
```
|
||||
|
||||
- To **add** an interface that needs a corresponding mock generated:
|
||||
- if the file `mocks_generate_test.go` exists in the package where the interface is located, either:
|
||||
- modify its `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface (preferred); or
|
||||
- add another `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface according to specific mock generation settings
|
||||
- if the file `mocks_generate_test.go` does not exist in the package where the interface is located, create it with content (adapt as needed):
|
||||
|
||||
```go
|
||||
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package mypackage
|
||||
|
||||
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface
|
||||
```
|
||||
|
||||
Notes:
|
||||
1. Ideally generate all mocks to `mocks_test.go` for the package you need to use the mocks for and do not export mocks to other packages. This reduces package dependencies, reduces production code pollution and forces to have locally defined narrow interfaces.
|
||||
1. Prefer using reflect mode to generate mocks than source mode, unless you need a mock for an unexported interface, which should be rare.
|
||||
- To **remove** an interface from having a corresponding mock generated:
|
||||
1. Edit the `mocks_generate_test.go` file in the directory where the interface is defined
|
||||
1. If the `//go:generate` mockgen command line:
|
||||
- generates a mock file for multiple interfaces, remove your interface from the line
|
||||
- generates a mock file only for the interface, remove the entire line. If the file is empty, remove `mocks_generate_test.go` as well.
|
||||
|
||||
## Documentation guidelines
|
||||
|
||||
- Code should be well commented, so it is easier to read and maintain.
|
||||
@@ -35,7 +69,7 @@ guidelines:
|
||||
[commentary](https://go.dev/doc/effective_go#commentary) guidelines.
|
||||
- Changes with user facing impact (e.g., addition or modification of flags and
|
||||
options) should be accompanied by a link to a pull request to the [avalanche-docs](https://github.com/ava-labs/avalanche-docs)
|
||||
repository. [example](https://github.com/ava-labs/avalanche-docs/pull/1119/files).
|
||||
repository. [example](https://github.com/ava-labs/avalanche-docs/pull/1119/files).
|
||||
- Changes that modify a package significantly or add new features should
|
||||
either update the existing or include a new `README.md` file in that package.
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ jobs:
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "~1.22.8"
|
||||
check-latest: true
|
||||
- run: go mod download
|
||||
shell: bash
|
||||
- run: ./scripts/build_bench_precompiles.sh
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Exits if any uncommitted changes are found.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
git update-index --really-refresh >> /dev/null
|
||||
git diff-index --quiet HEAD
|
||||
@@ -17,13 +17,17 @@ on:
|
||||
|
||||
jobs:
|
||||
publish_docker_image:
|
||||
name: Publish Docker Image
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Publish image to Dockerhub
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- name: Build and publish images to DockerHub
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
|
||||
DOCKER_REPO: "avaplatform/subnet-evm"
|
||||
run: .github/workflows/publish_docker_image.sh ${{ inputs.vm_id }}
|
||||
VM_ID: ${{ inputs.vm_id }}
|
||||
PUBLISH: 1
|
||||
PLATFORMS: "linux/amd64,linux/arm64"
|
||||
run: scripts/build_docker_image.sh
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# If this is not a trusted build (Docker Credentials are not set)
|
||||
if [[ -z "$DOCKER_USERNAME" ]]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
# Avalanche root directory
|
||||
SUBNET_EVM_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd )
|
||||
|
||||
# Load the versions
|
||||
source "$SUBNET_EVM_PATH"/scripts/versions.sh
|
||||
|
||||
# Set the vm id if provided
|
||||
if [[ $# -eq 1 ]]; then
|
||||
VM_ID=$1
|
||||
fi
|
||||
|
||||
# Buld the docker image
|
||||
source "$SUBNET_EVM_PATH"/scripts/build_docker_image.sh
|
||||
|
||||
if [[ $CURRENT_BRANCH == "master" ]]; then
|
||||
echo "Tagging current image as $DOCKERHUB_REPO:latest"
|
||||
docker tag "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" "$DOCKERHUB_REPO:latest"
|
||||
fi
|
||||
|
||||
echo "Pushing $DOCKERHUB_REPO:$BUILD_IMAGE_ID"
|
||||
|
||||
echo "$DOCKER_PASS" | docker login --username "$DOCKER_USERNAME" --password-stdin
|
||||
|
||||
docker push -a "$DOCKERHUB_REPO"
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Tag to include in artifact name"
|
||||
description: "Tag to checkout & release"
|
||||
required: true
|
||||
push:
|
||||
tags:
|
||||
@@ -20,11 +20,11 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
path: subnet-evm
|
||||
ref: ${{ github.event.inputs.tag }}
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "~1.22.8"
|
||||
check-latest: true
|
||||
- name: Set up arm64 cross compiler
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
|
||||
+14
-22
@@ -17,12 +17,11 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: ./scripts/lint_allowed_geth_imports.sh
|
||||
- run: ./scripts/lint_allowed_eth_imports.sh
|
||||
shell: bash
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.min_go_version }}
|
||||
check-latest: true
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
@@ -36,6 +35,10 @@ jobs:
|
||||
- name: Run actionlint
|
||||
shell: bash
|
||||
run: scripts/actionlint.sh
|
||||
- name: go mod tidy
|
||||
run: |
|
||||
go mod tidy
|
||||
git diff --exit-code
|
||||
|
||||
unit_test:
|
||||
name: Golang Unit Tests (${{ matrix.os }})
|
||||
@@ -49,13 +52,19 @@ jobs:
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.min_go_version }}
|
||||
check-latest: true
|
||||
- name: Set timeout on Windows # Windows UT run slower and need a longer timeout
|
||||
shell: bash
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: echo "TIMEOUT=1200s" >> "$GITHUB_ENV"
|
||||
- run: go mod download
|
||||
shell: bash
|
||||
- name: Mocks are up to date
|
||||
shell: bash
|
||||
run: |
|
||||
grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm
|
||||
go generate -run "go.uber.org/mock/mockgen" ./...
|
||||
git add --intent-to-add --all
|
||||
git diff --exit-code
|
||||
- run: ./scripts/build.sh
|
||||
shell: bash
|
||||
- run: ./scripts/build_test.sh
|
||||
@@ -77,7 +86,6 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.min_go_version }}
|
||||
check-latest: true
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
@@ -119,7 +127,6 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.min_go_version }}
|
||||
check-latest: true
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
@@ -140,7 +147,7 @@ jobs:
|
||||
shell: bash
|
||||
run: ./scripts/build.sh
|
||||
- name: Run Warp E2E Tests
|
||||
uses: ava-labs/avalanchego/.github/actions/[email protected]1-monitoring-url
|
||||
uses: ava-labs/avalanchego/.github/actions/[email protected]3
|
||||
with:
|
||||
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_warp.sh
|
||||
prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }}
|
||||
@@ -164,7 +171,6 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.min_go_version }}
|
||||
check-latest: true
|
||||
- name: Install AvalancheGo Release
|
||||
shell: bash
|
||||
run: BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh
|
||||
@@ -172,7 +178,7 @@ jobs:
|
||||
shell: bash
|
||||
run: ./scripts/build.sh
|
||||
- name: Run E2E Load Tests
|
||||
uses: ava-labs/avalanchego/.github/actions/[email protected]1-monitoring-url
|
||||
uses: ava-labs/avalanchego/.github/actions/[email protected]3
|
||||
with:
|
||||
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_load.sh
|
||||
prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }}
|
||||
@@ -184,19 +190,6 @@ jobs:
|
||||
if: always()
|
||||
with:
|
||||
name: load-tmpnet-data
|
||||
mock_gen:
|
||||
name: MockGen Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ env.min_go_version }}
|
||||
check-latest: true
|
||||
- shell: bash
|
||||
run: scripts/mock.gen.sh
|
||||
- shell: bash
|
||||
run: .github/workflows/check-clean-branch.sh
|
||||
test_build_image:
|
||||
name: Image build
|
||||
runs-on: ubuntu-latest
|
||||
@@ -213,7 +206,6 @@ jobs:
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.min_go_version }}
|
||||
check-latest: true
|
||||
- name: Install AvalancheGo Release
|
||||
shell: bash
|
||||
run: BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh
|
||||
|
||||
@@ -18,10 +18,12 @@ builds:
|
||||
overrides:
|
||||
- goos: linux
|
||||
goarch: arm64
|
||||
goarm64: v8.0
|
||||
env:
|
||||
- CC=aarch64-linux-gnu-gcc
|
||||
- goos: darwin
|
||||
goarch: arm64
|
||||
goarm64: v8.0
|
||||
env:
|
||||
- CC=oa64-clang
|
||||
- goos: darwin
|
||||
|
||||
@@ -30,6 +30,9 @@ The Subnet EVM runs in a separate process from the main AvalancheGo process and
|
||||
[v0.6.9] [email protected] (Protocol Version: 37)
|
||||
[v0.6.10] [email protected] (Protocol Version: 37)
|
||||
[v0.6.11] [email protected] (Protocol Version: 37)
|
||||
[v0.6.12] [email protected]/v1.12.0 (Protocol Version: 38)
|
||||
[v0.7.0] [email protected] (Protocol Version: 38)
|
||||
[v0.7.1] [email protected] (Protocol Version: 38)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
+12
@@ -2,6 +2,18 @@
|
||||
|
||||
## Pending Release
|
||||
|
||||
* Refactored trie_prefetcher.go to be structurally similar to upstream.
|
||||
|
||||
## [v0.7.0](https://github.com/ava-labs/subnet-evm/releases/tag/v0.7.0)
|
||||
|
||||
### Updates
|
||||
|
||||
- Changed default write option from `Sync` to `NoSync` in PebbleDB
|
||||
|
||||
### Fixes
|
||||
|
||||
- Fixed database close on shutdown
|
||||
|
||||
## [v0.6.11](https://github.com/ava-labs/subnet-evm/releases/tag/v0.6.11)
|
||||
|
||||
This release focuses on Standalone DB and database configs.
|
||||
|
||||
+2
-2
@@ -34,8 +34,8 @@ import (
|
||||
"io"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
)
|
||||
|
||||
// The ABI holds information about a contract's context and available
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ import (
|
||||
"io"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/accounts"
|
||||
"github.com/ava-labs/libevm/accounts/external"
|
||||
"github.com/ava-labs/libevm/accounts/keystore"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/accounts/external"
|
||||
"github.com/ethereum/go-ethereum/accounts/keystore"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// ErrNoChainID is returned whenever the user failed to specify a chain id.
|
||||
|
||||
@@ -31,9 +31,9 @@ import (
|
||||
"errors"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/interfaces"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -29,11 +29,11 @@ package backends
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/ethclient/simulated"
|
||||
"github.com/ava-labs/subnet-evm/interfaces"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// Verify that SimulatedBackend implements required interfaces
|
||||
|
||||
@@ -34,13 +34,13 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/event"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/interfaces"
|
||||
"github.com/ava-labs/subnet-evm/rpc"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
)
|
||||
|
||||
const basefeeWiggleMultiplier = 2
|
||||
|
||||
@@ -34,14 +34,14 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/hexutil"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/rlp"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/interfaces"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ import (
|
||||
"text/template"
|
||||
"unicode"
|
||||
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// BindHook is a callback function that can be used to customize the binding.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -35,8 +35,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -207,7 +207,7 @@ var bindTests = []struct {
|
||||
`
|
||||
"math/big"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
`,
|
||||
`
|
||||
testArgs := []common.Address{common.HexToAddress("1"), common.HexToAddress("2"), common.HexToAddress("3")}
|
||||
@@ -451,7 +451,7 @@ var bindTests = []struct {
|
||||
`[{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"readAllowList","outputs":[{"internalType":"uint256","name":"role","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sayHello","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"response","type":"string"}],"name":"setGreeting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setNone","outputs":[],"stateMutability":"nonpayable","type":"function"}]`,
|
||||
`"github.com/stretchr/testify/require"
|
||||
"math/big"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/core/extstate"
|
||||
"github.com/ava-labs/subnet-evm/precompile/allowlist"
|
||||
`,
|
||||
@@ -516,7 +516,7 @@ var bindTests = []struct {
|
||||
`,
|
||||
`[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addressTest","type":"address"},{"indexed":true,"internalType":"uint8","name":"intTest","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"bytesTest","type":"bytes"}],"name":"test","type":"event"},{"inputs":[],"name":"eventTest","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"},{"type":"event","name":"empty","inputs":[]},{"type":"event","name":"indexed","inputs":[{"name":"addr","type":"address","indexed":true},{"name":"num","type":"int8","indexed":true}]},{"type":"event","name":"mixed","inputs":[{"name":"addr","type":"address","indexed":true},{"name":"num","type":"int8"}]},{"type":"event","name":"dynamic","inputs":[{"name":"idxStr","type":"string","indexed":true},{"name":"idxDat","type":"bytes","indexed":true},{"name":"str","type":"string"},{"name":"dat","type":"bytes"}]},{"type":"event","name":"unnamed","inputs":[{"name":"","type":"uint8","indexed":true},{"name":"","type":"uint8","indexed":true}]}]`,
|
||||
`"github.com/stretchr/testify/require"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/precompile/contract"
|
||||
`,
|
||||
`
|
||||
@@ -695,11 +695,6 @@ func TestPrecompileBind(t *testing.T) {
|
||||
if out, err := replacer.CombinedOutput(); err != nil {
|
||||
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out)
|
||||
}
|
||||
replacer = exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/ethereum/[email protected]", "-replace", "github.com/ethereum/go-ethereum=github.com/ava-labs/[email protected]")
|
||||
replacer.Dir = pkg
|
||||
if out, err := replacer.CombinedOutput(); err != nil {
|
||||
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out)
|
||||
}
|
||||
tidier := exec.Command(gocmd, "mod", "tidy", "-compat=1.22")
|
||||
tidier.Dir = pkg
|
||||
if out, err := tidier.CombinedOutput(); err != nil {
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
{{- if .Contract.AllowList}}
|
||||
"github.com/ava-labs/subnet-evm/precompile/allowlist"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
{{- end}}
|
||||
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
{{- if .Contract.AllowList}}
|
||||
"github.com/ava-labs/subnet-evm/precompile/allowlist"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
{{- end}}
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -41,7 +41,7 @@ import (
|
||||
|
||||
_ "embed"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
)
|
||||
{{$contract := .Contract}}
|
||||
const (
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
{{- end}}
|
||||
"github.com/ava-labs/subnet-evm/precompile/testutils"
|
||||
"github.com/ava-labs/subnet-evm/vmerrs"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/subnet-evm/precompile/contract"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
)
|
||||
|
||||
// CUSTOM CODE STARTS HERE
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/ava-labs/subnet-evm/precompile/contract"
|
||||
"github.com/ava-labs/subnet-evm/precompile/modules"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
)
|
||||
|
||||
var _ contract.Configurator = &configurator{}
|
||||
|
||||
@@ -105,8 +105,8 @@ import (
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/interfaces"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/event"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
@@ -31,10 +31,10 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/interfaces"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// WaitMined waits for tx to be mined on the blockchain.
|
||||
|
||||
@@ -33,12 +33,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/ethclient/simulated"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||
@@ -125,7 +125,10 @@ func TestWaitDeployedCornerCases(t *testing.T) {
|
||||
// Create a transaction to an account.
|
||||
code := "6060604052600a8060106000396000f360606040526008565b00"
|
||||
tx := types.NewTransaction(0, common.HexToAddress("0x01"), big.NewInt(0), 3000000, gasPrice, common.FromHex(code))
|
||||
tx, _ = types.SignTx(tx, types.LatestSignerForChainID(big.NewInt(1337)), testKey)
|
||||
tx, err := types.SignTx(tx, types.LatestSignerForChainID(big.NewInt(1337)), testKey)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to sign transaction: %s", err)
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
if err := backend.Client().SendTransaction(ctx, tx); err != nil {
|
||||
|
||||
@@ -31,8 +31,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
)
|
||||
|
||||
type Error struct {
|
||||
|
||||
@@ -30,8 +30,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
)
|
||||
|
||||
// Event is an event potentially triggered by the EVM's LOG mechanism. The Event
|
||||
|
||||
@@ -35,8 +35,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
)
|
||||
|
||||
// FunctionType represents different types of functions a contract might have.
|
||||
|
||||
@@ -32,8 +32,8 @@ import (
|
||||
"math/big"
|
||||
"reflect"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
)
|
||||
|
||||
// packBytesSlice packs the given bytes as [L, V] as the canonical representation
|
||||
|
||||
@@ -37,7 +37,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
)
|
||||
|
||||
// TestPack tests the general pack/unpack tests in packing_test.go
|
||||
|
||||
@@ -29,7 +29,7 @@ package abi
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
)
|
||||
|
||||
type packUnpackTest struct {
|
||||
|
||||
@@ -33,9 +33,9 @@ import (
|
||||
"math/big"
|
||||
"reflect"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
)
|
||||
|
||||
// packTopic packs rule into the corresponding hash value for a log's topic
|
||||
|
||||
@@ -32,8 +32,8 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
)
|
||||
|
||||
func TestMakeTopics(t *testing.T) {
|
||||
|
||||
@@ -36,7 +36,7 @@ import (
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
)
|
||||
|
||||
// Type enumerator
|
||||
|
||||
@@ -31,8 +31,8 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// typeWithoutStringer is a alias for the Type type which simply doesn't implement
|
||||
|
||||
@@ -34,7 +34,7 @@ import (
|
||||
"math/big"
|
||||
"reflect"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -37,7 +37,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
+3
-3
@@ -34,12 +34,12 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/ava-labs/libevm/common/compiler"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
|
||||
"github.com/ava-labs/subnet-evm/cmd/utils"
|
||||
"github.com/ava-labs/subnet-evm/internal/flags"
|
||||
"github.com/ethereum/go-ethereum/common/compiler"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core/asm"
|
||||
"github.com/ava-labs/libevm/core/asm"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core/asm"
|
||||
"github.com/ava-labs/libevm/core/asm"
|
||||
)
|
||||
|
||||
func Compile(fn string, src []byte, debug bool) (string, error) {
|
||||
|
||||
@@ -34,12 +34,12 @@ import (
|
||||
"math/big"
|
||||
"os"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/hexutil"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/rlp"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -30,21 +30,21 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/libevm/rlp"
|
||||
"github.com/ava-labs/libevm/trie"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/consensus/misc/eip4844"
|
||||
"github.com/ava-labs/subnet-evm/core"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/trie"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/holiman/uint256"
|
||||
"golang.org/x/crypto/sha3"
|
||||
)
|
||||
|
||||
@@ -30,8 +30,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/subnet-evm/tests"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/hexutil"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
)
|
||||
|
||||
var _ = (*headerMarshaling)(nil)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"errors"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
)
|
||||
|
||||
var _ = (*stEnvMarshaling)(nil)
|
||||
|
||||
@@ -21,10 +21,10 @@ import (
|
||||
"io"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/eth/tracers"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// traceWriter is an vm.EVMLogger which also holds an inner logger/tracer.
|
||||
|
||||
@@ -34,13 +34,13 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/hexutil"
|
||||
"github.com/ava-labs/libevm/rlp"
|
||||
"github.com/ava-labs/subnet-evm/core"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/tests"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -34,17 +34,17 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/hexutil"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/eth/tracers/logger"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/eth/tracers"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/tests"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/eth/tracers/logger"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/hexutil"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/rlp"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
)
|
||||
|
||||
// txWithKey is a helper-struct, to allow us to use the types.Transaction along with
|
||||
|
||||
+2
-2
@@ -38,8 +38,8 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
// Force-load the tracer engines to trigger registration
|
||||
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
|
||||
_ "github.com/ethereum/go-ethereum/eth/tracers/native"
|
||||
_ "github.com/ava-labs/libevm/eth/tracers/js"
|
||||
_ "github.com/ava-labs/libevm/eth/tracers/native"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
+6
-6
@@ -37,6 +37,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/eth/tracers/logger"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/cmd/evm/internal/compiler"
|
||||
"github.com/ava-labs/subnet-evm/cmd/utils"
|
||||
"github.com/ava-labs/subnet-evm/core"
|
||||
@@ -45,11 +49,7 @@ import (
|
||||
"github.com/ava-labs/subnet-evm/core/vm/runtime"
|
||||
"github.com/ava-labs/subnet-evm/internal/flags"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/triedb/hashdb"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/eth/tracers/logger"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -159,8 +159,8 @@ func runCmd(ctx *cli.Context) error {
|
||||
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
triedb := triedb.NewDatabase(db, &triedb.Config{
|
||||
Preimages: preimages,
|
||||
HashDB: hashdb.Defaults,
|
||||
Preimages: preimages,
|
||||
DBOverride: hashdb.Defaults.BackendConstructor,
|
||||
})
|
||||
defer triedb.Close()
|
||||
genesis := genesisConfig.MustCommit(db, triedb)
|
||||
|
||||
@@ -32,12 +32,12 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/eth/tracers/logger"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/tests"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/eth/tracers/logger"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ import (
|
||||
|
||||
_ "embed"
|
||||
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi/bind/precompilebind"
|
||||
"github.com/ava-labs/subnet-evm/cmd/utils"
|
||||
"github.com/ava-labs/subnet-evm/internal/flags"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
ethcrypto "github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
ethcrypto "github.com/ava-labs/libevm/crypto"
|
||||
)
|
||||
|
||||
type Key struct {
|
||||
|
||||
@@ -9,14 +9,14 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/key"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/metrics"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/txs"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/ethclient"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// DistributeFunds ensures that each address in keys has at least [minFundsPerAddr] by sending funds
|
||||
|
||||
@@ -14,6 +14,9 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
ethcrypto "github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/config"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/key"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/metrics"
|
||||
@@ -21,9 +24,6 @@ import (
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/ethclient"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
ethcrypto "github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/ethclient"
|
||||
"github.com/ava-labs/subnet-evm/interfaces"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
type ethereumTxWorker struct {
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
gethlog "github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/config"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/load"
|
||||
"github.com/ava-labs/subnet-evm/log"
|
||||
gethlog "github.com/ethereum/go-ethereum/log"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/cmd/simulator/metrics"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
type THash interface {
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"crypto/ecdsa"
|
||||
"fmt"
|
||||
|
||||
ethcrypto "github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/ethclient"
|
||||
ethcrypto "github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
var _ TxSequence[*types.Transaction] = (*txSequence)(nil)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/utils"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// FeeConfig specifies the parameters for the dynamic fee algorithm, which determines the gas limit, base fee, and block gas cost of blocks
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"rpcChainVMProtocolVersion": {
|
||||
"v0.7.1": 38,
|
||||
"v0.7.0": 38,
|
||||
"v0.6.12": 38,
|
||||
"v0.6.11": 37,
|
||||
"v0.6.10": 37,
|
||||
"v0.6.9": 37,
|
||||
|
||||
@@ -30,11 +30,11 @@ package consensus
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/commontype"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// ChainHeaderReader defines a small collection of methods needed to access the local
|
||||
|
||||
@@ -18,7 +18,7 @@ The dynamic fee algorithm aims to adjust the base fee to handle network congesti
|
||||
|
||||
- EIP-1559 is intended for Ethereum where a block is produced roughly every 10s
|
||||
- The dynamic fee algorithm needs to handle the case that the network quiesces and there are no blocks for a long period of time
|
||||
- Since Subnet-EVM produces blocks at a different cadence, it adapts EIP-1559 to sum the amount of gas consumed within a 10 second interval instead of using only the amount of gas consumed in the parent block
|
||||
- Since Subnet-EVM produces blocks at a different cadence, it adapts EIP-1559 to sum the amount of gas consumed within a 10-second interval instead of using only the amount of gas consumed in the parent block
|
||||
|
||||
## Consensus Engine Callbacks
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/avalanchego/utils/timer/mockable"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/trie"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/consensus/misc/eip4844"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/trie"
|
||||
"github.com/ava-labs/subnet-evm/vmerrs"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
var testBlockGasCostStep = big.NewInt(50_000)
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/avalanchego/utils/wrappers"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/subnet-evm/commontype"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
)
|
||||
|
||||
// CalcBaseFee takes the previous header and the timestamp of its child block
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/commontype"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
package constants
|
||||
|
||||
import "github.com/ethereum/go-ethereum/common"
|
||||
import "github.com/ava-labs/libevm/common"
|
||||
|
||||
var (
|
||||
BlackholeAddr = common.Address{
|
||||
|
||||
+5
-5
@@ -31,15 +31,15 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
)
|
||||
|
||||
func BenchmarkInsertChain_empty_memdb(b *testing.B) {
|
||||
|
||||
@@ -30,11 +30,11 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ava-labs/libevm/trie"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/trie"
|
||||
)
|
||||
|
||||
// BlockValidator is responsible for validating block headers, uncles and
|
||||
|
||||
+44
-46
@@ -39,6 +39,14 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/lru"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/libevm/event"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/libevm/trie"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/commontype"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/consensus/misc/eip4844"
|
||||
@@ -49,16 +57,8 @@ import (
|
||||
"github.com/ava-labs/subnet-evm/internal/version"
|
||||
"github.com/ava-labs/subnet-evm/metrics"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/trie"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/triedb/hashdb"
|
||||
"github.com/ava-labs/subnet-evm/triedb/pathdb"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/lru"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -197,18 +197,18 @@ type CacheConfig struct {
|
||||
func (c *CacheConfig) triedbConfig() *triedb.Config {
|
||||
config := &triedb.Config{Preimages: c.Preimages}
|
||||
if c.StateScheme == rawdb.HashScheme || c.StateScheme == "" {
|
||||
config.HashDB = &hashdb.Config{
|
||||
config.DBOverride = hashdb.Config{
|
||||
CleanCacheSize: c.TrieCleanLimit * 1024 * 1024,
|
||||
StatsPrefix: trieCleanCacheStatsNamespace,
|
||||
ReferenceRootAtomicallyOnUpdate: true,
|
||||
}
|
||||
ReferenceRootAtomicallyOnUpdate: true, // Automatically reference root nodes when an update is made
|
||||
}.BackendConstructor
|
||||
}
|
||||
if c.StateScheme == rawdb.PathScheme {
|
||||
config.PathDB = &pathdb.Config{
|
||||
config.DBOverride = pathdb.Config{
|
||||
StateHistory: c.StateHistory,
|
||||
CleanCacheSize: c.TrieCleanLimit * 1024 * 1024,
|
||||
DirtyCacheSize: c.TrieDirtyLimit * 1024 * 1024,
|
||||
}
|
||||
}.BackendConstructor
|
||||
}
|
||||
return config
|
||||
}
|
||||
@@ -1187,8 +1187,8 @@ func (bc *BlockChain) newTip(block *types.Block) bool {
|
||||
// canonical chain.
|
||||
// writeBlockAndSetHead expects to be the last verification step during InsertBlock
|
||||
// since it creates a reference that will only be cleaned up by Accept/Reject.
|
||||
func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB) error {
|
||||
if err := bc.writeBlockWithState(block, receipts, state); err != nil {
|
||||
func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, parentRoot common.Hash, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB) error {
|
||||
if err := bc.writeBlockWithState(block, parentRoot, receipts, state); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1205,7 +1205,7 @@ func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types
|
||||
|
||||
// writeBlockWithState writes the block and all associated state to the database,
|
||||
// but it expects the chain mutex to be held.
|
||||
func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) error {
|
||||
func (bc *BlockChain) writeBlockWithState(block *types.Block, parentRoot common.Hash, receipts []*types.Receipt, state *state.StateDB) error {
|
||||
// Irrelevant of the canonical status, write the block itself to the database.
|
||||
//
|
||||
// Note all the components of block(hash->number map, header, body, receipts)
|
||||
@@ -1219,14 +1219,8 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
||||
}
|
||||
|
||||
// Commit all cached state changes into underlying memory database.
|
||||
// If snapshots are enabled, call CommitWithSnaps to explicitly create a snapshot
|
||||
// diff layer for the block.
|
||||
var err error
|
||||
if bc.snaps == nil {
|
||||
_, err = state.Commit(block.NumberU64(), bc.chainConfig.IsEIP158(block.Number()))
|
||||
} else {
|
||||
_, err = state.CommitWithSnap(block.NumberU64(), bc.chainConfig.IsEIP158(block.Number()), bc.snaps, block.Hash(), block.ParentHash())
|
||||
}
|
||||
_, err = bc.commitWithSnap(block, parentRoot, state)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1349,16 +1343,6 @@ func (bc *BlockChain) insertBlock(block *types.Block, writes bool) error {
|
||||
blockContentValidationTimer.Inc(time.Since(substart).Milliseconds())
|
||||
|
||||
// No validation errors for the block
|
||||
var activeState *state.StateDB
|
||||
defer func() {
|
||||
// The chain importer is starting and stopping trie prefetchers. If a bad
|
||||
// block or other error is hit however, an early return may not properly
|
||||
// terminate the background threads. This defer ensures that we clean up
|
||||
// and dangling prefetcher, without deferring each and holding on live refs.
|
||||
if activeState != nil {
|
||||
activeState.StopPrefetcher()
|
||||
}
|
||||
}()
|
||||
|
||||
// Retrieve the parent block to determine which root to build state on
|
||||
substart = time.Now()
|
||||
@@ -1377,8 +1361,8 @@ func (bc *BlockChain) insertBlock(block *types.Block, writes bool) error {
|
||||
blockStateInitTimer.Inc(time.Since(substart).Milliseconds())
|
||||
|
||||
// Enable prefetching to pull in trie node paths while processing transactions
|
||||
statedb.StartPrefetcher("chain", bc.cacheConfig.TriePrefetcherParallelism)
|
||||
activeState = statedb
|
||||
statedb.StartPrefetcher("chain", state.WithConcurrentWorkers(bc.cacheConfig.TriePrefetcherParallelism))
|
||||
defer statedb.StopPrefetcher()
|
||||
|
||||
// Process block using the parent state as reference point
|
||||
pstart := time.Now()
|
||||
@@ -1429,7 +1413,7 @@ func (bc *BlockChain) insertBlock(block *types.Block, writes bool) error {
|
||||
// will be cleaned up in Accept/Reject so we need to ensure an error cannot occur
|
||||
// later in verification, since that would cause the referenced root to never be dereferenced.
|
||||
wstart := time.Now()
|
||||
if err := bc.writeBlockAndSetHead(block, receipts, logs, statedb); err != nil {
|
||||
if err := bc.writeBlockAndSetHead(block, parent.Root, receipts, logs, statedb); err != nil {
|
||||
return err
|
||||
}
|
||||
// Update the metrics touched during block commit
|
||||
@@ -1729,17 +1713,15 @@ func (bc *BlockChain) reprocessBlock(parent *types.Block, current *types.Block)
|
||||
if snap == nil {
|
||||
return common.Hash{}, fmt.Errorf("failed to get snapshot for parent root: %s", parentRoot)
|
||||
}
|
||||
statedb, err = state.NewWithSnapshot(parentRoot, bc.stateCache, snap)
|
||||
statedb, err = state.New(parentRoot, bc.stateCache, bc.snaps)
|
||||
}
|
||||
if err != nil {
|
||||
return common.Hash{}, fmt.Errorf("could not fetch state for (%s: %d): %v", parent.Hash().Hex(), parent.NumberU64(), err)
|
||||
}
|
||||
|
||||
// Enable prefetching to pull in trie node paths while processing transactions
|
||||
statedb.StartPrefetcher("chain", bc.cacheConfig.TriePrefetcherParallelism)
|
||||
defer func() {
|
||||
statedb.StopPrefetcher()
|
||||
}()
|
||||
statedb.StartPrefetcher("chain", state.WithConcurrentWorkers(bc.cacheConfig.TriePrefetcherParallelism))
|
||||
defer statedb.StopPrefetcher()
|
||||
|
||||
// Process previously stored block
|
||||
receipts, _, usedGas, err := bc.processor.Process(current, parent.Header(), statedb, vm.Config{})
|
||||
@@ -1754,12 +1736,28 @@ func (bc *BlockChain) reprocessBlock(parent *types.Block, current *types.Block)
|
||||
log.Debug("Processed block", "block", current.Hash(), "number", current.NumberU64())
|
||||
|
||||
// Commit all cached state changes into underlying memory database.
|
||||
// If snapshots are enabled, call CommitWithSnaps to explicitly create a snapshot
|
||||
// diff layer for the block.
|
||||
if bc.snaps == nil {
|
||||
return statedb.Commit(current.NumberU64(), bc.chainConfig.IsEIP158(current.Number()))
|
||||
return bc.commitWithSnap(current, parentRoot, statedb)
|
||||
}
|
||||
|
||||
func (bc *BlockChain) commitWithSnap(
|
||||
current *types.Block, parentRoot common.Hash, statedb *state.StateDB,
|
||||
) (common.Hash, error) {
|
||||
// blockHashes must be passed through Commit since snapshots are based on the
|
||||
// block hash.
|
||||
blockHashes := snapshot.WithBlockHashes(current.Hash(), current.ParentHash())
|
||||
root, err := statedb.Commit(current.NumberU64(), bc.chainConfig.IsEIP158(current.Number()), blockHashes)
|
||||
if err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
return statedb.CommitWithSnap(current.NumberU64(), bc.chainConfig.IsEIP158(current.Number()), bc.snaps, current.Hash(), current.ParentHash())
|
||||
// Upstream does not perform a snapshot update if the root is the same as the
|
||||
// parent root, however here the snapshots are based on the block hash, so
|
||||
// this update is necessary. Note blockHashes are passed here as well.
|
||||
if bc.snaps != nil && root == parentRoot {
|
||||
if err := bc.snaps.Update(root, parentRoot, nil, nil, nil, blockHashes); err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
}
|
||||
return root, nil
|
||||
}
|
||||
|
||||
// initSnapshot instantiates a Snapshot instance and adds it to [bc]
|
||||
|
||||
@@ -8,14 +8,14 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/subnet-evm/accounts/abi"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -29,6 +29,10 @@ package core
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/event"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/commontype"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/constants"
|
||||
@@ -39,10 +43,6 @@ import (
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/precompile/contracts/feemanager"
|
||||
"github.com/ava-labs/subnet-evm/precompile/contracts/rewardmanager"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
)
|
||||
|
||||
// CurrentHeader retrieves the current head header of the canonical chain. The
|
||||
|
||||
@@ -34,14 +34,14 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
)
|
||||
|
||||
// snapshotTestBasic wraps the common testing fields in the snapshot tests.
|
||||
|
||||
@@ -10,17 +10,17 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/avalanchego/upgrade"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/eth/tracers/logger"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/core/state/pruner"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/eth/tracers/logger"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/bitutil"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/subnet-evm/core/bloombits"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/bitutil"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -36,8 +36,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/bitutil"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ava-labs/libevm/common/bitutil"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
)
|
||||
|
||||
// bloomIndexes represents the bit indexes inside the bloom filter that belong
|
||||
|
||||
@@ -33,7 +33,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
)
|
||||
|
||||
const testSectionSize = 4096
|
||||
|
||||
@@ -35,12 +35,12 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/libevm/event"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// ChainIndexerBackend defines the methods needed to process chain segments in
|
||||
|
||||
@@ -35,9 +35,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// Runs multiple tests with randomized parameters.
|
||||
|
||||
@@ -30,6 +30,10 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/commontype"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
@@ -39,10 +43,6 @@ import (
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
func ExampleGenerateChain() {
|
||||
|
||||
+1
-1
@@ -27,8 +27,8 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// NewTxsEvent is posted when a batch of transactions enter the transaction pool.
|
||||
|
||||
+5
-5
@@ -30,16 +30,16 @@ import (
|
||||
"bytes"
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
ethtypes "github.com/ava-labs/libevm/core/types"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/consensus/misc/eip4844"
|
||||
"github.com/ava-labs/subnet-evm/core/extstate"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/predicate"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
gethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
@@ -152,7 +152,7 @@ func newEVMBlockContext(header *types.Header, chain ChainContext, author *common
|
||||
BaseFee: baseFee,
|
||||
BlobBaseFee: blobBaseFee,
|
||||
GasLimit: header.GasLimit,
|
||||
Header: &gethtypes.Header{
|
||||
Header: ðtypes.Header{
|
||||
Number: new(big.Int).Set(header.Number),
|
||||
Time: header.Time,
|
||||
Extra: extra,
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
package extstate
|
||||
|
||||
import (
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/predicate"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
)
|
||||
|
||||
type VmStateDB interface {
|
||||
vm.StateDB
|
||||
Logs() []*types.Log
|
||||
|
||||
GetTxHash() common.Hash
|
||||
GetLogData() (topics [][]common.Hash, data [][]byte)
|
||||
}
|
||||
|
||||
type StateDB struct {
|
||||
@@ -31,6 +32,16 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
|
||||
s.VmStateDB.Prepare(rules, sender, coinbase, dst, precompiles, list)
|
||||
}
|
||||
|
||||
// GetLogData returns the underlying topics and data from each log included in the StateDB
|
||||
// Test helper function.
|
||||
func (s *StateDB) GetLogData() (topics [][]common.Hash, data [][]byte) {
|
||||
for _, log := range s.Logs() {
|
||||
topics = append(topics, log.Topics)
|
||||
data = append(data, common.CopyBytes(log.Data))
|
||||
}
|
||||
return topics, data
|
||||
}
|
||||
|
||||
// GetPredicateStorageSlots returns the storage slots associated with the address, index pair.
|
||||
// A list of access tuples can be included within transaction types post EIP-2930. The address
|
||||
// is declared directly on the access tuple and the index is the i'th occurrence of an access
|
||||
|
||||
@@ -5,10 +5,10 @@ package extstate
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/precompile/contract"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
+4
-4
@@ -8,10 +8,10 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/hexutil"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/libevm/params"
|
||||
)
|
||||
|
||||
var _ = (*genesisSpecMarshaling)(nil)
|
||||
|
||||
+10
-10
@@ -33,19 +33,19 @@ import (
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/hexutil"
|
||||
"github.com/ava-labs/libevm/common/math"
|
||||
"github.com/ava-labs/libevm/crypto"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/libevm/log"
|
||||
"github.com/ava-labs/libevm/trie"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/trie"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/triedb/pathdb"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
@@ -230,8 +230,8 @@ func (g *Genesis) trieConfig() *triedb.Config {
|
||||
return nil
|
||||
}
|
||||
return &triedb.Config{
|
||||
PathDB: pathdb.Defaults,
|
||||
IsVerkle: true,
|
||||
DBOverride: pathdb.Defaults.BackendConstructor,
|
||||
IsVerkle: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/libevm/trie"
|
||||
"github.com/ava-labs/libevm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/state"
|
||||
@@ -40,14 +45,9 @@ import (
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ava-labs/subnet-evm/precompile/allowlist"
|
||||
"github.com/ava-labs/subnet-evm/precompile/contracts/deployerallowlist"
|
||||
"github.com/ava-labs/subnet-evm/trie"
|
||||
"github.com/ava-labs/subnet-evm/triedb"
|
||||
"github.com/ava-labs/subnet-evm/triedb/pathdb"
|
||||
"github.com/ava-labs/subnet-evm/utils"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -351,7 +351,7 @@ func newDbConfig(scheme string) *triedb.Config {
|
||||
if scheme == rawdb.HashScheme {
|
||||
return triedb.HashDefaults
|
||||
}
|
||||
return &triedb.Config{PathDB: pathdb.Defaults}
|
||||
return &triedb.Config{DBOverride: pathdb.Defaults.BackendConstructor}
|
||||
}
|
||||
|
||||
func TestVerkleGenesisCommit(t *testing.T) {
|
||||
@@ -391,7 +391,7 @@ func TestVerkleGenesisCommit(t *testing.T) {
|
||||
}
|
||||
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
triedb := triedb.NewDatabase(db, &triedb.Config{IsVerkle: true, PathDB: pathdb.Defaults})
|
||||
triedb := triedb.NewDatabase(db, &triedb.Config{IsVerkle: true, DBOverride: pathdb.Defaults.BackendConstructor})
|
||||
block := genesis.MustCommit(db, triedb)
|
||||
if !bytes.Equal(block.Root().Bytes(), expected) {
|
||||
t.Fatalf("invalid genesis state root, expected %x, got %x", expected, got)
|
||||
|
||||
+3
-3
@@ -33,13 +33,13 @@ import (
|
||||
mrand "math/rand"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/common/lru"
|
||||
"github.com/ava-labs/libevm/ethdb"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/lru"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -32,13 +32,13 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/ava-labs/libevm/common"
|
||||
"github.com/ava-labs/libevm/core/vm"
|
||||
"github.com/ava-labs/subnet-evm/consensus"
|
||||
"github.com/ava-labs/subnet-evm/consensus/dummy"
|
||||
"github.com/ava-labs/subnet-evm/core/rawdb"
|
||||
"github.com/ava-labs/subnet-evm/core/types"
|
||||
"github.com/ava-labs/subnet-evm/params"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
)
|
||||
|
||||
func verifyUnbrokenCanonchain(bc *BlockChain) error {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user