Skip to content

Commit

Permalink
squashed all
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush committed Mar 6, 2024
1 parent 02f6c62 commit 1cb9527
Show file tree
Hide file tree
Showing 315 changed files with 19,918 additions and 7,920 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

# review whenever someone opens a pull request.

* @ceyonur @darioush @aaronbuchwald
* @ceyonur @darioush

2 changes: 1 addition & 1 deletion .github/workflows/auto-generated-code-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- shell: bash
run: scripts/mock.gen.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- run: go mod download
shell: bash
Expand Down
35 changes: 19 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:

env:
tmpnet_data_path: ~/.tmpnet/networks/1000

jobs:
lint_test:
name: Lint
Expand All @@ -18,7 +21,7 @@ jobs:
shell: bash
- uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand All @@ -37,7 +40,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- run: go mod download
shell: bash
Expand All @@ -59,7 +62,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- name: Use Node.js
uses: actions/setup-node@v4
Expand Down Expand Up @@ -88,7 +91,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: subnet-evm-e2e-logs-precompile
path: /tmp/network-runner-root-data*/
path: /tmp/e2e-test/precompile-data
retention-days: 5
e2e_warp:
name: e2e warp tests
Expand All @@ -101,7 +104,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- name: Use Node.js
uses: actions/setup-node@v4
Expand All @@ -124,14 +127,14 @@ jobs:
run: ./scripts/build.sh /tmp/e2e-test/avalanchego/plugins/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy
- name: Run Warp E2E Tests
shell: bash
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego DATA_DIR=/tmp/e2e-test/warp-data ./scripts/run_ginkgo_warp.sh
- name: Upload Artifact
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_warp.sh
- name: Upload tmpnet network dir for warp testing
if: always()
uses: actions/upload-artifact@v4
with:
name: subnet-evm-e2e-logs-warp
path: /tmp/network-runner-root-data*/
retention-days: 5
name: warp-tmpnet-data
path: ${{ env.tmpnet_data_path }}
if-no-files-found: error
e2e_load:
name: e2e load tests
runs-on: ubuntu-latest
Expand All @@ -143,7 +146,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- name: Install AvalancheGo Release
shell: bash
Expand All @@ -153,14 +156,14 @@ jobs:
run: ./scripts/build.sh /tmp/e2e-test/avalanchego/plugins/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy
- name: Run E2E Load Tests
shell: bash
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego DATA_DIR=/tmp/e2e-test/load-data ./scripts/run_ginkgo_load.sh
- name: Upload Artifact
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_load.sh
- name: Upload tmpnet network dir for load testing
if: always()
uses: actions/upload-artifact@v4
with:
name: subnet-evm-e2e-logs-load
path: /tmp/network-runner-root-data*/
retention-days: 5
name: load-tmpnet-data
path: ${{ env.tmpnet_data_path }}
if-no-files-found: error

build_image:
name: Build Docker Image
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: Release

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to include in artifact name'
required: true
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- "*"

jobs:
release:
Expand All @@ -19,7 +23,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- name: Set up arm64 cross compiler
run: |
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARG AVALANCHE_VERSION

# ============= Compilation Stage ================
FROM golang:1.20.12-bullseye AS builder
FROM golang:1.21.7-bullseye AS builder

WORKDIR /build

Expand All @@ -14,7 +14,7 @@ WORKDIR /build
COPY go.mod go.sum avalanchego* ./

# Download avalanche dependencies using go mod
RUN go mod download && go mod tidy -compat=1.20
RUN go mod download && go mod tidy -compat=1.21

# Copy the code into the container
COPY . .
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ The Subnet EVM runs in a separate process from the main AvalancheGo process and
[v0.5.9] [email protected] (Protocol Version: 30)
[v0.5.10] [email protected] (Protocol Version: 30)
[v0.5.11] [email protected] (Protocol Version: 31)
[v0.6.0] [email protected] (Protocol Version: 33)
[v0.6.1] [email protected] (Protocol Version: 33)
[v0.6.2] [email protected] (Protocol Version: 34)
```

## API
Expand Down Expand Up @@ -95,7 +98,7 @@ To support these changes, there have been a number of changes to the SubnetEVM b

### Clone Subnet-evm

First install Go 1.20.12 or later. Follow the instructions [here](https://go.dev/doc/install). You can verify by running `go version`.
First install Go 1.21.7 or later. Follow the instructions [here](https://go.dev/doc/install). You can verify by running `go version`.

Set `$GOPATH` environment variable properly for Go to look for Go Workspaces. Please read [this](https://go.dev/doc/code) for details. You can verify by running `echo $GOPATH`.

Expand Down
7 changes: 7 additions & 0 deletions accounts/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (abi ABI) PackOutput(name string, args ...interface{}) ([]byte, error) {
}

// getInputs gets input arguments of the given [name] method.
// useStrictMode indicates whether to check the input data length strictly.
func (abi ABI) getInputs(name string, data []byte, useStrictMode bool) (Arguments, error) {
// since there can't be naming collisions with contracts and events,
// we need to decide whether we're calling a method or an event
Expand Down Expand Up @@ -196,6 +197,9 @@ func (abi ABI) getArguments(name string, data []byte) (Arguments, error) {
}

// UnpackInput unpacks the input according to the ABI specification.
// useStrictMode indicates whether to check the input data length strictly.
// By default it was set to true. In order to support the general EVM tool compatibility this
// should be set to false. This transition (true -> false) should be done with a network upgrade.
func (abi ABI) UnpackInput(name string, data []byte, useStrictMode bool) ([]interface{}, error) {
args, err := abi.getInputs(name, data, useStrictMode)
if err != nil {
Expand All @@ -216,6 +220,9 @@ func (abi ABI) Unpack(name string, data []byte) ([]interface{}, error) {
// UnpackInputIntoInterface unpacks the input in v according to the ABI specification.
// It performs an additional copy. Please only use, if you want to unpack into a
// structure that does not strictly conform to the ABI structure (e.g. has additional arguments)
// useStrictMode indicates whether to check the input data length strictly.
// By default it was set to true. In order to support the general EVM tool compatibility this
// should be set to false. This transition (true -> false) should be done with a network upgrade.
func (abi ABI) UnpackInputIntoInterface(v interface{}, name string, data []byte, useStrictMode bool) error {
args, err := abi.getInputs(name, data, useStrictMode)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
var (
// ErrNoCode is returned by call and transact operations for which the requested
// recipient contract to operate on does not exist in the state db or does not
// have any code associated with it (i.e. suicided).
// have any code associated with it (i.e. self-destructed).
ErrNoCode = errors.New("no contract code at given address")

// ErrNoAcceptedState is raised when attempting to perform a accepted state action
Expand Down
26 changes: 12 additions & 14 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ import (
var (
_ bind.AcceptedContractCaller = (*SimulatedBackend)(nil)
_ bind.ContractBackend = (*SimulatedBackend)(nil)
_ bind.ContractFilterer = (*SimulatedBackend)(nil)
_ bind.ContractTransactor = (*SimulatedBackend)(nil)
_ bind.DeployBackend = (*SimulatedBackend)(nil)

_ interfaces.ChainReader = (*SimulatedBackend)(nil)
Expand Down Expand Up @@ -147,7 +145,7 @@ func (b *SimulatedBackend) Close() error {
return nil
}

// Commit imports all the pending transactions as a single block and starts a
// Commit imports all the accepted transactions as a single block and starts a
// fresh new state.
func (b *SimulatedBackend) Commit(accept bool) common.Hash {
b.mu.Lock()
Expand All @@ -171,7 +169,7 @@ func (b *SimulatedBackend) Commit(accept bool) common.Hash {
return blockHash
}

// Rollback aborts all pending transactions, reverting to the last committed state.
// Rollback aborts all accepted transactions, reverting to the last committed state.
func (b *SimulatedBackend) Rollback() {
b.mu.Lock()
defer b.mu.Unlock()
Expand Down Expand Up @@ -206,7 +204,7 @@ func (b *SimulatedBackend) Fork(ctx context.Context, parent common.Hash) error {
defer b.mu.Unlock()

if len(b.acceptedBlock.Transactions()) != 0 {
return errors.New("pending block dirty")
return errors.New("accepted block dirty")
}
block, err := b.blockByHash(ctx, parent)
if err != nil {
Expand Down Expand Up @@ -293,10 +291,10 @@ func (b *SimulatedBackend) TransactionReceipt(ctx context.Context, txHash common
return receipt, nil
}

// TransactionByHash checks the pool of pending transactions in addition to the
// blockchain. The isPending return value indicates whether the transaction has been
// TransactionByHash checks the pool of accepted transactions in addition to the
// blockchain. The isAccepted return value indicates whether the transaction has been
// mined yet. Note that the transaction may not be part of the canonical chain even if
// it's not pending.
// it's not accepted.
func (b *SimulatedBackend) TransactionByHash(ctx context.Context, txHash common.Hash) (*types.Transaction, bool, error) {
b.mu.Lock()
defer b.mu.Unlock()
Expand Down Expand Up @@ -537,7 +535,7 @@ func (b *SimulatedBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, erro
return big.NewInt(1), nil
}

// EstimateGas executes the requested code against the currently pending block/state and
// EstimateGas executes the requested code against the currently accepted block/state and
// returns the used amount of gas.
func (b *SimulatedBackend) EstimateGas(ctx context.Context, call interfaces.CallMsg) (uint64, error) {
b.mu.Lock()
Expand Down Expand Up @@ -641,7 +639,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call interfaces.Call
return hi, nil
}

// callContract implements common code between normal and pending contract calls.
// callContract implements common code between normal and accepted contract calls.
// state is modified during execution, make sure to copy it if necessary.
func (b *SimulatedBackend) callContract(ctx context.Context, call interfaces.CallMsg, header *types.Header, stateDB *state.StateDB) (*core.ExecutionResult, error) {
// Gas prices post 1559 need to be initialized
Expand Down Expand Up @@ -711,7 +709,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call interfaces.Cal
return core.ApplyMessage(vmEnv, msg, gasPool)
}

// SendTransaction updates the pending block to include the given transaction.
// SendTransaction updates the accepted block to include the given transaction.
func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transaction) error {
b.mu.Lock()
defer b.mu.Unlock()
Expand Down Expand Up @@ -768,7 +766,7 @@ func (b *SimulatedBackend) FilterLogs(ctx context.Context, query interfaces.Filt
to = query.ToBlock.Int64()
}
// Construct the range filter
filter, _ = b.filterSystem.NewRangeFilter(from, to, query.Addresses, query.Topics)
filter = b.filterSystem.NewRangeFilter(from, to, query.Addresses, query.Topics)
}
// Run the filter and return all the logs
logs, err := filter.Logs(ctx)
Expand Down Expand Up @@ -854,7 +852,7 @@ func (b *SimulatedBackend) AdjustTime(adjustment time.Duration) error {
}
block := b.blockchain.GetBlockByHash(b.acceptedBlock.ParentHash())
if block == nil {
return fmt.Errorf("could not find parent")
return errors.New("could not find parent")
}

blocks, _, _ := core.GenerateChain(b.config, block, dummy.NewFaker(), b.database, 1, 10, func(number int, block *core.BlockGen) {
Expand Down Expand Up @@ -911,7 +909,7 @@ func (fb *filterBackend) EventMux() *event.TypeMux { panic("not supported") }

func (fb *filterBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) {
switch number {
case rpc.PendingBlockNumber, rpc.AcceptedBlockNumber:
case rpc.PendingBlockNumber, rpc.FinalizedBlockNumber:
if block := fb.backend.acceptedBlock; block != nil {
return block.Header(), nil
}
Expand Down
1 change: 1 addition & 0 deletions accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func TestAdjustTime(t *testing.T) {
func TestNewAdjustTimeFail(t *testing.T) {
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
sim := simTestBackend(testAddr)
defer sim.blockchain.Stop()

// Create tx and send
head, _ := sim.HeaderByNumber(context.Background(), nil) // Should be child's, good enough
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func BindHelper(types []string, abis []string, bytecodes []string, fsigs []map[s
normalized := original
normalizedName := methodNormalizer[lang](alias(aliases, original.Name))
// Ensure there is no duplicated identifier
identifiers := callIdentifiers
var identifiers = callIdentifiers
if !original.IsConstant() {
identifiers = transactIdentifiers
}
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ func golangBindings(t *testing.T, overload bool) {
if out, err := replacer.CombinedOutput(); err != nil {
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out)
}
tidier := exec.Command(gocmd, "mod", "tidy", "-compat=1.20")
tidier := exec.Command(gocmd, "mod", "tidy", "-compat=1.21")
tidier.Dir = pkg
if out, err := tidier.CombinedOutput(); err != nil {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
Expand Down
3 changes: 3 additions & 0 deletions accounts/abi/bind/precompilebind/precompile_bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func createPrecompileHook(abifilename string, template string) bind.BindHook {
for key := range allowlist.AllowListABI.Methods {
delete(funcs, key)
}
for events := range allowlist.AllowListABI.Events {
delete(contract.Events, events)
}
}

precompileContract := &tmplPrecompileContract{
Expand Down
Loading

0 comments on commit 1cb9527

Please sign in to comment.