Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit b0565c7

Browse files
authored
Merge branch 'master' into powerslider/1410-context-cancel-misleading-logs
2 parents c3e1590 + 4819e74 commit b0565c7

File tree

5 files changed

+20
-139
lines changed

5 files changed

+20
-139
lines changed

RELEASES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## Pending Release
44

55
- Removes `avax.version` API
6+
- Removes `customethclient` package in favor of `ethclient` package and temporary type registrations (`WithTempRegisteredLibEVMExtras`)
7+
- Also removes blockHook extension in `ethclient` package.
68

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

ethclient/ethclient.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"fmt"
3636
"math/big"
3737

38+
"github.com/ava-labs/coreth/plugin/evm/customtypes"
3839
"github.com/ava-labs/coreth/rpc"
3940
ethereum "github.com/ava-labs/libevm"
4041
"github.com/ava-labs/libevm/common"
@@ -45,8 +46,6 @@ import (
4546
// Client defines typed wrappers for the Ethereum RPC API.
4647
type Client struct {
4748
c *rpc.Client
48-
// blockHook is called when a block is decoded.
49-
blockHook BlockHook
5049
}
5150

5251
// Dial connects a client to the given URL.
@@ -132,10 +131,12 @@ func (ec *Client) BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumb
132131
}
133132

134133
type rpcBlock struct {
135-
Hash common.Hash `json:"hash"`
136-
Transactions []rpcTransaction `json:"transactions"`
137-
UncleHashes []common.Hash `json:"uncles"`
138-
Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"`
134+
Hash common.Hash `json:"hash"`
135+
Transactions []rpcTransaction `json:"transactions"`
136+
UncleHashes []common.Hash `json:"uncles"`
137+
Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"`
138+
Version uint32 `json:"version"`
139+
BlockExtraData *hexutil.Bytes `json:"blockExtraData"`
139140
}
140141

141142
func (ec *Client) getBlock(ctx context.Context, method string, args ...interface{}) (*types.Block, error) {
@@ -204,16 +205,18 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface
204205
}
205206
txs[i] = tx.tx
206207
}
207-
block := types.NewBlockWithHeader(head).WithBody(types.Body{
208-
Transactions: txs,
209-
Uncles: uncles,
210-
})
211-
// Fill the block with the extra data. BlockHook can modify the block.
212-
if ec.blockHook != nil {
213-
if err := ec.blockHook.OnBlockDecoded(raw, block); err != nil {
214-
return nil, err
215-
}
208+
209+
block := types.NewBlockWithHeader(head).WithBody(
210+
types.Body{
211+
Transactions: txs,
212+
Uncles: uncles,
213+
Withdrawals: body.Withdrawals,
214+
})
215+
extra := &customtypes.BlockBodyExtra{
216+
Version: body.Version,
217+
ExtData: (*[]byte)(body.BlockExtraData),
216218
}
219+
customtypes.SetBlockExtra(block, extra)
217220
return block, nil
218221
}
219222

ethclient/ethclient_ext.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@ package ethclient
55

66
import (
77
"context"
8-
"encoding/json"
98
"math/big"
109

1110
"github.com/ava-labs/libevm/common"
1211
"github.com/ava-labs/libevm/common/hexutil"
13-
"github.com/ava-labs/libevm/core/types"
1412

1513
// Force-load precompiles to trigger registration
1614
_ "github.com/ava-labs/coreth/precompile/registry"
1715

1816
"github.com/ava-labs/coreth/accounts/abi/bind"
1917
"github.com/ava-labs/coreth/interfaces"
20-
"github.com/ava-labs/coreth/rpc"
2118

2219
ethereum "github.com/ava-labs/libevm"
2320
)
@@ -42,23 +39,6 @@ var (
4239
_ interfaces.AcceptedContractCaller = (*Client)(nil)
4340
)
4441

45-
// NewClientWithHook creates a client that uses the given RPC client and block hook.
46-
func NewClientWithHook(c *rpc.Client, hook BlockHook) *Client {
47-
return &Client{
48-
c: c,
49-
blockHook: hook,
50-
}
51-
}
52-
53-
// BlockHook is an interface that can be implemented to modify the block
54-
// after it has been decoded. This is useful for plugins that want to
55-
// modify the block before it is returned to the caller.
56-
type BlockHook interface {
57-
// OnBlockDecoded is called when a block is decoded. It can be used to
58-
// modify the block before it is returned to the caller.
59-
OnBlockDecoded(raw json.RawMessage, block *types.Block) error
60-
}
61-
6242
// SubscribeNewAcceptedTransactions subscribes to notifications about the accepted transaction hashes on the given channel.
6343
func (ec *Client) SubscribeNewAcceptedTransactions(ctx context.Context, ch chan<- *common.Hash) (ethereum.Subscription, error) {
6444
sub, err := ec.c.EthSubscribe(ctx, ch, "newAcceptedTransactions")

plugin/evm/customethclient/ethclient.go

Lines changed: 0 additions & 71 deletions
This file was deleted.

plugin/evm/customethclient/example_test.go

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)