diff --git a/CHANGELOG.md b/CHANGELOG.md index 00382adfb7a..e595b7295a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,19 @@ ### 🛠 Improvements -- [](https://github.com/vegaprotocol/vega/issues/xxx) +- [1333](https://github.com/vegaprotocol/core-test-coverage/issues/1333) - Added coverage for `0093-TRTO-001`. +- [1334](https://github.com/vegaprotocol/core-test-coverage/issues/1334) - Added coverage for `0093-TRTO-002`. +- [1335](https://github.com/vegaprotocol/core-test-coverage/issues/1335) - Added coverage for `0093-TRTO-003`. +- [1336](https://github.com/vegaprotocol/core-test-coverage/issues/1336) - Added coverage for `0093-TRTO-004`. +- [1337](https://github.com/vegaprotocol/core-test-coverage/issues/1337) - Added coverage for `0093-TRTO-005`. +- [1338](https://github.com/vegaprotocol/core-test-coverage/issues/1338) - Added coverage for `0093-TRTO-006`. +- [1339](https://github.com/vegaprotocol/core-test-coverage/issues/1339) - Added coverage for `0093-TRTO-007`. +- [1340](https://github.com/vegaprotocol/core-test-coverage/issues/1340) - Added coverage for `0093-TRTO-008`. +- [1341](https://github.com/vegaprotocol/core-test-coverage/issues/1341) - Added coverage for `0093-TRTO-009`. +- [1342](https://github.com/vegaprotocol/core-test-coverage/issues/1342) - Added coverage for `0093-TRTO-010`. +- [1343](https://github.com/vegaprotocol/core-test-coverage/issues/1343) - Added coverage for `0093-TRTO-011`. +- [1344](https://github.com/vegaprotocol/core-test-coverage/issues/1344) - Added coverage for `0093-TRTO-012`. +- [1382](https://github.com/vegaprotocol/core-test-coverage/issues/1382) - Added coverage for `0093-TRTO-013`. ### 🐛 Fixes diff --git a/core/processor/abci.go b/core/processor/abci.go index 7a6cadcb42e..52951355a78 100644 --- a/core/processor/abci.go +++ b/core/processor/abci.go @@ -92,6 +92,11 @@ var ( } ) +// Codec interface is here for mocking/testing. +type Codec interface { + abci.Codec +} + type Checkpoint interface { BalanceCheckpoint(ctx context.Context) (*types.CheckpointState, error) Checkpoint(ctx context.Context, now time.Time) (*types.CheckpointState, error) diff --git a/core/processor/abci_test.go b/core/processor/abci_test.go new file mode 100644 index 00000000000..78c8c91a847 --- /dev/null +++ b/core/processor/abci_test.go @@ -0,0 +1,907 @@ +// Copyright (C) 2023 Gobalsky Labs Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package processor_test + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "code.vegaprotocol.io/vega/core/blockchain/abci" + "code.vegaprotocol.io/vega/core/genesis" + "code.vegaprotocol.io/vega/core/netparams" + "code.vegaprotocol.io/vega/core/processor" + "code.vegaprotocol.io/vega/core/processor/mocks" + "code.vegaprotocol.io/vega/logging" + "code.vegaprotocol.io/vega/paths" + proto "code.vegaprotocol.io/vega/protos/vega" + commandspb "code.vegaprotocol.io/vega/protos/vega/commands/v1" + + tmtypes "github.com/cometbft/cometbft/abci/types" + "github.com/golang/mock/gomock" + "github.com/pkg/errors" + "github.com/stretchr/testify/require" + gproto "google.golang.org/protobuf/proto" +) + +func TestListSnapshots(t *testing.T) { + ctx, cfunc := context.WithCancel(context.Background()) + app := getTestApp(t, cfunc, stopDummy, true, true) + defer app.ctrl.Finish() + + app.snap.EXPECT().ListLatestSnapshots().Times(1).Return([]*tmtypes.Snapshot{ + { + Height: 123, + Format: 1, + Chunks: 3, + Hash: []byte("0xDEADBEEF"), + Metadata: []byte("test"), + }, + }, nil) + resp, err := app.ListSnapshots(ctx, nil) + require.NoError(t, err) + require.NotNil(t, resp) + require.Equal(t, 1, len(resp.GetSnapshots())) +} + +func TestAppInfo(t *testing.T) { + ctx, cfunc := context.WithCancel(context.Background()) + app := getTestApp(t, cfunc, stopDummy, true, true) + defer app.ctrl.Finish() + // first, the broker streaming stuff + app.broker.EXPECT().SetStreaming(false).Times(1).Return(true) + app.broker.EXPECT().SetStreaming(true).Times(1).Return(true) + // snapshot engine + app.snap.EXPECT().HasSnapshots().Times(1).Return(true, nil) + // hash, height, chainID := app.snapshotEngine.Info() + app.snap.EXPECT().Info().Times(1).Return([]byte("43f86066fe13743448442022c099c48abbd7e9c5eac1c2558fdac1fbf549e867"), int64(123), fmt.Sprintf("%d", app.pChainID)) + info, err := app.Info(ctx, nil) + require.NoError(t, err) + require.NotNil(t, info) +} + +func getTransaction(t *testing.T, inputData *commandspb.InputData) *commandspb.Transaction { + t.Helper() + rawInputData, err := gproto.Marshal(inputData) + if err != nil { + t.Fatal(err) + } + return &commandspb.Transaction{ + InputData: rawInputData, + Signature: &commandspb.Signature{ + Algo: "vega/ed25519", + Value: "876e46defc40030391b5feb2c9bb0b6b68b2d95a6b5fd17a730a46ea73f3b1808420c8c609be6f1c6156e472ecbcd09202f750da000dee41429947a4b7eca00b", + Version: 1, + }, + From: &commandspb.Transaction_PubKey{ + PubKey: "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0", + }, + Version: 2, + } +} + +// A batch transaction including only cancellations and/or post-only limit orders is executed at +// the top of the block alongside standalone post-only limit orders and cancellations (0093-TRTO-001). +func TestBatchOnlyCancelsAndPostOnly(t *testing.T) { + _, cfunc := context.WithCancel(context.Background()) + app := getTestApp(t, cfunc, stopDummy, false, false) + defer app.ctrl.Finish() + + // setup some order as the first tx + tx1InputData := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_FOK, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + }, + }, + } + tx1 := getTransaction(t, tx1InputData) + marshalledTx1, err := gproto.Marshal(tx1) + require.NoError(t, err) + + // setup a batch transaction with cancellation and post only + tx2InputData := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_BatchMarketInstructions{ + BatchMarketInstructions: &commandspb.BatchMarketInstructions{ + Cancellations: []*commandspb.OrderCancellation{ + { + OrderId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + }, + }, + Submissions: []*commandspb.OrderSubmission{ + { + MarketId: "926df3b689a5440fe21cad7069ebcedc46f75b2b23ce11002a1ee2254e339f23", + TimeInForce: proto.Order_TIME_IN_FORCE_GTC, + PostOnly: true, + }, + }, + }, + }, + } + tx2 := getTransaction(t, tx2InputData) + marshalledTx2, err := gproto.Marshal(tx2) + require.NoError(t, err) + + rawTxs := [][]byte{marshalledTx1, marshalledTx2} + txs := []abci.Tx{} + for _, tx := range rawTxs { + decodedTx, err := app.codec.Decode(tx, "1") + require.NoError(t, err) + txs = append(txs, decodedTx) + } + + app.txCache.EXPECT().GetRawTxs(gomock.Any()).Return(nil).Times(1) + app.txCache.EXPECT().IsDelayRequired(gomock.Any()).Return(true).AnyTimes() + app.txCache.EXPECT().NewDelayedTransaction(gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte("123")).Times(1) + app.limits.EXPECT().CanTrade().Return(true).AnyTimes() + blockTxs := app.Abci().OnPrepareProposal(100, txs, rawTxs) + require.Equal(t, 2, len(blockTxs)) + require.Equal(t, rawTxs[1], blockTxs[0]) + require.Equal(t, []byte("123"), blockTxs[1]) +} + +// A batch transaction including either a non-post-only order or an amendment is delayed by one block +// and then executed after the expedited transactions in that later block (0093-TRTO-002). +func TestBatchDelayed(t *testing.T) { + _, cfunc := context.WithCancel(context.Background()) + app := getTestApp(t, cfunc, stopDummy, false, false) + defer app.ctrl.Finish() + + // setup some order as the first tx that doesn't get delayed + tx1InputData := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_GTC, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + PostOnly: true, + }, + }, + } + tx1 := getTransaction(t, tx1InputData) + marshalledTx1, err := gproto.Marshal(tx1) + require.NoError(t, err) + + // setup a cancellation + tx2InputData := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderCancellation{ + OrderCancellation: &commandspb.OrderCancellation{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + }, + }, + } + tx2 := getTransaction(t, tx2InputData) + marshalledTx2, err := gproto.Marshal(tx2) + require.NoError(t, err) + + // now get a batch transaction with submission such that will get it delayed by 1 block + // setup a batch transaction with cancellation and post only + tx3InputData := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_BatchMarketInstructions{ + BatchMarketInstructions: &commandspb.BatchMarketInstructions{ + Submissions: []*commandspb.OrderSubmission{ + { + MarketId: "926df3b689a5440fe21cad7069ebcedc46f75b2b23ce11002a1ee2254e339f23", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_FOK, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + }, + { + MarketId: "926df3b689a5440fe21cad7069ebcedc46f75b2b23ce11002a1ee2254e339f23", + Side: proto.Side_SIDE_BUY, + Size: 2, + TimeInForce: proto.Order_TIME_IN_FORCE_FOK, + Type: proto.Order_TYPE_LIMIT, + Price: "234", + }, + }, + }, + }, + } + tx3 := getTransaction(t, tx3InputData) + marshalledTx3, err := gproto.Marshal(tx3) + require.NoError(t, err) + + rawTxs := [][]byte{marshalledTx1, marshalledTx2, marshalledTx3} + txs := []abci.Tx{} + for _, tx := range rawTxs { + decodedTx, err := app.codec.Decode(tx, "1") + require.NoError(t, err) + txs = append(txs, decodedTx) + } + + app.txCache.EXPECT().GetRawTxs(gomock.Any()).Return(nil).Times(1) + app.txCache.EXPECT().IsDelayRequired(gomock.Any()).Return(true).AnyTimes() + app.txCache.EXPECT().NewDelayedTransaction(gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte("123")).Times(1) + app.limits.EXPECT().CanTrade().Return(true).AnyTimes() + blockTxs := app.Abci().OnPrepareProposal(100, txs, rawTxs) + // the first two transactions and the delayed wrapped transaction + require.Equal(t, 3, len(blockTxs)) + require.Equal(t, rawTxs[1], blockTxs[0]) + require.Equal(t, rawTxs[0], blockTxs[1]) + require.Equal(t, []byte("123"), blockTxs[2]) + + // setup a cancellation + tx4InputData := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderCancellation{ + OrderCancellation: &commandspb.OrderCancellation{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + }, + }, + } + tx4 := getTransaction(t, tx4InputData) + marshalledTx4, err := gproto.Marshal(tx4) + require.NoError(t, err) + + rawTxs = [][]byte{marshalledTx4} + txs = []abci.Tx{} + for _, tx := range rawTxs { + decodedTx, err := app.codec.Decode(tx, "1") + require.NoError(t, err) + txs = append(txs, decodedTx) + } + // now lets go to the next block and have the postponed transactions executed after the + app.txCache.EXPECT().GetRawTxs(gomock.Any()).Return([][]byte{marshalledTx3}).Times(1) + blockTxs = app.Abci().OnPrepareProposal(101, txs, rawTxs) + require.Equal(t, 2, len(blockTxs)) + require.Equal(t, marshalledTx4, blockTxs[0]) + // the delayed transaction gets in execution order after the expedited + require.Equal(t, marshalledTx3, blockTxs[1]) +} + +// Cancellation transactions always occur before: +// Market orders (0093-TRTO-003) +// Non post-only limit orders (0093-TRTO-004) +// Order Amends (0093-TRTO-005) +// post-only limit orders (0093-TRTO-013). +func TestCancelledOrdersGoFirst(t *testing.T) { + _, cfunc := context.WithCancel(context.Background()) + app := getTestApp(t, cfunc, stopDummy, false, false) + defer app.ctrl.Finish() + + // cancel 1 + // setup a cancellation + cancel1 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderCancellation{ + OrderCancellation: &commandspb.OrderCancellation{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + }, + }, + } + cancel1Tx := getTransaction(t, cancel1) + marshalledCancel1Tx, err := gproto.Marshal(cancel1Tx) + require.NoError(t, err) + + // cancel 2 + cancel2 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderCancellation{ + OrderCancellation: &commandspb.OrderCancellation{ + MarketId: "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0", + }, + }, + } + cancel2Tx := getTransaction(t, cancel2) + marshalledCancel2Tx, err := gproto.Marshal(cancel2Tx) + require.NoError(t, err) + + // now lets set up one order of each of the desired types + marketOrder := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_FOK, + Type: proto.Order_TYPE_MARKET, + }, + }, + } + marketOrderTx := getTransaction(t, marketOrder) + marshalledMarketOrderTx, err := gproto.Marshal(marketOrderTx) + require.NoError(t, err) + + limitOrder := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_GTC, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + }, + }, + } + limitOrderTx := getTransaction(t, limitOrder) + marshalledLimitOrderTx, err := gproto.Marshal(limitOrderTx) + require.NoError(t, err) + + amend := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderAmendment{ + OrderAmendment: &commandspb.OrderAmendment{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + OrderId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + SizeDelta: 5, + }, + }, + } + amendTx := getTransaction(t, amend) + marshalledAmendTx, err := gproto.Marshal(amendTx) + require.NoError(t, err) + + postOnly := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_GTC, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + PostOnly: true, + }, + }, + } + postOnlyTx := getTransaction(t, postOnly) + marshalledPostOnlyTx, err := gproto.Marshal(postOnlyTx) + require.NoError(t, err) + + rawTxs := [][]byte{marshalledCancel1Tx, marshalledCancel2Tx, marshalledAmendTx, marshalledMarketOrderTx, marshalledLimitOrderTx, marshalledPostOnlyTx} + txs := []abci.Tx{} + for _, tx := range rawTxs { + decodedTx, err := app.codec.Decode(tx, "1") + require.NoError(t, err) + txs = append(txs, decodedTx) + } + + app.txCache.EXPECT().GetRawTxs(gomock.Any()).Return(nil).Times(1) + app.txCache.EXPECT().IsDelayRequired(gomock.Any()).Return(true).AnyTimes() + app.txCache.EXPECT().NewDelayedTransaction(gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte("123")).Times(1) + app.limits.EXPECT().CanTrade().Return(true).AnyTimes() + blockTxs := app.Abci().OnPrepareProposal(100, txs, rawTxs) + // cancel 1, then cancel 2, then post only, then wrapped delayed + require.Equal(t, 4, len(blockTxs)) + require.Equal(t, marshalledCancel1Tx, blockTxs[0]) + require.Equal(t, marshalledCancel2Tx, blockTxs[1]) + require.Equal(t, marshalledPostOnlyTx, blockTxs[2]) + require.Equal(t, []byte("123"), blockTxs[3]) + + // now, in the following block we expect the delayed transactions to be executed, still after expedited transactions + // cancel 3 + cancel3 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderCancellation{ + OrderCancellation: &commandspb.OrderCancellation{ + MarketId: "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0", + }, + }, + } + cancel3Tx := getTransaction(t, cancel3) + marshalledCancel3Tx, err := gproto.Marshal(cancel3Tx) + require.NoError(t, err) + + rawTxs = [][]byte{marshalledCancel3Tx} + txs = []abci.Tx{} + for _, tx := range rawTxs { + decodedTx, err := app.codec.Decode(tx, "1") + require.NoError(t, err) + txs = append(txs, decodedTx) + } + // now lets go to the next block and have the postponed transactions executed after the + app.txCache.EXPECT().GetRawTxs(gomock.Any()).Return([][]byte{marshalledAmendTx, marshalledMarketOrderTx, marshalledLimitOrderTx}).Times(1) + blockTxs = app.Abci().OnPrepareProposal(101, txs, rawTxs) + require.Equal(t, 4, len(blockTxs)) + require.Equal(t, marshalledCancel3Tx, blockTxs[0]) + require.Equal(t, marshalledAmendTx, blockTxs[1]) + require.Equal(t, marshalledMarketOrderTx, blockTxs[2]) + require.Equal(t, marshalledLimitOrderTx, blockTxs[3]) +} + +// Post-only transactions always occur before: +// Market orders (0093-TRTO-006) +// Non post-only limit orders (0093-TRTO-007) +// Order Amends (0093-TRTO-008). +// Potentially aggressive orders take effect on the market exactly one block after they are included +// in a block (i.e for an order which is included in block N it hits the market in block N+1). This is true for: +// Market orders (0093-TRTO-009) +// Non post-only limit orders (0093-TRTO-010) +// Order Amends (0093-TRTO-011). +func TestPostOnlyGoBeforeAggressive(t *testing.T) { + _, cfunc := context.WithCancel(context.Background()) + app := getTestApp(t, cfunc, stopDummy, false, false) + defer app.ctrl.Finish() + + postOnly1 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_GTC, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + PostOnly: true, + }, + }, + } + postOnly1Tx := getTransaction(t, postOnly1) + marshalledPostOnly1Tx, err := gproto.Marshal(postOnly1Tx) + require.NoError(t, err) + + postOnly2 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_GTC, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + PostOnly: true, + }, + }, + } + postOnly2Tx := getTransaction(t, postOnly2) + marshalledPostOnly2Tx, err := gproto.Marshal(postOnly2Tx) + require.NoError(t, err) + + // cancel 1 + cancel1 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderCancellation{ + OrderCancellation: &commandspb.OrderCancellation{ + MarketId: "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0", + }, + }, + } + cancel1Tx := getTransaction(t, cancel1) + marshalledCancel1Tx, err := gproto.Marshal(cancel1Tx) + require.NoError(t, err) + + // now lets set up one order of each of the desired types + marketOrder := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_FOK, + Type: proto.Order_TYPE_MARKET, + }, + }, + } + marketOrderTx := getTransaction(t, marketOrder) + marshalledMarketOrderTx, err := gproto.Marshal(marketOrderTx) + require.NoError(t, err) + + limitOrder := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_GTC, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + }, + }, + } + limitOrderTx := getTransaction(t, limitOrder) + marshalledLimitOrderTx, err := gproto.Marshal(limitOrderTx) + require.NoError(t, err) + + amend := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderAmendment{ + OrderAmendment: &commandspb.OrderAmendment{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + OrderId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + SizeDelta: 5, + }, + }, + } + amendTx := getTransaction(t, amend) + marshalledAmendTx, err := gproto.Marshal(amendTx) + require.NoError(t, err) + + rawTxs := [][]byte{marshalledAmendTx, marshalledMarketOrderTx, marshalledLimitOrderTx, marshalledPostOnly1Tx, marshalledCancel1Tx, marshalledPostOnly2Tx} + txs := []abci.Tx{} + for _, tx := range rawTxs { + decodedTx, err := app.codec.Decode(tx, "1") + require.NoError(t, err) + txs = append(txs, decodedTx) + } + + app.txCache.EXPECT().GetRawTxs(gomock.Any()).Return(nil).Times(1) + app.txCache.EXPECT().IsDelayRequired(gomock.Any()).Return(true).AnyTimes() + app.txCache.EXPECT().NewDelayedTransaction(gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte("123")).Times(1) + app.limits.EXPECT().CanTrade().Return(true).AnyTimes() + blockTxs := app.Abci().OnPrepareProposal(100, txs, rawTxs) + // cancel, then post only 1, then post only 2, then wrapped delayed + require.Equal(t, 4, len(blockTxs)) + require.Equal(t, marshalledCancel1Tx, blockTxs[0]) + require.Equal(t, marshalledPostOnly1Tx, blockTxs[1]) + require.Equal(t, marshalledPostOnly2Tx, blockTxs[2]) + require.Equal(t, []byte("123"), blockTxs[3]) + + // now, in the following block we expect the delayed transactions to be executed, still after expedited transactions + // cancel 3 + cancel3 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderCancellation{ + OrderCancellation: &commandspb.OrderCancellation{ + MarketId: "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0", + }, + }, + } + cancel3Tx := getTransaction(t, cancel3) + marshalledCancel3Tx, err := gproto.Marshal(cancel3Tx) + require.NoError(t, err) + + postOnly3 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderSubmission{ + OrderSubmission: &commandspb.OrderSubmission{ + MarketId: "47076f002ddd9bfeb7f4679fc75b4686f64446d5a5afcb84584e7c7166d13efa", + Side: proto.Side_SIDE_BUY, + Size: 1, + TimeInForce: proto.Order_TIME_IN_FORCE_GTC, + Type: proto.Order_TYPE_LIMIT, + Price: "123", + PostOnly: true, + }, + }, + } + postOnly3Tx := getTransaction(t, postOnly3) + marshalledPostOnly3Tx, err := gproto.Marshal(postOnly3Tx) + require.NoError(t, err) + + amend2 := &commandspb.InputData{ + Nonce: 123456789, + BlockHeight: 1789, + Command: &commandspb.InputData_OrderAmendment{ + OrderAmendment: &commandspb.OrderAmendment{ + MarketId: "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0", + OrderId: "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0", + SizeDelta: 5, + }, + }, + } + amend2Tx := getTransaction(t, amend2) + marshalledAmend2Tx, err := gproto.Marshal(amend2Tx) + require.NoError(t, err) + + rawTxs = [][]byte{marshalledPostOnly3Tx, marshalledAmend2Tx, marshalledCancel3Tx} + txs = []abci.Tx{} + for _, tx := range rawTxs { + decodedTx, err := app.codec.Decode(tx, "1") + require.NoError(t, err) + txs = append(txs, decodedTx) + } + // now lets go to the next block and have the postponed transactions executed after the new cancellation and post only from this block + // plus throw in another amend this block that gets delayed to the next block + app.txCache.EXPECT().GetRawTxs(gomock.Any()).Return([][]byte{marshalledAmendTx, marshalledMarketOrderTx, marshalledLimitOrderTx}).Times(1) + app.txCache.EXPECT().NewDelayedTransaction(gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte("456")).Times(1) + blockTxs = app.Abci().OnPrepareProposal(101, txs, rawTxs) + require.Equal(t, 6, len(blockTxs)) + require.Equal(t, marshalledCancel3Tx, blockTxs[0]) + require.Equal(t, marshalledPostOnly3Tx, blockTxs[1]) + require.Equal(t, marshalledAmendTx, blockTxs[2]) + require.Equal(t, marshalledMarketOrderTx, blockTxs[3]) + require.Equal(t, marshalledLimitOrderTx, blockTxs[4]) + require.Equal(t, []byte("456"), blockTxs[5]) +} + +type tstApp struct { + *processor.App + ctrl *gomock.Controller + timeSvc *mocks.MockTimeService + epochSvc *mocks.MockEpochService + delegation *mocks.MockDelegationEngine + exec *mocks.MockExecutionEngine + gov *mocks.MockGovernanceEngine + stats *mocks.MockStats + assets *mocks.MockAssets + validator *mocks.MockValidatorTopology + notary *mocks.MockNotary + evtForwarder *mocks.MockEvtForwarder + witness *mocks.MockWitness + banking *mocks.MockBanking + netParams *mocks.MockNetworkParameters + oracleEngine *mocks.MockOraclesEngine + oracleAdaptors *mocks.MockOracleAdaptors + l1Verifier *mocks.MockEthereumOracleVerifier + l2Verifier *mocks.MockEthereumOracleVerifier + limits *mocks.MockLimits + stakeVerifier *mocks.MockStakeVerifier + stakingAccs *mocks.MockStakingAccounts + primaryERC20 *mocks.MockERC20MultiSigTopology + secondaryERC20 *mocks.MockERC20MultiSigTopology + cp *mocks.MockCheckpoint + broker *mocks.MockBroker + evtForwarderHB *mocks.MockEvtForwarderHeartbeat + spam *mocks.MockSpamEngine + pow *mocks.MockPoWEngine + snap *mocks.MockSnapshotEngine + stateVar *mocks.MockStateVarEngine + teams *mocks.MockTeamsEngine + referral *mocks.MockReferralProgram + volDiscount *mocks.MockVolumeDiscountProgram + bClient *mocks.MockBlockchainClient + puSvc *mocks.MockProtocolUpgradeService + ethCallEng *mocks.MockEthCallEngine + balance *mocks.MockBalanceChecker + parties *mocks.MockPartiesEngine + txCache *mocks.MockTxCache + codec processor.NullBlockchainTxCodec + onTickCB []func(context.Context, time.Time) + pChainID, sChainID uint64 +} + +func stopDummy() error { + return nil +} + +func getTestApp(t *testing.T, cfunc func(), stop func() error, PoW, Spam bool) *tstApp { + t.Helper() + pChain := "1" + sChain := "2" + gHandler := &genesis.Handler{} + pChainID, err := strconv.ParseUint(pChain, 10, 64) + if err != nil { + t.Fatalf("Could not get test app instance, chain ID parse error: %v", err) + } + sChainID, err := strconv.ParseUint(sChain, 10, 64) + if err != nil { + t.Fatalf("Could not get test app instance, chain ID parse error: %v", err) + } + ctrl := gomock.NewController(t) + broker := mocks.NewMockBroker(ctrl) + timeSvc := mocks.NewMockTimeService(ctrl) + epochSvc := mocks.NewMockEpochService(ctrl) + delegation := mocks.NewMockDelegationEngine(ctrl) + exec := mocks.NewMockExecutionEngine(ctrl) + gov := mocks.NewMockGovernanceEngine(ctrl) + stats := mocks.NewMockStats(ctrl) + assets := mocks.NewMockAssets(ctrl) + validator := mocks.NewMockValidatorTopology(ctrl) + notary := mocks.NewMockNotary(ctrl) + evtForwarder := mocks.NewMockEvtForwarder(ctrl) + evtForwarderHB := mocks.NewMockEvtForwarderHeartbeat(ctrl) + witness := mocks.NewMockWitness(ctrl) + banking := mocks.NewMockBanking(ctrl) + netParams := mocks.NewMockNetworkParameters(ctrl) + oracleEngine := mocks.NewMockOraclesEngine(ctrl) + oracleAdaptors := mocks.NewMockOracleAdaptors(ctrl) + l1Verifier := mocks.NewMockEthereumOracleVerifier(ctrl) + l2Verifier := mocks.NewMockEthereumOracleVerifier(ctrl) + limits := mocks.NewMockLimits(ctrl) + stakeVerifier := mocks.NewMockStakeVerifier(ctrl) + stakingAccs := mocks.NewMockStakingAccounts(ctrl) + pERC20 := mocks.NewMockERC20MultiSigTopology(ctrl) + sERC20 := mocks.NewMockERC20MultiSigTopology(ctrl) + cp := mocks.NewMockCheckpoint(ctrl) + var ( + spam *mocks.MockSpamEngine + pow *mocks.MockPoWEngine + ) + if Spam { + spam = mocks.NewMockSpamEngine(ctrl) + } + if PoW { + pow = mocks.NewMockPoWEngine(ctrl) + } + snap := mocks.NewMockSnapshotEngine(ctrl) + stateVar := mocks.NewMockStateVarEngine(ctrl) + teams := mocks.NewMockTeamsEngine(ctrl) + referral := mocks.NewMockReferralProgram(ctrl) + volDiscount := mocks.NewMockVolumeDiscountProgram(ctrl) + bClient := mocks.NewMockBlockchainClient(ctrl) + puSvc := mocks.NewMockProtocolUpgradeService(ctrl) + ethCallEng := mocks.NewMockEthCallEngine(ctrl) + balance := mocks.NewMockBalanceChecker(ctrl) + parties := mocks.NewMockPartiesEngine(ctrl) + txCache := mocks.NewMockTxCache(ctrl) + codec := processor.NullBlockchainTxCodec{} + // paths, config, gastimator, ... + vp := paths.New("/tmp") + conf := processor.NewDefaultConfig() + gastimator := processor.NewGastimator(exec) + // test wrapper + tstApp := &tstApp{ + ctrl: ctrl, + broker: broker, + timeSvc: timeSvc, + epochSvc: epochSvc, + delegation: delegation, + exec: exec, + gov: gov, + stats: stats, + assets: assets, + validator: validator, + notary: notary, + evtForwarder: evtForwarder, + evtForwarderHB: evtForwarderHB, + witness: witness, + banking: banking, + netParams: netParams, + oracleEngine: oracleEngine, + oracleAdaptors: oracleAdaptors, + l1Verifier: l1Verifier, + l2Verifier: l2Verifier, + limits: limits, + stakeVerifier: stakeVerifier, + stakingAccs: stakingAccs, + primaryERC20: pERC20, + secondaryERC20: sERC20, + cp: cp, + spam: spam, + pow: pow, + snap: snap, + stateVar: stateVar, + teams: teams, + referral: referral, + volDiscount: volDiscount, + bClient: bClient, + puSvc: puSvc, + ethCallEng: ethCallEng, + balance: balance, + parties: parties, + txCache: txCache, + codec: codec, + onTickCB: []func(context.Context, time.Time){}, + pChainID: pChainID, + sChainID: sChainID, + } + // timeSvc will be set up to the onTick callback + timeSvc.EXPECT().NotifyOnTick(gomock.Any()).AnyTimes().Do(func(cbs ...func(context.Context, time.Time)) { + if cbs == nil { + return + } + tstApp.onTickCB = append(tstApp.onTickCB, cbs...) + }) + // ensureConfig calls netparams + netParams.EXPECT().GetJSONStruct(netparams.BlockchainsPrimaryEthereumConfig, gomock.Any()).Times(1).DoAndReturn(func(_ string, v netparams.Reset) error { + vt, ok := v.(*proto.EthereumConfig) + if !ok { + return errors.Errorf("invalid type %t", v) + } + vt.ChainId = pChain + return nil + }) + netParams.EXPECT().GetJSONStruct(netparams.BlockchainsEVMBridgeConfigs, gomock.Any()).Times(1).DoAndReturn(func(_ string, v netparams.Reset) error { + vt, ok := v.(*proto.EVMBridgeConfigs) + if !ok { + return errors.Errorf("invalid type %t", v) + } + if vt.Configs == nil { + vt.Configs = []*proto.EVMBridgeConfig{} + } + vt.Configs = append(vt.Configs, &proto.EVMBridgeConfig{ + ChainId: sChain, + }) + return nil + }) + // set primary chain ID + exec.EXPECT().OnChainIDUpdate(pChainID).Times(1).Return(nil) + gov.EXPECT().OnChainIDUpdate(pChainID).Times(1).Return(nil) + app := processor.NewApp( + logging.NewTestLogger(), + vp, + conf, + cfunc, + stop, + assets, + banking, + broker, + witness, + evtForwarder, + evtForwarderHB, + exec, + gHandler, + gov, + notary, + stats, + timeSvc, + epochSvc, + validator, + netParams, + &processor.Oracle{ + Engine: oracleEngine, + Adaptors: oracleAdaptors, + EthereumOraclesVerifier: l1Verifier, + EthereumL2OraclesVerifier: l2Verifier, + }, + delegation, + limits, + stakeVerifier, + cp, + spam, + pow, + stakingAccs, + snap, + stateVar, + teams, + referral, + volDiscount, + bClient, + pERC20, + sERC20, + "0", + puSvc, + &codec, + gastimator, + ethCallEng, + balance, + parties, + txCache, + ) + + // embed the app + tstApp.App = app + // return wrapper + return tstApp +} diff --git a/core/processor/mocks/mocks.go b/core/processor/mocks/mocks.go index db7d9837f92..883aaac1359 100644 --- a/core/processor/mocks/mocks.go +++ b/core/processor/mocks/mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: code.vegaprotocol.io/vega/core/processor (interfaces: TimeService,EpochService,DelegationEngine,ExecutionEngine,GovernanceEngine,Stats,Assets,ValidatorTopology,Notary,EvtForwarder,Witness,Banking,NetworkParameters,OraclesEngine,OracleAdaptors,Limits,StakeVerifier,StakingAccounts,ERC20MultiSigTopology,Checkpoint) +// Source: code.vegaprotocol.io/vega/core/processor (interfaces: TimeService,EpochService,DelegationEngine,ExecutionEngine,GovernanceEngine,Stats,Assets,ValidatorTopology,Notary,EvtForwarder,EvtForwarderHeartbeat,Witness,Banking,NetworkParameters,OraclesEngine,OracleAdaptors,Limits,StakeVerifier,StakingAccounts,ERC20MultiSigTopology,Checkpoint,Broker,SpamEngine,PoWEngine,SnapshotEngine,StateVarEngine,TeamsEngine,ReferralProgram,VolumeDiscountProgram,BlockchainClient,ProtocolUpgradeService,EthCallEngine,BalanceChecker,PartiesEngine,TxCache,EthereumOracleVerifier,Codec) // Package mocks is a generated GoMock package. package mocks @@ -10,16 +10,25 @@ import ( time "time" assets "code.vegaprotocol.io/vega/core/assets" + abci "code.vegaprotocol.io/vega/core/blockchain/abci" + broker "code.vegaprotocol.io/vega/core/broker" common "code.vegaprotocol.io/vega/core/datasource/common" + ethcall "code.vegaprotocol.io/vega/core/datasource/external/ethcall" + events "code.vegaprotocol.io/vega/core/events" common0 "code.vegaprotocol.io/vega/core/execution/common" governance "code.vegaprotocol.io/vega/core/governance" netparams "code.vegaprotocol.io/vega/core/netparams" + pow "code.vegaprotocol.io/vega/core/pow" + snapshot "code.vegaprotocol.io/vega/core/snapshot" types "code.vegaprotocol.io/vega/core/types" + statevar "code.vegaprotocol.io/vega/core/types/statevar" crypto "code.vegaprotocol.io/vega/libs/crypto" num "code.vegaprotocol.io/vega/libs/num" vega "code.vegaprotocol.io/vega/protos/vega" - v1 "code.vegaprotocol.io/vega/protos/vega/commands/v1" + v1 "code.vegaprotocol.io/vega/protos/vega/api/v1" + v10 "code.vegaprotocol.io/vega/protos/vega/commands/v1" types0 "github.com/cometbft/cometbft/abci/types" + types1 "github.com/cometbft/cometbft/types" gomock "github.com/golang/mock/gomock" decimal "github.com/shopspring/decimal" ) @@ -418,6 +427,20 @@ func (mr *MockExecutionEngineMockRecorder) CheckOrderSubmissionForSpam(arg0, arg return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckOrderSubmissionForSpam", reflect.TypeOf((*MockExecutionEngine)(nil).CheckOrderSubmissionForSpam), arg0, arg1) } +// GetMarketCounters mocks base method. +func (m *MockExecutionEngine) GetMarketCounters() map[string]*types.MarketCounters { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMarketCounters") + ret0, _ := ret[0].(map[string]*types.MarketCounters) + return ret0 +} + +// GetMarketCounters indicates an expected call of GetMarketCounters. +func (mr *MockExecutionEngineMockRecorder) GetMarketCounters() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMarketCounters", reflect.TypeOf((*MockExecutionEngine)(nil).GetMarketCounters)) +} + // Hash mocks base method. func (m *MockExecutionEngine) Hash() []byte { m.ctrl.T.Helper() @@ -1324,7 +1347,7 @@ func (mr *MockValidatorTopologyMockRecorder) AddForwarder(arg0 interface{}) *gom } // AddKeyRotate mocks base method. -func (m *MockValidatorTopology) AddKeyRotate(arg0 context.Context, arg1 string, arg2 uint64, arg3 *v1.KeyRotateSubmission) error { +func (m *MockValidatorTopology) AddKeyRotate(arg0 context.Context, arg1 string, arg2 uint64, arg3 *v10.KeyRotateSubmission) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddKeyRotate", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) @@ -1420,7 +1443,7 @@ func (mr *MockValidatorTopologyMockRecorder) IsValidatorVegaPubKey(arg0 interfac } // IssueSignatures mocks base method. -func (m *MockValidatorTopology) IssueSignatures(arg0 context.Context, arg1, arg2, arg3 string, arg4 v1.NodeSignatureKind) error { +func (m *MockValidatorTopology) IssueSignatures(arg0 context.Context, arg1, arg2, arg3 string, arg4 v10.NodeSignatureKind) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IssueSignatures", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(error) @@ -1448,7 +1471,7 @@ func (mr *MockValidatorTopologyMockRecorder) Len() *gomock.Call { } // ProcessAnnounceNode mocks base method. -func (m *MockValidatorTopology) ProcessAnnounceNode(arg0 context.Context, arg1 *v1.AnnounceNode) error { +func (m *MockValidatorTopology) ProcessAnnounceNode(arg0 context.Context, arg1 *v10.AnnounceNode) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ProcessAnnounceNode", arg0, arg1) ret0, _ := ret[0].(error) @@ -1462,7 +1485,7 @@ func (mr *MockValidatorTopologyMockRecorder) ProcessAnnounceNode(arg0, arg1 inte } // ProcessEthereumKeyRotation mocks base method. -func (m *MockValidatorTopology) ProcessEthereumKeyRotation(arg0 context.Context, arg1 string, arg2 *v1.EthereumKeyRotateSubmission, arg3 func([]byte, []byte, string) error) error { +func (m *MockValidatorTopology) ProcessEthereumKeyRotation(arg0 context.Context, arg1 string, arg2 *v10.EthereumKeyRotateSubmission, arg3 func([]byte, []byte, string) error) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ProcessEthereumKeyRotation", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) @@ -1476,7 +1499,7 @@ func (mr *MockValidatorTopologyMockRecorder) ProcessEthereumKeyRotation(arg0, ar } // ProcessValidatorHeartbeat mocks base method. -func (m *MockValidatorTopology) ProcessValidatorHeartbeat(arg0 context.Context, arg1 *v1.ValidatorHeartbeat, arg2 func([]byte, []byte, []byte) error, arg3 func([]byte, []byte, string) error) error { +func (m *MockValidatorTopology) ProcessValidatorHeartbeat(arg0 context.Context, arg1 *v10.ValidatorHeartbeat, arg2 func([]byte, []byte, []byte) error, arg3 func([]byte, []byte, string) error) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ProcessValidatorHeartbeat", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) @@ -1513,10 +1536,10 @@ func (m *MockNotary) EXPECT() *MockNotaryMockRecorder { } // IsSigned mocks base method. -func (m *MockNotary) IsSigned(arg0 context.Context, arg1 string, arg2 v1.NodeSignatureKind) ([]v1.NodeSignature, bool) { +func (m *MockNotary) IsSigned(arg0 context.Context, arg1 string, arg2 v10.NodeSignatureKind) ([]v10.NodeSignature, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IsSigned", arg0, arg1, arg2) - ret0, _ := ret[0].([]v1.NodeSignature) + ret0, _ := ret[0].([]v10.NodeSignature) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -1528,7 +1551,7 @@ func (mr *MockNotaryMockRecorder) IsSigned(arg0, arg1, arg2 interface{}) *gomock } // RegisterSignature mocks base method. -func (m *MockNotary) RegisterSignature(arg0 context.Context, arg1 string, arg2 v1.NodeSignature) error { +func (m *MockNotary) RegisterSignature(arg0 context.Context, arg1 string, arg2 v10.NodeSignature) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RegisterSignature", arg0, arg1, arg2) ret0, _ := ret[0].(error) @@ -1542,7 +1565,7 @@ func (mr *MockNotaryMockRecorder) RegisterSignature(arg0, arg1, arg2 interface{} } // StartAggregate mocks base method. -func (m *MockNotary) StartAggregate(arg0 string, arg1 v1.NodeSignatureKind, arg2 []byte) { +func (m *MockNotary) StartAggregate(arg0 string, arg1 v10.NodeSignatureKind, arg2 []byte) { m.ctrl.T.Helper() m.ctrl.Call(m, "StartAggregate", arg0, arg1, arg2) } @@ -1577,7 +1600,7 @@ func (m *MockEvtForwarder) EXPECT() *MockEvtForwarderMockRecorder { } // Ack mocks base method. -func (m *MockEvtForwarder) Ack(arg0 *v1.ChainEvent) bool { +func (m *MockEvtForwarder) Ack(arg0 *v10.ChainEvent) bool { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Ack", arg0) ret0, _ := ret[0].(bool) @@ -1590,6 +1613,43 @@ func (mr *MockEvtForwarderMockRecorder) Ack(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ack", reflect.TypeOf((*MockEvtForwarder)(nil).Ack), arg0) } +// MockEvtForwarderHeartbeat is a mock of EvtForwarderHeartbeat interface. +type MockEvtForwarderHeartbeat struct { + ctrl *gomock.Controller + recorder *MockEvtForwarderHeartbeatMockRecorder +} + +// MockEvtForwarderHeartbeatMockRecorder is the mock recorder for MockEvtForwarderHeartbeat. +type MockEvtForwarderHeartbeatMockRecorder struct { + mock *MockEvtForwarderHeartbeat +} + +// NewMockEvtForwarderHeartbeat creates a new mock instance. +func NewMockEvtForwarderHeartbeat(ctrl *gomock.Controller) *MockEvtForwarderHeartbeat { + mock := &MockEvtForwarderHeartbeat{ctrl: ctrl} + mock.recorder = &MockEvtForwarderHeartbeatMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockEvtForwarderHeartbeat) EXPECT() *MockEvtForwarderHeartbeatMockRecorder { + return m.recorder +} + +// ProcessHeartbeat mocks base method. +func (m *MockEvtForwarderHeartbeat) ProcessHeartbeat(arg0, arg1 string, arg2, arg3 uint64) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ProcessHeartbeat", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// ProcessHeartbeat indicates an expected call of ProcessHeartbeat. +func (mr *MockEvtForwarderHeartbeatMockRecorder) ProcessHeartbeat(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessHeartbeat", reflect.TypeOf((*MockEvtForwarderHeartbeat)(nil).ProcessHeartbeat), arg0, arg1, arg2, arg3) +} + // MockWitness is a mock of Witness interface. type MockWitness struct { ctrl *gomock.Controller @@ -1614,7 +1674,7 @@ func (m *MockWitness) EXPECT() *MockWitnessMockRecorder { } // AddNodeCheck mocks base method. -func (m *MockWitness) AddNodeCheck(arg0 context.Context, arg1 *v1.NodeVote, arg2 crypto.PublicKey) error { +func (m *MockWitness) AddNodeCheck(arg0 context.Context, arg1 *v10.NodeVote, arg2 crypto.PublicKey) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddNodeCheck", arg0, arg1, arg2) ret0, _ := ret[0].(error) @@ -2082,7 +2142,7 @@ func (m *MockOracleAdaptors) EXPECT() *MockOracleAdaptorsMockRecorder { } // Normalise mocks base method. -func (m *MockOracleAdaptors) Normalise(arg0 crypto.PublicKey, arg1 v1.OracleDataSubmission) (*common.Data, error) { +func (m *MockOracleAdaptors) Normalise(arg0 crypto.PublicKey, arg1 v10.OracleDataSubmission) (*common.Data, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Normalise", arg0, arg1) ret0, _ := ret[0].(*common.Data) @@ -2408,3 +2468,1348 @@ func (mr *MockCheckpointMockRecorder) Checkpoint(arg0, arg1 interface{}) *gomock mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Checkpoint", reflect.TypeOf((*MockCheckpoint)(nil).Checkpoint), arg0, arg1) } + +// MockBroker is a mock of Broker interface. +type MockBroker struct { + ctrl *gomock.Controller + recorder *MockBrokerMockRecorder +} + +// MockBrokerMockRecorder is the mock recorder for MockBroker. +type MockBrokerMockRecorder struct { + mock *MockBroker +} + +// NewMockBroker creates a new mock instance. +func NewMockBroker(ctrl *gomock.Controller) *MockBroker { + mock := &MockBroker{ctrl: ctrl} + mock.recorder = &MockBrokerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBroker) EXPECT() *MockBrokerMockRecorder { + return m.recorder +} + +// Send mocks base method. +func (m *MockBroker) Send(arg0 events.Event) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Send", arg0) +} + +// Send indicates an expected call of Send. +func (mr *MockBrokerMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBroker)(nil).Send), arg0) +} + +// SetStreaming mocks base method. +func (m *MockBroker) SetStreaming(arg0 bool) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetStreaming", arg0) + ret0, _ := ret[0].(bool) + return ret0 +} + +// SetStreaming indicates an expected call of SetStreaming. +func (mr *MockBrokerMockRecorder) SetStreaming(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStreaming", reflect.TypeOf((*MockBroker)(nil).SetStreaming), arg0) +} + +// SocketClient mocks base method. +func (m *MockBroker) SocketClient() broker.SocketClient { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SocketClient") + ret0, _ := ret[0].(broker.SocketClient) + return ret0 +} + +// SocketClient indicates an expected call of SocketClient. +func (mr *MockBrokerMockRecorder) SocketClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SocketClient", reflect.TypeOf((*MockBroker)(nil).SocketClient)) +} + +// StreamingEnabled mocks base method. +func (m *MockBroker) StreamingEnabled() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StreamingEnabled") + ret0, _ := ret[0].(bool) + return ret0 +} + +// StreamingEnabled indicates an expected call of StreamingEnabled. +func (mr *MockBrokerMockRecorder) StreamingEnabled() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamingEnabled", reflect.TypeOf((*MockBroker)(nil).StreamingEnabled)) +} + +// MockSpamEngine is a mock of SpamEngine interface. +type MockSpamEngine struct { + ctrl *gomock.Controller + recorder *MockSpamEngineMockRecorder +} + +// MockSpamEngineMockRecorder is the mock recorder for MockSpamEngine. +type MockSpamEngineMockRecorder struct { + mock *MockSpamEngine +} + +// NewMockSpamEngine creates a new mock instance. +func NewMockSpamEngine(ctrl *gomock.Controller) *MockSpamEngine { + mock := &MockSpamEngine{ctrl: ctrl} + mock.recorder = &MockSpamEngineMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSpamEngine) EXPECT() *MockSpamEngineMockRecorder { + return m.recorder +} + +// BeginBlock mocks base method. +func (m *MockSpamEngine) BeginBlock(arg0 []abci.Tx) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "BeginBlock", arg0) +} + +// BeginBlock indicates an expected call of BeginBlock. +func (mr *MockSpamEngineMockRecorder) BeginBlock(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockSpamEngine)(nil).BeginBlock), arg0) +} + +// CheckBlockTx mocks base method. +func (m *MockSpamEngine) CheckBlockTx(arg0 abci.Tx) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckBlockTx", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// CheckBlockTx indicates an expected call of CheckBlockTx. +func (mr *MockSpamEngineMockRecorder) CheckBlockTx(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckBlockTx", reflect.TypeOf((*MockSpamEngine)(nil).CheckBlockTx), arg0) +} + +// EndPrepareProposal mocks base method. +func (m *MockSpamEngine) EndPrepareProposal() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "EndPrepareProposal") +} + +// EndPrepareProposal indicates an expected call of EndPrepareProposal. +func (mr *MockSpamEngineMockRecorder) EndPrepareProposal() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndPrepareProposal", reflect.TypeOf((*MockSpamEngine)(nil).EndPrepareProposal)) +} + +// PreBlockAccept mocks base method. +func (m *MockSpamEngine) PreBlockAccept(arg0 abci.Tx) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PreBlockAccept", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// PreBlockAccept indicates an expected call of PreBlockAccept. +func (mr *MockSpamEngineMockRecorder) PreBlockAccept(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreBlockAccept", reflect.TypeOf((*MockSpamEngine)(nil).PreBlockAccept), arg0) +} + +// ProcessProposal mocks base method. +func (m *MockSpamEngine) ProcessProposal(arg0 []abci.Tx) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ProcessProposal", arg0) + ret0, _ := ret[0].(bool) + return ret0 +} + +// ProcessProposal indicates an expected call of ProcessProposal. +func (mr *MockSpamEngineMockRecorder) ProcessProposal(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessProposal", reflect.TypeOf((*MockSpamEngine)(nil).ProcessProposal), arg0) +} + +// MockPoWEngine is a mock of PoWEngine interface. +type MockPoWEngine struct { + ctrl *gomock.Controller + recorder *MockPoWEngineMockRecorder +} + +// MockPoWEngineMockRecorder is the mock recorder for MockPoWEngine. +type MockPoWEngineMockRecorder struct { + mock *MockPoWEngine +} + +// NewMockPoWEngine creates a new mock instance. +func NewMockPoWEngine(ctrl *gomock.Controller) *MockPoWEngine { + mock := &MockPoWEngine{ctrl: ctrl} + mock.recorder = &MockPoWEngineMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockPoWEngine) EXPECT() *MockPoWEngineMockRecorder { + return m.recorder +} + +// BeginBlock mocks base method. +func (m *MockPoWEngine) BeginBlock(arg0 uint64, arg1 string, arg2 []abci.Tx) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "BeginBlock", arg0, arg1, arg2) +} + +// BeginBlock indicates an expected call of BeginBlock. +func (mr *MockPoWEngineMockRecorder) BeginBlock(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockPoWEngine)(nil).BeginBlock), arg0, arg1, arg2) +} + +// BlockData mocks base method. +func (m *MockPoWEngine) BlockData() (uint64, string) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BlockData") + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(string) + return ret0, ret1 +} + +// BlockData indicates an expected call of BlockData. +func (mr *MockPoWEngineMockRecorder) BlockData() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockData", reflect.TypeOf((*MockPoWEngine)(nil).BlockData)) +} + +// CheckBlockTx mocks base method. +func (m *MockPoWEngine) CheckBlockTx(arg0 abci.Tx) (pow.ValidationResult, *uint) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckBlockTx", arg0) + ret0, _ := ret[0].(pow.ValidationResult) + ret1, _ := ret[1].(*uint) + return ret0, ret1 +} + +// CheckBlockTx indicates an expected call of CheckBlockTx. +func (mr *MockPoWEngineMockRecorder) CheckBlockTx(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckBlockTx", reflect.TypeOf((*MockPoWEngine)(nil).CheckBlockTx), arg0) +} + +// CheckTx mocks base method. +func (m *MockPoWEngine) CheckTx(arg0 abci.Tx) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckTx", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// CheckTx indicates an expected call of CheckTx. +func (mr *MockPoWEngineMockRecorder) CheckTx(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckTx", reflect.TypeOf((*MockPoWEngine)(nil).CheckTx), arg0) +} + +// EndPrepareProposal mocks base method. +func (m *MockPoWEngine) EndPrepareProposal(arg0 []pow.ValidationEntry) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "EndPrepareProposal", arg0) +} + +// EndPrepareProposal indicates an expected call of EndPrepareProposal. +func (mr *MockPoWEngineMockRecorder) EndPrepareProposal(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndPrepareProposal", reflect.TypeOf((*MockPoWEngine)(nil).EndPrepareProposal), arg0) +} + +// GetSpamStatistics mocks base method. +func (m *MockPoWEngine) GetSpamStatistics(arg0 string) *v1.PoWStatistic { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSpamStatistics", arg0) + ret0, _ := ret[0].(*v1.PoWStatistic) + return ret0 +} + +// GetSpamStatistics indicates an expected call of GetSpamStatistics. +func (mr *MockPoWEngineMockRecorder) GetSpamStatistics(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSpamStatistics", reflect.TypeOf((*MockPoWEngine)(nil).GetSpamStatistics), arg0) +} + +// IsReady mocks base method. +func (m *MockPoWEngine) IsReady() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsReady") + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsReady indicates an expected call of IsReady. +func (mr *MockPoWEngineMockRecorder) IsReady() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsReady", reflect.TypeOf((*MockPoWEngine)(nil).IsReady)) +} + +// OnCommit mocks base method. +func (m *MockPoWEngine) OnCommit() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "OnCommit") +} + +// OnCommit indicates an expected call of OnCommit. +func (mr *MockPoWEngineMockRecorder) OnCommit() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnCommit", reflect.TypeOf((*MockPoWEngine)(nil).OnCommit)) +} + +// ProcessProposal mocks base method. +func (m *MockPoWEngine) ProcessProposal(arg0 []abci.Tx) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ProcessProposal", arg0) + ret0, _ := ret[0].(bool) + return ret0 +} + +// ProcessProposal indicates an expected call of ProcessProposal. +func (mr *MockPoWEngineMockRecorder) ProcessProposal(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessProposal", reflect.TypeOf((*MockPoWEngine)(nil).ProcessProposal), arg0) +} + +// SpamPoWDifficulty mocks base method. +func (m *MockPoWEngine) SpamPoWDifficulty() uint32 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpamPoWDifficulty") + ret0, _ := ret[0].(uint32) + return ret0 +} + +// SpamPoWDifficulty indicates an expected call of SpamPoWDifficulty. +func (mr *MockPoWEngineMockRecorder) SpamPoWDifficulty() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpamPoWDifficulty", reflect.TypeOf((*MockPoWEngine)(nil).SpamPoWDifficulty)) +} + +// SpamPoWHashFunction mocks base method. +func (m *MockPoWEngine) SpamPoWHashFunction() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpamPoWHashFunction") + ret0, _ := ret[0].(string) + return ret0 +} + +// SpamPoWHashFunction indicates an expected call of SpamPoWHashFunction. +func (mr *MockPoWEngineMockRecorder) SpamPoWHashFunction() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpamPoWHashFunction", reflect.TypeOf((*MockPoWEngine)(nil).SpamPoWHashFunction)) +} + +// SpamPoWIncreasingDifficulty mocks base method. +func (m *MockPoWEngine) SpamPoWIncreasingDifficulty() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpamPoWIncreasingDifficulty") + ret0, _ := ret[0].(bool) + return ret0 +} + +// SpamPoWIncreasingDifficulty indicates an expected call of SpamPoWIncreasingDifficulty. +func (mr *MockPoWEngineMockRecorder) SpamPoWIncreasingDifficulty() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpamPoWIncreasingDifficulty", reflect.TypeOf((*MockPoWEngine)(nil).SpamPoWIncreasingDifficulty)) +} + +// SpamPoWNumberOfPastBlocks mocks base method. +func (m *MockPoWEngine) SpamPoWNumberOfPastBlocks() uint32 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpamPoWNumberOfPastBlocks") + ret0, _ := ret[0].(uint32) + return ret0 +} + +// SpamPoWNumberOfPastBlocks indicates an expected call of SpamPoWNumberOfPastBlocks. +func (mr *MockPoWEngineMockRecorder) SpamPoWNumberOfPastBlocks() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpamPoWNumberOfPastBlocks", reflect.TypeOf((*MockPoWEngine)(nil).SpamPoWNumberOfPastBlocks)) +} + +// SpamPoWNumberOfTxPerBlock mocks base method. +func (m *MockPoWEngine) SpamPoWNumberOfTxPerBlock() uint32 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpamPoWNumberOfTxPerBlock") + ret0, _ := ret[0].(uint32) + return ret0 +} + +// SpamPoWNumberOfTxPerBlock indicates an expected call of SpamPoWNumberOfTxPerBlock. +func (mr *MockPoWEngineMockRecorder) SpamPoWNumberOfTxPerBlock() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpamPoWNumberOfTxPerBlock", reflect.TypeOf((*MockPoWEngine)(nil).SpamPoWNumberOfTxPerBlock)) +} + +// MockSnapshotEngine is a mock of SnapshotEngine interface. +type MockSnapshotEngine struct { + ctrl *gomock.Controller + recorder *MockSnapshotEngineMockRecorder +} + +// MockSnapshotEngineMockRecorder is the mock recorder for MockSnapshotEngine. +type MockSnapshotEngineMockRecorder struct { + mock *MockSnapshotEngine +} + +// NewMockSnapshotEngine creates a new mock instance. +func NewMockSnapshotEngine(ctrl *gomock.Controller) *MockSnapshotEngine { + mock := &MockSnapshotEngine{ctrl: ctrl} + mock.recorder = &MockSnapshotEngineMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSnapshotEngine) EXPECT() *MockSnapshotEngineMockRecorder { + return m.recorder +} + +// AddProviders mocks base method. +func (m *MockSnapshotEngine) AddProviders(arg0 ...types.StateProvider) { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range arg0 { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "AddProviders", varargs...) +} + +// AddProviders indicates an expected call of AddProviders. +func (mr *MockSnapshotEngineMockRecorder) AddProviders(arg0 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddProviders", reflect.TypeOf((*MockSnapshotEngine)(nil).AddProviders), arg0...) +} + +// HasRestoredStateAlready mocks base method. +func (m *MockSnapshotEngine) HasRestoredStateAlready() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HasRestoredStateAlready") + ret0, _ := ret[0].(bool) + return ret0 +} + +// HasRestoredStateAlready indicates an expected call of HasRestoredStateAlready. +func (mr *MockSnapshotEngineMockRecorder) HasRestoredStateAlready() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasRestoredStateAlready", reflect.TypeOf((*MockSnapshotEngine)(nil).HasRestoredStateAlready)) +} + +// HasSnapshots mocks base method. +func (m *MockSnapshotEngine) HasSnapshots() (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HasSnapshots") + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// HasSnapshots indicates an expected call of HasSnapshots. +func (mr *MockSnapshotEngineMockRecorder) HasSnapshots() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasSnapshots", reflect.TypeOf((*MockSnapshotEngine)(nil).HasSnapshots)) +} + +// Info mocks base method. +func (m *MockSnapshotEngine) Info() ([]byte, int64, string) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Info") + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(int64) + ret2, _ := ret[2].(string) + return ret0, ret1, ret2 +} + +// Info indicates an expected call of Info. +func (mr *MockSnapshotEngineMockRecorder) Info() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info", reflect.TypeOf((*MockSnapshotEngine)(nil).Info)) +} + +// ListLatestSnapshots mocks base method. +func (m *MockSnapshotEngine) ListLatestSnapshots() ([]*types0.Snapshot, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListLatestSnapshots") + ret0, _ := ret[0].([]*types0.Snapshot) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListLatestSnapshots indicates an expected call of ListLatestSnapshots. +func (mr *MockSnapshotEngineMockRecorder) ListLatestSnapshots() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLatestSnapshots", reflect.TypeOf((*MockSnapshotEngine)(nil).ListLatestSnapshots)) +} + +// ReceiveSnapshot mocks base method. +func (m *MockSnapshotEngine) ReceiveSnapshot(arg0 *types.Snapshot) types0.ResponseOfferSnapshot { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReceiveSnapshot", arg0) + ret0, _ := ret[0].(types0.ResponseOfferSnapshot) + return ret0 +} + +// ReceiveSnapshot indicates an expected call of ReceiveSnapshot. +func (mr *MockSnapshotEngineMockRecorder) ReceiveSnapshot(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceiveSnapshot", reflect.TypeOf((*MockSnapshotEngine)(nil).ReceiveSnapshot), arg0) +} + +// ReceiveSnapshotChunk mocks base method. +func (m *MockSnapshotEngine) ReceiveSnapshotChunk(arg0 context.Context, arg1 *types.RawChunk, arg2 string) types0.ResponseApplySnapshotChunk { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReceiveSnapshotChunk", arg0, arg1, arg2) + ret0, _ := ret[0].(types0.ResponseApplySnapshotChunk) + return ret0 +} + +// ReceiveSnapshotChunk indicates an expected call of ReceiveSnapshotChunk. +func (mr *MockSnapshotEngineMockRecorder) ReceiveSnapshotChunk(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceiveSnapshotChunk", reflect.TypeOf((*MockSnapshotEngine)(nil).ReceiveSnapshotChunk), arg0, arg1, arg2) +} + +// RetrieveSnapshotChunk mocks base method. +func (m *MockSnapshotEngine) RetrieveSnapshotChunk(arg0 uint64, arg1, arg2 uint32) (*types.RawChunk, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RetrieveSnapshotChunk", arg0, arg1, arg2) + ret0, _ := ret[0].(*types.RawChunk) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RetrieveSnapshotChunk indicates an expected call of RetrieveSnapshotChunk. +func (mr *MockSnapshotEngineMockRecorder) RetrieveSnapshotChunk(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveSnapshotChunk", reflect.TypeOf((*MockSnapshotEngine)(nil).RetrieveSnapshotChunk), arg0, arg1, arg2) +} + +// Snapshot mocks base method. +func (m *MockSnapshotEngine) Snapshot(arg0 context.Context) ([]byte, snapshot.DoneCh, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Snapshot", arg0) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(snapshot.DoneCh) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Snapshot indicates an expected call of Snapshot. +func (mr *MockSnapshotEngineMockRecorder) Snapshot(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Snapshot", reflect.TypeOf((*MockSnapshotEngine)(nil).Snapshot), arg0) +} + +// SnapshotDump mocks base method. +func (m *MockSnapshotEngine) SnapshotDump(arg0 context.Context, arg1 string) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SnapshotDump", arg0, arg1) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SnapshotDump indicates an expected call of SnapshotDump. +func (mr *MockSnapshotEngineMockRecorder) SnapshotDump(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SnapshotDump", reflect.TypeOf((*MockSnapshotEngine)(nil).SnapshotDump), arg0, arg1) +} + +// SnapshotNow mocks base method. +func (m *MockSnapshotEngine) SnapshotNow(arg0 context.Context) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SnapshotNow", arg0) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SnapshotNow indicates an expected call of SnapshotNow. +func (mr *MockSnapshotEngineMockRecorder) SnapshotNow(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SnapshotNow", reflect.TypeOf((*MockSnapshotEngine)(nil).SnapshotNow), arg0) +} + +// MockStateVarEngine is a mock of StateVarEngine interface. +type MockStateVarEngine struct { + ctrl *gomock.Controller + recorder *MockStateVarEngineMockRecorder +} + +// MockStateVarEngineMockRecorder is the mock recorder for MockStateVarEngine. +type MockStateVarEngineMockRecorder struct { + mock *MockStateVarEngine +} + +// NewMockStateVarEngine creates a new mock instance. +func NewMockStateVarEngine(ctrl *gomock.Controller) *MockStateVarEngine { + mock := &MockStateVarEngine{ctrl: ctrl} + mock.recorder = &MockStateVarEngineMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockStateVarEngine) EXPECT() *MockStateVarEngineMockRecorder { + return m.recorder +} + +// OnBlockEnd mocks base method. +func (m *MockStateVarEngine) OnBlockEnd(arg0 context.Context) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "OnBlockEnd", arg0) +} + +// OnBlockEnd indicates an expected call of OnBlockEnd. +func (mr *MockStateVarEngineMockRecorder) OnBlockEnd(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnBlockEnd", reflect.TypeOf((*MockStateVarEngine)(nil).OnBlockEnd), arg0) +} + +// ProposedValueReceived mocks base method. +func (m *MockStateVarEngine) ProposedValueReceived(arg0 context.Context, arg1, arg2, arg3 string, arg4 *statevar.KeyValueBundle) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ProposedValueReceived", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(error) + return ret0 +} + +// ProposedValueReceived indicates an expected call of ProposedValueReceived. +func (mr *MockStateVarEngineMockRecorder) ProposedValueReceived(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProposedValueReceived", reflect.TypeOf((*MockStateVarEngine)(nil).ProposedValueReceived), arg0, arg1, arg2, arg3, arg4) +} + +// MockTeamsEngine is a mock of TeamsEngine interface. +type MockTeamsEngine struct { + ctrl *gomock.Controller + recorder *MockTeamsEngineMockRecorder +} + +// MockTeamsEngineMockRecorder is the mock recorder for MockTeamsEngine. +type MockTeamsEngineMockRecorder struct { + mock *MockTeamsEngine +} + +// NewMockTeamsEngine creates a new mock instance. +func NewMockTeamsEngine(ctrl *gomock.Controller) *MockTeamsEngine { + mock := &MockTeamsEngine{ctrl: ctrl} + mock.recorder = &MockTeamsEngineMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockTeamsEngine) EXPECT() *MockTeamsEngineMockRecorder { + return m.recorder +} + +// CreateTeam mocks base method. +func (m *MockTeamsEngine) CreateTeam(arg0 context.Context, arg1 types.PartyID, arg2 types.TeamID, arg3 *v10.CreateReferralSet_Team) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateTeam", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateTeam indicates an expected call of CreateTeam. +func (mr *MockTeamsEngineMockRecorder) CreateTeam(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTeam", reflect.TypeOf((*MockTeamsEngine)(nil).CreateTeam), arg0, arg1, arg2, arg3) +} + +// JoinTeam mocks base method. +func (m *MockTeamsEngine) JoinTeam(arg0 context.Context, arg1 types.PartyID, arg2 *v10.JoinTeam) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "JoinTeam", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// JoinTeam indicates an expected call of JoinTeam. +func (mr *MockTeamsEngineMockRecorder) JoinTeam(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "JoinTeam", reflect.TypeOf((*MockTeamsEngine)(nil).JoinTeam), arg0, arg1, arg2) +} + +// TeamExists mocks base method. +func (m *MockTeamsEngine) TeamExists(arg0 types.TeamID) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TeamExists", arg0) + ret0, _ := ret[0].(bool) + return ret0 +} + +// TeamExists indicates an expected call of TeamExists. +func (mr *MockTeamsEngineMockRecorder) TeamExists(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TeamExists", reflect.TypeOf((*MockTeamsEngine)(nil).TeamExists), arg0) +} + +// UpdateTeam mocks base method. +func (m *MockTeamsEngine) UpdateTeam(arg0 context.Context, arg1 types.PartyID, arg2 types.TeamID, arg3 *v10.UpdateReferralSet_Team) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateTeam", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateTeam indicates an expected call of UpdateTeam. +func (mr *MockTeamsEngineMockRecorder) UpdateTeam(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTeam", reflect.TypeOf((*MockTeamsEngine)(nil).UpdateTeam), arg0, arg1, arg2, arg3) +} + +// MockReferralProgram is a mock of ReferralProgram interface. +type MockReferralProgram struct { + ctrl *gomock.Controller + recorder *MockReferralProgramMockRecorder +} + +// MockReferralProgramMockRecorder is the mock recorder for MockReferralProgram. +type MockReferralProgramMockRecorder struct { + mock *MockReferralProgram +} + +// NewMockReferralProgram creates a new mock instance. +func NewMockReferralProgram(ctrl *gomock.Controller) *MockReferralProgram { + mock := &MockReferralProgram{ctrl: ctrl} + mock.recorder = &MockReferralProgramMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockReferralProgram) EXPECT() *MockReferralProgramMockRecorder { + return m.recorder +} + +// ApplyReferralCode mocks base method. +func (m *MockReferralProgram) ApplyReferralCode(arg0 context.Context, arg1 types.PartyID, arg2 types.ReferralSetID) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ApplyReferralCode", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ApplyReferralCode indicates an expected call of ApplyReferralCode. +func (mr *MockReferralProgramMockRecorder) ApplyReferralCode(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApplyReferralCode", reflect.TypeOf((*MockReferralProgram)(nil).ApplyReferralCode), arg0, arg1, arg2) +} + +// CheckSufficientBalanceForApplyReferralCode mocks base method. +func (m *MockReferralProgram) CheckSufficientBalanceForApplyReferralCode(arg0 types.PartyID, arg1 *num.Uint) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckSufficientBalanceForApplyReferralCode", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// CheckSufficientBalanceForApplyReferralCode indicates an expected call of CheckSufficientBalanceForApplyReferralCode. +func (mr *MockReferralProgramMockRecorder) CheckSufficientBalanceForApplyReferralCode(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckSufficientBalanceForApplyReferralCode", reflect.TypeOf((*MockReferralProgram)(nil).CheckSufficientBalanceForApplyReferralCode), arg0, arg1) +} + +// CheckSufficientBalanceForCreateOrUpdateReferralSet mocks base method. +func (m *MockReferralProgram) CheckSufficientBalanceForCreateOrUpdateReferralSet(arg0 types.PartyID, arg1 *num.Uint) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckSufficientBalanceForCreateOrUpdateReferralSet", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// CheckSufficientBalanceForCreateOrUpdateReferralSet indicates an expected call of CheckSufficientBalanceForCreateOrUpdateReferralSet. +func (mr *MockReferralProgramMockRecorder) CheckSufficientBalanceForCreateOrUpdateReferralSet(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckSufficientBalanceForCreateOrUpdateReferralSet", reflect.TypeOf((*MockReferralProgram)(nil).CheckSufficientBalanceForCreateOrUpdateReferralSet), arg0, arg1) +} + +// CreateReferralSet mocks base method. +func (m *MockReferralProgram) CreateReferralSet(arg0 context.Context, arg1 types.PartyID, arg2 types.ReferralSetID) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateReferralSet", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateReferralSet indicates an expected call of CreateReferralSet. +func (mr *MockReferralProgramMockRecorder) CreateReferralSet(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateReferralSet", reflect.TypeOf((*MockReferralProgram)(nil).CreateReferralSet), arg0, arg1, arg2) +} + +// PartyOwnsReferralSet mocks base method. +func (m *MockReferralProgram) PartyOwnsReferralSet(arg0 types.PartyID, arg1 types.ReferralSetID) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PartyOwnsReferralSet", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// PartyOwnsReferralSet indicates an expected call of PartyOwnsReferralSet. +func (mr *MockReferralProgramMockRecorder) PartyOwnsReferralSet(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PartyOwnsReferralSet", reflect.TypeOf((*MockReferralProgram)(nil).PartyOwnsReferralSet), arg0, arg1) +} + +// UpdateProgram mocks base method. +func (m *MockReferralProgram) UpdateProgram(arg0 *types.ReferralProgram) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "UpdateProgram", arg0) +} + +// UpdateProgram indicates an expected call of UpdateProgram. +func (mr *MockReferralProgramMockRecorder) UpdateProgram(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateProgram", reflect.TypeOf((*MockReferralProgram)(nil).UpdateProgram), arg0) +} + +// MockVolumeDiscountProgram is a mock of VolumeDiscountProgram interface. +type MockVolumeDiscountProgram struct { + ctrl *gomock.Controller + recorder *MockVolumeDiscountProgramMockRecorder +} + +// MockVolumeDiscountProgramMockRecorder is the mock recorder for MockVolumeDiscountProgram. +type MockVolumeDiscountProgramMockRecorder struct { + mock *MockVolumeDiscountProgram +} + +// NewMockVolumeDiscountProgram creates a new mock instance. +func NewMockVolumeDiscountProgram(ctrl *gomock.Controller) *MockVolumeDiscountProgram { + mock := &MockVolumeDiscountProgram{ctrl: ctrl} + mock.recorder = &MockVolumeDiscountProgramMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockVolumeDiscountProgram) EXPECT() *MockVolumeDiscountProgramMockRecorder { + return m.recorder +} + +// UpdateProgram mocks base method. +func (m *MockVolumeDiscountProgram) UpdateProgram(arg0 *types.VolumeDiscountProgram) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "UpdateProgram", arg0) +} + +// UpdateProgram indicates an expected call of UpdateProgram. +func (mr *MockVolumeDiscountProgramMockRecorder) UpdateProgram(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateProgram", reflect.TypeOf((*MockVolumeDiscountProgram)(nil).UpdateProgram), arg0) +} + +// MockBlockchainClient is a mock of BlockchainClient interface. +type MockBlockchainClient struct { + ctrl *gomock.Controller + recorder *MockBlockchainClientMockRecorder +} + +// MockBlockchainClientMockRecorder is the mock recorder for MockBlockchainClient. +type MockBlockchainClientMockRecorder struct { + mock *MockBlockchainClient +} + +// NewMockBlockchainClient creates a new mock instance. +func NewMockBlockchainClient(ctrl *gomock.Controller) *MockBlockchainClient { + mock := &MockBlockchainClient{ctrl: ctrl} + mock.recorder = &MockBlockchainClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBlockchainClient) EXPECT() *MockBlockchainClientMockRecorder { + return m.recorder +} + +// MaxMempoolSize mocks base method. +func (m *MockBlockchainClient) MaxMempoolSize() int64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MaxMempoolSize") + ret0, _ := ret[0].(int64) + return ret0 +} + +// MaxMempoolSize indicates an expected call of MaxMempoolSize. +func (mr *MockBlockchainClientMockRecorder) MaxMempoolSize() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MaxMempoolSize", reflect.TypeOf((*MockBlockchainClient)(nil).MaxMempoolSize)) +} + +// Validators mocks base method. +func (m *MockBlockchainClient) Validators(arg0 *int64) ([]*types1.Validator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Validators", arg0) + ret0, _ := ret[0].([]*types1.Validator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Validators indicates an expected call of Validators. +func (mr *MockBlockchainClientMockRecorder) Validators(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Validators", reflect.TypeOf((*MockBlockchainClient)(nil).Validators), arg0) +} + +// MockProtocolUpgradeService is a mock of ProtocolUpgradeService interface. +type MockProtocolUpgradeService struct { + ctrl *gomock.Controller + recorder *MockProtocolUpgradeServiceMockRecorder +} + +// MockProtocolUpgradeServiceMockRecorder is the mock recorder for MockProtocolUpgradeService. +type MockProtocolUpgradeServiceMockRecorder struct { + mock *MockProtocolUpgradeService +} + +// NewMockProtocolUpgradeService creates a new mock instance. +func NewMockProtocolUpgradeService(ctrl *gomock.Controller) *MockProtocolUpgradeService { + mock := &MockProtocolUpgradeService{ctrl: ctrl} + mock.recorder = &MockProtocolUpgradeServiceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockProtocolUpgradeService) EXPECT() *MockProtocolUpgradeServiceMockRecorder { + return m.recorder +} + +// BeginBlock mocks base method. +func (m *MockProtocolUpgradeService) BeginBlock(arg0 context.Context, arg1 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "BeginBlock", arg0, arg1) +} + +// BeginBlock indicates an expected call of BeginBlock. +func (mr *MockProtocolUpgradeServiceMockRecorder) BeginBlock(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockProtocolUpgradeService)(nil).BeginBlock), arg0, arg1) +} + +// Cleanup mocks base method. +func (m *MockProtocolUpgradeService) Cleanup(arg0 context.Context) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Cleanup", arg0) +} + +// Cleanup indicates an expected call of Cleanup. +func (mr *MockProtocolUpgradeServiceMockRecorder) Cleanup(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cleanup", reflect.TypeOf((*MockProtocolUpgradeService)(nil).Cleanup), arg0) +} + +// CoreReadyForUpgrade mocks base method. +func (m *MockProtocolUpgradeService) CoreReadyForUpgrade() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CoreReadyForUpgrade") + ret0, _ := ret[0].(bool) + return ret0 +} + +// CoreReadyForUpgrade indicates an expected call of CoreReadyForUpgrade. +func (mr *MockProtocolUpgradeServiceMockRecorder) CoreReadyForUpgrade() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CoreReadyForUpgrade", reflect.TypeOf((*MockProtocolUpgradeService)(nil).CoreReadyForUpgrade)) +} + +// GetUpgradeStatus mocks base method. +func (m *MockProtocolUpgradeService) GetUpgradeStatus() types.UpgradeStatus { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUpgradeStatus") + ret0, _ := ret[0].(types.UpgradeStatus) + return ret0 +} + +// GetUpgradeStatus indicates an expected call of GetUpgradeStatus. +func (mr *MockProtocolUpgradeServiceMockRecorder) GetUpgradeStatus() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUpgradeStatus", reflect.TypeOf((*MockProtocolUpgradeService)(nil).GetUpgradeStatus)) +} + +// IsValidProposal mocks base method. +func (m *MockProtocolUpgradeService) IsValidProposal(arg0 context.Context, arg1 string, arg2 uint64, arg3 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsValidProposal", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// IsValidProposal indicates an expected call of IsValidProposal. +func (mr *MockProtocolUpgradeServiceMockRecorder) IsValidProposal(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsValidProposal", reflect.TypeOf((*MockProtocolUpgradeService)(nil).IsValidProposal), arg0, arg1, arg2, arg3) +} + +// SetCoreReadyForUpgrade mocks base method. +func (m *MockProtocolUpgradeService) SetCoreReadyForUpgrade() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetCoreReadyForUpgrade") +} + +// SetCoreReadyForUpgrade indicates an expected call of SetCoreReadyForUpgrade. +func (mr *MockProtocolUpgradeServiceMockRecorder) SetCoreReadyForUpgrade() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCoreReadyForUpgrade", reflect.TypeOf((*MockProtocolUpgradeService)(nil).SetCoreReadyForUpgrade)) +} + +// SetReadyForUpgrade mocks base method. +func (m *MockProtocolUpgradeService) SetReadyForUpgrade() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetReadyForUpgrade") +} + +// SetReadyForUpgrade indicates an expected call of SetReadyForUpgrade. +func (mr *MockProtocolUpgradeServiceMockRecorder) SetReadyForUpgrade() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadyForUpgrade", reflect.TypeOf((*MockProtocolUpgradeService)(nil).SetReadyForUpgrade)) +} + +// TimeForUpgrade mocks base method. +func (m *MockProtocolUpgradeService) TimeForUpgrade() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TimeForUpgrade") + ret0, _ := ret[0].(bool) + return ret0 +} + +// TimeForUpgrade indicates an expected call of TimeForUpgrade. +func (mr *MockProtocolUpgradeServiceMockRecorder) TimeForUpgrade() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TimeForUpgrade", reflect.TypeOf((*MockProtocolUpgradeService)(nil).TimeForUpgrade)) +} + +// UpgradeProposal mocks base method. +func (m *MockProtocolUpgradeService) UpgradeProposal(arg0 context.Context, arg1 string, arg2 uint64, arg3 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpgradeProposal", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpgradeProposal indicates an expected call of UpgradeProposal. +func (mr *MockProtocolUpgradeServiceMockRecorder) UpgradeProposal(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpgradeProposal", reflect.TypeOf((*MockProtocolUpgradeService)(nil).UpgradeProposal), arg0, arg1, arg2, arg3) +} + +// MockEthCallEngine is a mock of EthCallEngine interface. +type MockEthCallEngine struct { + ctrl *gomock.Controller + recorder *MockEthCallEngineMockRecorder +} + +// MockEthCallEngineMockRecorder is the mock recorder for MockEthCallEngine. +type MockEthCallEngineMockRecorder struct { + mock *MockEthCallEngine +} + +// NewMockEthCallEngine creates a new mock instance. +func NewMockEthCallEngine(ctrl *gomock.Controller) *MockEthCallEngine { + mock := &MockEthCallEngine{ctrl: ctrl} + mock.recorder = &MockEthCallEngineMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockEthCallEngine) EXPECT() *MockEthCallEngineMockRecorder { + return m.recorder +} + +// Start mocks base method. +func (m *MockEthCallEngine) Start() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Start") +} + +// Start indicates an expected call of Start. +func (mr *MockEthCallEngineMockRecorder) Start() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockEthCallEngine)(nil).Start)) +} + +// MockBalanceChecker is a mock of BalanceChecker interface. +type MockBalanceChecker struct { + ctrl *gomock.Controller + recorder *MockBalanceCheckerMockRecorder +} + +// MockBalanceCheckerMockRecorder is the mock recorder for MockBalanceChecker. +type MockBalanceCheckerMockRecorder struct { + mock *MockBalanceChecker +} + +// NewMockBalanceChecker creates a new mock instance. +func NewMockBalanceChecker(ctrl *gomock.Controller) *MockBalanceChecker { + mock := &MockBalanceChecker{ctrl: ctrl} + mock.recorder = &MockBalanceCheckerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBalanceChecker) EXPECT() *MockBalanceCheckerMockRecorder { + return m.recorder +} + +// BeginBlock mocks base method. +func (m *MockBalanceChecker) BeginBlock(arg0 context.Context) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "BeginBlock", arg0) +} + +// BeginBlock indicates an expected call of BeginBlock. +func (mr *MockBalanceCheckerMockRecorder) BeginBlock(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockBalanceChecker)(nil).BeginBlock), arg0) +} + +// GetPartyBalance mocks base method. +func (m *MockBalanceChecker) GetPartyBalance(arg0 string) *num.Uint { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPartyBalance", arg0) + ret0, _ := ret[0].(*num.Uint) + return ret0 +} + +// GetPartyBalance indicates an expected call of GetPartyBalance. +func (mr *MockBalanceCheckerMockRecorder) GetPartyBalance(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPartyBalance", reflect.TypeOf((*MockBalanceChecker)(nil).GetPartyBalance), arg0) +} + +// MockPartiesEngine is a mock of PartiesEngine interface. +type MockPartiesEngine struct { + ctrl *gomock.Controller + recorder *MockPartiesEngineMockRecorder +} + +// MockPartiesEngineMockRecorder is the mock recorder for MockPartiesEngine. +type MockPartiesEngineMockRecorder struct { + mock *MockPartiesEngine +} + +// NewMockPartiesEngine creates a new mock instance. +func NewMockPartiesEngine(ctrl *gomock.Controller) *MockPartiesEngine { + mock := &MockPartiesEngine{ctrl: ctrl} + mock.recorder = &MockPartiesEngineMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockPartiesEngine) EXPECT() *MockPartiesEngineMockRecorder { + return m.recorder +} + +// CheckSufficientBalanceToUpdateProfile mocks base method. +func (m *MockPartiesEngine) CheckSufficientBalanceToUpdateProfile(arg0 types.PartyID, arg1 *num.Uint) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckSufficientBalanceToUpdateProfile", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// CheckSufficientBalanceToUpdateProfile indicates an expected call of CheckSufficientBalanceToUpdateProfile. +func (mr *MockPartiesEngineMockRecorder) CheckSufficientBalanceToUpdateProfile(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckSufficientBalanceToUpdateProfile", reflect.TypeOf((*MockPartiesEngine)(nil).CheckSufficientBalanceToUpdateProfile), arg0, arg1) +} + +// UpdateProfile mocks base method. +func (m *MockPartiesEngine) UpdateProfile(arg0 context.Context, arg1 types.PartyID, arg2 *v10.UpdatePartyProfile) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateProfile", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateProfile indicates an expected call of UpdateProfile. +func (mr *MockPartiesEngineMockRecorder) UpdateProfile(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateProfile", reflect.TypeOf((*MockPartiesEngine)(nil).UpdateProfile), arg0, arg1, arg2) +} + +// MockTxCache is a mock of TxCache interface. +type MockTxCache struct { + ctrl *gomock.Controller + recorder *MockTxCacheMockRecorder +} + +// MockTxCacheMockRecorder is the mock recorder for MockTxCache. +type MockTxCacheMockRecorder struct { + mock *MockTxCache +} + +// NewMockTxCache creates a new mock instance. +func NewMockTxCache(ctrl *gomock.Controller) *MockTxCache { + mock := &MockTxCache{ctrl: ctrl} + mock.recorder = &MockTxCacheMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockTxCache) EXPECT() *MockTxCacheMockRecorder { + return m.recorder +} + +// GetRawTxs mocks base method. +func (m *MockTxCache) GetRawTxs(arg0 uint64) [][]byte { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRawTxs", arg0) + ret0, _ := ret[0].([][]byte) + return ret0 +} + +// GetRawTxs indicates an expected call of GetRawTxs. +func (mr *MockTxCacheMockRecorder) GetRawTxs(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRawTxs", reflect.TypeOf((*MockTxCache)(nil).GetRawTxs), arg0) +} + +// IsDelayRequired mocks base method. +func (m *MockTxCache) IsDelayRequired(arg0 string) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsDelayRequired", arg0) + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsDelayRequired indicates an expected call of IsDelayRequired. +func (mr *MockTxCacheMockRecorder) IsDelayRequired(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDelayRequired", reflect.TypeOf((*MockTxCache)(nil).IsDelayRequired), arg0) +} + +// IsDelayRequiredAnyMarket mocks base method. +func (m *MockTxCache) IsDelayRequiredAnyMarket() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsDelayRequiredAnyMarket") + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsDelayRequiredAnyMarket indicates an expected call of IsDelayRequiredAnyMarket. +func (mr *MockTxCacheMockRecorder) IsDelayRequiredAnyMarket() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDelayRequiredAnyMarket", reflect.TypeOf((*MockTxCache)(nil).IsDelayRequiredAnyMarket)) +} + +// IsTxInCache mocks base method. +func (m *MockTxCache) IsTxInCache(arg0 []byte) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsTxInCache", arg0) + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsTxInCache indicates an expected call of IsTxInCache. +func (mr *MockTxCacheMockRecorder) IsTxInCache(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsTxInCache", reflect.TypeOf((*MockTxCache)(nil).IsTxInCache), arg0) +} + +// NewDelayedTransaction mocks base method. +func (m *MockTxCache) NewDelayedTransaction(arg0 context.Context, arg1 [][]byte, arg2 uint64) []byte { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewDelayedTransaction", arg0, arg1, arg2) + ret0, _ := ret[0].([]byte) + return ret0 +} + +// NewDelayedTransaction indicates an expected call of NewDelayedTransaction. +func (mr *MockTxCacheMockRecorder) NewDelayedTransaction(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewDelayedTransaction", reflect.TypeOf((*MockTxCache)(nil).NewDelayedTransaction), arg0, arg1, arg2) +} + +// SetRawTxs mocks base method. +func (m *MockTxCache) SetRawTxs(arg0 [][]byte, arg1 uint64) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetRawTxs", arg0, arg1) +} + +// SetRawTxs indicates an expected call of SetRawTxs. +func (mr *MockTxCacheMockRecorder) SetRawTxs(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetRawTxs", reflect.TypeOf((*MockTxCache)(nil).SetRawTxs), arg0, arg1) +} + +// MockEthereumOracleVerifier is a mock of EthereumOracleVerifier interface. +type MockEthereumOracleVerifier struct { + ctrl *gomock.Controller + recorder *MockEthereumOracleVerifierMockRecorder +} + +// MockEthereumOracleVerifierMockRecorder is the mock recorder for MockEthereumOracleVerifier. +type MockEthereumOracleVerifierMockRecorder struct { + mock *MockEthereumOracleVerifier +} + +// NewMockEthereumOracleVerifier creates a new mock instance. +func NewMockEthereumOracleVerifier(ctrl *gomock.Controller) *MockEthereumOracleVerifier { + mock := &MockEthereumOracleVerifier{ctrl: ctrl} + mock.recorder = &MockEthereumOracleVerifierMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockEthereumOracleVerifier) EXPECT() *MockEthereumOracleVerifierMockRecorder { + return m.recorder +} + +// ProcessEthereumContractCallResult mocks base method. +func (m *MockEthereumOracleVerifier) ProcessEthereumContractCallResult(arg0 ethcall.ContractCallEvent) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ProcessEthereumContractCallResult", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// ProcessEthereumContractCallResult indicates an expected call of ProcessEthereumContractCallResult. +func (mr *MockEthereumOracleVerifierMockRecorder) ProcessEthereumContractCallResult(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessEthereumContractCallResult", reflect.TypeOf((*MockEthereumOracleVerifier)(nil).ProcessEthereumContractCallResult), arg0) +} + +// MockCodec is a mock of Codec interface. +type MockCodec struct { + ctrl *gomock.Controller + recorder *MockCodecMockRecorder +} + +// MockCodecMockRecorder is the mock recorder for MockCodec. +type MockCodecMockRecorder struct { + mock *MockCodec +} + +// NewMockCodec creates a new mock instance. +func NewMockCodec(ctrl *gomock.Controller) *MockCodec { + mock := &MockCodec{ctrl: ctrl} + mock.recorder = &MockCodecMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockCodec) EXPECT() *MockCodecMockRecorder { + return m.recorder +} + +// Decode mocks base method. +func (m *MockCodec) Decode(arg0 []byte, arg1 string) (abci.Tx, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Decode", arg0, arg1) + ret0, _ := ret[0].(abci.Tx) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Decode indicates an expected call of Decode. +func (mr *MockCodecMockRecorder) Decode(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Decode", reflect.TypeOf((*MockCodec)(nil).Decode), arg0, arg1) +} diff --git a/core/processor/processor.go b/core/processor/processor.go index 57ac56b5a56..5d552b2b9f9 100644 --- a/core/processor/processor.go +++ b/core/processor/processor.go @@ -37,7 +37,7 @@ import ( "github.com/pkg/errors" ) -//go:generate go run github.com/golang/mock/mockgen -destination mocks/mocks.go -package mocks code.vegaprotocol.io/vega/core/processor TimeService,EpochService,DelegationEngine,ExecutionEngine,GovernanceEngine,Stats,Assets,ValidatorTopology,Notary,EvtForwarder,Witness,Banking,NetworkParameters,OraclesEngine,OracleAdaptors,Limits,StakeVerifier,StakingAccounts,ERC20MultiSigTopology,Checkpoint +//go:generate go run github.com/golang/mock/mockgen -destination mocks/mocks.go -package mocks code.vegaprotocol.io/vega/core/processor TimeService,EpochService,DelegationEngine,ExecutionEngine,GovernanceEngine,Stats,Assets,ValidatorTopology,Notary,EvtForwarder,EvtForwarderHeartbeat,Witness,Banking,NetworkParameters,OraclesEngine,OracleAdaptors,Limits,StakeVerifier,StakingAccounts,ERC20MultiSigTopology,Checkpoint,Broker,SpamEngine,PoWEngine,SnapshotEngine,StateVarEngine,TeamsEngine,ReferralProgram,VolumeDiscountProgram,BlockchainClient,ProtocolUpgradeService,EthCallEngine,BalanceChecker,PartiesEngine,TxCache,EthereumOracleVerifier,Codec var ( ErrChainEventFromNonValidator = errors.New("chain event emitted from a non-validator node") @@ -115,6 +115,9 @@ type ExecutionEngine interface { SubmitAMM(ctx context.Context, sub *types.SubmitAMM, deterministicID string) error AmendAMM(ctx context.Context, sub *types.AmendAMM, deterministicID string) error CancelAMM(ctx context.Context, sub *types.CancelAMM, deterministicID string) error + + // add this method here for testing, this is the exec engine interface used by the gastimator. + GetMarketCounters() map[string]*types.MarketCounters } type GovernanceEngine interface {