diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000000..8200c0597f1 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,5 @@ +## Why this should be merged + +## How this works + +## How this was tested diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0c673d15f16..1c4efd9734a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,23 +1,24 @@ -name: i386 linux tests +name: Go on: - push: - branches: [ master ] - pull_request: - branches: [ master ] + # DO NOT MERGE: disabled while developing auto-renaming + # push: + # branches: [ main ] + # pull_request: + # branches: [ main ] workflow_dispatch: jobs: - build: - runs-on: self-hosted + go_test_short: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: 1.21.4 - name: Run tests - run: go test -short ./... - env: - GOOS: linux - GOARCH: 386 + run: | # Upstream flakes are race conditions exacerbated by concurrent tests + FLAKY_REGEX='go-ethereum/(eth|eth/tracers/js|eth/tracers/logger|accounts/abi/bind|accounts/keystore|eth/downloader|miner|ethclient|ethclient/gethclient|eth/catalyst)$'; + go list ./... | grep -P "${FLAKY_REGEX}" | xargs -n 1 go test -short; + go test -short $(go list ./... | grep -Pv "${FLAKY_REGEX}"); diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 00000000000..f7e6d197b08 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,26 @@ +name: golangci-lint + +on: + # DO NOT MERGE: disabled while developing auto-renaming + # push: + # branches: [ main ] + # pull_request: + # branches: [ main ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 diff --git a/.github/workflows/libevm-delta.yml b/.github/workflows/libevm-delta.yml new file mode 100644 index 00000000000..01caed2ced2 --- /dev/null +++ b/.github/workflows/libevm-delta.yml @@ -0,0 +1,39 @@ +name: libevm delta + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + diffs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # everything + fetch-tags: true + + - name: Color-blindness a11y + run: | # https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40:~:text=8%20pairs%20of%20contrasting%20colors + git config color.diff.old "#DC3220"; + git config color.diff.new "#005AB5"; + + - name: git diff libevm-base + run: | + git diff --diff-filter=a --word-diff --unified=0 --color=always \ + libevm-base \ + ':(exclude).golangci.yml' \ + ':(exclude).github/**' \ + ':(exclude)README.md'; + + - name: git diff libevm-base..main + run: | + git checkout main --; + git diff --diff-filter=a --word-diff --unified=0 --color=always \ + libevm-base \ + ':(exclude).golangci.yml' \ + ':(exclude).github/**' \ + ':(exclude)README.md'; diff --git a/.github/workflows/rename-module.yml b/.github/workflows/rename-module.yml new file mode 100644 index 00000000000..54d9f9a6ad4 --- /dev/null +++ b/.github/workflows/rename-module.yml @@ -0,0 +1,72 @@ +name: Rename Go module + +on: + pull_request: # DO NOT MERGE WITH ANYTHING OTHER THAN workflow_dispatch + branches: [ main ] + workflow_dispatch: + inputs: + source_commit: + description: 'Upstream commit on which to base module renaming' + required: true + type: string + default: '2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1' + +jobs: + rename-module: + runs-on: ubuntu-latest + env: + output_branch: "${{ github.ref_name }}_auto-rename-module-${{ inputs.source_commit }}" + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # everything + fetch-tags: true + + - name: Check out source commit + run: git checkout ${{ inputs.source_commit }} + + - name: Globally update module name + run: | + go mod edit -module github.com/ava-labs/libevm; + find . -iname '*.go' -o -iname '*.txt' | xargs sed -i -E \ + 's|(["`]github\.com/)ethereum/go-ethereum|\1ava-labs/libevm|g'; + + - name: Remnant references + run: | + find . -type f | \ + xargs grep -In github.com/ethereum/go-ethereum | \ + grep -v "https://github.com/ethereum/go-ethereum" + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.21.4 + + - name: Smoke tests + # `go list` shows us the module name + # `go build` is a rudimentary but broad test of correctness + # The explicitly tested packages are edge cases: + # - bind creates generates tests and a go.mod on the fly + # - rlpgen has testdata with imports that need updating + run: | + go list . | grep ava-labs/libevm; + go build ./...; + go test ./accounts/abi/bind ./rlp/rlpgen + + - name: Commit to ${{ env.output_branch }} branch + uses: devops-infra/action-commit-push@8bc2ff9f9de7aa2a7581fc7e5b6401c04cab54c7 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + target_branch: ${{ env.output_branch }} + force: true + commit_prefix: "[AUTO] rename Go module + update internal import paths" + + - name: Open PR to "renamed-go-module" iff workflow dispatched on "main" + # if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' + uses: devops-infra/action-pull-request@v0.5.5 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + source_branch: ${{ env.output_branch }} + target_branch: renamed-go-module + title: "[AUTO] Rename upstream Go module at `${{ inputs.source_commit }}`" + body: "_PR generated by GitHub Action_" diff --git a/.golangci.yml b/.golangci.yml index 0343c4b4ebf..6d181550500 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,58 +3,119 @@ run: timeout: 20m tests: true - # default is true. Enables skipping of directories: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs-use-default: true - skip-files: - - core/genesis_alloc.go linters: - disable-all: true enable: + # Every available linter at the time of writing was considered (quickly) and + # inclusion was liberal. Linters are good at detecting code smells, but if + # we find that a particular one causes too many false positives then we can + # configure it better or, as a last resort, remove it. + - containedctx + - errcheck + - forcetypeassert + - gci + - gocheckcompilerdirectives + - gofmt + - goheader - goimports - - gosimple + - gomodguard + - gosec - govet - ineffassign + # TODO(arr4n): investigate ireturn - misspell + - nakedret + - nestif + - nilerr + - nolintlint + - reassign + - revive + - sloglint + - staticcheck + - tagliatelle + - testableexamples + - testifylint + - thelper + - tparallel - unconvert - - typecheck + - usestdlibvars - unused - - staticcheck - - bidichk - - durationcheck - - exportloopref - whitespace - # - structcheck # lots of false positives - # - errcheck #lot of false positives - # - contextcheck - # - errchkjson # lots of false positives - # - errorlint # this check crashes - # - exhaustive # silly check - # - makezero # false positives - # - nilerr # several intentional - linters-settings: - gofmt: - simplify: true + gci: + custom-order: true + sections: + - standard + - default + - localmodule + # The rest of these break developer expections, in increasing order of + # divergence, so are at the end to increase the chance of being seen. + - alias + - dot + - blank + goheader: + values: + template-path: .libevm-header + + gomodguard: + blocked: + modules: + - github.com/ava-labs/avalanchego: + - github.com/ava-labs/coreth: + - github.com/ava-labs/subnet-evm: + revive: + rules: + - name: unused-parameter + # Method parameters may be equired by interfaces and forcing them to be + # named _ is of questionable benefit. + disabled: true issues: - exclude-rules: - - path: crypto/bn256/cloudflare/optate.go + exclude-dirs-use-default: false + exclude-rules: + - path-except: libevm linters: - - deadcode + # If any issue is flagged in a non-libevm file, add the linter here + # because the problem isn't under our control. + - containedctx + - forcetypeassert + - errcheck + - gci + - gofmt + - goheader + - gosec + - gosimple + - govet + - nakedret + - nestif + - nilerr + - nolintlint + - revive - staticcheck - - path: internal/build/pgp.go - text: 'SA1019: "golang.org/x/crypto/openpgp" is deprecated: this package is unmaintained except for security fixes.' - - path: core/vm/contracts.go - text: 'SA1019: "golang.org/x/crypto/ripemd160" is deprecated: RIPEMD-160 is a legacy hash and should not be used for new applications.' - - path: accounts/usbwallet/trezor.go - text: 'SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead.' - - path: accounts/usbwallet/trezor/ - text: 'SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead.' - exclude: - - 'SA1019: event.TypeMux is deprecated: use Feed' - - 'SA1019: strings.Title is deprecated' - - 'SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.' - - 'SA1029: should not use built-in type string as key for value' + - tagliatelle + - testableexamples + - testifylint + - thelper + - tparallel + - typecheck + - usestdlibvars + - varnamelen + - wastedassign + - whitespace + include: + # Many of the default exclusions are because, verbatim "Annoying issue", + # which defeats the point of a linter. + - EXC0002 + - EXC0004 + - EXC0005 + - EXC0006 + - EXC0007 + - EXC0008 + - EXC0009 + - EXC0010 + - EXC0011 + - EXC0012 + - EXC0013 + - EXC0014 + - EXC0015 diff --git a/.libevm-header b/.libevm-header new file mode 100644 index 00000000000..f8685d93f28 --- /dev/null +++ b/.libevm-header @@ -0,0 +1,15 @@ +Copyright {{ MOD-YEAR }} the libevm authors. + +The libevm additions to go-ethereum are free software: you can redistribute +them and/or modify them under the terms of the GNU Lesser General Public License +as published by the Free Software Foundation, either version 3 of the License, +or (at your option) any later version. + +The libevm additions are distributed in the hope that they will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the go-ethereum library. If not, see +. diff --git a/README.md b/README.md index 1e8dba80909..efb72b5b078 100644 --- a/README.md +++ b/README.md @@ -356,3 +356,9 @@ also included in our repository in the `COPYING.LESSER` file. The go-ethereum binaries (i.e. all code inside of the `cmd` directory) are licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), also included in our repository in the `COPYING` file. + +The libevm (i) _additions_ to the go-ethereum library (i.e. all code in files with `libevm` in their full path, +be it a directory or file name); and (ii) _modifications_ to existing go-ethereum code; are licensed under the +[GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html), +also included in our repository in the `COPYING.LESSER` file. A comprehensive outline of _modifications_ is +produced by the [libevm delta workflow](https://github.com/ava-labs/libevm/actions/workflows/libevm-delta.yml). diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go index c7bc2b4541f..d086eeeb2d1 100644 --- a/accounts/abi/abi.go +++ b/accounts/abi/abi.go @@ -24,8 +24,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 diff --git a/accounts/abi/abi_test.go b/accounts/abi/abi_test.go index bc76df0dc26..b21218de3e0 100644 --- a/accounts/abi/abi_test.go +++ b/accounts/abi/abi_test.go @@ -26,9 +26,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" ) const jsondata = ` diff --git a/accounts/abi/bind/auth.go b/accounts/abi/bind/auth.go index 0740c695102..a323f2d4f96 100644 --- a/accounts/abi/bind/auth.go +++ b/accounts/abi/bind/auth.go @@ -23,13 +23,13 @@ import ( "io" "math/big" - "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/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" + "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/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" ) // ErrNoChainID is returned whenever the user failed to specify a chain id. diff --git a/accounts/abi/bind/backend.go b/accounts/abi/bind/backend.go index 38b30469708..8c77aa61bab 100644 --- a/accounts/abi/bind/backend.go +++ b/accounts/abi/bind/backend.go @@ -21,9 +21,9 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) var ( diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index dfd92969528..da58df5ae3c 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -19,9 +19,9 @@ package backends import ( "context" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient/simulated" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethclient/simulated" ) // SimulatedBackend is a simulated blockchain. diff --git a/accounts/abi/bind/base.go b/accounts/abi/bind/base.go index 96d284cdcc0..252fea64fb0 100644 --- a/accounts/abi/bind/base.go +++ b/accounts/abi/bind/base.go @@ -24,12 +24,12 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/event" ) const basefeeWiggleMultiplier = 2 diff --git a/accounts/abi/bind/base_test.go b/accounts/abi/bind/base_test.go index f7eb7d14d3e..8c2ea04800e 100644 --- a/accounts/abi/bind/base_test.go +++ b/accounts/abi/bind/base_test.go @@ -24,14 +24,14 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" "github.com/stretchr/testify/assert" ) diff --git a/accounts/abi/bind/bind.go b/accounts/abi/bind/bind.go index e902345f090..64ce1008706 100644 --- a/accounts/abi/bind/bind.go +++ b/accounts/abi/bind/bind.go @@ -29,8 +29,8 @@ import ( "text/template" "unicode" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/log" ) // Lang is a target programming language selector to generate bindings for. diff --git a/accounts/abi/bind/bind_test.go b/accounts/abi/bind/bind_test.go index a390a3c47c7..24d3cb0bb05 100644 --- a/accounts/abi/bind/bind_test.go +++ b/accounts/abi/bind/bind_test.go @@ -25,7 +25,7 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) var bindTests = []struct { @@ -46,7 +46,7 @@ var bindTests = []struct { `contract NilContract {}`, []string{`606060405260068060106000396000f3606060405200`}, []string{`[]`}, - `"github.com/ethereum/go-ethereum/common"`, + `"github.com/ava-labs/libevm/common"`, ` if b, err := NewEmpty(common.Address{}, nil); b == nil || err != nil { t.Fatalf("combined binding (%v) nil or error (%v) not nil", b, nil) @@ -69,7 +69,7 @@ var bindTests = []struct { `https://ethereum.org/token`, []string{`60606040526040516107fd3803806107fd83398101604052805160805160a05160c051929391820192909101600160a060020a0333166000908152600360209081526040822086905581548551838052601f6002600019610100600186161502019093169290920482018390047f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56390810193919290918801908390106100e857805160ff19168380011785555b506101189291505b8082111561017157600081556001016100b4565b50506002805460ff19168317905550505050610658806101a56000396000f35b828001600101855582156100ac579182015b828111156100ac5782518260005055916020019190600101906100fa565b50508060016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061017557805160ff19168380011785555b506100c89291506100b4565b5090565b82800160010185558215610165579182015b8281111561016557825182600050559160200191906001019061018756606060405236156100775760e060020a600035046306fdde03811461007f57806323b872dd146100dc578063313ce5671461010e57806370a082311461011a57806395d89b4114610132578063a9059cbb1461018e578063cae9ca51146101bd578063dc3080f21461031c578063dd62ed3e14610341575b610365610002565b61036760008054602060026001831615610100026000190190921691909104601f810182900490910260809081016040526060828152929190828280156104eb5780601f106104c0576101008083540402835291602001916104eb565b6103d5600435602435604435600160a060020a038316600090815260036020526040812054829010156104f357610002565b6103e760025460ff1681565b6103d560043560036020526000908152604090205481565b610367600180546020600282841615610100026000190190921691909104601f810182900490910260809081016040526060828152929190828280156104eb5780601f106104c0576101008083540402835291602001916104eb565b610365600435602435600160a060020a033316600090815260036020526040902054819010156103f157610002565b60806020604435600481810135601f8101849004909302840160405260608381526103d5948235946024803595606494939101919081908382808284375094965050505050505060006000836004600050600033600160a060020a03168152602001908152602001600020600050600087600160a060020a031681526020019081526020016000206000508190555084905080600160a060020a0316638f4ffcb1338630876040518560e060020a0281526004018085600160a060020a0316815260200184815260200183600160a060020a03168152602001806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156102f25780820380516001836020036101000a031916815260200191505b50955050505050506000604051808303816000876161da5a03f11561000257505050509392505050565b6005602090815260043560009081526040808220909252602435815220546103d59081565b60046020818152903560009081526040808220909252602435815220546103d59081565b005b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156103c75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051918252519081900360200190f35b6060908152602090f35b600160a060020a03821660009081526040902054808201101561041357610002565b806003600050600033600160a060020a03168152602001908152602001600020600082828250540392505081905550806003600050600084600160a060020a0316815260200190815260200160002060008282825054019250508190555081600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b820191906000526020600020905b8154815290600101906020018083116104ce57829003601f168201915b505050505081565b600160a060020a03831681526040812054808301101561051257610002565b600160a060020a0380851680835260046020908152604080852033949094168086529382528085205492855260058252808520938552929052908220548301111561055c57610002565b816003600050600086600160a060020a03168152602001908152602001600020600082828250540392505081905550816003600050600085600160a060020a03168152602001908152602001600020600082828250540192505081905550816005600050600086600160a060020a03168152602001908152602001600020600050600033600160a060020a0316815260200190815260200160002060008282825054019250508190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3939250505056`}, []string{`[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"spentAllowance","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"inputs":[{"name":"initialSupply","type":"uint256"},{"name":"tokenName","type":"string"},{"name":"decimalUnits","type":"uint8"},{"name":"tokenSymbol","type":"string"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]`}, - `"github.com/ethereum/go-ethereum/common"`, + `"github.com/ava-labs/libevm/common"`, ` if b, err := NewToken(common.Address{}, nil); b == nil || err != nil { t.Fatalf("binding (%v) nil or error (%v) not nil", b, nil) @@ -85,7 +85,7 @@ var bindTests = []struct { `https://ethereum.org/crowdsale`, []string{`606060408190526007805460ff1916905560a0806105a883396101006040529051608051915160c05160e05160008054600160a060020a03199081169095178155670de0b6b3a7640000958602600155603c9093024201600355930260045560058054909216909217905561052f90819061007990396000f36060604052361561006c5760e060020a600035046301cb3b20811461008257806329dcb0cf1461014457806338af3eed1461014d5780636e66f6e91461015f5780637a3a0e84146101715780637b3e5e7b1461017a578063a035b1fe14610183578063dc0d3dff1461018c575b61020060075460009060ff161561032357610002565b61020060035460009042106103205760025460015490106103cb576002548154600160a060020a0316908290606082818181858883f150915460025460408051600160a060020a039390931683526020830191909152818101869052517fe842aea7a5f1b01049d752008c53c52890b1a6daf660cf39e8eec506112bbdf6945090819003909201919050a15b60405160008054600160a060020a039081169230909116319082818181858883f150506007805460ff1916600117905550505050565b6103a160035481565b6103ab600054600160a060020a031681565b6103ab600554600160a060020a031681565b6103a160015481565b6103a160025481565b6103a160045481565b6103be60043560068054829081101561000257506000526002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8101547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d409190910154600160a060020a03919091169082565b005b505050815481101561000257906000526020600020906002020160005060008201518160000160006101000a815481600160a060020a030219169083021790555060208201518160010160005055905050806002600082828250540192505081905550600560009054906101000a9004600160a060020a0316600160a060020a031663a9059cbb3360046000505484046040518360e060020a0281526004018083600160a060020a03168152602001828152602001925050506000604051808303816000876161da5a03f11561000257505060408051600160a060020a03331681526020810184905260018183015290517fe842aea7a5f1b01049d752008c53c52890b1a6daf660cf39e8eec506112bbdf692509081900360600190a15b50565b5060a0604052336060908152346080819052600680546001810180835592939282908280158290116102025760020281600202836000526020600020918201910161020291905b8082111561039d57805473ffffffffffffffffffffffffffffffffffffffff19168155600060019190910190815561036a565b5090565b6060908152602090f35b600160a060020a03166060908152602090f35b6060918252608052604090f35b5b60065481101561010e576006805482908110156100025760009182526002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0190600680549254600160a060020a0316928490811015610002576002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d40015460405190915082818181858883f19350505050507fe842aea7a5f1b01049d752008c53c52890b1a6daf660cf39e8eec506112bbdf660066000508281548110156100025760008290526002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01548154600160a060020a039190911691908490811015610002576002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d40015460408051600160a060020a0394909416845260208401919091526000838201525191829003606001919050a16001016103cc56`}, []string{`[{"constant":false,"inputs":[],"name":"checkGoalReached","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"deadline","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"beneficiary","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"tokenReward","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"fundingGoal","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"amountRaised","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"price","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"funders","outputs":[{"name":"addr","type":"address"},{"name":"amount","type":"uint256"}],"type":"function"},{"inputs":[{"name":"ifSuccessfulSendTo","type":"address"},{"name":"fundingGoalInEthers","type":"uint256"},{"name":"durationInMinutes","type":"uint256"},{"name":"etherCostOfEachToken","type":"uint256"},{"name":"addressOfTokenUsedAsReward","type":"address"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"backer","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"isContribution","type":"bool"}],"name":"FundTransfer","type":"event"}]`}, - `"github.com/ethereum/go-ethereum/common"`, + `"github.com/ava-labs/libevm/common"`, ` if b, err := NewCrowdsale(common.Address{}, nil); b == nil || err != nil { t.Fatalf("binding (%v) nil or error (%v) not nil", b, nil) @@ -101,7 +101,7 @@ var bindTests = []struct { `https://ethereum.org/dao`, []string{`606060405260405160808061145f833960e06040529051905160a05160c05160008054600160a060020a03191633179055600184815560028490556003839055600780549182018082558280158290116100b8576003028160030283600052602060002091820191016100b891906101c8565b50506060919091015160029190910155600160a060020a0381166000146100a65760008054600160a060020a031916821790555b505050506111f18061026e6000396000f35b505060408051608081018252600080825260208281018290528351908101845281815292820192909252426060820152600780549194509250811015610002579081527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6889050815181546020848101517401000000000000000000000000000000000000000002600160a060020a03199290921690921760a060020a60ff021916178255604083015180516001848101805460008281528690209195600293821615610100026000190190911692909204601f9081018390048201949192919091019083901061023e57805160ff19168380011785555b50610072929150610226565b5050600060028201556001015b8082111561023a578054600160a860020a031916815560018181018054600080835592600290821615610100026000190190911604601f81901061020c57506101bb565b601f0160209004906000526020600020908101906101bb91905b8082111561023a5760008155600101610226565b5090565b828001600101855582156101af579182015b828111156101af57825182600050559160200191906001019061025056606060405236156100b95760e060020a6000350463013cf08b81146100bb578063237e9492146101285780633910682114610281578063400e3949146102995780635daf08ca146102a257806369bd34361461032f5780638160f0b5146103385780638da5cb5b146103415780639644fcbd14610353578063aa02a90f146103be578063b1050da5146103c7578063bcca1fd3146104b5578063d3c0715b146104dc578063eceb29451461058d578063f2fde38b1461067b575b005b61069c6004356004805482908110156100025790600052602060002090600a02016000506005810154815460018301546003840154600485015460068601546007870154600160a060020a03959095169750929560020194919360ff828116946101009093041692919089565b60408051602060248035600481810135601f81018590048502860185019096528585526107759581359591946044949293909201918190840183828082843750949650505050505050600060006004600050848154811015610002575090527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e600a8402908101547f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b909101904210806101e65750600481015460ff165b8061026757508060000160009054906101000a9004600160a060020a03168160010160005054846040518084600160a060020a0316606060020a0281526014018381526020018280519060200190808383829060006004602084601f0104600f02600301f15090500193505050506040518091039020816007016000505414155b8061027757506001546005820154105b1561109257610002565b61077560043560066020526000908152604090205481565b61077560055481565b61078760043560078054829081101561000257506000526003026000805160206111d18339815191528101547fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68a820154600160a060020a0382169260a060020a90920460ff16917fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c689019084565b61077560025481565b61077560015481565b610830600054600160a060020a031681565b604080516020604435600481810135601f81018490048402850184019095528484526100b9948135946024803595939460649492939101918190840183828082843750949650505050505050600080548190600160a060020a03908116339091161461084d57610002565b61077560035481565b604080516020604435600481810135601f8101849004840285018401909552848452610775948135946024803595939460649492939101918190840183828082843750506040805160209735808a0135601f81018a90048a0283018a019093528282529698976084979196506024909101945090925082915084018382808284375094965050505050505033600160a060020a031660009081526006602052604081205481908114806104ab5750604081205460078054909190811015610002579082526003026000805160206111d1833981519152015460a060020a900460ff16155b15610ce557610002565b6100b960043560243560443560005433600160a060020a03908116911614610b1857610002565b604080516020604435600481810135601f810184900484028501840190955284845261077594813594602480359593946064949293910191819084018382808284375094965050505050505033600160a060020a031660009081526006602052604081205481908114806105835750604081205460078054909190811015610002579082526003026000805160206111d18339815191520181505460a060020a900460ff16155b15610f1d57610002565b604080516020606435600481810135601f81018490048402850184019095528484526107759481359460248035956044359560849492019190819084018382808284375094965050505050505060006000600460005086815481101561000257908252600a027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01815090508484846040518084600160a060020a0316606060020a0281526014018381526020018280519060200190808383829060006004602084601f0104600f02600301f150905001935050505060405180910390208160070160005054149150610cdc565b6100b960043560005433600160a060020a03908116911614610f0857610002565b604051808a600160a060020a031681526020018981526020018060200188815260200187815260200186815260200185815260200184815260200183815260200182810382528981815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561075e5780601f106107335761010080835404028352916020019161075e565b820191906000526020600020905b81548152906001019060200180831161074157829003601f168201915b50509a505050505050505050505060405180910390f35b60408051918252519081900360200190f35b60408051600160a060020a038616815260208101859052606081018390526080918101828152845460026001821615610100026000190190911604928201839052909160a08301908590801561081e5780601f106107f35761010080835404028352916020019161081e565b820191906000526020600020905b81548152906001019060200180831161080157829003601f168201915b50509550505050505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b600160a060020a03851660009081526006602052604081205414156108a957604060002060078054918290556001820180825582801582901161095c5760030281600302836000526020600020918201910161095c9190610a4f565b600160a060020a03851660009081526006602052604090205460078054919350908390811015610002575060005250600381026000805160206111d183398151915201805474ff0000000000000000000000000000000000000000191660a060020a85021781555b60408051600160a060020a03871681526020810186905281517f27b022af4a8347100c7a041ce5ccf8e14d644ff05de696315196faae8cd50c9b929181900390910190a15050505050565b505050915081506080604051908101604052808681526020018581526020018481526020014281526020015060076000508381548110156100025790600052602060002090600302016000508151815460208481015160a060020a02600160a060020a03199290921690921774ff00000000000000000000000000000000000000001916178255604083015180516001848101805460008281528690209195600293821615610100026000190190911692909204601f90810183900482019491929190910190839010610ad357805160ff19168380011785555b50610b03929150610abb565b5050600060028201556001015b80821115610acf57805474ffffffffffffffffffffffffffffffffffffffffff1916815560018181018054600080835592600290821615610100026000190190911604601f819010610aa15750610a42565b601f016020900490600052602060002090810190610a4291905b80821115610acf5760008155600101610abb565b5090565b82800160010185558215610a36579182015b82811115610a36578251826000505591602001919060010190610ae5565b50506060919091015160029190910155610911565b600183905560028290556003819055604080518481526020810184905280820183905290517fa439d3fa452be5e0e1e24a8145e715f4fd8b9c08c96a42fd82a855a85e5d57de9181900360600190a1505050565b50508585846040518084600160a060020a0316606060020a0281526014018381526020018280519060200190808383829060006004602084601f0104600f02600301f150905001935050505060405180910390208160070160005081905550600260005054603c024201816003016000508190555060008160040160006101000a81548160ff0219169083021790555060008160040160016101000a81548160ff02191690830217905550600081600501600050819055507f646fec02522b41e7125cfc859a64fd4f4cefd5dc3b6237ca0abe251ded1fa881828787876040518085815260200184600160a060020a03168152602001838152602001806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f168015610cc45780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a1600182016005555b50949350505050565b6004805460018101808355909190828015829011610d1c57600a0281600a028360005260206000209182019101610d1c9190610db8565b505060048054929450918491508110156100025790600052602060002090600a02016000508054600160a060020a031916871781556001818101879055855160028381018054600082815260209081902096975091959481161561010002600019011691909104601f90810182900484019391890190839010610ed857805160ff19168380011785555b50610b6c929150610abb565b50506001015b80821115610acf578054600160a060020a03191681556000600182810182905560028381018054848255909281161561010002600019011604601f819010610e9c57505b5060006003830181905560048301805461ffff191690556005830181905560068301819055600783018190556008830180548282559082526020909120610db2916002028101905b80821115610acf57805474ffffffffffffffffffffffffffffffffffffffffff1916815560018181018054600080835592600290821615610100026000190190911604601f819010610eba57505b5050600101610e44565b601f016020900490600052602060002090810190610dfc9190610abb565b601f016020900490600052602060002090810190610e929190610abb565b82800160010185558215610da6579182015b82811115610da6578251826000505591602001919060010190610eea565b60008054600160a060020a0319168217905550565b600480548690811015610002576000918252600a027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01905033600160a060020a0316600090815260098201602052604090205490915060ff1660011415610f8457610002565b33600160a060020a031660009081526009820160205260409020805460ff1916600190811790915560058201805490910190558315610fcd576006810180546001019055610fda565b6006810180546000190190555b7fc34f869b7ff431b034b7b9aea9822dac189a685e0b015c7d1be3add3f89128e8858533866040518085815260200184815260200183600160a060020a03168152602001806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f16801561107a5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a1509392505050565b6006810154600354901315611158578060000160009054906101000a9004600160a060020a0316600160a060020a03168160010160005054670de0b6b3a76400000284604051808280519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156111225780820380516001836020036101000a031916815260200191505b5091505060006040518083038185876185025a03f15050505060048101805460ff191660011761ff00191661010017905561116d565b60048101805460ff191660011761ff00191690555b60068101546005820154600483015460408051888152602081019490945283810192909252610100900460ff166060830152517fd220b7272a8b6d0d7d6bcdace67b936a8f175e6d5c1b3ee438b72256b32ab3af9181900360800190a1509291505056a66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688`}, []string{`[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"proposals","outputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"},{"name":"description","type":"string"},{"name":"votingDeadline","type":"uint256"},{"name":"executed","type":"bool"},{"name":"proposalPassed","type":"bool"},{"name":"numberOfVotes","type":"uint256"},{"name":"currentResult","type":"int256"},{"name":"proposalHash","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"proposalNumber","type":"uint256"},{"name":"transactionBytecode","type":"bytes"}],"name":"executeProposal","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"memberId","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"numProposals","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"members","outputs":[{"name":"member","type":"address"},{"name":"canVote","type":"bool"},{"name":"name","type":"string"},{"name":"memberSince","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"debatingPeriodInMinutes","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"minimumQuorum","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"targetMember","type":"address"},{"name":"canVote","type":"bool"},{"name":"memberName","type":"string"}],"name":"changeMembership","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"majorityMargin","outputs":[{"name":"","type":"int256"}],"type":"function"},{"constant":false,"inputs":[{"name":"beneficiary","type":"address"},{"name":"etherAmount","type":"uint256"},{"name":"JobDescription","type":"string"},{"name":"transactionBytecode","type":"bytes"}],"name":"newProposal","outputs":[{"name":"proposalID","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"minimumQuorumForProposals","type":"uint256"},{"name":"minutesForDebate","type":"uint256"},{"name":"marginOfVotesForMajority","type":"int256"}],"name":"changeVotingRules","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"proposalNumber","type":"uint256"},{"name":"supportsProposal","type":"bool"},{"name":"justificationText","type":"string"}],"name":"vote","outputs":[{"name":"voteID","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"proposalNumber","type":"uint256"},{"name":"beneficiary","type":"address"},{"name":"etherAmount","type":"uint256"},{"name":"transactionBytecode","type":"bytes"}],"name":"checkProposalCode","outputs":[{"name":"codeChecksOut","type":"bool"}],"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"type":"function"},{"inputs":[{"name":"minimumQuorumForProposals","type":"uint256"},{"name":"minutesForDebate","type":"uint256"},{"name":"marginOfVotesForMajority","type":"int256"},{"name":"congressLeader","type":"address"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"proposalID","type":"uint256"},{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"description","type":"string"}],"name":"ProposalAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"proposalID","type":"uint256"},{"indexed":false,"name":"position","type":"bool"},{"indexed":false,"name":"voter","type":"address"},{"indexed":false,"name":"justification","type":"string"}],"name":"Voted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"proposalID","type":"uint256"},{"indexed":false,"name":"result","type":"int256"},{"indexed":false,"name":"quorum","type":"uint256"},{"indexed":false,"name":"active","type":"bool"}],"name":"ProposalTallied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"member","type":"address"},{"indexed":false,"name":"isMember","type":"bool"}],"name":"MembershipChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"minimumQuorum","type":"uint256"},{"indexed":false,"name":"debatingPeriodInMinutes","type":"uint256"},{"indexed":false,"name":"majorityMargin","type":"int256"}],"name":"ChangeOfRules","type":"event"}]`}, - `"github.com/ethereum/go-ethereum/common"`, + `"github.com/ava-labs/libevm/common"`, ` if b, err := NewDAO(common.Address{}, nil); b == nil || err != nil { t.Fatalf("binding (%v) nil or error (%v) not nil", b, nil) @@ -128,7 +128,7 @@ var bindTests = []struct { ` "fmt" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" `, `if b, err := NewInputChecker(common.Address{}, nil); b == nil || err != nil { t.Fatalf("binding (%v) nil or error (%v) not nil", b, nil) @@ -166,7 +166,7 @@ var bindTests = []struct { ` "fmt" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" `, `if b, err := NewOutputChecker(common.Address{}, nil); b == nil || err != nil { t.Fatalf("binding (%v) nil or error (%v) not nil", b, nil) @@ -207,7 +207,7 @@ var bindTests = []struct { "math/big" "reflect" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" `, `if e, err := NewEventChecker(common.Address{}, nil); e == nil || err != nil { t.Fatalf("binding (%v) nil or error (%v) not nil", e, nil) @@ -287,10 +287,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -343,10 +343,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -389,10 +389,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -446,11 +446,11 @@ var bindTests = []struct { "math/big" "reflect" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -495,10 +495,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -562,10 +562,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -607,10 +607,10 @@ var bindTests = []struct { []string{`6060604052609f8060106000396000f3606060405260e060020a6000350463f97a60058114601a575b005b600060605260c0604052600d60809081527f4920646f6e27742065786973740000000000000000000000000000000000000060a052602060c0908152600d60e081905281906101009060a09080838184600060046012f15050815172ffffffffffffffffffffffffffffffffffffff1916909152505060405161012081900392509050f3`}, []string{`[{"constant":true,"inputs":[],"name":"String","outputs":[{"name":"","type":"string"}],"type":"function"}]`}, ` - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" `, ` // Create a simulator and wrap a non-deployed contract @@ -646,10 +646,10 @@ var bindTests = []struct { []string{`6080604052348015600f57600080fd5b5060888061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063d5f6622514602d575b600080fd5b6033604c565b6040805192835260208301919091528051918290030190f35b600a809156fea264697066735822beefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeef64736f6c6343decafe0033`}, []string{`[{"inputs":[],"name":"Struct","outputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"}],"stateMutability":"pure","type":"function"}]`}, ` - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" `, ` // Create a simulator and wrap a non-deployed contract @@ -694,10 +694,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -743,11 +743,11 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -819,10 +819,10 @@ var bindTests = []struct { "fmt" "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -912,11 +912,11 @@ var bindTests = []struct { "math/big" "time" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -1103,10 +1103,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -1238,10 +1238,10 @@ var bindTests = []struct { "math/big" "reflect" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` @@ -1380,10 +1380,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -1446,10 +1446,10 @@ var bindTests = []struct { "math/big" "time" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Initialize test accounts @@ -1534,10 +1534,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/core/types" `, ` // Initialize test accounts @@ -1597,10 +1597,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/core/types" `, ` key, _ := crypto.GenerateKey() @@ -1659,10 +1659,10 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` // Generate a new random account and a funded simulator @@ -1720,10 +1720,10 @@ var bindTests = []struct { "bytes" "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" `, ` key, _ := crypto.GenerateKey() @@ -1808,11 +1808,11 @@ var bindTests = []struct { ` "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/ethconfig" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/ethconfig" `, ` var ( @@ -1879,11 +1879,11 @@ var bindTests = []struct { "context" "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/ethconfig" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/ethconfig" `, ` var ( @@ -1932,11 +1932,11 @@ var bindTests = []struct { "context" "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/ethconfig" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/ethconfig" `, tester: ` var ( @@ -1981,11 +1981,11 @@ var bindTests = []struct { "context" "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/ethconfig" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/ethconfig" `, tester: ` var ( @@ -2022,11 +2022,11 @@ var bindTests = []struct { "context" "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/ethconfig" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/accounts/abi/bind/backends" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/ethconfig" `, tester: ` var ( @@ -2060,7 +2060,7 @@ var bindTests = []struct { bytecode: []string{"0x6080604052348015600f57600080fd5b5060958061001e6000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c80639d993132146041578063d02767c7146049578063ffa02795146051575b600080fd5b60476059565b005b604f605b565b005b6057605d565b005b565b565b56fea26469706673582212200382ca602dff96a7e2ba54657985e2b4ac423a56abe4a1f0667bc635c4d4371f64736f6c63430008110033"}, abi: []string{`[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_param","type":"address"}],"name":"_1TestEvent","type":"event"},{"inputs":[],"name":"_1test","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"__1test","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"__2test","outputs":[],"stateMutability":"pure","type":"function"}]`}, imports: ` - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" `, tester: ` if b, err := NewNumericMethodName(common.Address{}, nil); b == nil || err != nil { @@ -2128,7 +2128,7 @@ func TestGolangBindings(t *testing.T) { t.Fatalf("failed to convert binding test to modules: %v\n%s", err, out) } pwd, _ := os.Getwd() - replacer := exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/ethereum/go-ethereum@v0.0.0", "-replace", "github.com/ethereum/go-ethereum="+filepath.Join(pwd, "..", "..", "..")) // Repo root + replacer := exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/ava-labs/libevm@v0.0.0", "-replace", "github.com/ava-labs/libevm="+filepath.Join(pwd, "..", "..", "..")) // Repo root 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) diff --git a/accounts/abi/bind/template.go b/accounts/abi/bind/template.go index 95dc13cc188..f9ce54fb913 100644 --- a/accounts/abi/bind/template.go +++ b/accounts/abi/bind/template.go @@ -16,7 +16,7 @@ package bind -import "github.com/ethereum/go-ethereum/accounts/abi" +import "github.com/ava-labs/libevm/accounts/abi" // tmplData is the data structure required to fill the binding template. type tmplData struct { @@ -91,12 +91,12 @@ import ( "strings" "errors" - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" + ethereum "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/accounts/abi/bind/util.go b/accounts/abi/bind/util.go index b931fbb04d6..8c39c7bd7f2 100644 --- a/accounts/abi/bind/util.go +++ b/accounts/abi/bind/util.go @@ -21,10 +21,10 @@ import ( "errors" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" ) // WaitMined waits for tx to be mined on the blockchain. diff --git a/accounts/abi/bind/util_test.go b/accounts/abi/bind/util_test.go index 592465f2acf..7a5654bbcb5 100644 --- a/accounts/abi/bind/util_test.go +++ b/accounts/abi/bind/util_test.go @@ -23,12 +23,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethclient/simulated" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethclient/simulated" + "github.com/ava-labs/libevm/params" ) var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") diff --git a/accounts/abi/error.go b/accounts/abi/error.go index 8e50112ec5d..3ce2b110563 100644 --- a/accounts/abi/error.go +++ b/accounts/abi/error.go @@ -21,8 +21,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 { diff --git a/accounts/abi/event.go b/accounts/abi/event.go index f9457b86afe..df9f2c7a38c 100644 --- a/accounts/abi/event.go +++ b/accounts/abi/event.go @@ -20,8 +20,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 diff --git a/accounts/abi/event_test.go b/accounts/abi/event_test.go index fffe28ea63a..d1c741dc2f3 100644 --- a/accounts/abi/event_test.go +++ b/accounts/abi/event_test.go @@ -25,8 +25,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" ) diff --git a/accounts/abi/method.go b/accounts/abi/method.go index c5a1a71f475..286b9df97e7 100644 --- a/accounts/abi/method.go +++ b/accounts/abi/method.go @@ -20,7 +20,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. diff --git a/accounts/abi/pack.go b/accounts/abi/pack.go index beef1fa37fa..6453e8b9cbb 100644 --- a/accounts/abi/pack.go +++ b/accounts/abi/pack.go @@ -22,8 +22,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 diff --git a/accounts/abi/pack_test.go b/accounts/abi/pack_test.go index 00bdae469e2..f217d60e7c9 100644 --- a/accounts/abi/pack_test.go +++ b/accounts/abi/pack_test.go @@ -27,7 +27,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 diff --git a/accounts/abi/packing_test.go b/accounts/abi/packing_test.go index eae3b0df205..0c89beaca96 100644 --- a/accounts/abi/packing_test.go +++ b/accounts/abi/packing_test.go @@ -19,7 +19,7 @@ package abi import ( "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) type packUnpackTest struct { diff --git a/accounts/abi/topics.go b/accounts/abi/topics.go index 7ce9b7273c4..147365d5fe9 100644 --- a/accounts/abi/topics.go +++ b/accounts/abi/topics.go @@ -23,9 +23,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" ) // MakeTopics converts a filter query argument list into a filter topic set. diff --git a/accounts/abi/topics_test.go b/accounts/abi/topics_test.go index 9e1efd38216..2749c4e369a 100644 --- a/accounts/abi/topics_test.go +++ b/accounts/abi/topics_test.go @@ -22,8 +22,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) { diff --git a/accounts/abi/type.go b/accounts/abi/type.go index 2eee11787fd..071859b2cd0 100644 --- a/accounts/abi/type.go +++ b/accounts/abi/type.go @@ -26,7 +26,7 @@ import ( "unicode" "unicode/utf8" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // Type enumerator diff --git a/accounts/abi/type_test.go b/accounts/abi/type_test.go index ae69872ad8e..c20a1164912 100644 --- a/accounts/abi/type_test.go +++ b/accounts/abi/type_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // typeWithoutStringer is a alias for the Type type which simply doesn't implement diff --git a/accounts/abi/unpack.go b/accounts/abi/unpack.go index 905b5ce629d..6f3b6aecdd7 100644 --- a/accounts/abi/unpack.go +++ b/accounts/abi/unpack.go @@ -24,7 +24,7 @@ import ( "math/big" "reflect" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) var ( diff --git a/accounts/abi/unpack_test.go b/accounts/abi/unpack_test.go index 29891ec0a41..6c8bc5fd0d6 100644 --- a/accounts/abi/unpack_test.go +++ b/accounts/abi/unpack_test.go @@ -27,7 +27,7 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" "github.com/stretchr/testify/require" ) diff --git a/accounts/accounts.go b/accounts/accounts.go index 6c351a9649e..9d6f24ed634 100644 --- a/accounts/accounts.go +++ b/accounts/accounts.go @@ -21,10 +21,10 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" "golang.org/x/crypto/sha3" ) diff --git a/accounts/accounts_test.go b/accounts/accounts_test.go index 2c4138aa780..71202b6788b 100644 --- a/accounts/accounts_test.go +++ b/accounts/accounts_test.go @@ -20,7 +20,7 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) func TestTextHash(t *testing.T) { diff --git a/accounts/external/backend.go b/accounts/external/backend.go index 6f1581f9b80..9ea74a7266b 100644 --- a/accounts/external/backend.go +++ b/accounts/external/backend.go @@ -22,15 +22,15 @@ import ( "math/big" "sync" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/signer/core/apitypes" ) type ExternalBackend struct { diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go index 4ed1439514e..2c21f57f55f 100644 --- a/accounts/keystore/account_cache.go +++ b/accounts/keystore/account_cache.go @@ -28,9 +28,9 @@ import ( "time" mapset "github.com/deckarep/golang-set/v2" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" "golang.org/x/exp/slices" ) diff --git a/accounts/keystore/account_cache_test.go b/accounts/keystore/account_cache_test.go index 48a238048fe..14804597fe5 100644 --- a/accounts/keystore/account_cache_test.go +++ b/accounts/keystore/account_cache_test.go @@ -28,8 +28,8 @@ import ( "github.com/cespare/cp" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" "golang.org/x/exp/slices" ) diff --git a/accounts/keystore/file_cache.go b/accounts/keystore/file_cache.go index 63eb8503744..4e99fa08916 100644 --- a/accounts/keystore/file_cache.go +++ b/accounts/keystore/file_cache.go @@ -24,7 +24,7 @@ import ( "time" mapset "github.com/deckarep/golang-set/v2" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) // fileCache is a cache of files seen during scan of keystore. diff --git a/accounts/keystore/key.go b/accounts/keystore/key.go index 9b2ac147122..1100aeb4cdd 100644 --- a/accounts/keystore/key.go +++ b/accounts/keystore/key.go @@ -28,9 +28,9 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" "github.com/google/uuid" ) diff --git a/accounts/keystore/keystore.go b/accounts/keystore/keystore.go index 0ffcf376a5f..dbf62421b14 100644 --- a/accounts/keystore/keystore.go +++ b/accounts/keystore/keystore.go @@ -32,11 +32,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/event" ) var ( diff --git a/accounts/keystore/keystore_test.go b/accounts/keystore/keystore_test.go index c9a23eddd6c..35b03b0fcc8 100644 --- a/accounts/keystore/keystore_test.go +++ b/accounts/keystore/keystore_test.go @@ -26,10 +26,10 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/event" "golang.org/x/exp/slices" ) diff --git a/accounts/keystore/passphrase.go b/accounts/keystore/passphrase.go index e7a7f8d0cb0..e9971e6a146 100644 --- a/accounts/keystore/passphrase.go +++ b/accounts/keystore/passphrase.go @@ -37,10 +37,10 @@ import ( "os" "path/filepath" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" "github.com/google/uuid" "golang.org/x/crypto/pbkdf2" "golang.org/x/crypto/scrypt" diff --git a/accounts/keystore/passphrase_test.go b/accounts/keystore/passphrase_test.go index 20ec0f5519f..e43a1c89b77 100644 --- a/accounts/keystore/passphrase_test.go +++ b/accounts/keystore/passphrase_test.go @@ -20,7 +20,7 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) const ( diff --git a/accounts/keystore/plain.go b/accounts/keystore/plain.go index f62a133ce16..fe960fa8c8d 100644 --- a/accounts/keystore/plain.go +++ b/accounts/keystore/plain.go @@ -22,7 +22,7 @@ import ( "os" "path/filepath" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) type keyStorePlain struct { diff --git a/accounts/keystore/plain_test.go b/accounts/keystore/plain_test.go index 737eb7fd61b..51136ab4b72 100644 --- a/accounts/keystore/plain_test.go +++ b/accounts/keystore/plain_test.go @@ -25,8 +25,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" ) func tmpKeyStoreIface(t *testing.T, encrypted bool) (dir string, ks keyStore) { diff --git a/accounts/keystore/presale.go b/accounts/keystore/presale.go index 0664dc2cdd0..46150987ad4 100644 --- a/accounts/keystore/presale.go +++ b/accounts/keystore/presale.go @@ -25,8 +25,8 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/crypto" "github.com/google/uuid" "golang.org/x/crypto/pbkdf2" ) diff --git a/accounts/keystore/wallet.go b/accounts/keystore/wallet.go index 1066095f6d0..63fdd34c6d1 100644 --- a/accounts/keystore/wallet.go +++ b/accounts/keystore/wallet.go @@ -19,10 +19,10 @@ package keystore import ( "math/big" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" ) // keystoreWallet implements the accounts.Wallet interface for the original diff --git a/accounts/keystore/watch.go b/accounts/keystore/watch.go index 1bef321cd1f..0053a8bc6e2 100644 --- a/accounts/keystore/watch.go +++ b/accounts/keystore/watch.go @@ -23,7 +23,7 @@ import ( "os" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" "github.com/fsnotify/fsnotify" ) diff --git a/accounts/manager.go b/accounts/manager.go index cbe4f7c79d8..dd10a577739 100644 --- a/accounts/manager.go +++ b/accounts/manager.go @@ -21,8 +21,8 @@ import ( "sort" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/event" ) // managerSubBufferSize determines how many incoming wallet events diff --git a/accounts/scwallet/hub.go b/accounts/scwallet/hub.go index 5f1f369ca2a..9ce850240aa 100644 --- a/accounts/scwallet/hub.go +++ b/accounts/scwallet/hub.go @@ -41,10 +41,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" pcsc "github.com/gballet/go-libpcsclite" ) diff --git a/accounts/scwallet/securechannel.go b/accounts/scwallet/securechannel.go index bbd8b226479..ac9bedd4d8f 100644 --- a/accounts/scwallet/securechannel.go +++ b/accounts/scwallet/securechannel.go @@ -27,7 +27,7 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/crypto" pcsc "github.com/gballet/go-libpcsclite" "golang.org/x/crypto/pbkdf2" "golang.org/x/text/unicode/norm" diff --git a/accounts/scwallet/wallet.go b/accounts/scwallet/wallet.go index f0ca9085b68..aefa7e58d3e 100644 --- a/accounts/scwallet/wallet.go +++ b/accounts/scwallet/wallet.go @@ -33,12 +33,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" pcsc "github.com/gballet/go-libpcsclite" "github.com/status-im/keycard-go/derivationpath" ) diff --git a/accounts/usbwallet/hub.go b/accounts/usbwallet/hub.go index e67942dbc10..18edb947eb1 100644 --- a/accounts/usbwallet/hub.go +++ b/accounts/usbwallet/hub.go @@ -23,9 +23,9 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" "github.com/karalabe/usb" ) diff --git a/accounts/usbwallet/ledger.go b/accounts/usbwallet/ledger.go index d0cb93e74e0..f8c80001551 100644 --- a/accounts/usbwallet/ledger.go +++ b/accounts/usbwallet/ledger.go @@ -28,13 +28,13 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" ) // ledgerOpcode is an enumeration encoding the supported Ledger opcodes. diff --git a/accounts/usbwallet/trezor.go b/accounts/usbwallet/trezor.go index 9644dc4e02c..7b6d00d47ff 100644 --- a/accounts/usbwallet/trezor.go +++ b/accounts/usbwallet/trezor.go @@ -27,12 +27,12 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/usbwallet/trezor" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/usbwallet/trezor" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" "github.com/golang/protobuf/proto" ) diff --git a/accounts/usbwallet/wallet.go b/accounts/usbwallet/wallet.go index 69083dc8939..2bdf888d9b1 100644 --- a/accounts/usbwallet/wallet.go +++ b/accounts/usbwallet/wallet.go @@ -25,12 +25,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" "github.com/karalabe/usb" ) diff --git a/beacon/engine/errors.go b/beacon/engine/errors.go index 62773a0ea9f..12e4e4eade3 100644 --- a/beacon/engine/errors.go +++ b/beacon/engine/errors.go @@ -17,8 +17,8 @@ package engine import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/rpc" ) // EngineAPIError is a standardized error message between consensus and execution diff --git a/beacon/engine/gen_blockparams.go b/beacon/engine/gen_blockparams.go index b1f01b50ff8..7c76250837c 100644 --- a/beacon/engine/gen_blockparams.go +++ b/beacon/engine/gen_blockparams.go @@ -6,9 +6,9 @@ import ( "encoding/json" "errors" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" ) var _ = (*payloadAttributesMarshaling)(nil) diff --git a/beacon/engine/gen_ed.go b/beacon/engine/gen_ed.go index 6893d64a162..280dc8ba501 100644 --- a/beacon/engine/gen_ed.go +++ b/beacon/engine/gen_ed.go @@ -7,9 +7,9 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" ) var _ = (*executableDataMarshaling)(nil) diff --git a/beacon/engine/gen_epe.go b/beacon/engine/gen_epe.go index e69f9a5951a..4439a5c6af4 100644 --- a/beacon/engine/gen_epe.go +++ b/beacon/engine/gen_epe.go @@ -7,7 +7,7 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*executionPayloadEnvelopeMarshaling)(nil) diff --git a/beacon/engine/types.go b/beacon/engine/types.go index 60accc3c791..b0afb9db211 100644 --- a/beacon/engine/types.go +++ b/beacon/engine/types.go @@ -20,10 +20,10 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/trie" ) // PayloadVersion denotes the version of PayloadAttributes used to request the diff --git a/beacon/light/canonical.go b/beacon/light/canonical.go index b5371493b4c..30fab6330a3 100644 --- a/beacon/light/canonical.go +++ b/beacon/light/canonical.go @@ -20,10 +20,10 @@ import ( "encoding/binary" "fmt" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" ) // canonicalStore stores instances of the given type in a database and caches diff --git a/beacon/light/committee_chain.go b/beacon/light/committee_chain.go index d707f8cc34d..43ad3508c06 100644 --- a/beacon/light/committee_chain.go +++ b/beacon/light/committee_chain.go @@ -23,14 +23,14 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/beacon/params" - "github.com/ethereum/go-ethereum/beacon/types" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/beacon/params" + "github.com/ava-labs/libevm/beacon/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) var ( diff --git a/beacon/light/committee_chain_test.go b/beacon/light/committee_chain_test.go index 60ea2a0efdb..28d76a065d3 100644 --- a/beacon/light/committee_chain_test.go +++ b/beacon/light/committee_chain_test.go @@ -21,10 +21,10 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/beacon/params" - "github.com/ethereum/go-ethereum/beacon/types" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/ethdb/memorydb" + "github.com/ava-labs/libevm/beacon/params" + "github.com/ava-labs/libevm/beacon/types" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/ethdb/memorydb" ) var ( diff --git a/beacon/light/test_helpers.go b/beacon/light/test_helpers.go index f537d963a66..241740e18ad 100644 --- a/beacon/light/test_helpers.go +++ b/beacon/light/test_helpers.go @@ -21,10 +21,10 @@ import ( "crypto/sha256" mrand "math/rand" - "github.com/ethereum/go-ethereum/beacon/merkle" - "github.com/ethereum/go-ethereum/beacon/params" - "github.com/ethereum/go-ethereum/beacon/types" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/beacon/merkle" + "github.com/ava-labs/libevm/beacon/params" + "github.com/ava-labs/libevm/beacon/types" + "github.com/ava-labs/libevm/common" ) func GenerateTestCommittee() *types.SerializedSyncCommittee { diff --git a/beacon/merkle/merkle.go b/beacon/merkle/merkle.go index 30896f9b017..6148ab61e13 100644 --- a/beacon/merkle/merkle.go +++ b/beacon/merkle/merkle.go @@ -22,8 +22,8 @@ import ( "errors" "reflect" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) // Value represents either a 32 byte leaf value or hash node in a binary merkle tree/partial proof. diff --git a/beacon/types/committee.go b/beacon/types/committee.go index 5f89c27554a..2a4ea7f3d65 100644 --- a/beacon/types/committee.go +++ b/beacon/types/committee.go @@ -22,9 +22,9 @@ import ( "fmt" "math/bits" - "github.com/ethereum/go-ethereum/beacon/params" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/beacon/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" bls "github.com/protolambda/bls12-381-util" ) diff --git a/beacon/types/config.go b/beacon/types/config.go index 8cb8808b6f0..ade8fba318a 100644 --- a/beacon/types/config.go +++ b/beacon/types/config.go @@ -24,9 +24,9 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/beacon/merkle" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/beacon/merkle" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" "gopkg.in/yaml.v3" ) diff --git a/beacon/types/gen_header_json.go b/beacon/types/gen_header_json.go index 9b3ffea06fc..180e1d45917 100644 --- a/beacon/types/gen_header_json.go +++ b/beacon/types/gen_header_json.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) var _ = (*headerMarshaling)(nil) diff --git a/beacon/types/gen_syncaggregate_json.go b/beacon/types/gen_syncaggregate_json.go index 1547ec5f01c..8a3fa6fdcac 100644 --- a/beacon/types/gen_syncaggregate_json.go +++ b/beacon/types/gen_syncaggregate_json.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*syncAggregateMarshaling)(nil) diff --git a/beacon/types/header.go b/beacon/types/header.go index 2ddc4575f17..92e7fd7073f 100644 --- a/beacon/types/header.go +++ b/beacon/types/header.go @@ -21,9 +21,9 @@ import ( "crypto/sha256" "encoding/binary" - "github.com/ethereum/go-ethereum/beacon/merkle" - "github.com/ethereum/go-ethereum/beacon/params" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/beacon/merkle" + "github.com/ava-labs/libevm/beacon/params" + "github.com/ava-labs/libevm/common" ) //go:generate go run github.com/fjl/gencodec -type Header -field-override headerMarshaling -out gen_header_json.go diff --git a/beacon/types/light_sync.go b/beacon/types/light_sync.go index 3284081e4d4..2c93d40e23c 100644 --- a/beacon/types/light_sync.go +++ b/beacon/types/light_sync.go @@ -20,9 +20,9 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/beacon/merkle" - "github.com/ethereum/go-ethereum/beacon/params" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/beacon/merkle" + "github.com/ava-labs/libevm/beacon/params" + "github.com/ava-labs/libevm/common" ) // BootstrapData contains a sync committee where light sync can be started, diff --git a/build/ci.go b/build/ci.go index 4d8dba6ce23..717720d00d6 100644 --- a/build/ci.go +++ b/build/ci.go @@ -53,10 +53,10 @@ import ( "time" "github.com/cespare/cp" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/signify" - "github.com/ethereum/go-ethereum/internal/build" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto/signify" + "github.com/ava-labs/libevm/internal/build" + "github.com/ava-labs/libevm/params" ) var ( @@ -244,8 +244,8 @@ func doInstall(cmdline []string) { func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (flags []string) { var ld []string if env.Commit != "" { - ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitCommit="+env.Commit) - ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitDate="+env.Date) + ld = append(ld, "-X", "github.com/ava-labs/libevm/internal/version.gitCommit="+env.Commit) + ld = append(ld, "-X", "github.com/ava-labs/libevm/internal/version.gitDate="+env.Date) } // Strip DWARF on darwin. This used to be required for certain things, // and there is no downside to this, so we just keep doing it. diff --git a/cmd/abidump/main.go b/cmd/abidump/main.go index ae1ac641391..741f8be3865 100644 --- a/cmd/abidump/main.go +++ b/cmd/abidump/main.go @@ -23,8 +23,8 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/ethereum/go-ethereum/signer/fourbyte" + "github.com/ava-labs/libevm/signer/core/apitypes" + "github.com/ava-labs/libevm/signer/fourbyte" ) func init() { diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index 0149dec5277..3ab6d95b6d5 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -24,12 +24,12 @@ import ( "regexp" "strings" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common/compiler" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common/compiler" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" "github.com/urfave/cli/v2" ) diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go index 350b85df1e6..f93a2b669dc 100644 --- a/cmd/bootnode/main.go +++ b/cmd/bootnode/main.go @@ -25,13 +25,13 @@ import ( "os" "time" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/discover" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/nat" + "github.com/ava-labs/libevm/p2p/netutil" ) func main() { diff --git a/cmd/clef/main.go b/cmd/clef/main.go index f9b00e4a12a..121d1e783ac 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -35,25 +35,25 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/signer/core" - "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/ethereum/go-ethereum/signer/fourbyte" - "github.com/ethereum/go-ethereum/signer/rules" - "github.com/ethereum/go-ethereum/signer/storage" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/signer/core" + "github.com/ava-labs/libevm/signer/core/apitypes" + "github.com/ava-labs/libevm/signer/fourbyte" + "github.com/ava-labs/libevm/signer/rules" + "github.com/ava-labs/libevm/signer/storage" "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" "github.com/urfave/cli/v2" diff --git a/cmd/clef/run_test.go b/cmd/clef/run_test.go index 5fa6e02e147..fcbfc2caa72 100644 --- a/cmd/clef/run_test.go +++ b/cmd/clef/run_test.go @@ -21,8 +21,8 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/internal/cmdtest" - "github.com/ethereum/go-ethereum/internal/reexec" + "github.com/ava-labs/libevm/internal/cmdtest" + "github.com/ava-labs/libevm/internal/reexec" ) const registeredName = "clef-test" diff --git a/cmd/devp2p/crawl.go b/cmd/devp2p/crawl.go index 4288a5feb89..27c95ea7bfb 100644 --- a/cmd/devp2p/crawl.go +++ b/cmd/devp2p/crawl.go @@ -22,8 +22,8 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" ) type crawler struct { diff --git a/cmd/devp2p/discv4cmd.go b/cmd/devp2p/discv4cmd.go index 45bcdcd3674..f6744844a51 100644 --- a/cmd/devp2p/discv4cmd.go +++ b/cmd/devp2p/discv4cmd.go @@ -24,13 +24,13 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/cmd/devp2p/internal/v4test" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/cmd/devp2p/internal/v4test" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/p2p/discover" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/params" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/discv5cmd.go b/cmd/devp2p/discv5cmd.go index 0dac9452697..162179601df 100644 --- a/cmd/devp2p/discv5cmd.go +++ b/cmd/devp2p/discv5cmd.go @@ -21,10 +21,10 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/cmd/devp2p/internal/v5test" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/ava-labs/libevm/cmd/devp2p/internal/v5test" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/p2p/discover" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/dns_cloudflare.go b/cmd/devp2p/dns_cloudflare.go index a3cc69cf192..ae04626d8c9 100644 --- a/cmd/devp2p/dns_cloudflare.go +++ b/cmd/devp2p/dns_cloudflare.go @@ -23,8 +23,8 @@ import ( "strings" "github.com/cloudflare/cloudflare-go" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/dnsdisc" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/dnsdisc" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/dns_route53.go b/cmd/devp2p/dns_route53.go index 21a32f9414e..d95023138e3 100644 --- a/cmd/devp2p/dns_route53.go +++ b/cmd/devp2p/dns_route53.go @@ -29,8 +29,8 @@ import ( "github.com/aws/aws-sdk-go-v2/credentials" "github.com/aws/aws-sdk-go-v2/service/route53" "github.com/aws/aws-sdk-go-v2/service/route53/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/dnsdisc" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/dnsdisc" "github.com/urfave/cli/v2" "golang.org/x/exp/slices" ) diff --git a/cmd/devp2p/dnscmd.go b/cmd/devp2p/dnscmd.go index 0fce7b10308..cb2c88ac4f7 100644 --- a/cmd/devp2p/dnscmd.go +++ b/cmd/devp2p/dnscmd.go @@ -25,11 +25,11 @@ import ( "path/filepath" "time" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/console/prompt" - "github.com/ethereum/go-ethereum/p2p/dnsdisc" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/console/prompt" + "github.com/ava-labs/libevm/p2p/dnsdisc" + "github.com/ava-labs/libevm/p2p/enode" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/enrcmd.go b/cmd/devp2p/enrcmd.go index c5a97c8411f..c457c9adee5 100644 --- a/cmd/devp2p/enrcmd.go +++ b/cmd/devp2p/enrcmd.go @@ -28,9 +28,9 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/internal/ethtest/chain.go b/cmd/devp2p/internal/ethtest/chain.go index e8b3725b17a..cd11fdb7057 100644 --- a/cmd/devp2p/internal/ethtest/chain.go +++ b/cmd/devp2p/internal/ethtest/chain.go @@ -30,16 +30,16 @@ import ( "sort" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/forkid" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "golang.org/x/exp/slices" ) diff --git a/cmd/devp2p/internal/ethtest/chain_test.go b/cmd/devp2p/internal/ethtest/chain_test.go index 62bd6d26eae..3bdf98d4441 100644 --- a/cmd/devp2p/internal/ethtest/chain_test.go +++ b/cmd/devp2p/internal/ethtest/chain_test.go @@ -21,9 +21,9 @@ import ( "strconv" "testing" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/p2p" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/p2p" "github.com/stretchr/testify/assert" ) diff --git a/cmd/devp2p/internal/ethtest/conn.go b/cmd/devp2p/internal/ethtest/conn.go index ba3c0585fde..ab2e83d92cb 100644 --- a/cmd/devp2p/internal/ethtest/conn.go +++ b/cmd/devp2p/internal/ethtest/conn.go @@ -25,12 +25,12 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/rlpx" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/rlpx" + "github.com/ava-labs/libevm/rlp" ) var ( diff --git a/cmd/devp2p/internal/ethtest/engine.go b/cmd/devp2p/internal/ethtest/engine.go index ea4fc76e6ff..0b33bee3bcf 100644 --- a/cmd/devp2p/internal/ethtest/engine.go +++ b/cmd/devp2p/internal/ethtest/engine.go @@ -25,7 +25,7 @@ import ( "path" "time" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" "github.com/golang-jwt/jwt/v4" ) diff --git a/cmd/devp2p/internal/ethtest/protocol.go b/cmd/devp2p/internal/ethtest/protocol.go index f5f5f7e4897..889a704ec34 100644 --- a/cmd/devp2p/internal/ethtest/protocol.go +++ b/cmd/devp2p/internal/ethtest/protocol.go @@ -16,8 +16,8 @@ package ethtest import ( - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/rlp" ) // Unexported devp2p message codes from p2p/peer.go. diff --git a/cmd/devp2p/internal/ethtest/snap.go b/cmd/devp2p/internal/ethtest/snap.go index 64e06335854..c4b5e4a85a1 100644 --- a/cmd/devp2p/internal/ethtest/snap.go +++ b/cmd/devp2p/internal/ethtest/snap.go @@ -24,14 +24,14 @@ import ( "math/rand" "reflect" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/internal/utesting" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/internal/utesting" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/trie/trienode" "golang.org/x/crypto/sha3" ) diff --git a/cmd/devp2p/internal/ethtest/suite.go b/cmd/devp2p/internal/ethtest/suite.go index d9efe262443..b4a4fdd470d 100644 --- a/cmd/devp2p/internal/ethtest/suite.go +++ b/cmd/devp2p/internal/ethtest/suite.go @@ -21,15 +21,15 @@ import ( "math/big" "reflect" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/internal/utesting" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/internal/utesting" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" "github.com/holiman/uint256" ) diff --git a/cmd/devp2p/internal/ethtest/suite_test.go b/cmd/devp2p/internal/ethtest/suite_test.go index ad73bc9f90e..c137fe9abda 100644 --- a/cmd/devp2p/internal/ethtest/suite_test.go +++ b/cmd/devp2p/internal/ethtest/suite_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/catalyst" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/internal/utesting" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/catalyst" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/internal/utesting" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" ) func makeJWTSecret() (string, [32]byte, error) { diff --git a/cmd/devp2p/internal/ethtest/transaction.go b/cmd/devp2p/internal/ethtest/transaction.go index 80b5d80745e..8356b01a4ca 100644 --- a/cmd/devp2p/internal/ethtest/transaction.go +++ b/cmd/devp2p/internal/ethtest/transaction.go @@ -22,10 +22,10 @@ import ( "os" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/internal/utesting" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/internal/utesting" ) // sendTxs sends the given transactions to the node and diff --git a/cmd/devp2p/internal/v4test/discv4tests.go b/cmd/devp2p/internal/v4test/discv4tests.go index ca556851b46..cf462c74eaa 100644 --- a/cmd/devp2p/internal/v4test/discv4tests.go +++ b/cmd/devp2p/internal/v4test/discv4tests.go @@ -24,9 +24,9 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/utesting" - "github.com/ethereum/go-ethereum/p2p/discover/v4wire" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/utesting" + "github.com/ava-labs/libevm/p2p/discover/v4wire" ) const ( diff --git a/cmd/devp2p/internal/v4test/framework.go b/cmd/devp2p/internal/v4test/framework.go index 92865941810..07aadc2f79a 100644 --- a/cmd/devp2p/internal/v4test/framework.go +++ b/cmd/devp2p/internal/v4test/framework.go @@ -22,9 +22,9 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/discover/v4wire" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/discover/v4wire" + "github.com/ava-labs/libevm/p2p/enode" ) const waitTime = 300 * time.Millisecond diff --git a/cmd/devp2p/internal/v5test/discv5tests.go b/cmd/devp2p/internal/v5test/discv5tests.go index 56624a0ca8e..79cea640db6 100644 --- a/cmd/devp2p/internal/v5test/discv5tests.go +++ b/cmd/devp2p/internal/v5test/discv5tests.go @@ -22,10 +22,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/internal/utesting" - "github.com/ethereum/go-ethereum/p2p/discover/v5wire" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/internal/utesting" + "github.com/ava-labs/libevm/p2p/discover/v5wire" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/netutil" ) // Suite is the discv5 test suite. diff --git a/cmd/devp2p/internal/v5test/framework.go b/cmd/devp2p/internal/v5test/framework.go index 10856a50bcf..cb2888ed9f4 100644 --- a/cmd/devp2p/internal/v5test/framework.go +++ b/cmd/devp2p/internal/v5test/framework.go @@ -24,11 +24,11 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/discover/v5wire" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/discover/v5wire" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" ) // readError represents an error during packet reading. diff --git a/cmd/devp2p/keycmd.go b/cmd/devp2p/keycmd.go index 98d7bd76aee..0cdb7fbeb24 100644 --- a/cmd/devp2p/keycmd.go +++ b/cmd/devp2p/keycmd.go @@ -21,9 +21,9 @@ import ( "fmt" "net" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/main.go b/cmd/devp2p/main.go index 8461a8b9b5e..a69454ab414 100644 --- a/cmd/devp2p/main.go +++ b/cmd/devp2p/main.go @@ -20,9 +20,9 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/internal/debug" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/internal/debug" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/p2p/enode" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/nodeset.go b/cmd/devp2p/nodeset.go index 7360dc5bcfd..ae83af41c7e 100644 --- a/cmd/devp2p/nodeset.go +++ b/cmd/devp2p/nodeset.go @@ -23,8 +23,8 @@ import ( "os" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/p2p/enode" "golang.org/x/exp/slices" ) diff --git a/cmd/devp2p/nodesetcmd.go b/cmd/devp2p/nodesetcmd.go index 6fbc185ad8a..60761fb9447 100644 --- a/cmd/devp2p/nodesetcmd.go +++ b/cmd/devp2p/nodesetcmd.go @@ -25,11 +25,11 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/forkid" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/rlpxcmd.go b/cmd/devp2p/rlpxcmd.go index aa7d065818d..cb9660027cc 100644 --- a/cmd/devp2p/rlpxcmd.go +++ b/cmd/devp2p/rlpxcmd.go @@ -21,12 +21,12 @@ import ( "fmt" "net" - "github.com/ethereum/go-ethereum/cmd/devp2p/internal/ethtest" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/rlpx" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/cmd/devp2p/internal/ethtest" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/rlpx" + "github.com/ava-labs/libevm/rlp" "github.com/urfave/cli/v2" ) diff --git a/cmd/devp2p/runtest.go b/cmd/devp2p/runtest.go index 7e3723c641d..9475c2f0149 100644 --- a/cmd/devp2p/runtest.go +++ b/cmd/devp2p/runtest.go @@ -19,10 +19,10 @@ package main import ( "os" - "github.com/ethereum/go-ethereum/cmd/devp2p/internal/v4test" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/internal/utesting" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/cmd/devp2p/internal/v4test" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/internal/utesting" + "github.com/ava-labs/libevm/log" "github.com/urfave/cli/v2" ) diff --git a/cmd/era/main.go b/cmd/era/main.go index e27d8ccec60..8e37d8fa0e8 100644 --- a/cmd/era/main.go +++ b/cmd/era/main.go @@ -26,13 +26,13 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/internal/era" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/internal/era" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" "github.com/urfave/cli/v2" ) diff --git a/cmd/ethkey/changepassword.go b/cmd/ethkey/changepassword.go index 4298e2b8340..fa59170edf7 100644 --- a/cmd/ethkey/changepassword.go +++ b/cmd/ethkey/changepassword.go @@ -21,8 +21,8 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/cmd/utils" "github.com/urfave/cli/v2" ) diff --git a/cmd/ethkey/generate.go b/cmd/ethkey/generate.go index 60d8b3c7795..b78843b27ea 100644 --- a/cmd/ethkey/generate.go +++ b/cmd/ethkey/generate.go @@ -22,9 +22,9 @@ import ( "os" "path/filepath" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/crypto" "github.com/google/uuid" "github.com/urfave/cli/v2" ) diff --git a/cmd/ethkey/inspect.go b/cmd/ethkey/inspect.go index 29b1c13e859..7555a56504f 100644 --- a/cmd/ethkey/inspect.go +++ b/cmd/ethkey/inspect.go @@ -21,9 +21,9 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/crypto" "github.com/urfave/cli/v2" ) diff --git a/cmd/ethkey/main.go b/cmd/ethkey/main.go index 25c0d104f61..b29a500ab0b 100644 --- a/cmd/ethkey/main.go +++ b/cmd/ethkey/main.go @@ -20,7 +20,7 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/internal/flags" + "github.com/ava-labs/libevm/internal/flags" "github.com/urfave/cli/v2" ) diff --git a/cmd/ethkey/message.go b/cmd/ethkey/message.go index 6b8dec03cd6..ff951e0e46b 100644 --- a/cmd/ethkey/message.go +++ b/cmd/ethkey/message.go @@ -21,11 +21,11 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" "github.com/urfave/cli/v2" ) diff --git a/cmd/ethkey/run_test.go b/cmd/ethkey/run_test.go index 73506e5da14..7b558fd208e 100644 --- a/cmd/ethkey/run_test.go +++ b/cmd/ethkey/run_test.go @@ -21,8 +21,8 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/internal/cmdtest" - "github.com/ethereum/go-ethereum/internal/reexec" + "github.com/ava-labs/libevm/internal/cmdtest" + "github.com/ava-labs/libevm/internal/reexec" ) type testEthkey struct { diff --git a/cmd/ethkey/utils.go b/cmd/ethkey/utils.go index 2821145089e..bb58856565e 100644 --- a/cmd/ethkey/utils.go +++ b/cmd/ethkey/utils.go @@ -22,7 +22,7 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ava-labs/libevm/cmd/utils" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/blockrunner.go b/cmd/evm/blockrunner.go index c5d836e0ea6..de83d675909 100644 --- a/cmd/evm/blockrunner.go +++ b/cmd/evm/blockrunner.go @@ -24,11 +24,11 @@ import ( "regexp" "sort" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers/logger" - "github.com/ethereum/go-ethereum/tests" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers/logger" + "github.com/ava-labs/libevm/tests" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/compiler.go b/cmd/evm/compiler.go index c071834b594..33392d2a69d 100644 --- a/cmd/evm/compiler.go +++ b/cmd/evm/compiler.go @@ -21,7 +21,7 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/cmd/evm/internal/compiler" + "github.com/ava-labs/libevm/cmd/evm/internal/compiler" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/disasm.go b/cmd/evm/disasm.go index b1f35cbaf51..3de33a91e87 100644 --- a/cmd/evm/disasm.go +++ b/cmd/evm/disasm.go @@ -22,7 +22,7 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/core/asm" + "github.com/ava-labs/libevm/core/asm" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/internal/compiler/compiler.go b/cmd/evm/internal/compiler/compiler.go index 54981b66976..ce0b22eb12c 100644 --- a/cmd/evm/internal/compiler/compiler.go +++ b/cmd/evm/internal/compiler/compiler.go @@ -20,7 +20,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) { diff --git a/cmd/evm/internal/t8ntool/block.go b/cmd/evm/internal/t8ntool/block.go index a2dc4734372..d51033ccae3 100644 --- a/cmd/evm/internal/t8ntool/block.go +++ b/cmd/evm/internal/t8ntool/block.go @@ -24,13 +24,13 @@ import ( "math/big" "os" - "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/consensus/clique" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "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/consensus/clique" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index cb975054c1b..06e1ce23b90 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -20,23 +20,23 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/consensus/misc" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "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/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/consensus/misc" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "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/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" "github.com/holiman/uint256" "golang.org/x/crypto/sha3" ) diff --git a/cmd/evm/internal/t8ntool/flags.go b/cmd/evm/internal/t8ntool/flags.go index c2eca8cc217..ff7ecae5f10 100644 --- a/cmd/evm/internal/t8ntool/flags.go +++ b/cmd/evm/internal/t8ntool/flags.go @@ -20,8 +20,8 @@ import ( "fmt" "strings" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/tests" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/tests" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/internal/t8ntool/gen_header.go b/cmd/evm/internal/t8ntool/gen_header.go index a8c8668978e..85d3d18e9de 100644 --- a/cmd/evm/internal/t8ntool/gen_header.go +++ b/cmd/evm/internal/t8ntool/gen_header.go @@ -7,10 +7,10 @@ import ( "errors" "math/big" - "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/core/types" + "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/core/types" ) var _ = (*headerMarshaling)(nil) diff --git a/cmd/evm/internal/t8ntool/gen_stenv.go b/cmd/evm/internal/t8ntool/gen_stenv.go index d47db4a8765..7819e7ca7b0 100644 --- a/cmd/evm/internal/t8ntool/gen_stenv.go +++ b/cmd/evm/internal/t8ntool/gen_stenv.go @@ -7,9 +7,9 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/types" ) var _ = (*stEnvMarshaling)(nil) diff --git a/cmd/evm/internal/t8ntool/tracewriter.go b/cmd/evm/internal/t8ntool/tracewriter.go index e4efad112f7..4b81f19c9a9 100644 --- a/cmd/evm/internal/t8ntool/tracewriter.go +++ b/cmd/evm/internal/t8ntool/tracewriter.go @@ -21,10 +21,10 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/log" ) // traceWriter is an vm.EVMLogger which also holds an inner logger/tracer. diff --git a/cmd/evm/internal/t8ntool/transaction.go b/cmd/evm/internal/t8ntool/transaction.go index 8533b786376..be0a548aa66 100644 --- a/cmd/evm/internal/t8ntool/transaction.go +++ b/cmd/evm/internal/t8ntool/transaction.go @@ -24,13 +24,13 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/tests" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/tests" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index 7802d496519..b692f51109d 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -24,17 +24,17 @@ import ( "os" "path" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/eth/tracers/logger" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/tests" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/eth/tracers/logger" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/tests" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/internal/t8ntool/tx_iterator.go b/cmd/evm/internal/t8ntool/tx_iterator.go index 8f28dc70223..e4b2f5d42b8 100644 --- a/cmd/evm/internal/t8ntool/tx_iterator.go +++ b/cmd/evm/internal/t8ntool/tx_iterator.go @@ -25,12 +25,12 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) // txWithKey is a helper-struct, to allow us to use the types.Transaction along with diff --git a/cmd/evm/main.go b/cmd/evm/main.go index c3e6a4af91b..53084ee8513 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -22,14 +22,14 @@ import ( "math/big" "os" - "github.com/ethereum/go-ethereum/cmd/evm/internal/t8ntool" - "github.com/ethereum/go-ethereum/internal/debug" - "github.com/ethereum/go-ethereum/internal/flags" + "github.com/ava-labs/libevm/cmd/evm/internal/t8ntool" + "github.com/ava-labs/libevm/internal/debug" + "github.com/ava-labs/libevm/internal/flags" "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 ( diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go index b8e8b542b7e..4b186dce491 100644 --- a/cmd/evm/runner.go +++ b/cmd/evm/runner.go @@ -27,19 +27,19 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/cmd/evm/internal/compiler" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/core/vm/runtime" - "github.com/ethereum/go-ethereum/eth/tracers/logger" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" + "github.com/ava-labs/libevm/cmd/evm/internal/compiler" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/core/vm/runtime" + "github.com/ava-labs/libevm/eth/tracers/logger" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/staterunner.go b/cmd/evm/staterunner.go index 458d809ad82..57306e25de2 100644 --- a/cmd/evm/staterunner.go +++ b/cmd/evm/staterunner.go @@ -22,12 +22,12 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers/logger" - "github.com/ethereum/go-ethereum/tests" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers/logger" + "github.com/ava-labs/libevm/tests" "github.com/urfave/cli/v2" ) diff --git a/cmd/evm/t8n_test.go b/cmd/evm/t8n_test.go index ad36540de56..94c8435a9e3 100644 --- a/cmd/evm/t8n_test.go +++ b/cmd/evm/t8n_test.go @@ -24,9 +24,9 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/cmd/evm/internal/t8ntool" - "github.com/ethereum/go-ethereum/internal/cmdtest" - "github.com/ethereum/go-ethereum/internal/reexec" + "github.com/ava-labs/libevm/cmd/evm/internal/t8ntool" + "github.com/ava-labs/libevm/internal/cmdtest" + "github.com/ava-labs/libevm/internal/reexec" ) func TestMain(m *testing.M) { diff --git a/cmd/geth/accountcmd.go b/cmd/geth/accountcmd.go index cc22684e0ba..3d26e462ea3 100644 --- a/cmd/geth/accountcmd.go +++ b/cmd/geth/accountcmd.go @@ -20,11 +20,11 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index d333c175599..ecb32148577 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -26,21 +26,21 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/internal/era" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/internal/era" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 5f52f1df544..ee4b8b6096b 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -26,23 +26,23 @@ import ( "strings" "unicode" - "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/accounts/scwallet" - "github.com/ethereum/go-ethereum/accounts/usbwallet" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/eth/catalyst" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/internal/version" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" + "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/accounts/scwallet" + "github.com/ava-labs/libevm/accounts/usbwallet" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/eth/catalyst" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/internal/version" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" "github.com/naoina/toml" "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/consolecmd.go b/cmd/geth/consolecmd.go index 526ede96192..e07506fbb14 100644 --- a/cmd/geth/consolecmd.go +++ b/cmd/geth/consolecmd.go @@ -20,9 +20,9 @@ import ( "fmt" "strings" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/console" - "github.com/ethereum/go-ethereum/internal/flags" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/console" + "github.com/ava-labs/libevm/internal/flags" "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/consolecmd_test.go b/cmd/geth/consolecmd_test.go index ef6ef5f2883..cc1ee9ea9c2 100644 --- a/cmd/geth/consolecmd_test.go +++ b/cmd/geth/consolecmd_test.go @@ -26,7 +26,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) const ( diff --git a/cmd/geth/dbcmd.go b/cmd/geth/dbcmd.go index 1d885bd58d2..a6c5688f124 100644 --- a/cmd/geth/dbcmd.go +++ b/cmd/geth/dbcmd.go @@ -27,17 +27,17 @@ import ( "syscall" "time" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/console/prompt" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/console/prompt" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie" "github.com/olekukonko/tablewriter" "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/exportcmd_test.go b/cmd/geth/exportcmd_test.go index 9570b1ffd27..008e94473ad 100644 --- a/cmd/geth/exportcmd_test.go +++ b/cmd/geth/exportcmd_test.go @@ -22,7 +22,7 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // TestExport does a basic test of "geth export", exporting the test-genesis. diff --git a/cmd/geth/logging_test.go b/cmd/geth/logging_test.go index b5ce03f4b8d..527dbcbd9d5 100644 --- a/cmd/geth/logging_test.go +++ b/cmd/geth/logging_test.go @@ -30,7 +30,7 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/internal/reexec" + "github.com/ava-labs/libevm/internal/reexec" ) func runSelf(args ...string) ([]byte, error) { diff --git a/cmd/geth/logtestcmd_active.go b/cmd/geth/logtestcmd_active.go index f2a2c5ded54..2cabcf63ae1 100644 --- a/cmd/geth/logtestcmd_active.go +++ b/cmd/geth/logtestcmd_active.go @@ -25,8 +25,8 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" "github.com/holiman/uint256" "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 2f7d37fdd7e..6d015a40392 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -25,25 +25,25 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/console/prompt" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/internal/debug" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/node" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/console/prompt" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/ethclient" + "github.com/ava-labs/libevm/internal/debug" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/node" "go.uber.org/automaxprocs/maxprocs" // 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" "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/misccmd.go b/cmd/geth/misccmd.go index f3530c30fb6..567f2e1c2b5 100644 --- a/cmd/geth/misccmd.go +++ b/cmd/geth/misccmd.go @@ -22,8 +22,8 @@ import ( "runtime" "strings" - "github.com/ethereum/go-ethereum/internal/version" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/internal/version" + "github.com/ava-labs/libevm/params" "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/run_test.go b/cmd/geth/run_test.go index 1d32880325d..5b13586366f 100644 --- a/cmd/geth/run_test.go +++ b/cmd/geth/run_test.go @@ -23,9 +23,9 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/internal/cmdtest" - "github.com/ethereum/go-ethereum/internal/reexec" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/internal/cmdtest" + "github.com/ava-labs/libevm/internal/reexec" + "github.com/ava-labs/libevm/rpc" ) type testgeth struct { diff --git a/cmd/geth/snapshot.go b/cmd/geth/snapshot.go index 4284005a022..9ee9b7ccd6c 100644 --- a/cmd/geth/snapshot.go +++ b/cmd/geth/snapshot.go @@ -24,18 +24,18 @@ import ( "os" "time" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/state/pruner" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/state/pruner" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" cli "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/verkle.go b/cmd/geth/verkle.go index 420b063d8ba..bfd12aef650 100644 --- a/cmd/geth/verkle.go +++ b/cmd/geth/verkle.go @@ -23,11 +23,11 @@ import ( "fmt" "os" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/cmd/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" "github.com/gballet/go-verkle" cli "github.com/urfave/cli/v2" ) diff --git a/cmd/geth/version_check.go b/cmd/geth/version_check.go index 237556788eb..c29c3c76ea7 100644 --- a/cmd/geth/version_check.go +++ b/cmd/geth/version_check.go @@ -26,7 +26,7 @@ import ( "regexp" "strings" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" "github.com/jedisct1/go-minisign" "github.com/urfave/cli/v2" ) diff --git a/cmd/p2psim/main.go b/cmd/p2psim/main.go index a0f5f0d2889..b2583ddfa90 100644 --- a/cmd/p2psim/main.go +++ b/cmd/p2psim/main.go @@ -44,13 +44,13 @@ import ( "strings" "text/tabwriter" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations" + "github.com/ava-labs/libevm/p2p/simulations/adapters" + "github.com/ava-labs/libevm/rpc" "github.com/urfave/cli/v2" ) diff --git a/cmd/rlpdump/main.go b/cmd/rlpdump/main.go index 7e1d314d492..3aef8444110 100644 --- a/cmd/rlpdump/main.go +++ b/cmd/rlpdump/main.go @@ -30,8 +30,8 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/rlp" ) var ( diff --git a/cmd/rlpdump/rlpdump_test.go b/cmd/rlpdump/rlpdump_test.go index 4b0ae680aca..3c87f84263d 100644 --- a/cmd/rlpdump/rlpdump_test.go +++ b/cmd/rlpdump/rlpdump_test.go @@ -22,8 +22,8 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) func TestRoundtrip(t *testing.T) { diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 4b571646655..9db1f780a9b 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -33,20 +33,20 @@ import ( "syscall" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/internal/debug" - "github.com/ethereum/go-ethereum/internal/era" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/internal/debug" + "github.com/ava-labs/libevm/internal/era" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "github.com/urfave/cli/v2" ) diff --git a/cmd/utils/export_test.go b/cmd/utils/export_test.go index 84ba8d0c316..9eb4a7f51ce 100644 --- a/cmd/utils/export_test.go +++ b/cmd/utils/export_test.go @@ -23,8 +23,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/rlp" ) // TestExport does basic sanity checks on the export/import functionality diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index b813e52970d..ac56bc74725 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -34,44 +34,44 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/fdlimit" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/txpool/legacypool" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/catalyst" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/eth/filters" - "github.com/ethereum/go-ethereum/eth/gasprice" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethdb/remotedb" - "github.com/ethereum/go-ethereum/ethstats" - "github.com/ethereum/go-ethereum/graphql" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/metrics/exp" - "github.com/ethereum/go-ethereum/metrics/influxdb" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/p2p/netutil" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/fdlimit" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/txpool/legacypool" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/catalyst" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/eth/filters" + "github.com/ava-labs/libevm/eth/gasprice" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/ethdb/remotedb" + "github.com/ava-labs/libevm/ethstats" + "github.com/ava-labs/libevm/graphql" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/metrics/exp" + "github.com/ava-labs/libevm/metrics/influxdb" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/nat" + "github.com/ava-labs/libevm/p2p/netutil" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" pcsclite "github.com/gballet/go-libpcsclite" gopsutil "github.com/shirou/gopsutil/mem" "github.com/urfave/cli/v2" diff --git a/cmd/utils/flags_legacy.go b/cmd/utils/flags_legacy.go index 243abd83110..9bbf3431a10 100644 --- a/cmd/utils/flags_legacy.go +++ b/cmd/utils/flags_legacy.go @@ -19,8 +19,8 @@ package utils import ( "fmt" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/internal/flags" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/internal/flags" "github.com/urfave/cli/v2" ) diff --git a/cmd/utils/history_test.go b/cmd/utils/history_test.go index 9b7f1797d8d..30ff0d65468 100644 --- a/cmd/utils/history_test.go +++ b/cmd/utils/history_test.go @@ -26,17 +26,17 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/era" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/era" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" ) var ( diff --git a/cmd/utils/prompt.go b/cmd/utils/prompt.go index f513e381888..adf899fee23 100644 --- a/cmd/utils/prompt.go +++ b/cmd/utils/prompt.go @@ -20,7 +20,7 @@ package utils import ( "fmt" - "github.com/ethereum/go-ethereum/console/prompt" + "github.com/ava-labs/libevm/console/prompt" ) // GetPassPhrase displays the given text(prompt) to the user and requests some textual diff --git a/common/bitutil/compress_test.go b/common/bitutil/compress_test.go index c6f6fe8bcf0..7642ab30399 100644 --- a/common/bitutil/compress_test.go +++ b/common/bitutil/compress_test.go @@ -22,7 +22,7 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) // Tests that data bitset encoding and decoding works and is bijective. diff --git a/common/bytes.go b/common/bytes.go index d1f5c6c9958..13c13131d7f 100644 --- a/common/bytes.go +++ b/common/bytes.go @@ -21,7 +21,7 @@ import ( "encoding/hex" "errors" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) // FromHex returns the bytes represented by the hexadecimal string s. diff --git a/common/hexutil/json_example_test.go b/common/hexutil/json_example_test.go index 80180d91868..122abc48bfe 100644 --- a/common/hexutil/json_example_test.go +++ b/common/hexutil/json_example_test.go @@ -20,7 +20,7 @@ import ( "encoding/json" "fmt" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) type MyType [5]byte diff --git a/common/math/big_test.go b/common/math/big_test.go index 803b5e1cc61..559779d34c2 100644 --- a/common/math/big_test.go +++ b/common/math/big_test.go @@ -22,7 +22,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func TestHexOrDecimal256(t *testing.T) { diff --git a/common/prque/lazyqueue.go b/common/prque/lazyqueue.go index 59bda72fa7e..fef2e05a2c8 100644 --- a/common/prque/lazyqueue.go +++ b/common/prque/lazyqueue.go @@ -20,7 +20,7 @@ import ( "container/heap" "time" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/ava-labs/libevm/common/mclock" "golang.org/x/exp/constraints" ) diff --git a/common/prque/lazyqueue_test.go b/common/prque/lazyqueue_test.go index ffb7e5e9e38..ed409e71903 100644 --- a/common/prque/lazyqueue_test.go +++ b/common/prque/lazyqueue_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/ava-labs/libevm/common/mclock" ) const ( diff --git a/common/types.go b/common/types.go index aadca87f82a..64887bf8035 100644 --- a/common/types.go +++ b/common/types.go @@ -29,7 +29,7 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" "golang.org/x/crypto/sha3" ) diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index a350e383a29..677cdf30e99 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -21,15 +21,15 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/trie" "github.com/holiman/uint256" ) diff --git a/consensus/beacon/faker.go b/consensus/beacon/faker.go index 981e345e3e1..f7612124139 100644 --- a/consensus/beacon/faker.go +++ b/consensus/beacon/faker.go @@ -19,8 +19,8 @@ package beacon import ( "math/big" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core/types" ) // NewFaker creates a fake consensus engine for testing. diff --git a/consensus/clique/api.go b/consensus/clique/api.go index 374b50692d8..986e3b6b7e3 100644 --- a/consensus/clique/api.go +++ b/consensus/clique/api.go @@ -20,12 +20,12 @@ import ( "encoding/json" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/rpc" ) // API is a user facing RPC API to allow controlling the signer and voting diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index c693189ea5e..c5d108337d7 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -27,22 +27,22 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - lru "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/misc" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + lru "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/misc" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/trie" "golang.org/x/crypto/sha3" ) diff --git a/consensus/clique/clique_test.go b/consensus/clique/clique_test.go index 8ef8dbffa97..2183f04b47d 100644 --- a/consensus/clique/clique_test.go +++ b/consensus/clique/clique_test.go @@ -20,13 +20,13 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" ) // This test case is a repro of an annoying bug that took us forever to catch. diff --git a/consensus/clique/snapshot.go b/consensus/clique/snapshot.go index a97115121b8..35488cc45d1 100644 --- a/consensus/clique/snapshot.go +++ b/consensus/clique/snapshot.go @@ -21,13 +21,13 @@ import ( "encoding/json" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" "golang.org/x/exp/slices" ) diff --git a/consensus/clique/snapshot_test.go b/consensus/clique/snapshot_test.go index 26cebe008a8..a77bae0d6c3 100644 --- a/consensus/clique/snapshot_test.go +++ b/consensus/clique/snapshot_test.go @@ -23,13 +23,13 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" "golang.org/x/exp/slices" ) diff --git a/consensus/consensus.go b/consensus/consensus.go index 3a2c2d22291..f5de068fc49 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -20,11 +20,11 @@ package consensus import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) // ChainHeaderReader defines a small collection of methods needed to access the local diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index c2936fd4b34..562efe2ab3d 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -23,16 +23,16 @@ import ( "time" mapset "github.com/deckarep/golang-set/v2" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/misc" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/misc" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" "github.com/holiman/uint256" "golang.org/x/crypto/sha3" ) diff --git a/consensus/ethash/consensus_test.go b/consensus/ethash/consensus_test.go index e3793cd1b01..eff56aa4176 100644 --- a/consensus/ethash/consensus_test.go +++ b/consensus/ethash/consensus_test.go @@ -26,10 +26,10 @@ import ( "path/filepath" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) type diffTest struct { diff --git a/consensus/ethash/difficulty.go b/consensus/ethash/difficulty.go index 66a18059c61..bb44d6e4124 100644 --- a/consensus/ethash/difficulty.go +++ b/consensus/ethash/difficulty.go @@ -19,7 +19,7 @@ package ethash import ( "math/big" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/core/types" "github.com/holiman/uint256" ) diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index f37ec260567..069595c86d0 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -20,9 +20,9 @@ package ethash import ( "time" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rpc" ) // Ethash is a consensus engine based on proof-of-work implementing the ethash diff --git a/consensus/merger.go b/consensus/merger.go index ffbcbf2b856..491c57d1dd5 100644 --- a/consensus/merger.go +++ b/consensus/merger.go @@ -20,10 +20,10 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" ) // transitionStatus describes the status of eth1/2 transition. This switch diff --git a/consensus/misc/dao.go b/consensus/misc/dao.go index e21a44f63de..690c9bc8712 100644 --- a/consensus/misc/dao.go +++ b/consensus/misc/dao.go @@ -21,9 +21,9 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/consensus/misc/eip1559/eip1559.go b/consensus/misc/eip1559/eip1559.go index 84b82c4c492..79788cca542 100644 --- a/consensus/misc/eip1559/eip1559.go +++ b/consensus/misc/eip1559/eip1559.go @@ -21,11 +21,11 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/consensus/misc" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/consensus/misc" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) // VerifyEIP1559Header verifies some header attributes which were changed in EIP-1559, diff --git a/consensus/misc/eip1559/eip1559_test.go b/consensus/misc/eip1559/eip1559_test.go index b5afdf0fe5e..958ecb4ef86 100644 --- a/consensus/misc/eip1559/eip1559_test.go +++ b/consensus/misc/eip1559/eip1559_test.go @@ -20,9 +20,9 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) // copyConfig does a _shallow_ copy of a given config. Safe to set new values, but diff --git a/consensus/misc/eip4844/eip4844.go b/consensus/misc/eip4844/eip4844.go index 2dad9a0cd3d..feccf03b2b8 100644 --- a/consensus/misc/eip4844/eip4844.go +++ b/consensus/misc/eip4844/eip4844.go @@ -21,8 +21,8 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) var ( diff --git a/consensus/misc/eip4844/eip4844_test.go b/consensus/misc/eip4844/eip4844_test.go index ec417380fcb..dbc217b178f 100644 --- a/consensus/misc/eip4844/eip4844_test.go +++ b/consensus/misc/eip4844/eip4844_test.go @@ -21,7 +21,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) func TestCalcExcessBlobGas(t *testing.T) { diff --git a/consensus/misc/gaslimit.go b/consensus/misc/gaslimit.go index dfcabd9a802..a4814251be1 100644 --- a/consensus/misc/gaslimit.go +++ b/consensus/misc/gaslimit.go @@ -19,7 +19,7 @@ package misc import ( "fmt" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) // VerifyGaslimit verifies the header gas limit according increase/decrease diff --git a/console/bridge.go b/console/bridge.go index 37578041ca9..e0cc4d9aa82 100644 --- a/console/bridge.go +++ b/console/bridge.go @@ -26,12 +26,12 @@ import ( "time" "github.com/dop251/goja" - "github.com/ethereum/go-ethereum/accounts/scwallet" - "github.com/ethereum/go-ethereum/accounts/usbwallet" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/console/prompt" - "github.com/ethereum/go-ethereum/internal/jsre" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/accounts/scwallet" + "github.com/ava-labs/libevm/accounts/usbwallet" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/console/prompt" + "github.com/ava-labs/libevm/internal/jsre" + "github.com/ava-labs/libevm/rpc" ) // bridge is a collection of JavaScript utility methods to bride the .js runtime diff --git a/console/bridge_test.go b/console/bridge_test.go index e57e294fc5a..d4e5c968d91 100644 --- a/console/bridge_test.go +++ b/console/bridge_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/dop251/goja" - "github.com/ethereum/go-ethereum/internal/jsre" + "github.com/ava-labs/libevm/internal/jsre" ) // TestUndefinedAsParam ensures that personal functions can receive diff --git a/console/console.go b/console/console.go index cdee53684ec..f8db91e5657 100644 --- a/console/console.go +++ b/console/console.go @@ -30,12 +30,12 @@ import ( "syscall" "github.com/dop251/goja" - "github.com/ethereum/go-ethereum/console/prompt" - "github.com/ethereum/go-ethereum/internal/jsre" - "github.com/ethereum/go-ethereum/internal/jsre/deps" - "github.com/ethereum/go-ethereum/internal/web3ext" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/console/prompt" + "github.com/ava-labs/libevm/internal/jsre" + "github.com/ava-labs/libevm/internal/jsre/deps" + "github.com/ava-labs/libevm/internal/web3ext" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rpc" "github.com/mattn/go-colorable" "github.com/peterh/liner" ) diff --git a/console/console_test.go b/console/console_test.go index a13be6a99de..b2686be734a 100644 --- a/console/console_test.go +++ b/console/console_test.go @@ -25,14 +25,14 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/console/prompt" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/internal/jsre" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/node" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/console/prompt" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/internal/jsre" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/node" ) const ( diff --git a/core/asm/asm.go b/core/asm/asm.go index 294eb6ffaad..f73fca93e5d 100644 --- a/core/asm/asm.go +++ b/core/asm/asm.go @@ -21,7 +21,7 @@ import ( "encoding/hex" "fmt" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/core/vm" ) // Iterator for disassembled EVM instructions diff --git a/core/asm/compiler.go b/core/asm/compiler.go index 02c589b2c1a..99f5b642ebb 100644 --- a/core/asm/compiler.go +++ b/core/asm/compiler.go @@ -24,8 +24,8 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/vm" ) // Compiler contains information about the parsed source diff --git a/core/bench_test.go b/core/bench_test.go index 97713868a54..2cb8d8c97d8 100644 --- a/core/bench_test.go +++ b/core/bench_test.go @@ -21,15 +21,15 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/params" ) func BenchmarkInsertChain_empty_memdb(b *testing.B) { diff --git a/core/block_validator.go b/core/block_validator.go index f3d65cea25f..1e6c733bd2b 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -20,11 +20,11 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" ) // BlockValidator is responsible for validating block headers, uncles and diff --git a/core/block_validator_test.go b/core/block_validator_test.go index 385c0afd9d4..b6c2a7c6908 100644 --- a/core/block_validator_test.go +++ b/core/block_validator_test.go @@ -21,16 +21,16 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/clique" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/clique" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" ) // Tests that simple header verification works, for both good and bad blocks. diff --git a/core/blockchain.go b/core/blockchain.go index b1bbc3d5982..0c1078721f5 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -28,28 +28,28 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/common/prque" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/internal/syncx" - "github.com/ethereum/go-ethereum/internal/version" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/common/prque" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/internal/syncx" + "github.com/ava-labs/libevm/internal/version" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" "golang.org/x/exp/slices" ) diff --git a/core/blockchain_insert.go b/core/blockchain_insert.go index 9bf662b6b71..be2dba8b2b3 100644 --- a/core/blockchain_insert.go +++ b/core/blockchain_insert.go @@ -19,10 +19,10 @@ package core import ( "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" ) // insertStats tracks and reports on block insertion. diff --git a/core/blockchain_reader.go b/core/blockchain_reader.go index 9e8e3bd4195..7841d0c59a9 100644 --- a/core/blockchain_reader.go +++ b/core/blockchain_reader.go @@ -20,17 +20,17 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/triedb" ) // CurrentHeader retrieves the current head header of the canonical chain. The diff --git a/core/blockchain_repair_test.go b/core/blockchain_repair_test.go index b2df39d17bb..e9037f9ec14 100644 --- a/core/blockchain_repair_test.go +++ b/core/blockchain_repair_test.go @@ -26,12 +26,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/params" ) // Tests a recovery for a short canonical chain where a recent block was already diff --git a/core/blockchain_sethead_test.go b/core/blockchain_sethead_test.go index 1504c74e0ef..8184a0fe557 100644 --- a/core/blockchain_sethead_test.go +++ b/core/blockchain_sethead_test.go @@ -27,16 +27,16 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" ) // rewindTest is a test case for chain rollback upon user request. diff --git a/core/blockchain_snapshot_test.go b/core/blockchain_snapshot_test.go index dd012c430c4..6d95788ad54 100644 --- a/core/blockchain_snapshot_test.go +++ b/core/blockchain_snapshot_test.go @@ -29,13 +29,13 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/params" ) // snapshotTestBasic wraps the common testing fields in the snapshot tests. diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 876d662f74d..c96ea5e847d 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -26,20 +26,20 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "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/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "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/libevm/params" + "github.com/ava-labs/libevm/trie" "github.com/holiman/uint256" ) diff --git a/core/blocks.go b/core/blocks.go index f20ba4aaf29..d40166b3a34 100644 --- a/core/blocks.go +++ b/core/blocks.go @@ -16,7 +16,7 @@ package core -import "github.com/ethereum/go-ethereum/common" +import "github.com/ava-labs/libevm/common" // BadHashes represent a set of manually tracked bad hashes (usually hard forks) var BadHashes = map[common.Hash]bool{ diff --git a/core/bloom_indexer.go b/core/bloom_indexer.go index 68a35d811e4..f0b98459d24 100644 --- a/core/bloom_indexer.go +++ b/core/bloom_indexer.go @@ -20,12 +20,12 @@ import ( "context" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/bitutil" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/bitutil" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" ) const ( diff --git a/core/bloombits/generator.go b/core/bloombits/generator.go index 646151db0bf..1d8041f2c7e 100644 --- a/core/bloombits/generator.go +++ b/core/bloombits/generator.go @@ -19,7 +19,7 @@ package bloombits import ( "errors" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/core/types" ) var ( diff --git a/core/bloombits/generator_test.go b/core/bloombits/generator_test.go index ac1aee0b252..401e8e8a013 100644 --- a/core/bloombits/generator_test.go +++ b/core/bloombits/generator_test.go @@ -22,7 +22,7 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/core/types" ) // Tests that batched bloom bits are correctly rotated from the input bloom diff --git a/core/bloombits/matcher.go b/core/bloombits/matcher.go index 6a4cfb23db1..990527f36d7 100644 --- a/core/bloombits/matcher.go +++ b/core/bloombits/matcher.go @@ -26,8 +26,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 diff --git a/core/bloombits/matcher_test.go b/core/bloombits/matcher_test.go index 7f3d5f279ca..b38d423d716 100644 --- a/core/bloombits/matcher_test.go +++ b/core/bloombits/matcher_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) const testSectionSize = 4096 diff --git a/core/chain_indexer.go b/core/chain_indexer.go index f5fce725883..4cbda663645 100644 --- a/core/chain_indexer.go +++ b/core/chain_indexer.go @@ -25,12 +25,12 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" ) // ChainIndexerBackend defines the methods needed to process chain segments in diff --git a/core/chain_indexer_test.go b/core/chain_indexer_test.go index f0996090155..48396a995d4 100644 --- a/core/chain_indexer_test.go +++ b/core/chain_indexer_test.go @@ -25,9 +25,9 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" ) // Runs multiple tests with randomized parameters. diff --git a/core/chain_makers.go b/core/chain_makers.go index 733030fd1c9..b2de06d9df9 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -20,18 +20,18 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/misc" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/misc" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/triedb" "github.com/holiman/uint256" ) diff --git a/core/chain_makers_test.go b/core/chain_makers_test.go index b46b898afb9..c9091fb6313 100644 --- a/core/chain_makers_test.go +++ b/core/chain_makers_test.go @@ -23,15 +23,15 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/triedb" ) func TestGeneratePOSChain(t *testing.T) { diff --git a/core/dao_test.go b/core/dao_test.go index b9a899ef2f9..7ae93cf817c 100644 --- a/core/dao_test.go +++ b/core/dao_test.go @@ -20,10 +20,10 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/params" ) // Tests that DAO-fork enabled clients can properly filter out fork-commencing diff --git a/core/error.go b/core/error.go index 72cacf8c78d..7b004b32c96 100644 --- a/core/error.go +++ b/core/error.go @@ -19,7 +19,7 @@ package core import ( "errors" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/core/types" ) var ( diff --git a/core/events.go b/core/events.go index ac935a137f5..c5198a92833 100644 --- a/core/events.go +++ b/core/events.go @@ -17,8 +17,8 @@ package core import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) // NewTxsEvent is posted when a batch of transactions enter the transaction pool. diff --git a/core/evm.go b/core/evm.go index 73f6d7bc20a..1be8d6d0ffe 100644 --- a/core/evm.go +++ b/core/evm.go @@ -19,11 +19,11 @@ package core import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" "github.com/holiman/uint256" ) @@ -73,6 +73,7 @@ func NewEVMBlockContext(header *types.Header, chain ChainContext, author *common BlobBaseFee: blobBaseFee, GasLimit: header.GasLimit, Random: random, + Header: header, } } diff --git a/core/forkchoice.go b/core/forkchoice.go index b293c851bf2..b4571fc63bd 100644 --- a/core/forkchoice.go +++ b/core/forkchoice.go @@ -22,11 +22,11 @@ import ( "math/big" mrand "math/rand" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" ) // ChainReader defines a small collection of methods needed to access the local diff --git a/core/forkid/forkid.go b/core/forkid/forkid.go index 76825d3befc..0a0f0db2098 100644 --- a/core/forkid/forkid.go +++ b/core/forkid/forkid.go @@ -26,9 +26,9 @@ import ( "reflect" "strings" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" "golang.org/x/exp/slices" ) diff --git a/core/forkid/forkid_test.go b/core/forkid/forkid_test.go index b9d346bd905..54f37be5528 100644 --- a/core/forkid/forkid_test.go +++ b/core/forkid/forkid_test.go @@ -23,11 +23,11 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) // TestCreation tests that different genesis and fork rule combinations result in diff --git a/core/gen_genesis.go b/core/gen_genesis.go index b8acf9df7c9..2e041d54bb3 100644 --- a/core/gen_genesis.go +++ b/core/gen_genesis.go @@ -7,11 +7,11 @@ import ( "errors" "math/big" - "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/core/types" - "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/core/types" + "github.com/ava-labs/libevm/params" ) var _ = (*genesisSpecMarshaling)(nil) diff --git a/core/genesis.go b/core/genesis.go index 54570ac61e4..70e79607531 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -24,20 +24,20 @@ import ( "math/big" "strings" - "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/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "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/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/pathdb" "github.com/holiman/uint256" ) diff --git a/core/genesis_test.go b/core/genesis_test.go index 61be0bd252c..0db8f3721ce 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -24,15 +24,15 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/pathdb" ) func TestInvalidCliqueConfig(t *testing.T) { diff --git a/core/headerchain.go b/core/headerchain.go index 519a32ab80a..dcf122c651c 100644 --- a/core/headerchain.go +++ b/core/headerchain.go @@ -26,15 +26,15 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) const ( diff --git a/core/headerchain_test.go b/core/headerchain_test.go index 25d9bfffcb0..761a81a5958 100644 --- a/core/headerchain_test.go +++ b/core/headerchain_test.go @@ -23,12 +23,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/triedb" ) func verifyUnbrokenCanonchain(hc *HeaderChain) error { diff --git a/core/mkalloc.go b/core/mkalloc.go index 12c40c14fbe..69dc0f92d74 100644 --- a/core/mkalloc.go +++ b/core/mkalloc.go @@ -32,9 +32,9 @@ import ( "os" "strconv" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/rlp" "golang.org/x/exp/slices" ) diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 964b3a311de..2eeceb51741 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -23,14 +23,14 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "golang.org/x/exp/slices" ) diff --git a/core/rawdb/accessors_chain_test.go b/core/rawdb/accessors_chain_test.go index a7ceb72998a..9e628825c9e 100644 --- a/core/rawdb/accessors_chain_test.go +++ b/core/rawdb/accessors_chain_test.go @@ -26,11 +26,11 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "golang.org/x/crypto/sha3" ) diff --git a/core/rawdb/accessors_indexes.go b/core/rawdb/accessors_indexes.go index 4f2ef0a8808..c787733ef27 100644 --- a/core/rawdb/accessors_indexes.go +++ b/core/rawdb/accessors_indexes.go @@ -20,12 +20,12 @@ import ( "bytes" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) // ReadTxLookupEntry retrieves the positional metadata associated with a transaction diff --git a/core/rawdb/accessors_indexes_test.go b/core/rawdb/accessors_indexes_test.go index 124389ba7a1..2f1feb17a23 100644 --- a/core/rawdb/accessors_indexes_test.go +++ b/core/rawdb/accessors_indexes_test.go @@ -21,12 +21,12 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/internal/blocktest" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/internal/blocktest" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) var newTestHasher = blocktest.NewHasher diff --git a/core/rawdb/accessors_metadata.go b/core/rawdb/accessors_metadata.go index 859566f722f..5b7892be46b 100644 --- a/core/rawdb/accessors_metadata.go +++ b/core/rawdb/accessors_metadata.go @@ -20,11 +20,11 @@ import ( "encoding/json" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) // ReadDatabaseVersion retrieves the version number of the database. diff --git a/core/rawdb/accessors_snapshot.go b/core/rawdb/accessors_snapshot.go index 3c82b3f7314..9dfe4605363 100644 --- a/core/rawdb/accessors_snapshot.go +++ b/core/rawdb/accessors_snapshot.go @@ -19,9 +19,9 @@ package rawdb import ( "encoding/binary" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) // ReadSnapshotDisabled retrieves if the snapshot maintenance is disabled. diff --git a/core/rawdb/accessors_state.go b/core/rawdb/accessors_state.go index 9ce58e7d27b..10468c5da03 100644 --- a/core/rawdb/accessors_state.go +++ b/core/rawdb/accessors_state.go @@ -19,9 +19,9 @@ package rawdb import ( "encoding/binary" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) // ReadPreimage retrieves a single preimage of the provided hash. diff --git a/core/rawdb/accessors_sync.go b/core/rawdb/accessors_sync.go index 2dc08b3b728..5a20c46d164 100644 --- a/core/rawdb/accessors_sync.go +++ b/core/rawdb/accessors_sync.go @@ -17,10 +17,10 @@ package rawdb import ( - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" ) // ReadSkeletonSyncStatus retrieves the serialized sync status saved at shutdown. diff --git a/core/rawdb/accessors_trie.go b/core/rawdb/accessors_trie.go index ea3367db360..173a02bb4f2 100644 --- a/core/rawdb/accessors_trie.go +++ b/core/rawdb/accessors_trie.go @@ -20,10 +20,10 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" "golang.org/x/crypto/sha3" ) diff --git a/core/rawdb/ancient_utils.go b/core/rawdb/ancient_utils.go index 428cda544b0..0b15234690a 100644 --- a/core/rawdb/ancient_utils.go +++ b/core/rawdb/ancient_utils.go @@ -20,8 +20,8 @@ import ( "fmt" "path/filepath" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" ) type tableSize struct { diff --git a/core/rawdb/chain_freezer.go b/core/rawdb/chain_freezer.go index bb2c409dbbd..850ecc27b6b 100644 --- a/core/rawdb/chain_freezer.go +++ b/core/rawdb/chain_freezer.go @@ -22,10 +22,10 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" ) const ( diff --git a/core/rawdb/chain_iterator.go b/core/rawdb/chain_iterator.go index 759e5913d13..6a3cd2ead83 100644 --- a/core/rawdb/chain_iterator.go +++ b/core/rawdb/chain_iterator.go @@ -21,12 +21,12 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/prque" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/prque" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" ) // InitDatabaseFromFreezer reinitializes an empty database from a previous batch diff --git a/core/rawdb/chain_iterator_test.go b/core/rawdb/chain_iterator_test.go index 78b0a82e10f..2b31776ceb6 100644 --- a/core/rawdb/chain_iterator_test.go +++ b/core/rawdb/chain_iterator_test.go @@ -23,8 +23,8 @@ import ( "sync" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) func TestChainIterator(t *testing.T) { diff --git a/core/rawdb/database.go b/core/rawdb/database.go index 27a9ec7412c..7a4535e21c0 100644 --- a/core/rawdb/database.go +++ b/core/rawdb/database.go @@ -26,12 +26,12 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethdb/leveldb" - "github.com/ethereum/go-ethereum/ethdb/memorydb" - "github.com/ethereum/go-ethereum/ethdb/pebble" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/ethdb/leveldb" + "github.com/ava-labs/libevm/ethdb/memorydb" + "github.com/ava-labs/libevm/ethdb/pebble" + "github.com/ava-labs/libevm/log" "github.com/olekukonko/tablewriter" ) diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go index b7824ddc0d2..fdf6ce368e6 100644 --- a/core/rawdb/freezer.go +++ b/core/rawdb/freezer.go @@ -26,10 +26,10 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" "github.com/gofrs/flock" ) diff --git a/core/rawdb/freezer_batch.go b/core/rawdb/freezer_batch.go index 84a63a4518d..d3ea615a879 100644 --- a/core/rawdb/freezer_batch.go +++ b/core/rawdb/freezer_batch.go @@ -19,8 +19,8 @@ package rawdb import ( "fmt" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/rlp" "github.com/golang/snappy" ) diff --git a/core/rawdb/freezer_meta.go b/core/rawdb/freezer_meta.go index 9eef9df351d..7134d6504d0 100644 --- a/core/rawdb/freezer_meta.go +++ b/core/rawdb/freezer_meta.go @@ -20,8 +20,8 @@ import ( "io" "os" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" ) const freezerVersion = 1 // The initial version tag of freezer table metadata diff --git a/core/rawdb/freezer_resettable.go b/core/rawdb/freezer_resettable.go index 7a854897381..e0f1f40b938 100644 --- a/core/rawdb/freezer_resettable.go +++ b/core/rawdb/freezer_resettable.go @@ -21,8 +21,8 @@ import ( "path/filepath" "sync" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) const tmpSuffix = ".tmp" diff --git a/core/rawdb/freezer_resettable_test.go b/core/rawdb/freezer_resettable_test.go index d741bc14e54..4b6eb11f9cc 100644 --- a/core/rawdb/freezer_resettable_test.go +++ b/core/rawdb/freezer_resettable_test.go @@ -21,7 +21,7 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/ethdb" ) func TestResetFreezer(t *testing.T) { diff --git a/core/rawdb/freezer_table.go b/core/rawdb/freezer_table.go index 4b9d510e828..4393390e1e7 100644 --- a/core/rawdb/freezer_table.go +++ b/core/rawdb/freezer_table.go @@ -27,9 +27,9 @@ import ( "sync" "sync/atomic" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" "github.com/golang/snappy" ) diff --git a/core/rawdb/freezer_table_test.go b/core/rawdb/freezer_table_test.go index 91b4943e598..24467c9338f 100644 --- a/core/rawdb/freezer_table_test.go +++ b/core/rawdb/freezer_table_test.go @@ -28,7 +28,7 @@ import ( "testing/quick" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" "github.com/stretchr/testify/require" ) diff --git a/core/rawdb/freezer_test.go b/core/rawdb/freezer_test.go index b4bd6a382a8..e6484ab4606 100644 --- a/core/rawdb/freezer_test.go +++ b/core/rawdb/freezer_test.go @@ -27,8 +27,8 @@ import ( "sync" "testing" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/rlp" "github.com/stretchr/testify/require" ) diff --git a/core/rawdb/key_length_iterator.go b/core/rawdb/key_length_iterator.go index d1c5af269a3..aa49294bc6f 100644 --- a/core/rawdb/key_length_iterator.go +++ b/core/rawdb/key_length_iterator.go @@ -16,7 +16,7 @@ package rawdb -import "github.com/ethereum/go-ethereum/ethdb" +import "github.com/ava-labs/libevm/ethdb" // KeyLengthIterator is a wrapper for a database iterator that ensures only key-value pairs // with a specific key length will be returned. diff --git a/core/rawdb/schema.go b/core/rawdb/schema.go index 11cf5b40fef..ec0752e4772 100644 --- a/core/rawdb/schema.go +++ b/core/rawdb/schema.go @@ -21,9 +21,9 @@ import ( "bytes" "encoding/binary" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/metrics" ) // The fields below define the low level database schema prefixing. diff --git a/core/rawdb/table.go b/core/rawdb/table.go index 19e4ed5b5c4..56f2967b4c6 100644 --- a/core/rawdb/table.go +++ b/core/rawdb/table.go @@ -17,7 +17,7 @@ package rawdb import ( - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/ethdb" ) // table is a wrapper around a database that prefixes each key access with a pre- diff --git a/core/rawdb/table_test.go b/core/rawdb/table_test.go index aa6adf3e72b..6ee0fa68e1a 100644 --- a/core/rawdb/table_test.go +++ b/core/rawdb/table_test.go @@ -20,7 +20,7 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/ethdb" ) func TestTableDatabase(t *testing.T) { testTableDatabase(t, "prefix") } diff --git a/core/rlp_test.go b/core/rlp_test.go index bc37408537a..c3c0ce95793 100644 --- a/core/rlp_test.go +++ b/core/rlp_test.go @@ -21,12 +21,12 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "golang.org/x/crypto/sha3" ) diff --git a/core/sender_cacher.go b/core/sender_cacher.go index 4be53619ebe..014e7085ec8 100644 --- a/core/sender_cacher.go +++ b/core/sender_cacher.go @@ -19,7 +19,7 @@ package core import ( "runtime" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/core/types" ) // SenderCacher is a concurrent transaction sender recoverer and cacher. diff --git a/core/state/access_list.go b/core/state/access_list.go index 41946913459..08498651199 100644 --- a/core/state/access_list.go +++ b/core/state/access_list.go @@ -17,7 +17,7 @@ package state import ( - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) type accessList struct { diff --git a/core/state/database.go b/core/state/database.go index 7520923eef4..87a22cf7658 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -21,16 +21,16 @@ import ( "fmt" "github.com/crate-crypto/go-ipa/banderwagon" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/utils" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/utils" + "github.com/ava-labs/libevm/triedb" ) const ( diff --git a/core/state/dump.go b/core/state/dump.go index 55abb50f1c5..23b516fe089 100644 --- a/core/state/dump.go +++ b/core/state/dump.go @@ -21,12 +21,12 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" ) // DumpConfig is a set of options to control what portions of the state will be diff --git a/core/state/iterator.go b/core/state/iterator.go index dc84ce689be..c6ee20ed3eb 100644 --- a/core/state/iterator.go +++ b/core/state/iterator.go @@ -21,10 +21,10 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" ) // nodeIterator is an iterator to traverse the entire state trie post-order, diff --git a/core/state/iterator_test.go b/core/state/iterator_test.go index 73cc22490b6..2be68abcad9 100644 --- a/core/state/iterator_test.go +++ b/core/state/iterator_test.go @@ -19,9 +19,9 @@ package state import ( "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/crypto" ) // Tests that the node iterator indeed walks over the entire database contents. diff --git a/core/state/journal.go b/core/state/journal.go index 6cdc1fc8680..2c92aff5448 100644 --- a/core/state/journal.go +++ b/core/state/journal.go @@ -17,7 +17,7 @@ package state import ( - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" "github.com/holiman/uint256" ) diff --git a/core/state/metrics.go b/core/state/metrics.go index 64c651461e7..da052b9de9c 100644 --- a/core/state/metrics.go +++ b/core/state/metrics.go @@ -16,7 +16,7 @@ package state -import "github.com/ethereum/go-ethereum/metrics" +import "github.com/ava-labs/libevm/metrics" var ( accountUpdatedMeter = metrics.NewRegisteredMeter("state/update/account", nil) diff --git a/core/state/pruner/bloom.go b/core/state/pruner/bloom.go index dad2b5b2a8b..2e828ccd654 100644 --- a/core/state/pruner/bloom.go +++ b/core/state/pruner/bloom.go @@ -21,9 +21,9 @@ import ( "errors" "os" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/log" bloomfilter "github.com/holiman/bloomfilter/v2" ) diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index 59c580dacaf..82771878d69 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -27,15 +27,15 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "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" ) const ( diff --git a/core/state/snapshot/context.go b/core/state/snapshot/context.go index 67d7e41a03c..5ea9c815ad0 100644 --- a/core/state/snapshot/context.go +++ b/core/state/snapshot/context.go @@ -22,12 +22,12 @@ import ( "errors" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethdb/memorydb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/ethdb/memorydb" + "github.com/ava-labs/libevm/log" ) const ( diff --git a/core/state/snapshot/conversion.go b/core/state/snapshot/conversion.go index 681be7ebc01..ef01bdc7ead 100644 --- a/core/state/snapshot/conversion.go +++ b/core/state/snapshot/conversion.go @@ -25,13 +25,13 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" ) // trieKV represents a trie key-value pair diff --git a/core/state/snapshot/difflayer.go b/core/state/snapshot/difflayer.go index 70c9f441896..57fe5c316e9 100644 --- a/core/state/snapshot/difflayer.go +++ b/core/state/snapshot/difflayer.go @@ -25,9 +25,9 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" bloomfilter "github.com/holiman/bloomfilter/v2" "golang.org/x/exp/slices" ) diff --git a/core/state/snapshot/difflayer_test.go b/core/state/snapshot/difflayer_test.go index 674a031b160..75c76e3674e 100644 --- a/core/state/snapshot/difflayer_test.go +++ b/core/state/snapshot/difflayer_test.go @@ -23,9 +23,9 @@ import ( "testing" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb/memorydb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb/memorydb" ) func copyDestructs(destructs map[common.Hash]struct{}) map[common.Hash]struct{} { diff --git a/core/state/snapshot/disklayer.go b/core/state/snapshot/disklayer.go index f5518a204ca..562170023d4 100644 --- a/core/state/snapshot/disklayer.go +++ b/core/state/snapshot/disklayer.go @@ -21,12 +21,12 @@ import ( "sync" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/triedb" ) // diskLayer is a low level persistent snapshot built on top of a key-value store. diff --git a/core/state/snapshot/disklayer_test.go b/core/state/snapshot/disklayer_test.go index 168458c4051..abb44a01f64 100644 --- a/core/state/snapshot/disklayer_test.go +++ b/core/state/snapshot/disklayer_test.go @@ -21,10 +21,10 @@ import ( "testing" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb/memorydb" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb/memorydb" + "github.com/ava-labs/libevm/rlp" ) // reverse reverses the contents of a byte slice. It's used to update random accs diff --git a/core/state/snapshot/generate.go b/core/state/snapshot/generate.go index 8de4b134d38..bf8cd2a3413 100644 --- a/core/state/snapshot/generate.go +++ b/core/state/snapshot/generate.go @@ -23,16 +23,16 @@ import ( "time" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "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/trie/trienode" + "github.com/ava-labs/libevm/triedb" ) var ( diff --git a/core/state/snapshot/generate_test.go b/core/state/snapshot/generate_test.go index da93ebc8750..e3bc94c281b 100644 --- a/core/state/snapshot/generate_test.go +++ b/core/state/snapshot/generate_test.go @@ -22,17 +22,17 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "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/trie/trienode" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" "github.com/holiman/uint256" "golang.org/x/crypto/sha3" ) diff --git a/core/state/snapshot/holdable_iterator.go b/core/state/snapshot/holdable_iterator.go index 1e86ff9d822..590820ac13a 100644 --- a/core/state/snapshot/holdable_iterator.go +++ b/core/state/snapshot/holdable_iterator.go @@ -17,8 +17,8 @@ package snapshot import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" ) // holdableIterator is a wrapper of underlying database iterator. It extends diff --git a/core/state/snapshot/holdable_iterator_test.go b/core/state/snapshot/holdable_iterator_test.go index ce4cf6bb8a6..610ead6ff0b 100644 --- a/core/state/snapshot/holdable_iterator_test.go +++ b/core/state/snapshot/holdable_iterator_test.go @@ -20,8 +20,8 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" ) func TestIteratorHold(t *testing.T) { diff --git a/core/state/snapshot/iterator.go b/core/state/snapshot/iterator.go index c1a196c7ff8..3a410abdc22 100644 --- a/core/state/snapshot/iterator.go +++ b/core/state/snapshot/iterator.go @@ -21,9 +21,9 @@ import ( "fmt" "sort" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" ) // Iterator is an iterator to step over all the accounts or the specific diff --git a/core/state/snapshot/iterator_binary.go b/core/state/snapshot/iterator_binary.go index 22184b25456..fda894fbe55 100644 --- a/core/state/snapshot/iterator_binary.go +++ b/core/state/snapshot/iterator_binary.go @@ -19,7 +19,7 @@ package snapshot import ( "bytes" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // binaryIterator is a simplistic iterator to step over the accounts or storage diff --git a/core/state/snapshot/iterator_fast.go b/core/state/snapshot/iterator_fast.go index 0502d9cf859..5ebd10082a8 100644 --- a/core/state/snapshot/iterator_fast.go +++ b/core/state/snapshot/iterator_fast.go @@ -21,7 +21,7 @@ import ( "fmt" "sort" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" "golang.org/x/exp/slices" ) diff --git a/core/state/snapshot/iterator_test.go b/core/state/snapshot/iterator_test.go index 54614427a5c..5ec9b3df804 100644 --- a/core/state/snapshot/iterator_test.go +++ b/core/state/snapshot/iterator_test.go @@ -25,8 +25,8 @@ import ( "testing" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" ) // TestAccountIteratorBasics tests some simple single-layer(diff and disk) iteration diff --git a/core/state/snapshot/journal.go b/core/state/snapshot/journal.go index 8513e73dd0b..c5e55d1e1c2 100644 --- a/core/state/snapshot/journal.go +++ b/core/state/snapshot/journal.go @@ -25,12 +25,12 @@ import ( "time" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/triedb" ) const journalVersion uint64 = 0 diff --git a/core/state/snapshot/metrics.go b/core/state/snapshot/metrics.go index b2e884588b5..1b7a112f2f1 100644 --- a/core/state/snapshot/metrics.go +++ b/core/state/snapshot/metrics.go @@ -16,7 +16,7 @@ package snapshot -import "github.com/ethereum/go-ethereum/metrics" +import "github.com/ava-labs/libevm/metrics" // Metrics in generation var ( diff --git a/core/state/snapshot/snapshot.go b/core/state/snapshot/snapshot.go index 5c38cb7252f..b65bdf96039 100644 --- a/core/state/snapshot/snapshot.go +++ b/core/state/snapshot/snapshot.go @@ -23,14 +23,14 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/triedb" ) var ( diff --git a/core/state/snapshot/snapshot_test.go b/core/state/snapshot/snapshot_test.go index a9ab3eaea37..df24d56a148 100644 --- a/core/state/snapshot/snapshot_test.go +++ b/core/state/snapshot/snapshot_test.go @@ -25,10 +25,10 @@ import ( "time" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" "github.com/holiman/uint256" ) diff --git a/core/state/snapshot/utils.go b/core/state/snapshot/utils.go index 62f073d2e15..bf5702189bd 100644 --- a/core/state/snapshot/utils.go +++ b/core/state/snapshot/utils.go @@ -21,11 +21,11 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) // CheckDanglingStorage iterates the snap storage data, and verifies that all diff --git a/core/state/state.libevm.go b/core/state/state.libevm.go new file mode 100644 index 00000000000..e2509c76270 --- /dev/null +++ b/core/state/state.libevm.go @@ -0,0 +1,64 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package state + +import ( + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" +) + +// GetExtra returns the extra payload from the [types.StateAccount] associated +// with the address, or a zero-value `SA` if not found. The +// [types.ExtraPayloads] MUST be sourced from [types.RegisterExtras]. +func GetExtra[SA any](s *StateDB, p types.ExtraPayloads[SA], addr common.Address) SA { + stateObject := s.getStateObject(addr) + if stateObject != nil { + return p.FromStateAccount(&stateObject.data) + } + var zero SA + return zero +} + +// SetExtra sets the extra payload for the address. See [GetExtra] for details. +func SetExtra[SA any](s *StateDB, p types.ExtraPayloads[SA], addr common.Address, extra SA) { + stateObject := s.getOrNewStateObject(addr) + if stateObject != nil { + setExtraOnObject(stateObject, p, addr, extra) + } +} + +func setExtraOnObject[SA any](s *stateObject, p types.ExtraPayloads[SA], addr common.Address, extra SA) { + s.db.journal.append(extraChange[SA]{ + payloads: p, + account: &addr, + prev: p.FromStateAccount(&s.data), + }) + p.SetOnStateAccount(&s.data, extra) +} + +// extraChange is a [journalEntry] for [SetExtra] / [setExtraOnObject]. +type extraChange[SA any] struct { + payloads types.ExtraPayloads[SA] + account *common.Address + prev SA +} + +func (e extraChange[SA]) dirtied() *common.Address { return e.account } + +func (e extraChange[SA]) revert(s *StateDB) { + e.payloads.SetOnStateAccount(&s.getStateObject(*e.account).data, e.prev) +} diff --git a/core/state/state.libevm_test.go b/core/state/state.libevm_test.go new file mode 100644 index 00000000000..2f63f42a61a --- /dev/null +++ b/core/state/state.libevm_test.go @@ -0,0 +1,172 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package state_test + +import ( + "fmt" + "reflect" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb/memorydb" + "github.com/ava-labs/libevm/libevm/ethtest" + "github.com/ava-labs/libevm/triedb" +) + +func TestGetSetExtra(t *testing.T) { + type accountExtra struct { + // Data is a pointer to test deep copying. + Data *[]byte // MUST be exported; I spent 20 minutes investigating failing tests because I'm an idiot + } + + types.TestOnlyClearRegisteredExtras() + t.Cleanup(types.TestOnlyClearRegisteredExtras) + // Just as its Data field is a pointer, the registered type is a pointer to + // test deep copying. + payloads := types.RegisterExtras[*accountExtra]() + + rng := ethtest.NewPseudoRand(42) + addr := rng.Address() + nonce := rng.Uint64() + balance := rng.Uint256() + buf := rng.Bytes(8) + extra := &accountExtra{Data: &buf} + + views := newWithSnaps(t) + stateDB := views.newStateDB(t, types.EmptyRootHash) + + assert.Nilf(t, state.GetExtra(stateDB, payloads, addr), "state.GetExtra() returns zero-value %T if before account creation", extra) + stateDB.CreateAccount(addr) + stateDB.SetNonce(addr, nonce) + stateDB.SetBalance(addr, balance) + assert.Nilf(t, state.GetExtra(stateDB, payloads, addr), "state.GetExtra() returns zero-value %T if after account creation but before SetExtra()", extra) + state.SetExtra(stateDB, payloads, addr, extra) + require.Equal(t, extra, state.GetExtra(stateDB, payloads, addr), "state.GetExtra() immediately after SetExtra()") + + root, err := stateDB.Commit(1, false) // arbitrary block number + require.NoErrorf(t, err, "%T.Commit(1, false)", stateDB) + require.NotEqualf(t, types.EmptyRootHash, root, "root hash returned by %T.Commit() is not the empty root", stateDB) + + t.Run(fmt.Sprintf("retrieve from %T", views.snaps), func(t *testing.T) { + iter, err := views.snaps.AccountIterator(root, common.Hash{}) + require.NoErrorf(t, err, "%T.AccountIterator(...)", views.snaps) + defer iter.Release() + + require.Truef(t, iter.Next(), "%T.Next() (i.e. at least one account)", iter) + require.NoErrorf(t, iter.Error(), "%T.Error()", iter) + + t.Run("types.FullAccount()", func(t *testing.T) { + got, err := types.FullAccount(iter.Account()) + require.NoErrorf(t, err, "types.FullAccount(%T.Account())", iter) + + want := &types.StateAccount{ + Nonce: nonce, + Balance: balance, + Root: types.EmptyRootHash, + CodeHash: types.EmptyCodeHash[:], + } + payloads.SetOnStateAccount(want, extra) + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("types.FullAccount(%T.Account()) diff (-want +got):\n%s", iter, diff) + } + }) + + require.Falsef(t, iter.Next(), "%T.Next() after first account (i.e. only one)", iter) + }) + + t.Run(fmt.Sprintf("retrieve from new %T", stateDB), func(t *testing.T) { + s := views.newStateDB(t, root) + assert.Equalf(t, nonce, s.GetNonce(addr), "%T.GetNonce()", s) + assert.Equalf(t, balance, s.GetBalance(addr), "%T.GetBalance()", s) + assert.Equal(t, extra, state.GetExtra(s, payloads, addr), "state.GetExtra()") + }) + + t.Run("reverting to snapshot", func(t *testing.T) { + s := views.newStateDB(t, root) + snap := s.Snapshot() + + oldExtra := extra + buf := append(*oldExtra.Data, rng.Bytes(8)...) + newExtra := &accountExtra{Data: &buf} + + state.SetExtra(s, payloads, addr, newExtra) + assert.Equalf(t, newExtra, state.GetExtra(s, payloads, addr), "state.GetExtra() after overwriting with new value") + s.RevertToSnapshot(snap) + assert.Equalf(t, oldExtra, state.GetExtra(s, payloads, addr), "state.GetExtra() after reverting to snapshot") + }) + + t.Run(fmt.Sprintf("%T.Copy()", stateDB), func(t *testing.T) { + require.Equalf(t, reflect.Pointer, reflect.TypeOf(extra).Kind(), "extra-payload type") + require.Equalf(t, reflect.Pointer, reflect.TypeOf(extra.Data).Kind(), "extra-payload field") + + orig := views.newStateDB(t, root) + cp := orig.Copy() + + oldExtra := extra + buf := append(*oldExtra.Data, rng.Bytes(8)...) + newExtra := &accountExtra{Data: &buf} + + assert.Equalf(t, oldExtra, state.GetExtra(orig, payloads, addr), "GetExtra([original %T]) before setting", orig) + assert.Equalf(t, oldExtra, state.GetExtra(cp, payloads, addr), "GetExtra([copy of %T]) returns the same payload", orig) + state.SetExtra(orig, payloads, addr, newExtra) + assert.Equalf(t, newExtra, state.GetExtra(orig, payloads, addr), "GetExtra([original %T]) returns overwritten payload", orig) + assert.Equalf(t, oldExtra, state.GetExtra(cp, payloads, addr), "GetExtra([copy of %T]) returns original payload despite overwriting on original", orig) + }) +} + +// stateViews are different ways to access the same data. +type stateViews struct { + snaps *snapshot.Tree + database state.Database +} + +func (v stateViews) newStateDB(t *testing.T, root common.Hash) *state.StateDB { + t.Helper() + s, err := state.New(root, v.database, v.snaps) + require.NoError(t, err, "state.New()") + return s +} + +func newWithSnaps(t *testing.T) stateViews { + t.Helper() + empty := types.EmptyRootHash + kvStore := memorydb.New() + ethDB := rawdb.NewDatabase(kvStore) + snaps, err := snapshot.New( + snapshot.Config{ + CacheSize: 16, // Mb (arbitrary but non-zero) + }, + kvStore, + triedb.NewDatabase(ethDB, nil), + empty, + ) + require.NoError(t, err, "snapshot.New()") + + return stateViews{ + snaps: snaps, + database: state.NewDatabase(ethDB), + } +} diff --git a/core/state/state_object.go b/core/state/state_object.go index fc26af68dbe..bf77f0d8f20 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -22,12 +22,12 @@ import ( "io" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie/trienode" "github.com/holiman/uint256" ) diff --git a/core/state/state_object_test.go b/core/state/state_object_test.go index 42fd7780258..80f48352562 100644 --- a/core/state/state_object_test.go +++ b/core/state/state_object_test.go @@ -20,7 +20,7 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func BenchmarkCutOriginal(b *testing.B) { diff --git a/core/state/state_test.go b/core/state/state_test.go index 9be610f962d..00186d9c178 100644 --- a/core/state/state_test.go +++ b/core/state/state_test.go @@ -21,12 +21,12 @@ import ( "encoding/json" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/triedb" "github.com/holiman/uint256" ) diff --git a/core/state/statedb.go b/core/state/statedb.go index a4b8cf93e2d..3b706002e76 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -22,17 +22,17 @@ import ( "sort" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" "github.com/holiman/uint256" ) @@ -579,6 +579,7 @@ func (s *StateDB) getDeletedStateObject(addr common.Address) *stateObject { Balance: acc.Balance, CodeHash: acc.CodeHash, Root: common.BytesToHash(acc.Root), + Extra: acc.Extra, // no need to deep-copy as `acc` is short-lived } if len(data.CodeHash) == 0 { data.CodeHash = types.EmptyCodeHash.Bytes() diff --git a/core/state/statedb_fuzz_test.go b/core/state/statedb_fuzz_test.go index b416bcf1f31..81849567ff5 100644 --- a/core/state/statedb_fuzz_test.go +++ b/core/state/statedb_fuzz_test.go @@ -28,16 +28,16 @@ import ( "testing" "testing/quick" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/triestate" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/trie/triestate" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/pathdb" "github.com/holiman/uint256" ) diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go index cd86a7f4b67..271059d6a25 100644 --- a/core/state/statedb_test.go +++ b/core/state/statedb_test.go @@ -29,17 +29,17 @@ import ( "testing" "testing/quick" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" "github.com/holiman/uint256" ) diff --git a/core/state/sync.go b/core/state/sync.go index 411b54eab09..6f476f6a8f8 100644 --- a/core/state/sync.go +++ b/core/state/sync.go @@ -17,11 +17,11 @@ package state import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" ) // NewStateSync creates a new state trie download scheduler. diff --git a/core/state/sync_test.go b/core/state/sync_test.go index 052c166578f..79c354e6cd4 100644 --- a/core/state/sync_test.go +++ b/core/state/sync_test.go @@ -20,16 +20,16 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" "github.com/holiman/uint256" ) diff --git a/core/state/transient_storage.go b/core/state/transient_storage.go index 66e563efa73..6fd7f6b98d0 100644 --- a/core/state/transient_storage.go +++ b/core/state/transient_storage.go @@ -17,7 +17,7 @@ package state import ( - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // transientStorage is a representation of EIP-1153 "Transient Storage". diff --git a/core/state/trie_prefetcher.go b/core/state/trie_prefetcher.go index c2a49417d45..45fac913dd0 100644 --- a/core/state/trie_prefetcher.go +++ b/core/state/trie_prefetcher.go @@ -19,9 +19,9 @@ package state import ( "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" ) var ( diff --git a/core/state/trie_prefetcher_test.go b/core/state/trie_prefetcher_test.go index 711ec832505..fda417efca0 100644 --- a/core/state/trie_prefetcher_test.go +++ b/core/state/trie_prefetcher_test.go @@ -21,9 +21,9 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" "github.com/holiman/uint256" ) diff --git a/core/state_prefetcher.go b/core/state_prefetcher.go index ff867309de3..d4ff5c7743d 100644 --- a/core/state_prefetcher.go +++ b/core/state_prefetcher.go @@ -19,11 +19,11 @@ package core import ( "sync/atomic" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/params" ) // statePrefetcher is a basic Prefetcher, which blindly executes a block on top diff --git a/core/state_processor.go b/core/state_processor.go index 9e32ab4e569..aff353691cf 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -21,14 +21,14 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/misc" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/misc" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" ) // StateProcessor is a basic Processor, which takes care of transitioning diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 7718c0cde48..2add8f21228 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -21,19 +21,19 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" "github.com/holiman/uint256" "golang.org/x/crypto/sha3" ) diff --git a/core/state_transition.go b/core/state_transition.go index 9c4f76d1c58..509403be610 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -21,12 +21,12 @@ import ( "math" "math/big" - "github.com/ethereum/go-ethereum/common" - cmath "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + cmath "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) @@ -365,6 +365,9 @@ func (st *StateTransition) preCheck() error { // However if any consensus issue encountered, return the error directly with // nil evm execution result. func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { + if err := st.canExecuteTransaction(); err != nil { + return nil, err + } // First check this message satisfies all consensus rules before // applying the message. The rules include these clauses // diff --git a/core/state_transition.libevm.go b/core/state_transition.libevm.go new file mode 100644 index 00000000000..8c30ebc4b2e --- /dev/null +++ b/core/state_transition.libevm.go @@ -0,0 +1,24 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package core + +// canExecuteTransaction is a convenience wrapper for calling the +// [params.RulesHooks.CanExecuteTransaction] hook. +func (st *StateTransition) canExecuteTransaction() error { + bCtx := st.evm.Context + rules := st.evm.ChainConfig().Rules(bCtx.BlockNumber, bCtx.Random != nil, bCtx.Time) + return rules.Hooks().CanExecuteTransaction(st.msg.From, st.msg.To, st.state) +} diff --git a/core/state_transition.libevm_test.go b/core/state_transition.libevm_test.go new file mode 100644 index 00000000000..74ab211a79e --- /dev/null +++ b/core/state_transition.libevm_test.go @@ -0,0 +1,56 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package core_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/libevm" + "github.com/ava-labs/libevm/libevm/ethtest" + "github.com/ava-labs/libevm/libevm/hookstest" +) + +func TestCanExecuteTransaction(t *testing.T) { + rng := ethtest.NewPseudoRand(42) + account := rng.Address() + slot := rng.Hash() + + makeErr := func(from common.Address, to *common.Address, val common.Hash) error { + return fmt.Errorf("From: %v To: %v State: %v", from, to, val) + } + hooks := &hookstest.Stub{ + CanExecuteTransactionFn: func(from common.Address, to *common.Address, s libevm.StateReader) error { + return makeErr(from, to, s.GetState(account, slot)) + }, + } + hooks.Register(t) + + value := rng.Hash() + + state, evm := ethtest.NewZeroEVM(t) + state.SetState(account, slot, value) + msg := &core.Message{ + From: rng.Address(), + To: rng.AddressPtr(), + } + _, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(30e6)) + require.EqualError(t, err, makeErr(msg.From, msg.To, value).Error()) +} diff --git a/core/txindexer.go b/core/txindexer.go index 70fe5f33220..121ef968dfd 100644 --- a/core/txindexer.go +++ b/core/txindexer.go @@ -20,9 +20,9 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) // TxIndexProgress is the struct describing the progress for transaction indexing. diff --git a/core/txindexer_test.go b/core/txindexer_test.go index 7b5ff1f206b..1679a19a465 100644 --- a/core/txindexer_test.go +++ b/core/txindexer_test.go @@ -21,13 +21,13 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/params" ) // TestTxIndexer tests the functionalities for managing transaction indexes. diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 3ed698c1b18..8899d7c7e68 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -29,18 +29,18 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "github.com/holiman/billy" "github.com/holiman/uint256" ) diff --git a/core/txpool/blobpool/blobpool_test.go b/core/txpool/blobpool/blobpool_test.go index f7644c1d0ab..97f9ea3aaea 100644 --- a/core/txpool/blobpool/blobpool_test.go +++ b/core/txpool/blobpool/blobpool_test.go @@ -29,20 +29,20 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/ethdb/memorydb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/ethdb/memorydb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "github.com/holiman/billy" "github.com/holiman/uint256" ) diff --git a/core/txpool/blobpool/config.go b/core/txpool/blobpool/config.go index 1d180739cdf..b6afe214be0 100644 --- a/core/txpool/blobpool/config.go +++ b/core/txpool/blobpool/config.go @@ -17,7 +17,7 @@ package blobpool import ( - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) // Config are the configuration parameters of the blob transaction pool. diff --git a/core/txpool/blobpool/evictheap.go b/core/txpool/blobpool/evictheap.go index bc4543a352e..002a7378822 100644 --- a/core/txpool/blobpool/evictheap.go +++ b/core/txpool/blobpool/evictheap.go @@ -22,7 +22,7 @@ import ( "math" "sort" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" "github.com/holiman/uint256" ) diff --git a/core/txpool/blobpool/evictheap_test.go b/core/txpool/blobpool/evictheap_test.go index 01b136551cf..bcb84dc36b5 100644 --- a/core/txpool/blobpool/evictheap_test.go +++ b/core/txpool/blobpool/evictheap_test.go @@ -21,8 +21,8 @@ import ( mrand "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/txpool/blobpool/interface.go b/core/txpool/blobpool/interface.go index 6f296a54bd6..c270bc74a60 100644 --- a/core/txpool/blobpool/interface.go +++ b/core/txpool/blobpool/interface.go @@ -17,10 +17,10 @@ package blobpool import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) // BlockChain defines the minimal set of methods needed to back a blob pool with diff --git a/core/txpool/blobpool/limbo.go b/core/txpool/blobpool/limbo.go index ec754f6894e..36725c69f6d 100644 --- a/core/txpool/blobpool/limbo.go +++ b/core/txpool/blobpool/limbo.go @@ -19,10 +19,10 @@ package blobpool import ( "errors" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" "github.com/holiman/billy" ) diff --git a/core/txpool/blobpool/metrics.go b/core/txpool/blobpool/metrics.go index 52419ade097..f008e216dca 100644 --- a/core/txpool/blobpool/metrics.go +++ b/core/txpool/blobpool/metrics.go @@ -16,7 +16,7 @@ package blobpool -import "github.com/ethereum/go-ethereum/metrics" +import "github.com/ava-labs/libevm/metrics" var ( // datacapGauge tracks the user's configured capacity for the blob pool. It diff --git a/core/txpool/legacypool/journal.go b/core/txpool/legacypool/journal.go index 899ed00bcce..c038825822a 100644 --- a/core/txpool/legacypool/journal.go +++ b/core/txpool/legacypool/journal.go @@ -22,10 +22,10 @@ import ( "io/fs" "os" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" ) // errNoActiveJournal is returned if a transaction is attempted to be inserted diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 4e1d26acf40..edab5a9758e 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -26,17 +26,17 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/prque" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/prque" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/txpool/legacypool/legacypool2_test.go b/core/txpool/legacypool/legacypool2_test.go index c8d3a76b83f..e844aed0229 100644 --- a/core/txpool/legacypool/legacypool2_test.go +++ b/core/txpool/legacypool/legacypool2_test.go @@ -20,12 +20,12 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/event" "github.com/holiman/uint256" ) diff --git a/core/txpool/legacypool/legacypool_test.go b/core/txpool/legacypool/legacypool_test.go index 7ffbf745bb8..5364d1461f3 100644 --- a/core/txpool/legacypool/legacypool_test.go +++ b/core/txpool/legacypool/legacypool_test.go @@ -29,16 +29,16 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" "github.com/holiman/uint256" ) diff --git a/core/txpool/legacypool/list.go b/core/txpool/legacypool/list.go index 7db9c98ace6..6eb43791999 100644 --- a/core/txpool/legacypool/list.go +++ b/core/txpool/legacypool/list.go @@ -25,8 +25,8 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" "github.com/holiman/uint256" "golang.org/x/exp/slices" ) diff --git a/core/txpool/legacypool/list_test.go b/core/txpool/legacypool/list_test.go index 8587c66f7d2..13d9c2f24ea 100644 --- a/core/txpool/legacypool/list_test.go +++ b/core/txpool/legacypool/list_test.go @@ -21,9 +21,9 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" "github.com/holiman/uint256" ) diff --git a/core/txpool/legacypool/noncer.go b/core/txpool/legacypool/noncer.go index 2c65dd2caea..4d13923bd53 100644 --- a/core/txpool/legacypool/noncer.go +++ b/core/txpool/legacypool/noncer.go @@ -19,8 +19,8 @@ package legacypool import ( "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/state" ) // noncer is a tiny virtual state database to manage the executable nonces of diff --git a/core/txpool/subpool.go b/core/txpool/subpool.go index 9881ed1b8f9..7e29eedd0be 100644 --- a/core/txpool/subpool.go +++ b/core/txpool/subpool.go @@ -20,10 +20,10 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" "github.com/holiman/uint256" ) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index be7435247d9..a5c5dd575ac 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -22,12 +22,12 @@ import ( "math/big" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" ) // TxStatus is the current status of a transaction as seen by the pool. diff --git a/core/txpool/validation.go b/core/txpool/validation.go index 8913859e846..1d75036c26e 100644 --- a/core/txpool/validation.go +++ b/core/txpool/validation.go @@ -21,13 +21,13 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" ) var ( diff --git a/core/types.go b/core/types.go index 36eb0d1dedb..7cf487b1609 100644 --- a/core/types.go +++ b/core/types.go @@ -19,9 +19,9 @@ package core import ( "sync/atomic" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" ) // Validator is an interface which defines the standard for block validation. It diff --git a/core/types/account.go b/core/types/account.go index bb0f4ca02e1..efc0927770e 100644 --- a/core/types/account.go +++ b/core/types/account.go @@ -23,9 +23,9 @@ import ( "fmt" "math/big" - "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" ) //go:generate go run github.com/fjl/gencodec -type Account -field-override accountMarshaling -out gen_account.go diff --git a/core/types/block.go b/core/types/block.go index 1a357baa3a4..5563d9e2839 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -26,9 +26,9 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/rlp" ) // A BlockNonce is a 64-bit hash which proves (combined with the diff --git a/core/types/block_test.go b/core/types/block_test.go index cf0b1dd85c1..37e5401975c 100644 --- a/core/types/block_test.go +++ b/core/types/block_test.go @@ -22,12 +22,12 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/blocktest" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/blocktest" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) // from bcValidBlockTest.json, "SimpleTx" diff --git a/core/types/bloom9.go b/core/types/bloom9.go index a560a20724f..175fd36e841 100644 --- a/core/types/bloom9.go +++ b/core/types/bloom9.go @@ -21,8 +21,8 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/crypto" ) type bytesBacked interface { diff --git a/core/types/bloom9_test.go b/core/types/bloom9_test.go index d3178d112ef..3c9f60f07b2 100644 --- a/core/types/bloom9_test.go +++ b/core/types/bloom9_test.go @@ -21,8 +21,8 @@ import ( "math/big" "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 TestBloom(t *testing.T) { diff --git a/core/types/gen_access_tuple.go b/core/types/gen_access_tuple.go index d740b70981a..ce941cf352a 100644 --- a/core/types/gen_access_tuple.go +++ b/core/types/gen_access_tuple.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // MarshalJSON marshals as JSON. diff --git a/core/types/gen_account.go b/core/types/gen_account.go index 4e475896a73..c3c7fb3fdfe 100644 --- a/core/types/gen_account.go +++ b/core/types/gen_account.go @@ -7,9 +7,9 @@ import ( "errors" "math/big" - "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 _ = (*accountMarshaling)(nil) diff --git a/core/types/gen_account_rlp.go b/core/types/gen_account_rlp.go index 8b424493afb..13bd2ad5f5c 100644 --- a/core/types/gen_account_rlp.go +++ b/core/types/gen_account_rlp.go @@ -2,7 +2,7 @@ package types -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *StateAccount) EncodeRLP(_w io.Writer) error { @@ -16,6 +16,9 @@ func (obj *StateAccount) EncodeRLP(_w io.Writer) error { } w.WriteBytes(obj.Root[:]) w.WriteBytes(obj.CodeHash) + if err := obj.Extra.EncodeRLP(w); err != nil { + return err + } w.ListEnd(_tmp0) return w.Flush() } diff --git a/core/types/gen_header_json.go b/core/types/gen_header_json.go index fb1f915d01d..f69d033ad33 100644 --- a/core/types/gen_header_json.go +++ b/core/types/gen_header_json.go @@ -7,8 +7,8 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*headerMarshaling)(nil) diff --git a/core/types/gen_header_rlp.go b/core/types/gen_header_rlp.go index ed6a1a002cd..848f91e7ce9 100644 --- a/core/types/gen_header_rlp.go +++ b/core/types/gen_header_rlp.go @@ -2,7 +2,7 @@ package types -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *Header) EncodeRLP(_w io.Writer) error { diff --git a/core/types/gen_log_json.go b/core/types/gen_log_json.go index 3ffa9c2feb1..db6ddbc3e4c 100644 --- a/core/types/gen_log_json.go +++ b/core/types/gen_log_json.go @@ -6,8 +6,8 @@ import ( "encoding/json" "errors" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*logMarshaling)(nil) diff --git a/core/types/gen_log_rlp.go b/core/types/gen_log_rlp.go index 7e896296684..a9c33bff7ce 100644 --- a/core/types/gen_log_rlp.go +++ b/core/types/gen_log_rlp.go @@ -2,7 +2,7 @@ package types -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *Log) EncodeRLP(_w io.Writer) error { diff --git a/core/types/gen_receipt_json.go b/core/types/gen_receipt_json.go index 4c641a97279..0ab21785aa7 100644 --- a/core/types/gen_receipt_json.go +++ b/core/types/gen_receipt_json.go @@ -7,8 +7,8 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*receiptMarshaling)(nil) diff --git a/core/types/gen_slim_account_rlp.libevm.go b/core/types/gen_slim_account_rlp.libevm.go new file mode 100644 index 00000000000..97e30f27ece --- /dev/null +++ b/core/types/gen_slim_account_rlp.libevm.go @@ -0,0 +1,24 @@ +// Code generated by rlpgen. DO NOT EDIT. + +package types + +import "github.com/ava-labs/libevm/rlp" +import "io" + +func (obj *SlimAccount) EncodeRLP(_w io.Writer) error { + w := rlp.NewEncoderBuffer(_w) + _tmp0 := w.List() + w.WriteUint64(obj.Nonce) + if obj.Balance == nil { + w.Write(rlp.EmptyString) + } else { + w.WriteUint256(obj.Balance) + } + w.WriteBytes(obj.Root) + w.WriteBytes(obj.CodeHash) + if err := obj.Extra.EncodeRLP(w); err != nil { + return err + } + w.ListEnd(_tmp0) + return w.Flush() +} diff --git a/core/types/gen_withdrawal_json.go b/core/types/gen_withdrawal_json.go index 983a7f7a124..cf861954022 100644 --- a/core/types/gen_withdrawal_json.go +++ b/core/types/gen_withdrawal_json.go @@ -5,8 +5,8 @@ package types import ( "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*withdrawalMarshaling)(nil) diff --git a/core/types/gen_withdrawal_rlp.go b/core/types/gen_withdrawal_rlp.go index 6a97c04c815..6a671937908 100644 --- a/core/types/gen_withdrawal_rlp.go +++ b/core/types/gen_withdrawal_rlp.go @@ -2,7 +2,7 @@ package types -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *Withdrawal) EncodeRLP(_w io.Writer) error { diff --git a/core/types/hashes.go b/core/types/hashes.go index 43e9130fd17..f4aaf617d92 100644 --- a/core/types/hashes.go +++ b/core/types/hashes.go @@ -17,9 +17,9 @@ package types import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" ) var ( diff --git a/core/types/hashing.go b/core/types/hashing.go index 224d7a87eaf..14ef8d7957c 100644 --- a/core/types/hashing.go +++ b/core/types/hashing.go @@ -22,9 +22,9 @@ import ( "math" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" "golang.org/x/crypto/sha3" ) diff --git a/core/types/hashing_test.go b/core/types/hashing_test.go index a6949414f30..230acbbbd48 100644 --- a/core/types/hashing_test.go +++ b/core/types/hashing_test.go @@ -24,14 +24,14 @@ import ( mrand "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" ) func TestDeriveSha(t *testing.T) { diff --git a/core/types/log.go b/core/types/log.go index 54c7ff6372c..cfd568fda0d 100644 --- a/core/types/log.go +++ b/core/types/log.go @@ -17,8 +17,8 @@ package types import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) //go:generate go run ../../rlp/rlpgen -type Log -out gen_log_rlp.go diff --git a/core/types/log_test.go b/core/types/log_test.go index 02eef3ecd43..1a09557aa08 100644 --- a/core/types/log_test.go +++ b/core/types/log_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var unmarshalLogTests = map[string]struct { diff --git a/core/types/receipt.go b/core/types/receipt.go index 4f96fde59c4..25ee6f31709 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -24,11 +24,11 @@ import ( "math/big" "unsafe" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) //go:generate go run github.com/fjl/gencodec -type Receipt -field-override receiptMarshaling -out gen_receipt_json.go diff --git a/core/types/receipt_test.go b/core/types/receipt_test.go index a7b26444712..84fdfa633d1 100644 --- a/core/types/receipt_test.go +++ b/core/types/receipt_test.go @@ -24,9 +24,9 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "github.com/holiman/uint256" "github.com/kylelemons/godebug/diff" ) diff --git a/core/types/rlp_fuzzer_test.go b/core/types/rlp_fuzzer_test.go index a3b9f72436b..4e3645874a3 100644 --- a/core/types/rlp_fuzzer_test.go +++ b/core/types/rlp_fuzzer_test.go @@ -22,7 +22,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" "github.com/holiman/uint256" ) diff --git a/core/types/rlp_payload.libevm.go b/core/types/rlp_payload.libevm.go new file mode 100644 index 00000000000..53f84705e45 --- /dev/null +++ b/core/types/rlp_payload.libevm.go @@ -0,0 +1,209 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package types + +import ( + "fmt" + "io" + + "github.com/ava-labs/libevm/libevm/pseudo" + "github.com/ava-labs/libevm/libevm/testonly" + "github.com/ava-labs/libevm/rlp" +) + +// RegisterExtras registers the type `SA` to be carried as an extra payload in +// [StateAccount] structs. It is expected to be called in an `init()` function +// and MUST NOT be called more than once. +// +// The payload will be treated as an extra struct field for the purposes of RLP +// encoding and decoding. RLP handling is plumbed through to the `SA` via the +// [StateAccountExtra] that holds it such that it acts as if there were a field +// of type `SA` in all StateAccount structs. +// +// The payload can be acced via the [ExtraPayloads.FromStateAccount] method of +// the accessor returned by RegisterExtras. +func RegisterExtras[SA any]() ExtraPayloads[SA] { + if registeredExtras != nil { + panic("re-registration of Extras") + } + var extra ExtraPayloads[SA] + registeredExtras = &extraConstructors{ + stateAccountType: func() string { + var x SA + return fmt.Sprintf("%T", x) + }(), + newStateAccount: pseudo.NewConstructor[SA]().Zero, + cloneStateAccount: extra.cloneStateAccount, + } + return extra +} + +// TestOnlyClearRegisteredExtras clears the [Extras] previously passed to +// [RegisterExtras]. It panics if called from a non-testing call stack. +// +// In tests it SHOULD be called before every call to [RegisterExtras] and then +// defer-called afterwards, either directly or via testing.TB.Cleanup(). This is +// a workaround for the single-call limitation on [RegisterExtras]. +func TestOnlyClearRegisteredExtras() { + testonly.OrPanic(func() { + registeredExtras = nil + }) +} + +var registeredExtras *extraConstructors + +type extraConstructors struct { + stateAccountType string + newStateAccount func() *pseudo.Type + cloneStateAccount func(*StateAccountExtra) *StateAccountExtra +} + +func (e *StateAccountExtra) clone() *StateAccountExtra { + switch r := registeredExtras; { + case r == nil, e == nil: + return nil + default: + return r.cloneStateAccount(e) + } +} + +// ExtraPayloads provides strongly typed access to the extra payload carried by +// [StateAccount] structs. The only valid way to construct an instance is by a +// call to [RegisterExtras]. +type ExtraPayloads[SA any] struct { + _ struct{} // make godoc show unexported fields so nobody tries to make their own instance ;) +} + +func (ExtraPayloads[SA]) cloneStateAccount(s *StateAccountExtra) *StateAccountExtra { + v := pseudo.MustNewValue[SA](s.t) + return &StateAccountExtra{ + t: pseudo.From(v.Get()).Type, + } +} + +// FromStateAccount returns the StateAccount's payload. +func (ExtraPayloads[SA]) FromStateAccount(a *StateAccount) SA { + return pseudo.MustNewValue[SA](a.extra().payload()).Get() +} + +// PointerFromStateAccount returns a pointer to the StateAccounts's extra +// payload. This is guaranteed to be non-nil. +// +// Note that copying a StateAccount by dereferencing a pointer will result in a +// shallow copy and that the *SA returned here will therefore be shared by all +// copies. If this is not the desired behaviour, use +// [StateAccount.Copy] or [ExtraPayloads.SetOnStateAccount]. +func (ExtraPayloads[SA]) PointerFromStateAccount(a *StateAccount) *SA { + return pseudo.MustPointerTo[SA](a.extra().payload()).Value.Get() +} + +// SetOnStateAccount sets the StateAccount's payload. +func (ExtraPayloads[SA]) SetOnStateAccount(a *StateAccount, val SA) { + a.extra().t = pseudo.From(val).Type +} + +// A StateAccountExtra carries the extra payload, if any, registered with +// [RegisterExtras]. It SHOULD NOT be used directly; instead use the +// [ExtraPayloads] accessor returned by RegisterExtras. +type StateAccountExtra struct { + t *pseudo.Type +} + +func (a *StateAccount) extra() *StateAccountExtra { + if a.Extra == nil { + a.Extra = &StateAccountExtra{ + t: registeredExtras.newStateAccount(), + } + } + return a.Extra +} + +func (e *StateAccountExtra) payload() *pseudo.Type { + if e.t == nil { + e.t = registeredExtras.newStateAccount() + } + return e.t +} + +// Equal reports whether `e` is semantically equivalent to `f` for the purpose +// of tests. +// +// Equal MUST NOT be used in production. Instead, compare values returned by +// [ExtraPayloads.FromStateAccount]. +func (e *StateAccountExtra) Equal(f *StateAccountExtra) bool { + if false { + // TODO(arr4n): calling this results in an error from cmp.Diff(): + // "non-deterministic or non-symmetric function detected". Explore the + // issue and then enable the enforcement. + testonly.OrPanic(func() {}) + } + + eNil := e == nil || e.t == nil + fNil := f == nil || f.t == nil + if eNil && fNil || eNil && f.t.IsZero() || fNil && e.t.IsZero() { + return true + } + return e.t.Equal(f.t) +} + +var _ interface { + rlp.Encoder + rlp.Decoder + fmt.Formatter +} = (*StateAccountExtra)(nil) + +// EncodeRLP implements the [rlp.Encoder] interface. +func (e *StateAccountExtra) EncodeRLP(w io.Writer) error { + switch r := registeredExtras; { + case r == nil: + return nil + case e == nil: + e = &StateAccountExtra{} + fallthrough + case e.t == nil: + e.t = r.newStateAccount() + } + return e.t.EncodeRLP(w) +} + +// DecodeRLP implements the [rlp.Decoder] interface. +func (e *StateAccountExtra) DecodeRLP(s *rlp.Stream) error { + switch r := registeredExtras; { + case r == nil: + return nil + case e.t == nil: + e.t = r.newStateAccount() + fallthrough + default: + return s.Decode(e.t) + } +} + +// Format implements the [fmt.Formatter] interface. +func (e *StateAccountExtra) Format(s fmt.State, verb rune) { + var out string + switch r := registeredExtras; { + case r == nil: + out = "" + case e == nil, e.t == nil: + out = fmt.Sprintf("[*StateAccountExtra[%s]]", r.stateAccountType) + default: + e.t.Format(s, verb) + return + } + _, _ = s.Write([]byte(out)) +} diff --git a/core/types/state_account.go b/core/types/state_account.go index 52ef843b352..0f7984f186c 100644 --- a/core/types/state_account.go +++ b/core/types/state_account.go @@ -19,12 +19,13 @@ package types import ( "bytes" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/rlp" "github.com/holiman/uint256" ) //go:generate go run ../../rlp/rlpgen -type StateAccount -out gen_account_rlp.go +//go:generate go run ../../rlp/rlpgen -type SlimAccount -out gen_slim_account_rlp.libevm.go // StateAccount is the Ethereum consensus representation of accounts. // These objects are stored in the main account trie. @@ -33,6 +34,8 @@ type StateAccount struct { Balance *uint256.Int Root common.Hash // merkle root of the storage trie CodeHash []byte + + Extra *StateAccountExtra } // NewEmptyStateAccount constructs an empty state account. @@ -55,6 +58,7 @@ func (acct *StateAccount) Copy() *StateAccount { Balance: balance, Root: acct.Root, CodeHash: common.CopyBytes(acct.CodeHash), + Extra: acct.Extra.clone(), } } @@ -66,6 +70,8 @@ type SlimAccount struct { Balance *uint256.Int Root []byte // Nil if root equals to types.EmptyRootHash CodeHash []byte // Nil if hash equals to types.EmptyCodeHash + + Extra *StateAccountExtra } // SlimAccountRLP encodes the state account in 'slim RLP' format. @@ -73,6 +79,7 @@ func SlimAccountRLP(account StateAccount) []byte { slim := SlimAccount{ Nonce: account.Nonce, Balance: account.Balance, + Extra: account.Extra, } if account.Root != EmptyRootHash { slim.Root = account.Root[:] @@ -80,7 +87,7 @@ func SlimAccountRLP(account StateAccount) []byte { if !bytes.Equal(account.CodeHash, EmptyCodeHash[:]) { slim.CodeHash = account.CodeHash } - data, err := rlp.EncodeToBytes(slim) + data, err := rlp.EncodeToBytes(&slim) if err != nil { panic(err) } @@ -96,6 +103,7 @@ func FullAccount(data []byte) (*StateAccount, error) { } var account StateAccount account.Nonce, account.Balance = slim.Nonce, slim.Balance + account.Extra = slim.Extra // Interpret the storage root and code hash in slim format. if len(slim.Root) == 0 { diff --git a/core/types/state_account.libevm_test.go b/core/types/state_account.libevm_test.go new file mode 100644 index 00000000000..89ae3d2e570 --- /dev/null +++ b/core/types/state_account.libevm_test.go @@ -0,0 +1,214 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package types + +import ( + "strings" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/holiman/uint256" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/libevm/pseudo" + "github.com/ava-labs/libevm/rlp" +) + +func TestStateAccountRLP(t *testing.T) { + // RLP encodings that don't involve extra payloads were generated on raw + // geth StateAccounts *before* any libevm modifications, thus locking in + // default behaviour. Encodings that involve a boolean payload were + // generated on ava-labs/coreth StateAccounts to guarantee equivalence. + + type test struct { + name string + register func() + acc *StateAccount + wantHex string + } + + explicitFalseBoolean := test{ + name: "explicit false-boolean extra", + register: func() { + RegisterExtras[bool]() + }, + acc: &StateAccount{ + Nonce: 0x444444, + Balance: uint256.NewInt(0x666666), + Root: common.Hash{}, + CodeHash: []byte{0xbb, 0xbb, 0xbb}, + Extra: &StateAccountExtra{ + t: pseudo.From(false).Type, + }, + }, + wantHex: `0xee8344444483666666a0000000000000000000000000000000000000000000000000000000000000000083bbbbbb80`, + } + + // The vanilla geth code won't set payloads so we need to ensure that the + // zero-value encoding is used instead of the null-value default as when + // no type is registered. + implicitFalseBoolean := explicitFalseBoolean + implicitFalseBoolean.name = "implicit false-boolean extra as zero-value of registered type" + // Clearing the Extra makes the `false` value implicit and due only to the + // fact that we register `bool`. Most importantly, note that `wantHex` + // remains identical. + implicitFalseBoolean.acc.Extra = nil + + tests := []test{ + explicitFalseBoolean, + implicitFalseBoolean, + { + name: "true-boolean extra", + register: func() { + RegisterExtras[bool]() + }, + acc: &StateAccount{ + Nonce: 0x444444, + Balance: uint256.NewInt(0x666666), + Root: common.Hash{}, + CodeHash: []byte{0xbb, 0xbb, 0xbb}, + Extra: &StateAccountExtra{ + t: pseudo.From(true).Type, + }, + }, + wantHex: `0xee8344444483666666a0000000000000000000000000000000000000000000000000000000000000000083bbbbbb01`, + }, + { + name: "vanilla geth account", + acc: &StateAccount{ + Nonce: 0xcccccc, + Balance: uint256.NewInt(0x555555), + Root: common.MaxHash, + CodeHash: []byte{0x77, 0x77, 0x77}, + }, + wantHex: `0xed83cccccc83555555a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83777777`, + }, + { + name: "vanilla geth account", + acc: &StateAccount{ + Nonce: 0x444444, + Balance: uint256.NewInt(0x666666), + Root: common.Hash{}, + CodeHash: []byte{0xbb, 0xbb, 0xbb}, + }, + wantHex: `0xed8344444483666666a0000000000000000000000000000000000000000000000000000000000000000083bbbbbb`, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.register != nil { + TestOnlyClearRegisteredExtras() + tt.register() + t.Cleanup(TestOnlyClearRegisteredExtras) + } + assertRLPEncodingAndReturn(t, tt.acc, tt.wantHex) + + t.Run("RLP round trip via SlimAccount", func(t *testing.T) { + got, err := FullAccount(SlimAccountRLP(*tt.acc)) + require.NoError(t, err) + + if diff := cmp.Diff(tt.acc, got); diff != "" { + t.Errorf("FullAccount(SlimAccountRLP(x)) != x; diff (-want +got):\n%s", diff) + } + }) + }) + } +} + +func assertRLPEncodingAndReturn(t *testing.T, val any, wantHex string) []byte { + t.Helper() + got, err := rlp.EncodeToBytes(val) + require.NoError(t, err, "rlp.EncodeToBytes()") + + t.Logf("got RLP: %#x", got) + wantHex = strings.TrimPrefix(wantHex, "0x") + require.Equalf(t, common.Hex2Bytes(wantHex), got, "RLP encoding of %T", val) + + return got +} + +func TestSlimAccountRLP(t *testing.T) { + // All RLP encodings were generated on geth SlimAccounts *before* libevm + // modifications, to lock in default behaviour. + tests := []struct { + name string + acc *SlimAccount + wantHex string + }{ + { + acc: &SlimAccount{ + Nonce: 0x444444, + Balance: uint256.NewInt(0x777777), + }, + wantHex: `0xca83444444837777778080`, + }, + { + acc: &SlimAccount{ + Nonce: 0x444444, + Balance: uint256.NewInt(0x777777), + Root: common.MaxHash[:], + }, + wantHex: `0xea8344444483777777a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80`, + }, + { + acc: &SlimAccount{ + Nonce: 0x444444, + Balance: uint256.NewInt(0x777777), + CodeHash: common.MaxHash[:], + }, + wantHex: `0xea834444448377777780a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`, + }, + { + acc: &SlimAccount{ + Nonce: 0x444444, + Balance: uint256.NewInt(0x777777), + Root: common.MaxHash[:], + CodeHash: repeatAsHash(0xee).Bytes(), + }, + wantHex: `0xf84a8344444483777777a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + buf := assertRLPEncodingAndReturn(t, tt.acc, tt.wantHex) + + got := new(SlimAccount) + require.NoError(t, rlp.DecodeBytes(buf, got), "rlp.DecodeBytes()") + + opts := []cmp.Option{ + // The require package differentiates between empty and nil + // slices and doesn't have a configuration mechanism. + cmpopts.EquateEmpty(), + } + + if diff := cmp.Diff(tt.acc, got, opts...); diff != "" { + t.Errorf("rlp.DecodeBytes(rlp.EncodeToBytes(%T), ...) round trip; diff (-want +got):\n%s", tt.acc, diff) + } + }) + } +} + +func repeatAsHash(x byte) (h common.Hash) { + for i := range h { + h[i] = x + } + return h +} diff --git a/core/types/state_account_storage.libevm_test.go b/core/types/state_account_storage.libevm_test.go new file mode 100644 index 00000000000..4af3a105dfa --- /dev/null +++ b/core/types/state_account_storage.libevm_test.go @@ -0,0 +1,153 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package types_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/holiman/uint256" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/libevm/ethtest" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" +) + +func TestStateAccountExtraViaTrieStorage(t *testing.T) { + rng := ethtest.NewPseudoRand(1984) + addr := rng.Address() + + type arbitraryPayload struct { + Data string + } + const arbitraryData = "Hello, RLP world!" + + var ( + // The specific trie hashes after inserting the account are irrelevant; + // what's important is that: (a) they are all different; and (b) tests + // of implicit and explicit zero-value payloads have the same hash. + vanillaGeth = common.HexToHash("0x2108846aaec8a88cfa02887527ad8c1beffc11b5ec428b68f15d9ce4e71e4ce1") + trueBool = common.HexToHash("0x665576885e52711e4cf90b72750fc1c17c80c5528bc54244e327414d486a10a4") + falseBool = common.HexToHash("0xa53fcb27d01347e202fb092d0af2a809cb84390c6001cbc151052ee29edc2294") + arbitrary = common.HexToHash("0x94eecff1444ab69437636630918c15596e001b30b973f03e06006ae20aa6e307") + ) + + tests := []struct { + name string + registerAndSetExtra func(*types.StateAccount) *types.StateAccount + assertExtra func(*testing.T, *types.StateAccount) + wantTrieHash common.Hash + }{ + { + name: "vanilla geth", + registerAndSetExtra: func(a *types.StateAccount) *types.StateAccount { + return a + }, + assertExtra: func(t *testing.T, a *types.StateAccount) { + t.Helper() + assert.Truef(t, a.Extra.Equal(nil), "%T.%T.IsEmpty()", a, a.Extra) + }, + wantTrieHash: vanillaGeth, + }, + { + name: "true-boolean payload", + registerAndSetExtra: func(a *types.StateAccount) *types.StateAccount { + types.RegisterExtras[bool]().SetOnStateAccount(a, true) + return a + }, + assertExtra: func(t *testing.T, sa *types.StateAccount) { + t.Helper() + assert.Truef(t, types.ExtraPayloads[bool]{}.FromStateAccount(sa), "") + }, + wantTrieHash: trueBool, + }, + { + name: "explicit false-boolean payload", + registerAndSetExtra: func(a *types.StateAccount) *types.StateAccount { + p := types.RegisterExtras[bool]() + p.SetOnStateAccount(a, false) // the explicit part + return a + }, + assertExtra: func(t *testing.T, sa *types.StateAccount) { + t.Helper() + assert.Falsef(t, types.ExtraPayloads[bool]{}.FromStateAccount(sa), "") + }, + wantTrieHash: falseBool, + }, + { + name: "implicit false-boolean payload", + registerAndSetExtra: func(a *types.StateAccount) *types.StateAccount { + types.RegisterExtras[bool]() + // Note that `a` is reflected, unchanged (the implicit part). + return a + }, + assertExtra: func(t *testing.T, sa *types.StateAccount) { + t.Helper() + assert.Falsef(t, types.ExtraPayloads[bool]{}.FromStateAccount(sa), "") + }, + wantTrieHash: falseBool, + }, + { + name: "arbitrary payload", + registerAndSetExtra: func(a *types.StateAccount) *types.StateAccount { + p := arbitraryPayload{arbitraryData} + types.RegisterExtras[arbitraryPayload]().SetOnStateAccount(a, p) + return a + }, + assertExtra: func(t *testing.T, sa *types.StateAccount) { + t.Helper() + got := types.ExtraPayloads[arbitraryPayload]{}.FromStateAccount(sa) + assert.Equalf(t, arbitraryPayload{arbitraryData}, got, "") + }, + wantTrieHash: arbitrary, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + types.TestOnlyClearRegisteredExtras() + t.Cleanup(types.TestOnlyClearRegisteredExtras) + + acct := tt.registerAndSetExtra(&types.StateAccount{ + Nonce: 42, + Balance: uint256.NewInt(314159), + Root: types.EmptyRootHash, + CodeHash: types.EmptyCodeHash[:], + }) + + db := triedb.NewDatabase(rawdb.NewMemoryDatabase(), nil) + id := trie.TrieID(types.EmptyRootHash) + state, err := trie.NewStateTrie(id, db) + require.NoError(t, err, "trie.NewStateTrie(types.EmptyRootHash, ...)") + + require.NoErrorf(t, state.UpdateAccount(addr, acct), "%T.UpdateAccount(...)", state) + assert.Equalf(t, tt.wantTrieHash, state.Hash(), "%T.Hash() after UpdateAccount()", state) + + got, err := state.GetAccount(addr) + require.NoError(t, err, "state.GetAccount({account updated earlier})") + if diff := cmp.Diff(acct, got); diff != "" { + t.Errorf("%T.GetAccount() not equal to value passed to %[1]T.UpdateAccount(); diff (-want +got):\n%s", state, diff) + } + tt.assertExtra(t, got) + }) + } +} diff --git a/core/types/transaction.go b/core/types/transaction.go index 7d2e9d5325a..b9a8ea92abf 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -25,10 +25,10 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" ) var ( diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 4d5b2bcdd4c..04a23c1f4bb 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -21,9 +21,9 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto/kzg4844" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/crypto/kzg4844" "github.com/holiman/uint256" ) diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 9e26642f753..816699fa13a 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -22,9 +22,9 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" ) var ErrInvalidChainId = errors.New("invalid chain id for signer") diff --git a/core/types/transaction_signing_test.go b/core/types/transaction_signing_test.go index b66577f7ed5..499bcc94f39 100644 --- a/core/types/transaction_signing_test.go +++ b/core/types/transaction_signing_test.go @@ -22,10 +22,10 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) func TestEIP155Signing(t *testing.T) { diff --git a/core/types/transaction_test.go b/core/types/transaction_test.go index 76a010d2e50..408c3e54a81 100644 --- a/core/types/transaction_test.go +++ b/core/types/transaction_test.go @@ -26,9 +26,9 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" ) // The values in those tests are from the Transaction Tests diff --git a/core/types/tx_access_list.go b/core/types/tx_access_list.go index 730a77b7528..3f96da8b958 100644 --- a/core/types/tx_access_list.go +++ b/core/types/tx_access_list.go @@ -20,8 +20,8 @@ import ( "bytes" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/rlp" ) //go:generate go run github.com/fjl/gencodec -type AccessTuple -out gen_access_tuple.go diff --git a/core/types/tx_blob.go b/core/types/tx_blob.go index 25a85695efc..fb98677b5e1 100644 --- a/core/types/tx_blob.go +++ b/core/types/tx_blob.go @@ -21,10 +21,10 @@ import ( "crypto/sha256" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" "github.com/holiman/uint256" ) diff --git a/core/types/tx_blob_test.go b/core/types/tx_blob_test.go index 25d09e31ce4..967c48ed890 100644 --- a/core/types/tx_blob_test.go +++ b/core/types/tx_blob_test.go @@ -4,9 +4,9 @@ import ( "crypto/ecdsa" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/kzg4844" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/kzg4844" "github.com/holiman/uint256" ) diff --git a/core/types/tx_dynamic_fee.go b/core/types/tx_dynamic_fee.go index 8b5b514fdec..171d2aea8c3 100644 --- a/core/types/tx_dynamic_fee.go +++ b/core/types/tx_dynamic_fee.go @@ -20,8 +20,8 @@ import ( "bytes" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/rlp" ) // DynamicFeeTx represents an EIP-1559 transaction. diff --git a/core/types/tx_legacy.go b/core/types/tx_legacy.go index 71025b78fc0..bb810beada5 100644 --- a/core/types/tx_legacy.go +++ b/core/types/tx_legacy.go @@ -20,7 +20,7 @@ import ( "bytes" "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // LegacyTx is the transaction data of the original Ethereum transactions. diff --git a/core/types/types_test.go b/core/types/types_test.go index 1fb386d5dee..f1cab0aa668 100644 --- a/core/types/types_test.go +++ b/core/types/types_test.go @@ -20,9 +20,9 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" ) type devnull struct{ len int } diff --git a/core/types/withdrawal.go b/core/types/withdrawal.go index d1ad918f985..c26c92c2f52 100644 --- a/core/types/withdrawal.go +++ b/core/types/withdrawal.go @@ -19,9 +19,9 @@ package types import ( "bytes" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/rlp" ) //go:generate go run github.com/fjl/gencodec -type Withdrawal -field-override withdrawalMarshaling -out gen_withdrawal_json.go diff --git a/core/vm/analysis_test.go b/core/vm/analysis_test.go index 398861f8ae7..d1cf14de31c 100644 --- a/core/vm/analysis_test.go +++ b/core/vm/analysis_test.go @@ -20,7 +20,7 @@ import ( "math/bits" "testing" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/crypto" ) func TestJumpDestAnalysis(t *testing.T) { diff --git a/core/vm/common.go b/core/vm/common.go index 90ba4a4ad15..eea865d915d 100644 --- a/core/vm/common.go +++ b/core/vm/common.go @@ -17,8 +17,8 @@ package vm import ( - "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" "github.com/holiman/uint256" ) diff --git a/core/vm/contract.go b/core/vm/contract.go index 16b669ebca2..7a94ba3c376 100644 --- a/core/vm/contract.go +++ b/core/vm/contract.go @@ -17,7 +17,7 @@ package vm import ( - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" "github.com/holiman/uint256" ) diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 33a867654e7..dc07de85025 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -23,14 +23,14 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/blake2b" - "github.com/ethereum/go-ethereum/crypto/bls12381" - "github.com/ethereum/go-ethereum/crypto/bn256" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/blake2b" + "github.com/ava-labs/libevm/crypto/bls12381" + "github.com/ava-labs/libevm/crypto/bn256" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/params" "golang.org/x/crypto/ripemd160" ) @@ -148,7 +148,10 @@ func init() { } // ActivePrecompiles returns the precompiles enabled with the current configuration. -func ActivePrecompiles(rules params.Rules) []common.Address { +func ActivePrecompiles(rules params.Rules) (active []common.Address) { + defer func() { + active = rules.Hooks().ActivePrecompiles(append([]common.Address{}, active...)) + }() switch { case rules.IsCancun: return PrecompiledAddressesCancun @@ -168,14 +171,13 @@ func ActivePrecompiles(rules params.Rules) []common.Address { // - the returned bytes, // - the _remaining_ gas, // - any error that occurred -func RunPrecompiledContract(p PrecompiledContract, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) { +func (args *evmCallArgs) RunPrecompiledContract(p PrecompiledContract, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) { gasCost := p.RequiredGas(input) if suppliedGas < gasCost { return nil, 0, ErrOutOfGas } suppliedGas -= gasCost - output, err := p.Run(input) - return output, suppliedGas, err + return args.run(p, input, suppliedGas) } // ECRECOVER implemented as a native contract. diff --git a/core/vm/contracts.libevm.go b/core/vm/contracts.libevm.go new file mode 100644 index 00000000000..a6c9c1a860e --- /dev/null +++ b/core/vm/contracts.libevm.go @@ -0,0 +1,192 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package vm + +import ( + "fmt" + "math/big" + + "github.com/holiman/uint256" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/libevm" + "github.com/ava-labs/libevm/params" +) + +// evmCallArgs mirrors the parameters of the [EVM] methods Call(), CallCode(), +// DelegateCall() and StaticCall(). Its fields are identical to those of the +// parameters, prepended with the receiver name and call type. As +// {Delegate,Static}Call don't accept a value, they MAY set the respective field +// to nil as it will be ignored. +// +// Instantiation can be achieved by merely copying the parameter names, in +// order, which is trivially achieved with AST manipulation: +// +// func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte, gas uint64) ... { +// ... +// args := &evmCallArgs{evm, staticCall, caller, addr, input, gas, nil /*value*/} +type evmCallArgs struct { + evm *EVM + callType CallType + + // args:start + caller ContractRef + addr common.Address + input []byte + gas uint64 + value *uint256.Int + // args:end +} + +// A CallType refers to a *CALL* [OpCode] / respective method on [EVM]. +type CallType uint8 + +const ( + UnknownCallType CallType = iota + Call + CallCode + DelegateCall + StaticCall +) + +// String returns a human-readable representation of the CallType. +func (t CallType) String() string { + switch t { + case Call: + return "Call" + case CallCode: + return "CallCode" + case DelegateCall: + return "DelegateCall" + case StaticCall: + return "StaticCall" + } + return fmt.Sprintf("Unknown %T(%d)", t, t) +} + +// run runs the [PrecompiledContract], differentiating between stateful and +// regular types. +func (args *evmCallArgs) run(p PrecompiledContract, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) { + if p, ok := p.(statefulPrecompile); ok { + return p(args.env(), input, suppliedGas) + } + // Gas consumption for regular precompiles was already handled by the native + // RunPrecompiledContract(), which called this method. + ret, err = p.Run(input) + return ret, suppliedGas, err +} + +// PrecompiledStatefulContract is the stateful equivalent of a +// [PrecompiledContract]. +type PrecompiledStatefulContract func(env PrecompileEnvironment, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) + +// NewStatefulPrecompile constructs a new PrecompiledContract that can be used +// via an [EVM] instance but MUST NOT be called directly; a direct call to Run() +// reserves the right to panic. See other requirements defined in the comments +// on [PrecompiledContract]. +func NewStatefulPrecompile(run PrecompiledStatefulContract) PrecompiledContract { + return statefulPrecompile(run) +} + +// statefulPrecompile implements the [PrecompiledContract] interface to allow a +// [PrecompiledStatefulContract] to be carried with regular geth plumbing. The +// methods are defined on this unexported type instead of directly on +// [PrecompiledStatefulContract] to hide implementation details. +type statefulPrecompile PrecompiledStatefulContract + +// RequiredGas always returns zero as this gas is consumed by native geth code +// before the contract is run. +func (statefulPrecompile) RequiredGas([]byte) uint64 { return 0 } + +func (p statefulPrecompile) Run([]byte) ([]byte, error) { + // https://google.github.io/styleguide/go/best-practices.html#when-to-panic + // This would indicate an API misuse and would occur in tests, not in + // production. + panic(fmt.Sprintf("BUG: call to %T.Run(); MUST call %T itself", p, p)) +} + +// A PrecompileEnvironment provides (a) information about the context in which a +// precompiled contract is being run; and (b) a means of calling other +// contracts. +type PrecompileEnvironment interface { + ChainConfig() *params.ChainConfig + Rules() params.Rules + ReadOnly() bool + // StateDB will be non-nil i.f.f !ReadOnly(). + StateDB() StateDB + // ReadOnlyState will always be non-nil. + ReadOnlyState() libevm.StateReader + Addresses() *libevm.AddressContext + IncomingCallType() CallType + + BlockHeader() (types.Header, error) + BlockNumber() *big.Int + BlockTime() uint64 + + // Call is equivalent to [EVM.Call] except that the `caller` argument is + // removed and automatically determined according to the type of call that + // invoked the precompile. + Call(addr common.Address, input []byte, gas uint64, value *uint256.Int, _ ...CallOption) (ret []byte, gasRemaining uint64, _ error) +} + +func (args *evmCallArgs) env() *environment { + var ( + self common.Address + value = args.value + ) + switch args.callType { + case StaticCall: + value = new(uint256.Int) + fallthrough + case Call: + self = args.addr + + case DelegateCall: + value = nil + fallthrough + case CallCode: + self = args.caller.Address() + } + + // This is equivalent to the `contract` variables created by evm.*Call*() + // methods, for non precompiles, to pass to [EVMInterpreter.Run]. + contract := NewContract(args.caller, AccountRef(self), value, args.gas) + if args.callType == DelegateCall { + contract = contract.AsDelegate() + } + + return &environment{ + evm: args.evm, + self: contract, + callType: args.callType, + } +} + +var ( + // These lock in the assumptions made when implementing [evmCallArgs]. If + // these break then the struct fields SHOULD be changed to match these + // signatures. + _ = [](func(ContractRef, common.Address, []byte, uint64, *uint256.Int) ([]byte, uint64, error)){ + (*EVM)(nil).Call, + (*EVM)(nil).CallCode, + } + _ = [](func(ContractRef, common.Address, []byte, uint64) ([]byte, uint64, error)){ + (*EVM)(nil).DelegateCall, + (*EVM)(nil).StaticCall, + } +) diff --git a/core/vm/contracts.libevm_test.go b/core/vm/contracts.libevm_test.go new file mode 100644 index 00000000000..59c07bbf9a7 --- /dev/null +++ b/core/vm/contracts.libevm_test.go @@ -0,0 +1,705 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package vm_test + +import ( + "bytes" + "fmt" + "math/big" + "reflect" + "strings" + "testing" + + "github.com/holiman/uint256" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "golang.org/x/exp/rand" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/libevm" + "github.com/ava-labs/libevm/libevm/ethtest" + "github.com/ava-labs/libevm/libevm/hookstest" + "github.com/ava-labs/libevm/params" +) + +type precompileStub struct { + requiredGas uint64 + returnData []byte +} + +func (s *precompileStub) RequiredGas([]byte) uint64 { return s.requiredGas } +func (s *precompileStub) Run([]byte) ([]byte, error) { return s.returnData, nil } + +func TestPrecompileOverride(t *testing.T) { + type test struct { + name string + addr common.Address + requiredGas uint64 + stubData []byte + } + + const gasLimit = uint64(1e7) + + tests := []test{ + { + name: "arbitrary values", + addr: common.Address{'p', 'r', 'e', 'c', 'o', 'm', 'p', 'i', 'l', 'e'}, + requiredGas: 314159, + stubData: []byte("the return data"), + }, + } + + rng := rand.New(rand.NewSource(42)) + for _, addr := range vm.PrecompiledAddressesCancun { + tests = append(tests, test{ + name: fmt.Sprintf("existing precompile %v", addr), + addr: addr, + requiredGas: rng.Uint64n(gasLimit), + stubData: addr[:], + }) + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + hooks := &hookstest.Stub{ + PrecompileOverrides: map[common.Address]libevm.PrecompiledContract{ + tt.addr: &precompileStub{ + requiredGas: tt.requiredGas, + returnData: tt.stubData, + }, + }, + } + hooks.Register(t) + + t.Run(fmt.Sprintf("%T.Call([overridden precompile address = %v])", &vm.EVM{}, tt.addr), func(t *testing.T) { + _, evm := ethtest.NewZeroEVM(t) + gotData, gotGasLeft, err := evm.Call(vm.AccountRef{}, tt.addr, nil, gasLimit, uint256.NewInt(0)) + require.NoError(t, err) + assert.Equal(t, tt.stubData, gotData, "contract's return data") + assert.Equal(t, gasLimit-tt.requiredGas, gotGasLeft, "gas left") + }) + }) + } +} + +type statefulPrecompileOutput struct { + ChainID *big.Int + Addresses *libevm.AddressContext + StateValue common.Hash + ReadOnly bool + BlockNumber, Difficulty *big.Int + BlockTime uint64 + Input []byte + IncomingCallType vm.CallType +} + +func (o statefulPrecompileOutput) String() string { + var lines []string + out := reflect.ValueOf(o) + for i, n := 0, out.NumField(); i < n; i++ { + name := out.Type().Field(i).Name + fld := out.Field(i).Interface() + + verb := "%v" + switch fld.(type) { + case []byte: + verb = "%#x" + case *libevm.AddressContext: + verb = "%+v" + case vm.CallType: + verb = "%d (%[2]q)" + } + lines = append(lines, fmt.Sprintf("%s: "+verb, name, fld)) + } + return strings.Join(lines, "\n") +} + +func (o statefulPrecompileOutput) Bytes() []byte { + return []byte(o.String()) +} + +func TestNewStatefulPrecompile(t *testing.T) { + precompile := common.HexToAddress("60C0DE") // GO CODE + rng := ethtest.NewPseudoRand(314159) + slot := rng.Hash() + + const gasLimit = 1e6 + gasCost := rng.Uint64n(gasLimit) + + run := func(env vm.PrecompileEnvironment, input []byte, suppliedGas uint64) ([]byte, uint64, error) { + if got, want := env.StateDB() != nil, !env.ReadOnly(); got != want { + return nil, 0, fmt.Errorf("PrecompileEnvironment().StateDB() must be non-nil i.f.f. not read-only; got non-nil? %t; want %t", got, want) + } + hdr, err := env.BlockHeader() + if err != nil { + return nil, 0, err + } + + out := &statefulPrecompileOutput{ + ChainID: env.ChainConfig().ChainID, + Addresses: env.Addresses(), + StateValue: env.ReadOnlyState().GetState(precompile, slot), + ReadOnly: env.ReadOnly(), + BlockNumber: env.BlockNumber(), + BlockTime: env.BlockTime(), + Difficulty: hdr.Difficulty, + Input: input, + IncomingCallType: env.IncomingCallType(), + } + return out.Bytes(), suppliedGas - gasCost, nil + } + hooks := &hookstest.Stub{ + PrecompileOverrides: map[common.Address]libevm.PrecompiledContract{ + precompile: vm.NewStatefulPrecompile(run), + }, + } + hooks.Register(t) + + header := &types.Header{ + Number: rng.BigUint64(), + Time: rng.Uint64(), + Difficulty: rng.BigUint64(), + } + input := rng.Bytes(8) + value := rng.Hash() + chainID := rng.BigUint64() + + caller := common.HexToAddress("CA11E12") // caller of the precompile + eoa := common.HexToAddress("E0A") // caller of the precompile-caller + callerContract := vm.NewContract(vm.AccountRef(eoa), vm.AccountRef(caller), uint256.NewInt(0), 1e6) + + state, evm := ethtest.NewZeroEVM( + t, + ethtest.WithBlockContext( + core.NewEVMBlockContext(header, nil, rng.AddressPtr()), + ), + ethtest.WithChainConfig( + ¶ms.ChainConfig{ChainID: chainID}, + ), + ) + state.SetState(precompile, slot, value) + evm.Origin = eoa + + tests := []struct { + name string + call func() ([]byte, uint64, error) + wantAddresses *libevm.AddressContext + // Note that this only covers evm.readOnly being true because of the + // precompile's call. See TestInheritReadOnly for alternate case. + wantReadOnly bool + wantCallType vm.CallType + }{ + { + name: "EVM.Call()", + call: func() ([]byte, uint64, error) { + return evm.Call(callerContract, precompile, input, gasLimit, uint256.NewInt(0)) + }, + wantAddresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, + Self: precompile, + }, + wantReadOnly: false, + wantCallType: vm.Call, + }, + { + name: "EVM.CallCode()", + call: func() ([]byte, uint64, error) { + return evm.CallCode(callerContract, precompile, input, gasLimit, uint256.NewInt(0)) + }, + wantAddresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, + Self: caller, + }, + wantReadOnly: false, + wantCallType: vm.CallCode, + }, + { + name: "EVM.DelegateCall()", + call: func() ([]byte, uint64, error) { + return evm.DelegateCall(callerContract, precompile, input, gasLimit) + }, + wantAddresses: &libevm.AddressContext{ + Origin: eoa, + Caller: eoa, // inherited from caller + Self: caller, + }, + wantReadOnly: false, + wantCallType: vm.DelegateCall, + }, + { + name: "EVM.StaticCall()", + call: func() ([]byte, uint64, error) { + return evm.StaticCall(callerContract, precompile, input, gasLimit) + }, + wantAddresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, + Self: precompile, + }, + wantReadOnly: true, + wantCallType: vm.StaticCall, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + wantOutput := statefulPrecompileOutput{ + ChainID: chainID, + Addresses: tt.wantAddresses, + StateValue: value, + ReadOnly: tt.wantReadOnly, + BlockNumber: header.Number, + BlockTime: header.Time, + Difficulty: header.Difficulty, + Input: input, + IncomingCallType: tt.wantCallType, + } + + wantGasLeft := gasLimit - gasCost + + gotReturnData, gotGasLeft, err := tt.call() + require.NoError(t, err) + assert.Equal(t, wantOutput.String(), string(gotReturnData)) + assert.Equal(t, wantGasLeft, gotGasLeft) + }) + } +} + +func TestInheritReadOnly(t *testing.T) { + // The regular test of stateful precompiles only checks the read-only state + // when called directly via vm.EVM.*Call*() methods. That approach will not + // result in a read-only state via inheritance, which occurs when already in + // a read-only environment there is a non-static call to a precompile. + // + // Test strategy: + // + // 1. Create a precompile that echoes its read-only status in the return + // data. We MUST NOT assert inside the precompile as we need proof that + // the precompile was actually called. + // + // 2. Create a bytecode contract that calls the precompile with CALL and + // propagates the return data. Using CALL (i.e. not STATICCALL) means + // that we know for certain that [forceReadOnly] isn't being used and, + // instead, the read-only state is being read from + // evm.interpreter.readOnly. + // + // 3. Assert that the returned input is as expected for the read-only state. + + // (1) + + precompile := common.Address{255} + + const ( + ifReadOnly = iota + 1 // see contract bytecode for rationale + ifNotReadOnly + ) + hooks := &hookstest.Stub{ + PrecompileOverrides: map[common.Address]libevm.PrecompiledContract{ + precompile: vm.NewStatefulPrecompile( + func(env vm.PrecompileEnvironment, input []byte, suppliedGas uint64) ([]byte, uint64, error) { + if env.ReadOnly() { + return []byte{ifReadOnly}, suppliedGas, nil + } + return []byte{ifNotReadOnly}, suppliedGas, nil + }, + ), + }, + } + hookstest.Register(t, params.Extras[*hookstest.Stub, *hookstest.Stub]{ + NewRules: func(_ *params.ChainConfig, r *params.Rules, _ *hookstest.Stub, blockNum *big.Int, isMerge bool, timestamp uint64) *hookstest.Stub { + r.IsCancun = true // enable PUSH0 + return hooks + }, + }) + + // (2) + contract := makeReturnProxy(t, precompile, vm.CALL) + + state, evm := ethtest.NewZeroEVM(t) + rng := ethtest.NewPseudoRand(42) + contractAddr := rng.Address() + state.CreateAccount(contractAddr) + state.SetCode(contractAddr, convertBytes[vm.OpCode, byte](contract)) + + // (3) + + caller := vm.AccountRef(rng.Address()) + tests := []struct { + name string + call func() ([]byte, uint64, error) + want byte + }{ + { + name: "EVM.Call()", + call: func() ([]byte, uint64, error) { + return evm.Call(caller, contractAddr, []byte{}, 1e6, uint256.NewInt(0)) + }, + want: ifNotReadOnly, + }, + { + name: "EVM.StaticCall()", + call: func() ([]byte, uint64, error) { + return evm.StaticCall(vm.AccountRef(rng.Address()), contractAddr, []byte{}, 1e6) + }, + want: ifReadOnly, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, _, err := tt.call() + require.NoError(t, err) + require.Equalf(t, []byte{tt.want}, got, "want %d if read-only, otherwise %d", ifReadOnly, ifNotReadOnly) + }) + } +} + +// makeReturnProxy returns the bytecode of a contract that will call `dest` with +// the specified call type and propagated the returned value. +// +// The contract does NOT check if the call reverted. In this case, the +// propagated return value will always be an empty slice. Tests using these +// proxies MUST use non-empty slices as test values. +// +// TODO(arr4n): convert this to arr4n/specops for clarity and to make it easier +// to generate a revert check. +func makeReturnProxy(t *testing.T, dest common.Address, call vm.OpCode) []vm.OpCode { + t.Helper() + const p0 = vm.PUSH0 + contract := []vm.OpCode{ + vm.CALLDATASIZE, p0, p0, vm.CALLDATACOPY, + + p0, // retSize + p0, // retOffset + vm.CALLDATASIZE, // argSize + p0, // argOffset + } + + // See CALL signature: https://www.evm.codes/#f1?fork=cancun + switch call { + case vm.CALL, vm.CALLCODE: + contract = append(contract, p0) // value + case vm.DELEGATECALL, vm.STATICCALL: + default: + t.Fatalf("Bad test setup: invalid non-CALL-type opcode %s", call) + } + + contract = append(contract, vm.PUSH20) + contract = append(contract, convertBytes[byte, vm.OpCode](dest[:])...) + + contract = append(contract, + p0, // gas + call, + + // See function comment re ignored reverts. + vm.RETURNDATASIZE, p0, p0, vm.RETURNDATACOPY, + vm.RETURNDATASIZE, p0, vm.RETURN, + ) + return contract +} + +func convertBytes[From ~byte, To ~byte](buf []From) []To { + out := make([]To, len(buf)) + for i, b := range buf { + out[i] = To(b) + } + return out +} + +func TestCanCreateContract(t *testing.T) { + rng := ethtest.NewPseudoRand(142857) + account := rng.Address() + slot := rng.Hash() + + const gasLimit uint64 = 1e6 + gasUsage := rng.Uint64n(gasLimit) + + makeErr := func(cc *libevm.AddressContext, stateVal common.Hash) error { + return fmt.Errorf("Origin: %v Caller: %v Contract: %v State: %v", cc.Origin, cc.Caller, cc.Self, stateVal) + } + hooks := &hookstest.Stub{ + CanCreateContractFn: func(cc *libevm.AddressContext, gas uint64, s libevm.StateReader) (uint64, error) { + return gas - gasUsage, makeErr(cc, s.GetState(account, slot)) + }, + } + hooks.Register(t) + + origin := rng.Address() + caller := rng.Address() + value := rng.Hash() + code := []byte{byte(vm.STOP)} + salt := rng.Hash() + + create := crypto.CreateAddress(caller, 0) + create2 := crypto.CreateAddress2(caller, salt, crypto.Keccak256(code)) + + tests := []struct { + name string + create func(*vm.EVM) ([]byte, common.Address, uint64, error) + wantErr error + }{ + { + name: "Create", + create: func(evm *vm.EVM) ([]byte, common.Address, uint64, error) { + return evm.Create(vm.AccountRef(caller), code, gasLimit, uint256.NewInt(0)) + }, + wantErr: makeErr(&libevm.AddressContext{Origin: origin, Caller: caller, Self: create}, value), + }, + { + name: "Create2", + create: func(evm *vm.EVM) ([]byte, common.Address, uint64, error) { + return evm.Create2(vm.AccountRef(caller), code, gasLimit, uint256.NewInt(0), new(uint256.Int).SetBytes(salt[:])) + }, + wantErr: makeErr(&libevm.AddressContext{Origin: origin, Caller: caller, Self: create2}, value), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + state, evm := ethtest.NewZeroEVM(t) + state.SetState(account, slot, value) + evm.TxContext.Origin = origin + + _, _, gasRemaining, err := tt.create(evm) + require.EqualError(t, err, tt.wantErr.Error()) + // require prints uint64s in hex + require.Equal(t, int(gasLimit-gasUsage), int(gasRemaining), "gas remaining") //nolint:gosec // G115 won't overflow as <= 1e6 + }) + } +} + +func TestActivePrecompilesOverride(t *testing.T) { + newRules := func() params.Rules { + return new(params.ChainConfig).Rules(big.NewInt(0), false, 0) + } + defaultActive := vm.ActivePrecompiles(newRules()) + + rng := ethtest.NewPseudoRand(0xDecafC0ffeeBad) + precompiles := make([]common.Address, rng.Intn(10)+5) + for i := range precompiles { + precompiles[i] = rng.Address() + } + hooks := &hookstest.Stub{ + ActivePrecompilesFn: func(active []common.Address) []common.Address { + assert.Equal(t, defaultActive, active, "ActivePrecompiles() hook receives default addresses") + return precompiles + }, + } + hooks.Register(t) + + require.Equal(t, precompiles, vm.ActivePrecompiles(newRules()), "vm.ActivePrecompiles() returns overridden addresses") +} + +func TestPrecompileMakeCall(t *testing.T) { + // There is one test per *CALL* op code: + // + // 1. `eoa` makes a call to a bytecode contract, `caller`; + // 2. `caller` calls `sut`, the precompile under test, via the test's *CALL* op code; + // 3. `sut` makes a Call() to `dest`, which reflects env data for testing. + // + // This acts as a full integration test of a precompile being invoked before + // making an "outbound" call. + eoa := common.HexToAddress("E0A") + caller := common.HexToAddress("CA11E12") + sut := common.HexToAddress("7E57ED") + dest := common.HexToAddress("DE57") + + rng := ethtest.NewPseudoRand(142857) + precompileCallData := rng.Bytes(8) + + // If the SUT precompile receives this as its calldata then it will use the + // vm.WithUNSAFECallerAddressProxying() option. + unsafeCallerProxyOptSentinel := []byte("override-caller sentinel") + + hooks := &hookstest.Stub{ + PrecompileOverrides: map[common.Address]libevm.PrecompiledContract{ + sut: vm.NewStatefulPrecompile(func(env vm.PrecompileEnvironment, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) { + var opts []vm.CallOption + if bytes.Equal(input, unsafeCallerProxyOptSentinel) { + opts = append(opts, vm.WithUNSAFECallerAddressProxying()) + } + // We are ultimately testing env.Call(), hence why this is the SUT. + return env.Call(dest, precompileCallData, suppliedGas, uint256.NewInt(0), opts...) + }), + dest: vm.NewStatefulPrecompile(func(env vm.PrecompileEnvironment, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) { + out := &statefulPrecompileOutput{ + Addresses: env.Addresses(), + ReadOnly: env.ReadOnly(), + Input: input, // expected to be callData + } + return out.Bytes(), suppliedGas, nil + }), + }, + } + hookstest.Register(t, params.Extras[*hookstest.Stub, *hookstest.Stub]{ + NewRules: func(_ *params.ChainConfig, r *params.Rules, _ *hookstest.Stub, blockNum *big.Int, isMerge bool, timestamp uint64) *hookstest.Stub { + r.IsCancun = true // enable PUSH0 + return hooks + }, + }) + + tests := []struct { + incomingCallType vm.OpCode + eoaTxCallData []byte + // Unlike TestNewStatefulPrecompile, which tests the AddressContext of + // the precompile itself, these test the AddressContext of a contract + // called by the precompile. + want statefulPrecompileOutput + }{ + { + incomingCallType: vm.CALL, + want: statefulPrecompileOutput{ + Addresses: &libevm.AddressContext{ + Origin: eoa, + Caller: sut, + Self: dest, + }, + Input: precompileCallData, + }, + }, + { + incomingCallType: vm.CALL, + eoaTxCallData: unsafeCallerProxyOptSentinel, + want: statefulPrecompileOutput{ + Addresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, // overridden by CallOption + Self: dest, + }, + Input: precompileCallData, + }, + }, + { + incomingCallType: vm.CALLCODE, + want: statefulPrecompileOutput{ + Addresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, // SUT runs as its own caller because of CALLCODE + Self: dest, + }, + Input: precompileCallData, + }, + }, + { + incomingCallType: vm.CALLCODE, + eoaTxCallData: unsafeCallerProxyOptSentinel, + want: statefulPrecompileOutput{ + Addresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, // CallOption is a NOOP + Self: dest, + }, + Input: precompileCallData, + }, + }, + { + incomingCallType: vm.DELEGATECALL, + want: statefulPrecompileOutput{ + Addresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, // as with CALLCODE + Self: dest, + }, + Input: precompileCallData, + }, + }, + { + incomingCallType: vm.DELEGATECALL, + eoaTxCallData: unsafeCallerProxyOptSentinel, + want: statefulPrecompileOutput{ + Addresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, // CallOption is a NOOP + Self: dest, + }, + Input: precompileCallData, + }, + }, + { + incomingCallType: vm.STATICCALL, + want: statefulPrecompileOutput{ + Addresses: &libevm.AddressContext{ + Origin: eoa, + Caller: sut, + Self: dest, + }, + Input: precompileCallData, + // This demonstrates that even though the precompile makes a + // (non-static) CALL, the read-only state is inherited. Yes, + // this is _another_ way to get a read-only state, different to + // the other tests. + ReadOnly: true, + }, + }, + { + incomingCallType: vm.STATICCALL, + eoaTxCallData: unsafeCallerProxyOptSentinel, + want: statefulPrecompileOutput{ + Addresses: &libevm.AddressContext{ + Origin: eoa, + Caller: caller, // overridden by CallOption + Self: dest, + }, + Input: precompileCallData, + ReadOnly: true, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.incomingCallType.String(), func(t *testing.T) { + t.Logf("calldata = %q", tt.eoaTxCallData) + state, evm := ethtest.NewZeroEVM(t) + evm.Origin = eoa + state.CreateAccount(caller) + proxy := makeReturnProxy(t, sut, tt.incomingCallType) + state.SetCode(caller, convertBytes[vm.OpCode, byte](proxy)) + + got, _, err := evm.Call(vm.AccountRef(eoa), caller, tt.eoaTxCallData, 1e6, uint256.NewInt(0)) + require.NoError(t, err) + require.Equal(t, tt.want.String(), string(got)) + }) + } +} + +//nolint:testableexamples // Including output would only make the example more complicated and hide the true intent +func ExamplePrecompileEnvironment() { + // To determine the actual caller of a precompile, as against the effective + // caller (under EVM rules, as exposed by `Addresses().Caller`): + actualCaller := func(env vm.PrecompileEnvironment) common.Address { + if env.IncomingCallType() == vm.DelegateCall { + // DelegateCall acts as if it were its own caller. + return env.Addresses().Self + } + // CallCode could return either `Self` or `Caller` as it acts as its + // caller but doesn't inherit the caller's caller as DelegateCall does. + // Having it handled here is arbitrary from a behavioural perspective + // and is done only to simplify the code. + // + // Call and StaticCall don't affect self/caller semantics in any way. + return env.Addresses().Caller + } + + // actualCaller would typically be a top-level function. It's only a + // variable to include it in this example function. + _ = actualCaller +} diff --git a/core/vm/contracts_fuzz_test.go b/core/vm/contracts_fuzz_test.go index 87c1fff7cc8..df671b8f7a4 100644 --- a/core/vm/contracts_fuzz_test.go +++ b/core/vm/contracts_fuzz_test.go @@ -19,7 +19,7 @@ package vm import ( "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func FuzzPrecompiledContracts(f *testing.F) { diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index fc30541d459..e897efb9c50 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // precompiledTest defines the input/output pairs for precompiled contract tests. diff --git a/core/vm/eips.go b/core/vm/eips.go index 9f06b2818fe..35ca3e1a4a0 100644 --- a/core/vm/eips.go +++ b/core/vm/eips.go @@ -20,8 +20,8 @@ import ( "fmt" "sort" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/vm/environment.libevm.go b/core/vm/environment.libevm.go new file mode 100644 index 00000000000..051a5ff142b --- /dev/null +++ b/core/vm/environment.libevm.go @@ -0,0 +1,141 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package vm + +import ( + "fmt" + "math/big" + + "github.com/holiman/uint256" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/libevm" + "github.com/ava-labs/libevm/params" +) + +var _ PrecompileEnvironment = (*environment)(nil) + +type environment struct { + evm *EVM + self *Contract + callType CallType +} + +func (e *environment) ChainConfig() *params.ChainConfig { return e.evm.chainConfig } +func (e *environment) Rules() params.Rules { return e.evm.chainRules } +func (e *environment) ReadOnlyState() libevm.StateReader { return e.evm.StateDB } +func (e *environment) IncomingCallType() CallType { return e.callType } +func (e *environment) BlockNumber() *big.Int { return new(big.Int).Set(e.evm.Context.BlockNumber) } +func (e *environment) BlockTime() uint64 { return e.evm.Context.Time } + +func (e *environment) ReadOnly() bool { + // A switch statement provides clearer code coverage for difficult-to-test + // cases. + switch { + case e.callType == StaticCall: + // evm.interpreter.readOnly is only set to true via a call to + // EVMInterpreter.Run() so, if a precompile is called directly with + // StaticCall(), then readOnly might not be set yet. + return true + case e.evm.interpreter.readOnly: + return true + default: + return false + } +} + +func (e *environment) Addresses() *libevm.AddressContext { + return &libevm.AddressContext{ + Origin: e.evm.Origin, + Caller: e.self.CallerAddress, + Self: e.self.Address(), + } +} + +func (e *environment) StateDB() StateDB { + if e.ReadOnly() { + return nil + } + return e.evm.StateDB +} + +func (e *environment) BlockHeader() (types.Header, error) { + hdr := e.evm.Context.Header + if hdr == nil { + // Although [core.NewEVMBlockContext] sets the field and is in the + // typical hot path (e.g. miner), there are other ways to create a + // [vm.BlockContext] (e.g. directly in tests) that may result in no + // available header. + return types.Header{}, fmt.Errorf("nil %T in current %T", hdr, e.evm.Context) + } + return *hdr, nil +} + +func (e *environment) Call(addr common.Address, input []byte, gas uint64, value *uint256.Int, opts ...CallOption) ([]byte, uint64, error) { + return e.callContract(Call, addr, input, gas, value, opts...) +} + +func (e *environment) callContract(typ CallType, addr common.Address, input []byte, gas uint64, value *uint256.Int, opts ...CallOption) ([]byte, uint64, error) { + // Depth and read-only setting are handled by [EVMInterpreter.Run], which + // isn't used for precompiles, so we need to do it ourselves to maintain the + // expected invariants. + in := e.evm.interpreter + + in.evm.depth++ + defer func() { in.evm.depth-- }() + + if e.ReadOnly() && !in.readOnly { // i.e. the precompile was StaticCall()ed + in.readOnly = true + defer func() { in.readOnly = false }() + } + + var caller ContractRef = e.self + for _, o := range opts { + switch o := o.(type) { + case callOptUNSAFECallerAddressProxy: + // Note that, in addition to being unsafe, this breaks an EVM + // assumption that the caller ContractRef is always a *Contract. + caller = AccountRef(e.self.CallerAddress) + if e.callType == DelegateCall { + // self was created with AsDelegate(), which means that + // CallerAddress was inherited. + caller = AccountRef(e.self.Address()) + } + case nil: + default: + return nil, gas, fmt.Errorf("unsupported option %T", o) + } + } + + switch typ { + case Call: + if in.readOnly && !value.IsZero() { + return nil, gas, ErrWriteProtection + } + return e.evm.Call(caller, addr, input, gas, value) + case CallCode, DelegateCall, StaticCall: + // TODO(arr4n): these cases should be very similar to CALL, hence the + // early abstraction, to signal to future maintainers. If implementing + // them, there's likely no need to honour the + // [callOptUNSAFECallerAddressProxy] because it's purely for backwards + // compatibility. + fallthrough + default: + return nil, gas, fmt.Errorf("unimplemented precompile call type %v", typ) + } +} diff --git a/core/vm/evm.go b/core/vm/evm.go index 16cc8549080..ae56d5a69ed 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -20,10 +20,11 @@ import ( "math/big" "sync/atomic" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/libevm" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) @@ -38,6 +39,9 @@ type ( ) func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) { + if p, override := evm.chainRules.Hooks().PrecompileOverride(addr); override { + return p, p != nil + } var precompiles map[common.Address]PrecompiledContract switch { case evm.chainRules.IsCancun: @@ -75,6 +79,8 @@ type BlockContext struct { BaseFee *big.Int // Provides information for BASEFEE (0 if vm runs with NoBaseFee flag and 0 gas price) BlobBaseFee *big.Int // Provides information for BLOBBASEFEE (0 if vm runs with NoBaseFee flag and 0 blob gas price) Random *common.Hash // Provides information for PREVRANDAO + + Header *types.Header // libevm addition; not guaranteed to be set } // TxContext provides the EVM with information about a transaction. @@ -137,6 +143,7 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig blockCtx.BlobBaseFee = new(big.Int) } } + blockCtx, txCtx, statedb, chainConfig, config = overrideNewEVMArgs(blockCtx, txCtx, statedb, chainConfig, config) evm := &EVM{ Context: blockCtx, TxContext: txCtx, @@ -152,8 +159,7 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig // Reset resets the EVM with a new transaction context.Reset // This is not threadsafe and should only be done very cautiously. func (evm *EVM) Reset(txCtx TxContext, statedb StateDB) { - evm.TxContext = txCtx - evm.StateDB = statedb + evm.TxContext, evm.StateDB = evm.overrideEVMResetArgs(txCtx, statedb) } // Cancel cancels any running EVM operation. This may be called concurrently and @@ -224,7 +230,8 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas } if isPrecompile { - ret, gas, err = RunPrecompiledContract(p, input, gas) + args := &evmCallArgs{evm, Call, caller, addr, input, gas, value} + ret, gas, err = args.RunPrecompiledContract(p, input, gas) } else { // Initialise a new contract and set the code that is to be used by the EVM. // The contract is a scoped environment for this execution context only. @@ -287,7 +294,8 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte, // It is allowed to call precompiles, even via delegatecall if p, isPrecompile := evm.precompile(addr); isPrecompile { - ret, gas, err = RunPrecompiledContract(p, input, gas) + args := &evmCallArgs{evm, CallCode, caller, addr, input, gas, value} + ret, gas, err = args.RunPrecompiledContract(p, input, gas) } else { addrCopy := addr // Initialise a new contract and set the code that is to be used by the EVM. @@ -332,7 +340,8 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by // It is allowed to call precompiles, even via delegatecall if p, isPrecompile := evm.precompile(addr); isPrecompile { - ret, gas, err = RunPrecompiledContract(p, input, gas) + args := &evmCallArgs{evm, DelegateCall, caller, addr, input, gas, nil} + ret, gas, err = args.RunPrecompiledContract(p, input, gas) } else { addrCopy := addr // Initialise a new contract and make initialise the delegate values @@ -381,7 +390,8 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte } if p, isPrecompile := evm.precompile(addr); isPrecompile { - ret, gas, err = RunPrecompiledContract(p, input, gas) + args := &evmCallArgs{evm, StaticCall, caller, addr, input, gas, nil} + ret, gas, err = args.RunPrecompiledContract(p, input, gas) } else { // At this point, we use a copy of address. If we don't, the go compiler will // leak the 'contract' to the outer scope, and make allocation for 'contract' @@ -443,6 +453,19 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, if evm.StateDB.GetNonce(address) != 0 || (contractHash != (common.Hash{}) && contractHash != types.EmptyCodeHash) { return nil, common.Address{}, 0, ErrContractAddressCollision } + + //libevm:start + // + // This check MUST be placed after the caller's nonce is incremented but + // before all other state-modifying behaviour, even if changes may be + // reverted to the snapshot. + addrs := &libevm.AddressContext{Origin: evm.Origin, Caller: caller.Address(), Self: address} + gas, err := evm.chainRules.Hooks().CanCreateContract(addrs, gas, evm.StateDB) + if err != nil { + return nil, common.Address{}, gas, err + } + //libevm:end + // Create a new account on the state snapshot := evm.StateDB.Snapshot() evm.StateDB.CreateAccount(address) diff --git a/core/vm/evm.libevm_test.go b/core/vm/evm.libevm_test.go new file mode 100644 index 00000000000..d3221f0f74c --- /dev/null +++ b/core/vm/evm.libevm_test.go @@ -0,0 +1,93 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package vm + +import ( + "math/big" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/params" +) + +type evmArgOverrider struct { + newEVMchainID int64 + + gotResetChainID *big.Int + resetTxContextTo TxContext + resetStateDBTo StateDB +} + +func (o *evmArgOverrider) OverrideNewEVMArgs(args *NewEVMArgs) *NewEVMArgs { + args.ChainConfig = ¶ms.ChainConfig{ChainID: big.NewInt(o.newEVMchainID)} + return args +} + +func (o *evmArgOverrider) OverrideEVMResetArgs(r params.Rules, _ *EVMResetArgs) *EVMResetArgs { + o.gotResetChainID = r.ChainID + return &EVMResetArgs{ + TxContext: o.resetTxContextTo, + StateDB: o.resetStateDBTo, + } +} + +func (o *evmArgOverrider) register(t *testing.T) { + t.Helper() + libevmHooks = nil + RegisterHooks(o) + t.Cleanup(func() { + libevmHooks = nil + }) +} + +func TestOverrideNewEVMArgs(t *testing.T) { + // The overrideNewEVMArgs function accepts and returns all arguments to + // NewEVM(), in order. Here we lock in our assumption of that order. If this + // breaks then all functionality overriding the args MUST be updated. + var _ func(BlockContext, TxContext, StateDB, *params.ChainConfig, Config) *EVM = NewEVM + + const chainID = 13579 + hooks := evmArgOverrider{newEVMchainID: chainID} + hooks.register(t) + + evm := NewEVM(BlockContext{}, TxContext{}, nil, nil, Config{}) + got := evm.ChainConfig().ChainID + require.Equalf(t, big.NewInt(chainID), got, "%T.ChainConfig().ChainID set by NewEVM() hook", evm) +} + +func TestOverrideEVMResetArgs(t *testing.T) { + // Equivalent to rationale for TestOverrideNewEVMArgs above. + var _ func(TxContext, StateDB) = (*EVM)(nil).Reset + + const ( + chainID = 0xc0ffee + gasPrice = 1357924680 + ) + hooks := &evmArgOverrider{ + newEVMchainID: chainID, + resetTxContextTo: TxContext{ + GasPrice: big.NewInt(gasPrice), + }, + } + hooks.register(t) + + evm := NewEVM(BlockContext{}, TxContext{}, nil, nil, Config{}) + evm.Reset(TxContext{}, nil) + assert.Equalf(t, big.NewInt(chainID), hooks.gotResetChainID, "%T.ChainID passed to Reset() hook", params.Rules{}) + assert.Equalf(t, big.NewInt(gasPrice), evm.GasPrice, "%T.GasPrice set by Reset() hook", evm) +} diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index 4b141d8f9a5..92f9cfd1165 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -19,9 +19,9 @@ package vm import ( "errors" - "github.com/ethereum/go-ethereum/common" - "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/math" + "github.com/ava-labs/libevm/params" ) // memoryGasCost calculates the quadratic gas for memory expansion. It does so diff --git a/core/vm/gas_table_test.go b/core/vm/gas_table_test.go index 4a2545b6edf..15421769ae7 100644 --- a/core/vm/gas_table_test.go +++ b/core/vm/gas_table_test.go @@ -23,12 +23,12 @@ import ( "sort" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/vm/hooks.libevm.go b/core/vm/hooks.libevm.go new file mode 100644 index 00000000000..e0864504435 --- /dev/null +++ b/core/vm/hooks.libevm.go @@ -0,0 +1,76 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package vm + +import "github.com/ava-labs/libevm/params" + +// RegisterHooks registers the Hooks. It is expected to be called in an `init()` +// function and MUST NOT be called more than once. +func RegisterHooks(h Hooks) { + if libevmHooks != nil { + panic("already registered") + } + libevmHooks = h +} + +var libevmHooks Hooks + +// Hooks are arbitrary configuration functions to modify default VM behaviour. +// See [RegisterHooks]. +type Hooks interface { + OverrideNewEVMArgs(*NewEVMArgs) *NewEVMArgs + OverrideEVMResetArgs(params.Rules, *EVMResetArgs) *EVMResetArgs +} + +// NewEVMArgs are the arguments received by [NewEVM], available for override +// via [Hooks]. +type NewEVMArgs struct { + BlockContext BlockContext + TxContext TxContext + StateDB StateDB + ChainConfig *params.ChainConfig + Config Config +} + +// EVMResetArgs are the arguments received by [EVM.Reset], available for +// override via [Hooks]. +type EVMResetArgs struct { + TxContext TxContext + StateDB StateDB +} + +func overrideNewEVMArgs( + blockCtx BlockContext, + txCtx TxContext, + statedb StateDB, + chainConfig *params.ChainConfig, + config Config, +) (BlockContext, TxContext, StateDB, *params.ChainConfig, Config) { + if libevmHooks == nil { + return blockCtx, txCtx, statedb, chainConfig, config + } + args := libevmHooks.OverrideNewEVMArgs(&NewEVMArgs{blockCtx, txCtx, statedb, chainConfig, config}) + return args.BlockContext, args.TxContext, args.StateDB, args.ChainConfig, args.Config +} + +func (evm *EVM) overrideEVMResetArgs(txCtx TxContext, statedb StateDB) (TxContext, StateDB) { + if libevmHooks == nil { + return txCtx, statedb + } + args := libevmHooks.OverrideEVMResetArgs(evm.chainRules, &EVMResetArgs{txCtx, statedb}) + return args.TxContext, args.StateDB +} diff --git a/core/vm/instructions.go b/core/vm/instructions.go index b8055de6bce..4993c361f4e 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -19,10 +19,10 @@ package vm import ( "math" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/vm/instructions_test.go b/core/vm/instructions_test.go index 8653864d11e..308207292c9 100644 --- a/core/vm/instructions_test.go +++ b/core/vm/instructions_test.go @@ -25,13 +25,13 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/vm/interface.go b/core/vm/interface.go index 25bfa067206..db3710bf7ef 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -19,9 +19,9 @@ package vm import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 1968289f4ea..6af763c214c 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -17,10 +17,10 @@ package vm import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" ) // Config are the configuration options for the Interpreter diff --git a/core/vm/interpreter_test.go b/core/vm/interpreter_test.go index ff4977d728e..f44da3a9fcf 100644 --- a/core/vm/interpreter_test.go +++ b/core/vm/interpreter_test.go @@ -20,12 +20,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index 65716f9442a..80802f37f5a 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -19,7 +19,7 @@ package vm import ( "fmt" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) type ( diff --git a/core/vm/jump_table_export.go b/core/vm/jump_table_export.go index b74109da0ad..fbd9817e06c 100644 --- a/core/vm/jump_table_export.go +++ b/core/vm/jump_table_export.go @@ -19,7 +19,7 @@ package vm import ( "errors" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) // LookupInstructionSet returns the instruction set for the fork configured by diff --git a/core/vm/libevm_test.go b/core/vm/libevm_test.go new file mode 100644 index 00000000000..4e365d4e425 --- /dev/null +++ b/core/vm/libevm_test.go @@ -0,0 +1,22 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package vm + +// The original RunPrecompiledContract was migrated to being a method on +// [evmCallArgs]. We need to replace it for use by regular geth tests. +func RunPrecompiledContract(p PrecompiledContract, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) { + return (*evmCallArgs)(nil).RunPrecompiledContract(p, input, suppliedGas) +} diff --git a/core/vm/logger.go b/core/vm/logger.go index 2667908a84d..70231e6d236 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -19,7 +19,7 @@ package vm import ( "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // EVMLogger is used to collect execution traces from an EVM transaction diff --git a/core/vm/memory_test.go b/core/vm/memory_test.go index ba36f8023c6..009db6f7d31 100644 --- a/core/vm/memory_test.go +++ b/core/vm/memory_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func TestMemoryCopy(t *testing.T) { diff --git a/core/vm/operations_acl.go b/core/vm/operations_acl.go index f420a241058..7b06e346180 100644 --- a/core/vm/operations_acl.go +++ b/core/vm/operations_acl.go @@ -19,9 +19,9 @@ package vm import ( "errors" - "github.com/ethereum/go-ethereum/common" - "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/math" + "github.com/ava-labs/libevm/params" ) func makeGasSStoreFunc(clearingRefund uint64) gasFunc { diff --git a/core/vm/options.libevm.go b/core/vm/options.libevm.go new file mode 100644 index 00000000000..94ecdbb0457 --- /dev/null +++ b/core/vm/options.libevm.go @@ -0,0 +1,38 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package vm + +// A CallOption modifies the default behaviour of a contract call. +type CallOption interface { + libevmCallOption() // noop to only allow internally defined options +} + +// WithUNSAFECallerAddressProxying results in precompiles making contract calls +// specifying their own caller's address as the caller. This is NOT SAFE for +// regular use as callers of the precompile may not understand that they are +// escalating the precompile's privileges. +// +// Deprecated: this option MUST NOT be used other than to allow migration to +// libevm when backwards compatibility is required. +func WithUNSAFECallerAddressProxying() CallOption { + return callOptUNSAFECallerAddressProxy{} +} + +// Deprecated: see [WithUNSAFECallerAddressProxying]. +type callOptUNSAFECallerAddressProxy struct{} + +func (callOptUNSAFECallerAddressProxy) libevmCallOption() {} diff --git a/core/vm/runtime/env.go b/core/vm/runtime/env.go index 34335b8e9e2..b7660a43cde 100644 --- a/core/vm/runtime/env.go +++ b/core/vm/runtime/env.go @@ -17,8 +17,8 @@ package runtime import ( - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/vm" ) func NewEnv(cfg *Config) *vm.EVM { diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index 46f2bb5d5f6..b2a53129d5a 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -20,13 +20,13 @@ import ( "math" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/core/vm/runtime/runtime_example_test.go b/core/vm/runtime/runtime_example_test.go index b7d0ddc384e..1fd163a043c 100644 --- a/core/vm/runtime/runtime_example_test.go +++ b/core/vm/runtime/runtime_example_test.go @@ -19,8 +19,8 @@ package runtime_test import ( "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm/runtime" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm/runtime" ) func ExampleExecute() { diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go index b9e3c8ed661..3bd7098e5ed 100644 --- a/core/vm/runtime/runtime_test.go +++ b/core/vm/runtime/runtime_test.go @@ -23,21 +23,21 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/asm" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/eth/tracers/logger" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/asm" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/eth/tracers/logger" + "github.com/ava-labs/libevm/params" // force-load js tracers to trigger registration - _ "github.com/ethereum/go-ethereum/eth/tracers/js" + _ "github.com/ava-labs/libevm/eth/tracers/js" "github.com/holiman/uint256" ) diff --git a/core/vm/stack.libevm.go b/core/vm/stack.libevm.go new file mode 100644 index 00000000000..e4ad1344096 --- /dev/null +++ b/core/vm/stack.libevm.go @@ -0,0 +1,30 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package vm + +import "github.com/holiman/uint256" + +// A MutableStack embeds a Stack to expose unexported mutation methods. +type MutableStack struct { + *Stack +} + +// Push pushes a value to the stack. +func (s MutableStack) Push(d *uint256.Int) { s.Stack.push(d) } + +// Pop pops a value from the stack. +func (s MutableStack) Pop() uint256.Int { return s.Stack.pop() } diff --git a/core/vm/stack.libevm_test.go b/core/vm/stack.libevm_test.go new file mode 100644 index 00000000000..0215f8e71d8 --- /dev/null +++ b/core/vm/stack.libevm_test.go @@ -0,0 +1,42 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package vm_test + +import ( + "testing" + + "github.com/holiman/uint256" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/core/vm" +) + +func TestMutableStack(t *testing.T) { + s := &vm.Stack{} + m := vm.MutableStack{Stack: s} + + push := func(u uint64) uint256.Int { + u256 := uint256.NewInt(u) + m.Push(u256) + return *u256 + } + + require.Empty(t, s.Data(), "new stack") + want := []uint256.Int{push(42), push(314159), push(142857)} + require.Equalf(t, want, s.Data(), "after pushing %d values to empty stack", len(want)) + require.Equal(t, want[len(want)-1], m.Pop(), "popped value") + require.Equal(t, want[:len(want)-1], s.Data(), "after popping a single value") +} diff --git a/core/vm/stack_table.go b/core/vm/stack_table.go index 10c12901afd..e3477e7c274 100644 --- a/core/vm/stack_table.go +++ b/core/vm/stack_table.go @@ -17,7 +17,7 @@ package vm import ( - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) func minSwapStack(n int) int { diff --git a/crypto/bls12381/g1_test.go b/crypto/bls12381/g1_test.go index 87140459fbc..9e43b2a1dfc 100644 --- a/crypto/bls12381/g1_test.go +++ b/crypto/bls12381/g1_test.go @@ -6,7 +6,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func (g *G1) one() *PointG1 { diff --git a/crypto/bls12381/g2_test.go b/crypto/bls12381/g2_test.go index 4d1f3a19ac6..15690af33f8 100644 --- a/crypto/bls12381/g2_test.go +++ b/crypto/bls12381/g2_test.go @@ -6,7 +6,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func (g *G2) one() *PointG2 { diff --git a/crypto/bls12381/pairing_test.go b/crypto/bls12381/pairing_test.go index 77676fe9b1f..8c0674742b8 100644 --- a/crypto/bls12381/pairing_test.go +++ b/crypto/bls12381/pairing_test.go @@ -4,7 +4,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func TestPairingExpected(t *testing.T) { diff --git a/crypto/bls12381/utils.go b/crypto/bls12381/utils.go index de8bf495fe7..93439ade78a 100644 --- a/crypto/bls12381/utils.go +++ b/crypto/bls12381/utils.go @@ -20,7 +20,7 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func bigFromHex(hex string) *big.Int { diff --git a/crypto/bn256/bn256_fast.go b/crypto/bn256/bn256_fast.go index e3c9b605184..4bc6613e2d5 100644 --- a/crypto/bn256/bn256_fast.go +++ b/crypto/bn256/bn256_fast.go @@ -9,7 +9,7 @@ package bn256 import ( - bn256cf "github.com/ethereum/go-ethereum/crypto/bn256/cloudflare" + bn256cf "github.com/ava-labs/libevm/crypto/bn256/cloudflare" ) // G1 is an abstract cyclic group. The zero value is suitable for use as the diff --git a/crypto/bn256/bn256_slow.go b/crypto/bn256/bn256_slow.go index 4c0c351e2da..9ef96c550d9 100644 --- a/crypto/bn256/bn256_slow.go +++ b/crypto/bn256/bn256_slow.go @@ -8,7 +8,7 @@ // Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve. package bn256 -import bn256 "github.com/ethereum/go-ethereum/crypto/bn256/google" +import bn256 "github.com/ava-labs/libevm/crypto/bn256/google" // G1 is an abstract cyclic group. The zero value is suitable for use as the // output of an operation, but cannot be used as an input. diff --git a/crypto/crypto.go b/crypto/crypto.go index 2492165d388..79b4d653f12 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -29,9 +29,9 @@ import ( "math/big" "os" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/rlp" "golang.org/x/crypto/sha3" ) diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index da123cf980a..6f048bcbf95 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -25,8 +25,8 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var testAddrHex = "970e8128ab834e8eac17ab8e3812f010678cf791" diff --git a/crypto/ecies/ecies_test.go b/crypto/ecies/ecies_test.go index e3da71010ed..c48a48ed745 100644 --- a/crypto/ecies/ecies_test.go +++ b/crypto/ecies/ecies_test.go @@ -39,7 +39,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/crypto" ) func TestKDF(t *testing.T) { diff --git a/crypto/ecies/params.go b/crypto/ecies/params.go index df7698ea0cb..b2622667fb6 100644 --- a/crypto/ecies/params.go +++ b/crypto/ecies/params.go @@ -43,7 +43,7 @@ import ( "fmt" "hash" - ethcrypto "github.com/ethereum/go-ethereum/crypto" + ethcrypto "github.com/ava-labs/libevm/crypto" ) var ( diff --git a/crypto/kzg4844/kzg4844.go b/crypto/kzg4844/kzg4844.go index 52124df6746..44131bcfcb0 100644 --- a/crypto/kzg4844/kzg4844.go +++ b/crypto/kzg4844/kzg4844.go @@ -24,7 +24,7 @@ import ( "reflect" "sync/atomic" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) //go:embed trusted_setup.json diff --git a/crypto/kzg4844/kzg4844_ckzg_cgo.go b/crypto/kzg4844/kzg4844_ckzg_cgo.go index 54002856987..0b0dce4e001 100644 --- a/crypto/kzg4844/kzg4844_ckzg_cgo.go +++ b/crypto/kzg4844/kzg4844_ckzg_cgo.go @@ -25,7 +25,7 @@ import ( gokzg4844 "github.com/crate-crypto/go-kzg-4844" ckzg4844 "github.com/ethereum/c-kzg-4844/bindings/go" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) // ckzgAvailable signals whether the library was compiled into Geth. diff --git a/crypto/secp256k1/dummy.go b/crypto/secp256k1/dummy.go index 65a75080f60..a93fd2f7987 100644 --- a/crypto/secp256k1/dummy.go +++ b/crypto/secp256k1/dummy.go @@ -15,7 +15,7 @@ package secp256k1 import ( - _ "github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/include" - _ "github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src" - _ "github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/modules/recovery" + _ "github.com/ava-labs/libevm/crypto/secp256k1/libsecp256k1/include" + _ "github.com/ava-labs/libevm/crypto/secp256k1/libsecp256k1/src" + _ "github.com/ava-labs/libevm/crypto/secp256k1/libsecp256k1/src/modules/recovery" ) diff --git a/crypto/signature_cgo.go b/crypto/signature_cgo.go index 2339e520154..b1e3691b446 100644 --- a/crypto/signature_cgo.go +++ b/crypto/signature_cgo.go @@ -25,8 +25,8 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto/secp256k1" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto/secp256k1" ) // Ecrecover returns the uncompressed public key that created the given signature. diff --git a/crypto/signature_test.go b/crypto/signature_test.go index aecff76bfbd..48834fac5eb 100644 --- a/crypto/signature_test.go +++ b/crypto/signature_test.go @@ -22,9 +22,9 @@ import ( "reflect" "testing" - "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 ( diff --git a/eth/api.go b/eth/api.go index 44e934fd040..330246fe948 100644 --- a/eth/api.go +++ b/eth/api.go @@ -17,8 +17,8 @@ package eth import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) // EthereumAPI provides an API to access Ethereum full node-related information. diff --git a/eth/api_admin.go b/eth/api_admin.go index 4a3ccb84e82..6e4a223add1 100644 --- a/eth/api_admin.go +++ b/eth/api_admin.go @@ -24,9 +24,9 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" ) // AdminAPI is the collection of Ethereum full node related APIs for node diff --git a/eth/api_backend.go b/eth/api_backend.go index 65adccd8518..a7f6aaab339 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -22,24 +22,24 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/gasprice" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/gasprice" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) // EthAPIBackend implements ethapi.Backend and tracers.Backend for full nodes diff --git a/eth/api_debug.go b/eth/api_debug.go index 05010a3969c..2332c76590d 100644 --- a/eth/api_debug.go +++ b/eth/api_debug.go @@ -22,17 +22,17 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/trie" ) // DebugAPI is the collection of Ethereum full node APIs for debugging the diff --git a/eth/api_debug_test.go b/eth/api_debug_test.go index 671e935beb1..1f819564ce7 100644 --- a/eth/api_debug_test.go +++ b/eth/api_debug_test.go @@ -24,12 +24,12 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/triedb" "github.com/holiman/uint256" "golang.org/x/exp/slices" ) diff --git a/eth/api_miner.go b/eth/api_miner.go index 764d0ae5e2f..d497da07718 100644 --- a/eth/api_miner.go +++ b/eth/api_miner.go @@ -20,8 +20,8 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) // MinerAPI provides an API to control the miner. diff --git a/eth/backend.go b/eth/backend.go index 0a0813aafac..f8b1695c85a 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -24,39 +24,39 @@ import ( "runtime" "sync" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/clique" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state/pruner" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/txpool/blobpool" - "github.com/ethereum/go-ethereum/core/txpool/legacypool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/eth/gasprice" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/internal/shutdowncheck" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/dnsdisc" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/clique" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state/pruner" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/txpool/blobpool" + "github.com/ava-labs/libevm/core/txpool/legacypool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/eth/gasprice" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/internal/shutdowncheck" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/dnsdisc" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/rpc" ) // Config contains the configuration options of the ETH protocol. diff --git a/eth/bloombits.go b/eth/bloombits.go index 0cb7050d232..a87ea8f96ce 100644 --- a/eth/bloombits.go +++ b/eth/bloombits.go @@ -19,8 +19,8 @@ package eth import ( "time" - "github.com/ethereum/go-ethereum/common/bitutil" - "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ava-labs/libevm/common/bitutil" + "github.com/ava-labs/libevm/core/rawdb" ) const ( diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index 58566a47fc6..3d092ef5b6b 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -23,20 +23,20 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/beacon/engine" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/internal/version" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/params/forks" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/beacon/engine" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/internal/version" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/params/forks" + "github.com/ava-labs/libevm/rpc" ) // Register adds the engine API to the full node. diff --git a/eth/catalyst/api_test.go b/eth/catalyst/api_test.go index cc1258ca55b..f1f28364ba2 100644 --- a/eth/catalyst/api_test.go +++ b/eth/catalyst/api_test.go @@ -28,26 +28,26 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/beacon/engine" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - beaconConsensus "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/beacon/engine" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus" + beaconConsensus "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/trie" "github.com/mattn/go-colorable" ) diff --git a/eth/catalyst/queue.go b/eth/catalyst/queue.go index 634dc1b2e6c..6f473557b6c 100644 --- a/eth/catalyst/queue.go +++ b/eth/catalyst/queue.go @@ -19,10 +19,10 @@ package catalyst import ( "sync" - "github.com/ethereum/go-ethereum/beacon/engine" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/miner" + "github.com/ava-labs/libevm/beacon/engine" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/miner" ) // maxTrackedPayloads is the maximum number of prepared payloads the execution diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index f1c5689e1d2..36f2007a60a 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -23,15 +23,15 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/beacon/engine" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/beacon/engine" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) const devEpochLength = 32 diff --git a/eth/catalyst/simulated_beacon_api.go b/eth/catalyst/simulated_beacon_api.go index 73d0a5921d8..f696c6b35f9 100644 --- a/eth/catalyst/simulated_beacon_api.go +++ b/eth/catalyst/simulated_beacon_api.go @@ -20,10 +20,10 @@ import ( "context" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" ) type api struct { diff --git a/eth/catalyst/simulated_beacon_test.go b/eth/catalyst/simulated_beacon_test.go index 6fa97ad87a2..d2c5db4a834 100644 --- a/eth/catalyst/simulated_beacon_test.go +++ b/eth/catalyst/simulated_beacon_test.go @@ -22,16 +22,16 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/params" ) func startSimulatedBeaconEthService(t *testing.T, genesis *core.Genesis) (*node.Node, *eth.Ethereum, *SimulatedBeacon) { diff --git a/eth/catalyst/tester.go b/eth/catalyst/tester.go index 0922ac0ba65..4684ac9ae0c 100644 --- a/eth/catalyst/tester.go +++ b/eth/catalyst/tester.go @@ -20,11 +20,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" ) // FullSyncTester is an auxiliary service that allows Geth to perform full sync diff --git a/eth/downloader/api.go b/eth/downloader/api.go index 6b8cb98e23b..6a1dffa831d 100644 --- a/eth/downloader/api.go +++ b/eth/downloader/api.go @@ -21,10 +21,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/rpc" ) // DownloaderAPI provides an API which gives information about the current diff --git a/eth/downloader/beacondevsync.go b/eth/downloader/beacondevsync.go index 9a38fedd463..bb565d4dbf4 100644 --- a/eth/downloader/beacondevsync.go +++ b/eth/downloader/beacondevsync.go @@ -20,8 +20,8 @@ import ( "errors" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" ) // BeaconDevSync is a development helper to test synchronization by providing diff --git a/eth/downloader/beaconsync.go b/eth/downloader/beaconsync.go index d3f75c85270..0ff0619fc8f 100644 --- a/eth/downloader/beaconsync.go +++ b/eth/downloader/beaconsync.go @@ -21,10 +21,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" ) // beaconBackfiller is the chain and state backfilling that can be commenced once diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 6e7c5dcf02c..4d813703af1 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -25,17 +25,17 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/triedb" ) var ( diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go index 2468e1a9809..93cdac50cc6 100644 --- a/eth/downloader/downloader_test.go +++ b/eth/downloader/downloader_test.go @@ -26,20 +26,20 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" ) // downloadTester is a test simulator for mocking out local block chain. diff --git a/eth/downloader/events.go b/eth/downloader/events.go index 25255a3a72e..26b71262594 100644 --- a/eth/downloader/events.go +++ b/eth/downloader/events.go @@ -16,7 +16,7 @@ package downloader -import "github.com/ethereum/go-ethereum/core/types" +import "github.com/ava-labs/libevm/core/types" type DoneEvent struct { Latest *types.Header diff --git a/eth/downloader/fetchers.go b/eth/downloader/fetchers.go index cc4279b0da7..be6c40046d2 100644 --- a/eth/downloader/fetchers.go +++ b/eth/downloader/fetchers.go @@ -19,9 +19,9 @@ package downloader import ( "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/protocols/eth" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/protocols/eth" ) // fetchHeadersByHash is a blocking version of Peer.RequestHeadersByHash which diff --git a/eth/downloader/fetchers_concurrent.go b/eth/downloader/fetchers_concurrent.go index 649aa276159..49836f7622f 100644 --- a/eth/downloader/fetchers_concurrent.go +++ b/eth/downloader/fetchers_concurrent.go @@ -21,10 +21,10 @@ import ( "sort" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/prque" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/prque" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/log" ) // timeoutGracePeriod is the amount of time to allow for a peer to deliver a diff --git a/eth/downloader/fetchers_concurrent_bodies.go b/eth/downloader/fetchers_concurrent_bodies.go index 5105fda66b3..a3c2a369adc 100644 --- a/eth/downloader/fetchers_concurrent_bodies.go +++ b/eth/downloader/fetchers_concurrent_bodies.go @@ -19,9 +19,9 @@ package downloader import ( "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/log" ) // bodyQueue implements typedQueue and is a type adapter between the generic diff --git a/eth/downloader/fetchers_concurrent_headers.go b/eth/downloader/fetchers_concurrent_headers.go index 8201f4ca742..6b7092c168b 100644 --- a/eth/downloader/fetchers_concurrent_headers.go +++ b/eth/downloader/fetchers_concurrent_headers.go @@ -19,9 +19,9 @@ package downloader import ( "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/log" ) // headerQueue implements typedQueue and is a type adapter between the generic diff --git a/eth/downloader/fetchers_concurrent_receipts.go b/eth/downloader/fetchers_concurrent_receipts.go index 3169f030ba1..03ca35a1b65 100644 --- a/eth/downloader/fetchers_concurrent_receipts.go +++ b/eth/downloader/fetchers_concurrent_receipts.go @@ -19,9 +19,9 @@ package downloader import ( "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/log" ) // receiptQueue implements typedQueue and is a type adapter between the generic diff --git a/eth/downloader/metrics.go b/eth/downloader/metrics.go index 23c033a8ad1..c8de59f73c9 100644 --- a/eth/downloader/metrics.go +++ b/eth/downloader/metrics.go @@ -19,7 +19,7 @@ package downloader import ( - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) var ( diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go index 4c43af5270c..27987c87c91 100644 --- a/eth/downloader/peer.go +++ b/eth/downloader/peer.go @@ -25,11 +25,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/msgrate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/msgrate" ) const ( diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go index 6ff858d7553..e02359b6902 100644 --- a/eth/downloader/queue.go +++ b/eth/downloader/queue.go @@ -26,13 +26,13 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/prque" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/prque" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/params" ) const ( diff --git a/eth/downloader/queue_test.go b/eth/downloader/queue_test.go index 50b9031a27c..aafde29f17b 100644 --- a/eth/downloader/queue_test.go +++ b/eth/downloader/queue_test.go @@ -25,13 +25,13 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" "golang.org/x/exp/slog" ) diff --git a/eth/downloader/resultstore.go b/eth/downloader/resultstore.go index e4323c04ebc..fe8d3ced7dc 100644 --- a/eth/downloader/resultstore.go +++ b/eth/downloader/resultstore.go @@ -21,7 +21,7 @@ import ( "sync" "sync/atomic" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/core/types" ) // resultStore implements a structure for maintaining fetchResults, tracking their diff --git a/eth/downloader/skeleton.go b/eth/downloader/skeleton.go index 873ee950b66..db70a21013e 100644 --- a/eth/downloader/skeleton.go +++ b/eth/downloader/skeleton.go @@ -24,12 +24,12 @@ import ( "sort" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) // scratchHeaders is the number of headers to store in a scratch space to allow diff --git a/eth/downloader/skeleton_test.go b/eth/downloader/skeleton_test.go index 2b108dfe936..a6fb7b8b3bb 100644 --- a/eth/downloader/skeleton_test.go +++ b/eth/downloader/skeleton_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/log" ) // hookedBackfiller is a tester backfiller with all interface methods mocked and diff --git a/eth/downloader/statesync.go b/eth/downloader/statesync.go index 501af63ed5c..95f8b270bdc 100644 --- a/eth/downloader/statesync.go +++ b/eth/downloader/statesync.go @@ -19,8 +19,8 @@ package downloader import ( "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" ) // syncState starts downloading state with the given root hash. diff --git a/eth/downloader/testchain_test.go b/eth/downloader/testchain_test.go index 46f3febd8ba..59daf9da6cd 100644 --- a/eth/downloader/testchain_test.go +++ b/eth/downloader/testchain_test.go @@ -22,15 +22,15 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/triedb" ) // Test chain parameters. diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index ad664afb5bd..2d0b1e02b10 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -21,19 +21,19 @@ import ( "errors" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/clique" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/txpool/blobpool" - "github.com/ethereum/go-ethereum/core/txpool/legacypool" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/gasprice" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/clique" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/txpool/blobpool" + "github.com/ava-labs/libevm/core/txpool/legacypool" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/gasprice" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/params" ) // FullNodeGPO contains default gasprice oracle settings for full node. diff --git a/eth/ethconfig/gen_config.go b/eth/ethconfig/gen_config.go index 2abddc9e0d3..351052f5709 100644 --- a/eth/ethconfig/gen_config.go +++ b/eth/ethconfig/gen_config.go @@ -5,13 +5,13 @@ package ethconfig import ( "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/txpool/blobpool" - "github.com/ethereum/go-ethereum/core/txpool/legacypool" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/gasprice" - "github.com/ethereum/go-ethereum/miner" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/txpool/blobpool" + "github.com/ava-labs/libevm/core/txpool/legacypool" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/gasprice" + "github.com/ava-labs/libevm/miner" ) // MarshalTOML marshals as TOML. diff --git a/eth/fetcher/block_fetcher.go b/eth/fetcher/block_fetcher.go index 126eaaea7fa..5915067f933 100644 --- a/eth/fetcher/block_fetcher.go +++ b/eth/fetcher/block_fetcher.go @@ -22,14 +22,14 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/prque" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/prque" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/trie" ) const ( diff --git a/eth/fetcher/block_fetcher_test.go b/eth/fetcher/block_fetcher_test.go index cb7cbaf79ed..d85e5b54302 100644 --- a/eth/fetcher/block_fetcher_test.go +++ b/eth/fetcher/block_fetcher_test.go @@ -24,16 +24,16 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" ) var ( diff --git a/eth/fetcher/tx_fetcher.go b/eth/fetcher/tx_fetcher.go index ea7892d8d84..39562713a01 100644 --- a/eth/fetcher/tx_fetcher.go +++ b/eth/fetcher/tx_fetcher.go @@ -25,13 +25,13 @@ import ( "sort" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" ) const ( diff --git a/eth/fetcher/tx_fetcher_test.go b/eth/fetcher/tx_fetcher_test.go index 4a62e579b63..54fe5bbed90 100644 --- a/eth/fetcher/tx_fetcher_test.go +++ b/eth/fetcher/tx_fetcher_test.go @@ -23,11 +23,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) var ( diff --git a/eth/filters/api.go b/eth/filters/api.go index 8cf701ec571..41e15e0ddc2 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -25,12 +25,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/rpc" ) var ( diff --git a/eth/filters/api_test.go b/eth/filters/api_test.go index 822bc826f6b..e3a64a841be 100644 --- a/eth/filters/api_test.go +++ b/eth/filters/api_test.go @@ -21,8 +21,8 @@ import ( "fmt" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/rpc" ) func TestUnmarshalJSONNewFilterArgs(t *testing.T) { diff --git a/eth/filters/bench_test.go b/eth/filters/bench_test.go index 73b96b77af6..6080244d2c6 100644 --- a/eth/filters/bench_test.go +++ b/eth/filters/bench_test.go @@ -22,13 +22,13 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/bitutil" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/node" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/bitutil" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/node" ) func BenchmarkBloomBits512(b *testing.B) { diff --git a/eth/filters/filter.go b/eth/filters/filter.go index 83e3284a2b5..3f30c11a4bb 100644 --- a/eth/filters/filter.go +++ b/eth/filters/filter.go @@ -21,10 +21,10 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rpc" ) // Filter can be used to retrieve and filter logs. diff --git a/eth/filters/filter_system.go b/eth/filters/filter_system.go index f98a1f84ce1..f59a688a39e 100644 --- a/eth/filters/filter_system.go +++ b/eth/filters/filter_system.go @@ -25,18 +25,18 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) // Config represents the configuration of the filter system. diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go index 99c012cc84f..822300d696d 100644 --- a/eth/filters/filter_system_test.go +++ b/eth/filters/filter_system_test.go @@ -27,19 +27,19 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) type testBackend struct { diff --git a/eth/filters/filter_test.go b/eth/filters/filter_test.go index 659ca5ce197..c67d96fbba3 100644 --- a/eth/filters/filter_test.go +++ b/eth/filters/filter_test.go @@ -24,17 +24,17 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/triedb" ) func makeReceipt(addr common.Address) *types.Receipt { diff --git a/eth/gasestimator/gasestimator.go b/eth/gasestimator/gasestimator.go index f07f98956e3..107a593c459 100644 --- a/eth/gasestimator/gasestimator.go +++ b/eth/gasestimator/gasestimator.go @@ -23,13 +23,13 @@ import ( "math" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" ) // Options are the contextual parameters to execute the requested call. diff --git a/eth/gasprice/feehistory.go b/eth/gasprice/feehistory.go index d657eb6d996..0e2ca7a1aa2 100644 --- a/eth/gasprice/feehistory.go +++ b/eth/gasprice/feehistory.go @@ -25,11 +25,11 @@ import ( "math/big" "sync/atomic" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rpc" "golang.org/x/exp/slices" ) diff --git a/eth/gasprice/feehistory_test.go b/eth/gasprice/feehistory_test.go index 1bcfb287a57..6497e3d78fa 100644 --- a/eth/gasprice/feehistory_test.go +++ b/eth/gasprice/feehistory_test.go @@ -22,7 +22,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/rpc" ) func TestFeeHistory(t *testing.T) { diff --git a/eth/gasprice/gasprice.go b/eth/gasprice/gasprice.go index b7196498114..0d408d4c2bc 100644 --- a/eth/gasprice/gasprice.go +++ b/eth/gasprice/gasprice.go @@ -21,14 +21,14 @@ import ( "math/big" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" "golang.org/x/exp/slices" ) diff --git a/eth/gasprice/gasprice_test.go b/eth/gasprice/gasprice_test.go index 79217502f79..c3129a54cbd 100644 --- a/eth/gasprice/gasprice_test.go +++ b/eth/gasprice/gasprice_test.go @@ -22,16 +22,16 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) const testHead = 32 diff --git a/eth/handler.go b/eth/handler.go index 0343a578701..cafbbcb33ee 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -24,24 +24,24 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/fetcher" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/forkid" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/fetcher" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/triedb/pathdb" ) const ( diff --git a/eth/handler_eth.go b/eth/handler_eth.go index f1284c10e63..d38cbf21cc4 100644 --- a/eth/handler_eth.go +++ b/eth/handler_eth.go @@ -22,11 +22,11 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/p2p/enode" ) // ethHandler implements the eth.Backend interface to handle the various network diff --git a/eth/handler_eth_test.go b/eth/handler_eth_test.go index 579ca3c0973..17aa882f555 100644 --- a/eth/handler_eth_test.go +++ b/eth/handler_eth_test.go @@ -22,20 +22,20 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/forkid" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/params" ) // testEthHandler is a mock event handler to listen for inbound network requests diff --git a/eth/handler_snap.go b/eth/handler_snap.go index 767416ffd65..125ec4130f9 100644 --- a/eth/handler_snap.go +++ b/eth/handler_snap.go @@ -17,9 +17,9 @@ package eth import ( - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/p2p/enode" ) // snapHandler implements the snap.Backend interface to handle the various network diff --git a/eth/handler_test.go b/eth/handler_test.go index 58353f6b645..02e425b0bda 100644 --- a/eth/handler_test.go +++ b/eth/handler_test.go @@ -21,19 +21,19 @@ import ( "sort" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/eth/peer.go b/eth/peer.go index 76187777166..7bc908c4438 100644 --- a/eth/peer.go +++ b/eth/peer.go @@ -17,8 +17,8 @@ package eth import ( - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/eth/protocols/snap" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/eth/protocols/snap" ) // ethPeerInfo represents a short summary of the `eth` sub-protocol metadata known diff --git a/eth/peerset.go b/eth/peerset.go index c0c11e3e85e..e686026342d 100644 --- a/eth/peerset.go +++ b/eth/peerset.go @@ -22,10 +22,10 @@ import ( "math/big" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/p2p" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/p2p" ) var ( diff --git a/eth/protocols/eth/broadcast.go b/eth/protocols/eth/broadcast.go index ad5395cb8dd..29909227118 100644 --- a/eth/protocols/eth/broadcast.go +++ b/eth/protocols/eth/broadcast.go @@ -19,8 +19,8 @@ package eth import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) const ( diff --git a/eth/protocols/eth/discovery.go b/eth/protocols/eth/discovery.go index a7bdd47daf0..5bde57cedf2 100644 --- a/eth/protocols/eth/discovery.go +++ b/eth/protocols/eth/discovery.go @@ -17,10 +17,10 @@ package eth import ( - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/forkid" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/rlp" ) // enrEntry is the ENR entry which advertises `eth` protocol on the discovery. diff --git a/eth/protocols/eth/dispatcher.go b/eth/protocols/eth/dispatcher.go index ae98820cd6a..273b6dd9ca9 100644 --- a/eth/protocols/eth/dispatcher.go +++ b/eth/protocols/eth/dispatcher.go @@ -21,7 +21,7 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/p2p" + "github.com/ava-labs/libevm/p2p" ) var ( diff --git a/eth/protocols/eth/handler.go b/eth/protocols/eth/handler.go index 2d69ecdc836..8562a55ae03 100644 --- a/eth/protocols/eth/handler.go +++ b/eth/protocols/eth/handler.go @@ -21,14 +21,14 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/params" ) const ( diff --git a/eth/protocols/eth/handler_test.go b/eth/protocols/eth/handler_test.go index fdf551ef210..d1a1079f126 100644 --- a/eth/protocols/eth/handler_test.go +++ b/eth/protocols/eth/handler_test.go @@ -22,21 +22,21 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/txpool/legacypool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/txpool/legacypool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/params" ) var ( diff --git a/eth/protocols/eth/handlers.go b/eth/protocols/eth/handlers.go index 0275708a6cd..7e63f07fcca 100644 --- a/eth/protocols/eth/handlers.go +++ b/eth/protocols/eth/handlers.go @@ -20,12 +20,12 @@ import ( "encoding/json" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" ) func handleGetBlockHeaders(backend Backend, msg Decoder, peer *Peer) error { diff --git a/eth/protocols/eth/handshake.go b/eth/protocols/eth/handshake.go index ea16a85b1e1..b9e595ce196 100644 --- a/eth/protocols/eth/handshake.go +++ b/eth/protocols/eth/handshake.go @@ -22,10 +22,10 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/forkid" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/p2p" ) const ( diff --git a/eth/protocols/eth/handshake_test.go b/eth/protocols/eth/handshake_test.go index b9fd13d8630..389134b2e4a 100644 --- a/eth/protocols/eth/handshake_test.go +++ b/eth/protocols/eth/handshake_test.go @@ -20,10 +20,10 @@ import ( "errors" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/forkid" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" ) // Tests that handshake failures are detected and reported correctly. diff --git a/eth/protocols/eth/metrics.go b/eth/protocols/eth/metrics.go index 5e0aee39f84..0ba230fe306 100644 --- a/eth/protocols/eth/metrics.go +++ b/eth/protocols/eth/metrics.go @@ -16,7 +16,7 @@ package eth -import "github.com/ethereum/go-ethereum/metrics" +import "github.com/ava-labs/libevm/metrics" // meters stores ingress and egress handshake meters. var meters bidirectionalMeters diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index ffd78b05946..c80fc42664f 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -22,10 +22,10 @@ import ( "sync" mapset "github.com/deckarep/golang-set/v2" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/rlp" ) const ( diff --git a/eth/protocols/eth/peer_test.go b/eth/protocols/eth/peer_test.go index efbbbc6fff8..a66c5649ce9 100644 --- a/eth/protocols/eth/peer_test.go +++ b/eth/protocols/eth/peer_test.go @@ -23,9 +23,9 @@ import ( "crypto/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" ) // testPeer is a simulated peer to allow testing direct network calls. diff --git a/eth/protocols/eth/protocol.go b/eth/protocols/eth/protocol.go index 47e8d97244c..566b4f74612 100644 --- a/eth/protocols/eth/protocol.go +++ b/eth/protocols/eth/protocol.go @@ -22,10 +22,10 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/forkid" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/forkid" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" ) // Constants to match up protocol versions and messages diff --git a/eth/protocols/eth/protocol_test.go b/eth/protocols/eth/protocol_test.go index bc2545dea28..c6e84670692 100644 --- a/eth/protocols/eth/protocol_test.go +++ b/eth/protocols/eth/protocol_test.go @@ -21,9 +21,9 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" ) // Tests that the custom union field encoder and decoder works correctly. diff --git a/eth/protocols/eth/tracker.go b/eth/protocols/eth/tracker.go index 324fd22839c..7bd6bad9fb5 100644 --- a/eth/protocols/eth/tracker.go +++ b/eth/protocols/eth/tracker.go @@ -19,7 +19,7 @@ package eth import ( "time" - "github.com/ethereum/go-ethereum/p2p/tracker" + "github.com/ava-labs/libevm/p2p/tracker" ) // requestTracker is a singleton tracker for eth/66 and newer request times. diff --git a/eth/protocols/snap/discovery.go b/eth/protocols/snap/discovery.go index 684ec7e632d..dece58eacca 100644 --- a/eth/protocols/snap/discovery.go +++ b/eth/protocols/snap/discovery.go @@ -17,7 +17,7 @@ package snap import ( - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" ) // enrEntry is the ENR entry which advertises `snap` protocol on the discovery. diff --git a/eth/protocols/snap/handler.go b/eth/protocols/snap/handler.go index bd7ce9e7154..cc4ae809d4c 100644 --- a/eth/protocols/snap/handler.go +++ b/eth/protocols/snap/handler.go @@ -21,16 +21,16 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/trie/trienode" ) const ( diff --git a/eth/protocols/snap/handler_fuzzing_test.go b/eth/protocols/snap/handler_fuzzing_test.go index 4e234ad21b4..90f405a93b9 100644 --- a/eth/protocols/snap/handler_fuzzing_test.go +++ b/eth/protocols/snap/handler_fuzzing_test.go @@ -24,16 +24,16 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" fuzz "github.com/google/gofuzz" ) diff --git a/eth/protocols/snap/metrics.go b/eth/protocols/snap/metrics.go index a7d071953f6..378a4cab8d4 100644 --- a/eth/protocols/snap/metrics.go +++ b/eth/protocols/snap/metrics.go @@ -17,7 +17,7 @@ package snap import ( - metrics "github.com/ethereum/go-ethereum/metrics" + metrics "github.com/ava-labs/libevm/metrics" ) var ( diff --git a/eth/protocols/snap/peer.go b/eth/protocols/snap/peer.go index c57931678ce..89eb0d10dc1 100644 --- a/eth/protocols/snap/peer.go +++ b/eth/protocols/snap/peer.go @@ -17,9 +17,9 @@ package snap import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p" ) // Peer is a collection of relevant information we have about a `snap` peer. diff --git a/eth/protocols/snap/protocol.go b/eth/protocols/snap/protocol.go index 0db206b0810..d615a08e0e5 100644 --- a/eth/protocols/snap/protocol.go +++ b/eth/protocols/snap/protocol.go @@ -20,9 +20,9 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" ) // Constants to match up protocol versions and messages diff --git a/eth/protocols/snap/range.go b/eth/protocols/snap/range.go index 8c98c71d506..ea7ceeb9e4f 100644 --- a/eth/protocols/snap/range.go +++ b/eth/protocols/snap/range.go @@ -19,7 +19,7 @@ package snap import ( "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" "github.com/holiman/uint256" ) diff --git a/eth/protocols/snap/range_test.go b/eth/protocols/snap/range_test.go index ea643f13612..7aca87d7780 100644 --- a/eth/protocols/snap/range_test.go +++ b/eth/protocols/snap/range_test.go @@ -19,7 +19,7 @@ package snap import ( "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // Tests that given a starting hash and a density, the hash ranger can correctly diff --git a/eth/protocols/snap/sort_test.go b/eth/protocols/snap/sort_test.go index be0a8c57069..2d51de44d99 100644 --- a/eth/protocols/snap/sort_test.go +++ b/eth/protocols/snap/sort_test.go @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func hexToNibbles(s string) []byte { diff --git a/eth/protocols/snap/sync.go b/eth/protocols/snap/sync.go index 887a50775d7..de8c0c02c2d 100644 --- a/eth/protocols/snap/sync.go +++ b/eth/protocols/snap/sync.go @@ -29,19 +29,19 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/msgrate" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/msgrate" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/trie/trienode" "golang.org/x/crypto/sha3" ) diff --git a/eth/protocols/snap/sync_test.go b/eth/protocols/snap/sync_test.go index b780868b4e0..a31bfee7fea 100644 --- a/eth/protocols/snap/sync_test.go +++ b/eth/protocols/snap/sync_test.go @@ -27,18 +27,18 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "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/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/testutil" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "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/trie/testutil" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/pathdb" "github.com/holiman/uint256" "golang.org/x/crypto/sha3" "golang.org/x/exp/slices" diff --git a/eth/protocols/snap/tracker.go b/eth/protocols/snap/tracker.go index 2cf59cc23ac..f4b6b779dfb 100644 --- a/eth/protocols/snap/tracker.go +++ b/eth/protocols/snap/tracker.go @@ -19,7 +19,7 @@ package snap import ( "time" - "github.com/ethereum/go-ethereum/p2p/tracker" + "github.com/ava-labs/libevm/p2p/tracker" ) // requestTracker is a singleton tracker for request times. diff --git a/eth/state_accessor.go b/eth/state_accessor.go index 526361a2b8a..bd42e048642 100644 --- a/eth/state_accessor.go +++ b/eth/state_accessor.go @@ -22,16 +22,16 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" ) // noopReleaser is returned in case there is no operation expected diff --git a/eth/sync.go b/eth/sync.go index cdcfbdb3db4..dbcf057cc2d 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -21,12 +21,12 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/log" ) const ( diff --git a/eth/sync_test.go b/eth/sync_test.go index a31986730f0..58f1a4db467 100644 --- a/eth/sync_test.go +++ b/eth/sync_test.go @@ -20,11 +20,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/eth/protocols/snap" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/eth/protocols/snap" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" ) // Tests that snap sync is disabled after a successful sync cycle. diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 68331082052..42afcd67eef 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -27,21 +27,21 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers/logger" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers/logger" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/rpc" ) const ( diff --git a/eth/tracers/api_test.go b/eth/tracers/api_test.go index d8e4b9a4ef3..2e1a750a6f6 100644 --- a/eth/tracers/api_test.go +++ b/eth/tracers/api_test.go @@ -28,21 +28,21 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "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/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "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/libevm/internal/ethapi" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" "golang.org/x/exp/slices" ) diff --git a/eth/tracers/internal/tracetest/calltrace_test.go b/eth/tracers/internal/tracetest/calltrace_test.go index 6216a16ced9..7b5008688f4 100644 --- a/eth/tracers/internal/tracetest/calltrace_test.go +++ b/eth/tracers/internal/tracetest/calltrace_test.go @@ -24,17 +24,17 @@ import ( "strings" "testing" - "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/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/tests" + "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/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/tests" ) type callContext struct { diff --git a/eth/tracers/internal/tracetest/flat_calltrace_test.go b/eth/tracers/internal/tracetest/flat_calltrace_test.go index abee4889176..4ed1507d2a6 100644 --- a/eth/tracers/internal/tracetest/flat_calltrace_test.go +++ b/eth/tracers/internal/tracetest/flat_calltrace_test.go @@ -10,17 +10,17 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/tests" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/tests" // Force-load the native, to trigger registration - "github.com/ethereum/go-ethereum/eth/tracers" + "github.com/ava-labs/libevm/eth/tracers" ) // flatCallTrace is the result of a callTracerParity run. diff --git a/eth/tracers/internal/tracetest/prestate_test.go b/eth/tracers/internal/tracetest/prestate_test.go index 8a60123dc2c..1a31ae6f093 100644 --- a/eth/tracers/internal/tracetest/prestate_test.go +++ b/eth/tracers/internal/tracetest/prestate_test.go @@ -24,13 +24,13 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/tests" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/tests" ) // prestateTrace is the result of a prestateTrace run. diff --git a/eth/tracers/internal/tracetest/util.go b/eth/tracers/internal/tracetest/util.go index 95d292c9240..ee9194fbf83 100644 --- a/eth/tracers/internal/tracetest/util.go +++ b/eth/tracers/internal/tracetest/util.go @@ -5,8 +5,8 @@ import ( "unicode" // Force-load native and js packages, 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" ) // To generate a new callTracer test, copy paste the makeTest method below into diff --git a/eth/tracers/js/goja.go b/eth/tracers/js/goja.go index 07c138bae47..72fac558b0f 100644 --- a/eth/tracers/js/goja.go +++ b/eth/tracers/js/goja.go @@ -24,12 +24,12 @@ import ( "github.com/dop251/goja" - "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/crypto" - "github.com/ethereum/go-ethereum/eth/tracers" - jsassets "github.com/ethereum/go-ethereum/eth/tracers/js/internal/tracers" + "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/crypto" + "github.com/ava-labs/libevm/eth/tracers" + jsassets "github.com/ava-labs/libevm/eth/tracers/js/internal/tracers" ) var assetTracers = make(map[string]string) diff --git a/eth/tracers/js/tracer_test.go b/eth/tracers/js/tracer_test.go index b7f2693770b..767e283c5e5 100644 --- a/eth/tracers/js/tracer_test.go +++ b/eth/tracers/js/tracer_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/eth/tracers/logger/access_list_tracer.go b/eth/tracers/logger/access_list_tracer.go index 766ee4e4b95..7cb6218fb07 100644 --- a/eth/tracers/logger/access_list_tracer.go +++ b/eth/tracers/logger/access_list_tracer.go @@ -19,9 +19,9 @@ package logger import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" ) // accessList is an accumulator for the set of accounts and storage slots an EVM diff --git a/eth/tracers/logger/gen_structlog.go b/eth/tracers/logger/gen_structlog.go index b406cb34454..8a1d17acf35 100644 --- a/eth/tracers/logger/gen_structlog.go +++ b/eth/tracers/logger/gen_structlog.go @@ -5,10 +5,10 @@ package logger import ( "encoding/json" - "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/core/vm" + "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/core/vm" "github.com/holiman/uint256" ) diff --git a/eth/tracers/logger/logger.go b/eth/tracers/logger/logger.go index 2b36f9f4922..977f7fa09e1 100644 --- a/eth/tracers/logger/logger.go +++ b/eth/tracers/logger/logger.go @@ -25,12 +25,12 @@ import ( "strings" "sync/atomic" - "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/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "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/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/eth/tracers/logger/logger_json.go b/eth/tracers/logger/logger_json.go index a2cb4cd9fc5..cc713a7b80d 100644 --- a/eth/tracers/logger/logger_json.go +++ b/eth/tracers/logger/logger_json.go @@ -21,9 +21,9 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/core/vm" ) type JSONLogger struct { diff --git a/eth/tracers/logger/logger_test.go b/eth/tracers/logger/logger_test.go index 1d8eb320f60..3812dc5b911 100644 --- a/eth/tracers/logger/logger_test.go +++ b/eth/tracers/logger/logger_test.go @@ -22,10 +22,10 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/eth/tracers/native/4byte.go b/eth/tracers/native/4byte.go index 5a2c4f91115..5acddb3c6ed 100644 --- a/eth/tracers/native/4byte.go +++ b/eth/tracers/native/4byte.go @@ -22,9 +22,9 @@ import ( "strconv" "sync/atomic" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" ) func init() { diff --git a/eth/tracers/native/call.go b/eth/tracers/native/call.go index be9b58a4cd3..62de52e7892 100644 --- a/eth/tracers/native/call.go +++ b/eth/tracers/native/call.go @@ -22,12 +22,12 @@ import ( "math/big" "sync/atomic" - "github.com/ethereum/go-ethereum/accounts/abi" - "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" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/accounts/abi" + "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" + "github.com/ava-labs/libevm/log" ) //go:generate go run github.com/fjl/gencodec -type callFrame -field-override callFrameMarshaling -out gen_callframe_json.go diff --git a/eth/tracers/native/call_flat.go b/eth/tracers/native/call_flat.go index 266ab990014..01aa40eb829 100644 --- a/eth/tracers/native/call_flat.go +++ b/eth/tracers/native/call_flat.go @@ -23,10 +23,10 @@ import ( "math/big" "strings" - "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" + "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" ) //go:generate go run github.com/fjl/gencodec -type flatCallAction -field-override flatCallActionMarshaling -out gen_flatcallaction_json.go diff --git a/eth/tracers/native/gen_account_json.go b/eth/tracers/native/gen_account_json.go index 4c39cbc38cd..bd62f0db35c 100644 --- a/eth/tracers/native/gen_account_json.go +++ b/eth/tracers/native/gen_account_json.go @@ -6,8 +6,8 @@ import ( "encoding/json" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*accountMarshaling)(nil) diff --git a/eth/tracers/native/gen_callframe_json.go b/eth/tracers/native/gen_callframe_json.go index c44f38390df..52b864352a6 100644 --- a/eth/tracers/native/gen_callframe_json.go +++ b/eth/tracers/native/gen_callframe_json.go @@ -6,9 +6,9 @@ import ( "encoding/json" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/vm" ) var _ = (*callFrameMarshaling)(nil) diff --git a/eth/tracers/native/gen_flatcallaction_json.go b/eth/tracers/native/gen_flatcallaction_json.go index c0756069835..9609d50b63b 100644 --- a/eth/tracers/native/gen_flatcallaction_json.go +++ b/eth/tracers/native/gen_flatcallaction_json.go @@ -6,8 +6,8 @@ import ( "encoding/json" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*flatCallActionMarshaling)(nil) diff --git a/eth/tracers/native/gen_flatcallresult_json.go b/eth/tracers/native/gen_flatcallresult_json.go index e9fa5e44da8..c8e65589ffe 100644 --- a/eth/tracers/native/gen_flatcallresult_json.go +++ b/eth/tracers/native/gen_flatcallresult_json.go @@ -5,8 +5,8 @@ package native import ( "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var _ = (*flatCallResultMarshaling)(nil) diff --git a/eth/tracers/native/mux.go b/eth/tracers/native/mux.go index db8ddd64380..04d30201772 100644 --- a/eth/tracers/native/mux.go +++ b/eth/tracers/native/mux.go @@ -20,9 +20,9 @@ import ( "encoding/json" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" ) func init() { diff --git a/eth/tracers/native/noop.go b/eth/tracers/native/noop.go index 3beecd8abfe..282100b4315 100644 --- a/eth/tracers/native/noop.go +++ b/eth/tracers/native/noop.go @@ -20,9 +20,9 @@ import ( "encoding/json" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers" ) func init() { diff --git a/eth/tracers/native/prestate.go b/eth/tracers/native/prestate.go index d7e10173cf2..55e021e097d 100644 --- a/eth/tracers/native/prestate.go +++ b/eth/tracers/native/prestate.go @@ -22,12 +22,12 @@ import ( "math/big" "sync/atomic" - "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/crypto" - "github.com/ethereum/go-ethereum/eth/tracers" - "github.com/ethereum/go-ethereum/log" + "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/crypto" + "github.com/ava-labs/libevm/eth/tracers" + "github.com/ava-labs/libevm/log" ) //go:generate go run github.com/fjl/gencodec -type account -field-override accountMarshaling -out gen_account_json.go diff --git a/eth/tracers/tracers.go b/eth/tracers/tracers.go index 7b43b7cf834..1c8bd2b171b 100644 --- a/eth/tracers/tracers.go +++ b/eth/tracers/tracers.go @@ -23,8 +23,8 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" ) // Context contains some contextual infos for a transaction execution that is not diff --git a/eth/tracers/tracers_test.go b/eth/tracers/tracers_test.go index 6ac266e06d6..7a82ecc8a5a 100644 --- a/eth/tracers/tracers_test.go +++ b/eth/tracers/tracers_test.go @@ -20,15 +20,15 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "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/params" - "github.com/ethereum/go-ethereum/tests" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "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/params" + "github.com/ava-labs/libevm/tests" ) func BenchmarkTransactionTrace(b *testing.B) { diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 5c3cb79dd65..6fdb5a5f932 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -24,11 +24,11 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rpc" ) // Client defines typed wrappers for the Ethereum RPC API. diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go index 0d2675f8d10..e0a75d87254 100644 --- a/ethclient/ethclient_test.go +++ b/ethclient/ethclient_test.go @@ -25,17 +25,17 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) // Verify that Client implements the ethereum interfaces. diff --git a/ethclient/gethclient/gethclient.go b/ethclient/gethclient/gethclient.go index 73d05d499ef..ebd87d684be 100644 --- a/ethclient/gethclient/gethclient.go +++ b/ethclient/gethclient/gethclient.go @@ -25,12 +25,12 @@ import ( "runtime" "runtime/debug" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/rpc" ) // Client is a wrapper around rpc.Client that implements geth-specific functionality. diff --git a/ethclient/gethclient/gethclient_test.go b/ethclient/gethclient/gethclient_test.go index 158886475ed..d5a53623fda 100644 --- a/ethclient/gethclient/gethclient_test.go +++ b/ethclient/gethclient/gethclient_test.go @@ -23,19 +23,19 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/eth/filters" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/eth/filters" + "github.com/ava-labs/libevm/ethclient" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) var ( diff --git a/ethclient/signer.go b/ethclient/signer.go index f827d4eb56f..0c61668c719 100644 --- a/ethclient/signer.go +++ b/ethclient/signer.go @@ -20,8 +20,8 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) // senderFromServer is a types.Signer that remembers the sender address returned by the RPC diff --git a/ethclient/simulated/backend.go b/ethclient/simulated/backend.go index 0c2a0b453c1..ee90f4d415b 100644 --- a/ethclient/simulated/backend.go +++ b/ethclient/simulated/backend.go @@ -19,20 +19,20 @@ package simulated import ( "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/catalyst" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/eth/filters" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/catalyst" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/eth/filters" + "github.com/ava-labs/libevm/ethclient" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) // Client exposes the methods provided by the Ethereum RPC client. diff --git a/ethclient/simulated/backend_test.go b/ethclient/simulated/backend_test.go index a8fd7913c33..3bcb60937d2 100644 --- a/ethclient/simulated/backend_test.go +++ b/ethclient/simulated/backend_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/accounts/abi/bind" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/params" ) var _ bind.ContractBackend = (Client)(nil) diff --git a/ethclient/simulated/options.go b/ethclient/simulated/options.go index 6db995c9175..a4ae639a9ec 100644 --- a/ethclient/simulated/options.go +++ b/ethclient/simulated/options.go @@ -19,8 +19,8 @@ package simulated import ( "math/big" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/node" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/node" ) // WithBlockGasLimit configures the simulated backend to target a specific gas limit diff --git a/ethclient/simulated/options_test.go b/ethclient/simulated/options_test.go index 9ff2be5ff93..504be1b9b5a 100644 --- a/ethclient/simulated/options_test.go +++ b/ethclient/simulated/options_test.go @@ -22,10 +22,10 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) // Tests that the simulator starts with the initial gas limit in the genesis block, diff --git a/ethdb/dbtest/testsuite.go b/ethdb/dbtest/testsuite.go index 29bd24364e3..89917a26762 100644 --- a/ethdb/dbtest/testsuite.go +++ b/ethdb/dbtest/testsuite.go @@ -23,7 +23,7 @@ import ( "sort" "testing" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/ethdb" "golang.org/x/exp/slices" ) diff --git a/ethdb/leveldb/leveldb.go b/ethdb/leveldb/leveldb.go index e58efbddbe8..d5fd6b555ac 100644 --- a/ethdb/leveldb/leveldb.go +++ b/ethdb/leveldb/leveldb.go @@ -26,10 +26,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/errors" "github.com/syndtr/goleveldb/leveldb/filter" diff --git a/ethdb/leveldb/leveldb_test.go b/ethdb/leveldb/leveldb_test.go index d8c63860161..d71ca5d5be2 100644 --- a/ethdb/leveldb/leveldb_test.go +++ b/ethdb/leveldb/leveldb_test.go @@ -19,8 +19,8 @@ package leveldb import ( "testing" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethdb/dbtest" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/ethdb/dbtest" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/storage" ) diff --git a/ethdb/memorydb/memorydb.go b/ethdb/memorydb/memorydb.go index 2a939f9a185..ad51a13ef9b 100644 --- a/ethdb/memorydb/memorydb.go +++ b/ethdb/memorydb/memorydb.go @@ -23,8 +23,8 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" ) var ( diff --git a/ethdb/memorydb/memorydb_test.go b/ethdb/memorydb/memorydb_test.go index 51499c3b1f0..6468ec95f55 100644 --- a/ethdb/memorydb/memorydb_test.go +++ b/ethdb/memorydb/memorydb_test.go @@ -20,8 +20,8 @@ import ( "encoding/binary" "testing" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethdb/dbtest" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/ethdb/dbtest" ) func TestMemoryDB(t *testing.T) { diff --git a/ethdb/pebble/pebble.go b/ethdb/pebble/pebble.go index af4686cf5b7..7efa104eeb4 100644 --- a/ethdb/pebble/pebble.go +++ b/ethdb/pebble/pebble.go @@ -27,10 +27,10 @@ import ( "github.com/cockroachdb/pebble" "github.com/cockroachdb/pebble/bloom" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" ) const ( diff --git a/ethdb/pebble/pebble_test.go b/ethdb/pebble/pebble_test.go index 1d5611f211e..6c46ce4548f 100644 --- a/ethdb/pebble/pebble_test.go +++ b/ethdb/pebble/pebble_test.go @@ -21,8 +21,8 @@ import ( "github.com/cockroachdb/pebble" "github.com/cockroachdb/pebble/vfs" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethdb/dbtest" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/ethdb/dbtest" ) func TestPebbleDB(t *testing.T) { diff --git a/ethdb/remotedb/remotedb.go b/ethdb/remotedb/remotedb.go index c1c803caf2b..8375dd0dfa2 100644 --- a/ethdb/remotedb/remotedb.go +++ b/ethdb/remotedb/remotedb.go @@ -22,9 +22,9 @@ package remotedb import ( - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/rpc" ) // Database is a key-value lookup for a remote database via debug_dbGet. diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go index 61ceec443eb..21a211acedf 100644 --- a/ethstats/ethstats.go +++ b/ethstats/ethstats.go @@ -30,19 +30,19 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - ethproto "github.com/ethereum/go-ethereum/eth/protocols/eth" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + ethproto "github.com/ava-labs/libevm/eth/protocols/eth" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/rpc" "github.com/gorilla/websocket" ) diff --git a/event/example_feed_test.go b/event/example_feed_test.go index 9b5ad50df54..47f5b761fa6 100644 --- a/event/example_feed_test.go +++ b/event/example_feed_test.go @@ -19,7 +19,7 @@ package event_test import ( "fmt" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm/event" ) func ExampleFeed_acknowledgedEvents() { diff --git a/event/example_scope_test.go b/event/example_scope_test.go index 825a8deeacb..85e96174ee2 100644 --- a/event/example_scope_test.go +++ b/event/example_scope_test.go @@ -20,7 +20,7 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm/event" ) // This example demonstrates how SubscriptionScope can be used to control the lifetime of diff --git a/event/example_subscription_test.go b/event/example_subscription_test.go index 5c76b55d98e..df2bd27f16d 100644 --- a/event/example_subscription_test.go +++ b/event/example_subscription_test.go @@ -19,7 +19,7 @@ package event_test import ( "fmt" - "github.com/ethereum/go-ethereum/event" + "github.com/ava-labs/libevm/event" ) func ExampleNewSubscription() { diff --git a/event/subscription.go b/event/subscription.go index 07e059c6db3..055f5908f31 100644 --- a/event/subscription.go +++ b/event/subscription.go @@ -21,7 +21,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/ava-labs/libevm/common/mclock" ) // Subscription represents a stream of events. The carrier of the events is typically a diff --git a/go.mod b/go.mod index 7a54b1ff7ca..91ce2782224 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/ethereum/go-ethereum +module github.com/ava-labs/libevm go 1.20 diff --git a/graphql/graphiql.go b/graphql/graphiql.go index 823df0c6419..94a2eb20ffd 100644 --- a/graphql/graphiql.go +++ b/graphql/graphiql.go @@ -27,8 +27,8 @@ import ( "net/http" "path/filepath" - "github.com/ethereum/go-ethereum/graphql/internal/graphiql" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/graphql/internal/graphiql" + "github.com/ava-labs/libevm/log" ) // GraphiQL is an in-browser IDE for exploring GraphiQL APIs. diff --git a/graphql/graphql.go b/graphql/graphql.go index bac86476b10..84a8dd3b26f 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -27,17 +27,17 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum" - "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/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/filters" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "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/consensus/misc/eip1559" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/filters" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/rpc" ) var ( diff --git a/graphql/graphql_test.go b/graphql/graphql_test.go index 1dda1020582..452631b307a 100644 --- a/graphql/graphql_test.go +++ b/graphql/graphql_test.go @@ -27,19 +27,19 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/eth/filters" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/eth/filters" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/params" "github.com/stretchr/testify/assert" ) diff --git a/graphql/service.go b/graphql/service.go index 584165bdb80..d7a14827036 100644 --- a/graphql/service.go +++ b/graphql/service.go @@ -24,10 +24,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/eth/filters" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/eth/filters" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/rpc" "github.com/graph-gophers/graphql-go" gqlErrors "github.com/graph-gophers/graphql-go/errors" ) diff --git a/interfaces.go b/interfaces.go index 53e2e3ae169..31b47dddb0b 100644 --- a/interfaces.go +++ b/interfaces.go @@ -22,8 +22,8 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) // NotFound is returned by API methods if the requested item does not exist. diff --git a/internal/blocktest/test_hash.go b/internal/blocktest/test_hash.go index 4d2b077e89b..85d17c5bf16 100644 --- a/internal/blocktest/test_hash.go +++ b/internal/blocktest/test_hash.go @@ -25,7 +25,7 @@ package blocktest import ( "hash" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" "golang.org/x/crypto/sha3" ) diff --git a/internal/cmdtest/test_cmd.go b/internal/cmdtest/test_cmd.go index 4890d0b7c61..e8823276234 100644 --- a/internal/cmdtest/test_cmd.go +++ b/internal/cmdtest/test_cmd.go @@ -32,7 +32,7 @@ import ( "text/template" "time" - "github.com/ethereum/go-ethereum/internal/reexec" + "github.com/ava-labs/libevm/internal/reexec" ) func NewTestCmd(t *testing.T, data interface{}) *TestCmd { diff --git a/internal/debug/api.go b/internal/debug/api.go index 482989e0d0f..936df44f221 100644 --- a/internal/debug/api.go +++ b/internal/debug/api.go @@ -35,7 +35,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" "github.com/hashicorp/go-bexpr" "golang.org/x/exp/slog" ) diff --git a/internal/debug/flags.go b/internal/debug/flags.go index dac878a7b1f..188c03d5ffe 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -26,10 +26,10 @@ import ( "path/filepath" "runtime" - "github.com/ethereum/go-ethereum/internal/flags" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/metrics/exp" + "github.com/ava-labs/libevm/internal/flags" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/metrics/exp" "github.com/fjl/memsize/memsizeui" "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" diff --git a/internal/debug/trace.go b/internal/debug/trace.go index e291030b82e..ea7ebfe83cc 100644 --- a/internal/debug/trace.go +++ b/internal/debug/trace.go @@ -21,7 +21,7 @@ import ( "os" "runtime/trace" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) // StartGoTrace turns on tracing, writing to the given file. diff --git a/internal/era/accumulator.go b/internal/era/accumulator.go index 19e03973f1f..8344f474758 100644 --- a/internal/era/accumulator.go +++ b/internal/era/accumulator.go @@ -20,7 +20,7 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ssz "github.com/ferranbt/fastssz" ) diff --git a/internal/era/builder.go b/internal/era/builder.go index 9217c049f33..987b48ba62d 100644 --- a/internal/era/builder.go +++ b/internal/era/builder.go @@ -22,10 +22,10 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/internal/era/e2store" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/internal/era/e2store" + "github.com/ava-labs/libevm/rlp" "github.com/golang/snappy" ) diff --git a/internal/era/e2store/e2store_test.go b/internal/era/e2store/e2store_test.go index febcffe4cf2..78a806bd120 100644 --- a/internal/era/e2store/e2store_test.go +++ b/internal/era/e2store/e2store_test.go @@ -22,7 +22,7 @@ import ( "io" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) func TestEncode(t *testing.T) { diff --git a/internal/era/era.go b/internal/era/era.go index a0e701b7e0f..38402620e50 100644 --- a/internal/era/era.go +++ b/internal/era/era.go @@ -27,10 +27,10 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/internal/era/e2store" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/internal/era/e2store" + "github.com/ava-labs/libevm/rlp" "github.com/golang/snappy" ) diff --git a/internal/era/era_test.go b/internal/era/era_test.go index ee5d9e82a09..0f17de2eed7 100644 --- a/internal/era/era_test.go +++ b/internal/era/era_test.go @@ -23,7 +23,7 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) type testchain struct { diff --git a/internal/era/iterator.go b/internal/era/iterator.go index e74a8154b1a..5d3934f1db7 100644 --- a/internal/era/iterator.go +++ b/internal/era/iterator.go @@ -21,8 +21,8 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" ) // Iterator wraps RawIterator and returns decoded Era1 entries. diff --git a/internal/ethapi/addrlock.go b/internal/ethapi/addrlock.go index 61ddff688cc..9be45b2aef7 100644 --- a/internal/ethapi/addrlock.go +++ b/internal/ethapi/addrlock.go @@ -19,7 +19,7 @@ package ethapi import ( "sync" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) type AddrLocker struct { diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 863849f4da6..7da95b2e5d7 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -26,27 +26,27 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/accounts/scwallet" - "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/consensus" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/gasestimator" - "github.com/ethereum/go-ethereum/eth/tracers/logger" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/accounts/scwallet" + "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/consensus" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/gasestimator" + "github.com/ava-labs/libevm/eth/tracers/logger" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/trie" "github.com/holiman/uint256" "github.com/tyler-smith/go-bip39" ) diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index a6f7405eb36..3559eb1a8b3 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -31,27 +31,27 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/internal/blocktest" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/beacon" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/internal/blocktest" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" "github.com/holiman/uint256" "github.com/stretchr/testify/require" "golang.org/x/exp/slices" diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 5f408ba20ba..4c8535fe01e 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -22,19 +22,19 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) // Backend interface provides the common API services (that are provided by diff --git a/internal/ethapi/dbapi.go b/internal/ethapi/dbapi.go index 33fda936dcd..2bd3bc956e5 100644 --- a/internal/ethapi/dbapi.go +++ b/internal/ethapi/dbapi.go @@ -17,8 +17,8 @@ package ethapi import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) // DbGet returns the raw value of a key stored in the database. diff --git a/internal/ethapi/errors.go b/internal/ethapi/errors.go index b5e668a8050..de0efc8f0f3 100644 --- a/internal/ethapi/errors.go +++ b/internal/ethapi/errors.go @@ -19,9 +19,9 @@ package ethapi import ( "fmt" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/vm" ) // revertError is an API error that encompasses an EVM revert with JSON error diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index bae1c686415..90f24bc6035 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -24,16 +24,16 @@ import ( "fmt" "math/big" - "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/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto/kzg4844" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "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/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto/kzg4844" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" "github.com/holiman/uint256" ) diff --git a/internal/ethapi/transaction_args_test.go b/internal/ethapi/transaction_args_test.go index 1b1634b2503..c99cf8521a5 100644 --- a/internal/ethapi/transaction_args_test.go +++ b/internal/ethapi/transaction_args_test.go @@ -24,20 +24,20 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/bloombits" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rpc" ) // TestSetFeeDefaults tests the logic for filling in default fee values works as expected. diff --git a/internal/flags/flags.go b/internal/flags/flags.go index bf62c53adf5..e5decd9956a 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -28,7 +28,7 @@ import ( "strings" "syscall" - "github.com/ethereum/go-ethereum/common/math" + "github.com/ava-labs/libevm/common/math" "github.com/urfave/cli/v2" ) diff --git a/internal/flags/helpers.go b/internal/flags/helpers.go index 0112724fa14..cb0c6230533 100644 --- a/internal/flags/helpers.go +++ b/internal/flags/helpers.go @@ -23,9 +23,9 @@ import ( "sort" "strings" - "github.com/ethereum/go-ethereum/internal/version" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/internal/version" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" "github.com/mattn/go-isatty" "github.com/urfave/cli/v2" ) diff --git a/internal/guide/guide_test.go b/internal/guide/guide_test.go index f682daac91b..278f9134fef 100644 --- a/internal/guide/guide_test.go +++ b/internal/guide/guide_test.go @@ -28,9 +28,9 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) // Tests that the account management snippets work correctly. diff --git a/internal/jsre/jsre.go b/internal/jsre/jsre.go index f6e21d2ef70..8eaf53d11f1 100644 --- a/internal/jsre/jsre.go +++ b/internal/jsre/jsre.go @@ -28,7 +28,7 @@ import ( "time" "github.com/dop251/goja" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // JSRE is a JS runtime environment embedding the goja interpreter. diff --git a/internal/shutdowncheck/shutdown_tracker.go b/internal/shutdowncheck/shutdown_tracker.go index c95b4f02f4b..7ebbf77aab3 100644 --- a/internal/shutdowncheck/shutdown_tracker.go +++ b/internal/shutdowncheck/shutdown_tracker.go @@ -19,10 +19,10 @@ package shutdowncheck import ( "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) // ShutdownTracker is a service that reports previous unclean shutdowns diff --git a/internal/testlog/testlog.go b/internal/testlog/testlog.go index 037b7ee9c12..befcf2714f4 100644 --- a/internal/testlog/testlog.go +++ b/internal/testlog/testlog.go @@ -24,7 +24,7 @@ import ( "sync" "testing" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" "golang.org/x/exp/slog" ) diff --git a/internal/version/version.go b/internal/version/version.go index 0daea02b57e..882dad91d24 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -23,10 +23,10 @@ import ( "runtime/debug" "strings" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) -const ourPath = "github.com/ethereum/go-ethereum" // Path to our module +const ourPath = "github.com/ava-labs/libevm" // Path to our module // These variables are set at build-time by the linker when the build is // done by build/ci.go. diff --git a/libevm/ethtest/evm.go b/libevm/ethtest/evm.go new file mode 100644 index 00000000000..4e16c4e90bb --- /dev/null +++ b/libevm/ethtest/evm.go @@ -0,0 +1,98 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +// Package ethtest provides utility functions for use in testing +// Ethereum-related functionality. +package ethtest + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/params" +) + +// NewZeroEVM returns a new EVM backed by a [rawdb.NewMemoryDatabase]; all other +// arguments to [vm.NewEVM] are the zero values of their respective types, +// except for the use of [core.CanTransfer] and [core.Transfer] instead of nil +// functions. +func NewZeroEVM(tb testing.TB, opts ...EVMOption) (*state.StateDB, *vm.EVM) { + tb.Helper() + + sdb, err := state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()), nil) + require.NoError(tb, err, "state.New()") + + args := &evmConstructorArgs{ + vm.BlockContext{ + CanTransfer: core.CanTransfer, + Transfer: core.Transfer, + }, + vm.TxContext{}, + sdb, + ¶ms.ChainConfig{}, + vm.Config{}, + } + for _, o := range opts { + o.apply(args) + } + + return sdb, vm.NewEVM( + args.blockContext, + args.txContext, + args.stateDB, + args.chainConfig, + args.config, + ) +} + +type evmConstructorArgs struct { + blockContext vm.BlockContext + txContext vm.TxContext + stateDB vm.StateDB + chainConfig *params.ChainConfig + config vm.Config +} + +// An EVMOption configures the EVM returned by [NewZeroEVM]. +type EVMOption interface { + apply(*evmConstructorArgs) +} + +type funcOption func(*evmConstructorArgs) + +var _ EVMOption = funcOption(nil) + +func (f funcOption) apply(args *evmConstructorArgs) { f(args) } + +// WithBlockContext overrides the default context. +func WithBlockContext(c vm.BlockContext) EVMOption { + return funcOption(func(args *evmConstructorArgs) { + args.blockContext = c + }) +} + +// WithBlockContext overrides the default context. +func WithChainConfig(c *params.ChainConfig) EVMOption { + return funcOption(func(args *evmConstructorArgs) { + args.chainConfig = c + }) +} diff --git a/libevm/ethtest/rand.go b/libevm/ethtest/rand.go new file mode 100644 index 00000000000..ffb9de6b8f2 --- /dev/null +++ b/libevm/ethtest/rand.go @@ -0,0 +1,90 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package ethtest + +import ( + "math/big" + + "github.com/holiman/uint256" + "golang.org/x/exp/rand" + + "github.com/ava-labs/libevm/common" +) + +// PseudoRand extends [rand.Rand] (*not* crypto/rand). +type PseudoRand struct { + *rand.Rand +} + +// NewPseudoRand returns a new PseudoRand with the given seed. +func NewPseudoRand(seed uint64) *PseudoRand { + return &PseudoRand{rand.New(rand.NewSource(seed))} +} + +// Read is equivalent to [rand.Rand.Read] except that it doesn't return an error +// because it is guaranteed to be nil. +func (r *PseudoRand) Read(p []byte) int { + n, _ := r.Rand.Read(p) // Guaranteed nil error + return n +} + +// Address returns a pseudorandom address. +func (r *PseudoRand) Address() (a common.Address) { + r.Read(a[:]) + return a +} + +// AddressPtr returns a pointer to a pseudorandom address. +func (r *PseudoRand) AddressPtr() *common.Address { + a := r.Address() + return &a +} + +// Hash returns a pseudorandom hash. +func (r *PseudoRand) Hash() (h common.Hash) { + r.Read(h[:]) + return h +} + +// HashPtr returns a pointer to a pseudorandom hash. +func (r *PseudoRand) HashPtr() *common.Hash { + h := r.Hash() + return &h +} + +// Bytes returns `n` pseudorandom bytes. +func (r *PseudoRand) Bytes(n uint) []byte { + b := make([]byte, n) + r.Read(b) + return b +} + +// Big returns [rand.Rand.Uint64] as a [big.Int]. +func (r *PseudoRand) BigUint64() *big.Int { + return new(big.Int).SetUint64(r.Uint64()) +} + +// Uint64Ptr returns a pointer to a pseudorandom uint64. +func (r *PseudoRand) Uint64Ptr() *uint64 { + u := r.Uint64() + return &u +} + +// Uint256 returns a random 256-bit unsigned int. +func (r *PseudoRand) Uint256() *uint256.Int { + return new(uint256.Int).SetBytes(r.Bytes(32)) +} diff --git a/libevm/hookstest/stub.go b/libevm/hookstest/stub.go new file mode 100644 index 00000000000..1e37aa3f940 --- /dev/null +++ b/libevm/hookstest/stub.go @@ -0,0 +1,128 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +// Package hookstest provides test doubles and convenience wrappers for testing +// libevm hooks. +package hookstest + +import ( + "math/big" + "testing" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/libevm" + "github.com/ava-labs/libevm/params" +) + +// Register clears any registered [params.Extras] and then registers `extras` +// for the lifetime of the current test, clearing them via tb's +// [testing.TB.Cleanup]. +func Register[C params.ChainConfigHooks, R params.RulesHooks](tb testing.TB, extras params.Extras[C, R]) params.ExtraPayloads[C, R] { + tb.Helper() + params.TestOnlyClearRegisteredExtras() + tb.Cleanup(params.TestOnlyClearRegisteredExtras) + return params.RegisterExtras(extras) +} + +// A Stub is a test double for [params.ChainConfigHooks] and +// [params.RulesHooks]. Each of the fields, if non-nil, back their respective +// hook methods, which otherwise fall back to the default behaviour. +type Stub struct { + CheckConfigForkOrderFn func() error + CheckConfigCompatibleFn func(*params.ChainConfig, *big.Int, uint64) *params.ConfigCompatError + DescriptionSuffix string + PrecompileOverrides map[common.Address]libevm.PrecompiledContract + ActivePrecompilesFn func([]common.Address) []common.Address + CanExecuteTransactionFn func(common.Address, *common.Address, libevm.StateReader) error + CanCreateContractFn func(*libevm.AddressContext, uint64, libevm.StateReader) (uint64, error) +} + +// Register is a convenience wrapper for registering s as both the +// [params.ChainConfigHooks] and [params.RulesHooks] via [Register]. +func (s *Stub) Register(tb testing.TB) params.ExtraPayloads[*Stub, *Stub] { + tb.Helper() + return Register(tb, params.Extras[*Stub, *Stub]{ + NewRules: func(_ *params.ChainConfig, _ *params.Rules, _ *Stub, blockNum *big.Int, isMerge bool, timestamp uint64) *Stub { + return s + }, + }) +} + +// PrecompileOverride uses the s.PrecompileOverrides map, if non-empty, as the +// canonical source of all overrides. If the map is empty then no precompiles +// are overridden. +func (s Stub) PrecompileOverride(a common.Address) (libevm.PrecompiledContract, bool) { + if len(s.PrecompileOverrides) == 0 { + return nil, false + } + p, ok := s.PrecompileOverrides[a] + return p, ok +} + +// ActivePrecompiles proxies arguments to the s.ActivePrecompilesFn function if +// non-nil, otherwise it acts as a noop. +func (s Stub) ActivePrecompiles(active []common.Address) []common.Address { + if f := s.ActivePrecompilesFn; f != nil { + return f(active) + } + return active +} + +// CheckConfigForkOrder proxies arguments to the s.CheckConfigForkOrderFn +// function if non-nil, otherwise it acts as a noop. +func (s Stub) CheckConfigForkOrder() error { + if f := s.CheckConfigForkOrderFn; f != nil { + return f() + } + return nil +} + +// CheckConfigCompatible proxies arguments to the s.CheckConfigCompatibleFn +// function if non-nil, otherwise it acts as a noop. +func (s Stub) CheckConfigCompatible(newcfg *params.ChainConfig, headNumber *big.Int, headTimestamp uint64) *params.ConfigCompatError { + if f := s.CheckConfigCompatibleFn; f != nil { + return f(newcfg, headNumber, headTimestamp) + } + return nil +} + +// Description returns s.DescriptionSuffix. +func (s Stub) Description() string { + return s.DescriptionSuffix +} + +// CanExecuteTransaction proxies arguments to the s.CanExecuteTransactionFn +// function if non-nil, otherwise it acts as a noop. +func (s Stub) CanExecuteTransaction(from common.Address, to *common.Address, sr libevm.StateReader) error { + if f := s.CanExecuteTransactionFn; f != nil { + return f(from, to, sr) + } + return nil +} + +// CanCreateContract proxies arguments to the s.CanCreateContractFn function if +// non-nil, otherwise it acts as a noop. +func (s Stub) CanCreateContract(cc *libevm.AddressContext, gas uint64, sr libevm.StateReader) (uint64, error) { + if f := s.CanCreateContractFn; f != nil { + return f(cc, gas, sr) + } + return gas, nil +} + +var _ interface { + params.ChainConfigHooks + params.RulesHooks +} = Stub{} diff --git a/libevm/interfaces_test.go b/libevm/interfaces_test.go new file mode 100644 index 00000000000..e9127c389ab --- /dev/null +++ b/libevm/interfaces_test.go @@ -0,0 +1,35 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package libevm_test + +import ( + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/libevm" +) + +// IMPORTANT: if any of these break then the libevm copy MUST be updated. + +// These two interfaces MUST be identical. +var ( + // Each assignment demonstrates that the methods of the LHS interface are a + // (non-strict) subset of the RHS interface's; both being possible + // proves that they are identical. + _ vm.PrecompiledContract = (libevm.PrecompiledContract)(nil) + _ libevm.PrecompiledContract = (vm.PrecompiledContract)(nil) +) + +// StateReader MUST be a subset vm.StateDB. +var _ libevm.StateReader = (vm.StateDB)(nil) diff --git a/libevm/libevm.go b/libevm/libevm.go new file mode 100644 index 00000000000..cb2d1c46eb5 --- /dev/null +++ b/libevm/libevm.go @@ -0,0 +1,68 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package libevm + +import ( + "github.com/holiman/uint256" + + "github.com/ava-labs/libevm/common" +) + +// PrecompiledContract is an exact copy of vm.PrecompiledContract, mirrored here +// for instances where importing that package would result in a circular +// dependency. +type PrecompiledContract interface { + RequiredGas(input []byte) uint64 + Run(input []byte) ([]byte, error) +} + +// StateReader is a subset of vm.StateDB, exposing only methods that read from +// but do not modify state. See method comments in vm.StateDB, which aren't +// copied here as they risk becoming outdated. +type StateReader interface { + GetBalance(common.Address) *uint256.Int + GetNonce(common.Address) uint64 + + GetCodeHash(common.Address) common.Hash + GetCode(common.Address) []byte + GetCodeSize(common.Address) int + + GetRefund() uint64 + + GetCommittedState(common.Address, common.Hash) common.Hash + GetState(common.Address, common.Hash) common.Hash + + GetTransientState(addr common.Address, key common.Hash) common.Hash + + HasSelfDestructed(common.Address) bool + + Exist(common.Address) bool + Empty(common.Address) bool + + AddressInAccessList(addr common.Address) bool + SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool) +} + +// AddressContext carries addresses available to contexts such as calls and +// contract creation. +// +// With respect to contract creation, the Self address MAY be the predicted +// address of the contract about to be deployed, which may not exist yet. +type AddressContext struct { + Origin common.Address // equivalent to vm.ORIGIN op code + Caller common.Address // equivalent to vm.CALLER op code + Self common.Address // equivalent to vm.ADDRESS op code +} diff --git a/libevm/pseudo/constructor.go b/libevm/pseudo/constructor.go new file mode 100644 index 00000000000..d72237494de --- /dev/null +++ b/libevm/pseudo/constructor.go @@ -0,0 +1,40 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package pseudo + +// A Constructor returns newly constructed [Type] instances for a pre-registered +// concrete type. +type Constructor interface { + Zero() *Type + NewPointer() *Type + NilPointer() *Type +} + +// NewConstructor returns a [Constructor] that builds `T` [Type] instances. +func NewConstructor[T any]() Constructor { + return ctor[T]{} +} + +type ctor[T any] struct{} + +func (ctor[T]) Zero() *Type { return Zero[T]().Type } +func (ctor[T]) NilPointer() *Type { return Zero[*T]().Type } + +func (ctor[T]) NewPointer() *Type { + var x T + return From(&x).Type +} diff --git a/libevm/pseudo/constructor_test.go b/libevm/pseudo/constructor_test.go new file mode 100644 index 00000000000..4dc3b19aef6 --- /dev/null +++ b/libevm/pseudo/constructor_test.go @@ -0,0 +1,61 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package pseudo + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConstructor(t *testing.T) { + testConstructor[uint](t) + testConstructor[string](t) + testConstructor[struct{ x string }](t) +} + +//nolint:thelper // This is the test itself so we want local line numbers reported. +func testConstructor[T any](t *testing.T) { + var zero T + t.Run(fmt.Sprintf("%T", zero), func(t *testing.T) { + ctor := NewConstructor[T]() + + t.Run("NilPointer()", func(t *testing.T) { + got := get[*T](t, ctor.NilPointer()) + assert.Nil(t, got) + }) + + t.Run("NewPointer()", func(t *testing.T) { + got := get[*T](t, ctor.NewPointer()) + require.NotNil(t, got) + assert.Equal(t, zero, *got) + }) + + t.Run("Zero()", func(t *testing.T) { + got := get[T](t, ctor.Zero()) + assert.Equal(t, zero, got) + }) + }) +} + +func get[T any](t *testing.T, typ *Type) (x T) { + t.Helper() + val, err := NewValue[T](typ) + require.NoError(t, err, "NewValue[%T]()", x) + return val.Get() +} diff --git a/libevm/pseudo/fmt.go b/libevm/pseudo/fmt.go new file mode 100644 index 00000000000..e10234e6783 --- /dev/null +++ b/libevm/pseudo/fmt.go @@ -0,0 +1,56 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package pseudo + +import ( + "fmt" +) + +var _ = []fmt.Formatter{ + (*Type)(nil), + (*Value[struct{}])(nil), + (*concrete[struct{}])(nil), +} + +// Format implements the [fmt.Formatter] interface. +func (t *Type) Format(s fmt.State, verb rune) { + switch { + case t == nil, t.val == nil: + writeToFmtState(s, "[pseudo.Type[unknown]]") + default: + t.val.Format(s, verb) + } +} + +// Format implements the [fmt.Formatter] interface. +func (v *Value[T]) Format(s fmt.State, verb rune) { v.t.Format(s, verb) } + +func (c *concrete[T]) Format(s fmt.State, verb rune) { + switch { + case c == nil: + writeToFmtState(s, "[pseudo.Type[%T]]", concrete[T]{}.val) + default: + // Respects the original formatting directive. fmt all the way down! + format := fmt.Sprintf("pseudo.Type[%%T]{%s}", fmt.FormatString(s, verb)) + writeToFmtState(s, format, c.val, c.val) + } +} + +func writeToFmtState(s fmt.State, format string, a ...any) { + // There is no way to bubble errors out from a `fmt.Formatter`. + _, _ = s.Write([]byte(fmt.Sprintf(format, a...))) +} diff --git a/libevm/pseudo/fmt_test.go b/libevm/pseudo/fmt_test.go new file mode 100644 index 00000000000..e29ecab0565 --- /dev/null +++ b/libevm/pseudo/fmt_test.go @@ -0,0 +1,82 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package pseudo + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestFormat(t *testing.T) { + tests := []struct { + name string + from any + format string + wantContains []string + }{ + { + name: "width", + from: 42, + format: "%04d", + wantContains: []string{"int", "0042"}, + }, + { + name: "precision", + from: float64(2), + format: "%.5f", + wantContains: []string{"float64", "2.00000"}, + }, + { + name: "flag", + from: 42, + format: "%+d", + wantContains: []string{"int", "+42"}, + }, + { + name: "verb", + from: 42, + format: "%x", + wantContains: []string{"int", "2a"}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := fmt.Sprintf(tt.format, fromAny(t, tt.from)) + for _, want := range tt.wantContains { + assert.Containsf(t, got, want, "fmt.Sprintf(%q, From(%T[%[2]v]))", tt.format, tt.from) + } + }) + } +} + +func fromAny(t *testing.T, x any) *Type { + t.Helper() + + // Without this, the function will be From[any](). + switch x := x.(type) { + case int: + return From(x).Type + case float64: + return From(x).Type + default: + t.Fatalf("Bad test setup: add type case for %T", x) + return nil + } +} diff --git a/libevm/pseudo/reflect.go b/libevm/pseudo/reflect.go new file mode 100644 index 00000000000..1d8a64b89c2 --- /dev/null +++ b/libevm/pseudo/reflect.go @@ -0,0 +1,60 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package pseudo + +import ( + "reflect" + + "github.com/ava-labs/libevm/rlp" +) + +// Reflection is used as a last resort in pseudo types so is limited to this +// file to avoid being seen as the norm. If you are adding to this file, please +// try to achieve the same results with type parameters. + +func (c *concrete[T]) isZero() bool { + // The alternative would require that T be comparable, which would bubble up + // and invade the rest of the code base. + return reflect.ValueOf(c.val).IsZero() +} + +func (c *concrete[T]) equal(t *Type) bool { + d, ok := t.val.(*concrete[T]) + if !ok { + return false + } + switch v := any(c.val).(type) { + case EqualityChecker[T]: + return v.Equal(d.val) + default: + // See rationale for reflection in [concrete.isZero]. + return reflect.DeepEqual(c.val, d.val) + } +} + +func (c *concrete[T]) DecodeRLP(s *rlp.Stream) error { + switch v := reflect.ValueOf(c.val); v.Kind() { + case reflect.Pointer: + if v.IsNil() { + el := v.Type().Elem() + c.val = reflect.New(el).Interface().(T) //nolint:forcetypeassert // Invariant scoped to the last few lines of code so simple to verify + } + return s.Decode(c.val) + default: + return s.Decode(&c.val) + } +} diff --git a/libevm/pseudo/rlp_test.go b/libevm/pseudo/rlp_test.go new file mode 100644 index 00000000000..91bfafec0f8 --- /dev/null +++ b/libevm/pseudo/rlp_test.go @@ -0,0 +1,86 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package pseudo_test + +import ( + "math/big" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/libevm/ethtest" + "github.com/ava-labs/libevm/libevm/pseudo" + "github.com/ava-labs/libevm/rlp" +) + +func TestRLPEquivalence(t *testing.T) { + t.Parallel() + + for seed := uint64(0); seed < 20; seed++ { + seed := seed + + t.Run("fuzz pointer-type round trip", func(t *testing.T) { + t.Parallel() + rng := ethtest.NewPseudoRand(seed) + + hdr := &types.Header{ + ParentHash: rng.Hash(), + UncleHash: rng.Hash(), + Coinbase: rng.Address(), + Root: rng.Hash(), + TxHash: rng.Hash(), + ReceiptHash: rng.Hash(), + Difficulty: big.NewInt(rng.Int63()), + Number: big.NewInt(rng.Int63()), + GasLimit: rng.Uint64(), + GasUsed: rng.Uint64(), + Time: rng.Uint64(), + Extra: rng.Bytes(uint(rng.Uint64n(128))), + MixDigest: rng.Hash(), + } + rng.Read(hdr.Bloom[:]) + rng.Read(hdr.Nonce[:]) + + want, err := rlp.EncodeToBytes(hdr) + require.NoErrorf(t, err, "rlp.EncodeToBytes(%T)", hdr) + + typ := pseudo.From(hdr).Type + gotRLP, err := rlp.EncodeToBytes(typ) + require.NoErrorf(t, err, "rlp.EncodeToBytes(%T)", typ) + + require.Equalf(t, want, gotRLP, "RLP encoding of %T (canonical) vs %T (under test)", hdr, typ) + + t.Run("decode", func(t *testing.T) { + pseudo := pseudo.Zero[*types.Header]() + require.NoErrorf(t, rlp.DecodeBytes(gotRLP, pseudo.Type), "rlp.DecodeBytes(..., %T[%T])", pseudo.Type, hdr) + require.Equal(t, hdr, pseudo.Value.Get(), "RLP-decoded value") + }) + }) + + t.Run("fuzz non-pointer decode", func(t *testing.T) { + rng := ethtest.NewPseudoRand(seed) + x := rng.Uint64() + buf, err := rlp.EncodeToBytes(x) + require.NoErrorf(t, err, "rlp.EncodeToBytes(%T)", x) + + pseudo := pseudo.Zero[uint64]() + require.NoErrorf(t, rlp.DecodeBytes(buf, pseudo.Type), "rlp.DecodeBytes(..., %T[%T])", pseudo.Type, x) + require.Equal(t, x, pseudo.Value.Get(), "RLP-decoded value") + }) + } +} diff --git a/libevm/pseudo/type.go b/libevm/pseudo/type.go new file mode 100644 index 00000000000..ff7572f6c20 --- /dev/null +++ b/libevm/pseudo/type.go @@ -0,0 +1,251 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +// Package pseudo provides a bridge between generic and non-generic code via +// pseudo-types and pseudo-values. With careful usage, there is minimal +// reduction in type safety. +// +// Adding generic type parameters to anything (e.g. struct, function, etc) +// "pollutes" all code that uses the generic type. Refactoring all uses isn't +// always feasible, and a [Type] acts as an intermediate fix. Although their +// constructors are generic, they are not, and they are instead coupled with a +// generic [Value] that SHOULD be used for access. +// +// Packages typically SHOULD NOT expose a [Type] and SHOULD instead provide +// users with a type-safe [Value]. +package pseudo + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/ava-labs/libevm/rlp" +) + +// A Type wraps a strongly-typed value without exposing information about its +// type. It can be used in lieu of a generic field / parameter. +type Type struct { + val value +} + +// A Value provides strongly-typed access to the payload carried by a [Type]. +type Value[T any] struct { + t *Type +} + +// A Pseudo type couples a [Type] and a [Value]. If returned by a constructor +// from this package, both wrap the same payload. +type Pseudo[T any] struct { + Type *Type + Value *Value[T] +} + +// TypeAndValue is a convenience function for splitting the contents of `p`, +// typically at construction. +func (p *Pseudo[T]) TypeAndValue() (*Type, *Value[T]) { + return p.Type, p.Value +} + +// From returns a Pseudo[T] constructed from `v`. +func From[T any](v T) *Pseudo[T] { + t := &Type{ + val: &concrete[T]{ + val: v, + }, + } + return &Pseudo[T]{t, MustNewValue[T](t)} +} + +// Zero is equivalent to [From] called with the [zero value] of type `T`. Note +// that pointers, slices, maps, etc. will therefore be nil. +// +// [zero value]: https://go.dev/tour/basics/12 +func Zero[T any]() *Pseudo[T] { + var x T + return From[T](x) +} + +// PointerTo is equivalent to [From] called with a pointer to the payload +// carried by `t`. It first confirms that the payload is of type `T`. +func PointerTo[T any](t *Type) (*Pseudo[*T], error) { + c, ok := t.val.(*concrete[T]) + if !ok { + var want *T + return nil, fmt.Errorf("cannot create *Pseudo[%T] from *Type carrying %T", want, t.val.get()) + } + return From(&c.val), nil +} + +// MustPointerTo is equivalent to [PointerTo] except that it panics instead of +// returning an error. +func MustPointerTo[T any](t *Type) *Pseudo[*T] { + p, err := PointerTo[T](t) + if err != nil { + panic(err) + } + return p +} + +// Interface returns the wrapped value as an `any`, equivalent to +// [reflect.Value.Interface]. Prefer [Value.Get]. +func (t *Type) Interface() any { return t.val.get() } + +// NewValue constructs a [Value] from a [Type], first confirming that `t` wraps +// a payload of type `T`. +func NewValue[T any](t *Type) (*Value[T], error) { + var x T + if !t.val.canSetTo(x) { + return nil, fmt.Errorf("cannot create *Value[%T] with *Type carrying %T", x, t.val.get()) + } + return &Value[T]{t}, nil +} + +// MustNewValue is equivalent to [NewValue] except that it panics instead of +// returning an error. +func MustNewValue[T any](t *Type) *Value[T] { + v, err := NewValue[T](t) + if err != nil { + panic(err) + } + return v +} + +// IsZero reports whether t carries the the zero value for its type. +func (t *Type) IsZero() bool { return t.val.isZero() } + +// An EqualityChecker reports if it is equal to another value of the same type. +type EqualityChecker[T any] interface { + Equal(T) bool +} + +// Equal reports whether t carries a value equal to that carried by u. If t and +// u carry different types then Equal returns false. If t and u carry the same +// type and said type implements [EqualityChecker] then Equal propagates the +// value returned by the checker. In all other cases, Equal returns +// [reflect.DeepEqual] performed on the payloads carried by t and u. +func (t *Type) Equal(u *Type) bool { return t.val.equal(u) } + +// Get returns the value. +func (v *Value[T]) Get() T { return v.t.val.get().(T) } //nolint:forcetypeassert // invariant + +// Set sets the value. +func (v *Value[T]) Set(val T) { v.t.val.mustSet(val) } + +// MarshalJSON implements the [json.Marshaler] interface. +func (t *Type) MarshalJSON() ([]byte, error) { return t.val.MarshalJSON() } + +// UnmarshalJSON implements the [json.Unmarshaler] interface. +func (t *Type) UnmarshalJSON(b []byte) error { return t.val.UnmarshalJSON(b) } + +// MarshalJSON implements the [json.Marshaler] interface. +func (v *Value[T]) MarshalJSON() ([]byte, error) { return v.t.MarshalJSON() } + +// UnmarshalJSON implements the [json.Unmarshaler] interface. +func (v *Value[T]) UnmarshalJSON(b []byte) error { return v.t.UnmarshalJSON(b) } + +// EncodeRLP implements the [rlp.Encoder] interface. +func (t *Type) EncodeRLP(w io.Writer) error { return t.val.EncodeRLP(w) } + +// DecodeRLP implements the [rlp.Decoder] interface. +func (t *Type) DecodeRLP(s *rlp.Stream) error { return t.val.DecodeRLP(s) } + +var _ = []interface { + json.Marshaler + json.Unmarshaler +}{ + (*Type)(nil), + (*Value[struct{}])(nil), + (*concrete[struct{}])(nil), +} + +var _ = []interface { + rlp.Encoder + rlp.Decoder +}{ + (*Type)(nil), + (*concrete[struct{}])(nil), +} + +// A value is a non-generic wrapper around a [concrete] struct. +type value interface { + get() any + isZero() bool + equal(*Type) bool + canSetTo(any) bool + set(any) error + mustSet(any) + + json.Marshaler + json.Unmarshaler + rlp.Encoder + rlp.Decoder + fmt.Formatter +} + +type concrete[T any] struct { + val T +} + +func (c *concrete[T]) get() any { return c.val } + +func (c *concrete[T]) canSetTo(v any) bool { + _, ok := v.(T) + return ok +} + +// An invalidTypeError is returned by [conrete.set] if the value is incompatible +// with its type. This should never leave this package and exists only to +// provide precise testing of unhappy paths. +type invalidTypeError[T any] struct { + SetTo any +} + +func (e *invalidTypeError[T]) Error() string { + var t T + return fmt.Sprintf("cannot set %T to %T", t, e.SetTo) +} + +func (c *concrete[T]) set(v any) error { + vv, ok := v.(T) + if !ok { + // Other invariants in this implementation (aim to) guarantee that this + // will never happen. + return &invalidTypeError[T]{SetTo: v} + } + c.val = vv + return nil +} + +func (c *concrete[T]) mustSet(v any) { + if err := c.set(v); err != nil { + panic(err) + } + _ = 0 // for happy-path coverage inspection +} + +func (c *concrete[T]) MarshalJSON() ([]byte, error) { return json.Marshal(c.val) } + +func (c *concrete[T]) UnmarshalJSON(b []byte) error { + var v T + if err := json.Unmarshal(b, &v); err != nil { + return err + } + c.val = v + return nil +} + +func (c *concrete[T]) EncodeRLP(w io.Writer) error { return rlp.Encode(w, c.val) } diff --git a/libevm/pseudo/type_test.go b/libevm/pseudo/type_test.go new file mode 100644 index 00000000000..2413ae421ed --- /dev/null +++ b/libevm/pseudo/type_test.go @@ -0,0 +1,174 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package pseudo + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestType(t *testing.T) { + testType(t, "Zero[int]", Zero[int], 0, 42, "I'm not an int") + testType(t, "Zero[string]", Zero[string], "", "hello, world", 99) + + testType( + t, "From[uint](314159)", + func() *Pseudo[uint] { + return From[uint](314159) + }, + 314159, 0, struct{}{}, + ) + + testType(t, "nil pointer", Zero[*float64], (*float64)(nil), new(float64), 0) +} + +//nolint:thelper // This is the test itself so we want local line numbers reported. +func testType[T any](t *testing.T, name string, ctor func() *Pseudo[T], init T, setTo T, invalid any) { + t.Run(name, func(t *testing.T) { + typ, val := ctor().TypeAndValue() + assert.Equal(t, init, val.Get()) + val.Set(setTo) + assert.Equal(t, setTo, val.Get()) + + t.Run("set to invalid type", func(t *testing.T) { + wantErr := &invalidTypeError[T]{SetTo: invalid} + + assertError := func(t *testing.T, err any) { + t.Helper() + switch err := err.(type) { + case *invalidTypeError[T]: + assert.Equal(t, wantErr, err) + default: + t.Errorf("got error %v; want %v", err, wantErr) + } + } + + t.Run(fmt.Sprintf("Set(%T{%v})", invalid, invalid), func(t *testing.T) { + assertError(t, typ.val.set(invalid)) + }) + + t.Run(fmt.Sprintf("MustSet(%T{%v})", invalid, invalid), func(t *testing.T) { + defer func() { + assertError(t, recover()) + }() + typ.val.mustSet(invalid) + }) + }) + + t.Run("JSON round trip", func(t *testing.T) { + buf, err := json.Marshal(typ) + require.NoError(t, err) + + got, gotVal := Zero[T]().TypeAndValue() + require.NoError(t, json.Unmarshal(buf, &got)) + assert.Equal(t, val.Get(), gotVal.Get()) + }) + }) +} + +//nolint:ineffassign,testableexamples // Although `typ` is overwritten it's to demonstrate different approaches +func ExamplePseudo_TypeAndValue() { + typ, val := From("hello").TypeAndValue() + + // But, if only one is needed: + typ = From("world").Type + val = From("this isn't coupled to the Type").Value + + _ = typ + _ = val +} + +func TestPointer(t *testing.T) { + type carrier struct { + payload int + } + + typ, val := From(carrier{42}).TypeAndValue() + + t.Run("invalid type", func(t *testing.T) { + _, err := PointerTo[int](typ) + require.Errorf(t, err, "PointerTo[int](%T)", carrier{}) + }) + + t.Run("valid type", func(t *testing.T) { + ptrVal := MustPointerTo[carrier](typ).Value + + assert.Equal(t, 42, val.Get().payload, "before setting via pointer") + var ptr *carrier = ptrVal.Get() + ptr.payload = 314159 + assert.Equal(t, 314159, val.Get().payload, "after setting via pointer") + }) +} + +func TestIsZero(t *testing.T) { + tests := []struct { + typ *Type + want bool + }{ + {From(0).Type, true}, + {From(1).Type, false}, + {From("").Type, true}, + {From("x").Type, false}, + {From((*testing.T)(nil)).Type, true}, + {From(t).Type, false}, + {From(false).Type, true}, + {From(true).Type, false}, + } + + for _, tt := range tests { + assert.Equalf(t, tt.want, tt.typ.IsZero(), "%T(%[1]v) IsZero()", tt.typ.Interface()) + } +} + +type isEqualStub struct { + isEqual bool +} + +var _ EqualityChecker[isEqualStub] = (*isEqualStub)(nil) + +func (s isEqualStub) Equal(isEqualStub) bool { + return s.isEqual +} + +func TestEqual(t *testing.T) { + isEqual := isEqualStub{true} + notEqual := isEqualStub{false} + + tests := []struct { + a, b *Type + want bool + }{ + {From(42).Type, From(42).Type, true}, + {From(99).Type, From("").Type, false}, + {From(false).Type, From("").Type, false}, // sorry JavaScript, you're wrong + {From(isEqual).Type, From(isEqual).Type, true}, + {From(notEqual).Type, From(notEqual).Type, false}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + t.Logf("a = %+v", tt.a) + t.Logf("b = %+v", tt.b) + assert.Equal(t, tt.want, tt.a.Equal(tt.b), "a.Equals(b)") + assert.Equal(t, tt.want, tt.b.Equal(tt.a), "b.Equals(a)") + }) + } +} diff --git a/libevm/testonly/testonly.go b/libevm/testonly/testonly.go new file mode 100644 index 00000000000..74a9a81d6f3 --- /dev/null +++ b/libevm/testonly/testonly.go @@ -0,0 +1,40 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +// Package testonly enforces functionality that MUST be limited to tests. +package testonly + +import ( + "runtime" + "strings" +) + +// OrPanic runs `fn` i.f.f. called from within a testing environment. +func OrPanic(fn func()) { + pc := make([]uintptr, 64) + runtime.Callers(0, pc) + frames := runtime.CallersFrames(pc) + for { + f, more := frames.Next() + if strings.Contains(f.File, "/testing/") || strings.HasSuffix(f.File, "_test.go") { + fn() + return + } + if !more { + panic("no _test.go file in call stack") + } + } +} diff --git a/metrics/cpu_enabled.go b/metrics/cpu_enabled.go index 2359028a212..7f2bb61c4f0 100644 --- a/metrics/cpu_enabled.go +++ b/metrics/cpu_enabled.go @@ -20,7 +20,7 @@ package metrics import ( - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" "github.com/shirou/gopsutil/cpu" ) diff --git a/metrics/cputime_unix.go b/metrics/cputime_unix.go index ad4f812fd28..afffe0a2ae7 100644 --- a/metrics/cputime_unix.go +++ b/metrics/cputime_unix.go @@ -22,7 +22,7 @@ package metrics import ( syscall "golang.org/x/sys/unix" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) // getProcessCPUTime retrieves the process' CPU time since program startup. diff --git a/metrics/exp/exp.go b/metrics/exp/exp.go index 7e3f82a075f..a13a904dcf9 100644 --- a/metrics/exp/exp.go +++ b/metrics/exp/exp.go @@ -8,9 +8,9 @@ import ( "net/http" "sync" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/metrics/prometheus" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/metrics/prometheus" ) type exp struct { diff --git a/metrics/influxdb/influxdb.go b/metrics/influxdb/influxdb.go index bbc4fc024b3..fce61327473 100644 --- a/metrics/influxdb/influxdb.go +++ b/metrics/influxdb/influxdb.go @@ -3,7 +3,7 @@ package influxdb import ( "fmt" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) func readMeter(namespace, name string, i interface{}) (string, map[string]interface{}) { diff --git a/metrics/influxdb/influxdb_test.go b/metrics/influxdb/influxdb_test.go index c6f2eeac627..2d2862abc7c 100644 --- a/metrics/influxdb/influxdb_test.go +++ b/metrics/influxdb/influxdb_test.go @@ -26,8 +26,8 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/metrics/internal" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/metrics/internal" influxdb2 "github.com/influxdata/influxdb-client-go/v2" ) diff --git a/metrics/influxdb/influxdbv1.go b/metrics/influxdb/influxdbv1.go index ac58280803b..ddc27301bbd 100644 --- a/metrics/influxdb/influxdbv1.go +++ b/metrics/influxdb/influxdbv1.go @@ -5,8 +5,8 @@ import ( uurl "net/url" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" client "github.com/influxdata/influxdb1-client/v2" ) diff --git a/metrics/influxdb/influxdbv2.go b/metrics/influxdb/influxdbv2.go index 114d57ae076..25e44465ba0 100644 --- a/metrics/influxdb/influxdbv2.go +++ b/metrics/influxdb/influxdbv2.go @@ -4,8 +4,8 @@ import ( "context" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" influxdb2 "github.com/influxdata/influxdb-client-go/v2" "github.com/influxdata/influxdb-client-go/v2/api" ) diff --git a/metrics/internal/sampledata.go b/metrics/internal/sampledata.go index de9b207b6d4..d3d9bed16b0 100644 --- a/metrics/internal/sampledata.go +++ b/metrics/internal/sampledata.go @@ -22,7 +22,7 @@ import ( metrics2 "runtime/metrics" "time" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) // ExampleMetrics returns an ordered registry populated with a sample of metrics. diff --git a/metrics/internal/sampledata_test.go b/metrics/internal/sampledata_test.go index 00132994064..70ba435d4de 100644 --- a/metrics/internal/sampledata_test.go +++ b/metrics/internal/sampledata_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) func TestCollectRuntimeMetrics(t *testing.T) { diff --git a/metrics/librato/librato.go b/metrics/librato/librato.go index a86f7586378..9a1afb03579 100644 --- a/metrics/librato/librato.go +++ b/metrics/librato/librato.go @@ -7,7 +7,7 @@ import ( "regexp" "time" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) // a regexp for extracting the unit from time.Duration.String diff --git a/metrics/metrics.go b/metrics/metrics.go index 9ca8f115c0f..fc9f8ca883b 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -14,7 +14,7 @@ import ( "syscall" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) // Enabled is checked by the constructor functions for all of the diff --git a/metrics/prometheus/collector.go b/metrics/prometheus/collector.go index 25b258d56ab..fb8ad8ab217 100644 --- a/metrics/prometheus/collector.go +++ b/metrics/prometheus/collector.go @@ -23,7 +23,7 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) var ( diff --git a/metrics/prometheus/collector_test.go b/metrics/prometheus/collector_test.go index ea17aac4585..0b44961e786 100644 --- a/metrics/prometheus/collector_test.go +++ b/metrics/prometheus/collector_test.go @@ -22,8 +22,8 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/metrics/internal" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/metrics/internal" ) func TestMain(m *testing.M) { diff --git a/metrics/prometheus/prometheus.go b/metrics/prometheus/prometheus.go index dbdeae6c7f7..8600176ccb7 100644 --- a/metrics/prometheus/prometheus.go +++ b/metrics/prometheus/prometheus.go @@ -22,8 +22,8 @@ import ( "net/http" "sort" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" ) // Handler returns an HTTP handler which dump metrics in Prometheus format. diff --git a/miner/miner.go b/miner/miner.go index 58bb71b557b..0ad80a58c44 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -23,17 +23,17 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" ) // Backend wraps all methods required for mining. Only full node is capable diff --git a/miner/miner_test.go b/miner/miner_test.go index 5907fb44646..1f8f0640fdc 100644 --- a/miner/miner_test.go +++ b/miner/miner_test.go @@ -23,21 +23,21 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/clique" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/txpool/legacypool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/clique" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/txpool/legacypool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" ) type mockBackend struct { diff --git a/miner/ordering.go b/miner/ordering.go index bcf7af46e89..d55b232d851 100644 --- a/miner/ordering.go +++ b/miner/ordering.go @@ -20,9 +20,9 @@ import ( "container/heap" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" "github.com/holiman/uint256" ) diff --git a/miner/ordering_test.go b/miner/ordering_test.go index 3587a835c88..934e2134aff 100644 --- a/miner/ordering_test.go +++ b/miner/ordering_test.go @@ -23,10 +23,10 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" "github.com/holiman/uint256" ) diff --git a/miner/payload_building.go b/miner/payload_building.go index 719736c4795..3fd736b99ba 100644 --- a/miner/payload_building.go +++ b/miner/payload_building.go @@ -23,12 +23,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/beacon/engine" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/beacon/engine" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) // BuildPayloadArgs contains the provided parameters for building payload. diff --git a/miner/payload_building_test.go b/miner/payload_building_test.go index 708072b5ecf..8313340690b 100644 --- a/miner/payload_building_test.go +++ b/miner/payload_building_test.go @@ -21,12 +21,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/beacon/engine" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/beacon/engine" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) func TestBuildPayload(t *testing.T) { diff --git a/miner/stress/clique/main.go b/miner/stress/clique/main.go index 60593938458..e539de407d2 100644 --- a/miner/stress/clique/main.go +++ b/miner/stress/clique/main.go @@ -26,22 +26,22 @@ import ( "os/signal" "time" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/fdlimit" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/txpool/legacypool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/fdlimit" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/txpool/legacypool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/eth" + "github.com/ava-labs/libevm/eth/downloader" + "github.com/ava-labs/libevm/eth/ethconfig" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/miner" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/params" ) func main() { diff --git a/miner/worker.go b/miner/worker.go index 9a36106231e..8639be72947 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -24,19 +24,19 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/misc/eip1559" - "github.com/ethereum/go-ethereum/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/misc/eip1559" + "github.com/ava-labs/libevm/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie" "github.com/holiman/uint256" ) diff --git a/miner/worker_test.go b/miner/worker_test.go index 9dba12ae51a..7a7b3de964b 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -22,21 +22,21 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" - "github.com/ethereum/go-ethereum/consensus/clique" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/txpool" - "github.com/ethereum/go-ethereum/core/txpool/legacypool" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/consensus" + "github.com/ava-labs/libevm/consensus/clique" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/txpool" + "github.com/ava-labs/libevm/core/txpool/legacypool" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/params" "github.com/holiman/uint256" ) diff --git a/node/api.go b/node/api.go index f81f394beb2..7bf3640d6a2 100644 --- a/node/api.go +++ b/node/api.go @@ -21,13 +21,13 @@ import ( "fmt" "strings" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/debug" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/debug" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/rpc" ) // apis returns the collection of built-in RPC APIs. diff --git a/node/api_test.go b/node/api_test.go index 8761c4883ef..d5ecb81594f 100644 --- a/node/api_test.go +++ b/node/api_test.go @@ -25,7 +25,7 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/rpc" "github.com/stretchr/testify/assert" ) diff --git a/node/config.go b/node/config.go index 949db887e4e..903ad37da58 100644 --- a/node/config.go +++ b/node/config.go @@ -25,11 +25,11 @@ import ( "runtime" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/rpc" ) const ( diff --git a/node/config_test.go b/node/config_test.go index e8af8ddcd87..fd1211b63ad 100644 --- a/node/config_test.go +++ b/node/config_test.go @@ -23,8 +23,8 @@ import ( "runtime" "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p" ) // Tests that datadirs can be successfully created, be them manually configured diff --git a/node/defaults.go b/node/defaults.go index 307d9e186a2..b944d0d45ed 100644 --- a/node/defaults.go +++ b/node/defaults.go @@ -22,9 +22,9 @@ import ( "path/filepath" "runtime" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/nat" + "github.com/ava-labs/libevm/rpc" ) const ( diff --git a/node/endpoints.go b/node/endpoints.go index 14c12fd1f17..d7fb5266ac3 100644 --- a/node/endpoints.go +++ b/node/endpoints.go @@ -21,8 +21,8 @@ import ( "net/http" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rpc" ) // StartHTTPEndpoint starts the HTTP RPC endpoint. diff --git a/node/jwt_auth.go b/node/jwt_auth.go index d4f8193ca7f..14624863b88 100644 --- a/node/jwt_auth.go +++ b/node/jwt_auth.go @@ -21,7 +21,7 @@ import ( "net/http" "time" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/rpc" "github.com/golang-jwt/jwt/v4" ) diff --git a/node/node.go b/node/node.go index dfa83d58c72..52d683d988a 100644 --- a/node/node.go +++ b/node/node.go @@ -28,15 +28,15 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/rpc" "github.com/gofrs/flock" ) diff --git a/node/node_auth_test.go b/node/node_auth_test.go index 597cd8531f7..18744943cc5 100644 --- a/node/node_auth_test.go +++ b/node/node_auth_test.go @@ -26,8 +26,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/rpc" "github.com/golang-jwt/jwt/v4" ) diff --git a/node/node_example_test.go b/node/node_example_test.go index e45ee49a25a..f3e711b3be7 100644 --- a/node/node_example_test.go +++ b/node/node_example_test.go @@ -20,7 +20,7 @@ import ( "fmt" "log" - "github.com/ethereum/go-ethereum/node" + "github.com/ava-labs/libevm/node" ) // SampleLifecycle is a trivial network service that can be attached to a node for diff --git a/node/node_test.go b/node/node_test.go index 04810a815bf..d4da000d8e1 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -26,10 +26,10 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/rpc" "github.com/stretchr/testify/assert" ) diff --git a/node/rpcstack.go b/node/rpcstack.go index d80d5271a7f..7804a859fe5 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -30,8 +30,8 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rpc" "github.com/rs/cors" ) diff --git a/node/rpcstack_test.go b/node/rpcstack_test.go index e41cc51ad31..5e217600348 100644 --- a/node/rpcstack_test.go +++ b/node/rpcstack_test.go @@ -28,9 +28,9 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/internal/testlog" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/internal/testlog" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rpc" "github.com/golang-jwt/jwt/v4" "github.com/gorilla/websocket" "github.com/stretchr/testify/assert" diff --git a/node/utils_test.go b/node/utils_test.go index 681f3a8b285..efd80d39c86 100644 --- a/node/utils_test.go +++ b/node/utils_test.go @@ -20,8 +20,8 @@ package node import ( - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/rpc" ) // NoopLifecycle is a trivial implementation of the Service interface. diff --git a/p2p/dial.go b/p2p/dial.go index 5e4ab1d50dc..84ec15891b3 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -27,10 +27,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/netutil" ) const ( diff --git a/p2p/dial_test.go b/p2p/dial_test.go index 13908f11eab..1e618c37df7 100644 --- a/p2p/dial_test.go +++ b/p2p/dial_test.go @@ -27,11 +27,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/internal/testlog" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/internal/testlog" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/netutil" ) // This test checks that dynamic dials are launched from discovery results. diff --git a/p2p/discover/common.go b/p2p/discover/common.go index c9f0477defe..ad4b3594507 100644 --- a/p2p/discover/common.go +++ b/p2p/discover/common.go @@ -21,11 +21,11 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/p2p/netutil" ) // UDPConn is a network connection on which discovery can operate. diff --git a/p2p/discover/lookup.go b/p2p/discover/lookup.go index b8d97b44e1c..5aa3dc324d5 100644 --- a/p2p/discover/lookup.go +++ b/p2p/discover/lookup.go @@ -21,7 +21,7 @@ import ( "errors" "time" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/p2p/enode" ) // lookup performs a network search for nodes close to the given target. It approaches the diff --git a/p2p/discover/metrics.go b/p2p/discover/metrics.go index 56aae24285d..4ef6484c3ce 100644 --- a/p2p/discover/metrics.go +++ b/p2p/discover/metrics.go @@ -20,7 +20,7 @@ import ( "fmt" "net" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) const ( diff --git a/p2p/discover/node.go b/p2p/discover/node.go index 9ffe101ccff..2fb52d6feac 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -24,9 +24,9 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" ) // node represents a host on the network. diff --git a/p2p/discover/ntp.go b/p2p/discover/ntp.go index 3f9157808f1..6039962fdaf 100644 --- a/p2p/discover/ntp.go +++ b/p2p/discover/ntp.go @@ -24,7 +24,7 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" "golang.org/x/exp/slices" ) diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 2b7a28708b8..4141fa81012 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -33,11 +33,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/netutil" ) const ( diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index 3ba34222513..82517a242ea 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -27,10 +27,10 @@ import ( "testing/quick" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/p2p/netutil" ) func TestTable_pingReplace(t *testing.T) { diff --git a/p2p/discover/table_util_test.go b/p2p/discover/table_util_test.go index d6309dfd6c6..b13f1ca61b2 100644 --- a/p2p/discover/table_util_test.go +++ b/p2p/discover/table_util_test.go @@ -26,9 +26,9 @@ import ( "net" "sync" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" "golang.org/x/exp/slices" ) diff --git a/p2p/discover/v4_lookup_test.go b/p2p/discover/v4_lookup_test.go index 8867a5a8ac7..f62e50d6860 100644 --- a/p2p/discover/v4_lookup_test.go +++ b/p2p/discover/v4_lookup_test.go @@ -22,10 +22,10 @@ import ( "net" "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/discover/v4wire" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/discover/v4wire" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" "golang.org/x/exp/slices" ) diff --git a/p2p/discover/v4_udp.go b/p2p/discover/v4_udp.go index 988f16b01df..75b196eceaf 100644 --- a/p2p/discover/v4_udp.go +++ b/p2p/discover/v4_udp.go @@ -29,11 +29,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover/v4wire" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/discover/v4wire" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/netutil" ) // Errors diff --git a/p2p/discover/v4_udp_test.go b/p2p/discover/v4_udp_test.go index 361e3796264..c64776c051a 100644 --- a/p2p/discover/v4_udp_test.go +++ b/p2p/discover/v4_udp_test.go @@ -31,11 +31,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/internal/testlog" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover/v4wire" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/internal/testlog" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/discover/v4wire" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" ) // shared test variables diff --git a/p2p/discover/v4wire/v4wire.go b/p2p/discover/v4wire/v4wire.go index 9c59359fb2c..bee8f08ea2f 100644 --- a/p2p/discover/v4wire/v4wire.go +++ b/p2p/discover/v4wire/v4wire.go @@ -27,11 +27,11 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" ) // RPC packet types diff --git a/p2p/discover/v4wire/v4wire_test.go b/p2p/discover/v4wire/v4wire_test.go index 38820f3b48f..9a8fc43b15b 100644 --- a/p2p/discover/v4wire/v4wire_test.go +++ b/p2p/discover/v4wire/v4wire_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" ) // EIP-8 test vectors. diff --git a/p2p/discover/v5_talk.go b/p2p/discover/v5_talk.go index c1f67879402..d8f4fb16607 100644 --- a/p2p/discover/v5_talk.go +++ b/p2p/discover/v5_talk.go @@ -21,9 +21,9 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover/v5wire" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/discover/v5wire" + "github.com/ava-labs/libevm/p2p/enode" ) // This is a limit for the number of concurrent talk requests. diff --git a/p2p/discover/v5_udp.go b/p2p/discover/v5_udp.go index 8b3e33d37cf..8c29bc83aac 100644 --- a/p2p/discover/v5_udp.go +++ b/p2p/discover/v5_udp.go @@ -28,12 +28,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover/v5wire" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/discover/v5wire" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/p2p/netutil" ) const ( diff --git a/p2p/discover/v5_udp_test.go b/p2p/discover/v5_udp_test.go index eaa969ea8b6..ff23850e319 100644 --- a/p2p/discover/v5_udp_test.go +++ b/p2p/discover/v5_udp_test.go @@ -27,12 +27,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/internal/testlog" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover/v5wire" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/internal/testlog" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/discover/v5wire" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" "github.com/stretchr/testify/require" "golang.org/x/exp/slices" ) diff --git a/p2p/discover/v5wire/crypto.go b/p2p/discover/v5wire/crypto.go index fc0a0edef59..b8ad2816939 100644 --- a/p2p/discover/v5wire/crypto.go +++ b/p2p/discover/v5wire/crypto.go @@ -25,9 +25,9 @@ import ( "fmt" "hash" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" "golang.org/x/crypto/hkdf" ) diff --git a/p2p/discover/v5wire/crypto_test.go b/p2p/discover/v5wire/crypto_test.go index 72169b43141..b5b9f7ddd53 100644 --- a/p2p/discover/v5wire/crypto_test.go +++ b/p2p/discover/v5wire/crypto_test.go @@ -25,9 +25,9 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" ) func TestVector_ECDH(t *testing.T) { diff --git a/p2p/discover/v5wire/encoding.go b/p2p/discover/v5wire/encoding.go index 5108910620e..d87c1c9f154 100644 --- a/p2p/discover/v5wire/encoding.go +++ b/p2p/discover/v5wire/encoding.go @@ -28,10 +28,10 @@ import ( "fmt" "hash" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" ) // TODO concurrent WHOAREYOU tie-breaker diff --git a/p2p/discover/v5wire/encoding_test.go b/p2p/discover/v5wire/encoding_test.go index a5387311a5d..feda18c1ec1 100644 --- a/p2p/discover/v5wire/encoding_test.go +++ b/p2p/discover/v5wire/encoding_test.go @@ -30,10 +30,10 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" ) // To regenerate discv5 test vectors, run diff --git a/p2p/discover/v5wire/msg.go b/p2p/discover/v5wire/msg.go index 401db2f6c58..30a57ef81a3 100644 --- a/p2p/discover/v5wire/msg.go +++ b/p2p/discover/v5wire/msg.go @@ -20,11 +20,11 @@ import ( "fmt" "net" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" ) // Packet is implemented by all message types. diff --git a/p2p/discover/v5wire/session.go b/p2p/discover/v5wire/session.go index 862c21fcee9..e4279e12a32 100644 --- a/p2p/discover/v5wire/session.go +++ b/p2p/discover/v5wire/session.go @@ -22,10 +22,10 @@ import ( "encoding/binary" "time" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" ) const handshakeTimeout = time.Second diff --git a/p2p/dnsdisc/client.go b/p2p/dnsdisc/client.go index 8f1c221b803..197c6865719 100644 --- a/p2p/dnsdisc/client.go +++ b/p2p/dnsdisc/client.go @@ -27,12 +27,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" "golang.org/x/sync/singleflight" "golang.org/x/time/rate" ) diff --git a/p2p/dnsdisc/client_test.go b/p2p/dnsdisc/client_test.go index abc35ddbd3d..70a69034649 100644 --- a/p2p/dnsdisc/client_test.go +++ b/p2p/dnsdisc/client_test.go @@ -25,13 +25,13 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/testlog" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/testlog" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" ) var signingKeyForTesting, _ = crypto.ToECDSA(hexutil.MustDecode("0xdc599867fc513f8f5e2c2c9c489cde5e71362d1d9ec6e693e0de063236ed1240")) diff --git a/p2p/dnsdisc/sync.go b/p2p/dnsdisc/sync.go index 073547c90d0..76fa56cad78 100644 --- a/p2p/dnsdisc/sync.go +++ b/p2p/dnsdisc/sync.go @@ -21,8 +21,8 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/p2p/enode" ) // This is the number of consecutive leaf requests that may fail before diff --git a/p2p/dnsdisc/tree.go b/p2p/dnsdisc/tree.go index 7d9703a3455..aa7788b32ea 100644 --- a/p2p/dnsdisc/tree.go +++ b/p2p/dnsdisc/tree.go @@ -25,10 +25,10 @@ import ( "io" "strings" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" "golang.org/x/crypto/sha3" "golang.org/x/exp/slices" ) diff --git a/p2p/dnsdisc/tree_test.go b/p2p/dnsdisc/tree_test.go index 9ed17aa4b3e..1a59d8921a1 100644 --- a/p2p/dnsdisc/tree_test.go +++ b/p2p/dnsdisc/tree_test.go @@ -21,8 +21,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/p2p/enode" ) func TestParseRoot(t *testing.T) { diff --git a/p2p/enode/idscheme.go b/p2p/enode/idscheme.go index fd5d868b761..514b938e5ab 100644 --- a/p2p/enode/idscheme.go +++ b/p2p/enode/idscheme.go @@ -21,10 +21,10 @@ import ( "fmt" "io" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" "golang.org/x/crypto/sha3" ) diff --git a/p2p/enode/idscheme_test.go b/p2p/enode/idscheme_test.go index 0910e6e83f6..822033da4ed 100644 --- a/p2p/enode/idscheme_test.go +++ b/p2p/enode/idscheme_test.go @@ -23,9 +23,9 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/p2p/enode/iter_test.go b/p2p/enode/iter_test.go index b736ed450ad..46f60841851 100644 --- a/p2p/enode/iter_test.go +++ b/p2p/enode/iter_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/p2p/enr" ) func TestReadNodes(t *testing.T) { diff --git a/p2p/enode/localnode.go b/p2p/enode/localnode.go index a18204e752c..2c42ba6607e 100644 --- a/p2p/enode/localnode.go +++ b/p2p/enode/localnode.go @@ -26,9 +26,9 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/p2p/netutil" ) const ( diff --git a/p2p/enode/localnode_test.go b/p2p/enode/localnode_test.go index 7f97ad392f2..1a5091205e2 100644 --- a/p2p/enode/localnode_test.go +++ b/p2p/enode/localnode_test.go @@ -21,8 +21,8 @@ import ( "net" "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enr" "github.com/stretchr/testify/assert" ) diff --git a/p2p/enode/node.go b/p2p/enode/node.go index d7a1a9a1561..507fc5bbe6c 100644 --- a/p2p/enode/node.go +++ b/p2p/enode/node.go @@ -26,8 +26,8 @@ import ( "net" "strings" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" ) var errMissingPrefix = errors.New("missing 'enr:' prefix for base64-encoded record") diff --git a/p2p/enode/node_test.go b/p2p/enode/node_test.go index d15859c477a..62b9ef3a180 100644 --- a/p2p/enode/node_test.go +++ b/p2p/enode/node_test.go @@ -24,8 +24,8 @@ import ( "testing" "testing/quick" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" "github.com/stretchr/testify/assert" ) diff --git a/p2p/enode/nodedb.go b/p2p/enode/nodedb.go index 7e7fb69b293..fd5c3b29283 100644 --- a/p2p/enode/nodedb.go +++ b/p2p/enode/nodedb.go @@ -26,7 +26,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/errors" "github.com/syndtr/goleveldb/leveldb/iterator" diff --git a/p2p/enode/urlv4.go b/p2p/enode/urlv4.go index 0272eee9872..438ae1f1d26 100644 --- a/p2p/enode/urlv4.go +++ b/p2p/enode/urlv4.go @@ -26,9 +26,9 @@ import ( "regexp" "strconv" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enr" ) var ( diff --git a/p2p/enode/urlv4_test.go b/p2p/enode/urlv4_test.go index 33de96cc57f..46e974c5a4b 100644 --- a/p2p/enode/urlv4_test.go +++ b/p2p/enode/urlv4_test.go @@ -24,8 +24,8 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/enr" ) func init() { diff --git a/p2p/enr/enr.go b/p2p/enr/enr.go index 2b093b2f1ab..160c937382f 100644 --- a/p2p/enr/enr.go +++ b/p2p/enr/enr.go @@ -40,7 +40,7 @@ import ( "io" "sort" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" ) const SizeLimit = 300 // maximum encoded size of a node record in bytes diff --git a/p2p/enr/enr_test.go b/p2p/enr/enr_test.go index b85ee209d59..268f3134f39 100644 --- a/p2p/enr/enr_test.go +++ b/p2p/enr/enr_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/p2p/enr/entries.go b/p2p/enr/entries.go index 9945a436c9f..ad68e231eb9 100644 --- a/p2p/enr/entries.go +++ b/p2p/enr/entries.go @@ -22,7 +22,7 @@ import ( "io" "net" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" ) // Entry is implemented by known node record entry types. diff --git a/p2p/message.go b/p2p/message.go index 3ab56ee3501..bd1ee61367d 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -24,9 +24,9 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/rlp" ) // Msg defines the structure of a p2p message. diff --git a/p2p/metrics.go b/p2p/metrics.go index a6e36b91a8d..eac902f0fed 100644 --- a/p2p/metrics.go +++ b/p2p/metrics.go @@ -22,7 +22,7 @@ import ( "errors" "net" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) const ( diff --git a/p2p/msgrate/msgrate.go b/p2p/msgrate/msgrate.go index de1a3177db0..8e23462dec4 100644 --- a/p2p/msgrate/msgrate.go +++ b/p2p/msgrate/msgrate.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) // measurementImpact is the impact a single measurement has on a peer's final diff --git a/p2p/nat/nat.go b/p2p/nat/nat.go index 2aa1f855852..83ac702df4c 100644 --- a/p2p/nat/nat.go +++ b/p2p/nat/nat.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" natpmp "github.com/jackpal/go-nat-pmp" ) diff --git a/p2p/netutil/iptrack.go b/p2p/netutil/iptrack.go index a070499e19d..dc26dce9abd 100644 --- a/p2p/netutil/iptrack.go +++ b/p2p/netutil/iptrack.go @@ -19,7 +19,7 @@ package netutil import ( "time" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/ava-labs/libevm/common/mclock" ) // IPTracker predicts the external endpoint, i.e. IP address and port, of the local host diff --git a/p2p/netutil/iptrack_test.go b/p2p/netutil/iptrack_test.go index ee3bba861e2..5037e204c97 100644 --- a/p2p/netutil/iptrack_test.go +++ b/p2p/netutil/iptrack_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/ava-labs/libevm/common/mclock" ) const ( diff --git a/p2p/nodestate/nodestate.go b/p2p/nodestate/nodestate.go index 1e1757559c0..91bbb759c66 100644 --- a/p2p/nodestate/nodestate.go +++ b/p2p/nodestate/nodestate.go @@ -23,13 +23,13 @@ import ( "time" "unsafe" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" ) var ( diff --git a/p2p/nodestate/nodestate_test.go b/p2p/nodestate/nodestate_test.go index d06ad755e22..5868cbea279 100644 --- a/p2p/nodestate/nodestate_test.go +++ b/p2p/nodestate/nodestate_test.go @@ -23,11 +23,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" ) func testSetup(flagPersist []bool, fieldType []reflect.Type) (*Setup, []Flags, []Field) { diff --git a/p2p/peer.go b/p2p/peer.go index 65a7903f586..c45b5dc6f25 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -24,13 +24,13 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rlp" "golang.org/x/exp/slices" ) diff --git a/p2p/peer_test.go b/p2p/peer_test.go index 4308bbd2eb4..9786954f2f5 100644 --- a/p2p/peer_test.go +++ b/p2p/peer_test.go @@ -28,9 +28,9 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" ) var discard = Protocol{ diff --git a/p2p/protocol.go b/p2p/protocol.go index 9bb6785a225..d329bd2e95c 100644 --- a/p2p/protocol.go +++ b/p2p/protocol.go @@ -20,8 +20,8 @@ import ( "fmt" "strings" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" ) // Protocol represents a P2P subprotocol implementation. diff --git a/p2p/rlpx/buffer_test.go b/p2p/rlpx/buffer_test.go index 9fee4172bd0..41f2571dee6 100644 --- a/p2p/rlpx/buffer_test.go +++ b/p2p/rlpx/buffer_test.go @@ -20,7 +20,7 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" "github.com/stretchr/testify/assert" ) diff --git a/p2p/rlpx/rlpx.go b/p2p/rlpx/rlpx.go index 8bd6f64b9bd..d81cf3aeba2 100644 --- a/p2p/rlpx/rlpx.go +++ b/p2p/rlpx/rlpx.go @@ -34,9 +34,9 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/ecies" + "github.com/ava-labs/libevm/rlp" "github.com/golang/snappy" "golang.org/x/crypto/sha3" ) diff --git a/p2p/rlpx/rlpx_test.go b/p2p/rlpx/rlpx_test.go index 136cb1b5bfc..6509654657c 100644 --- a/p2p/rlpx/rlpx_test.go +++ b/p2p/rlpx/rlpx_test.go @@ -29,10 +29,10 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/p2p/simulations/pipes" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/crypto/ecies" + "github.com/ava-labs/libevm/p2p/simulations/pipes" + "github.com/ava-labs/libevm/rlp" "github.com/stretchr/testify/assert" ) diff --git a/p2p/server.go b/p2p/server.go index 975a3bb9166..ef16d086bcf 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -28,16 +28,16 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/discover" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/p2p/nat" + "github.com/ava-labs/libevm/p2p/netutil" "golang.org/x/exp/slices" ) diff --git a/p2p/server_nat.go b/p2p/server_nat.go index 299d2754900..8a3e306e224 100644 --- a/p2p/server_nat.go +++ b/p2p/server_nat.go @@ -20,10 +20,10 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/nat" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/p2p/nat" ) const ( diff --git a/p2p/server_nat_test.go b/p2p/server_nat_test.go index de935fcfc56..99b5fd62607 100644 --- a/p2p/server_nat_test.go +++ b/p2p/server_nat_test.go @@ -22,9 +22,9 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/internal/testlog" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/internal/testlog" + "github.com/ava-labs/libevm/log" ) func TestServerPortMapping(t *testing.T) { diff --git a/p2p/server_test.go b/p2p/server_test.go index a0491e984a7..e5866c6dda1 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -29,12 +29,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/testlog" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/rlpx" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/testlog" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/p2p/rlpx" ) type testTransport struct { diff --git a/p2p/simulations/adapters/exec.go b/p2p/simulations/adapters/exec.go index 63cc4936c1b..3d2bf90f653 100644 --- a/p2p/simulations/adapters/exec.go +++ b/p2p/simulations/adapters/exec.go @@ -34,12 +34,12 @@ import ( "syscall" "time" - "github.com/ethereum/go-ethereum/internal/reexec" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/internal/reexec" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/rpc" "github.com/gorilla/websocket" "golang.org/x/exp/slog" ) diff --git a/p2p/simulations/adapters/inproc.go b/p2p/simulations/adapters/inproc.go index 349e496b2f6..4af652fafce 100644 --- a/p2p/simulations/adapters/inproc.go +++ b/p2p/simulations/adapters/inproc.go @@ -24,13 +24,13 @@ import ( "net" "sync" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/pipes" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations/pipes" + "github.com/ava-labs/libevm/rpc" "github.com/gorilla/websocket" ) diff --git a/p2p/simulations/adapters/inproc_test.go b/p2p/simulations/adapters/inproc_test.go index 2a61508fe18..61dba476705 100644 --- a/p2p/simulations/adapters/inproc_test.go +++ b/p2p/simulations/adapters/inproc_test.go @@ -23,7 +23,7 @@ import ( "sync" "testing" - "github.com/ethereum/go-ethereum/p2p/simulations/pipes" + "github.com/ava-labs/libevm/p2p/simulations/pipes" ) func TestTCPPipe(t *testing.T) { diff --git a/p2p/simulations/adapters/types.go b/p2p/simulations/adapters/types.go index fb8463d221e..02a121b7bfd 100644 --- a/p2p/simulations/adapters/types.go +++ b/p2p/simulations/adapters/types.go @@ -25,14 +25,14 @@ import ( "os" "strconv" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/reexec" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/internal/reexec" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rpc" "github.com/gorilla/websocket" "golang.org/x/exp/slog" ) diff --git a/p2p/simulations/connect.go b/p2p/simulations/connect.go index ede96b34c13..52136dd77ba 100644 --- a/p2p/simulations/connect.go +++ b/p2p/simulations/connect.go @@ -20,7 +20,7 @@ import ( "errors" "strings" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/p2p/enode" ) var ( diff --git a/p2p/simulations/connect_test.go b/p2p/simulations/connect_test.go index 0154a18b030..d97f4448ed0 100644 --- a/p2p/simulations/connect_test.go +++ b/p2p/simulations/connect_test.go @@ -19,9 +19,9 @@ package simulations import ( "testing" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations/adapters" ) func newTestNetwork(t *testing.T, nodeCount int) (*Network, []enode.ID) { diff --git a/p2p/simulations/examples/ping-pong.go b/p2p/simulations/examples/ping-pong.go index 70b35ad7774..8e6d0f377b8 100644 --- a/p2p/simulations/examples/ping-pong.go +++ b/p2p/simulations/examples/ping-pong.go @@ -25,12 +25,12 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations" + "github.com/ava-labs/libevm/p2p/simulations/adapters" ) var adapterType = flag.String("adapter", "sim", `node adapter to use (one of "sim", "exec" or "docker")`) diff --git a/p2p/simulations/http.go b/p2p/simulations/http.go index 34521b47789..39e67a8113d 100644 --- a/p2p/simulations/http.go +++ b/p2p/simulations/http.go @@ -30,11 +30,11 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations/adapters" + "github.com/ava-labs/libevm/rpc" "github.com/gorilla/websocket" "github.com/julienschmidt/httprouter" ) diff --git a/p2p/simulations/http_test.go b/p2p/simulations/http_test.go index c53a49797bd..08747ddc86d 100644 --- a/p2p/simulations/http_test.go +++ b/p2p/simulations/http_test.go @@ -29,13 +29,13 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations/adapters" + "github.com/ava-labs/libevm/rpc" "github.com/mattn/go-colorable" "golang.org/x/exp/slog" ) diff --git a/p2p/simulations/mocker.go b/p2p/simulations/mocker.go index 0dc04e65f92..c2bb8b3c98e 100644 --- a/p2p/simulations/mocker.go +++ b/p2p/simulations/mocker.go @@ -24,9 +24,9 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations/adapters" ) // a map of mocker names to its function diff --git a/p2p/simulations/mocker_test.go b/p2p/simulations/mocker_test.go index 0112ee5cfd6..684794251f9 100644 --- a/p2p/simulations/mocker_test.go +++ b/p2p/simulations/mocker_test.go @@ -27,7 +27,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/p2p/enode" ) func TestMocker(t *testing.T) { diff --git a/p2p/simulations/network.go b/p2p/simulations/network.go index 4735e5cfa6c..00bfe49a5c2 100644 --- a/p2p/simulations/network.go +++ b/p2p/simulations/network.go @@ -26,11 +26,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/ava-labs/libevm/event" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations/adapters" ) var DialBanTimeout = 200 * time.Millisecond diff --git a/p2p/simulations/network_test.go b/p2p/simulations/network_test.go index 4ed1e4e6c33..6af4dfc3830 100644 --- a/p2p/simulations/network_test.go +++ b/p2p/simulations/network_test.go @@ -27,10 +27,10 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/node" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/simulations/adapters" ) // Tests that a created snapshot with a minimal service only contains the expected connections diff --git a/p2p/simulations/simulation.go b/p2p/simulations/simulation.go index ae62c42b9c2..ecb94df53a3 100644 --- a/p2p/simulations/simulation.go +++ b/p2p/simulations/simulation.go @@ -20,7 +20,7 @@ import ( "context" "time" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ava-labs/libevm/p2p/enode" ) // Simulation provides a framework for running actions in a simulated network diff --git a/p2p/simulations/test.go b/p2p/simulations/test.go index 0edb07b127f..f8f8609bfb8 100644 --- a/p2p/simulations/test.go +++ b/p2p/simulations/test.go @@ -19,10 +19,10 @@ package simulations import ( "testing" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/p2p" + "github.com/ava-labs/libevm/p2p/enode" + "github.com/ava-labs/libevm/p2p/enr" + "github.com/ava-labs/libevm/rpc" ) // NoopService is the service that does not do anything diff --git a/p2p/tracker/tracker.go b/p2p/tracker/tracker.go index 6a733b9ba51..dcf3e2552dc 100644 --- a/p2p/tracker/tracker.go +++ b/p2p/tracker/tracker.go @@ -22,8 +22,8 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" ) const ( diff --git a/p2p/transport.go b/p2p/transport.go index 5fc7686feb0..8e505f79ed3 100644 --- a/p2p/transport.go +++ b/p2p/transport.go @@ -26,11 +26,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/bitutil" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p/rlpx" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/bitutil" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/p2p/rlpx" + "github.com/ava-labs/libevm/rlp" ) const ( diff --git a/p2p/transport_test.go b/p2p/transport_test.go index 24e06c5a06b..1d3062ee29e 100644 --- a/p2p/transport_test.go +++ b/p2p/transport_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/simulations/pipes" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/p2p/simulations/pipes" ) func TestProtocolHandshake(t *testing.T) { diff --git a/p2p/util.go b/p2p/util.go index 2c8f322a66a..654d3f4aaa7 100644 --- a/p2p/util.go +++ b/p2p/util.go @@ -19,7 +19,7 @@ package p2p import ( "container/heap" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/ava-labs/libevm/common/mclock" ) // expHeap tracks strings and their expiry time. diff --git a/p2p/util_test.go b/p2p/util_test.go index cc0d2b215fe..db2e5715a43 100644 --- a/p2p/util_test.go +++ b/p2p/util_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/ava-labs/libevm/common/mclock" ) func TestExpHeap(t *testing.T) { diff --git a/params/bootnodes.go b/params/bootnodes.go index 5e2c7c21810..2963d0c5445 100644 --- a/params/bootnodes.go +++ b/params/bootnodes.go @@ -16,7 +16,7 @@ package params -import "github.com/ethereum/go-ethereum/common" +import "github.com/ava-labs/libevm/common" // MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on // the main Ethereum network. diff --git a/params/config.go b/params/config.go index 21ede457fd6..1708bc78de7 100644 --- a/params/config.go +++ b/params/config.go @@ -20,8 +20,9 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/params/forks" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/libevm/pseudo" + "github.com/ava-labs/libevm/params/forks" ) // Genesis hashes to enforce below configs on. @@ -365,6 +366,8 @@ type ChainConfig struct { // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty"` Clique *CliqueConfig `json:"clique,omitempty"` + + extra *pseudo.Type // See RegisterExtras() } // EthashConfig is the consensus engine configs for proof-of-work based sealing. @@ -475,7 +478,7 @@ func (c *ChainConfig) Description() string { if c.VerkleTime != nil { banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime) } - return banner + return banner + c.Hooks().Description() } // IsHomestead returns whether num is either equal to the homestead block or greater. @@ -668,7 +671,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { lastFork = cur } } - return nil + return c.Hooks().CheckConfigForkOrder() } func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, headTimestamp uint64) *ConfigCompatError { @@ -739,7 +742,7 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, if isForkTimestampIncompatible(c.VerkleTime, newcfg.VerkleTime, headTimestamp) { return newTimestampCompatError("Verkle fork timestamp", c.VerkleTime, newcfg.VerkleTime) } - return nil + return c.Hooks().CheckConfigCompatible(newcfg, headNumber, headTimestamp) } // BaseFeeChangeDenominator bounds the amount the base fee can change between blocks. @@ -902,6 +905,8 @@ type Rules struct { IsBerlin, IsLondon bool IsMerge, IsShanghai, IsCancun, IsPrague bool IsVerkle bool + + extra *pseudo.Type // See RegisterExtras() } // Rules ensures c's ChainID is not nil. @@ -912,7 +917,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules } // disallow setting Merge out of order isMerge = isMerge && c.IsLondon(num) - return Rules{ + r := Rules{ ChainID: new(big.Int).Set(chainID), IsHomestead: c.IsHomestead(num), IsEIP150: c.IsEIP150(num), @@ -930,4 +935,6 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules IsPrague: isMerge && c.IsPrague(num, timestamp), IsVerkle: isMerge && c.IsVerkle(num, timestamp), } + c.addRulesExtra(&r, num, isMerge, timestamp) + return r } diff --git a/params/config.libevm.go b/params/config.libevm.go new file mode 100644 index 00000000000..ddde634f8a5 --- /dev/null +++ b/params/config.libevm.go @@ -0,0 +1,243 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package params + +import ( + "fmt" + "math/big" + "reflect" + + "github.com/ava-labs/libevm/libevm/pseudo" + "github.com/ava-labs/libevm/libevm/testonly" +) + +// Extras are arbitrary payloads to be added as extra fields in [ChainConfig] +// and [Rules] structs. See [RegisterExtras]. +type Extras[C ChainConfigHooks, R RulesHooks] struct { + // ReuseJSONRoot, if true, signals that JSON unmarshalling of a + // [ChainConfig] MUST reuse the root JSON input when unmarshalling the extra + // payload. If false, it is assumed that the extra JSON payload is nested in + // the "extra" key. + // + // *NOTE* this requires multiple passes for both marshalling and + // unmarshalling of JSON so is inefficient and should be used as a last + // resort. + ReuseJSONRoot bool + // NewRules, if non-nil is called at the end of [ChainConfig.Rules] with the + // newly created [Rules] and other context from the method call. Its + // returned value will be the extra payload of the [Rules]. If NewRules is + // nil then so too will the [Rules] extra payload be a zero-value `R`. + // + // NewRules MAY modify the [Rules] but MUST NOT modify the [ChainConfig]. + // TODO(arr4n): add the [Rules] to the return signature to make it clearer + // that the caller can modify the generated Rules. + NewRules func(_ *ChainConfig, _ *Rules, _ C, blockNum *big.Int, isMerge bool, timestamp uint64) R +} + +// RegisterExtras registers the types `C` and `R` such that they are carried as +// extra payloads in [ChainConfig] and [Rules] structs, respectively. It is +// expected to be called in an `init()` function and MUST NOT be called more +// than once. Both `C` and `R` MUST be structs or pointers to structs. +// +// After registration, JSON unmarshalling of a [ChainConfig] will create a new +// `C` and unmarshal the JSON key "extra" into it. Conversely, JSON marshalling +// will populate the "extra" key with the contents of the `C`. Both the +// [json.Marshaler] and [json.Unmarshaler] interfaces are honoured if +// implemented by `C` and/or `R.` +// +// Calls to [ChainConfig.Rules] will call the `NewRules` function of the +// registered [Extras] to create a new `R`. +// +// The payloads can be accessed via the [ExtraPayloads.FromChainConfig] and +// [ExtraPayloads.FromRules] methods of the accessor returned by RegisterExtras. +// Where stated in the interface definitions, they will also be used as hooks to +// alter Ethereum behaviour; if this isn't desired then they can embed +// [NOOPHooks] to satisfy either interface. +func RegisterExtras[C ChainConfigHooks, R RulesHooks](e Extras[C, R]) ExtraPayloads[C, R] { + if registeredExtras != nil { + panic("re-registration of Extras") + } + mustBeStructOrPointerToOne[C]() + mustBeStructOrPointerToOne[R]() + + payloads := e.payloads() + registeredExtras = &extraConstructors{ + newChainConfig: pseudo.NewConstructor[C]().Zero, + newRules: pseudo.NewConstructor[R]().Zero, + reuseJSONRoot: e.ReuseJSONRoot, + newForRules: e.newForRules, + payloads: payloads, + } + return payloads +} + +// TestOnlyClearRegisteredExtras clears the [Extras] previously passed to +// [RegisterExtras]. It panics if called from a non-testing call stack. +// +// In tests it SHOULD be called before every call to [RegisterExtras] and then +// defer-called afterwards, either directly or via testing.TB.Cleanup(). This is +// a workaround for the single-call limitation on [RegisterExtras]. +func TestOnlyClearRegisteredExtras() { + testonly.OrPanic(func() { + registeredExtras = nil + }) +} + +// registeredExtras holds non-generic constructors for the [Extras] types +// registered via [RegisterExtras]. +var registeredExtras *extraConstructors + +type extraConstructors struct { + newChainConfig, newRules func() *pseudo.Type + reuseJSONRoot bool + newForRules func(_ *ChainConfig, _ *Rules, blockNum *big.Int, isMerge bool, timestamp uint64) *pseudo.Type + // use top-level hooksFrom() functions instead of these as they handle + // instances where no [Extras] were registered. + payloads interface { + hooksFromChainConfig(*ChainConfig) ChainConfigHooks + hooksFromRules(*Rules) RulesHooks + } +} + +func (e *Extras[C, R]) newForRules(c *ChainConfig, r *Rules, blockNum *big.Int, isMerge bool, timestamp uint64) *pseudo.Type { + if e.NewRules == nil { + return registeredExtras.newRules() + } + rExtra := e.NewRules(c, r, e.payloads().FromChainConfig(c), blockNum, isMerge, timestamp) + return pseudo.From(rExtra).Type +} + +func (*Extras[C, R]) payloads() (g ExtraPayloads[C, R]) { return } + +// mustBeStructOrPointerToOne panics if `T` isn't a struct or a *struct. +func mustBeStructOrPointerToOne[T any]() { + var x T + switch t := reflect.TypeOf(x); t.Kind() { + case reflect.Struct: + return + case reflect.Pointer: + if t.Elem().Kind() == reflect.Struct { + return + } + } + panic(notStructMessage[T]()) +} + +// notStructMessage returns the message with which [mustBeStructOrPointerToOne] +// might panic. It exists to avoid change-detector tests should the message +// contents change. +func notStructMessage[T any]() string { + var x T + return fmt.Sprintf("%T is not a struct nor a pointer to a struct", x) +} + +// ExtraPayloads provides strongly typed access to the extra payloads carried by +// [ChainConfig] and [Rules] structs. The only valid way to construct an +// instance is by a call to [RegisterExtras]. +type ExtraPayloads[C ChainConfigHooks, R RulesHooks] struct { + _ struct{} // make godoc show unexported fields so nobody tries to make their own instance ;) +} + +// FromChainConfig returns the ChainConfig's extra payload. +func (ExtraPayloads[C, R]) FromChainConfig(c *ChainConfig) C { + return pseudo.MustNewValue[C](c.extraPayload()).Get() +} + +// PointerFromChainConfig returns a pointer to the ChainConfig's extra payload. +// This is guaranteed to be non-nil. +// +// Note that copying a ChainConfig by dereferencing a pointer will result in a +// shallow copy and that the *C returned here will therefore be shared by all +// copies. If this is not the desired behaviour, use +// [ExtraPayloads.SetOnChainConfig]. +func (ExtraPayloads[C, R]) PointerFromChainConfig(c *ChainConfig) *C { + return pseudo.MustPointerTo[C](c.extraPayload()).Value.Get() +} + +// SetOnChainConfig sets the ChainConfig's extra payload. +func (e ExtraPayloads[C, R]) SetOnChainConfig(cc *ChainConfig, val C) { + cc.extra = pseudo.From(val).Type +} + +// hooksFromChainConfig is equivalent to FromChainConfig(), but returns an +// interface instead of the concrete type implementing it; this allows it to be +// used in non-generic code. +func (e ExtraPayloads[C, R]) hooksFromChainConfig(c *ChainConfig) ChainConfigHooks { + return e.FromChainConfig(c) +} + +// FromRules returns the Rules' extra payload. +func (ExtraPayloads[C, R]) FromRules(r *Rules) R { + return pseudo.MustNewValue[R](r.extraPayload()).Get() +} + +// PointerFromRules returns a pointer to the Rules's extra payload. This is +// guaranteed to be non-nil. +// +// Note that copying a Rules by dereferencing a pointer will result in a shallow +// copy and that the *R returned here will therefore be shared by all copies. If +// this is not the desired behaviour, use [ExtraPayloads.SetOnRules]. +func (ExtraPayloads[C, R]) PointerFromRules(r *Rules) *R { + return pseudo.MustPointerTo[R](r.extraPayload()).Value.Get() +} + +// SetOnRules sets the Rules' extra payload. +func (e ExtraPayloads[C, R]) SetOnRules(r *Rules, val R) { + r.extra = pseudo.From(val).Type +} + +// hooksFromRules is the [RulesHooks] equivalent of hooksFromChainConfig(). +func (e ExtraPayloads[C, R]) hooksFromRules(r *Rules) RulesHooks { + return e.FromRules(r) +} + +// addRulesExtra is called at the end of [ChainConfig.Rules]; it exists to +// abstract the libevm-specific behaviour outside of original geth code. +func (c *ChainConfig) addRulesExtra(r *Rules, blockNum *big.Int, isMerge bool, timestamp uint64) { + r.extra = nil + if registeredExtras != nil { + r.extra = registeredExtras.newForRules(c, r, blockNum, isMerge, timestamp) + } +} + +// extraPayload returns the ChainConfig's extra payload iff [RegisterExtras] has +// already been called. If the payload hasn't been populated (typically via +// unmarshalling of JSON), a nil value is constructed and returned. +func (c *ChainConfig) extraPayload() *pseudo.Type { + if registeredExtras == nil { + // This will only happen if someone constructs an [ExtraPayloads] + // directly, without a call to [RegisterExtras]. + // + // See https://google.github.io/styleguide/go/best-practices#when-to-panic + panic(fmt.Sprintf("%T.ExtraPayload() called before RegisterExtras()", c)) + } + if c.extra == nil { + c.extra = registeredExtras.newChainConfig() + } + return c.extra +} + +// extraPayload is equivalent to [ChainConfig.extraPayload]. +func (r *Rules) extraPayload() *pseudo.Type { + if registeredExtras == nil { + // See ChainConfig.extraPayload() equivalent. + panic(fmt.Sprintf("%T.ExtraPayload() called before RegisterExtras()", r)) + } + if r.extra == nil { + r.extra = registeredExtras.newRules() + } + return r.extra +} diff --git a/params/config.libevm_test.go b/params/config.libevm_test.go new file mode 100644 index 00000000000..7a665a45686 --- /dev/null +++ b/params/config.libevm_test.go @@ -0,0 +1,275 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package params + +import ( + "encoding/json" + "math/big" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/libevm/pseudo" +) + +type rawJSON struct { + json.RawMessage + NOOPHooks +} + +var _ interface { + json.Marshaler + json.Unmarshaler +} = (*rawJSON)(nil) + +func TestRegisterExtras(t *testing.T) { + type ( + ccExtraA struct { + A string `json:"a"` + ChainConfigHooks + } + rulesExtraA struct { + A string + RulesHooks + } + ccExtraB struct { + B string `json:"b"` + ChainConfigHooks + } + rulesExtraB struct { + B string + RulesHooks + } + ) + + tests := []struct { + name string + register func() + ccExtra *pseudo.Type + wantRulesExtra any + }{ + { + name: "Rules payload copied from ChainConfig payload", + register: func() { + RegisterExtras(Extras[ccExtraA, rulesExtraA]{ + NewRules: func(cc *ChainConfig, r *Rules, ex ccExtraA, _ *big.Int, _ bool, _ uint64) rulesExtraA { + return rulesExtraA{ + A: ex.A, + } + }, + }) + }, + ccExtra: pseudo.From(ccExtraA{ + A: "hello", + }).Type, + wantRulesExtra: rulesExtraA{ + A: "hello", + }, + }, + { + name: "no NewForRules() function results in zero value", + register: func() { + RegisterExtras(Extras[ccExtraB, rulesExtraB]{}) + }, + ccExtra: pseudo.From(ccExtraB{ + B: "world", + }).Type, + wantRulesExtra: rulesExtraB{}, + }, + { + name: "no NewForRules() function results in nil pointer", + register: func() { + RegisterExtras(Extras[ccExtraB, *rulesExtraB]{}) + }, + ccExtra: pseudo.From(ccExtraB{ + B: "world", + }).Type, + wantRulesExtra: (*rulesExtraB)(nil), + }, + { + name: "custom JSON handling honoured", + register: func() { + RegisterExtras(Extras[rawJSON, struct{ RulesHooks }]{}) + }, + ccExtra: pseudo.From(rawJSON{ + RawMessage: []byte(`"hello, world"`), + }).Type, + wantRulesExtra: struct{ RulesHooks }{}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + TestOnlyClearRegisteredExtras() + tt.register() + defer TestOnlyClearRegisteredExtras() + + input := &ChainConfig{ + ChainID: big.NewInt(142857), + extra: tt.ccExtra, + } + + buf, err := json.Marshal(input) + require.NoError(t, err) + + got := new(ChainConfig) + require.NoError(t, json.Unmarshal(buf, got)) + assert.Equal(t, tt.ccExtra.Interface(), got.extraPayload().Interface()) + assert.Equal(t, input, got) + + gotRules := got.Rules(nil, false, 0) + assert.Equal(t, tt.wantRulesExtra, gotRules.extraPayload().Interface()) + }) + } +} + +func TestModificationOfZeroExtras(t *testing.T) { + type ( + ccExtra struct { + X int + NOOPHooks + } + rulesExtra struct { + X int + NOOPHooks + } + ) + + TestOnlyClearRegisteredExtras() + t.Cleanup(TestOnlyClearRegisteredExtras) + extras := RegisterExtras(Extras[ccExtra, rulesExtra]{}) + + config := new(ChainConfig) + rules := new(Rules) + // These assertion helpers are defined before any modifications so that the + // closure is demonstrably over the original zero values. + assertChainConfigExtra := func(t *testing.T, want ccExtra, msg string) { + t.Helper() + assert.Equalf(t, want, extras.FromChainConfig(config), "%T: "+msg, &config) + } + assertRulesExtra := func(t *testing.T, want rulesExtra, msg string) { + t.Helper() + assert.Equalf(t, want, extras.FromRules(rules), "%T: "+msg, &rules) + } + + assertChainConfigExtra(t, ccExtra{}, "zero value") + assertRulesExtra(t, rulesExtra{}, "zero value") + + const answer = 42 + extras.PointerFromChainConfig(config).X = answer + assertChainConfigExtra(t, ccExtra{X: answer}, "after setting via pointer field") + + const pi = 314159 + extras.PointerFromRules(rules).X = pi + assertRulesExtra(t, rulesExtra{X: pi}, "after setting via pointer field") + + ccReplace := ccExtra{X: 142857} + extras.SetOnChainConfig(config, ccReplace) + assertChainConfigExtra(t, ccReplace, "after replacement of entire extra via `*pointer = x`") + + rulesReplace := rulesExtra{X: 18101986} + extras.SetOnRules(rules, rulesReplace) + assertRulesExtra(t, rulesReplace, "after replacement of entire extra via `*pointer = x`") + + if t.Failed() { + // The test of shallow copying is now guaranteed to fail. + return + } + t.Run("copy", func(t *testing.T) { + const ( + // Arbitrary test values. + seqUp = 123456789 + seqDown = 987654321 + ) + + ccCopy := *config + t.Run("ChainConfig", func(t *testing.T) { + assert.Equal(t, extras.FromChainConfig(&ccCopy), ccReplace, "extras copied") + + extras.PointerFromChainConfig(&ccCopy).X = seqUp + assertChainConfigExtra(t, ccExtra{X: seqUp}, "original changed via copied.PointerFromChainConfig because copy only shallow") + + ccReplace = ccExtra{X: seqDown} + extras.SetOnChainConfig(&ccCopy, ccReplace) + assert.Equal(t, extras.FromChainConfig(&ccCopy), ccReplace, "SetOnChainConfig effect") + assertChainConfigExtra(t, ccExtra{X: seqUp}, "original unchanged after copied.SetOnChainConfig") + }) + + rCopy := *rules + t.Run("Rules", func(t *testing.T) { + assert.Equal(t, extras.FromRules(&rCopy), rulesReplace, "extras copied") + + extras.PointerFromRules(&rCopy).X = seqUp + assertRulesExtra(t, rulesExtra{X: seqUp}, "original changed via copied.PointerFromRuels because copy only shallow") + + rulesReplace = rulesExtra{X: seqDown} + extras.SetOnRules(&rCopy, rulesReplace) + assert.Equal(t, extras.FromRules(&rCopy), rulesReplace, "SetOnRules effect") + assertRulesExtra(t, rulesExtra{X: seqUp}, "original unchanged after copied.SetOnRules") + }) + }) +} + +func TestExtrasPanic(t *testing.T) { + TestOnlyClearRegisteredExtras() + defer TestOnlyClearRegisteredExtras() + + assertPanics( + t, func() { + new(ChainConfig).extraPayload() + }, + "before RegisterExtras", + ) + + assertPanics( + t, func() { + new(Rules).extraPayload() + }, + "before RegisterExtras", + ) + + assertPanics( + t, func() { + mustBeStructOrPointerToOne[int]() + }, + notStructMessage[int](), + ) + + RegisterExtras(Extras[struct{ ChainConfigHooks }, struct{ RulesHooks }]{}) + + assertPanics( + t, func() { + RegisterExtras(Extras[struct{ ChainConfigHooks }, struct{ RulesHooks }]{}) + }, + "re-registration", + ) +} + +func assertPanics(t *testing.T, fn func(), wantContains string) { + t.Helper() + defer func() { + switch r := recover().(type) { + case nil: + t.Error("function did not panic as expected") + case string: + assert.Contains(t, r, wantContains) + default: + t.Fatalf("BAD TEST SETUP: recover() got unsupported type %T", r) + } + }() + fn() +} diff --git a/params/config_test.go b/params/config_test.go index bf8ce2fc5e2..707566aa46f 100644 --- a/params/config_test.go +++ b/params/config_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/math" + "github.com/ava-labs/libevm/common/math" ) func TestCheckCompatible(t *testing.T) { diff --git a/params/dao.go b/params/dao.go index da3c8dfc992..15905861dfa 100644 --- a/params/dao.go +++ b/params/dao.go @@ -19,7 +19,7 @@ package params import ( "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // DAOForkBlockExtra is the block header extra-data field to set for the DAO fork diff --git a/params/example.libevm_test.go b/params/example.libevm_test.go new file mode 100644 index 00000000000..943f40b128f --- /dev/null +++ b/params/example.libevm_test.go @@ -0,0 +1,175 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +// In practice, everything in this file except for the Example() function SHOULD +// be a standalone package, typically called `extraparams`. As long as this new +// package is imported anywhere, its init() function will register the "extra" +// types, which can be accessed via [extraparams.FromChainConfig] and/or +// [extraparams.FromRules]. In all other respects, the [params.ChainConfig] and +// [params.Rules] types will act as expected. +// +// The Example() function demonstrates how the `extraparams` package might be +// used from elsewhere. +package params_test + +import ( + "encoding/json" + "errors" + "fmt" + "log" + "math/big" + "time" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/libevm" + "github.com/ava-labs/libevm/params" +) + +// In practice this would be a regular init() function but nuances around the +// testing of this package require it to be called in the Example(). +func initFn() { + params.TestOnlyClearRegisteredExtras() // not necessary outside of the example + // This registration makes *all* [params.ChainConfig] and [params.Rules] + // instances respect the payload types. They do not need to be modified to + // know about `extraparams`. + payloads = params.RegisterExtras(params.Extras[ChainConfigExtra, RulesExtra]{ + NewRules: constructRulesExtra, + }) +} + +var payloads params.ExtraPayloads[ChainConfigExtra, RulesExtra] + +// constructRulesExtra acts as an adjunct to the [params.ChainConfig.Rules] +// method. Its primary purpose is to construct the extra payload for the +// [params.Rules] but it MAY also modify the [params.Rules]. +func constructRulesExtra(c *params.ChainConfig, r *params.Rules, cEx ChainConfigExtra, blockNum *big.Int, isMerge bool, timestamp uint64) RulesExtra { + return RulesExtra{ + IsMyFork: cEx.MyForkTime != nil && *cEx.MyForkTime <= timestamp, + timestamp: timestamp, + } +} + +// ChainConfigExtra can be any struct. Here it just mirrors a common pattern in +// the standard [params.ChainConfig] struct. +type ChainConfigExtra struct { + MyForkTime *uint64 `json:"myForkTime"` + + // (Optional) If not all hooks are desirable then embedding a [NOOPHooks] + // allows the type to satisfy the [ChainConfigHooks] interface, resulting in + // default Ethereum behaviour. + params.NOOPHooks +} + +// RulesExtra can be any struct. It too mirrors a common pattern in +// [params.Rules]. +type RulesExtra struct { + IsMyFork bool + timestamp uint64 + + params.NOOPHooks +} + +// FromChainConfig returns the extra payload carried by the ChainConfig. +func FromChainConfig(c *params.ChainConfig) ChainConfigExtra { + return payloads.FromChainConfig(c) +} + +// FromRules returns the extra payload carried by the Rules. +func FromRules(r *params.Rules) RulesExtra { + return payloads.FromRules(r) +} + +// myForkPrecompiledContracts is analogous to the vm.PrecompiledContracts +// maps. Note [RulesExtra.PrecompileOverride] treatment of nil values here. +var myForkPrecompiledContracts = map[common.Address]vm.PrecompiledContract{ + //... + common.BytesToAddress([]byte{0x2}): nil, // i.e disabled + //... +} + +// PrecompileOverride implements the required [params.RuleHooks] method. +func (r RulesExtra) PrecompileOverride(addr common.Address) (_ libevm.PrecompiledContract, override bool) { + if !r.IsMyFork { + return nil, false + } + p, ok := myForkPrecompiledContracts[addr] + // The returned boolean indicates whether or not [vm.EVMInterpreter] MUST + // override the address, not what it returns as its own `isPrecompile` + // boolean. + // + // Therefore returning `nil, true` here indicates that the precompile will + // be disabled. Returning `false` here indicates that the default precompile + // behaviour will be exhibited. + // + // The same pattern can alternatively be implemented with an explicit + // `disabledPrecompiles` set to make the behaviour clearer. + return p, ok +} + +// CanCreateContract implements the required [params.RuleHooks] method. Access +// to state allows it to be configured on-chain however this is an optional +// implementation detail. +func (r RulesExtra) CanCreateContract(_ *libevm.AddressContext, gas uint64, _ libevm.StateReader) (uint64, error) { + if time.Unix(int64(r.timestamp), 0).UTC().Day() != int(time.Tuesday) { //nolint:gosec // G115 timestamp won't overflow int64 for millions of years so this is someone else's problem + // Consumes all remaining gas. + return 0, errors.New("uh oh") + } + return gas, nil +} + +// This example demonstrates how the rest of this file would be used from a +// *different* package. +func ExampleExtraPayloads() { + initFn() // Outside of an example this is unnecessary as the function will be a regular init(). + + const forkTime = 530003640 + jsonData := fmt.Sprintf(`{ + "chainId": 1234, + "extra": { + "myForkTime": %d + } + }`, forkTime) + + // Because [params.RegisterExtras] has been called, unmarshalling a JSON + // field of "extra" into a [params.ChainConfig] will populate a new value of + // the registered type. This can be accessed with the [FromChainConfig] + // function. + config := new(params.ChainConfig) + if err := json.Unmarshal([]byte(jsonData), config); err != nil { + log.Fatal(err) + } + + fmt.Println("Chain ID", config.ChainID) // original geth fields work as expected + + ccExtra := FromChainConfig(config) // extraparams.FromChainConfig() in practice + if ccExtra.MyForkTime != nil { + fmt.Println("Fork time", *ccExtra.MyForkTime) + } + + for _, time := range []uint64{forkTime - 1, forkTime, forkTime + 1} { + rules := config.Rules(nil, false, time) + rExtra := FromRules(&rules) // extraparams.FromRules() in practice + fmt.Printf("IsMyFork at %v: %t\n", rExtra.timestamp, rExtra.IsMyFork) + } + + // Output: + // Chain ID 1234 + // Fork time 530003640 + // IsMyFork at 530003639: false + // IsMyFork at 530003640: true + // IsMyFork at 530003641: true +} diff --git a/params/hooks.libevm.go b/params/hooks.libevm.go new file mode 100644 index 00000000000..0e2127aca41 --- /dev/null +++ b/params/hooks.libevm.go @@ -0,0 +1,133 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package params + +import ( + "math/big" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/libevm" +) + +// ChainConfigHooks are required for all types registered as [Extras] for +// [ChainConfig] payloads. +type ChainConfigHooks interface { + CheckConfigForkOrder() error + CheckConfigCompatible(newcfg *ChainConfig, headNumber *big.Int, headTimestamp uint64) *ConfigCompatError + Description() string +} + +// TODO(arr4n): given the choice of whether a hook should be defined on a +// ChainConfig or on the Rules, what are the guiding principles? A ChainConfig +// carries the most general information while Rules benefit from "knowing" the +// block number and timestamp. I am leaning towards the default choice being +// on Rules (as it's trivial to copy information from ChainConfig to Rules in +// [Extras.NewRules]) unless the call site only has access to a ChainConfig. + +// RulesHooks are required for all types registered as [Extras] for [Rules] +// payloads. +type RulesHooks interface { + RulesAllowlistHooks + // PrecompileOverride signals whether or not the EVM interpreter MUST + // override its treatment of the address when deciding if it is a + // precompiled contract. If PrecompileOverride returns `true` then the + // interpreter will treat the address as a precompile i.f.f the + // [PrecompiledContract] is non-nil. If it returns `false` then the default + // precompile behaviour is honoured. + PrecompileOverride(common.Address) (_ libevm.PrecompiledContract, override bool) + // ActivePrecompiles receives the addresses that would usually be returned + // by a call to [vm.ActivePrecompiles] and MUST return the value to be + // returned by said function, which will be propagated. It MAY alter the + // received slice. The value it returns MUST be consistent with the + // behaviour of the PrecompileOverride hook. + ActivePrecompiles([]common.Address) []common.Address +} + +// RulesAllowlistHooks are a subset of [RulesHooks] that gate actions, signalled +// by returning a nil (allowed) or non-nil (blocked) error. +type RulesAllowlistHooks interface { + // CanCreateContract is called after the deployer's nonce is incremented but + // before all other state-modifying actions. + CanCreateContract(_ *libevm.AddressContext, gas uint64, _ libevm.StateReader) (gasRemaining uint64, _ error) + CanExecuteTransaction(from common.Address, to *common.Address, _ libevm.StateReader) error +} + +// Hooks returns the hooks registered with [RegisterExtras], or [NOOPHooks] if +// none were registered. +func (c *ChainConfig) Hooks() ChainConfigHooks { + if e := registeredExtras; e != nil { + return e.payloads.hooksFromChainConfig(c) + } + return NOOPHooks{} +} + +// Hooks returns the hooks registered with [RegisterExtras], or [NOOPHooks] if +// none were registered. +func (r *Rules) Hooks() RulesHooks { + if e := registeredExtras; e != nil { + return e.payloads.hooksFromRules(r) + } + return NOOPHooks{} +} + +// NOOPHooks implements both [ChainConfigHooks] and [RulesHooks] such that every +// hook is a no-op. This allows it to be returned instead of a nil interface, +// which would otherwise require every usage site to perform a nil check. It can +// also be embedded in structs that only wish to implement a sub-set of hooks. +// Use of a NOOPHooks is equivalent to default Ethereum behaviour. +type NOOPHooks struct{} + +var _ interface { + ChainConfigHooks + RulesHooks +} = NOOPHooks{} + +// CheckConfigForkOrder verifies all (otherwise valid) fork orders. +func (NOOPHooks) CheckConfigForkOrder() error { + return nil +} + +// CheckConfigCompatible verifies all (otherwise valid) new configs. +func (NOOPHooks) CheckConfigCompatible(*ChainConfig, *big.Int, uint64) *ConfigCompatError { + return nil +} + +// Description returns the empty string. +func (NOOPHooks) Description() string { + return "" +} + +// CanExecuteTransaction allows all (otherwise valid) transactions. +func (NOOPHooks) CanExecuteTransaction(_ common.Address, _ *common.Address, _ libevm.StateReader) error { + return nil +} + +// CanCreateContract allows all (otherwise valid) contract deployment, not +// consuming any more gas. +func (NOOPHooks) CanCreateContract(_ *libevm.AddressContext, gas uint64, _ libevm.StateReader) (uint64, error) { + return gas, nil +} + +// PrecompileOverride instructs the EVM interpreter to use the default +// precompile behaviour. +func (NOOPHooks) PrecompileOverride(common.Address) (libevm.PrecompiledContract, bool) { + return nil, false +} + +// ActivePrecompiles echoes the active addresses unchanged. +func (NOOPHooks) ActivePrecompiles(active []common.Address) []common.Address { + return active +} diff --git a/params/hooks.libevm_test.go b/params/hooks.libevm_test.go new file mode 100644 index 00000000000..babbb1b52b6 --- /dev/null +++ b/params/hooks.libevm_test.go @@ -0,0 +1,78 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package params_test + +import ( + "errors" + "fmt" + "math/big" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/libevm/ethtest" + "github.com/ava-labs/libevm/libevm/hookstest" + "github.com/ava-labs/libevm/params" +) + +func TestChainConfigHooks_Description(t *testing.T) { + const suffix = "Arran was here" + c := new(params.ChainConfig) + want := c.Description() + suffix + + hooks := &hookstest.Stub{ + DescriptionSuffix: "Arran was here", + } + hooks.Register(t).SetOnChainConfig(c, hooks) + require.Equal(t, want, c.Description(), "ChainConfigHooks.Description() is appended to non-extras equivalent") +} + +func TestChainConfigHooks_CheckConfigForkOrder(t *testing.T) { + err := errors.New("uh oh") + + c := new(params.ChainConfig) + require.NoError(t, c.CheckConfigForkOrder(), "CheckConfigForkOrder() with no hooks") + + hooks := &hookstest.Stub{ + CheckConfigForkOrderFn: func() error { return err }, + } + hooks.Register(t).SetOnChainConfig(c, hooks) + require.Equal(t, err, c.CheckConfigForkOrder(), "CheckConfigForkOrder() with error-producing hook") +} + +func TestChainConfigHooks_CheckConfigCompatible(t *testing.T) { + rng := ethtest.NewPseudoRand(1234567890) + newcfg := ¶ms.ChainConfig{ + ChainID: rng.BigUint64(), + } + headNumber := rng.Uint64() + headTimestamp := rng.Uint64() + + c := new(params.ChainConfig) + require.Nil(t, c.CheckCompatible(newcfg, headNumber, headTimestamp), "CheckCompatible() with no hooks") + + makeCompatErr := func(newcfg *params.ChainConfig, headNumber *big.Int, headTimestamp uint64) *params.ConfigCompatError { + return ¶ms.ConfigCompatError{ + What: fmt.Sprintf("ChainID: %v Head #: %v Head Time: %d", newcfg.ChainID, headNumber, headTimestamp), + } + } + hooks := &hookstest.Stub{ + CheckConfigCompatibleFn: makeCompatErr, + } + hooks.Register(t).SetOnChainConfig(c, hooks) + want := makeCompatErr(newcfg, new(big.Int).SetUint64(headNumber), headTimestamp) + require.Equal(t, want, c.CheckCompatible(newcfg, headNumber, headTimestamp), "CheckCompatible() with error-producing hook") +} diff --git a/params/json.libevm.go b/params/json.libevm.go new file mode 100644 index 00000000000..6b217cc1f8b --- /dev/null +++ b/params/json.libevm.go @@ -0,0 +1,125 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package params + +import ( + "encoding/json" + "fmt" + + "github.com/ava-labs/libevm/libevm/pseudo" +) + +var _ interface { + json.Marshaler + json.Unmarshaler +} = (*ChainConfig)(nil) + +// chainConfigWithoutMethods avoids infinite recurion into +// [ChainConfig.UnmarshalJSON]. +type chainConfigWithoutMethods ChainConfig + +// chainConfigWithExportedExtra supports JSON (un)marshalling of a [ChainConfig] +// while exposing the `extra` field as the "extra" JSON key. +type chainConfigWithExportedExtra struct { + *chainConfigWithoutMethods // embedded to achieve regular JSON unmarshalling + Extra *pseudo.Type `json:"extra"` // `c.extra` is otherwise unexported +} + +// UnmarshalJSON implements the [json.Unmarshaler] interface. +func (c *ChainConfig) UnmarshalJSON(data []byte) error { + switch reg := registeredExtras; { + case reg != nil && !reg.reuseJSONRoot: + return c.unmarshalJSONWithExtra(data) + + case reg != nil && reg.reuseJSONRoot: // although the latter is redundant, it's clearer + c.extra = reg.newChainConfig() + if err := json.Unmarshal(data, c.extra); err != nil { + c.extra = nil + return err + } + fallthrough // Important! We've only unmarshalled the extra field. + default: // reg == nil + return json.Unmarshal(data, (*chainConfigWithoutMethods)(c)) + } +} + +// unmarshalJSONWithExtra unmarshals JSON under the assumption that the +// registered [Extras] payload is in the JSON "extra" key. All other +// unmarshalling is performed as if no [Extras] were registered. +func (c *ChainConfig) unmarshalJSONWithExtra(data []byte) error { + cc := &chainConfigWithExportedExtra{ + chainConfigWithoutMethods: (*chainConfigWithoutMethods)(c), + Extra: registeredExtras.newChainConfig(), + } + if err := json.Unmarshal(data, cc); err != nil { + return err + } + c.extra = cc.Extra + return nil +} + +// MarshalJSON implements the [json.Marshaler] interface. +func (c *ChainConfig) MarshalJSON() ([]byte, error) { + switch reg := registeredExtras; { + case reg == nil: + return json.Marshal((*chainConfigWithoutMethods)(c)) + + case !reg.reuseJSONRoot: + return c.marshalJSONWithExtra() + + default: // reg.reuseJSONRoot == true + // The inverse of reusing the JSON root is merging two JSON buffers, + // which isn't supported by the native package. So we use + // map[string]json.RawMessage intermediates. + geth, err := toJSONRawMessages((*chainConfigWithoutMethods)(c)) + if err != nil { + return nil, err + } + extra, err := toJSONRawMessages(c.extra) + if err != nil { + return nil, err + } + + for k, v := range extra { + if _, ok := geth[k]; ok { + return nil, fmt.Errorf("duplicate JSON key %q in both %T and registered extra", k, c) + } + geth[k] = v + } + return json.Marshal(geth) + } +} + +// marshalJSONWithExtra is the inverse of unmarshalJSONWithExtra(). +func (c *ChainConfig) marshalJSONWithExtra() ([]byte, error) { + cc := &chainConfigWithExportedExtra{ + chainConfigWithoutMethods: (*chainConfigWithoutMethods)(c), + Extra: c.extra, + } + return json.Marshal(cc) +} + +func toJSONRawMessages(v any) (map[string]json.RawMessage, error) { + buf, err := json.Marshal(v) + if err != nil { + return nil, err + } + msgs := make(map[string]json.RawMessage) + if err := json.Unmarshal(buf, &msgs); err != nil { + return nil, err + } + return msgs, nil +} diff --git a/params/json.libevm_test.go b/params/json.libevm_test.go new file mode 100644 index 00000000000..70014e0d8d1 --- /dev/null +++ b/params/json.libevm_test.go @@ -0,0 +1,146 @@ +// Copyright 2024 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . +package params + +import ( + "bytes" + "encoding/json" + "math/big" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/ava-labs/libevm/libevm/pseudo" +) + +type nestedChainConfigExtra struct { + NestedFoo string `json:"foo"` + + NOOPHooks +} + +type rootJSONChainConfigExtra struct { + TopLevelFoo string `json:"foo"` + + NOOPHooks +} + +func TestChainConfigJSONRoundTrip(t *testing.T) { + tests := []struct { + name string + register func() + jsonInput string + want *ChainConfig + }{ + { + name: "no registered extras", + register: func() {}, + jsonInput: `{ + "chainId": 1234 + }`, + want: &ChainConfig{ + ChainID: big.NewInt(1234), + }, + }, + { + name: "reuse top-level JSON with non-pointer", + register: func() { + RegisterExtras(Extras[rootJSONChainConfigExtra, NOOPHooks]{ + ReuseJSONRoot: true, + }) + }, + jsonInput: `{ + "chainId": 5678, + "foo": "hello" + }`, + want: &ChainConfig{ + ChainID: big.NewInt(5678), + extra: pseudo.From(rootJSONChainConfigExtra{TopLevelFoo: "hello"}).Type, + }, + }, + { + name: "reuse top-level JSON with pointer", + register: func() { + RegisterExtras(Extras[*rootJSONChainConfigExtra, NOOPHooks]{ + ReuseJSONRoot: true, + }) + }, + jsonInput: `{ + "chainId": 5678, + "foo": "hello" + }`, + want: &ChainConfig{ + ChainID: big.NewInt(5678), + extra: pseudo.From(&rootJSONChainConfigExtra{TopLevelFoo: "hello"}).Type, + }, + }, + { + name: "nested JSON with non-pointer", + register: func() { + RegisterExtras(Extras[nestedChainConfigExtra, NOOPHooks]{ + ReuseJSONRoot: false, // explicit zero value only for tests + }) + }, + jsonInput: `{ + "chainId": 42, + "extra": {"foo": "world"} + }`, + want: &ChainConfig{ + ChainID: big.NewInt(42), + extra: pseudo.From(nestedChainConfigExtra{NestedFoo: "world"}).Type, + }, + }, + { + name: "nested JSON with pointer", + register: func() { + RegisterExtras(Extras[*nestedChainConfigExtra, NOOPHooks]{ + ReuseJSONRoot: false, // explicit zero value only for tests + }) + }, + jsonInput: `{ + "chainId": 42, + "extra": {"foo": "world"} + }`, + want: &ChainConfig{ + ChainID: big.NewInt(42), + extra: pseudo.From(&nestedChainConfigExtra{NestedFoo: "world"}).Type, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + TestOnlyClearRegisteredExtras() + t.Cleanup(TestOnlyClearRegisteredExtras) + tt.register() + + t.Run("json.Unmarshal()", func(t *testing.T) { + got := new(ChainConfig) + require.NoError(t, json.Unmarshal([]byte(tt.jsonInput), got)) + require.Equal(t, tt.want, got) + }) + + t.Run("json.Marshal()", func(t *testing.T) { + var want bytes.Buffer + require.NoError(t, json.Compact(&want, []byte(tt.jsonInput)), "json.Compact()") + + got, err := json.Marshal(tt.want) + require.NoError(t, err, "json.Marshal()") + require.Equal(t, want.String(), string(got)) + }) + }) + } +} diff --git a/params/protocol_params.go b/params/protocol_params.go index 7eb63e89ac6..a12b7b64873 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -19,7 +19,7 @@ package params import ( "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) const ( diff --git a/rlp/decode.go b/rlp/decode.go index 9b17d2d8108..e068dd97ad5 100644 --- a/rlp/decode.go +++ b/rlp/decode.go @@ -28,7 +28,7 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/rlp/internal/rlpstruct" + "github.com/ava-labs/libevm/rlp/internal/rlpstruct" "github.com/holiman/uint256" ) diff --git a/rlp/decode_test.go b/rlp/decode_test.go index 07d9c579a6a..2ca0b8badc0 100644 --- a/rlp/decode_test.go +++ b/rlp/decode_test.go @@ -27,7 +27,7 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/common/math" + "github.com/ava-labs/libevm/common/math" "github.com/holiman/uint256" ) diff --git a/rlp/encbuffer_example_test.go b/rlp/encbuffer_example_test.go index ee15d82a77b..aee15398736 100644 --- a/rlp/encbuffer_example_test.go +++ b/rlp/encbuffer_example_test.go @@ -20,7 +20,7 @@ import ( "bytes" "fmt" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" ) func ExampleEncoderBuffer() { diff --git a/rlp/encode.go b/rlp/encode.go index ffb42b29977..266b46f9278 100644 --- a/rlp/encode.go +++ b/rlp/encode.go @@ -23,7 +23,7 @@ import ( "math/big" "reflect" - "github.com/ethereum/go-ethereum/rlp/internal/rlpstruct" + "github.com/ava-labs/libevm/rlp/internal/rlpstruct" "github.com/holiman/uint256" ) diff --git a/rlp/encode_test.go b/rlp/encode_test.go index 314958eb560..6e49183bd87 100644 --- a/rlp/encode_test.go +++ b/rlp/encode_test.go @@ -26,7 +26,7 @@ import ( "sync" "testing" - "github.com/ethereum/go-ethereum/common/math" + "github.com/ava-labs/libevm/common/math" "github.com/holiman/uint256" ) diff --git a/rlp/encoder_example_test.go b/rlp/encoder_example_test.go index 4cd3cb86737..7de84e58fa0 100644 --- a/rlp/encoder_example_test.go +++ b/rlp/encoder_example_test.go @@ -20,7 +20,7 @@ import ( "fmt" "io" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" ) type MyCoolType struct { diff --git a/rlp/iterator_test.go b/rlp/iterator_test.go index a22aaec8621..1c790ca599f 100644 --- a/rlp/iterator_test.go +++ b/rlp/iterator_test.go @@ -19,7 +19,7 @@ package rlp import ( "testing" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common/hexutil" ) // TestIterator tests some basic things about the ListIterator. A more diff --git a/rlp/rlpgen/gen.go b/rlp/rlpgen/gen.go index 0c658648269..150797c7aa5 100644 --- a/rlp/rlpgen/gen.go +++ b/rlp/rlpgen/gen.go @@ -23,7 +23,7 @@ import ( "go/types" "sort" - "github.com/ethereum/go-ethereum/rlp/internal/rlpstruct" + "github.com/ava-labs/libevm/rlp/internal/rlpstruct" ) // buildContext keeps the data needed for make*Op. diff --git a/rlp/rlpgen/main.go b/rlp/rlpgen/main.go index b3a74b9df13..3e9310458af 100644 --- a/rlp/rlpgen/main.go +++ b/rlp/rlpgen/main.go @@ -27,7 +27,7 @@ import ( "golang.org/x/tools/go/packages" ) -const pathOfPackageRLP = "github.com/ethereum/go-ethereum/rlp" +const pathOfPackageRLP = "github.com/ava-labs/libevm/rlp" func main() { var ( diff --git a/rlp/rlpgen/testdata/bigint.out.txt b/rlp/rlpgen/testdata/bigint.out.txt index f54d1faa15f..aa7274eb20c 100644 --- a/rlp/rlpgen/testdata/bigint.out.txt +++ b/rlp/rlpgen/testdata/bigint.out.txt @@ -1,6 +1,6 @@ package test -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *Test) EncodeRLP(_w io.Writer) error { diff --git a/rlp/rlpgen/testdata/nil.out.txt b/rlp/rlpgen/testdata/nil.out.txt index e0d5dcebad3..7704e86d0c6 100644 --- a/rlp/rlpgen/testdata/nil.out.txt +++ b/rlp/rlpgen/testdata/nil.out.txt @@ -1,6 +1,6 @@ package test -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *Test) EncodeRLP(_w io.Writer) error { diff --git a/rlp/rlpgen/testdata/optional.out.txt b/rlp/rlpgen/testdata/optional.out.txt index 02df8e457f9..560571d4e9c 100644 --- a/rlp/rlpgen/testdata/optional.out.txt +++ b/rlp/rlpgen/testdata/optional.out.txt @@ -1,6 +1,6 @@ package test -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *Test) EncodeRLP(_w io.Writer) error { diff --git a/rlp/rlpgen/testdata/rawvalue.in.txt b/rlp/rlpgen/testdata/rawvalue.in.txt index 3a657bc907b..16ed9ad6bb1 100644 --- a/rlp/rlpgen/testdata/rawvalue.in.txt +++ b/rlp/rlpgen/testdata/rawvalue.in.txt @@ -2,7 +2,7 @@ package test -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" type Test struct { RawValue rlp.RawValue diff --git a/rlp/rlpgen/testdata/rawvalue.out.txt b/rlp/rlpgen/testdata/rawvalue.out.txt index 3607c986367..7da1075f758 100644 --- a/rlp/rlpgen/testdata/rawvalue.out.txt +++ b/rlp/rlpgen/testdata/rawvalue.out.txt @@ -1,6 +1,6 @@ package test -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *Test) EncodeRLP(_w io.Writer) error { diff --git a/rlp/rlpgen/testdata/uint256.out.txt b/rlp/rlpgen/testdata/uint256.out.txt index 5e6d3ed992c..3ad38e8e8e8 100644 --- a/rlp/rlpgen/testdata/uint256.out.txt +++ b/rlp/rlpgen/testdata/uint256.out.txt @@ -1,6 +1,6 @@ package test -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "github.com/holiman/uint256" import "io" diff --git a/rlp/rlpgen/testdata/uints.out.txt b/rlp/rlpgen/testdata/uints.out.txt index 1a354956a40..b1c672786f2 100644 --- a/rlp/rlpgen/testdata/uints.out.txt +++ b/rlp/rlpgen/testdata/uints.out.txt @@ -1,6 +1,6 @@ package test -import "github.com/ethereum/go-ethereum/rlp" +import "github.com/ava-labs/libevm/rlp" import "io" func (obj *Test) EncodeRLP(_w io.Writer) error { diff --git a/rlp/typecache.go b/rlp/typecache.go index 3e37c9d2fcc..bcfa3eb32a4 100644 --- a/rlp/typecache.go +++ b/rlp/typecache.go @@ -22,7 +22,7 @@ import ( "sync" "sync/atomic" - "github.com/ethereum/go-ethereum/rlp/internal/rlpstruct" + "github.com/ava-labs/libevm/rlp/internal/rlpstruct" ) // typeinfo is an entry in the type cache. diff --git a/rpc/client.go b/rpc/client.go index 2b0016db8f4..dcd24d36d76 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -28,7 +28,7 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) var ( diff --git a/rpc/client_example_test.go b/rpc/client_example_test.go index 044b57a9c43..86791159c73 100644 --- a/rpc/client_example_test.go +++ b/rpc/client_example_test.go @@ -21,8 +21,8 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/rpc" ) // In this example, our client wishes to track the latest 'block number' diff --git a/rpc/client_opt_test.go b/rpc/client_opt_test.go index d7cc2572a77..ce3de06d045 100644 --- a/rpc/client_opt_test.go +++ b/rpc/client_opt_test.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/rpc" ) // This example configures a HTTP-based RPC client with two options - one setting the diff --git a/rpc/client_test.go b/rpc/client_test.go index ac02ad33cf6..a8f96eeedc8 100644 --- a/rpc/client_test.go +++ b/rpc/client_test.go @@ -34,7 +34,7 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) func TestClientRequest(t *testing.T) { diff --git a/rpc/endpoints.go b/rpc/endpoints.go index d78ebe2858b..da5d88e135c 100644 --- a/rpc/endpoints.go +++ b/rpc/endpoints.go @@ -20,7 +20,7 @@ import ( "net" "strings" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) // StartIPCEndpoint starts an IPC endpoint. diff --git a/rpc/handler.go b/rpc/handler.go index f44e4d7b01d..1a1a5b0fe3d 100644 --- a/rpc/handler.go +++ b/rpc/handler.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) // handler handles JSON-RPC messages. There is one handler per connection. Note that diff --git a/rpc/ipc.go b/rpc/ipc.go index a08245b2708..37f7a5e6a6a 100644 --- a/rpc/ipc.go +++ b/rpc/ipc.go @@ -20,8 +20,8 @@ import ( "context" "net" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/p2p/netutil" ) // ServeListener accepts connections on l, serving JSON-RPC on them. diff --git a/rpc/ipc_unix.go b/rpc/ipc_unix.go index 33c1cad5494..14a9666ab57 100644 --- a/rpc/ipc_unix.go +++ b/rpc/ipc_unix.go @@ -26,7 +26,7 @@ import ( "os" "path/filepath" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) const ( diff --git a/rpc/metrics.go b/rpc/metrics.go index ef7449ce05e..78dfb8382e2 100644 --- a/rpc/metrics.go +++ b/rpc/metrics.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/metrics" ) var ( diff --git a/rpc/server.go b/rpc/server.go index e2f9120aa2b..646a2fe480e 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -22,7 +22,7 @@ import ( "sync" "sync/atomic" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) const MetadataApi = "rpc" diff --git a/rpc/service.go b/rpc/service.go index a180b8db93e..ee67941003b 100644 --- a/rpc/service.go +++ b/rpc/service.go @@ -25,7 +25,7 @@ import ( "sync" "unicode" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) var ( diff --git a/rpc/subscription_test.go b/rpc/subscription_test.go index 3a131c8e6bd..876b1174800 100644 --- a/rpc/subscription_test.go +++ b/rpc/subscription_test.go @@ -28,8 +28,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) func TestNewID(t *testing.T) { diff --git a/rpc/types.go b/rpc/types.go index d1240817861..5aa67e9b0af 100644 --- a/rpc/types.go +++ b/rpc/types.go @@ -24,8 +24,8 @@ import ( "math" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) // API describes the set of methods offered over the RPC interface diff --git a/rpc/types_test.go b/rpc/types_test.go index 617f441d916..b9ec5144aea 100644 --- a/rpc/types_test.go +++ b/rpc/types_test.go @@ -21,8 +21,8 @@ import ( "reflect" "testing" - "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" ) func TestBlockNumberJSONUnmarshal(t *testing.T) { diff --git a/rpc/websocket.go b/rpc/websocket.go index 538e53a31b7..32e3730b3d2 100644 --- a/rpc/websocket.go +++ b/rpc/websocket.go @@ -28,7 +28,7 @@ import ( "time" mapset "github.com/deckarep/golang-set/v2" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" "github.com/gorilla/websocket" ) diff --git a/signer/core/api.go b/signer/core/api.go index a32f24cb18c..1c6e868cf49 100644 --- a/signer/core/api.go +++ b/signer/core/api.go @@ -26,18 +26,18 @@ import ( "os" "reflect" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/accounts/scwallet" - "github.com/ethereum/go-ethereum/accounts/usbwallet" - "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/internal/ethapi" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/ethereum/go-ethereum/signer/storage" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/accounts/scwallet" + "github.com/ava-labs/libevm/accounts/usbwallet" + "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/internal/ethapi" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rpc" + "github.com/ava-labs/libevm/signer/core/apitypes" + "github.com/ava-labs/libevm/signer/storage" ) const ( diff --git a/signer/core/api_test.go b/signer/core/api_test.go index 69229dadaf2..67f63211955 100644 --- a/signer/core/api_test.go +++ b/signer/core/api_test.go @@ -26,17 +26,17 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/signer/core" - "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/ethereum/go-ethereum/signer/fourbyte" - "github.com/ethereum/go-ethereum/signer/storage" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/signer/core" + "github.com/ava-labs/libevm/signer/core/apitypes" + "github.com/ava-labs/libevm/signer/fourbyte" + "github.com/ava-labs/libevm/signer/storage" ) // Used for testing diff --git a/signer/core/apitypes/signed_data_internal_test.go b/signer/core/apitypes/signed_data_internal_test.go index 8067893c213..efa8a12138f 100644 --- a/signer/core/apitypes/signed_data_internal_test.go +++ b/signer/core/apitypes/signed_data_internal_test.go @@ -21,9 +21,9 @@ import ( "math/big" "testing" - "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" ) func TestBytesPadding(t *testing.T) { diff --git a/signer/core/apitypes/types.go b/signer/core/apitypes/types.go index 6bfcd2a727b..9d48cc2746e 100644 --- a/signer/core/apitypes/types.go +++ b/signer/core/apitypes/types.go @@ -28,12 +28,12 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/accounts" - "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/core/types" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts" + "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/core/types" + "github.com/ava-labs/libevm/crypto" ) var typedDataReferenceTypeRegexp = regexp.MustCompile(`^[A-Za-z](\w*)(\[\])?$`) diff --git a/signer/core/auditlog.go b/signer/core/auditlog.go index d2207c9eb8d..363d3fc2e1c 100644 --- a/signer/core/auditlog.go +++ b/signer/core/auditlog.go @@ -21,11 +21,11 @@ import ( "encoding/json" "os" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/signer/core/apitypes" "golang.org/x/exp/slog" ) diff --git a/signer/core/cliui.go b/signer/core/cliui.go index b1bd3206ed3..b427ca0b067 100644 --- a/signer/core/cliui.go +++ b/signer/core/cliui.go @@ -25,10 +25,10 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/console/prompt" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/console/prompt" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/log" ) type CommandlineUI struct { diff --git a/signer/core/gnosis_safe.go b/signer/core/gnosis_safe.go index 01724e53836..310b4f1ec89 100644 --- a/signer/core/gnosis_safe.go +++ b/signer/core/gnosis_safe.go @@ -20,10 +20,10 @@ import ( "fmt" "math/big" - "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/signer/core/apitypes" + "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/signer/core/apitypes" ) // GnosisSafeTx is a type to parse the safe-tx returned by the relayer, diff --git a/signer/core/signed_data.go b/signer/core/signed_data.go index c6ae7b12743..9f007913786 100644 --- a/signer/core/signed_data.go +++ b/signer/core/signed_data.go @@ -23,14 +23,14 @@ import ( "fmt" "mime" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/consensus/clique" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/consensus/clique" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/signer/core/apitypes" ) // sign receives a request and produces a signature diff --git a/signer/core/signed_data_test.go b/signer/core/signed_data_test.go index 1cf8b4bf381..692e345978d 100644 --- a/signer/core/signed_data_test.go +++ b/signer/core/signed_data_test.go @@ -27,13 +27,13 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/accounts/keystore" - "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/signer/core" - "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/ava-labs/libevm/accounts/keystore" + "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/signer/core" + "github.com/ava-labs/libevm/signer/core/apitypes" ) var typesStandard = apitypes.Types{ diff --git a/signer/core/stdioui.go b/signer/core/stdioui.go index a0ce6844171..299b91a7427 100644 --- a/signer/core/stdioui.go +++ b/signer/core/stdioui.go @@ -19,9 +19,9 @@ package core import ( "context" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rpc" ) type StdIOUI struct { diff --git a/signer/core/uiapi.go b/signer/core/uiapi.go index b8c3acfb4d3..dda74830303 100644 --- a/signer/core/uiapi.go +++ b/signer/core/uiapi.go @@ -24,11 +24,11 @@ import ( "math/big" "os" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/accounts/keystore" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/crypto" ) // UIServerAPI implements methods Clef provides for a UI to query, in the bidirectional communication diff --git a/signer/fourbyte/abi.go b/signer/fourbyte/abi.go index 352abc59e18..b8406dfeced 100644 --- a/signer/fourbyte/abi.go +++ b/signer/fourbyte/abi.go @@ -22,8 +22,8 @@ import ( "fmt" "strings" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/common" ) // decodedCallData is an internal type to represent a method call parsed according diff --git a/signer/fourbyte/abi_test.go b/signer/fourbyte/abi_test.go index 9656732dff9..ebe1c49adb6 100644 --- a/signer/fourbyte/abi_test.go +++ b/signer/fourbyte/abi_test.go @@ -22,8 +22,8 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/common" ) func verify(t *testing.T, jsondata, calldata string, exp []interface{}) { diff --git a/signer/fourbyte/fourbyte_test.go b/signer/fourbyte/fourbyte_test.go index a3dc3b51170..cb74fd77fc7 100644 --- a/signer/fourbyte/fourbyte_test.go +++ b/signer/fourbyte/fourbyte_test.go @@ -21,8 +21,8 @@ import ( "fmt" "testing" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/accounts/abi" + "github.com/ava-labs/libevm/common" ) // Tests that all the selectors contained in the 4byte database are valid. diff --git a/signer/fourbyte/validation.go b/signer/fourbyte/validation.go index 58111e8e00c..f4c7eda1737 100644 --- a/signer/fourbyte/validation.go +++ b/signer/fourbyte/validation.go @@ -22,8 +22,8 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/signer/core/apitypes" ) // ValidateTransaction does a number of checks on the supplied transaction, and diff --git a/signer/fourbyte/validation_test.go b/signer/fourbyte/validation_test.go index 74fed9fe012..4f162ee9852 100644 --- a/signer/fourbyte/validation_test.go +++ b/signer/fourbyte/validation_test.go @@ -20,9 +20,9 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/signer/core/apitypes" ) func mixAddr(a string) (*common.MixedcaseAddress, error) { diff --git a/signer/rules/rules.go b/signer/rules/rules.go index c9921e57a95..412ead64090 100644 --- a/signer/rules/rules.go +++ b/signer/rules/rules.go @@ -24,11 +24,11 @@ import ( "strings" "github.com/dop251/goja" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/internal/jsre/deps" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/signer/core" - "github.com/ethereum/go-ethereum/signer/storage" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/internal/jsre/deps" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/signer/core" + "github.com/ava-labs/libevm/signer/storage" ) // consoleOutput is an override for the console.log and console.error methods to diff --git a/signer/rules/rules_test.go b/signer/rules/rules_test.go index d27de22b29a..0ae9bfbd8df 100644 --- a/signer/rules/rules_test.go +++ b/signer/rules/rules_test.go @@ -22,14 +22,14 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/signer/core" - "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/ethereum/go-ethereum/signer/storage" + "github.com/ava-labs/libevm/accounts" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/internal/ethapi" + "github.com/ava-labs/libevm/signer/core" + "github.com/ava-labs/libevm/signer/core/apitypes" + "github.com/ava-labs/libevm/signer/storage" ) const JS = ` diff --git a/signer/storage/aes_gcm_storage.go b/signer/storage/aes_gcm_storage.go index 928d643dd61..4a8f277afb9 100644 --- a/signer/storage/aes_gcm_storage.go +++ b/signer/storage/aes_gcm_storage.go @@ -24,7 +24,7 @@ import ( "io" "os" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/log" ) type storedCredential struct { diff --git a/signer/storage/aes_gcm_storage_test.go b/signer/storage/aes_gcm_storage_test.go index a223b1a6b4e..374a00d91b0 100644 --- a/signer/storage/aes_gcm_storage_test.go +++ b/signer/storage/aes_gcm_storage_test.go @@ -23,8 +23,8 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" "github.com/mattn/go-colorable" "golang.org/x/exp/slog" ) diff --git a/tests/block_test.go b/tests/block_test.go index fb355085fd8..2f31007c193 100644 --- a/tests/block_test.go +++ b/tests/block_test.go @@ -21,8 +21,8 @@ import ( "runtime" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" ) func TestBlockchain(t *testing.T) { diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 53d733f1c44..d2f4713e4fc 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -26,22 +26,22 @@ import ( "os" "reflect" - "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/consensus/beacon" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "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/consensus/beacon" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" ) // A BlockTest checks handling of entire blocks. diff --git a/tests/difficulty_test.go b/tests/difficulty_test.go index 03e14df7c4d..dd65ea11a95 100644 --- a/tests/difficulty_test.go +++ b/tests/difficulty_test.go @@ -20,7 +20,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) var ( diff --git a/tests/difficulty_test_util.go b/tests/difficulty_test_util.go index 62b978f9ef2..2759f1f5840 100644 --- a/tests/difficulty_test_util.go +++ b/tests/difficulty_test_util.go @@ -20,11 +20,11 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/math" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" ) //go:generate go run github.com/fjl/gencodec -type DifficultyTest -field-override difficultyTestMarshaling -out gen_difficultytest.go diff --git a/tests/fuzzers/bls12381/bls12381_fuzz.go b/tests/fuzzers/bls12381/bls12381_fuzz.go index 9a5c566540f..79e839dec8b 100644 --- a/tests/fuzzers/bls12381/bls12381_fuzz.go +++ b/tests/fuzzers/bls12381/bls12381_fuzz.go @@ -30,8 +30,8 @@ import ( gnark "github.com/consensys/gnark-crypto/ecc/bls12-381" "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" "github.com/consensys/gnark-crypto/ecc/bls12-381/fr" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/bls12381" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto/bls12381" blst "github.com/supranational/blst/bindings/go" ) diff --git a/tests/fuzzers/bls12381/precompile_fuzzer.go b/tests/fuzzers/bls12381/precompile_fuzzer.go index 763ed56e9f7..69f1111dbef 100644 --- a/tests/fuzzers/bls12381/precompile_fuzzer.go +++ b/tests/fuzzers/bls12381/precompile_fuzzer.go @@ -20,8 +20,8 @@ import ( "bytes" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" ) const ( diff --git a/tests/fuzzers/bn256/bn256_fuzz.go b/tests/fuzzers/bn256/bn256_fuzz.go index 75f7d59deee..37284675adf 100644 --- a/tests/fuzzers/bn256/bn256_fuzz.go +++ b/tests/fuzzers/bn256/bn256_fuzz.go @@ -23,8 +23,8 @@ import ( "math/big" "github.com/consensys/gnark-crypto/ecc/bn254" - cloudflare "github.com/ethereum/go-ethereum/crypto/bn256/cloudflare" - google "github.com/ethereum/go-ethereum/crypto/bn256/google" + cloudflare "github.com/ava-labs/libevm/crypto/bn256/cloudflare" + google "github.com/ava-labs/libevm/crypto/bn256/google" ) func getG1Points(input io.Reader) (*cloudflare.G1, *google.G1, *bn254.G1Affine) { diff --git a/tests/fuzzers/difficulty/difficulty-fuzz.go b/tests/fuzzers/difficulty/difficulty-fuzz.go index fbbd7f6876b..73e6cd8e912 100644 --- a/tests/fuzzers/difficulty/difficulty-fuzz.go +++ b/tests/fuzzers/difficulty/difficulty-fuzz.go @@ -23,8 +23,8 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/consensus/ethash" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/consensus/ethash" + "github.com/ava-labs/libevm/core/types" ) type fuzzer struct { diff --git a/tests/fuzzers/rangeproof/rangeproof-fuzzer.go b/tests/fuzzers/rangeproof/rangeproof-fuzzer.go index dcafebb265d..3a0037e4d26 100644 --- a/tests/fuzzers/rangeproof/rangeproof-fuzzer.go +++ b/tests/fuzzers/rangeproof/rangeproof-fuzzer.go @@ -22,11 +22,11 @@ import ( "fmt" "io" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb/memorydb" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb/memorydb" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/triedb" "golang.org/x/exp/slices" ) diff --git a/tests/fuzzers/secp256k1/secp_test.go b/tests/fuzzers/secp256k1/secp_test.go index ca3039764b4..79099803238 100644 --- a/tests/fuzzers/secp256k1/secp_test.go +++ b/tests/fuzzers/secp256k1/secp_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/btcsuite/btcd/btcec/v2" - "github.com/ethereum/go-ethereum/crypto/secp256k1" + "github.com/ava-labs/libevm/crypto/secp256k1" ) func TestFuzzer(t *testing.T) { diff --git a/tests/fuzzers/txfetcher/txfetcher_fuzzer.go b/tests/fuzzers/txfetcher/txfetcher_fuzzer.go index 51f2fc3b4d9..75a5581e0d2 100644 --- a/tests/fuzzers/txfetcher/txfetcher_fuzzer.go +++ b/tests/fuzzers/txfetcher/txfetcher_fuzzer.go @@ -23,10 +23,10 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/fetcher" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/mclock" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/eth/fetcher" ) var ( diff --git a/tests/gen_btheader.go b/tests/gen_btheader.go index 80ad89e03bf..4c129a55519 100644 --- a/tests/gen_btheader.go +++ b/tests/gen_btheader.go @@ -6,10 +6,10 @@ import ( "encoding/json" "math/big" - "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/core/types" + "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/core/types" ) var _ = (*btHeaderMarshaling)(nil) diff --git a/tests/gen_difficultytest.go b/tests/gen_difficultytest.go index cd15ae31b5d..f056466d778 100644 --- a/tests/gen_difficultytest.go +++ b/tests/gen_difficultytest.go @@ -6,8 +6,8 @@ import ( "encoding/json" "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 _ = (*difficultyTestMarshaling)(nil) diff --git a/tests/gen_stenv.go b/tests/gen_stenv.go index a5bd0d5fcb8..a6a2920acf9 100644 --- a/tests/gen_stenv.go +++ b/tests/gen_stenv.go @@ -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) diff --git a/tests/gen_sttransaction.go b/tests/gen_sttransaction.go index 9b5aecbfe6b..7a98bd64765 100644 --- a/tests/gen_sttransaction.go +++ b/tests/gen_sttransaction.go @@ -6,10 +6,10 @@ import ( "encoding/json" "math/big" - "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/core/types" + "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/core/types" ) var _ = (*stTransactionMarshaling)(nil) diff --git a/tests/init.go b/tests/init.go index 99b7e4d3331..e77bf89468c 100644 --- a/tests/init.go +++ b/tests/init.go @@ -21,7 +21,7 @@ import ( "math/big" "sort" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) func u64(val uint64) *uint64 { return &val } diff --git a/tests/init_test.go b/tests/init_test.go index e9bb99dc7d0..3028bd14a33 100644 --- a/tests/init_test.go +++ b/tests/init_test.go @@ -30,7 +30,7 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) var ( diff --git a/tests/rlp_test_util.go b/tests/rlp_test_util.go index e4bd5450a84..0517f1baa91 100644 --- a/tests/rlp_test_util.go +++ b/tests/rlp_test_util.go @@ -24,7 +24,7 @@ import ( "math/big" "strings" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" ) // RLPTest is the JSON structure of a single RLP test. diff --git a/tests/state_test.go b/tests/state_test.go index 1d749d8bcf5..888717980b4 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -30,12 +30,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth/tracers/logger" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/eth/tracers/logger" "github.com/holiman/uint256" ) diff --git a/tests/state_test_util.go b/tests/state_test_util.go index c916d26d412..9db0227c843 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -25,23 +25,23 @@ import ( "strconv" "strings" - "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/consensus/misc/eip4844" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/state/snapshot" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "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/consensus/misc/eip4844" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/state" + "github.com/ava-labs/libevm/core/state/snapshot" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/core/vm" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/triedb" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" "github.com/holiman/uint256" "golang.org/x/crypto/sha3" ) diff --git a/tests/transaction_test.go b/tests/transaction_test.go index cb0f2623189..2908fa80eb5 100644 --- a/tests/transaction_test.go +++ b/tests/transaction_test.go @@ -19,7 +19,7 @@ package tests import ( "testing" - "github.com/ethereum/go-ethereum/params" + "github.com/ava-labs/libevm/params" ) func TestTransaction(t *testing.T) { diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go index 391aa57584c..e4cc23a5ad2 100644 --- a/tests/transaction_test_util.go +++ b/tests/transaction_test_util.go @@ -19,12 +19,12 @@ package tests import ( "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" + "github.com/ava-labs/libevm/core" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/rlp" ) // TransactionTest checks RLP decoding and sender derivation of transactions. diff --git a/trie/committer.go b/trie/committer.go index 4e2f7b8bd6a..bede34ddaa3 100644 --- a/trie/committer.go +++ b/trie/committer.go @@ -19,8 +19,8 @@ package trie import ( "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/trie/trienode" ) // committer is the tool used for the trie Commit operation. The committer will diff --git a/trie/database_test.go b/trie/database_test.go index aed508b368c..5f4cf16e8e1 100644 --- a/trie/database_test.go +++ b/trie/database_test.go @@ -17,12 +17,12 @@ package trie import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/triedb/database" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/triedb/database" ) // testReader implements database.Reader interface, providing function to diff --git a/trie/errors.go b/trie/errors.go index 7be7041c7f0..97cabf16460 100644 --- a/trie/errors.go +++ b/trie/errors.go @@ -20,7 +20,7 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // ErrCommitted is returned when a already committed trie is requested for usage. diff --git a/trie/hasher.go b/trie/hasher.go index 1e063d8020b..726b9256ad4 100644 --- a/trie/hasher.go +++ b/trie/hasher.go @@ -19,8 +19,8 @@ package trie import ( "sync" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" "golang.org/x/crypto/sha3" ) diff --git a/trie/iterator.go b/trie/iterator.go index 83ccc0740f3..c02e1826d02 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -21,8 +21,8 @@ import ( "container/heap" "errors" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" ) // NodeResolver is used for looking up trie nodes before reaching into the real diff --git a/trie/iterator_test.go b/trie/iterator_test.go index 41e83f6cb69..71a7870015f 100644 --- a/trie/iterator_test.go +++ b/trie/iterator_test.go @@ -22,11 +22,11 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/trie/trienode" ) func TestEmptyIterator(t *testing.T) { diff --git a/trie/node.go b/trie/node.go index 15bbf62f1c9..593a57a86a6 100644 --- a/trie/node.go +++ b/trie/node.go @@ -21,8 +21,8 @@ import ( "io" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/rlp" ) var indices = []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "[17]"} diff --git a/trie/node_enc.go b/trie/node_enc.go index 1b2eca682f0..0b9d8174761 100644 --- a/trie/node_enc.go +++ b/trie/node_enc.go @@ -17,7 +17,7 @@ package trie import ( - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/rlp" ) func nodeToBytes(n node) []byte { diff --git a/trie/node_test.go b/trie/node_test.go index 9b8b33748fa..c125ac9b8b9 100644 --- a/trie/node_test.go +++ b/trie/node_test.go @@ -20,8 +20,8 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" ) func newTestFullNode(v []byte) []interface{} { diff --git a/trie/proof.go b/trie/proof.go index fd892fb4bec..a7874afd35b 100644 --- a/trie/proof.go +++ b/trie/proof.go @@ -21,9 +21,9 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" ) // Prove constructs a merkle proof for key. The result contains all encoded nodes diff --git a/trie/proof_test.go b/trie/proof_test.go index 5471d0efa6b..c757c7614f5 100644 --- a/trie/proof_test.go +++ b/trie/proof_test.go @@ -24,10 +24,10 @@ import ( mrand "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb/memorydb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb/memorydb" "golang.org/x/exp/slices" ) diff --git a/trie/secure_trie.go b/trie/secure_trie.go index efd4dfb5d33..e2d5cc6855d 100644 --- a/trie/secure_trie.go +++ b/trie/secure_trie.go @@ -17,11 +17,11 @@ package trie import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/triedb/database" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/triedb/database" ) // SecureTrie is the old name of StateTrie. diff --git a/trie/secure_trie_test.go b/trie/secure_trie_test.go index 0a6fd688b7e..cc52fbf5fed 100644 --- a/trie/secure_trie_test.go +++ b/trie/secure_trie_test.go @@ -23,11 +23,11 @@ import ( "sync" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/trie/trienode" ) func newEmptySecure() *StateTrie { diff --git a/trie/stacktrie.go b/trie/stacktrie.go index f2f5355c49e..628ba9ffd3b 100644 --- a/trie/stacktrie.go +++ b/trie/stacktrie.go @@ -21,10 +21,10 @@ import ( "errors" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" ) var ( diff --git a/trie/stacktrie_fuzzer_test.go b/trie/stacktrie_fuzzer_test.go index 50b5c4de52f..d2557a73663 100644 --- a/trie/stacktrie_fuzzer_test.go +++ b/trie/stacktrie_fuzzer_test.go @@ -22,11 +22,11 @@ import ( "fmt" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/trie/trienode" "golang.org/x/crypto/sha3" "golang.org/x/exp/slices" ) diff --git a/trie/stacktrie_test.go b/trie/stacktrie_test.go index 3a0e1cb2607..708618b5918 100644 --- a/trie/stacktrie_test.go +++ b/trie/stacktrie_test.go @@ -22,10 +22,10 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/trie/testutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/trie/testutil" "github.com/stretchr/testify/assert" "golang.org/x/exp/slices" ) diff --git a/trie/sync.go b/trie/sync.go index 589d28364b8..989cab70c1b 100644 --- a/trie/sync.go +++ b/trie/sync.go @@ -21,13 +21,13 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/prque" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/prque" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" ) // ErrNotRequested is returned by the trie sync when it's requested to process a diff --git a/trie/sync_test.go b/trie/sync_test.go index 7bc68c041fd..3bad8cb339c 100644 --- a/trie/sync_test.go +++ b/trie/sync_test.go @@ -22,13 +22,13 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethdb/memorydb" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/ethdb/memorydb" + "github.com/ava-labs/libevm/trie/trienode" ) // makeTestTrie create a sample test trie to test node-wise reconstruction. diff --git a/trie/testutil/utils.go b/trie/testutil/utils.go index a75d0431b0f..0fa7cde6a2d 100644 --- a/trie/testutil/utils.go +++ b/trie/testutil/utils.go @@ -21,9 +21,9 @@ import ( "encoding/binary" mrand "math/rand" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/trie/trienode" ) // Prng is a pseudo random number generator seeded by strong randomness. diff --git a/trie/tracer.go b/trie/tracer.go index 5786af4d3ec..c2b88699a77 100644 --- a/trie/tracer.go +++ b/trie/tracer.go @@ -17,7 +17,7 @@ package trie import ( - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // tracer tracks the changes of trie nodes. During the trie operations, diff --git a/trie/tracer_test.go b/trie/tracer_test.go index 27e42d497af..ec578af7603 100644 --- a/trie/tracer_test.go +++ b/trie/tracer_test.go @@ -20,10 +20,10 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/trie/trienode" ) var ( diff --git a/trie/trie.go b/trie/trie.go index 12764e18d1b..264b6d11a8c 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -22,11 +22,11 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/triedb/database" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/triedb/database" ) // Trie is a Merkle Patricia Trie. Use New to create a trie that sits on diff --git a/trie/trie_id.go b/trie/trie_id.go index 8ab490ca3b1..7a0612c7189 100644 --- a/trie/trie_id.go +++ b/trie/trie_id.go @@ -16,7 +16,7 @@ package trie -import "github.com/ethereum/go-ethereum/common" +import "github.com/ava-labs/libevm/common" // ID is the identifier for uniquely identifying a trie. type ID struct { diff --git a/trie/trie_reader.go b/trie/trie_reader.go index 42bc4316fe6..d54d7b6df2f 100644 --- a/trie/trie_reader.go +++ b/trie/trie_reader.go @@ -17,11 +17,11 @@ package trie import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie/triestate" - "github.com/ethereum/go-ethereum/triedb/database" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie/triestate" + "github.com/ava-labs/libevm/triedb/database" ) // trieReader is a wrapper of the underlying node reader. It's not safe diff --git a/trie/trie_test.go b/trie/trie_test.go index 379a866f7ea..40a8f60b3b7 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -30,13 +30,13 @@ import ( "testing/quick" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie/trienode" "github.com/holiman/uint256" "golang.org/x/crypto/sha3" ) diff --git a/trie/trienode/node.go b/trie/trienode/node.go index 95315c2e9a4..8bd0a18ba38 100644 --- a/trie/trienode/node.go +++ b/trie/trienode/node.go @@ -21,7 +21,7 @@ import ( "sort" "strings" - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // Node is a wrapper which contains the encoded blob of the trie node and its diff --git a/trie/trienode/proof.go b/trie/trienode/proof.go index 012f0087dde..0a4cf78ae27 100644 --- a/trie/trienode/proof.go +++ b/trie/trienode/proof.go @@ -20,10 +20,10 @@ import ( "errors" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rlp" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/rlp" ) // ProofSet stores a set of trie nodes. It implements trie.Database and can also diff --git a/trie/triestate/state.go b/trie/triestate/state.go index 4c47e9c3973..a85b1543c28 100644 --- a/trie/triestate/state.go +++ b/trie/triestate/state.go @@ -21,11 +21,11 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie/trienode" "golang.org/x/crypto/sha3" ) diff --git a/trie/utils/verkle.go b/trie/utils/verkle.go index ce059edc643..2b31eab5d1b 100644 --- a/trie/utils/verkle.go +++ b/trie/utils/verkle.go @@ -21,8 +21,8 @@ import ( "sync" "github.com/crate-crypto/go-ipa/bandersnatch/fr" - "github.com/ethereum/go-ethereum/common/lru" - "github.com/ethereum/go-ethereum/metrics" + "github.com/ava-labs/libevm/common/lru" + "github.com/ava-labs/libevm/metrics" "github.com/gballet/go-verkle" "github.com/holiman/uint256" ) diff --git a/trie/verkle.go b/trie/verkle.go index 01d813d9ec9..f91982881dd 100644 --- a/trie/verkle.go +++ b/trie/verkle.go @@ -21,12 +21,12 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/utils" - "github.com/ethereum/go-ethereum/triedb/database" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/utils" + "github.com/ava-labs/libevm/triedb/database" "github.com/gballet/go-verkle" "github.com/holiman/uint256" ) diff --git a/trie/verkle_test.go b/trie/verkle_test.go index 0cbe28bf019..14cc1efce16 100644 --- a/trie/verkle_test.go +++ b/trie/verkle_test.go @@ -21,10 +21,10 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/trie/utils" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/trie/utils" "github.com/holiman/uint256" ) diff --git a/triedb/database.go b/triedb/database.go index 939a21f1478..4ce4de54a5d 100644 --- a/triedb/database.go +++ b/triedb/database.go @@ -19,15 +19,15 @@ package triedb import ( "errors" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" - "github.com/ethereum/go-ethereum/triedb/database" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" + "github.com/ava-labs/libevm/triedb/database" + "github.com/ava-labs/libevm/triedb/hashdb" + "github.com/ava-labs/libevm/triedb/pathdb" ) // Config defines all necessary options for database. diff --git a/triedb/database/database.go b/triedb/database/database.go index 18a8f454e2f..44d841016ba 100644 --- a/triedb/database/database.go +++ b/triedb/database/database.go @@ -17,7 +17,7 @@ package database import ( - "github.com/ethereum/go-ethereum/common" + "github.com/ava-labs/libevm/common" ) // Reader wraps the Node method of a backing trie reader. diff --git a/triedb/hashdb/database.go b/triedb/hashdb/database.go index e45ccdba32c..4727fc0e89c 100644 --- a/triedb/hashdb/database.go +++ b/triedb/hashdb/database.go @@ -24,15 +24,15 @@ import ( "time" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/metrics" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" ) var ( diff --git a/triedb/pathdb/database.go b/triedb/pathdb/database.go index f2d6cea635a..6c0c60c7697 100644 --- a/triedb/pathdb/database.go +++ b/triedb/pathdb/database.go @@ -23,14 +23,14 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/params" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" ) const ( diff --git a/triedb/pathdb/database_test.go b/triedb/pathdb/database_test.go index e7bd4699938..0f25ebcc4db 100644 --- a/triedb/pathdb/database_test.go +++ b/triedb/pathdb/database_test.go @@ -23,14 +23,14 @@ import ( "math/rand" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie/testutil" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie/testutil" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" "github.com/holiman/uint256" ) diff --git a/triedb/pathdb/difflayer.go b/triedb/pathdb/difflayer.go index 10567715d2e..749efc9de8d 100644 --- a/triedb/pathdb/difflayer.go +++ b/triedb/pathdb/difflayer.go @@ -20,10 +20,10 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" ) // diffLayer represents a collection of modifications made to the in-memory tries diff --git a/triedb/pathdb/difflayer_test.go b/triedb/pathdb/difflayer_test.go index 9b5907c3c5b..de0c084415e 100644 --- a/triedb/pathdb/difflayer_test.go +++ b/triedb/pathdb/difflayer_test.go @@ -20,10 +20,10 @@ import ( "bytes" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/trie/testutil" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/trie/testutil" + "github.com/ava-labs/libevm/trie/trienode" ) func emptyLayer() *diskLayer { diff --git a/triedb/pathdb/disklayer.go b/triedb/pathdb/disklayer.go index ef697cbce8c..568285c54b2 100644 --- a/triedb/pathdb/disklayer.go +++ b/triedb/pathdb/disklayer.go @@ -22,12 +22,12 @@ import ( "sync" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" "golang.org/x/crypto/sha3" ) diff --git a/triedb/pathdb/errors.go b/triedb/pathdb/errors.go index 78ee4459fe5..16a274931da 100644 --- a/triedb/pathdb/errors.go +++ b/triedb/pathdb/errors.go @@ -20,8 +20,8 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/common/hexutil" ) var ( diff --git a/triedb/pathdb/history.go b/triedb/pathdb/history.go index 6e3f3faaedc..ae4760508f1 100644 --- a/triedb/pathdb/history.go +++ b/triedb/pathdb/history.go @@ -23,11 +23,11 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie/triestate" "golang.org/x/exp/slices" ) diff --git a/triedb/pathdb/history_test.go b/triedb/pathdb/history_test.go index a3257441de8..761540e6268 100644 --- a/triedb/pathdb/history_test.go +++ b/triedb/pathdb/history_test.go @@ -22,13 +22,13 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie/testutil" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie/testutil" + "github.com/ava-labs/libevm/trie/triestate" ) // randomStateSet generates a random state change set. diff --git a/triedb/pathdb/journal.go b/triedb/pathdb/journal.go index ac770763e38..ab259f1c69d 100644 --- a/triedb/pathdb/journal.go +++ b/triedb/pathdb/journal.go @@ -23,14 +23,14 @@ import ( "io" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/rlp" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" ) var ( diff --git a/triedb/pathdb/layertree.go b/triedb/pathdb/layertree.go index d314779910e..45c4161a212 100644 --- a/triedb/pathdb/layertree.go +++ b/triedb/pathdb/layertree.go @@ -21,10 +21,10 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" ) // layerTree is a group of state layers identified by the state root. diff --git a/triedb/pathdb/metrics.go b/triedb/pathdb/metrics.go index 9e2b1dcbf55..c8b5ff9f3a7 100644 --- a/triedb/pathdb/metrics.go +++ b/triedb/pathdb/metrics.go @@ -16,7 +16,7 @@ package pathdb -import "github.com/ethereum/go-ethereum/metrics" +import "github.com/ava-labs/libevm/metrics" var ( cleanHitMeter = metrics.NewRegisteredMeter("pathdb/clean/hit", nil) diff --git a/triedb/pathdb/nodebuffer.go b/triedb/pathdb/nodebuffer.go index 4a7d328b9af..62d6c049337 100644 --- a/triedb/pathdb/nodebuffer.go +++ b/triedb/pathdb/nodebuffer.go @@ -21,12 +21,12 @@ import ( "time" "github.com/VictoriaMetrics/fastcache" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/trie/trienode" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/ethdb" + "github.com/ava-labs/libevm/log" + "github.com/ava-labs/libevm/trie/trienode" ) // nodebuffer is a collection of modified trie nodes to aggregate the disk diff --git a/triedb/pathdb/testutils.go b/triedb/pathdb/testutils.go index d6fdacb4213..fb6c11a1be4 100644 --- a/triedb/pathdb/testutils.go +++ b/triedb/pathdb/testutils.go @@ -20,11 +20,11 @@ import ( "bytes" "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/trie/trienode" - "github.com/ethereum/go-ethereum/trie/triestate" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/ava-labs/libevm/trie/trienode" + "github.com/ava-labs/libevm/trie/triestate" "golang.org/x/exp/slices" ) diff --git a/triedb/preimages.go b/triedb/preimages.go index a5384910f75..c2de227dcd6 100644 --- a/triedb/preimages.go +++ b/triedb/preimages.go @@ -19,9 +19,9 @@ package triedb import ( "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/rawdb" + "github.com/ava-labs/libevm/ethdb" ) // preimageStore is the store for caching preimages of node key.