From f1b1eb8b367dd15d9ada6f540562d9fd942339d1 Mon Sep 17 00:00:00 2001 From: Aayush Date: Tue, 7 Mar 2023 13:40:39 -0500 Subject: [PATCH] refactor: EthAPI: Drop unnecessary param from newEthTxReceipt --- node/impl/full/eth.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/node/impl/full/eth.go b/node/impl/full/eth.go index 907adf8cd..af8595362 100644 --- a/node/impl/full/eth.go +++ b/node/impl/full/eth.go @@ -433,7 +433,7 @@ func (a *EthModule) EthGetTransactionReceipt(ctx context.Context, txHash ethtype } } - receipt, err := newEthTxReceipt(ctx, tx, msgLookup, replay, events, a.StateAPI) + receipt, err := newEthTxReceipt(ctx, tx, replay, events, a.StateAPI) if err != nil { return nil, nil } @@ -2030,7 +2030,7 @@ func newEthTxFromMessageLookup(ctx context.Context, msgLookup *api.MsgLookup, tx return tx, nil } -func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLookup, replay *api.InvocResult, events []types.Event, sa StateAPI) (api.EthTxReceipt, error) { +func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, replay *api.InvocResult, events []types.Event, sa StateAPI) (api.EthTxReceipt, error) { var ( transactionIndex ethtypes.EthUint64 blockHash ethtypes.EthHash @@ -2059,25 +2059,25 @@ func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLook LogsBloom: ethtypes.EmptyEthBloom[:], } - if lookup.Receipt.ExitCode.IsSuccess() { + if replay.MsgRct.ExitCode.IsSuccess() { receipt.Status = 1 } - if lookup.Receipt.ExitCode.IsError() { + if replay.MsgRct.ExitCode.IsError() { receipt.Status = 0 } - receipt.GasUsed = ethtypes.EthUint64(lookup.Receipt.GasUsed) + receipt.GasUsed = ethtypes.EthUint64(replay.MsgRct.GasUsed) // TODO: handle CumulativeGasUsed receipt.CumulativeGasUsed = ethtypes.EmptyEthInt - effectiveGasPrice := big.Div(replay.GasCost.TotalCost, big.NewInt(lookup.Receipt.GasUsed)) + effectiveGasPrice := big.Div(replay.GasCost.TotalCost, big.NewInt(replay.MsgRct.GasUsed)) receipt.EffectiveGasPrice = ethtypes.EthBigInt(effectiveGasPrice) - if receipt.To == nil && lookup.Receipt.ExitCode.IsSuccess() { + if receipt.To == nil && replay.MsgRct.ExitCode.IsSuccess() { // Create and Create2 return the same things. var ret eam.CreateExternalReturn - if err := ret.UnmarshalCBOR(bytes.NewReader(lookup.Receipt.Return)); err != nil { + if err := ret.UnmarshalCBOR(bytes.NewReader(replay.MsgRct.Return)); err != nil { return api.EthTxReceipt{}, xerrors.Errorf("failed to parse contract creation result: %w", err) } addr := ethtypes.EthAddress(ret.EthAddress)