Skip to content

refactor: replace golang.org/x/exp with stdlib #590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions chain/test_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,29 @@ package chain
import (
"errors"
"fmt"
compilationTypes "github.com/crytic/medusa/compilation/types"
"maps"
"math/big"

"github.com/crytic/medusa/chain/state"
"golang.org/x/net/context"

"github.com/crytic/medusa-geth/core/rawdb"
"github.com/crytic/medusa-geth/core/tracing"
"github.com/crytic/medusa-geth/triedb"
"github.com/crytic/medusa-geth/triedb/hashdb"
"github.com/crytic/medusa/chain/config"
"github.com/holiman/uint256"
"golang.org/x/exp/maps"

"github.com/crytic/medusa-geth/common"
"github.com/crytic/medusa-geth/common/math"
"github.com/crytic/medusa-geth/core"
"github.com/crytic/medusa-geth/core/rawdb"
gethState "github.com/crytic/medusa-geth/core/state"
"github.com/crytic/medusa-geth/core/tracing"
gethTypes "github.com/crytic/medusa-geth/core/types"
"github.com/crytic/medusa-geth/core/vm"
"github.com/crytic/medusa-geth/ethdb"
"github.com/crytic/medusa-geth/params"
"github.com/crytic/medusa-geth/triedb"
"github.com/crytic/medusa-geth/triedb/hashdb"
"github.com/crytic/medusa/chain/config"
"github.com/crytic/medusa/chain/state"
"github.com/crytic/medusa/chain/types"
"github.com/crytic/medusa/chain/vendored"
compilationTypes "github.com/crytic/medusa/compilation/types"
"github.com/crytic/medusa/utils"
"github.com/holiman/uint256"
"golang.org/x/net/context"
)

// TestChain represents a simulated Ethereum chain used for testing. It maintains blocks in-memory and strips away
Expand Down
2 changes: 1 addition & 1 deletion chain/test_chain_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package chain

import (
"math/big"
"slices"

"github.com/crytic/medusa-geth/common"
"github.com/crytic/medusa-geth/core/tracing"
coretypes "github.com/crytic/medusa-geth/core/types"
"github.com/crytic/medusa-geth/core/vm"
"github.com/crytic/medusa-geth/eth/tracers"
"github.com/crytic/medusa/chain/types"
"golang.org/x/exp/slices"
)

// TestChainTracer is an extended tracers.Tracer which can be used with a TestChain to store any captured
Expand Down
2 changes: 1 addition & 1 deletion cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package cmd

import (
"fmt"
"golang.org/x/exp/slices"
"os"
"slices"
"strings"

"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion compilation/types/compiled_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"bytes"
"encoding/json"
"fmt"
"slices"
"strings"

"github.com/crytic/medusa-geth/accounts/abi"
"golang.org/x/exp/slices"
)

// CompiledContract represents a single contract unit from a smart contract compilation.
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/calls/call_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package calls

import (
"math/big"
"slices"

"github.com/crytic/medusa-geth/common"
"github.com/crytic/medusa-geth/common/hexutil"
"github.com/crytic/medusa-geth/core"
coreTypes "github.com/crytic/medusa-geth/core/types"
"github.com/crytic/medusa/chain"
"github.com/crytic/medusa/logging"
"golang.org/x/exp/slices"
)

// The following directives will be picked up by the `go generate` command to generate JSON marshaling code from
Expand Down
3 changes: 1 addition & 2 deletions fuzzing/contracts/contract.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package contracts

import (
"slices"
"strings"

"golang.org/x/exp/slices"

"github.com/crytic/medusa-geth/accounts/abi"
"github.com/crytic/medusa/compilation/types"
)
Expand Down
9 changes: 4 additions & 5 deletions fuzzing/executiontracer/execution_tracer.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package executiontracer

import (
"github.com/crytic/medusa/fuzzing/config"
"math/big"
"slices"

"github.com/crytic/medusa-geth/common"
"github.com/crytic/medusa-geth/core"
"github.com/crytic/medusa-geth/core/tracing"
coretypes "github.com/crytic/medusa-geth/core/types"
"github.com/crytic/medusa-geth/core/vm"
"github.com/crytic/medusa-geth/eth/tracers"
"github.com/crytic/medusa/chain"
"github.com/crytic/medusa/chain/types"
"github.com/crytic/medusa/fuzzing/config"
"github.com/crytic/medusa/fuzzing/contracts"
"github.com/crytic/medusa/utils"

"github.com/crytic/medusa-geth/core/vm"
"github.com/crytic/medusa-geth/eth/tracers"
"golang.org/x/exp/slices"
)

// CallWithExecutionTrace obtains an execution trace for a given call, on the provided chain, using the state
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"runtime"
"slices"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -39,7 +40,6 @@ import (
fuzzingutils "github.com/crytic/medusa/fuzzing/utils"
"github.com/crytic/medusa/fuzzing/valuegeneration"
"github.com/crytic/medusa/utils"
"golang.org/x/exp/slices"
)

// Fuzzer represents an Ethereum smart contract fuzzing provider.
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/fuzzer_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package fuzzing

import (
"fmt"
"maps"
"math/big"
"math/rand"

Expand All @@ -14,7 +15,6 @@ import (
"github.com/crytic/medusa/fuzzing/coverage"
"github.com/crytic/medusa/fuzzing/valuegeneration"
"github.com/crytic/medusa/utils"
"golang.org/x/exp/maps"
)

// FuzzerWorker describes a single thread worker utilizing its own go-ethereum test node to run property tests against
Expand Down
3 changes: 1 addition & 2 deletions fuzzing/test_case_assertion_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package fuzzing

import (
"math/big"
"slices"
"sync"

"github.com/crytic/medusa/compilation/abiutils"
"github.com/crytic/medusa/fuzzing/calls"
"github.com/crytic/medusa/fuzzing/config"
"github.com/crytic/medusa/fuzzing/contracts"

"golang.org/x/exp/slices"
)

// AssertionTestCaseProvider is am AssertionTestCase provider which spawns test cases for every contract method and
Expand Down
4 changes: 2 additions & 2 deletions fuzzing/test_case_optimization_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package fuzzing

import (
"fmt"
"github.com/crytic/medusa/fuzzing/config"
"math/big"
"slices"
"sync"

"github.com/crytic/medusa-geth/core"
"github.com/crytic/medusa/fuzzing/calls"
"github.com/crytic/medusa/fuzzing/config"
"github.com/crytic/medusa/fuzzing/contracts"
"github.com/crytic/medusa/fuzzing/executiontracer"
"golang.org/x/exp/slices"
)

// MIN_INT is the minimum value for an int256 in hexadecimal
Expand Down
4 changes: 2 additions & 2 deletions fuzzing/test_case_property_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package fuzzing

import (
"fmt"
"github.com/crytic/medusa/fuzzing/config"
"math/big"
"slices"
"sync"

"github.com/crytic/medusa-geth/core"
"github.com/crytic/medusa/fuzzing/calls"
"github.com/crytic/medusa/fuzzing/config"
"github.com/crytic/medusa/fuzzing/contracts"
"github.com/crytic/medusa/fuzzing/executiontracer"
"golang.org/x/exp/slices"
)

// PropertyTestCaseProvider is a provider for on-chain property tests.
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/valuegeneration/generator_mutational.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package valuegeneration
import (
"math/big"
"math/rand"
"slices"

"github.com/crytic/medusa-geth/common"
"github.com/crytic/medusa/utils"
"golang.org/x/exp/slices"
)

// MutationalValueGenerator represents a ValueGenerator and ValueMutator for function inputs and call arguments. It
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/valuegeneration/value_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package valuegeneration
import (
"encoding/hex"
"hash"
"maps"
"math/big"
"reflect"

"github.com/crytic/medusa/utils/reflectionutils"

"github.com/crytic/medusa-geth/common"
"golang.org/x/crypto/sha3"
"golang.org/x/exp/maps"
)

// ValueSet represents potential values of significance within the source code to be used in fuzz tests.
Expand Down