From c9cdf144d55f6bbd75314e812eeefc18d7e8c40e Mon Sep 17 00:00:00 2001 From: gary rong Date: Thu, 8 Aug 2019 21:44:11 +0800 Subject: graphql, internal/ethapi: support overriding accounts in eth_call (#19917) * graphql, internal/ethapi: extend eth_call This PR offers the third option parameter for eth_call API. Caller can specify a batch of contracts for overriding the original account metadata(nonce, balance, code, state). It has a few advantages: * It's friendly for debugging * It's can make on-chain contract lighter for getting rid of state access functions * core, internal: address comments --- graphql/graphql.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'graphql') diff --git a/graphql/graphql.go b/graphql/graphql.go index 771c3c62f..df279f42b 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -817,7 +817,7 @@ func (b *Block) Call(ctx context.Context, args struct { return nil, err } } - result, gas, failed, err := ethapi.DoCall(ctx, b.backend, args.Data, *b.num, vm.Config{}, 5*time.Second, b.backend.RPCGasCap()) + result, gas, failed, err := ethapi.DoCall(ctx, b.backend, args.Data, *b.num, nil, vm.Config{}, 5*time.Second, b.backend.RPCGasCap()) status := hexutil.Uint64(1) if failed { status = 0 @@ -885,7 +885,7 @@ func (p *Pending) Account(ctx context.Context, args struct { func (p *Pending) Call(ctx context.Context, args struct { Data ethapi.CallArgs }) (*CallResult, error) { - result, gas, failed, err := ethapi.DoCall(ctx, p.backend, args.Data, rpc.PendingBlockNumber, vm.Config{}, 5*time.Second, p.backend.RPCGasCap()) + result, gas, failed, err := ethapi.DoCall(ctx, p.backend, args.Data, rpc.PendingBlockNumber, nil, vm.Config{}, 5*time.Second, p.backend.RPCGasCap()) status := hexutil.Uint64(1) if failed { status = 0 -- cgit v1.2.3