From 07a49b3c6b8ef68dc0c7703e386d1714dd59be1c Mon Sep 17 00:00:00 2001 From: Mario Apra Date: Fri, 9 Aug 2024 15:47:49 +0100 Subject: [PATCH] Stop skipping tests Right now the only tests being skipped is the p2p tests Co-authored-by: kirugan --- rpc/block_test.go | 10 +++--- rpc/estimate_fee_test.go | 45 ++++++++++++-------------- rpc/events_test.go | 6 ++-- rpc/simulation.go | 3 +- rpc/simulation_test.go | 70 +++++++++++++++++++++------------------- rpc/trace_test.go | 12 +++---- rpc/transaction_test.go | 59 +++++++++++++++++---------------- 7 files changed, 101 insertions(+), 104 deletions(-) diff --git a/rpc/block_test.go b/rpc/block_test.go index d7a02e348b..c0ebb4f723 100644 --- a/rpc/block_test.go +++ b/rpc/block_test.go @@ -588,16 +588,13 @@ func TestBlockWithReceipts(t *testing.T) { mainnetGw := adaptfeeder.New(client) t.Run("pending block", func(t *testing.T) { - t.Skip() block0, err := mainnetGw.BlockByNumber(context.Background(), 0) require.NoError(t, err) - blockID := rpc.BlockID{Pending: true} - mockReader.EXPECT().Pending().Return(blockchain.Pending{Block: block0}, nil) mockReader.EXPECT().L1Head().Return(&core.L1Head{}, nil) - resp, rpcErr := handler.BlockWithReceipts(blockID) + resp, rpcErr := handler.BlockWithReceipts(rpc.BlockID{Pending: true}) header := resp.BlockHeader var txsWithReceipt []rpc.TransactionWithReceipt @@ -622,6 +619,8 @@ func TestBlockWithReceipts(t *testing.T) { Timestamp: header.Timestamp, SequencerAddress: header.SequencerAddress, L1GasPrice: header.L1GasPrice, + L1DataGasPrice: header.L1DataGasPrice, + L1DAMode: header.L1DAMode, StarknetVersion: header.StarknetVersion, }, Transactions: txsWithReceipt, @@ -629,7 +628,6 @@ func TestBlockWithReceipts(t *testing.T) { }) t.Run("accepted L1 block", func(t *testing.T) { - t.Skip() block1, err := mainnetGw.BlockByNumber(context.Background(), 1) require.NoError(t, err) @@ -664,7 +662,9 @@ func TestBlockWithReceipts(t *testing.T) { NewRoot: header.NewRoot, Timestamp: header.Timestamp, SequencerAddress: header.SequencerAddress, + L1DAMode: header.L1DAMode, L1GasPrice: header.L1GasPrice, + L1DataGasPrice: header.L1DataGasPrice, StarknetVersion: header.StarknetVersion, }, Transactions: transactions, diff --git a/rpc/estimate_fee_test.go b/rpc/estimate_fee_test.go index da3703e977..0520a806f2 100644 --- a/rpc/estimate_fee_test.go +++ b/rpc/estimate_fee_test.go @@ -3,6 +3,7 @@ package rpc_test import ( "encoding/json" "errors" + "fmt" "testing" "github.com/NethermindEth/juno/core" @@ -18,8 +19,7 @@ import ( "go.uber.org/mock/gomock" ) -func TestEstimateMessageFee(t *testing.T) { - t.Skip() +func TestEstimateMessageFeeV0_6(t *testing.T) { mockCtrl := gomock.NewController(t) t.Cleanup(mockCtrl.Finish) @@ -57,7 +57,7 @@ func TestEstimateMessageFee(t *testing.T) { Header: latestHeader, }, gomock.Any(), &utils.Mainnet, gomock.Any(), false, true, false).DoAndReturn( func(txns []core.Transaction, declaredClasses []core.Class, paidFeesOnL1 []*felt.Felt, blockInfo *vm.BlockInfo, - state core.StateReader, network *utils.Network, skipChargeFee, skipValidate, errOnRevert bool, + state core.StateReader, network *utils.Network, skipChargeFee, skipValidate, errOnRevert, useBlobData bool, ) ([]*felt.Felt, []*felt.Felt, []vm.TransactionTrace, error) { require.Len(t, txns, 1) assert.NotNil(t, txns[0].(*core.L1HandlerTransaction)) @@ -81,18 +81,21 @@ func TestEstimateMessageFee(t *testing.T) { estimateFee, err := handler.EstimateMessageFeeV0_6(msg, rpc.BlockID{Latest: true}) require.Nil(t, err) - feeUnit := rpc.WEI - require.Equal(t, rpc.FeeEstimate{ - GasConsumed: expectedGasConsumed, - GasPrice: latestHeader.GasPrice, - OverallFee: new(felt.Felt).Mul(expectedGasConsumed, latestHeader.GasPrice), - Unit: &feeUnit, - }, *estimateFee) + expectedJSON := fmt.Sprintf( + `{"gas_consumed":%q,"gas_price":%q,"overall_fee":%q,"unit":"WEI"}`, + expectedGasConsumed, + latestHeader.GasPrice, + new(felt.Felt).Mul(expectedGasConsumed, latestHeader.GasPrice), + ) + + // we check json response here because some fields are private and we can't set them and assert.Equal fails + // also in 0.6 response some fields should not be presented + estimateFeeJSON, jsonErr := json.Marshal(estimateFee) + require.NoError(t, jsonErr) + require.Equal(t, expectedJSON, string(estimateFeeJSON)) } func TestEstimateFee(t *testing.T) { - t.Skip() - mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() @@ -110,24 +113,24 @@ func TestEstimateFee(t *testing.T) { blockInfo := vm.BlockInfo{Header: &core.Header{}} t.Run("ok with zero values", func(t *testing.T) { - mockVM.EXPECT().Execute(nil, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, true, false, false). - Return([]*felt.Felt{}, []vm.TransactionTrace{}, nil) + mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, false, true, true). + Return([]*felt.Felt{}, []*felt.Felt{}, []vm.TransactionTrace{}, nil) _, err := handler.EstimateFee([]rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{}, rpc.BlockID{Latest: true}) require.Nil(t, err) }) t.Run("ok with zero values, skip validate", func(t *testing.T) { - mockVM.EXPECT().Execute(nil, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, true, false, false). - Return([]*felt.Felt{}, []vm.TransactionTrace{}, nil) + mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, true, true, true). + Return([]*felt.Felt{}, []*felt.Felt{}, []vm.TransactionTrace{}, nil) _, err := handler.EstimateFee([]rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}, rpc.BlockID{Latest: true}) require.Nil(t, err) }) t.Run("transaction execution error", func(t *testing.T) { - mockVM.EXPECT().Execute(nil, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, true, false, false). - Return(nil, nil, vm.TransactionExecutionError{ + mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &blockInfo, mockState, n, true, true, true, true). + Return(nil, nil, nil, vm.TransactionExecutionError{ Index: 44, Cause: errors.New("oops"), }) @@ -137,12 +140,6 @@ func TestEstimateFee(t *testing.T) { TransactionIndex: 44, ExecutionError: "oops", }), err) - - mockVM.EXPECT().Execute(nil, nil, []*felt.Felt{}, &blockInfo, mockState, n, false, true, true, false). - Return(nil, nil, vm.TransactionExecutionError{ - Index: 44, - Cause: errors.New("oops"), - }) }) } diff --git a/rpc/events_test.go b/rpc/events_test.go index 3db08d233e..5ed4973306 100644 --- a/rpc/events_test.go +++ b/rpc/events_test.go @@ -230,7 +230,6 @@ func (fc *fakeConn) Equal(other jsonrpc.Conn) bool { } func TestSubscribeNewHeadsAndUnsubscribe(t *testing.T) { - t.Skip() t.Parallel() log := utils.NewNopZapLogger() n := utils.Ptr(utils.Mainnet) @@ -281,7 +280,7 @@ func TestSubscribeNewHeadsAndUnsubscribe(t *testing.T) { syncCancel() // Receive a block header. - want := `{"jsonrpc":"2.0","method":"juno_subscribeNewHeads","params":{"result":{"block_hash":"0x4e1f77f39545afe866ac151ac908bd1a347a2a8a7d58bef1276db4f06fdf2f6","parent_hash":"0x2a70fb03fe363a2d6be843343a1d81ce6abeda1e9bd5cc6ad8fa9f45e30fdeb","block_number":2,"new_root":"0x3ceee867d50b5926bb88c0ec7e0b9c20ae6b537e74aac44b8fcf6bb6da138d9","timestamp":1637084470,"sequencer_address":"0x0","l1_gas_price":{"price_in_fri":"0x0","price_in_wei":"0x0"},"starknet_version":""},"subscription":%d}}` + want := `{"jsonrpc":"2.0","method":"juno_subscribeNewHeads","params":{"result":{"block_hash":"0x4e1f77f39545afe866ac151ac908bd1a347a2a8a7d58bef1276db4f06fdf2f6","parent_hash":"0x2a70fb03fe363a2d6be843343a1d81ce6abeda1e9bd5cc6ad8fa9f45e30fdeb","block_number":2,"new_root":"0x3ceee867d50b5926bb88c0ec7e0b9c20ae6b537e74aac44b8fcf6bb6da138d9","timestamp":1637084470,"sequencer_address":"0x0","l1_gas_price":{"price_in_fri":"0x0","price_in_wei":"0x0"},"l1_data_gas_price":{"price_in_fri":"0x0","price_in_wei":"0x0"},"l1_da_mode":"CALLDATA","starknet_version":""},"subscription":%d}}` want = fmt.Sprintf(want, id) got := make([]byte, len(want)) _, err := clientConn.Read(got) @@ -312,7 +311,6 @@ func TestSubscribeNewHeadsAndUnsubscribe(t *testing.T) { } func TestMultipleSubscribeNewHeadsAndUnsubscribe(t *testing.T) { - t.Skip() t.Parallel() log := utils.NewNopZapLogger() n := utils.Ptr(utils.Mainnet) @@ -382,7 +380,7 @@ func TestMultipleSubscribeNewHeadsAndUnsubscribe(t *testing.T) { syncCancel() // Receive a block header. - want = `{"jsonrpc":"2.0","method":"juno_subscribeNewHeads","params":{"result":{"block_hash":"0x4e1f77f39545afe866ac151ac908bd1a347a2a8a7d58bef1276db4f06fdf2f6","parent_hash":"0x2a70fb03fe363a2d6be843343a1d81ce6abeda1e9bd5cc6ad8fa9f45e30fdeb","block_number":2,"new_root":"0x3ceee867d50b5926bb88c0ec7e0b9c20ae6b537e74aac44b8fcf6bb6da138d9","timestamp":1637084470,"sequencer_address":"0x0","l1_gas_price":{"price_in_fri":"0x0","price_in_wei":"0x0"},"starknet_version":""},"subscription":%d}}` + want = `{"jsonrpc":"2.0","method":"juno_subscribeNewHeads","params":{"result":{"block_hash":"0x4e1f77f39545afe866ac151ac908bd1a347a2a8a7d58bef1276db4f06fdf2f6","parent_hash":"0x2a70fb03fe363a2d6be843343a1d81ce6abeda1e9bd5cc6ad8fa9f45e30fdeb","block_number":2,"new_root":"0x3ceee867d50b5926bb88c0ec7e0b9c20ae6b537e74aac44b8fcf6bb6da138d9","timestamp":1637084470,"sequencer_address":"0x0","l1_gas_price":{"price_in_fri":"0x0","price_in_wei":"0x0"},"l1_data_gas_price":{"price_in_fri":"0x0","price_in_wei":"0x0"},"l1_da_mode":"CALLDATA","starknet_version":""},"subscription":%d}}` firstWant = fmt.Sprintf(want, firstID) _, firstGot, err = conn1.Read(ctx) require.NoError(t, err) diff --git a/rpc/simulation.go b/rpc/simulation.go index 4948c062ac..fb58b230b4 100644 --- a/rpc/simulation.go +++ b/rpc/simulation.go @@ -56,7 +56,8 @@ func (h *Handler) SimulateTransactions(id BlockID, transactions []BroadcastedTra func (h *Handler) SimulateTransactionsV0_6(id BlockID, transactions []BroadcastedTransaction, simulationFlags []SimulationFlag, ) ([]SimulatedTransaction, *jsonrpc.Error) { - return h.simulateTransactions(id, transactions, simulationFlags, true, true) + // todo double check errOnRevert = false + return h.simulateTransactions(id, transactions, simulationFlags, true, false) } //nolint:funlen,gocyclo diff --git a/rpc/simulation_test.go b/rpc/simulation_test.go index 135d8c879d..8a35aee4e0 100644 --- a/rpc/simulation_test.go +++ b/rpc/simulation_test.go @@ -14,8 +14,8 @@ import ( "go.uber.org/mock/gomock" ) -func TestSimulateTransactions(t *testing.T) { - t.Skip() +//nolint:dupl +func TestSimulateTransactionsV0_6(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() @@ -34,51 +34,55 @@ func TestSimulateTransactions(t *testing.T) { mockReader.EXPECT().HeadsHeader().Return(headsHeader, nil).AnyTimes() t.Run("ok with zero values, skip fee", func(t *testing.T) { - mockVM.EXPECT().Execute(nil, nil, []*felt.Felt{}, &vm.BlockInfo{ + mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &vm.BlockInfo{ Header: headsHeader, }, mockState, n, true, false, false, false). - Return([]*felt.Felt{}, []vm.TransactionTrace{}, nil) + Return([]*felt.Felt{}, []*felt.Felt{}, []vm.TransactionTrace{}, nil) - _, err := handler.SimulateTransactions(rpc.BlockID{Latest: true}, []rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipFeeChargeFlag}) + _, err := handler.SimulateTransactionsV0_6(rpc.BlockID{Latest: true}, []rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipFeeChargeFlag}) require.Nil(t, err) }) t.Run("ok with zero values, skip validate", func(t *testing.T) { - mockVM.EXPECT().Execute(nil, nil, []*felt.Felt{}, &vm.BlockInfo{ + mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &vm.BlockInfo{ Header: headsHeader, - }, mockState, n, false, false, false, false). - Return([]*felt.Felt{}, []vm.TransactionTrace{}, nil) + }, mockState, n, false, true, false, false). + Return([]*felt.Felt{}, []*felt.Felt{}, []vm.TransactionTrace{}, nil) - _, err := handler.SimulateTransactions(rpc.BlockID{Latest: true}, []rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}) + _, err := handler.SimulateTransactionsV0_6(rpc.BlockID{Latest: true}, []rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}) require.Nil(t, err) }) t.Run("transaction execution error", func(t *testing.T) { - mockVM.EXPECT().Execute(nil, nil, []*felt.Felt{}, &vm.BlockInfo{ - Header: headsHeader, - }, mockState, n, false, false, false, false). - Return(nil, nil, vm.TransactionExecutionError{ - Index: 44, - Cause: errors.New("oops"), - }) - - _, err := handler.SimulateTransactions(rpc.BlockID{Latest: true}, []rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}) - require.Equal(t, rpc.ErrTransactionExecutionError.CloneWithData(rpc.TransactionExecutionErrorData{ - TransactionIndex: 44, - ExecutionError: "oops", - }), err) + t.Run("v0_6", func(t *testing.T) { //nolint:dupl + mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &vm.BlockInfo{ + Header: headsHeader, + }, mockState, n, false, true, false, false). + Return(nil, nil, nil, vm.TransactionExecutionError{ + Index: 44, + Cause: errors.New("oops"), + }) - mockVM.EXPECT().Execute(nil, nil, []*felt.Felt{}, &vm.BlockInfo{ - Header: headsHeader, - }, mockState, n, false, true, true, false). - Return(nil, nil, vm.TransactionExecutionError{ - Index: 44, - Cause: errors.New("oops"), - }) + _, err := handler.SimulateTransactionsV0_6(rpc.BlockID{Latest: true}, []rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}) + require.Equal(t, rpc.ErrTransactionExecutionError.CloneWithData(rpc.TransactionExecutionErrorData{ + TransactionIndex: 44, + ExecutionError: "oops", + }), err) + }) + t.Run("v0_7", func(t *testing.T) { //nolint:dupl + mockVM.EXPECT().Execute([]core.Transaction{}, nil, []*felt.Felt{}, &vm.BlockInfo{ + Header: headsHeader, + }, mockState, n, false, true, false, true). + Return(nil, nil, nil, vm.TransactionExecutionError{ + Index: 44, + Cause: errors.New("oops"), + }) - _, err = handler.SimulateTransactionsV0_6(rpc.BlockID{Latest: true}, []rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}) - require.Equal(t, rpc.ErrContractError.CloneWithData(rpc.ContractErrorData{ - RevertError: "oops", - }), err) + _, err := handler.SimulateTransactions(rpc.BlockID{Latest: true}, []rpc.BroadcastedTransaction{}, []rpc.SimulationFlag{rpc.SkipValidateFlag}) + require.Equal(t, rpc.ErrTransactionExecutionError.CloneWithData(rpc.TransactionExecutionErrorData{ + TransactionIndex: 44, + ExecutionError: "oops", + }), err) + }) }) } diff --git a/rpc/trace_test.go b/rpc/trace_test.go index b1a4debaf2..3721788a68 100644 --- a/rpc/trace_test.go +++ b/rpc/trace_test.go @@ -390,9 +390,7 @@ func TestTraceTransactionV0_6(t *testing.T) { }) } -func TestTraceBlockTransactions(t *testing.T) { - t.Skip() - +func TestTraceBlockTransactionsV0_6(t *testing.T) { errTests := map[string]rpc.BlockID{ "latest": {Latest: true}, "pending": {Pending: true}, @@ -474,9 +472,9 @@ func TestTraceBlockTransactions(t *testing.T) { require.NoError(t, json.Unmarshal(vmTraceJSON, &vmTrace)) mockVM.EXPECT().Execute(block.Transactions, []core.Class{declaredClass.Class}, paidL1Fees, &vm.BlockInfo{Header: header}, gomock.Any(), n, false, false, false, false). - Return(nil, []vm.TransactionTrace{vmTrace, vmTrace}, nil) + Return(nil, nil, []vm.TransactionTrace{vmTrace, vmTrace}, nil) - result, err := handler.TraceBlockTransactions(context.Background(), rpc.BlockID{Hash: blockHash}) + result, err := handler.TraceBlockTransactionsV0_6(context.Background(), rpc.BlockID{Hash: blockHash}) require.Nil(t, err) assert.Equal(t, &vm.TransactionTrace{ ValidateInvocation: &vm.FunctionInvocation{}, @@ -541,7 +539,7 @@ func TestTraceBlockTransactions(t *testing.T) { require.NoError(t, json.Unmarshal(vmTraceJSON, &vmTrace)) mockVM.EXPECT().Execute([]core.Transaction{tx}, []core.Class{declaredClass.Class}, []*felt.Felt{}, &vm.BlockInfo{Header: header}, gomock.Any(), n, false, false, false, false). - Return(nil, []vm.TransactionTrace{vmTrace}, nil) + Return(nil, nil, []vm.TransactionTrace{vmTrace}, nil) expectedResult := []rpc.TracedBlockTransaction{ { @@ -549,7 +547,7 @@ func TestTraceBlockTransactions(t *testing.T) { TraceRoot: &vmTrace, }, } - result, err := handler.TraceBlockTransactions(context.Background(), rpc.BlockID{Hash: blockHash}) + result, err := handler.TraceBlockTransactionsV0_6(context.Background(), rpc.BlockID{Hash: blockHash}) require.Nil(t, err) assert.Equal(t, expectedResult, result) }) diff --git a/rpc/transaction_test.go b/rpc/transaction_test.go index 78bc9c3f6d..53a1292bb8 100644 --- a/rpc/transaction_test.go +++ b/rpc/transaction_test.go @@ -488,13 +488,8 @@ func TestTransactionByBlockIdAndIndex(t *testing.T) { }) } -// TODO[Pawel]: The following 2 tests `Test[Legacy]TransactionReceiptByHash` are skipped -// but we still keep them here. I have a doubt whether they test anything useful. -// //nolint:dupl -func TestTransactionReceiptByHash(t *testing.T) { - t.Skip() - +func TestTransactionReceiptByHashV0_6(t *testing.T) { mockCtrl := gomock.NewController(t) t.Cleanup(mockCtrl.Finish) @@ -506,7 +501,7 @@ func TestTransactionReceiptByHash(t *testing.T) { txHash := new(felt.Felt).SetBytes([]byte("random hash")) mockReader.EXPECT().TransactionByHash(txHash).Return(nil, errors.New("tx not found")) - tx, rpcErr := handler.TransactionReceiptByHash(*txHash) + tx, rpcErr := handler.TransactionReceiptByHashV0_6(*txHash) assert.Nil(t, tx) assert.Equal(t, rpc.ErrTxnHashNotFound, rpcErr) }) @@ -523,7 +518,7 @@ func TestTransactionReceiptByHash(t *testing.T) { expectedMap := make(map[string]any) require.NoError(t, json.Unmarshal([]byte(expected), &expectedMap)) - receipt, err := handler.TransactionReceiptByHash(*h) + receipt, err := handler.TransactionReceiptByHashV0_6(*h) require.Nil(t, err) receiptJSON, jsonErr := json.Marshal(receipt) @@ -752,8 +747,7 @@ func TestTransactionReceiptByHash(t *testing.T) { } //nolint:dupl -func TestLegacyTransactionReceiptByHash(t *testing.T) { - t.Skip() +func TestTransactionReceiptByHash(t *testing.T) { mockCtrl := gomock.NewController(t) t.Cleanup(mockCtrl.Finish) @@ -776,21 +770,19 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { block0, err := mainnetGw.BlockByNumber(context.Background(), 0) require.NoError(t, err) - checkTxReceipt := func(t *testing.T, _ *felt.Felt, expected string) { + checkTxReceipt := func(t *testing.T, h *felt.Felt, expected string) { t.Helper() expectedMap := make(map[string]any) require.NoError(t, json.Unmarshal([]byte(expected), &expectedMap)) - //nolint:gocritic - // receipt, err := handler.LegacyTransactionReceiptByHash(*h) - // require.Nil(t, err) - // receiptJSON, jsonErr := json.Marshal(receipt) - // require.NoError(t, jsonErr) + receipt, err := handler.TransactionReceiptByHash(*h) + require.Nil(t, err) + receiptJSON, jsonErr := json.Marshal(receipt) + require.NoError(t, jsonErr) receiptMap := make(map[string]any) - //nolint:gocritic - // require.NoError(t, json.Unmarshal(receiptJSON, &receiptMap)) + require.NoError(t, json.Unmarshal(receiptJSON, &receiptMap)) assert.Equal(t, expectedMap, receiptMap) } @@ -803,7 +795,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { expected: `{ "type": "DEPLOY", "transaction_hash": "0xe0a2e45a80bb827967e096bcf58874f6c01c191e0a0530624cba66a508ae75", - "actual_fee": "0x0", + "actual_fee": {"amount": "0x0", "unit": "WEI"}, "finality_status": "ACCEPTED_ON_L2", "execution_status": "SUCCEEDED", "block_hash": "0x47c3637b57c2b079b93c61539950c17e868a28f46cdef28f88521067f21e943", @@ -811,7 +803,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { "messages_sent": [], "events": [], "contract_address": "0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6", - "execution_resources": {"bitwise_builtin_applications":"0x0", "ec_op_builtin_applications":"0x0", "ecdsa_builtin_applications":"0x0", "keccak_builtin_applications":"0x0", "memory_holes":"0x0", "pedersen_builtin_applications":"0x0", "poseidon_builtin_applications":"0x0", "range_check_builtin_applications":"0x0", "steps":"0x1d"} + "execution_resources":{"steps":29} }`, }, "without contract addr": { @@ -819,7 +811,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { expected: `{ "type": "INVOKE", "transaction_hash": "0xce54bbc5647e1c1ea4276c01a708523f740db0ff5474c77734f73beec2624", - "actual_fee": "0x0", + "actual_fee": {"amount": "0x0", "unit": "WEI"}, "finality_status": "ACCEPTED_ON_L2", "execution_status": "SUCCEEDED", "block_hash": "0x47c3637b57c2b079b93c61539950c17e868a28f46cdef28f88521067f21e943", @@ -835,7 +827,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { } ], "events": [], - "execution_resources":{"bitwise_builtin_applications":"0x0", "ec_op_builtin_applications":"0x0", "ecdsa_builtin_applications":"0x0", "keccak_builtin_applications":"0x0", "memory_holes":"0x0", "pedersen_builtin_applications":"0x0", "poseidon_builtin_applications":"0x0", "range_check_builtin_applications":"0x0", "steps":"0x1f"} + "execution_resources":{"steps":31} }`, }, } @@ -855,7 +847,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { expected := `{ "type": "INVOKE", "transaction_hash": "0xce54bbc5647e1c1ea4276c01a708523f740db0ff5474c77734f73beec2624", - "actual_fee": "0x0", + "actual_fee": {"amount": "0x0", "unit": "WEI"}, "finality_status": "ACCEPTED_ON_L2", "execution_status": "SUCCEEDED", "messages_sent": [ @@ -869,7 +861,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { } ], "events": [], - "execution_resources":{"bitwise_builtin_applications":"0x0", "ec_op_builtin_applications":"0x0", "ecdsa_builtin_applications":"0x0", "keccak_builtin_applications":"0x0", "memory_holes":"0x0", "pedersen_builtin_applications":"0x0", "poseidon_builtin_applications":"0x0", "range_check_builtin_applications":"0x0", "steps":"0x1f"} + "execution_resources":{"steps":31} }` txHash := block0.Transactions[i].Hash() @@ -884,7 +876,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { expected := `{ "type": "INVOKE", "transaction_hash": "0xce54bbc5647e1c1ea4276c01a708523f740db0ff5474c77734f73beec2624", - "actual_fee": "0x0", + "actual_fee": {"amount": "0x0", "unit": "WEI"}, "finality_status": "ACCEPTED_ON_L1", "execution_status": "SUCCEEDED", "block_hash": "0x47c3637b57c2b079b93c61539950c17e868a28f46cdef28f88521067f21e943", @@ -900,7 +892,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { } ], "events": [], - "execution_resources":{"bitwise_builtin_applications":"0x0", "ec_op_builtin_applications":"0x0", "ecdsa_builtin_applications":"0x0", "keccak_builtin_applications":"0x0", "memory_holes":"0x0", "pedersen_builtin_applications":"0x0", "poseidon_builtin_applications":"0x0", "range_check_builtin_applications":"0x0", "steps":"0x1f"} + "execution_resources":{"steps":31} }` txHash := block0.Transactions[i].Hash() @@ -918,7 +910,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { expected := `{ "type": "INVOKE", "transaction_hash": "0x19abec18bbacec23c2eee160c70190a48e4b41dd5ff98ad8f247f9393559998", - "actual_fee": "0x247aff6e224", + "actual_fee": {"amount": "0x247aff6e224", "unit": "WEI"}, "execution_status": "REVERTED", "finality_status": "ACCEPTED_ON_L2", "block_hash": "0x76e0229fd0c36dda2ee7905f7e4c9b3ebb78d98c4bfab550bcb3a03bf859a6", @@ -926,7 +918,7 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { "messages_sent": [], "events": [], "revert_reason": "Error in the called contract (0x00b1461de04c6a1aa3375bdf9b7723a8779c082ffe21311d683a0b15c078b5dc):\nError at pc=0:25:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:731)\nUnknown location (pc=0:677)\nUnknown location (pc=0:291)\nUnknown location (pc=0:314)\n\nError in the called contract (0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7):\nError at pc=0:104:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:1678)\nUnknown location (pc=0:1664)\n\nError in the called contract (0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7):\nError at pc=0:6:\nGot an exception while executing a hint: Assertion failed, 0 % 0x800000000000011000000000000000000000000000000000000000000000001 is equal to 0\nCairo traceback (most recent call last):\nUnknown location (pc=0:1238)\nUnknown location (pc=0:1215)\nUnknown location (pc=0:836)\n", - "execution_resources":{"bitwise_builtin_applications":"0x0", "ec_op_builtin_applications":"0x0", "ecdsa_builtin_applications":"0x0", "keccak_builtin_applications":"0x0", "memory_holes":"0x0", "pedersen_builtin_applications":"0x0", "poseidon_builtin_applications":"0x0", "range_check_builtin_applications":"0x0","steps":"0x0"} + "execution_resources":{"steps":0} }` integClient := feeder.NewTestClient(t, &utils.Integration) @@ -981,8 +973,15 @@ func TestLegacyTransactionReceiptByHash(t *testing.T) { ] } ], - "execution_resources": {"bitwise_builtin_applications":"0x0", "ec_op_builtin_applications":"0x0", "ecdsa_builtin_applications":"0x0", "keccak_builtin_applications":"0x0", "memory_holes":"0x4", "pedersen_builtin_applications":"0x0", "poseidon_builtin_applications":"0x0", "range_check_builtin_applications":"0x13", "steps":"0x267"}, - "actual_fee": "0x16d8b4ad4000", + "execution_resources": { + "steps": 615, + "range_check_builtin_applications": 19, + "memory_holes": 4 + }, + "actual_fee": { + "amount": "0x16d8b4ad4000", + "unit": "FRI" + }, "type": "INVOKE" }`