Skip to content
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

feat(ethclient): export GetTxBlockTraceOnTopOfBlock & GetNumSkippedTransactions & GetSkippedTransactionHashes & GetSkippedTransaction #644

Merged
merged 5 commits into from
Mar 11, 2024
Merged
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
26 changes: 26 additions & 0 deletions ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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 := &eth.RPCTransaction{}
return tx, ec.c.CallContext(ctx, &tx, "scroll_getSkippedTransaction", txHash)
}

type rpcRowConsumption struct {
RowConsumption types.RowConsumption `json:"rowConsumption"`
}
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
Loading