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

internal/ethapi: merge CallArgs and SendTxArgs #22718

Merged
merged 2 commits into from
May 25, 2021
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
2 changes: 1 addition & 1 deletion eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *
// created during the execution of EVM if the given transaction was added on
// top of the provided block and returns them as a JSON object.
// You can provide -2 as a block number to trace on top of the pending block.
func (api *API) TraceCall(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, config *TraceCallConfig) (interface{}, error) {
func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, config *TraceCallConfig) (interface{}, error) {
// Try to retrieve the specified block
var (
err error
Expand Down
20 changes: 10 additions & 10 deletions eth/tracers/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ func TestTraceCall(t *testing.T) {

var testSuite = []struct {
blockNumber rpc.BlockNumber
call ethapi.CallArgs
call ethapi.TransactionArgs
config *TraceCallConfig
expectErr error
expect interface{}
}{
// Standard JSON trace upon the genesis, plain transfer.
{
blockNumber: rpc.BlockNumber(0),
call: ethapi.CallArgs{
call: ethapi.TransactionArgs{
From: &accounts[0].addr,
To: &accounts[1].addr,
Value: (*hexutil.Big)(big.NewInt(1000)),
Expand All @@ -223,7 +223,7 @@ func TestTraceCall(t *testing.T) {
// Standard JSON trace upon the head, plain transfer.
{
blockNumber: rpc.BlockNumber(genBlocks),
call: ethapi.CallArgs{
call: ethapi.TransactionArgs{
From: &accounts[0].addr,
To: &accounts[1].addr,
Value: (*hexutil.Big)(big.NewInt(1000)),
Expand All @@ -240,7 +240,7 @@ func TestTraceCall(t *testing.T) {
// Standard JSON trace upon the non-existent block, error expects
{
blockNumber: rpc.BlockNumber(genBlocks + 1),
call: ethapi.CallArgs{
call: ethapi.TransactionArgs{
From: &accounts[0].addr,
To: &accounts[1].addr,
Value: (*hexutil.Big)(big.NewInt(1000)),
Expand All @@ -252,7 +252,7 @@ func TestTraceCall(t *testing.T) {
// Standard JSON trace upon the latest block
{
blockNumber: rpc.LatestBlockNumber,
call: ethapi.CallArgs{
call: ethapi.TransactionArgs{
From: &accounts[0].addr,
To: &accounts[1].addr,
Value: (*hexutil.Big)(big.NewInt(1000)),
Expand All @@ -269,7 +269,7 @@ func TestTraceCall(t *testing.T) {
// Standard JSON trace upon the pending block
{
blockNumber: rpc.PendingBlockNumber,
call: ethapi.CallArgs{
call: ethapi.TransactionArgs{
From: &accounts[0].addr,
To: &accounts[1].addr,
Value: (*hexutil.Big)(big.NewInt(1000)),
Expand Down Expand Up @@ -329,15 +329,15 @@ func TestOverridenTraceCall(t *testing.T) {

var testSuite = []struct {
blockNumber rpc.BlockNumber
call ethapi.CallArgs
call ethapi.TransactionArgs
config *TraceCallConfig
expectErr error
expect *callTrace
}{
// Succcessful call with state overriding
{
blockNumber: rpc.PendingBlockNumber,
call: ethapi.CallArgs{
call: ethapi.TransactionArgs{
From: &randomAccounts[0].addr,
To: &randomAccounts[1].addr,
Value: (*hexutil.Big)(big.NewInt(1000)),
Expand All @@ -361,7 +361,7 @@ func TestOverridenTraceCall(t *testing.T) {
// Invalid call without state overriding
{
blockNumber: rpc.PendingBlockNumber,
call: ethapi.CallArgs{
call: ethapi.TransactionArgs{
From: &randomAccounts[0].addr,
To: &randomAccounts[1].addr,
Value: (*hexutil.Big)(big.NewInt(1000)),
Expand Down Expand Up @@ -390,7 +390,7 @@ func TestOverridenTraceCall(t *testing.T) {
// }
{
blockNumber: rpc.PendingBlockNumber,
call: ethapi.CallArgs{
call: ethapi.TransactionArgs{
From: &randomAccounts[0].addr,
To: &randomAccounts[2].addr,
Data: newRPCBytes(common.Hex2Bytes("8381f58a")), // call number()
Expand Down
8 changes: 4 additions & 4 deletions graphql/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ func (c *CallResult) Status() Long {
}

func (b *Block) Call(ctx context.Context, args struct {
Data ethapi.CallArgs
Data ethapi.TransactionArgs
}) (*CallResult, error) {
if b.numberOrHash == nil {
_, err := b.resolve(ctx)
Expand All @@ -887,7 +887,7 @@ func (b *Block) Call(ctx context.Context, args struct {
}

func (b *Block) EstimateGas(ctx context.Context, args struct {
Data ethapi.CallArgs
Data ethapi.TransactionArgs
}) (Long, error) {
if b.numberOrHash == nil {
_, err := b.resolveHeader(ctx)
Expand Down Expand Up @@ -937,7 +937,7 @@ func (p *Pending) Account(ctx context.Context, args struct {
}

func (p *Pending) Call(ctx context.Context, args struct {
Data ethapi.CallArgs
Data ethapi.TransactionArgs
}) (*CallResult, error) {
pendingBlockNr := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
result, err := ethapi.DoCall(ctx, p.backend, args.Data, pendingBlockNr, nil, vm.Config{}, 5*time.Second, p.backend.RPCGasCap())
Expand All @@ -957,7 +957,7 @@ func (p *Pending) Call(ctx context.Context, args struct {
}

func (p *Pending) EstimateGas(ctx context.Context, args struct {
Data ethapi.CallArgs
Data ethapi.TransactionArgs
}) (Long, error) {
pendingBlockNr := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
gas, err := ethapi.DoEstimateGas(ctx, p.backend, args.Data, pendingBlockNr, p.backend.RPCGasCap())
Expand Down
Loading