From 3b9e643629d667e1867d0530f0f828541ec082cc Mon Sep 17 00:00:00 2001 From: Kirill Date: Mon, 29 Jul 2024 12:22:10 +0300 Subject: [PATCH] Fix linter issues --- adapters/p2p2core/receipt.go | 1 + core/receipt.go | 7 +------ core/receipt_pkg_test.go | 3 ++- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/adapters/p2p2core/receipt.go b/adapters/p2p2core/receipt.go index 0f24fe2e03..217511e5b8 100644 --- a/adapters/p2p2core/receipt.go +++ b/adapters/p2p2core/receipt.go @@ -34,6 +34,7 @@ func AdaptReceipt(r *spec.Receipt, txHash *felt.Felt) *core.TransactionReceipt { TransactionHash: txHash, Reverted: common.RevertReason != nil, // todo is it correct? RevertReason: common.GetRevertReason(), + TotalGasConsumed: nil, // todo(kirill) set field after spec update } } diff --git a/core/receipt.go b/core/receipt.go index 25ef04e531..6b3e5e7c2b 100644 --- a/core/receipt.go +++ b/core/receipt.go @@ -27,12 +27,7 @@ type TransactionReceipt struct { func (r *TransactionReceipt) Hash() (*felt.Felt, error) { revertReasonHash := &felt.Zero if r.Reverted { - // todo remove error because it's unneccessary - var err error - revertReasonHash, err = crypto.StarknetKeccak([]byte(r.RevertReason)) - if err != nil { - return nil, err - } + revertReasonHash = crypto.StarknetKeccak([]byte(r.RevertReason)) } var totalGasConsumed GasConsumed diff --git a/core/receipt_pkg_test.go b/core/receipt_pkg_test.go index 6e856ab56e..e6aadae54b 100644 --- a/core/receipt_pkg_test.go +++ b/core/receipt_pkg_test.go @@ -2,12 +2,13 @@ package core import ( "encoding/binary" + "testing" + "github.com/NethermindEth/juno/core/felt" "github.com/NethermindEth/juno/utils" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "testing" ) func TestReceiptHash(t *testing.T) {