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

RPC update - add l2 gas #2335

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions adapters/core2p2p/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ func AdaptHeader(header *core.Header, commitments *core.BlockCommitments,
},
Receipts: AdaptHash(commitments.ReceiptCommitment),
ProtocolVersion: header.ProtocolVersion,
GasPriceFri: AdaptUint128(header.GasPriceSTRK),
GasPriceFri: AdaptUint128(header.L1GasPriceSTRK),
Signatures: utils.Map(header.Signatures, AdaptSignature),
StateDiffCommitment: &spec.StateDiffCommitment{
StateDiffLength: stateDiffLength,
Root: AdaptHash(stateDiffCommitment),
},
GasPriceWei: AdaptUint128(header.GasPrice),
GasPriceWei: AdaptUint128(header.L1GasPriceETH),
DataGasPriceFri: AdaptUint128(header.L1DataGasPrice.PriceInFri),
DataGasPriceWei: AdaptUint128(header.L1DataGasPrice.PriceInWei),
L1DataAvailabilityMode: adaptL1DA(header.L1DAMode),
Expand Down
6 changes: 4 additions & 2 deletions adapters/p2p2core/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ func AdaptBlockHeader(h *spec.SignedBlockHeader, eventsBloom *bloom.BloomFilter)
Timestamp: h.Time,
ProtocolVersion: h.ProtocolVersion,
EventsBloom: eventsBloom,
L1GasPriceETH: AdaptUint128(h.GasPriceWei),
L2GasPriceETH: nil, // TODO: Fix when we have l2 gas price
Signatures: utils.Map(h.Signatures, adaptSignature),
L1GasPriceSTRK: AdaptUint128(h.GasPriceFri),
L2GasPriceSTRK: nil, // TODO: Fix when we have l2 gas price
L1DAMode: adaptDA(h.L1DataAvailabilityMode),
L1DataGasPrice: &core.GasPrice{
PriceInWei: AdaptUint128(h.DataGasPriceWei),
PriceInFri: AdaptUint128(h.DataGasPriceFri),
},
GasPrice: AdaptUint128(h.GasPriceWei),
GasPriceSTRK: AdaptUint128(h.GasPriceFri),
}
}

Expand Down
6 changes: 4 additions & 2 deletions adapters/sn2core/sn2core.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ func AdaptBlock(response *starknet.Block, sig *starknet.Signature) (*core.Block,
TransactionCount: uint64(len(response.Transactions)),
EventCount: eventCount,
EventsBloom: core.EventsBloom(receipts),
GasPrice: response.GasPriceETH(),
GasPriceSTRK: response.GasPriceSTRK(),
L1GasPriceETH: response.L1GasPriceETH(),
L2GasPriceETH: response.L2GasPriceETH(),
L1GasPriceSTRK: response.L1GasPriceSTRK(),
L2GasPriceSTRK: response.L2GasPriceSTRK(),
L1DAMode: core.L1DAMode(response.L1DAMode),
L1DataGasPrice: (*core.GasPrice)(response.L1DataGasPrice),
Signatures: sigs,
Expand Down
6 changes: 4 additions & 2 deletions adapters/sn2core/sn2core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ func TestAdaptBlock(t *testing.T) {
assert.Empty(t, block.Signatures)
}

assert.Equal(t, test.gasPriceSTRK, block.GasPriceSTRK)
assert.Equal(t, test.gasPriceWEI, block.GasPrice)
assert.Equal(t, test.gasPriceSTRK, block.L1GasPriceSTRK)
assert.Equal(t, test.gasPriceWEI, block.L1GasPriceETH)
assert.Nil(t, block.L2GasPriceSTRK)
assert.Nil(t, block.L2GasPriceETH)
if test.l1DAGasPriceFRI != nil {
assert.Equal(t, test.l1DAGasPriceFRI, block.L1DataGasPrice.PriceInFri)
}
Expand Down
12 changes: 6 additions & 6 deletions clients/feeder/feeder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func TestBlockWithoutSequencerAddressUnmarshal(t *testing.T) {
assert.Equal(t, uint64(11817), block.Number)
assert.Equal(t, "0x3df24be7b5fed6b41de08d38686b6142944119ca2a345c38793590d6804bba4", block.StateRoot.String())
assert.Equal(t, "ACCEPTED_ON_L2", block.Status)
assert.Equal(t, "0x27ad16775", block.GasPriceETH().String())
assert.Equal(t, "0x27ad16775", block.L1GasPriceETH().String())
assert.Equal(t, 52, len(block.Transactions))
assert.Equal(t, 52, len(block.Receipts))
assert.Equal(t, uint64(1669465009), block.Timestamp)
Expand All @@ -291,7 +291,7 @@ func TestBlockWithSequencerAddressUnmarshal(t *testing.T) {
assert.Equal(t, uint64(19199), block.Number)
assert.Equal(t, "0x541b796ea02703d02ff31459815f65f410ceefe80a4e3499f7ef9ccc36d26ee", block.StateRoot.String())
assert.Equal(t, "ACCEPTED_ON_L2", block.Status)
assert.Equal(t, "0x31c4e2d75", block.GasPriceETH().String())
assert.Equal(t, "0x31c4e2d75", block.L1GasPriceETH().String())
assert.Equal(t, 324, len(block.Transactions))
assert.Equal(t, 324, len(block.Receipts))
assert.Equal(t, uint64(1674728186), block.Timestamp)
Expand All @@ -309,8 +309,8 @@ func TestBlockHeaderV013Unmarshal(t *testing.T) {
require.Equal(t, uint64(319132), block.Number)
require.Equal(t, utils.HexToFelt(t, "0x2a6b9a8b60e1de80dc50e6b704b415a38e8fd03d82244cec92cbff0821a8975"), block.StateRoot)
require.Equal(t, "ACCEPTED_ON_L2", block.Status)
require.Equal(t, utils.HexToFelt(t, "0x3b9aca08"), block.GasPriceETH())
require.Equal(t, utils.HexToFelt(t, "0x2540be400"), block.GasPriceSTRK())
require.Equal(t, utils.HexToFelt(t, "0x3b9aca08"), block.L1GasPriceETH())
require.Equal(t, utils.HexToFelt(t, "0x2540be400"), block.L1GasPriceSTRK())
require.Equal(t, uint64(1700075354), block.Timestamp)
require.Equal(t, utils.HexToFelt(t, "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8"), block.SequencerAddress)
require.Equal(t, "0.13.0", block.Version)
Expand All @@ -324,8 +324,8 @@ func TestBlockHeaderV0131Unmarshal(t *testing.T) {
require.Equal(t, utils.HexToFelt(t, "0x8ab8117e952f95efd96de0bc66dc6f13fe68dfda14b95fe1972759dee283a8"), block.Hash)
require.Equal(t, utils.HexToFelt(t, "0x13367121d0b7e34a9b10c8a5a1c269811cd9afc3ce680c88888f1a22d2f017a"), block.TransactionCommitment)
require.Equal(t, utils.HexToFelt(t, "0x1090dd2ab2aa22bd5fc5a59d3b1394d54461bb2a80156c4b2c2622d2c474ca2"), block.EventCommitment)
require.Equal(t, utils.HexToFelt(t, "0x3b9aca0a"), block.GasPriceETH())
require.Equal(t, utils.HexToFelt(t, "0x2b6fdb70"), block.GasPriceSTRK())
require.Equal(t, utils.HexToFelt(t, "0x3b9aca0a"), block.L1GasPriceETH())
require.Equal(t, utils.HexToFelt(t, "0x2b6fdb70"), block.L1GasPriceSTRK())
require.Equal(t, utils.HexToFelt(t, "0x5265a14ef"), block.L1DataGasPrice.PriceInWei)
require.Equal(t, utils.HexToFelt(t, "0x3c0c00c87"), block.L1DataGasPrice.PriceInFri)
require.Equal(t, starknet.Blob, block.L1DAMode)
Expand Down
22 changes: 13 additions & 9 deletions core/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ type Header struct {
ProtocolVersion string
// Bloom filter on the events emitted this block
EventsBloom *bloom.BloomFilter
// Amount of WEI charged per Gas spent
GasPrice *felt.Felt
// Amount of WEI charged per Gas spent on L1
L1GasPriceETH *felt.Felt
// Amount of STRK charged per Gas spent on L2
L2GasPriceETH *felt.Felt
Copy link
Contributor

@kirugan kirugan Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it's not as simple as that. When we encode structures into bytes encoder it stores field names alongside their values so if we rename it here we receive nil in these fields even if our db is up to date.

@IronGauntlets please confirm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be fixed with tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked on block №800:

        "l1_gas_price": {
            "price_in_fri": "0x0",
-           "price_in_wei": "0x476b2446"
+           "price_in_wei": null
        },

@kirugan you are right

// Sequencer signatures
Signatures [][]*felt.Felt
// Amount of STRK charged per Gas spent
GasPriceSTRK *felt.Felt
// Amount of STRK charged per Gas spent on L1
L1GasPriceSTRK *felt.Felt
// Amount of STRK charged per Gas spent on L2
L2GasPriceSTRK *felt.Felt
// The mode of the L1 data availability
L1DAMode L1DAMode
// The gas price for L1 data availability
Expand Down Expand Up @@ -215,11 +219,11 @@ func Post0132Hash(b *Block, stateDiff *StateDiff) (*felt.Felt, *BlockCommitments
new(felt.Felt).SetUint64(b.Timestamp), // block timestamp
concatCounts,
sdCommitment,
txCommitment, // transaction commitment
eCommitment, // event commitment
rCommitment, // receipt commitment
b.GasPrice, // gas price in wei
b.GasPriceSTRK, // gas price in fri
txCommitment, // transaction commitment
eCommitment, // event commitment
rCommitment, // receipt commitment
b.L1GasPriceETH, // gas price in wei
b.L1GasPriceSTRK, // gas price in fri
b.L1DataGasPrice.PriceInWei,
b.L1DataGasPrice.PriceInFri,
new(felt.Felt).SetBytes([]byte(b.ProtocolVersion)),
Expand Down
9 changes: 7 additions & 2 deletions rpc/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type BlockHeader struct {
Timestamp uint64 `json:"timestamp"`
SequencerAddress *felt.Felt `json:"sequencer_address,omitempty"`
L1GasPrice *ResourcePrice `json:"l1_gas_price"`
L2GasPrice *ResourcePrice `json:"l2_gas_price"`
L1DataGasPrice *ResourcePrice `json:"l1_data_gas_price,omitempty"`
L1DAMode *L1DAMode `json:"l1_da_mode,omitempty"`
StarknetVersion string `json:"starknet_version"`
Expand Down Expand Up @@ -326,8 +327,12 @@ func adaptBlockHeader(header *core.Header) BlockHeader {
Timestamp: header.Timestamp,
SequencerAddress: sequencerAddress,
L1GasPrice: &ResourcePrice{
InWei: header.GasPrice,
InFri: nilToZero(header.GasPriceSTRK), // Old block headers will be nil.
InWei: header.L1GasPriceETH,
InFri: nilToZero(header.L1GasPriceSTRK),
},
L2GasPrice: &ResourcePrice{
InWei: header.L2GasPriceETH,
InFri: header.L2GasPriceSTRK,
},
L1DataGasPrice: &l1DataGasPrice,
L1DAMode: &l1DAMode,
Expand Down
6 changes: 6 additions & 0 deletions rpc/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ func TestBlockWithTxHashesV013(t *testing.T) {
InFri: utils.HexToFelt(t, "0x17882b6aa74"),
InWei: utils.HexToFelt(t, "0x3b9aca10"),
},
L2GasPrice: &rpc.ResourcePrice{
InFri: nil,
InWei: nil,
},
L1DataGasPrice: &rpc.ResourcePrice{
InFri: utils.HexToFelt(t, "0x2cc6d7f596e1"),
InWei: utils.HexToFelt(t, "0x716a8f6dd"),
Expand Down Expand Up @@ -643,6 +647,7 @@ func TestBlockWithReceipts(t *testing.T) {
Timestamp: header.Timestamp,
SequencerAddress: header.SequencerAddress,
L1GasPrice: header.L1GasPrice,
L2GasPrice: header.L2GasPrice,
L1DataGasPrice: header.L1DataGasPrice,
L1DAMode: header.L1DAMode,
StarknetVersion: header.StarknetVersion,
Expand Down Expand Up @@ -689,6 +694,7 @@ func TestBlockWithReceipts(t *testing.T) {
SequencerAddress: header.SequencerAddress,
L1DAMode: header.L1DAMode,
L1GasPrice: header.L1GasPrice,
L2GasPrice: header.L2GasPrice,
L1DataGasPrice: header.L1DataGasPrice,
StarknetVersion: header.StarknetVersion,
},
Expand Down
56 changes: 50 additions & 6 deletions rpc/estimate_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
}

type FeeEstimate struct {
type FeeEstimateV0_7 struct {
GasConsumed *felt.Felt `json:"gas_consumed"`
GasPrice *felt.Felt `json:"gas_price"`
DataGasConsumed *felt.Felt `json:"data_gas_consumed"`
Expand All @@ -37,10 +37,45 @@
Unit *FeeUnit `json:"unit,omitempty"`
}

type FeeEstimate struct {
L1GasConsumed *felt.Felt `json:"l1_gas_consumed,omitempty"`
L1GasPrice *felt.Felt `json:"l1_gas_price,omitempty"`
L2GasConsumed *felt.Felt `json:"l2_gas_consumed,omitempty"`
L2GasPrice *felt.Felt `json:"l2_gas_price,omitempty"`
L1DataGasConsumed *felt.Felt `json:"l1_data_gas_consumed,omitempty"`
L1DataGasPrice *felt.Felt `json:"l1_data_gas_price,omitempty"`
OverallFee *felt.Felt `json:"overall_fee"`
Unit *FeeUnit `json:"unit,omitempty"`
}

/****************************************************
Estimate Fee Handlers
*****************************************************/

func feeEstimateToV0_7(feeEstimate FeeEstimate) FeeEstimateV0_7 {
return FeeEstimateV0_7{
GasConsumed: feeEstimate.L1GasConsumed,
GasPrice: feeEstimate.L1GasPrice,
DataGasConsumed: feeEstimate.L1DataGasConsumed,
DataGasPrice: feeEstimate.L1DataGasPrice,
OverallFee: feeEstimate.OverallFee,
Unit: feeEstimate.Unit,
}
}

func (h *Handler) EstimateFeeV0_7(broadcastedTxns []BroadcastedTransaction,
simulationFlags []SimulationFlag, id BlockID,
) ([]FeeEstimateV0_7, http.Header, *jsonrpc.Error) {
result, httpHeader, err := h.simulateTransactions(id, broadcastedTxns, append(simulationFlags, SkipFeeChargeFlag), true)
if err != nil {
return nil, httpHeader, err
}

return utils.Map(result, func(tx SimulatedTransaction) FeeEstimateV0_7 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can pass function name (=pointer) like:

return utils.Map(result, FeeEstimateToV0_7)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, feeEstimateToV0_7 adapts FeeEstimate, not SimulatedTransaction.
return utils.Map(result, feeEstimateToV0_7) requires changes in feeEstimateToV0_7.

return feeEstimateToV0_7(tx.FeeEstimation)
}), httpHeader, nil

Check warning on line 76 in rpc/estimate_fee.go

View check run for this annotation

Codecov / codecov/patch

rpc/estimate_fee.go#L75-L76

Added lines #L75 - L76 were not covered by tests
}

func (h *Handler) EstimateFee(broadcastedTxns []BroadcastedTransaction,
simulationFlags []SimulationFlag, id BlockID,
) ([]FeeEstimate, http.Header, *jsonrpc.Error) {
Expand All @@ -54,18 +89,27 @@
}), httpHeader, nil
}

func (h *Handler) EstimateMessageFee(msg MsgFromL1, id BlockID) (*FeeEstimate, http.Header, *jsonrpc.Error) { //nolint:gocritic
return h.estimateMessageFee(msg, id, h.EstimateFee)
//nolint:gocritic
func (h *Handler) EstimateMessageFeeV0_7(msg MsgFromL1, id BlockID) (*FeeEstimateV0_7, http.Header, *jsonrpc.Error) {
estimate, header, err := estimateMessageFee(msg, id, h.EstimateFee)
if err != nil {
return nil, header, err
}
estimateV0_7 := feeEstimateToV0_7(*estimate)
return &estimateV0_7, header, nil

Check warning on line 99 in rpc/estimate_fee.go

View check run for this annotation

Codecov / codecov/patch

rpc/estimate_fee.go#L93-L99

Added lines #L93 - L99 were not covered by tests
}

//nolint:gocritic
func (h *Handler) EstimateMessageFee(msg MsgFromL1, id BlockID) (*FeeEstimate, http.Header, *jsonrpc.Error) {
return estimateMessageFee(msg, id, h.EstimateFee)

Check warning on line 104 in rpc/estimate_fee.go

View check run for this annotation

Codecov / codecov/patch

rpc/estimate_fee.go#L103-L104

Added lines #L103 - L104 were not covered by tests
}

type estimateFeeHandler func(broadcastedTxns []BroadcastedTransaction,
simulationFlags []SimulationFlag, id BlockID,
) ([]FeeEstimate, http.Header, *jsonrpc.Error)

//nolint:gocritic
func (h *Handler) estimateMessageFee(msg MsgFromL1, id BlockID, f estimateFeeHandler) (*FeeEstimate,
http.Header, *jsonrpc.Error,
) {
func estimateMessageFee(msg MsgFromL1, id BlockID, f estimateFeeHandler) (*FeeEstimate, http.Header, *jsonrpc.Error) {

Check warning on line 112 in rpc/estimate_fee.go

View check run for this annotation

Codecov / codecov/patch

rpc/estimate_fee.go#L112

Added line #L112 was not covered by tests
calldata := make([]*felt.Felt, 0, len(msg.Payload)+1)
// The order of the calldata parameters matters. msg.From must be prepended.
calldata = append(calldata, new(felt.Felt).SetBytes(msg.From.Bytes()))
Expand Down
43 changes: 43 additions & 0 deletions rpc/estimate_fee_pkg_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package rpc

import (
"testing"

"github.com/NethermindEth/juno/core/felt"
"github.com/stretchr/testify/assert"
)

func TestFeeEstimateToV0_7(t *testing.T) {
t.Run("empty", func(t *testing.T) {
assert.Equal(t, FeeEstimateV0_7{}, feeEstimateToV0_7(FeeEstimate{}))
})

t.Run("full", func(t *testing.T) {
gasConsumed := new(felt.Felt).SetUint64(1)
gasPrice := new(felt.Felt).SetUint64(2)
dataGasConsumed := new(felt.Felt).SetUint64(3)
dataGasPrice := new(felt.Felt).SetUint64(4)
overallFee := new(felt.Felt).SetUint64(5)
unit := WEI
assert.Equal(
t,
FeeEstimateV0_7{
GasConsumed: gasConsumed,
GasPrice: gasPrice,
DataGasConsumed: dataGasConsumed,
DataGasPrice: dataGasPrice,
OverallFee: overallFee,
Unit: &unit,
},
feeEstimateToV0_7(FeeEstimate{
L1GasConsumed: gasConsumed,
L1GasPrice: gasPrice,
L2GasConsumed: new(felt.Felt).SetUint64(6),
L2GasPrice: new(felt.Felt).SetUint64(7),
L1DataGasConsumed: dataGasConsumed,
L1DataGasPrice: dataGasPrice,
OverallFee: overallFee,
Unit: &unit,
}))
})
}
24 changes: 21 additions & 3 deletions rpc/estimate_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,53 @@ func TestEstimateFee(t *testing.T) {
blockInfo := vm.BlockInfo{Header: &core.Header{}}
t.Run("ok with zero values", func(t *testing.T) {
mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, false, true).
Return([]*felt.Felt{}, []core.GasConsumed{}, []vm.TransactionTrace{}, uint64(123), nil)
Return([]*felt.Felt{}, []core.GasConsumed{}, []vm.TransactionTrace{}, uint64(123), nil).Times(2)

_, httpHeader, err := handler.EstimateFee([]rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{}, rpc.BlockID{Latest: true})
require.Nil(t, err)
assert.Equal(t, httpHeader.Get(rpc.ExecutionStepsHeader), "123")

// TODO: Remove this when v0.7 is removed
_, httpHeader, err = handler.EstimateFeeV0_7([]rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{}, rpc.BlockID{Latest: true})
require.Nil(t, err)
assert.Equal(t, httpHeader.Get(rpc.ExecutionStepsHeader), "123")
})

t.Run("ok with zero values, skip validate", func(t *testing.T) {
mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, true, true).
Return([]*felt.Felt{}, []core.GasConsumed{}, []vm.TransactionTrace{}, uint64(123), nil)
Return([]*felt.Felt{}, []core.GasConsumed{}, []vm.TransactionTrace{}, uint64(123), nil).Times(2)

_, httpHeader, err := handler.EstimateFee([]rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}, rpc.BlockID{Latest: true})
require.Nil(t, err)
assert.Equal(t, httpHeader.Get(rpc.ExecutionStepsHeader), "123")

// TODO: Remove this when v0.7 is removed
_, httpHeader, err = handler.EstimateFeeV0_7([]rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}, rpc.BlockID{Latest: true})
require.Nil(t, err)
assert.Equal(t, httpHeader.Get(rpc.ExecutionStepsHeader), "123")
})

t.Run("transaction execution error", func(t *testing.T) {
mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, true, true).
Return(nil, nil, nil, uint64(0), vm.TransactionExecutionError{
Index: 44,
Cause: errors.New("oops"),
})
}).Times(2)

_, httpHeader, err := handler.EstimateFee([]rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}, rpc.BlockID{Latest: true})
require.Equal(t, rpc.ErrTransactionExecutionError.CloneWithData(rpc.TransactionExecutionErrorData{
TransactionIndex: 44,
ExecutionError: "oops",
}), err)
require.Equal(t, httpHeader.Get(rpc.ExecutionStepsHeader), "0")

// TODO: Remove this when v0.7 is removed
_, httpHeader, err = handler.EstimateFeeV0_7([]rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}, rpc.BlockID{Latest: true})
require.Equal(t, rpc.ErrTransactionExecutionError.CloneWithData(rpc.TransactionExecutionErrorData{
TransactionIndex: 44,
ExecutionError: "oops",
}), err)
require.Equal(t, httpHeader.Get(rpc.ExecutionStepsHeader), "0")
})

t.Run("transaction with invalid contract class", func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions rpc/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,12 @@ func (h *Handler) MethodsV0_7() ([]jsonrpc.Method, string) { //nolint: funlen
{
Name: "starknet_estimateFee",
Params: []jsonrpc.Parameter{{Name: "request"}, {Name: "simulation_flags"}, {Name: "block_id"}},
Handler: h.EstimateFee,
Handler: h.EstimateFeeV0_7,
},
{
Name: "starknet_estimateMessageFee",
Params: []jsonrpc.Parameter{{Name: "message"}, {Name: "block_id"}},
Handler: h.EstimateMessageFee,
Handler: h.EstimateMessageFeeV0_7,
},
{
Name: "starknet_traceTransaction",
Expand Down
Loading
Loading