Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 17 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
1 change: 1 addition & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Major refactor to use [`libevm`](https://github.com/ava-labs/libevm) for EVM execution, database access, types & chain configuration. This improves maintainability and enables keeping up with upstream changes more easily.
- Add metrics for ACP-176
- Removed the `"price-options-max-base-fee"` config flag
- Removed extra type support in "ethclient.BlockByHash", "ethclient.BlockByNumber".

## [v0.15.0](https://github.com/ava-labs/coreth/releases/tag/v0.15.0)

Expand Down
5 changes: 3 additions & 2 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"github.com/ava-labs/coreth/core/state/snapshot"
"github.com/ava-labs/coreth/internal/version"
"github.com/ava-labs/coreth/params"
"github.com/ava-labs/coreth/plugin/evm/customlogs"

Check failure on line 48 in core/blockchain.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (windows-latest)

no required module provides package github.com/ava-labs/coreth/plugin/evm/customlogs; to add it:
"github.com/ava-labs/coreth/plugin/evm/customrawdb"
"github.com/ava-labs/coreth/plugin/evm/customtypes"
"github.com/ava-labs/coreth/plugin/evm/upgrade/acp176"
Expand Down Expand Up @@ -594,7 +595,7 @@
bc.acceptorTipLock.Unlock()

// Update accepted feeds
flattenedLogs := customtypes.FlattenLogs(logs)
flattenedLogs := customlogs.FlattenLogs(logs)
bc.chainAcceptedFeed.Send(ChainEvent{Block: next, Hash: next.Hash(), Logs: flattenedLogs})
if len(flattenedLogs) > 0 {
bc.logsAcceptedFeed.Send(flattenedLogs)
Expand Down Expand Up @@ -1447,7 +1448,7 @@
// the processing of a block. These logs are later announced as deleted or reborn.
func (bc *BlockChain) collectLogs(b *types.Block, removed bool) []*types.Log {
unflattenedLogs := bc.collectUnflattenedLogs(b, removed)
return customtypes.FlattenLogs(unflattenedLogs)
return customlogs.FlattenLogs(unflattenedLogs)
}

// reorg takes two blocks, an old chain and a new chain and will reconstruct the
Expand Down
4 changes: 2 additions & 2 deletions eth/filters/filter.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a nit change on line 380 of filterLogs you missed

var check = 
to
check :=

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"math/big"

"github.com/ava-labs/coreth/core/bloombits"
"github.com/ava-labs/coreth/plugin/evm/customtypes"
"github.com/ava-labs/coreth/plugin/evm/customlogs"
"github.com/ava-labs/coreth/rpc"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/core/types"
Expand Down Expand Up @@ -342,7 +342,7 @@ func (f *Filter) checkMatches(ctx context.Context, header *types.Header) ([]*typ
return nil, err
}

unfiltered := customtypes.FlattenLogs(logsList)
unfiltered := customlogs.FlattenLogs(logsList)
logs := filterLogs(unfiltered, nil, nil, f.addresses, f.topics)
if len(logs) == 0 {
return nil, nil
Expand Down
25 changes: 7 additions & 18 deletions ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (

"github.com/ava-labs/coreth/accounts/abi/bind"
"github.com/ava-labs/coreth/interfaces"
"github.com/ava-labs/coreth/plugin/evm/customtypes"
"github.com/ava-labs/coreth/rpc"
ethereum "github.com/ava-labs/libevm"
"github.com/ava-labs/libevm/common"
Expand Down Expand Up @@ -194,11 +193,9 @@ func (ec *client) BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumb
}

type rpcBlock struct {
Hash common.Hash `json:"hash"`
Transactions []rpcTransaction `json:"transactions"`
UncleHashes []common.Hash `json:"uncles"`
Version uint32 `json:"version"`
BlockExtraData *hexutil.Bytes `json:"blockExtraData"`
Hash common.Hash `json:"hash"`
Transactions []rpcTransaction `json:"transactions"`
UncleHashes []common.Hash `json:"uncles"`
}

func (ec *client) getBlock(ctx context.Context, method string, args ...interface{}) (*types.Block, error) {
Expand Down Expand Up @@ -267,18 +264,10 @@ func (ec *client) getBlock(ctx context.Context, method string, args ...interface
}
txs[i] = tx.tx
}

block := types.NewBlockWithHeader(head).WithBody(
types.Body{
Transactions: txs,
Uncles: uncles,
})
extra := &customtypes.BlockBodyExtra{
Version: body.Version,
ExtData: (*[]byte)(body.BlockExtraData),
}
customtypes.SetBlockExtra(block, extra)
return block, nil
return types.NewBlockWithHeader(head).WithBody(types.Body{
Transactions: txs,
Uncles: uncles,
}), nil
}

// HeaderByHash returns the block header with the given hash.
Expand Down
14 changes: 0 additions & 14 deletions plugin/evm/customtypes/log_ext.go

This file was deleted.

14 changes: 9 additions & 5 deletions plugin/evm/imports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// its recursive package imports (including itself) in the same format.
func getDependencies(packageName string) (map[string]struct{}, error) {
// Configure the load mode to include dependencies
cfg := &packages.Config{Mode: packages.NeedDeps | packages.NeedImports | packages.NeedName | packages.NeedModule}
cfg := &packages.Config{Mode: packages.NeedImports | packages.NeedName}
pkgs, err := packages.Load(cfg, packageName)
if err != nil {
return nil, fmt.Errorf("failed to load package: %v", err)
Expand All @@ -38,7 +38,9 @@ func getDependencies(packageName string) (map[string]struct{}, error) {
}

// Start collecting dependencies
collectDeps(pkgs[0])
for _, pkg := range pkgs {
collectDeps(pkg)
}
return deps, nil
}

Expand All @@ -54,10 +56,12 @@ func TestMustNotImport(t *testing.T) {
// Importing these packages configures libevm globally and it is not
// possible to do so for both coreth and subnet-evm, where the client may
// wish to connect to multiple chains.
"plugin/evm/atomic": {"core", "core/vm", "params"},
"plugin/evm/client": {"core", "core/vm", "params"},
"plugin/evm/config": {"core", "core/vm", "params"},
"plugin/evm/atomic": {"core", "core/vm", "plugin/evm/customtypes", "params"},
"plugin/evm/client": {"core", "core/vm", "plugin/evm/customtypes", "params"},
"plugin/evm/config": {"core", "core/vm", "params", "plugin/evm/customtypes"},
"plugin/evm/header": {"core", "core/vm", "params"},
"ethclient": {"plugin/evm/customtypes", "params"},
"warp": {"plugin/evm/customtypes", "params"},
}

for packageName, forbiddenImports := range mustNotImport {
Expand Down
Loading