From dab4354b628a7f7e879c676a69e418f53ecac7ce Mon Sep 17 00:00:00 2001 From: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:30:45 +0800 Subject: [PATCH] feat(ethclient): export `GetTxBlockTraceOnTopOfBlock` & `GetNumSkippedTransactions` & `GetSkippedTransactionHashes` & `GetSkippedTransaction` (#644) --- ethclient/ethclient.go | 26 ++++++++++++++++++++++++++ params/version.go | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index df7a7dd69a..a99a82bd51 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -28,6 +28,8 @@ import ( "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/common/hexutil" "github.com/scroll-tech/go-ethereum/core/types" + "github.com/scroll-tech/go-ethereum/eth" + "github.com/scroll-tech/go-ethereum/eth/tracers" "github.com/scroll-tech/go-ethereum/rpc" ) @@ -342,6 +344,30 @@ func (ec *Client) GetBlockTraceByNumber(ctx context.Context, number *big.Int) (* return blockTrace, ec.c.CallContext(ctx, &blockTrace, "scroll_getBlockTraceByNumberOrHash", toBlockNumArg(number)) } +// GetTxBlockTraceOnTopOfBlock returns the BlockTrace given the tx and block. +func (ec *Client) GetTxBlockTraceOnTopOfBlock(ctx context.Context, tx *types.Transaction, blockNumberOrHash rpc.BlockNumberOrHash, config *tracers.TraceConfig) (*types.BlockTrace, error) { + blockTrace := &types.BlockTrace{} + return blockTrace, ec.c.CallContext(ctx, &blockTrace, "scroll_getTxBlockTraceOnTopOfBlock", tx, blockNumberOrHash, config) +} + +// GetNumSkippedTransactions returns the ... +func (ec *Client) GetNumSkippedTransactions(ctx context.Context) (uint64, error) { + var num uint64 + return num, ec.c.CallContext(ctx, &num, "scroll_getNumSkippedTransactions") +} + +// GetSkippedTransactionHashes returns the BlockTrace given the tx and block. +func (ec *Client) GetSkippedTransactionHashes(ctx context.Context, from uint64, to uint64) ([]common.Hash, error) { + hashes := []common.Hash{} + return hashes, ec.c.CallContext(ctx, &hashes, "scroll_getSkippedTransactionHashes", from, to) +} + +// GetSkippedTransaction returns the BlockTrace given the tx and block. +func (ec *Client) GetSkippedTransaction(ctx context.Context, txHash common.Hash) (*eth.RPCTransaction, error) { + tx := ð.RPCTransaction{} + return tx, ec.c.CallContext(ctx, &tx, "scroll_getSkippedTransaction", txHash) +} + type rpcRowConsumption struct { RowConsumption types.RowConsumption `json:"rowConsumption"` } diff --git a/params/version.go b/params/version.go index e9366e4fa4..0bf067e222 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 1 // Minor version component of the current release - VersionPatch = 20 // Patch version component of the current release + VersionPatch = 21 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string )