diff --git a/.mockery.yaml b/.mockery.yaml index e8e4bec4d9..f245c8a47a 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -4,9 +4,65 @@ template: testify packages: github.com/wavesplatform/gowaves/pkg/networking: interfaces: - Handler: {} - Header: {} - Protocol: {} + Handler: { } + Header: { } + Protocol: { } github.com/wavesplatform/gowaves/pkg/blockchaininfo: interfaces: - UpdatesPublisherInterface: {} + UpdatesPublisherInterface: { } + github.com/wavesplatform/gowaves/pkg/state: + interfaces: + State: + config: + filename: mock_state.go + scriptStorageState: + config: + structname: MockScriptStorageState + filename: mock_script_storage_state_test.go + featuresState: + config: + structname: MockFeaturesState + filename: mock_features_state_test.go + github.com/wavesplatform/gowaves/pkg/consensus: + interfaces: + stateInfoProvider: + config: + filename: mock_state_info_provider_test.go + github.com/wavesplatform/gowaves/pkg/ride: + interfaces: + environment: + config: + structname: MockEnvironment + filename: mock_environment_test.go + github.com/wavesplatform/gowaves/pkg/grpc/server: + interfaces: + GrpcHandlers: + config: + filename: mock_grpc_handlers_test.go + github.com/wavesplatform/gowaves/pkg/node/peers: + interfaces: + PeerManager: + config: + filename: mock_peer_manager.go + PeerStorage: + config: + filename: mock_peer_storage_test.go + github.com/wavesplatform/gowaves/pkg/p2p/conn: + interfaces: + deadlineReader: + config: + structname: MockDeadlineReader + filename: mock_deadline_reader_test.go + github.com/wavesplatform/gowaves/pkg/p2p/peer: + interfaces: + Peer: + config: + filename: mock_peer_exported.go + github.com/wavesplatform/gowaves/pkg/types: + interfaces: + SmartState: + config: + filename: mock_smart_state.go + EnrichedSmartState: + config: + filename: mock_enriched_smart_state.go diff --git a/Makefile b/Makefile index 1cc45c1830..552866d115 100644 --- a/Makefile +++ b/Makefile @@ -256,12 +256,6 @@ dist: clean dist-chaincmp dist-importer dist-node dist-wallet dist-compiler build: vendor ver build-chaincmp-native build-blockcmp-native build-node-native build-importer-native build-wallet-native build-rollback-native build-compiler-native build-statehash-native build-convert-native mock: - mockgen -source pkg/miner/utxpool/cleaner.go -destination pkg/miner/utxpool/mock.go -package utxpool stateWrapper - mockgen -source pkg/node/peers/peer_manager.go -destination pkg/mock/peer_manager.go -package mock PeerManager - mockgen -source pkg/node/peers/peer_storage.go -destination pkg/mock/peer_storage.go -package mock PeerStorage - mockgen -source pkg/p2p/peer/peer.go -destination pkg/mock/peer.go -package mock Peer - mockgen -source pkg/state/api.go -destination pkg/mock/state.go -package mock State - mockgen -source pkg/grpc/server/api.go -destination pkg/mock/grpc.go -package mock GrpcHandlers mockery proto: diff --git a/go.mod b/go.mod index 512cb86629..965a597541 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/fxamacker/cbor/v2 v2.9.0 github.com/go-chi/chi/v5 v5.2.5 github.com/go-test/deep v1.1.1 - github.com/golang/mock v1.6.0 github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c github.com/jinzhu/copier v0.4.0 diff --git a/go.sum b/go.sum index 8e59eb5035..561faa4083 100644 --- a/go.sum +++ b/go.sum @@ -97,8 +97,6 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -327,7 +325,6 @@ github.com/xenolf/lego v2.7.2+incompatible/go.mod h1:fwiGnfsIjG7OHPfOvgK7Y/Qo6+2 github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= @@ -359,7 +356,6 @@ golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2 golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -368,7 +364,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -377,7 +372,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -389,9 +383,6 @@ golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -400,7 +391,6 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg= golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -415,7 +405,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729173947-1c30660f9f89/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/api/blocks_test.go b/pkg/api/blocks_test.go index badb0212aa..4e421f6818 100644 --- a/pkg/api/blocks_test.go +++ b/pkg/api/blocks_test.go @@ -4,26 +4,22 @@ import ( "encoding/json" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" - "github.com/wavesplatform/gowaves/pkg/mock" "github.com/wavesplatform/gowaves/pkg/proto" "github.com/wavesplatform/gowaves/pkg/services" + "github.com/wavesplatform/gowaves/pkg/state" ) func TestApp_BlocksFirst(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - g := &proto.Block{ BlockHeader: proto.BlockHeader{ BlockSignature: crypto.MustSignatureFromBase58("5uqnLK3Z9eiot6FyYBfwUnbyid3abicQbAZjz38GQ1Q8XigQMxTK4C1zNkqS1SVw7FqSidbZKxWAKLVoEsp4nNqa"), }, } - s := mock.NewMockState(ctrl) + s := state.NewMockState(t) s.EXPECT().BlockByHeight(proto.Height(1)).Return(g, nil) app, err := NewApp("api-key", nil, services.Services{State: s}) @@ -35,10 +31,7 @@ func TestApp_BlocksFirst(t *testing.T) { func TestApp_BlocksLast(t *testing.T) { g := &proto.Block{} - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - s := mock.NewMockState(ctrl) + s := state.NewMockState(t) s.EXPECT().Height().Return(proto.Height(1), nil) s.EXPECT().BlockByHeight(proto.Height(1)).Return(g, nil) diff --git a/pkg/api/node_api_test.go b/pkg/api/node_api_test.go index ce9b55c2c3..5292c55638 100644 --- a/pkg/api/node_api_test.go +++ b/pkg/api/node_api_test.go @@ -9,14 +9,13 @@ import ( "testing" "github.com/go-chi/chi/v5" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" apiErrs "github.com/wavesplatform/gowaves/pkg/api/errors" - "github.com/wavesplatform/gowaves/pkg/mock" "github.com/wavesplatform/gowaves/pkg/proto" "github.com/wavesplatform/gowaves/pkg/services" + "github.com/wavesplatform/gowaves/pkg/state" ) const apiKey = "X-API-Key" @@ -83,8 +82,7 @@ func TestNodeApi_WavesRegularBalanceByAddress(t *testing.T) { addr, err := proto.NewAddressFromString(addrStr) require.NoError(t, err) - ctrl := gomock.NewController(t) - st := mock.NewMockState(ctrl) + st := state.NewMockState(t) st.EXPECT().WavesBalance(proto.NewRecipientFromAddress(addr)).Return(uint64(1000), nil).Times(1) resp := httptest.NewRecorder() @@ -112,13 +110,11 @@ func TestNodeApi_WavesRegularBalanceByAddress(t *testing.T) { t.Run("error", func(t *testing.T) { doTest := func(t *testing.T, addrStr string) { - ctrl := gomock.NewController(t) - resp := httptest.NewRecorder() req := createRequest(addrStr) a, err := NewApp("", nil, services.Services{ - State: mock.NewMockState(ctrl), + State: state.NewMockState(t), Scheme: proto.TestNetScheme, }) require.NoError(t, err) diff --git a/pkg/api/peers_test.go b/pkg/api/peers_test.go index b8a775f0ff..dbe558ffde 100644 --- a/pkg/api/peers_test.go +++ b/pkg/api/peers_test.go @@ -6,22 +6,16 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/wavesplatform/gowaves/pkg/node/peers" "github.com/wavesplatform/gowaves/pkg/node/peers/storage" "github.com/wavesplatform/gowaves/pkg/proto" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/wavesplatform/gowaves/pkg/mock" "github.com/wavesplatform/gowaves/pkg/services" ) func TestApp_PeersKnown(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - peerManager := mock.NewMockPeerManager(ctrl) + peerManager := peers.NewMockPeerManager(t) addr := proto.NewTCPAddr(net.ParseIP("127.0.0.1"), 6868).ToIpPort() peerManager.EXPECT().KnownPeers().Return([]storage.KnownPeer{storage.KnownPeer(addr)}) @@ -34,10 +28,7 @@ func TestApp_PeersKnown(t *testing.T) { } func TestApp_PeersSuspended(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - peerManager := mock.NewMockPeerManager(ctrl) + peerManager := peers.NewMockPeerManager(t) now := time.Now() @@ -76,10 +67,7 @@ func TestApp_PeersSuspended(t *testing.T) { } func TestApp_PeersBlackList(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - peerManager := mock.NewMockPeerManager(ctrl) + peerManager := peers.NewMockPeerManager(t) now := time.Now() diff --git a/pkg/consensus/blocks_validation.go b/pkg/consensus/blocks_validation.go index f48239c9e0..8e93ee2c10 100644 --- a/pkg/consensus/blocks_validation.go +++ b/pkg/consensus/blocks_validation.go @@ -35,7 +35,6 @@ func isInvalidMainNetBlock(blockID proto.BlockID, height uint64) bool { return false } -//go:generate moq -out validator_moq_test.go . stateInfoProvider type stateInfoProvider interface { HeaderByHeight(height uint64) (*proto.BlockHeader, error) NewestHitSourceAtHeight(height uint64) ([]byte, error) diff --git a/pkg/consensus/blocks_validation_internal_test.go b/pkg/consensus/blocks_validation_internal_test.go index 186709db11..e1b830c6cd 100644 --- a/pkg/consensus/blocks_validation_internal_test.go +++ b/pkg/consensus/blocks_validation_internal_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" @@ -56,20 +57,21 @@ func TestValidator_ShouldIncludeNewBlockFieldsOfLightNodeFeature(t *testing.T) { } for i, tt := range tests { t.Run(strconv.Itoa(i+1), func(t *testing.T) { - sip := &stateInfoProviderMock{ - NewestIsActiveAtHeightFunc: func(featureID int16, height uint64) (bool, error) { + m := NewMockstateInfoProvider(t) + m.EXPECT().NewestIsActiveAtHeight(mock.Anything, mock.Anything).RunAndReturn( + func(featureID int16, height uint64) (bool, error) { require.Equal(t, int16(settings.LightNode), featureID) require.Equal(t, tt.blockHeight, height) return tt.lightNodeIsActiveAtHeight, nil - }, - NewestActivationHeightFunc: func(featureID int16) (uint64, error) { + }).Maybe() + m.EXPECT().NewestActivationHeight(mock.Anything).RunAndReturn( + func(featureID int16) (uint64, error) { require.Equal(t, int16(settings.LightNode), featureID) return tt.lightNodeActivationHeight, nil - }, - } - sets := settings.MustTestNetSettings() // copy of testnet settings + }).Maybe() + sets := settings.MustTestNetSettings() // copy of Testnet settings sets.LightNodeBlockFieldsAbsenceInterval = tt.lightNodeBlockFieldsAbsenceInterval - v := NewValidator(sip, sets, timeMock{}) + v := NewValidator(m, sets, timeMock{}) result, err := v.ShouldIncludeNewBlockFieldsOfLightNodeFeature(tt.blockHeight) require.NoError(t, err) assert.Equal(t, tt.expectedResult, result) @@ -165,18 +167,19 @@ func TestValidator_validateLightNodeBlockFields(t *testing.T) { } for i, tt := range tests { t.Run(strconv.Itoa(i+1), func(t *testing.T) { - sip := &stateInfoProviderMock{ - NewestIsActiveAtHeightFunc: func(featureID int16, height uint64) (bool, error) { + sip := NewMockstateInfoProvider(t) + sip.EXPECT().NewestIsActiveAtHeight(mock.Anything, mock.Anything).RunAndReturn( + func(featureID int16, height uint64) (bool, error) { require.Equal(t, int16(settings.LightNode), featureID) require.Equal(t, tt.blockHeight, height) return tt.lightNodeIsActiveAtHeight, nil - }, - NewestActivationHeightFunc: func(featureID int16) (uint64, error) { + }).Maybe() + sip.EXPECT().NewestActivationHeight(mock.Anything).RunAndReturn( + func(featureID int16) (uint64, error) { require.Equal(t, int16(settings.LightNode), featureID) return tt.lightNodeActivationHeight, nil - }, - } - sets := settings.MustTestNetSettings() // copy of testnet settings + }).Maybe() + sets := settings.MustTestNetSettings() // copy of Testnet settings sets.LightNodeBlockFieldsAbsenceInterval = tt.lightNodeBlockFieldsAbsenceInterval v := NewValidator(sip, sets, timeMock{}) err := v.validateLightNodeBlockFields(&tt.blockHeader, tt.blockHeight) diff --git a/pkg/consensus/mock_state_info_provider_test.go b/pkg/consensus/mock_state_info_provider_test.go new file mode 100644 index 0000000000..30015f85c7 --- /dev/null +++ b/pkg/consensus/mock_state_info_provider_test.go @@ -0,0 +1,413 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package consensus + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/proto" +) + +// NewMockstateInfoProvider creates a new instance of MockstateInfoProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockstateInfoProvider(t interface { + mock.TestingT + Cleanup(func()) +}) *MockstateInfoProvider { + mock := &MockstateInfoProvider{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockstateInfoProvider is an autogenerated mock type for the stateInfoProvider type +type MockstateInfoProvider struct { + mock.Mock +} + +type MockstateInfoProvider_Expecter struct { + mock *mock.Mock +} + +func (_m *MockstateInfoProvider) EXPECT() *MockstateInfoProvider_Expecter { + return &MockstateInfoProvider_Expecter{mock: &_m.Mock} +} + +// HeaderByHeight provides a mock function for the type MockstateInfoProvider +func (_mock *MockstateInfoProvider) HeaderByHeight(height uint64) (*proto.BlockHeader, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for HeaderByHeight") + } + + var r0 *proto.BlockHeader + var r1 error + if returnFunc, ok := ret.Get(0).(func(uint64) (*proto.BlockHeader, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(uint64) *proto.BlockHeader); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BlockHeader) + } + } + if returnFunc, ok := ret.Get(1).(func(uint64) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockstateInfoProvider_HeaderByHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeaderByHeight' +type MockstateInfoProvider_HeaderByHeight_Call struct { + *mock.Call +} + +// HeaderByHeight is a helper method to define mock.On call +// - height uint64 +func (_e *MockstateInfoProvider_Expecter) HeaderByHeight(height interface{}) *MockstateInfoProvider_HeaderByHeight_Call { + return &MockstateInfoProvider_HeaderByHeight_Call{Call: _e.mock.On("HeaderByHeight", height)} +} + +func (_c *MockstateInfoProvider_HeaderByHeight_Call) Run(run func(height uint64)) *MockstateInfoProvider_HeaderByHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 uint64 + if args[0] != nil { + arg0 = args[0].(uint64) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockstateInfoProvider_HeaderByHeight_Call) Return(blockHeader *proto.BlockHeader, err error) *MockstateInfoProvider_HeaderByHeight_Call { + _c.Call.Return(blockHeader, err) + return _c +} + +func (_c *MockstateInfoProvider_HeaderByHeight_Call) RunAndReturn(run func(height uint64) (*proto.BlockHeader, error)) *MockstateInfoProvider_HeaderByHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewestAccountHasScript provides a mock function for the type MockstateInfoProvider +func (_mock *MockstateInfoProvider) NewestAccountHasScript(addr proto.WavesAddress) (bool, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for NewestAccountHasScript") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (bool, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) bool); ok { + r0 = returnFunc(addr) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockstateInfoProvider_NewestAccountHasScript_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAccountHasScript' +type MockstateInfoProvider_NewestAccountHasScript_Call struct { + *mock.Call +} + +// NewestAccountHasScript is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockstateInfoProvider_Expecter) NewestAccountHasScript(addr interface{}) *MockstateInfoProvider_NewestAccountHasScript_Call { + return &MockstateInfoProvider_NewestAccountHasScript_Call{Call: _e.mock.On("NewestAccountHasScript", addr)} +} + +func (_c *MockstateInfoProvider_NewestAccountHasScript_Call) Run(run func(addr proto.WavesAddress)) *MockstateInfoProvider_NewestAccountHasScript_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockstateInfoProvider_NewestAccountHasScript_Call) Return(b bool, err error) *MockstateInfoProvider_NewestAccountHasScript_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockstateInfoProvider_NewestAccountHasScript_Call) RunAndReturn(run func(addr proto.WavesAddress) (bool, error)) *MockstateInfoProvider_NewestAccountHasScript_Call { + _c.Call.Return(run) + return _c +} + +// NewestActivationHeight provides a mock function for the type MockstateInfoProvider +func (_mock *MockstateInfoProvider) NewestActivationHeight(featureID int16) (uint64, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for NewestActivationHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (uint64, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) uint64); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockstateInfoProvider_NewestActivationHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestActivationHeight' +type MockstateInfoProvider_NewestActivationHeight_Call struct { + *mock.Call +} + +// NewestActivationHeight is a helper method to define mock.On call +// - featureID int16 +func (_e *MockstateInfoProvider_Expecter) NewestActivationHeight(featureID interface{}) *MockstateInfoProvider_NewestActivationHeight_Call { + return &MockstateInfoProvider_NewestActivationHeight_Call{Call: _e.mock.On("NewestActivationHeight", featureID)} +} + +func (_c *MockstateInfoProvider_NewestActivationHeight_Call) Run(run func(featureID int16)) *MockstateInfoProvider_NewestActivationHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockstateInfoProvider_NewestActivationHeight_Call) Return(v uint64, err error) *MockstateInfoProvider_NewestActivationHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockstateInfoProvider_NewestActivationHeight_Call) RunAndReturn(run func(featureID int16) (uint64, error)) *MockstateInfoProvider_NewestActivationHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewestHitSourceAtHeight provides a mock function for the type MockstateInfoProvider +func (_mock *MockstateInfoProvider) NewestHitSourceAtHeight(height uint64) ([]byte, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for NewestHitSourceAtHeight") + } + + var r0 []byte + var r1 error + if returnFunc, ok := ret.Get(0).(func(uint64) ([]byte, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(uint64) []byte); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + if returnFunc, ok := ret.Get(1).(func(uint64) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockstateInfoProvider_NewestHitSourceAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestHitSourceAtHeight' +type MockstateInfoProvider_NewestHitSourceAtHeight_Call struct { + *mock.Call +} + +// NewestHitSourceAtHeight is a helper method to define mock.On call +// - height uint64 +func (_e *MockstateInfoProvider_Expecter) NewestHitSourceAtHeight(height interface{}) *MockstateInfoProvider_NewestHitSourceAtHeight_Call { + return &MockstateInfoProvider_NewestHitSourceAtHeight_Call{Call: _e.mock.On("NewestHitSourceAtHeight", height)} +} + +func (_c *MockstateInfoProvider_NewestHitSourceAtHeight_Call) Run(run func(height uint64)) *MockstateInfoProvider_NewestHitSourceAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 uint64 + if args[0] != nil { + arg0 = args[0].(uint64) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockstateInfoProvider_NewestHitSourceAtHeight_Call) Return(bytes []byte, err error) *MockstateInfoProvider_NewestHitSourceAtHeight_Call { + _c.Call.Return(bytes, err) + return _c +} + +func (_c *MockstateInfoProvider_NewestHitSourceAtHeight_Call) RunAndReturn(run func(height uint64) ([]byte, error)) *MockstateInfoProvider_NewestHitSourceAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewestIsActiveAtHeight provides a mock function for the type MockstateInfoProvider +func (_mock *MockstateInfoProvider) NewestIsActiveAtHeight(featureID int16, height proto.Height) (bool, error) { + ret := _mock.Called(featureID, height) + + if len(ret) == 0 { + panic("no return value specified for NewestIsActiveAtHeight") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16, proto.Height) (bool, error)); ok { + return returnFunc(featureID, height) + } + if returnFunc, ok := ret.Get(0).(func(int16, proto.Height) bool); ok { + r0 = returnFunc(featureID, height) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16, proto.Height) error); ok { + r1 = returnFunc(featureID, height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockstateInfoProvider_NewestIsActiveAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestIsActiveAtHeight' +type MockstateInfoProvider_NewestIsActiveAtHeight_Call struct { + *mock.Call +} + +// NewestIsActiveAtHeight is a helper method to define mock.On call +// - featureID int16 +// - height proto.Height +func (_e *MockstateInfoProvider_Expecter) NewestIsActiveAtHeight(featureID interface{}, height interface{}) *MockstateInfoProvider_NewestIsActiveAtHeight_Call { + return &MockstateInfoProvider_NewestIsActiveAtHeight_Call{Call: _e.mock.On("NewestIsActiveAtHeight", featureID, height)} +} + +func (_c *MockstateInfoProvider_NewestIsActiveAtHeight_Call) Run(run func(featureID int16, height proto.Height)) *MockstateInfoProvider_NewestIsActiveAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 proto.Height + if args[1] != nil { + arg1 = args[1].(proto.Height) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockstateInfoProvider_NewestIsActiveAtHeight_Call) Return(b bool, err error) *MockstateInfoProvider_NewestIsActiveAtHeight_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockstateInfoProvider_NewestIsActiveAtHeight_Call) RunAndReturn(run func(featureID int16, height proto.Height) (bool, error)) *MockstateInfoProvider_NewestIsActiveAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewestMinerGeneratingBalance provides a mock function for the type MockstateInfoProvider +func (_mock *MockstateInfoProvider) NewestMinerGeneratingBalance(header *proto.BlockHeader, height proto.Height) (uint64, error) { + ret := _mock.Called(header, height) + + if len(ret) == 0 { + panic("no return value specified for NewestMinerGeneratingBalance") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(*proto.BlockHeader, proto.Height) (uint64, error)); ok { + return returnFunc(header, height) + } + if returnFunc, ok := ret.Get(0).(func(*proto.BlockHeader, proto.Height) uint64); ok { + r0 = returnFunc(header, height) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(*proto.BlockHeader, proto.Height) error); ok { + r1 = returnFunc(header, height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockstateInfoProvider_NewestMinerGeneratingBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestMinerGeneratingBalance' +type MockstateInfoProvider_NewestMinerGeneratingBalance_Call struct { + *mock.Call +} + +// NewestMinerGeneratingBalance is a helper method to define mock.On call +// - header *proto.BlockHeader +// - height proto.Height +func (_e *MockstateInfoProvider_Expecter) NewestMinerGeneratingBalance(header interface{}, height interface{}) *MockstateInfoProvider_NewestMinerGeneratingBalance_Call { + return &MockstateInfoProvider_NewestMinerGeneratingBalance_Call{Call: _e.mock.On("NewestMinerGeneratingBalance", header, height)} +} + +func (_c *MockstateInfoProvider_NewestMinerGeneratingBalance_Call) Run(run func(header *proto.BlockHeader, height proto.Height)) *MockstateInfoProvider_NewestMinerGeneratingBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *proto.BlockHeader + if args[0] != nil { + arg0 = args[0].(*proto.BlockHeader) + } + var arg1 proto.Height + if args[1] != nil { + arg1 = args[1].(proto.Height) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockstateInfoProvider_NewestMinerGeneratingBalance_Call) Return(v uint64, err error) *MockstateInfoProvider_NewestMinerGeneratingBalance_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockstateInfoProvider_NewestMinerGeneratingBalance_Call) RunAndReturn(run func(header *proto.BlockHeader, height proto.Height) (uint64, error)) *MockstateInfoProvider_NewestMinerGeneratingBalance_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/consensus/validator_moq_test.go b/pkg/consensus/validator_moq_test.go deleted file mode 100644 index 8605fe03c0..0000000000 --- a/pkg/consensus/validator_moq_test.go +++ /dev/null @@ -1,307 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package consensus - -import ( - "github.com/wavesplatform/gowaves/pkg/proto" - "sync" -) - -// Ensure, that stateInfoProviderMock does implement stateInfoProvider. -// If this is not the case, regenerate this file with moq. -var _ stateInfoProvider = &stateInfoProviderMock{} - -// stateInfoProviderMock is a mock implementation of stateInfoProvider. -// -// func TestSomethingThatUsesstateInfoProvider(t *testing.T) { -// -// // make and configure a mocked stateInfoProvider -// mockedstateInfoProvider := &stateInfoProviderMock{ -// HeaderByHeightFunc: func(height uint64) (*proto.BlockHeader, error) { -// panic("mock out the HeaderByHeight method") -// }, -// NewestAccountHasScriptFunc: func(addr proto.WavesAddress) (bool, error) { -// panic("mock out the NewestAccountHasScript method") -// }, -// NewestActivationHeightFunc: func(featureID int16) (uint64, error) { -// panic("mock out the NewestActivationHeight method") -// }, -// NewestHitSourceAtHeightFunc: func(height uint64) ([]byte, error) { -// panic("mock out the NewestHitSourceAtHeight method") -// }, -// NewestIsActiveAtHeightFunc: func(featureID int16, height uint64) (bool, error) { -// panic("mock out the NewestIsActiveAtHeight method") -// }, -// NewestMinerGeneratingBalanceFunc: func(header *proto.BlockHeader, height uint64) (uint64, error) { -// panic("mock out the NewestMinerGeneratingBalance method") -// }, -// } -// -// // use mockedstateInfoProvider in code that requires stateInfoProvider -// // and then make assertions. -// -// } -type stateInfoProviderMock struct { - // HeaderByHeightFunc mocks the HeaderByHeight method. - HeaderByHeightFunc func(height uint64) (*proto.BlockHeader, error) - - // NewestAccountHasScriptFunc mocks the NewestAccountHasScript method. - NewestAccountHasScriptFunc func(addr proto.WavesAddress) (bool, error) - - // NewestActivationHeightFunc mocks the NewestActivationHeight method. - NewestActivationHeightFunc func(featureID int16) (uint64, error) - - // NewestHitSourceAtHeightFunc mocks the NewestHitSourceAtHeight method. - NewestHitSourceAtHeightFunc func(height uint64) ([]byte, error) - - // NewestIsActiveAtHeightFunc mocks the NewestIsActiveAtHeight method. - NewestIsActiveAtHeightFunc func(featureID int16, height uint64) (bool, error) - - // NewestMinerGeneratingBalanceFunc mocks the NewestMinerGeneratingBalance method. - NewestMinerGeneratingBalanceFunc func(header *proto.BlockHeader, height uint64) (uint64, error) - - // calls tracks calls to the methods. - calls struct { - // HeaderByHeight holds details about calls to the HeaderByHeight method. - HeaderByHeight []struct { - // Height is the height argument value. - Height uint64 - } - // NewestAccountHasScript holds details about calls to the NewestAccountHasScript method. - NewestAccountHasScript []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // NewestActivationHeight holds details about calls to the NewestActivationHeight method. - NewestActivationHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // NewestHitSourceAtHeight holds details about calls to the NewestHitSourceAtHeight method. - NewestHitSourceAtHeight []struct { - // Height is the height argument value. - Height uint64 - } - // NewestIsActiveAtHeight holds details about calls to the NewestIsActiveAtHeight method. - NewestIsActiveAtHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // Height is the height argument value. - Height uint64 - } - // NewestMinerGeneratingBalance holds details about calls to the NewestMinerGeneratingBalance method. - NewestMinerGeneratingBalance []struct { - // Header is the header argument value. - Header *proto.BlockHeader - // Height is the height argument value. - Height uint64 - } - } - lockHeaderByHeight sync.RWMutex - lockNewestAccountHasScript sync.RWMutex - lockNewestActivationHeight sync.RWMutex - lockNewestHitSourceAtHeight sync.RWMutex - lockNewestIsActiveAtHeight sync.RWMutex - lockNewestMinerGeneratingBalance sync.RWMutex -} - -// HeaderByHeight calls HeaderByHeightFunc. -func (mock *stateInfoProviderMock) HeaderByHeight(height uint64) (*proto.BlockHeader, error) { - if mock.HeaderByHeightFunc == nil { - panic("stateInfoProviderMock.HeaderByHeightFunc: method is nil but stateInfoProvider.HeaderByHeight was just called") - } - callInfo := struct { - Height uint64 - }{ - Height: height, - } - mock.lockHeaderByHeight.Lock() - mock.calls.HeaderByHeight = append(mock.calls.HeaderByHeight, callInfo) - mock.lockHeaderByHeight.Unlock() - return mock.HeaderByHeightFunc(height) -} - -// HeaderByHeightCalls gets all the calls that were made to HeaderByHeight. -// Check the length with: -// -// len(mockedstateInfoProvider.HeaderByHeightCalls()) -func (mock *stateInfoProviderMock) HeaderByHeightCalls() []struct { - Height uint64 -} { - var calls []struct { - Height uint64 - } - mock.lockHeaderByHeight.RLock() - calls = mock.calls.HeaderByHeight - mock.lockHeaderByHeight.RUnlock() - return calls -} - -// NewestAccountHasScript calls NewestAccountHasScriptFunc. -func (mock *stateInfoProviderMock) NewestAccountHasScript(addr proto.WavesAddress) (bool, error) { - if mock.NewestAccountHasScriptFunc == nil { - panic("stateInfoProviderMock.NewestAccountHasScriptFunc: method is nil but stateInfoProvider.NewestAccountHasScript was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.lockNewestAccountHasScript.Lock() - mock.calls.NewestAccountHasScript = append(mock.calls.NewestAccountHasScript, callInfo) - mock.lockNewestAccountHasScript.Unlock() - return mock.NewestAccountHasScriptFunc(addr) -} - -// NewestAccountHasScriptCalls gets all the calls that were made to NewestAccountHasScript. -// Check the length with: -// -// len(mockedstateInfoProvider.NewestAccountHasScriptCalls()) -func (mock *stateInfoProviderMock) NewestAccountHasScriptCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.lockNewestAccountHasScript.RLock() - calls = mock.calls.NewestAccountHasScript - mock.lockNewestAccountHasScript.RUnlock() - return calls -} - -// NewestActivationHeight calls NewestActivationHeightFunc. -func (mock *stateInfoProviderMock) NewestActivationHeight(featureID int16) (uint64, error) { - if mock.NewestActivationHeightFunc == nil { - panic("stateInfoProviderMock.NewestActivationHeightFunc: method is nil but stateInfoProvider.NewestActivationHeight was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.lockNewestActivationHeight.Lock() - mock.calls.NewestActivationHeight = append(mock.calls.NewestActivationHeight, callInfo) - mock.lockNewestActivationHeight.Unlock() - return mock.NewestActivationHeightFunc(featureID) -} - -// NewestActivationHeightCalls gets all the calls that were made to NewestActivationHeight. -// Check the length with: -// -// len(mockedstateInfoProvider.NewestActivationHeightCalls()) -func (mock *stateInfoProviderMock) NewestActivationHeightCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.lockNewestActivationHeight.RLock() - calls = mock.calls.NewestActivationHeight - mock.lockNewestActivationHeight.RUnlock() - return calls -} - -// NewestHitSourceAtHeight calls NewestHitSourceAtHeightFunc. -func (mock *stateInfoProviderMock) NewestHitSourceAtHeight(height uint64) ([]byte, error) { - if mock.NewestHitSourceAtHeightFunc == nil { - panic("stateInfoProviderMock.NewestHitSourceAtHeightFunc: method is nil but stateInfoProvider.NewestHitSourceAtHeight was just called") - } - callInfo := struct { - Height uint64 - }{ - Height: height, - } - mock.lockNewestHitSourceAtHeight.Lock() - mock.calls.NewestHitSourceAtHeight = append(mock.calls.NewestHitSourceAtHeight, callInfo) - mock.lockNewestHitSourceAtHeight.Unlock() - return mock.NewestHitSourceAtHeightFunc(height) -} - -// NewestHitSourceAtHeightCalls gets all the calls that were made to NewestHitSourceAtHeight. -// Check the length with: -// -// len(mockedstateInfoProvider.NewestHitSourceAtHeightCalls()) -func (mock *stateInfoProviderMock) NewestHitSourceAtHeightCalls() []struct { - Height uint64 -} { - var calls []struct { - Height uint64 - } - mock.lockNewestHitSourceAtHeight.RLock() - calls = mock.calls.NewestHitSourceAtHeight - mock.lockNewestHitSourceAtHeight.RUnlock() - return calls -} - -// NewestIsActiveAtHeight calls NewestIsActiveAtHeightFunc. -func (mock *stateInfoProviderMock) NewestIsActiveAtHeight(featureID int16, height uint64) (bool, error) { - if mock.NewestIsActiveAtHeightFunc == nil { - panic("stateInfoProviderMock.NewestIsActiveAtHeightFunc: method is nil but stateInfoProvider.NewestIsActiveAtHeight was just called") - } - callInfo := struct { - FeatureID int16 - Height uint64 - }{ - FeatureID: featureID, - Height: height, - } - mock.lockNewestIsActiveAtHeight.Lock() - mock.calls.NewestIsActiveAtHeight = append(mock.calls.NewestIsActiveAtHeight, callInfo) - mock.lockNewestIsActiveAtHeight.Unlock() - return mock.NewestIsActiveAtHeightFunc(featureID, height) -} - -// NewestIsActiveAtHeightCalls gets all the calls that were made to NewestIsActiveAtHeight. -// Check the length with: -// -// len(mockedstateInfoProvider.NewestIsActiveAtHeightCalls()) -func (mock *stateInfoProviderMock) NewestIsActiveAtHeightCalls() []struct { - FeatureID int16 - Height uint64 -} { - var calls []struct { - FeatureID int16 - Height uint64 - } - mock.lockNewestIsActiveAtHeight.RLock() - calls = mock.calls.NewestIsActiveAtHeight - mock.lockNewestIsActiveAtHeight.RUnlock() - return calls -} - -// NewestMinerGeneratingBalance calls NewestMinerGeneratingBalanceFunc. -func (mock *stateInfoProviderMock) NewestMinerGeneratingBalance(header *proto.BlockHeader, height uint64) (uint64, error) { - if mock.NewestMinerGeneratingBalanceFunc == nil { - panic("stateInfoProviderMock.NewestMinerGeneratingBalanceFunc: method is nil but stateInfoProvider.NewestMinerGeneratingBalance was just called") - } - callInfo := struct { - Header *proto.BlockHeader - Height uint64 - }{ - Header: header, - Height: height, - } - mock.lockNewestMinerGeneratingBalance.Lock() - mock.calls.NewestMinerGeneratingBalance = append(mock.calls.NewestMinerGeneratingBalance, callInfo) - mock.lockNewestMinerGeneratingBalance.Unlock() - return mock.NewestMinerGeneratingBalanceFunc(header, height) -} - -// NewestMinerGeneratingBalanceCalls gets all the calls that were made to NewestMinerGeneratingBalance. -// Check the length with: -// -// len(mockedstateInfoProvider.NewestMinerGeneratingBalanceCalls()) -func (mock *stateInfoProviderMock) NewestMinerGeneratingBalanceCalls() []struct { - Header *proto.BlockHeader - Height uint64 -} { - var calls []struct { - Header *proto.BlockHeader - Height uint64 - } - mock.lockNewestMinerGeneratingBalance.RLock() - calls = mock.calls.NewestMinerGeneratingBalance - mock.lockNewestMinerGeneratingBalance.RUnlock() - return calls -} diff --git a/pkg/grpc/server/mock_grpc_handlers_test.go b/pkg/grpc/server/mock_grpc_handlers_test.go new file mode 100644 index 0000000000..73079497d7 --- /dev/null +++ b/pkg/grpc/server/mock_grpc_handlers_test.go @@ -0,0 +1,1292 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package server + +import ( + "context" + + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/grpc/generated/waves" + "github.com/wavesplatform/gowaves/pkg/grpc/generated/waves/node/grpc" + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +// NewMockGrpcHandlers creates a new instance of MockGrpcHandlers. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockGrpcHandlers(t interface { + mock.TestingT + Cleanup(func()) +}) *MockGrpcHandlers { + mock := &MockGrpcHandlers{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockGrpcHandlers is an autogenerated mock type for the GrpcHandlers type +type MockGrpcHandlers struct { + mock.Mock +} + +type MockGrpcHandlers_Expecter struct { + mock *mock.Mock +} + +func (_m *MockGrpcHandlers) EXPECT() *MockGrpcHandlers_Expecter { + return &MockGrpcHandlers_Expecter{mock: &_m.Mock} +} + +// Broadcast provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) Broadcast(context1 context.Context, signedTransaction *waves.SignedTransaction) (*waves.SignedTransaction, error) { + ret := _mock.Called(context1, signedTransaction) + + if len(ret) == 0 { + panic("no return value specified for Broadcast") + } + + var r0 *waves.SignedTransaction + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *waves.SignedTransaction) (*waves.SignedTransaction, error)); ok { + return returnFunc(context1, signedTransaction) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *waves.SignedTransaction) *waves.SignedTransaction); ok { + r0 = returnFunc(context1, signedTransaction) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*waves.SignedTransaction) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *waves.SignedTransaction) error); ok { + r1 = returnFunc(context1, signedTransaction) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_Broadcast_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Broadcast' +type MockGrpcHandlers_Broadcast_Call struct { + *mock.Call +} + +// Broadcast is a helper method to define mock.On call +// - context1 context.Context +// - signedTransaction *waves.SignedTransaction +func (_e *MockGrpcHandlers_Expecter) Broadcast(context1 interface{}, signedTransaction interface{}) *MockGrpcHandlers_Broadcast_Call { + return &MockGrpcHandlers_Broadcast_Call{Call: _e.mock.On("Broadcast", context1, signedTransaction)} +} + +func (_c *MockGrpcHandlers_Broadcast_Call) Run(run func(context1 context.Context, signedTransaction *waves.SignedTransaction)) *MockGrpcHandlers_Broadcast_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *waves.SignedTransaction + if args[1] != nil { + arg1 = args[1].(*waves.SignedTransaction) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_Broadcast_Call) Return(signedTransaction1 *waves.SignedTransaction, err error) *MockGrpcHandlers_Broadcast_Call { + _c.Call.Return(signedTransaction1, err) + return _c +} + +func (_c *MockGrpcHandlers_Broadcast_Call) RunAndReturn(run func(context1 context.Context, signedTransaction *waves.SignedTransaction) (*waves.SignedTransaction, error)) *MockGrpcHandlers_Broadcast_Call { + _c.Call.Return(run) + return _c +} + +// GetActivationStatus provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetActivationStatus(context1 context.Context, activationStatusRequest *grpc.ActivationStatusRequest) (*grpc.ActivationStatusResponse, error) { + ret := _mock.Called(context1, activationStatusRequest) + + if len(ret) == 0 { + panic("no return value specified for GetActivationStatus") + } + + var r0 *grpc.ActivationStatusResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.ActivationStatusRequest) (*grpc.ActivationStatusResponse, error)); ok { + return returnFunc(context1, activationStatusRequest) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.ActivationStatusRequest) *grpc.ActivationStatusResponse); ok { + r0 = returnFunc(context1, activationStatusRequest) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*grpc.ActivationStatusResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *grpc.ActivationStatusRequest) error); ok { + r1 = returnFunc(context1, activationStatusRequest) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_GetActivationStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetActivationStatus' +type MockGrpcHandlers_GetActivationStatus_Call struct { + *mock.Call +} + +// GetActivationStatus is a helper method to define mock.On call +// - context1 context.Context +// - activationStatusRequest *grpc.ActivationStatusRequest +func (_e *MockGrpcHandlers_Expecter) GetActivationStatus(context1 interface{}, activationStatusRequest interface{}) *MockGrpcHandlers_GetActivationStatus_Call { + return &MockGrpcHandlers_GetActivationStatus_Call{Call: _e.mock.On("GetActivationStatus", context1, activationStatusRequest)} +} + +func (_c *MockGrpcHandlers_GetActivationStatus_Call) Run(run func(context1 context.Context, activationStatusRequest *grpc.ActivationStatusRequest)) *MockGrpcHandlers_GetActivationStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *grpc.ActivationStatusRequest + if args[1] != nil { + arg1 = args[1].(*grpc.ActivationStatusRequest) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetActivationStatus_Call) Return(activationStatusResponse *grpc.ActivationStatusResponse, err error) *MockGrpcHandlers_GetActivationStatus_Call { + _c.Call.Return(activationStatusResponse, err) + return _c +} + +func (_c *MockGrpcHandlers_GetActivationStatus_Call) RunAndReturn(run func(context1 context.Context, activationStatusRequest *grpc.ActivationStatusRequest) (*grpc.ActivationStatusResponse, error)) *MockGrpcHandlers_GetActivationStatus_Call { + _c.Call.Return(run) + return _c +} + +// GetActiveLeases provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetActiveLeases(accountRequest *grpc.AccountRequest, accountsApi_GetActiveLeasesServer grpc.AccountsApi_GetActiveLeasesServer) error { + ret := _mock.Called(accountRequest, accountsApi_GetActiveLeasesServer) + + if len(ret) == 0 { + panic("no return value specified for GetActiveLeases") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.AccountRequest, grpc.AccountsApi_GetActiveLeasesServer) error); ok { + r0 = returnFunc(accountRequest, accountsApi_GetActiveLeasesServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetActiveLeases_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetActiveLeases' +type MockGrpcHandlers_GetActiveLeases_Call struct { + *mock.Call +} + +// GetActiveLeases is a helper method to define mock.On call +// - accountRequest *grpc.AccountRequest +// - accountsApi_GetActiveLeasesServer grpc.AccountsApi_GetActiveLeasesServer +func (_e *MockGrpcHandlers_Expecter) GetActiveLeases(accountRequest interface{}, accountsApi_GetActiveLeasesServer interface{}) *MockGrpcHandlers_GetActiveLeases_Call { + return &MockGrpcHandlers_GetActiveLeases_Call{Call: _e.mock.On("GetActiveLeases", accountRequest, accountsApi_GetActiveLeasesServer)} +} + +func (_c *MockGrpcHandlers_GetActiveLeases_Call) Run(run func(accountRequest *grpc.AccountRequest, accountsApi_GetActiveLeasesServer grpc.AccountsApi_GetActiveLeasesServer)) *MockGrpcHandlers_GetActiveLeases_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.AccountRequest + if args[0] != nil { + arg0 = args[0].(*grpc.AccountRequest) + } + var arg1 grpc.AccountsApi_GetActiveLeasesServer + if args[1] != nil { + arg1 = args[1].(grpc.AccountsApi_GetActiveLeasesServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetActiveLeases_Call) Return(err error) *MockGrpcHandlers_GetActiveLeases_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetActiveLeases_Call) RunAndReturn(run func(accountRequest *grpc.AccountRequest, accountsApi_GetActiveLeasesServer grpc.AccountsApi_GetActiveLeasesServer) error) *MockGrpcHandlers_GetActiveLeases_Call { + _c.Call.Return(run) + return _c +} + +// GetBalances provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetBalances(balancesRequest *grpc.BalancesRequest, accountsApi_GetBalancesServer grpc.AccountsApi_GetBalancesServer) error { + ret := _mock.Called(balancesRequest, accountsApi_GetBalancesServer) + + if len(ret) == 0 { + panic("no return value specified for GetBalances") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.BalancesRequest, grpc.AccountsApi_GetBalancesServer) error); ok { + r0 = returnFunc(balancesRequest, accountsApi_GetBalancesServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetBalances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBalances' +type MockGrpcHandlers_GetBalances_Call struct { + *mock.Call +} + +// GetBalances is a helper method to define mock.On call +// - balancesRequest *grpc.BalancesRequest +// - accountsApi_GetBalancesServer grpc.AccountsApi_GetBalancesServer +func (_e *MockGrpcHandlers_Expecter) GetBalances(balancesRequest interface{}, accountsApi_GetBalancesServer interface{}) *MockGrpcHandlers_GetBalances_Call { + return &MockGrpcHandlers_GetBalances_Call{Call: _e.mock.On("GetBalances", balancesRequest, accountsApi_GetBalancesServer)} +} + +func (_c *MockGrpcHandlers_GetBalances_Call) Run(run func(balancesRequest *grpc.BalancesRequest, accountsApi_GetBalancesServer grpc.AccountsApi_GetBalancesServer)) *MockGrpcHandlers_GetBalances_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.BalancesRequest + if args[0] != nil { + arg0 = args[0].(*grpc.BalancesRequest) + } + var arg1 grpc.AccountsApi_GetBalancesServer + if args[1] != nil { + arg1 = args[1].(grpc.AccountsApi_GetBalancesServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetBalances_Call) Return(err error) *MockGrpcHandlers_GetBalances_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetBalances_Call) RunAndReturn(run func(balancesRequest *grpc.BalancesRequest, accountsApi_GetBalancesServer grpc.AccountsApi_GetBalancesServer) error) *MockGrpcHandlers_GetBalances_Call { + _c.Call.Return(run) + return _c +} + +// GetBaseTarget provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetBaseTarget(context1 context.Context, empty *emptypb.Empty) (*grpc.BaseTargetResponse, error) { + ret := _mock.Called(context1, empty) + + if len(ret) == 0 { + panic("no return value specified for GetBaseTarget") + } + + var r0 *grpc.BaseTargetResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *emptypb.Empty) (*grpc.BaseTargetResponse, error)); ok { + return returnFunc(context1, empty) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *emptypb.Empty) *grpc.BaseTargetResponse); ok { + r0 = returnFunc(context1, empty) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*grpc.BaseTargetResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *emptypb.Empty) error); ok { + r1 = returnFunc(context1, empty) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_GetBaseTarget_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBaseTarget' +type MockGrpcHandlers_GetBaseTarget_Call struct { + *mock.Call +} + +// GetBaseTarget is a helper method to define mock.On call +// - context1 context.Context +// - empty *emptypb.Empty +func (_e *MockGrpcHandlers_Expecter) GetBaseTarget(context1 interface{}, empty interface{}) *MockGrpcHandlers_GetBaseTarget_Call { + return &MockGrpcHandlers_GetBaseTarget_Call{Call: _e.mock.On("GetBaseTarget", context1, empty)} +} + +func (_c *MockGrpcHandlers_GetBaseTarget_Call) Run(run func(context1 context.Context, empty *emptypb.Empty)) *MockGrpcHandlers_GetBaseTarget_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *emptypb.Empty + if args[1] != nil { + arg1 = args[1].(*emptypb.Empty) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetBaseTarget_Call) Return(baseTargetResponse *grpc.BaseTargetResponse, err error) *MockGrpcHandlers_GetBaseTarget_Call { + _c.Call.Return(baseTargetResponse, err) + return _c +} + +func (_c *MockGrpcHandlers_GetBaseTarget_Call) RunAndReturn(run func(context1 context.Context, empty *emptypb.Empty) (*grpc.BaseTargetResponse, error)) *MockGrpcHandlers_GetBaseTarget_Call { + _c.Call.Return(run) + return _c +} + +// GetBlock provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetBlock(context1 context.Context, blockRequest *grpc.BlockRequest) (*grpc.BlockWithHeight, error) { + ret := _mock.Called(context1, blockRequest) + + if len(ret) == 0 { + panic("no return value specified for GetBlock") + } + + var r0 *grpc.BlockWithHeight + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.BlockRequest) (*grpc.BlockWithHeight, error)); ok { + return returnFunc(context1, blockRequest) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.BlockRequest) *grpc.BlockWithHeight); ok { + r0 = returnFunc(context1, blockRequest) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*grpc.BlockWithHeight) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *grpc.BlockRequest) error); ok { + r1 = returnFunc(context1, blockRequest) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_GetBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlock' +type MockGrpcHandlers_GetBlock_Call struct { + *mock.Call +} + +// GetBlock is a helper method to define mock.On call +// - context1 context.Context +// - blockRequest *grpc.BlockRequest +func (_e *MockGrpcHandlers_Expecter) GetBlock(context1 interface{}, blockRequest interface{}) *MockGrpcHandlers_GetBlock_Call { + return &MockGrpcHandlers_GetBlock_Call{Call: _e.mock.On("GetBlock", context1, blockRequest)} +} + +func (_c *MockGrpcHandlers_GetBlock_Call) Run(run func(context1 context.Context, blockRequest *grpc.BlockRequest)) *MockGrpcHandlers_GetBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *grpc.BlockRequest + if args[1] != nil { + arg1 = args[1].(*grpc.BlockRequest) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetBlock_Call) Return(blockWithHeight *grpc.BlockWithHeight, err error) *MockGrpcHandlers_GetBlock_Call { + _c.Call.Return(blockWithHeight, err) + return _c +} + +func (_c *MockGrpcHandlers_GetBlock_Call) RunAndReturn(run func(context1 context.Context, blockRequest *grpc.BlockRequest) (*grpc.BlockWithHeight, error)) *MockGrpcHandlers_GetBlock_Call { + _c.Call.Return(run) + return _c +} + +// GetBlockRange provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetBlockRange(blockRangeRequest *grpc.BlockRangeRequest, blocksApi_GetBlockRangeServer grpc.BlocksApi_GetBlockRangeServer) error { + ret := _mock.Called(blockRangeRequest, blocksApi_GetBlockRangeServer) + + if len(ret) == 0 { + panic("no return value specified for GetBlockRange") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.BlockRangeRequest, grpc.BlocksApi_GetBlockRangeServer) error); ok { + r0 = returnFunc(blockRangeRequest, blocksApi_GetBlockRangeServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetBlockRange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlockRange' +type MockGrpcHandlers_GetBlockRange_Call struct { + *mock.Call +} + +// GetBlockRange is a helper method to define mock.On call +// - blockRangeRequest *grpc.BlockRangeRequest +// - blocksApi_GetBlockRangeServer grpc.BlocksApi_GetBlockRangeServer +func (_e *MockGrpcHandlers_Expecter) GetBlockRange(blockRangeRequest interface{}, blocksApi_GetBlockRangeServer interface{}) *MockGrpcHandlers_GetBlockRange_Call { + return &MockGrpcHandlers_GetBlockRange_Call{Call: _e.mock.On("GetBlockRange", blockRangeRequest, blocksApi_GetBlockRangeServer)} +} + +func (_c *MockGrpcHandlers_GetBlockRange_Call) Run(run func(blockRangeRequest *grpc.BlockRangeRequest, blocksApi_GetBlockRangeServer grpc.BlocksApi_GetBlockRangeServer)) *MockGrpcHandlers_GetBlockRange_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.BlockRangeRequest + if args[0] != nil { + arg0 = args[0].(*grpc.BlockRangeRequest) + } + var arg1 grpc.BlocksApi_GetBlockRangeServer + if args[1] != nil { + arg1 = args[1].(grpc.BlocksApi_GetBlockRangeServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetBlockRange_Call) Return(err error) *MockGrpcHandlers_GetBlockRange_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetBlockRange_Call) RunAndReturn(run func(blockRangeRequest *grpc.BlockRangeRequest, blocksApi_GetBlockRangeServer grpc.BlocksApi_GetBlockRangeServer) error) *MockGrpcHandlers_GetBlockRange_Call { + _c.Call.Return(run) + return _c +} + +// GetCumulativeScore provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetCumulativeScore(context1 context.Context, empty *emptypb.Empty) (*grpc.ScoreResponse, error) { + ret := _mock.Called(context1, empty) + + if len(ret) == 0 { + panic("no return value specified for GetCumulativeScore") + } + + var r0 *grpc.ScoreResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *emptypb.Empty) (*grpc.ScoreResponse, error)); ok { + return returnFunc(context1, empty) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *emptypb.Empty) *grpc.ScoreResponse); ok { + r0 = returnFunc(context1, empty) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*grpc.ScoreResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *emptypb.Empty) error); ok { + r1 = returnFunc(context1, empty) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_GetCumulativeScore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCumulativeScore' +type MockGrpcHandlers_GetCumulativeScore_Call struct { + *mock.Call +} + +// GetCumulativeScore is a helper method to define mock.On call +// - context1 context.Context +// - empty *emptypb.Empty +func (_e *MockGrpcHandlers_Expecter) GetCumulativeScore(context1 interface{}, empty interface{}) *MockGrpcHandlers_GetCumulativeScore_Call { + return &MockGrpcHandlers_GetCumulativeScore_Call{Call: _e.mock.On("GetCumulativeScore", context1, empty)} +} + +func (_c *MockGrpcHandlers_GetCumulativeScore_Call) Run(run func(context1 context.Context, empty *emptypb.Empty)) *MockGrpcHandlers_GetCumulativeScore_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *emptypb.Empty + if args[1] != nil { + arg1 = args[1].(*emptypb.Empty) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetCumulativeScore_Call) Return(scoreResponse *grpc.ScoreResponse, err error) *MockGrpcHandlers_GetCumulativeScore_Call { + _c.Call.Return(scoreResponse, err) + return _c +} + +func (_c *MockGrpcHandlers_GetCumulativeScore_Call) RunAndReturn(run func(context1 context.Context, empty *emptypb.Empty) (*grpc.ScoreResponse, error)) *MockGrpcHandlers_GetCumulativeScore_Call { + _c.Call.Return(run) + return _c +} + +// GetCurrentHeight provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetCurrentHeight(context1 context.Context, empty *emptypb.Empty) (*wrapperspb.UInt32Value, error) { + ret := _mock.Called(context1, empty) + + if len(ret) == 0 { + panic("no return value specified for GetCurrentHeight") + } + + var r0 *wrapperspb.UInt32Value + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *emptypb.Empty) (*wrapperspb.UInt32Value, error)); ok { + return returnFunc(context1, empty) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *emptypb.Empty) *wrapperspb.UInt32Value); ok { + r0 = returnFunc(context1, empty) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*wrapperspb.UInt32Value) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *emptypb.Empty) error); ok { + r1 = returnFunc(context1, empty) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_GetCurrentHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCurrentHeight' +type MockGrpcHandlers_GetCurrentHeight_Call struct { + *mock.Call +} + +// GetCurrentHeight is a helper method to define mock.On call +// - context1 context.Context +// - empty *emptypb.Empty +func (_e *MockGrpcHandlers_Expecter) GetCurrentHeight(context1 interface{}, empty interface{}) *MockGrpcHandlers_GetCurrentHeight_Call { + return &MockGrpcHandlers_GetCurrentHeight_Call{Call: _e.mock.On("GetCurrentHeight", context1, empty)} +} + +func (_c *MockGrpcHandlers_GetCurrentHeight_Call) Run(run func(context1 context.Context, empty *emptypb.Empty)) *MockGrpcHandlers_GetCurrentHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *emptypb.Empty + if args[1] != nil { + arg1 = args[1].(*emptypb.Empty) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetCurrentHeight_Call) Return(uInt32Value *wrapperspb.UInt32Value, err error) *MockGrpcHandlers_GetCurrentHeight_Call { + _c.Call.Return(uInt32Value, err) + return _c +} + +func (_c *MockGrpcHandlers_GetCurrentHeight_Call) RunAndReturn(run func(context1 context.Context, empty *emptypb.Empty) (*wrapperspb.UInt32Value, error)) *MockGrpcHandlers_GetCurrentHeight_Call { + _c.Call.Return(run) + return _c +} + +// GetDataEntries provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetDataEntries(dataRequest *grpc.DataRequest, accountsApi_GetDataEntriesServer grpc.AccountsApi_GetDataEntriesServer) error { + ret := _mock.Called(dataRequest, accountsApi_GetDataEntriesServer) + + if len(ret) == 0 { + panic("no return value specified for GetDataEntries") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.DataRequest, grpc.AccountsApi_GetDataEntriesServer) error); ok { + r0 = returnFunc(dataRequest, accountsApi_GetDataEntriesServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetDataEntries_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDataEntries' +type MockGrpcHandlers_GetDataEntries_Call struct { + *mock.Call +} + +// GetDataEntries is a helper method to define mock.On call +// - dataRequest *grpc.DataRequest +// - accountsApi_GetDataEntriesServer grpc.AccountsApi_GetDataEntriesServer +func (_e *MockGrpcHandlers_Expecter) GetDataEntries(dataRequest interface{}, accountsApi_GetDataEntriesServer interface{}) *MockGrpcHandlers_GetDataEntries_Call { + return &MockGrpcHandlers_GetDataEntries_Call{Call: _e.mock.On("GetDataEntries", dataRequest, accountsApi_GetDataEntriesServer)} +} + +func (_c *MockGrpcHandlers_GetDataEntries_Call) Run(run func(dataRequest *grpc.DataRequest, accountsApi_GetDataEntriesServer grpc.AccountsApi_GetDataEntriesServer)) *MockGrpcHandlers_GetDataEntries_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.DataRequest + if args[0] != nil { + arg0 = args[0].(*grpc.DataRequest) + } + var arg1 grpc.AccountsApi_GetDataEntriesServer + if args[1] != nil { + arg1 = args[1].(grpc.AccountsApi_GetDataEntriesServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetDataEntries_Call) Return(err error) *MockGrpcHandlers_GetDataEntries_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetDataEntries_Call) RunAndReturn(run func(dataRequest *grpc.DataRequest, accountsApi_GetDataEntriesServer grpc.AccountsApi_GetDataEntriesServer) error) *MockGrpcHandlers_GetDataEntries_Call { + _c.Call.Return(run) + return _c +} + +// GetInfo provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetInfo(context1 context.Context, assetRequest *grpc.AssetRequest) (*grpc.AssetInfoResponse, error) { + ret := _mock.Called(context1, assetRequest) + + if len(ret) == 0 { + panic("no return value specified for GetInfo") + } + + var r0 *grpc.AssetInfoResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.AssetRequest) (*grpc.AssetInfoResponse, error)); ok { + return returnFunc(context1, assetRequest) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.AssetRequest) *grpc.AssetInfoResponse); ok { + r0 = returnFunc(context1, assetRequest) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*grpc.AssetInfoResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *grpc.AssetRequest) error); ok { + r1 = returnFunc(context1, assetRequest) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_GetInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInfo' +type MockGrpcHandlers_GetInfo_Call struct { + *mock.Call +} + +// GetInfo is a helper method to define mock.On call +// - context1 context.Context +// - assetRequest *grpc.AssetRequest +func (_e *MockGrpcHandlers_Expecter) GetInfo(context1 interface{}, assetRequest interface{}) *MockGrpcHandlers_GetInfo_Call { + return &MockGrpcHandlers_GetInfo_Call{Call: _e.mock.On("GetInfo", context1, assetRequest)} +} + +func (_c *MockGrpcHandlers_GetInfo_Call) Run(run func(context1 context.Context, assetRequest *grpc.AssetRequest)) *MockGrpcHandlers_GetInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *grpc.AssetRequest + if args[1] != nil { + arg1 = args[1].(*grpc.AssetRequest) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetInfo_Call) Return(assetInfoResponse *grpc.AssetInfoResponse, err error) *MockGrpcHandlers_GetInfo_Call { + _c.Call.Return(assetInfoResponse, err) + return _c +} + +func (_c *MockGrpcHandlers_GetInfo_Call) RunAndReturn(run func(context1 context.Context, assetRequest *grpc.AssetRequest) (*grpc.AssetInfoResponse, error)) *MockGrpcHandlers_GetInfo_Call { + _c.Call.Return(run) + return _c +} + +// GetNFTList provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetNFTList(nFTRequest *grpc.NFTRequest, assetsApi_GetNFTListServer grpc.AssetsApi_GetNFTListServer) error { + ret := _mock.Called(nFTRequest, assetsApi_GetNFTListServer) + + if len(ret) == 0 { + panic("no return value specified for GetNFTList") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.NFTRequest, grpc.AssetsApi_GetNFTListServer) error); ok { + r0 = returnFunc(nFTRequest, assetsApi_GetNFTListServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetNFTList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNFTList' +type MockGrpcHandlers_GetNFTList_Call struct { + *mock.Call +} + +// GetNFTList is a helper method to define mock.On call +// - nFTRequest *grpc.NFTRequest +// - assetsApi_GetNFTListServer grpc.AssetsApi_GetNFTListServer +func (_e *MockGrpcHandlers_Expecter) GetNFTList(nFTRequest interface{}, assetsApi_GetNFTListServer interface{}) *MockGrpcHandlers_GetNFTList_Call { + return &MockGrpcHandlers_GetNFTList_Call{Call: _e.mock.On("GetNFTList", nFTRequest, assetsApi_GetNFTListServer)} +} + +func (_c *MockGrpcHandlers_GetNFTList_Call) Run(run func(nFTRequest *grpc.NFTRequest, assetsApi_GetNFTListServer grpc.AssetsApi_GetNFTListServer)) *MockGrpcHandlers_GetNFTList_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.NFTRequest + if args[0] != nil { + arg0 = args[0].(*grpc.NFTRequest) + } + var arg1 grpc.AssetsApi_GetNFTListServer + if args[1] != nil { + arg1 = args[1].(grpc.AssetsApi_GetNFTListServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetNFTList_Call) Return(err error) *MockGrpcHandlers_GetNFTList_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetNFTList_Call) RunAndReturn(run func(nFTRequest *grpc.NFTRequest, assetsApi_GetNFTListServer grpc.AssetsApi_GetNFTListServer) error) *MockGrpcHandlers_GetNFTList_Call { + _c.Call.Return(run) + return _c +} + +// GetScript provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetScript(context1 context.Context, accountRequest *grpc.AccountRequest) (*grpc.ScriptResponse, error) { + ret := _mock.Called(context1, accountRequest) + + if len(ret) == 0 { + panic("no return value specified for GetScript") + } + + var r0 *grpc.ScriptResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.AccountRequest) (*grpc.ScriptResponse, error)); ok { + return returnFunc(context1, accountRequest) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.AccountRequest) *grpc.ScriptResponse); ok { + r0 = returnFunc(context1, accountRequest) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*grpc.ScriptResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *grpc.AccountRequest) error); ok { + r1 = returnFunc(context1, accountRequest) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_GetScript_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetScript' +type MockGrpcHandlers_GetScript_Call struct { + *mock.Call +} + +// GetScript is a helper method to define mock.On call +// - context1 context.Context +// - accountRequest *grpc.AccountRequest +func (_e *MockGrpcHandlers_Expecter) GetScript(context1 interface{}, accountRequest interface{}) *MockGrpcHandlers_GetScript_Call { + return &MockGrpcHandlers_GetScript_Call{Call: _e.mock.On("GetScript", context1, accountRequest)} +} + +func (_c *MockGrpcHandlers_GetScript_Call) Run(run func(context1 context.Context, accountRequest *grpc.AccountRequest)) *MockGrpcHandlers_GetScript_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *grpc.AccountRequest + if args[1] != nil { + arg1 = args[1].(*grpc.AccountRequest) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetScript_Call) Return(scriptResponse *grpc.ScriptResponse, err error) *MockGrpcHandlers_GetScript_Call { + _c.Call.Return(scriptResponse, err) + return _c +} + +func (_c *MockGrpcHandlers_GetScript_Call) RunAndReturn(run func(context1 context.Context, accountRequest *grpc.AccountRequest) (*grpc.ScriptResponse, error)) *MockGrpcHandlers_GetScript_Call { + _c.Call.Return(run) + return _c +} + +// GetStateChanges provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetStateChanges(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetStateChangesServer grpc.TransactionsApi_GetStateChangesServer) error { + ret := _mock.Called(transactionsRequest, transactionsApi_GetStateChangesServer) + + if len(ret) == 0 { + panic("no return value specified for GetStateChanges") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.TransactionsRequest, grpc.TransactionsApi_GetStateChangesServer) error); ok { + r0 = returnFunc(transactionsRequest, transactionsApi_GetStateChangesServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetStateChanges_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStateChanges' +type MockGrpcHandlers_GetStateChanges_Call struct { + *mock.Call +} + +// GetStateChanges is a helper method to define mock.On call +// - transactionsRequest *grpc.TransactionsRequest +// - transactionsApi_GetStateChangesServer grpc.TransactionsApi_GetStateChangesServer +func (_e *MockGrpcHandlers_Expecter) GetStateChanges(transactionsRequest interface{}, transactionsApi_GetStateChangesServer interface{}) *MockGrpcHandlers_GetStateChanges_Call { + return &MockGrpcHandlers_GetStateChanges_Call{Call: _e.mock.On("GetStateChanges", transactionsRequest, transactionsApi_GetStateChangesServer)} +} + +func (_c *MockGrpcHandlers_GetStateChanges_Call) Run(run func(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetStateChangesServer grpc.TransactionsApi_GetStateChangesServer)) *MockGrpcHandlers_GetStateChanges_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.TransactionsRequest + if args[0] != nil { + arg0 = args[0].(*grpc.TransactionsRequest) + } + var arg1 grpc.TransactionsApi_GetStateChangesServer + if args[1] != nil { + arg1 = args[1].(grpc.TransactionsApi_GetStateChangesServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetStateChanges_Call) Return(err error) *MockGrpcHandlers_GetStateChanges_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetStateChanges_Call) RunAndReturn(run func(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetStateChangesServer grpc.TransactionsApi_GetStateChangesServer) error) *MockGrpcHandlers_GetStateChanges_Call { + _c.Call.Return(run) + return _c +} + +// GetStatuses provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetStatuses(transactionsByIdRequest *grpc.TransactionsByIdRequest, transactionsApi_GetStatusesServer grpc.TransactionsApi_GetStatusesServer) error { + ret := _mock.Called(transactionsByIdRequest, transactionsApi_GetStatusesServer) + + if len(ret) == 0 { + panic("no return value specified for GetStatuses") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.TransactionsByIdRequest, grpc.TransactionsApi_GetStatusesServer) error); ok { + r0 = returnFunc(transactionsByIdRequest, transactionsApi_GetStatusesServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetStatuses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStatuses' +type MockGrpcHandlers_GetStatuses_Call struct { + *mock.Call +} + +// GetStatuses is a helper method to define mock.On call +// - transactionsByIdRequest *grpc.TransactionsByIdRequest +// - transactionsApi_GetStatusesServer grpc.TransactionsApi_GetStatusesServer +func (_e *MockGrpcHandlers_Expecter) GetStatuses(transactionsByIdRequest interface{}, transactionsApi_GetStatusesServer interface{}) *MockGrpcHandlers_GetStatuses_Call { + return &MockGrpcHandlers_GetStatuses_Call{Call: _e.mock.On("GetStatuses", transactionsByIdRequest, transactionsApi_GetStatusesServer)} +} + +func (_c *MockGrpcHandlers_GetStatuses_Call) Run(run func(transactionsByIdRequest *grpc.TransactionsByIdRequest, transactionsApi_GetStatusesServer grpc.TransactionsApi_GetStatusesServer)) *MockGrpcHandlers_GetStatuses_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.TransactionsByIdRequest + if args[0] != nil { + arg0 = args[0].(*grpc.TransactionsByIdRequest) + } + var arg1 grpc.TransactionsApi_GetStatusesServer + if args[1] != nil { + arg1 = args[1].(grpc.TransactionsApi_GetStatusesServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetStatuses_Call) Return(err error) *MockGrpcHandlers_GetStatuses_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetStatuses_Call) RunAndReturn(run func(transactionsByIdRequest *grpc.TransactionsByIdRequest, transactionsApi_GetStatusesServer grpc.TransactionsApi_GetStatusesServer) error) *MockGrpcHandlers_GetStatuses_Call { + _c.Call.Return(run) + return _c +} + +// GetTransactionSnapshots provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetTransactionSnapshots(transactionSnapshotsRequest *grpc.TransactionSnapshotsRequest, transactionsApi_GetTransactionSnapshotsServer grpc.TransactionsApi_GetTransactionSnapshotsServer) error { + ret := _mock.Called(transactionSnapshotsRequest, transactionsApi_GetTransactionSnapshotsServer) + + if len(ret) == 0 { + panic("no return value specified for GetTransactionSnapshots") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.TransactionSnapshotsRequest, grpc.TransactionsApi_GetTransactionSnapshotsServer) error); ok { + r0 = returnFunc(transactionSnapshotsRequest, transactionsApi_GetTransactionSnapshotsServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetTransactionSnapshots_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransactionSnapshots' +type MockGrpcHandlers_GetTransactionSnapshots_Call struct { + *mock.Call +} + +// GetTransactionSnapshots is a helper method to define mock.On call +// - transactionSnapshotsRequest *grpc.TransactionSnapshotsRequest +// - transactionsApi_GetTransactionSnapshotsServer grpc.TransactionsApi_GetTransactionSnapshotsServer +func (_e *MockGrpcHandlers_Expecter) GetTransactionSnapshots(transactionSnapshotsRequest interface{}, transactionsApi_GetTransactionSnapshotsServer interface{}) *MockGrpcHandlers_GetTransactionSnapshots_Call { + return &MockGrpcHandlers_GetTransactionSnapshots_Call{Call: _e.mock.On("GetTransactionSnapshots", transactionSnapshotsRequest, transactionsApi_GetTransactionSnapshotsServer)} +} + +func (_c *MockGrpcHandlers_GetTransactionSnapshots_Call) Run(run func(transactionSnapshotsRequest *grpc.TransactionSnapshotsRequest, transactionsApi_GetTransactionSnapshotsServer grpc.TransactionsApi_GetTransactionSnapshotsServer)) *MockGrpcHandlers_GetTransactionSnapshots_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.TransactionSnapshotsRequest + if args[0] != nil { + arg0 = args[0].(*grpc.TransactionSnapshotsRequest) + } + var arg1 grpc.TransactionsApi_GetTransactionSnapshotsServer + if args[1] != nil { + arg1 = args[1].(grpc.TransactionsApi_GetTransactionSnapshotsServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetTransactionSnapshots_Call) Return(err error) *MockGrpcHandlers_GetTransactionSnapshots_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetTransactionSnapshots_Call) RunAndReturn(run func(transactionSnapshotsRequest *grpc.TransactionSnapshotsRequest, transactionsApi_GetTransactionSnapshotsServer grpc.TransactionsApi_GetTransactionSnapshotsServer) error) *MockGrpcHandlers_GetTransactionSnapshots_Call { + _c.Call.Return(run) + return _c +} + +// GetTransactions provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetTransactions(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetTransactionsServer grpc.TransactionsApi_GetTransactionsServer) error { + ret := _mock.Called(transactionsRequest, transactionsApi_GetTransactionsServer) + + if len(ret) == 0 { + panic("no return value specified for GetTransactions") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.TransactionsRequest, grpc.TransactionsApi_GetTransactionsServer) error); ok { + r0 = returnFunc(transactionsRequest, transactionsApi_GetTransactionsServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetTransactions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransactions' +type MockGrpcHandlers_GetTransactions_Call struct { + *mock.Call +} + +// GetTransactions is a helper method to define mock.On call +// - transactionsRequest *grpc.TransactionsRequest +// - transactionsApi_GetTransactionsServer grpc.TransactionsApi_GetTransactionsServer +func (_e *MockGrpcHandlers_Expecter) GetTransactions(transactionsRequest interface{}, transactionsApi_GetTransactionsServer interface{}) *MockGrpcHandlers_GetTransactions_Call { + return &MockGrpcHandlers_GetTransactions_Call{Call: _e.mock.On("GetTransactions", transactionsRequest, transactionsApi_GetTransactionsServer)} +} + +func (_c *MockGrpcHandlers_GetTransactions_Call) Run(run func(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetTransactionsServer grpc.TransactionsApi_GetTransactionsServer)) *MockGrpcHandlers_GetTransactions_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.TransactionsRequest + if args[0] != nil { + arg0 = args[0].(*grpc.TransactionsRequest) + } + var arg1 grpc.TransactionsApi_GetTransactionsServer + if args[1] != nil { + arg1 = args[1].(grpc.TransactionsApi_GetTransactionsServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetTransactions_Call) Return(err error) *MockGrpcHandlers_GetTransactions_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetTransactions_Call) RunAndReturn(run func(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetTransactionsServer grpc.TransactionsApi_GetTransactionsServer) error) *MockGrpcHandlers_GetTransactions_Call { + _c.Call.Return(run) + return _c +} + +// GetUnconfirmed provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) GetUnconfirmed(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetUnconfirmedServer grpc.TransactionsApi_GetUnconfirmedServer) error { + ret := _mock.Called(transactionsRequest, transactionsApi_GetUnconfirmedServer) + + if len(ret) == 0 { + panic("no return value specified for GetUnconfirmed") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(*grpc.TransactionsRequest, grpc.TransactionsApi_GetUnconfirmedServer) error); ok { + r0 = returnFunc(transactionsRequest, transactionsApi_GetUnconfirmedServer) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockGrpcHandlers_GetUnconfirmed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUnconfirmed' +type MockGrpcHandlers_GetUnconfirmed_Call struct { + *mock.Call +} + +// GetUnconfirmed is a helper method to define mock.On call +// - transactionsRequest *grpc.TransactionsRequest +// - transactionsApi_GetUnconfirmedServer grpc.TransactionsApi_GetUnconfirmedServer +func (_e *MockGrpcHandlers_Expecter) GetUnconfirmed(transactionsRequest interface{}, transactionsApi_GetUnconfirmedServer interface{}) *MockGrpcHandlers_GetUnconfirmed_Call { + return &MockGrpcHandlers_GetUnconfirmed_Call{Call: _e.mock.On("GetUnconfirmed", transactionsRequest, transactionsApi_GetUnconfirmedServer)} +} + +func (_c *MockGrpcHandlers_GetUnconfirmed_Call) Run(run func(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetUnconfirmedServer grpc.TransactionsApi_GetUnconfirmedServer)) *MockGrpcHandlers_GetUnconfirmed_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *grpc.TransactionsRequest + if args[0] != nil { + arg0 = args[0].(*grpc.TransactionsRequest) + } + var arg1 grpc.TransactionsApi_GetUnconfirmedServer + if args[1] != nil { + arg1 = args[1].(grpc.TransactionsApi_GetUnconfirmedServer) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_GetUnconfirmed_Call) Return(err error) *MockGrpcHandlers_GetUnconfirmed_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockGrpcHandlers_GetUnconfirmed_Call) RunAndReturn(run func(transactionsRequest *grpc.TransactionsRequest, transactionsApi_GetUnconfirmedServer grpc.TransactionsApi_GetUnconfirmedServer) error) *MockGrpcHandlers_GetUnconfirmed_Call { + _c.Call.Return(run) + return _c +} + +// ResolveAlias provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) ResolveAlias(context1 context.Context, stringValue *wrapperspb.StringValue) (*wrapperspb.BytesValue, error) { + ret := _mock.Called(context1, stringValue) + + if len(ret) == 0 { + panic("no return value specified for ResolveAlias") + } + + var r0 *wrapperspb.BytesValue + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *wrapperspb.StringValue) (*wrapperspb.BytesValue, error)); ok { + return returnFunc(context1, stringValue) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *wrapperspb.StringValue) *wrapperspb.BytesValue); ok { + r0 = returnFunc(context1, stringValue) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*wrapperspb.BytesValue) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *wrapperspb.StringValue) error); ok { + r1 = returnFunc(context1, stringValue) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_ResolveAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveAlias' +type MockGrpcHandlers_ResolveAlias_Call struct { + *mock.Call +} + +// ResolveAlias is a helper method to define mock.On call +// - context1 context.Context +// - stringValue *wrapperspb.StringValue +func (_e *MockGrpcHandlers_Expecter) ResolveAlias(context1 interface{}, stringValue interface{}) *MockGrpcHandlers_ResolveAlias_Call { + return &MockGrpcHandlers_ResolveAlias_Call{Call: _e.mock.On("ResolveAlias", context1, stringValue)} +} + +func (_c *MockGrpcHandlers_ResolveAlias_Call) Run(run func(context1 context.Context, stringValue *wrapperspb.StringValue)) *MockGrpcHandlers_ResolveAlias_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *wrapperspb.StringValue + if args[1] != nil { + arg1 = args[1].(*wrapperspb.StringValue) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_ResolveAlias_Call) Return(bytesValue *wrapperspb.BytesValue, err error) *MockGrpcHandlers_ResolveAlias_Call { + _c.Call.Return(bytesValue, err) + return _c +} + +func (_c *MockGrpcHandlers_ResolveAlias_Call) RunAndReturn(run func(context1 context.Context, stringValue *wrapperspb.StringValue) (*wrapperspb.BytesValue, error)) *MockGrpcHandlers_ResolveAlias_Call { + _c.Call.Return(run) + return _c +} + +// Sign provides a mock function for the type MockGrpcHandlers +func (_mock *MockGrpcHandlers) Sign(context1 context.Context, signRequest *grpc.SignRequest) (*waves.SignedTransaction, error) { + ret := _mock.Called(context1, signRequest) + + if len(ret) == 0 { + panic("no return value specified for Sign") + } + + var r0 *waves.SignedTransaction + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.SignRequest) (*waves.SignedTransaction, error)); ok { + return returnFunc(context1, signRequest) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *grpc.SignRequest) *waves.SignedTransaction); ok { + r0 = returnFunc(context1, signRequest) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*waves.SignedTransaction) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *grpc.SignRequest) error); ok { + r1 = returnFunc(context1, signRequest) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockGrpcHandlers_Sign_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sign' +type MockGrpcHandlers_Sign_Call struct { + *mock.Call +} + +// Sign is a helper method to define mock.On call +// - context1 context.Context +// - signRequest *grpc.SignRequest +func (_e *MockGrpcHandlers_Expecter) Sign(context1 interface{}, signRequest interface{}) *MockGrpcHandlers_Sign_Call { + return &MockGrpcHandlers_Sign_Call{Call: _e.mock.On("Sign", context1, signRequest)} +} + +func (_c *MockGrpcHandlers_Sign_Call) Run(run func(context1 context.Context, signRequest *grpc.SignRequest)) *MockGrpcHandlers_Sign_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *grpc.SignRequest + if args[1] != nil { + arg1 = args[1].(*grpc.SignRequest) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockGrpcHandlers_Sign_Call) Return(signedTransaction *waves.SignedTransaction, err error) *MockGrpcHandlers_Sign_Call { + _c.Call.Return(signedTransaction, err) + return _c +} + +func (_c *MockGrpcHandlers_Sign_Call) RunAndReturn(run func(context1 context.Context, signRequest *grpc.SignRequest) (*waves.SignedTransaction, error)) *MockGrpcHandlers_Sign_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/grpc/server/transactions_api_test.go b/pkg/grpc/server/transactions_api_test.go index f3bde14cb0..a68178093c 100644 --- a/pkg/grpc/server/transactions_api_test.go +++ b/pkg/grpc/server/transactions_api_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -21,7 +21,6 @@ import ( g "github.com/wavesplatform/gowaves/pkg/grpc/generated/waves/node/grpc" "github.com/wavesplatform/gowaves/pkg/libs/ntptime" "github.com/wavesplatform/gowaves/pkg/miner/utxpool" - "github.com/wavesplatform/gowaves/pkg/mock" "github.com/wavesplatform/gowaves/pkg/proto" "github.com/wavesplatform/gowaves/pkg/settings" ) @@ -284,11 +283,8 @@ func TestSign(t *testing.T) { } func TestBroadcast(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - h := mock.NewMockGrpcHandlers(ctrl) - h.EXPECT().Broadcast(gomock.Any(), gomock.Any()).Return(&pb.SignedTransaction{}, nil) + h := NewMockGrpcHandlers(t) + h.EXPECT().Broadcast(mock.Anything, mock.Anything).Return(&pb.SignedTransaction{}, nil) gRPCServer := createGRPCServerWithHandlers(h) ctx := t.Context() @@ -305,7 +301,10 @@ func TestBroadcast(t *testing.T) { conn, err := grpc.NewClient(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) - defer conn.Close() + defer func() { + clErr := conn.Close() + require.NoError(t, clErr) + }() cl := g.NewTransactionsApiClient(conn) _, err = cl.Broadcast(ctx, &pb.SignedTransaction{}) diff --git a/pkg/miner/internal_test.go b/pkg/miner/internal_test.go index 3a0da44899..c615f6adf5 100644 --- a/pkg/miner/internal_test.go +++ b/pkg/miner/internal_test.go @@ -3,11 +3,10 @@ package miner import ( "testing" - "github.com/golang/mock/gomock" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" - "github.com/wavesplatform/gowaves/pkg/mock" "github.com/wavesplatform/gowaves/pkg/proto" "github.com/wavesplatform/gowaves/pkg/settings" "github.com/wavesplatform/gowaves/pkg/state" @@ -37,7 +36,7 @@ func TestMineBlock(t *testing.T) { require.EqualValues(t, 600000000, b.RewardVote) } t.Run("BeforeLightNode", func(t *testing.T) { - m := mock.NewMockState(gomock.NewController(t)) + m := state.NewMockState(t) m.EXPECT().Height().Return(proto.Height(42), nil).Times(1) m.EXPECT().IsActiveLightNodeNewBlocksFields(proto.Height(43)).Return(false, nil).Times(1) @@ -45,11 +44,11 @@ func TestMineBlock(t *testing.T) { doTest(t, m) }) t.Run("AfterLightNode", func(t *testing.T) { - m := mock.NewMockState(gomock.NewController(t)) + m := state.NewMockState(t) m.EXPECT().Height().Return(proto.Height(42), nil).Times(1) m.EXPECT().IsActiveLightNodeNewBlocksFields(proto.Height(43)).Return(true, nil).Times(1) - m.EXPECT().CreateNextSnapshotHash(gomock.AssignableToTypeOf(&proto.Block{})). + m.EXPECT().CreateNextSnapshotHash(mock.AnythingOfType("*proto.Block")). Return(crypto.MustDigestFromBase58("EijBTmUp8j1VRm8542zBii1BdYHvZ26iDk1hLup8kZTP"), nil).Times(1) doTest(t, m) diff --git a/pkg/miner/scheduler/consensus_test.go b/pkg/miner/scheduler/consensus_test.go index 919b116360..3eb82dbdba 100644 --- a/pkg/miner/scheduler/consensus_test.go +++ b/pkg/miner/scheduler/consensus_test.go @@ -3,22 +3,19 @@ package scheduler import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" - "github.com/wavesplatform/gowaves/pkg/mock" + + "github.com/wavesplatform/gowaves/pkg/node/peers" ) func TestMinerConsensus(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - m := mock.NewMockPeerManager(ctrl) + m := peers.NewMockPeerManager(t) - m.EXPECT().ConnectedCount().Return(1) + m.EXPECT().ConnectedCount().Return(1).Once() a := NewMinerConsensus(m, 1) assert.True(t, a.IsMiningAllowed()) - m.EXPECT().ConnectedCount().Return(0) + m.EXPECT().ConnectedCount().Return(0).Once() a = NewMinerConsensus(m, 1) assert.False(t, a.IsMiningAllowed()) } diff --git a/pkg/miner/utxpool/cleaner.go b/pkg/miner/utxpool/cleaner.go index 7d5f1456ca..586ddf94de 100644 --- a/pkg/miner/utxpool/cleaner.go +++ b/pkg/miner/utxpool/cleaner.go @@ -8,31 +8,25 @@ import ( "github.com/wavesplatform/gowaves/pkg/types" ) +// Cleaner is responsible for validating transactions in the UTX pool and removing invalid ones. type Cleaner struct { - inner BulkValidator - state stateWrapper + validator BulkValidator + state cleanerState } -func NewCleaner(state state.State, pool types.UtxPool, tm types.Time, scheme proto.Scheme) *Cleaner { - return newCleaner(state, newBulkValidator(state, pool, tm, scheme)) -} - -func newCleaner(state stateWrapper, validator BulkValidator) *Cleaner { +func NewCleaner(state cleanerState, pool types.UtxPool, tm types.Time, scheme proto.Scheme) *Cleaner { return &Cleaner{ - state: state, - inner: validator, + validator: newBulkValidator(state, pool, tm, scheme), + state: state, } } func (a *Cleaner) Clean(ctx context.Context) { - a.work(ctx) -} - -func (a *Cleaner) work(ctx context.Context) { - a.inner.Validate(ctx) + a.validator.Validate(ctx) } -type stateWrapper interface { +// cleanerState is an interface that provides necessary methods for the Cleaner to interact with the blockchain state. +type cleanerState interface { TopBlock() *proto.Block TxValidation(func(validation state.TxValidation) error) error } diff --git a/pkg/miner/utxpool/mock.go b/pkg/miner/utxpool/mock.go deleted file mode 100644 index ce2de7874b..0000000000 --- a/pkg/miner/utxpool/mock.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: pkg/miner/utxpool/cleaner.go - -// Package utxpool is a generated GoMock package. -package utxpool - -import ( - reflect "reflect" - - gomock "github.com/golang/mock/gomock" - proto "github.com/wavesplatform/gowaves/pkg/proto" - state "github.com/wavesplatform/gowaves/pkg/state" -) - -// MockstateWrapper is a mock of stateWrapper interface. -type MockstateWrapper struct { - ctrl *gomock.Controller - recorder *MockstateWrapperMockRecorder -} - -// MockstateWrapperMockRecorder is the mock recorder for MockstateWrapper. -type MockstateWrapperMockRecorder struct { - mock *MockstateWrapper -} - -// NewMockstateWrapper creates a new mock instance. -func NewMockstateWrapper(ctrl *gomock.Controller) *MockstateWrapper { - mock := &MockstateWrapper{ctrl: ctrl} - mock.recorder = &MockstateWrapperMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockstateWrapper) EXPECT() *MockstateWrapperMockRecorder { - return m.recorder -} - -// TopBlock mocks base method. -func (m *MockstateWrapper) TopBlock() *proto.Block { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TopBlock") - ret0, _ := ret[0].(*proto.Block) - return ret0 -} - -// TopBlock indicates an expected call of TopBlock. -func (mr *MockstateWrapperMockRecorder) TopBlock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TopBlock", reflect.TypeOf((*MockstateWrapper)(nil).TopBlock)) -} - -// TxValidation mocks base method. -func (m *MockstateWrapper) TxValidation(arg0 func(state.TxValidation) error) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TxValidation", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// TxValidation indicates an expected call of TxValidation. -func (mr *MockstateWrapperMockRecorder) TxValidation(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TxValidation", reflect.TypeOf((*MockstateWrapper)(nil).TxValidation), arg0) -} diff --git a/pkg/miner/utxpool/transaction_bulk_validator.go b/pkg/miner/utxpool/transaction_bulk_validator.go index e0a35d4a58..8cb2424400 100644 --- a/pkg/miner/utxpool/transaction_bulk_validator.go +++ b/pkg/miner/utxpool/transaction_bulk_validator.go @@ -16,13 +16,13 @@ type BulkValidator interface { } type bulkValidator struct { - state stateWrapper + state cleanerState utx types.UtxPool tm types.Time scheme proto.Scheme } -func newBulkValidator(state stateWrapper, utx types.UtxPool, tm types.Time, scheme proto.Scheme) *bulkValidator { +func newBulkValidator(state cleanerState, utx types.UtxPool, tm types.Time, scheme proto.Scheme) *bulkValidator { return &bulkValidator{ state: state, utx: utx, diff --git a/pkg/miner/utxpool/transaction_bulk_validator_test.go b/pkg/miner/utxpool/transaction_bulk_validator_test.go index c619fae57a..b95d1b7ec1 100644 --- a/pkg/miner/utxpool/transaction_bulk_validator_test.go +++ b/pkg/miner/utxpool/transaction_bulk_validator_test.go @@ -5,26 +5,22 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/proto" "github.com/wavesplatform/gowaves/pkg/settings" + "github.com/wavesplatform/gowaves/pkg/state" "github.com/wavesplatform/gowaves/pkg/util/byte_helpers" ) func TestBulkValidator_Validate(t *testing.T) { - - ctrl := gomock.NewController(t) - defer ctrl.Finish() - emptyBlock := &proto.Block{} now := time.Now() - m := NewMockstateWrapper(ctrl) + m := state.NewMockState(t) m.EXPECT().TopBlock().Return(emptyBlock) - m.EXPECT().TxValidation(gomock.Any()). - Return(nil).Times(1) + m.EXPECT().TxValidation(mock.Anything).Return(nil).Times(1) utx := New(10000, NoOpValidator{}, settings.MustMainNetSettings()) require.NoError(t, utx.AddWithBytesRaw(byte_helpers.TransferWithSig.Transaction, byte_helpers.TransferWithSig.TransactionBytes)) diff --git a/pkg/miner/utxpool/transaction_validator_test.go b/pkg/miner/utxpool/transaction_validator_test.go index d948a447d7..f720f79ade 100644 --- a/pkg/miner/utxpool/transaction_validator_test.go +++ b/pkg/miner/utxpool/transaction_validator_test.go @@ -4,10 +4,11 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/state" "github.com/wavesplatform/gowaves/pkg/util/byte_helpers" ) @@ -18,19 +19,16 @@ func (t tm) Now() time.Time { } func TestValidatorImpl_Validate(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - emptyBlock := &proto.Block{} emptyBlock.Timestamp = proto.NewTimestampFromTime(time.Now()) now := time.Now() - m := NewMockstateWrapper(ctrl) + m := state.NewMockState(t) v, err := NewValidator(tm(now), 24*time.Hour) require.NoError(t, err) m.EXPECT().TopBlock().Return(emptyBlock) - m.EXPECT().TxValidation(gomock.Any()).Times(1) + m.EXPECT().TxValidation(mock.Anything).Return(nil).Times(1) err = v.Validate(m, byte_helpers.BurnWithSig.Transaction) require.NoError(t, err) diff --git a/pkg/mock/grpc.go b/pkg/mock/grpc.go deleted file mode 100644 index c8d9c74641..0000000000 --- a/pkg/mock/grpc.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: pkg/grpc/server/api.go - -// Package mock is a generated GoMock package. -package mock - -import ( - context "context" - reflect "reflect" - - gomock "github.com/golang/mock/gomock" - waves "github.com/wavesplatform/gowaves/pkg/grpc/generated/waves" - grpc "github.com/wavesplatform/gowaves/pkg/grpc/generated/waves/node/grpc" - emptypb "google.golang.org/protobuf/types/known/emptypb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" -) - -// MockGrpcHandlers is a mock of GrpcHandlers interface. -type MockGrpcHandlers struct { - ctrl *gomock.Controller - recorder *MockGrpcHandlersMockRecorder -} - -// MockGrpcHandlersMockRecorder is the mock recorder for MockGrpcHandlers. -type MockGrpcHandlersMockRecorder struct { - mock *MockGrpcHandlers -} - -// NewMockGrpcHandlers creates a new mock instance. -func NewMockGrpcHandlers(ctrl *gomock.Controller) *MockGrpcHandlers { - mock := &MockGrpcHandlers{ctrl: ctrl} - mock.recorder = &MockGrpcHandlersMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockGrpcHandlers) EXPECT() *MockGrpcHandlersMockRecorder { - return m.recorder -} - -// Broadcast mocks base method. -func (m *MockGrpcHandlers) Broadcast(arg0 context.Context, arg1 *waves.SignedTransaction) (*waves.SignedTransaction, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Broadcast", arg0, arg1) - ret0, _ := ret[0].(*waves.SignedTransaction) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Broadcast indicates an expected call of Broadcast. -func (mr *MockGrpcHandlersMockRecorder) Broadcast(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Broadcast", reflect.TypeOf((*MockGrpcHandlers)(nil).Broadcast), arg0, arg1) -} - -// GetActivationStatus mocks base method. -func (m *MockGrpcHandlers) GetActivationStatus(arg0 context.Context, arg1 *grpc.ActivationStatusRequest) (*grpc.ActivationStatusResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetActivationStatus", arg0, arg1) - ret0, _ := ret[0].(*grpc.ActivationStatusResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetActivationStatus indicates an expected call of GetActivationStatus. -func (mr *MockGrpcHandlersMockRecorder) GetActivationStatus(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActivationStatus", reflect.TypeOf((*MockGrpcHandlers)(nil).GetActivationStatus), arg0, arg1) -} - -// GetActiveLeases mocks base method. -func (m *MockGrpcHandlers) GetActiveLeases(arg0 *grpc.AccountRequest, arg1 grpc.AccountsApi_GetActiveLeasesServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetActiveLeases", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetActiveLeases indicates an expected call of GetActiveLeases. -func (mr *MockGrpcHandlersMockRecorder) GetActiveLeases(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActiveLeases", reflect.TypeOf((*MockGrpcHandlers)(nil).GetActiveLeases), arg0, arg1) -} - -// GetBalances mocks base method. -func (m *MockGrpcHandlers) GetBalances(arg0 *grpc.BalancesRequest, arg1 grpc.AccountsApi_GetBalancesServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBalances", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetBalances indicates an expected call of GetBalances. -func (mr *MockGrpcHandlersMockRecorder) GetBalances(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalances", reflect.TypeOf((*MockGrpcHandlers)(nil).GetBalances), arg0, arg1) -} - -// GetBaseTarget mocks base method. -func (m *MockGrpcHandlers) GetBaseTarget(arg0 context.Context, arg1 *emptypb.Empty) (*grpc.BaseTargetResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBaseTarget", arg0, arg1) - ret0, _ := ret[0].(*grpc.BaseTargetResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBaseTarget indicates an expected call of GetBaseTarget. -func (mr *MockGrpcHandlersMockRecorder) GetBaseTarget(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBaseTarget", reflect.TypeOf((*MockGrpcHandlers)(nil).GetBaseTarget), arg0, arg1) -} - -// GetBlock mocks base method. -func (m *MockGrpcHandlers) GetBlock(arg0 context.Context, arg1 *grpc.BlockRequest) (*grpc.BlockWithHeight, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlock", arg0, arg1) - ret0, _ := ret[0].(*grpc.BlockWithHeight) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBlock indicates an expected call of GetBlock. -func (mr *MockGrpcHandlersMockRecorder) GetBlock(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*MockGrpcHandlers)(nil).GetBlock), arg0, arg1) -} - -// GetBlockRange mocks base method. -func (m *MockGrpcHandlers) GetBlockRange(arg0 *grpc.BlockRangeRequest, arg1 grpc.BlocksApi_GetBlockRangeServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockRange", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetBlockRange indicates an expected call of GetBlockRange. -func (mr *MockGrpcHandlersMockRecorder) GetBlockRange(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockRange", reflect.TypeOf((*MockGrpcHandlers)(nil).GetBlockRange), arg0, arg1) -} - -// GetCumulativeScore mocks base method. -func (m *MockGrpcHandlers) GetCumulativeScore(arg0 context.Context, arg1 *emptypb.Empty) (*grpc.ScoreResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCumulativeScore", arg0, arg1) - ret0, _ := ret[0].(*grpc.ScoreResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetCumulativeScore indicates an expected call of GetCumulativeScore. -func (mr *MockGrpcHandlersMockRecorder) GetCumulativeScore(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCumulativeScore", reflect.TypeOf((*MockGrpcHandlers)(nil).GetCumulativeScore), arg0, arg1) -} - -// GetCurrentHeight mocks base method. -func (m *MockGrpcHandlers) GetCurrentHeight(arg0 context.Context, arg1 *emptypb.Empty) (*wrapperspb.UInt32Value, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCurrentHeight", arg0, arg1) - ret0, _ := ret[0].(*wrapperspb.UInt32Value) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetCurrentHeight indicates an expected call of GetCurrentHeight. -func (mr *MockGrpcHandlersMockRecorder) GetCurrentHeight(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentHeight", reflect.TypeOf((*MockGrpcHandlers)(nil).GetCurrentHeight), arg0, arg1) -} - -// GetDataEntries mocks base method. -func (m *MockGrpcHandlers) GetDataEntries(arg0 *grpc.DataRequest, arg1 grpc.AccountsApi_GetDataEntriesServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDataEntries", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetDataEntries indicates an expected call of GetDataEntries. -func (mr *MockGrpcHandlersMockRecorder) GetDataEntries(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDataEntries", reflect.TypeOf((*MockGrpcHandlers)(nil).GetDataEntries), arg0, arg1) -} - -// GetInfo mocks base method. -func (m *MockGrpcHandlers) GetInfo(arg0 context.Context, arg1 *grpc.AssetRequest) (*grpc.AssetInfoResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetInfo", arg0, arg1) - ret0, _ := ret[0].(*grpc.AssetInfoResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetInfo indicates an expected call of GetInfo. -func (mr *MockGrpcHandlersMockRecorder) GetInfo(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInfo", reflect.TypeOf((*MockGrpcHandlers)(nil).GetInfo), arg0, arg1) -} - -// GetNFTList mocks base method. -func (m *MockGrpcHandlers) GetNFTList(arg0 *grpc.NFTRequest, arg1 grpc.AssetsApi_GetNFTListServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetNFTList", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetNFTList indicates an expected call of GetNFTList. -func (mr *MockGrpcHandlersMockRecorder) GetNFTList(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNFTList", reflect.TypeOf((*MockGrpcHandlers)(nil).GetNFTList), arg0, arg1) -} - -// GetScript mocks base method. -func (m *MockGrpcHandlers) GetScript(arg0 context.Context, arg1 *grpc.AccountRequest) (*grpc.ScriptResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetScript", arg0, arg1) - ret0, _ := ret[0].(*grpc.ScriptResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetScript indicates an expected call of GetScript. -func (mr *MockGrpcHandlersMockRecorder) GetScript(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScript", reflect.TypeOf((*MockGrpcHandlers)(nil).GetScript), arg0, arg1) -} - -// GetStateChanges mocks base method. -func (m *MockGrpcHandlers) GetStateChanges(arg0 *grpc.TransactionsRequest, arg1 grpc.TransactionsApi_GetStateChangesServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetStateChanges", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetStateChanges indicates an expected call of GetStateChanges. -func (mr *MockGrpcHandlersMockRecorder) GetStateChanges(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStateChanges", reflect.TypeOf((*MockGrpcHandlers)(nil).GetStateChanges), arg0, arg1) -} - -// GetStatuses mocks base method. -func (m *MockGrpcHandlers) GetStatuses(arg0 *grpc.TransactionsByIdRequest, arg1 grpc.TransactionsApi_GetStatusesServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetStatuses", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetStatuses indicates an expected call of GetStatuses. -func (mr *MockGrpcHandlersMockRecorder) GetStatuses(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStatuses", reflect.TypeOf((*MockGrpcHandlers)(nil).GetStatuses), arg0, arg1) -} - -// GetTransactionSnapshots mocks base method. -func (m *MockGrpcHandlers) GetTransactionSnapshots(arg0 *grpc.TransactionSnapshotsRequest, arg1 grpc.TransactionsApi_GetTransactionSnapshotsServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTransactionSnapshots", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetTransactionSnapshots indicates an expected call of GetTransactionSnapshots. -func (mr *MockGrpcHandlersMockRecorder) GetTransactionSnapshots(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactionSnapshots", reflect.TypeOf((*MockGrpcHandlers)(nil).GetTransactionSnapshots), arg0, arg1) -} - -// GetTransactions mocks base method. -func (m *MockGrpcHandlers) GetTransactions(arg0 *grpc.TransactionsRequest, arg1 grpc.TransactionsApi_GetTransactionsServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTransactions", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetTransactions indicates an expected call of GetTransactions. -func (mr *MockGrpcHandlersMockRecorder) GetTransactions(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactions", reflect.TypeOf((*MockGrpcHandlers)(nil).GetTransactions), arg0, arg1) -} - -// GetUnconfirmed mocks base method. -func (m *MockGrpcHandlers) GetUnconfirmed(arg0 *grpc.TransactionsRequest, arg1 grpc.TransactionsApi_GetUnconfirmedServer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUnconfirmed", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetUnconfirmed indicates an expected call of GetUnconfirmed. -func (mr *MockGrpcHandlersMockRecorder) GetUnconfirmed(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUnconfirmed", reflect.TypeOf((*MockGrpcHandlers)(nil).GetUnconfirmed), arg0, arg1) -} - -// ResolveAlias mocks base method. -func (m *MockGrpcHandlers) ResolveAlias(arg0 context.Context, arg1 *wrapperspb.StringValue) (*wrapperspb.BytesValue, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResolveAlias", arg0, arg1) - ret0, _ := ret[0].(*wrapperspb.BytesValue) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ResolveAlias indicates an expected call of ResolveAlias. -func (mr *MockGrpcHandlersMockRecorder) ResolveAlias(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResolveAlias", reflect.TypeOf((*MockGrpcHandlers)(nil).ResolveAlias), arg0, arg1) -} - -// Sign mocks base method. -func (m *MockGrpcHandlers) Sign(arg0 context.Context, arg1 *grpc.SignRequest) (*waves.SignedTransaction, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Sign", arg0, arg1) - ret0, _ := ret[0].(*waves.SignedTransaction) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Sign indicates an expected call of Sign. -func (mr *MockGrpcHandlersMockRecorder) Sign(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sign", reflect.TypeOf((*MockGrpcHandlers)(nil).Sign), arg0, arg1) -} diff --git a/pkg/mock/noop_peer.go b/pkg/mock/noop_peer.go deleted file mode 100644 index 311505b748..0000000000 --- a/pkg/mock/noop_peer.go +++ /dev/null @@ -1,10 +0,0 @@ -package mock - -import "github.com/wavesplatform/gowaves/pkg/proto" - -type NoOpPeer struct { -} - -func (NoOpPeer) SendMessage(proto.Message) { - -} diff --git a/pkg/mock/peer.go b/pkg/mock/peer.go deleted file mode 100644 index ee72b18fb6..0000000000 --- a/pkg/mock/peer.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: pkg/p2p/peer/peer.go - -// Package mock is a generated GoMock package. -package mock - -import ( - reflect "reflect" - - gomock "github.com/golang/mock/gomock" - conn "github.com/wavesplatform/gowaves/pkg/p2p/conn" - peer "github.com/wavesplatform/gowaves/pkg/p2p/peer" - proto "github.com/wavesplatform/gowaves/pkg/proto" -) - -// MockPeer is a mock of Peer interface. -type MockPeer struct { - ctrl *gomock.Controller - recorder *MockPeerMockRecorder -} - -// MockPeerMockRecorder is the mock recorder for MockPeer. -type MockPeerMockRecorder struct { - mock *MockPeer -} - -// NewMockPeer creates a new mock instance. -func NewMockPeer(ctrl *gomock.Controller) *MockPeer { - mock := &MockPeer{ctrl: ctrl} - mock.recorder = &MockPeerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockPeer) EXPECT() *MockPeerMockRecorder { - return m.recorder -} - -// Close mocks base method. -func (m *MockPeer) Close() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close") - ret0, _ := ret[0].(error) - return ret0 -} - -// Close indicates an expected call of Close. -func (mr *MockPeerMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPeer)(nil).Close)) -} - -// Connection mocks base method. -func (m *MockPeer) Connection() conn.Connection { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Connection") - ret0, _ := ret[0].(conn.Connection) - return ret0 -} - -// Connection indicates an expected call of Connection. -func (mr *MockPeerMockRecorder) Connection() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connection", reflect.TypeOf((*MockPeer)(nil).Connection)) -} - -// Direction mocks base method. -func (m *MockPeer) Direction() peer.Direction { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Direction") - ret0, _ := ret[0].(peer.Direction) - return ret0 -} - -// Direction indicates an expected call of Direction. -func (mr *MockPeerMockRecorder) Direction() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Direction", reflect.TypeOf((*MockPeer)(nil).Direction)) -} - -// Equal mocks base method. -func (m *MockPeer) Equal(arg0 peer.Peer) bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Equal", arg0) - ret0, _ := ret[0].(bool) - return ret0 -} - -// Equal indicates an expected call of Equal. -func (mr *MockPeerMockRecorder) Equal(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Equal", reflect.TypeOf((*MockPeer)(nil).Equal), arg0) -} - -// Handshake mocks base method. -func (m *MockPeer) Handshake() proto.Handshake { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Handshake") - ret0, _ := ret[0].(proto.Handshake) - return ret0 -} - -// Handshake indicates an expected call of Handshake. -func (mr *MockPeerMockRecorder) Handshake() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Handshake", reflect.TypeOf((*MockPeer)(nil).Handshake)) -} - -// ID mocks base method. -func (m *MockPeer) ID() peer.ID { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ID") - ret0, _ := ret[0].(peer.ID) - return ret0 -} - -// ID indicates an expected call of ID. -func (mr *MockPeerMockRecorder) ID() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ID", reflect.TypeOf((*MockPeer)(nil).ID)) -} - -// RemoteAddr mocks base method. -func (m *MockPeer) RemoteAddr() proto.TCPAddr { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoteAddr") - ret0, _ := ret[0].(proto.TCPAddr) - return ret0 -} - -// RemoteAddr indicates an expected call of RemoteAddr. -func (mr *MockPeerMockRecorder) RemoteAddr() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoteAddr", reflect.TypeOf((*MockPeer)(nil).RemoteAddr)) -} - -// SendMessage mocks base method. -func (m *MockPeer) SendMessage(arg0 proto.Message) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SendMessage", arg0) -} - -// SendMessage indicates an expected call of SendMessage. -func (mr *MockPeerMockRecorder) SendMessage(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMessage", reflect.TypeOf((*MockPeer)(nil).SendMessage), arg0) -} diff --git a/pkg/mock/peer_manager.go b/pkg/mock/peer_manager.go deleted file mode 100644 index 3c66392f00..0000000000 --- a/pkg/mock/peer_manager.go +++ /dev/null @@ -1,325 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: pkg/node/peers/peer_manager.go - -// Package mock is a generated GoMock package. -package mock - -import ( - context "context" - net "net" - reflect "reflect" - time "time" - - gomock "github.com/golang/mock/gomock" - storage "github.com/wavesplatform/gowaves/pkg/node/peers/storage" - peer "github.com/wavesplatform/gowaves/pkg/p2p/peer" - proto "github.com/wavesplatform/gowaves/pkg/proto" -) - -// MockPeerManager is a mock of PeerManager interface. -type MockPeerManager struct { - ctrl *gomock.Controller - recorder *MockPeerManagerMockRecorder -} - -// MockPeerManagerMockRecorder is the mock recorder for MockPeerManager. -type MockPeerManagerMockRecorder struct { - mock *MockPeerManager -} - -// NewMockPeerManager creates a new mock instance. -func NewMockPeerManager(ctrl *gomock.Controller) *MockPeerManager { - mock := &MockPeerManager{ctrl: ctrl} - mock.recorder = &MockPeerManagerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockPeerManager) EXPECT() *MockPeerManagerMockRecorder { - return m.recorder -} - -// AddToBlackList mocks base method. -func (m *MockPeerManager) AddToBlackList(peer peer.Peer, blockTime time.Time, reason string) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "AddToBlackList", peer, blockTime, reason) -} - -// AddToBlackList indicates an expected call of AddToBlackList. -func (mr *MockPeerManagerMockRecorder) AddToBlackList(peer, blockTime, reason interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddToBlackList", reflect.TypeOf((*MockPeerManager)(nil).AddToBlackList), peer, blockTime, reason) -} - -// AskPeers mocks base method. -func (m *MockPeerManager) AskPeers() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "AskPeers") -} - -// AskPeers indicates an expected call of AskPeers. -func (mr *MockPeerManagerMockRecorder) AskPeers() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AskPeers", reflect.TypeOf((*MockPeerManager)(nil).AskPeers)) -} - -// BlackList mocks base method. -func (m *MockPeerManager) BlackList() []storage.BlackListedPeer { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlackList") - ret0, _ := ret[0].([]storage.BlackListedPeer) - return ret0 -} - -// BlackList indicates an expected call of BlackList. -func (mr *MockPeerManagerMockRecorder) BlackList() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlackList", reflect.TypeOf((*MockPeerManager)(nil).BlackList)) -} - -// CheckPeerInLargestScoreGroup mocks base method. -func (m *MockPeerManager) CheckPeerInLargestScoreGroup(p peer.Peer) (peer.Peer, bool) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CheckPeerInLargestScoreGroup", p) - ret0, _ := ret[0].(peer.Peer) - ret1, _ := ret[1].(bool) - return ret0, ret1 -} - -// CheckPeerInLargestScoreGroup indicates an expected call of CheckPeerInLargestScoreGroup. -func (mr *MockPeerManagerMockRecorder) CheckPeerInLargestScoreGroup(p interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckPeerInLargestScoreGroup", reflect.TypeOf((*MockPeerManager)(nil).CheckPeerInLargestScoreGroup), p) -} - -// CheckPeerWithMaxScore mocks base method. -func (m *MockPeerManager) CheckPeerWithMaxScore(p peer.Peer) (peer.Peer, bool) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CheckPeerWithMaxScore", p) - ret0, _ := ret[0].(peer.Peer) - ret1, _ := ret[1].(bool) - return ret0, ret1 -} - -// CheckPeerWithMaxScore indicates an expected call of CheckPeerWithMaxScore. -func (mr *MockPeerManagerMockRecorder) CheckPeerWithMaxScore(p interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckPeerWithMaxScore", reflect.TypeOf((*MockPeerManager)(nil).CheckPeerWithMaxScore), p) -} - -// ClearBlackList mocks base method. -func (m *MockPeerManager) ClearBlackList() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ClearBlackList") - ret0, _ := ret[0].(error) - return ret0 -} - -// ClearBlackList indicates an expected call of ClearBlackList. -func (mr *MockPeerManagerMockRecorder) ClearBlackList() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClearBlackList", reflect.TypeOf((*MockPeerManager)(nil).ClearBlackList)) -} - -// Close mocks base method. -func (m *MockPeerManager) Close() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close") - ret0, _ := ret[0].(error) - return ret0 -} - -// Close indicates an expected call of Close. -func (mr *MockPeerManagerMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPeerManager)(nil).Close)) -} - -// Connect mocks base method. -func (m *MockPeerManager) Connect(arg0 context.Context, arg1 proto.TCPAddr) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Connect", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Connect indicates an expected call of Connect. -func (mr *MockPeerManagerMockRecorder) Connect(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connect", reflect.TypeOf((*MockPeerManager)(nil).Connect), arg0, arg1) -} - -// ConnectedCount mocks base method. -func (m *MockPeerManager) ConnectedCount() int { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ConnectedCount") - ret0, _ := ret[0].(int) - return ret0 -} - -// ConnectedCount indicates an expected call of ConnectedCount. -func (mr *MockPeerManagerMockRecorder) ConnectedCount() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectedCount", reflect.TypeOf((*MockPeerManager)(nil).ConnectedCount)) -} - -// Disconnect mocks base method. -func (m *MockPeerManager) Disconnect(arg0 peer.Peer) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Disconnect", arg0) -} - -// Disconnect indicates an expected call of Disconnect. -func (mr *MockPeerManagerMockRecorder) Disconnect(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disconnect", reflect.TypeOf((*MockPeerManager)(nil).Disconnect), arg0) -} - -// EachConnected mocks base method. -func (m *MockPeerManager) EachConnected(arg0 func(peer.Peer, *proto.Score)) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "EachConnected", arg0) -} - -// EachConnected indicates an expected call of EachConnected. -func (mr *MockPeerManagerMockRecorder) EachConnected(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EachConnected", reflect.TypeOf((*MockPeerManager)(nil).EachConnected), arg0) -} - -// KnownPeers mocks base method. -func (m *MockPeerManager) KnownPeers() []storage.KnownPeer { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "KnownPeers") - ret0, _ := ret[0].([]storage.KnownPeer) - return ret0 -} - -// KnownPeers indicates an expected call of KnownPeers. -func (mr *MockPeerManagerMockRecorder) KnownPeers() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KnownPeers", reflect.TypeOf((*MockPeerManager)(nil).KnownPeers)) -} - -// NewConnection mocks base method. -func (m *MockPeerManager) NewConnection(arg0 peer.Peer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewConnection", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// NewConnection indicates an expected call of NewConnection. -func (mr *MockPeerManagerMockRecorder) NewConnection(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewConnection", reflect.TypeOf((*MockPeerManager)(nil).NewConnection), arg0) -} - -// Score mocks base method. -func (m *MockPeerManager) Score(p peer.Peer) (*proto.Score, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Score", p) - ret0, _ := ret[0].(*proto.Score) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Score indicates an expected call of Score. -func (mr *MockPeerManagerMockRecorder) Score(p interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Score", reflect.TypeOf((*MockPeerManager)(nil).Score), p) -} - -// SpawnIncomingConnection mocks base method. -func (m *MockPeerManager) SpawnIncomingConnection(ctx context.Context, conn net.Conn) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SpawnIncomingConnection", ctx, conn) - ret0, _ := ret[0].(error) - return ret0 -} - -// SpawnIncomingConnection indicates an expected call of SpawnIncomingConnection. -func (mr *MockPeerManagerMockRecorder) SpawnIncomingConnection(ctx, conn interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpawnIncomingConnection", reflect.TypeOf((*MockPeerManager)(nil).SpawnIncomingConnection), ctx, conn) -} - -// SpawnOutgoingConnections mocks base method. -func (m *MockPeerManager) SpawnOutgoingConnections(arg0 context.Context) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SpawnOutgoingConnections", arg0) -} - -// SpawnOutgoingConnections indicates an expected call of SpawnOutgoingConnections. -func (mr *MockPeerManagerMockRecorder) SpawnOutgoingConnections(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpawnOutgoingConnections", reflect.TypeOf((*MockPeerManager)(nil).SpawnOutgoingConnections), arg0) -} - -// Spawned mocks base method. -func (m *MockPeerManager) Spawned() []proto.IpPort { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Spawned") - ret0, _ := ret[0].([]proto.IpPort) - return ret0 -} - -// Spawned indicates an expected call of Spawned. -func (mr *MockPeerManagerMockRecorder) Spawned() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Spawned", reflect.TypeOf((*MockPeerManager)(nil).Spawned)) -} - -// Suspend mocks base method. -func (m *MockPeerManager) Suspend(peer peer.Peer, suspendTime time.Time, reason string) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Suspend", peer, suspendTime, reason) -} - -// Suspend indicates an expected call of Suspend. -func (mr *MockPeerManagerMockRecorder) Suspend(peer, suspendTime, reason interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Suspend", reflect.TypeOf((*MockPeerManager)(nil).Suspend), peer, suspendTime, reason) -} - -// Suspended mocks base method. -func (m *MockPeerManager) Suspended() []storage.SuspendedPeer { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Suspended") - ret0, _ := ret[0].([]storage.SuspendedPeer) - return ret0 -} - -// Suspended indicates an expected call of Suspended. -func (mr *MockPeerManagerMockRecorder) Suspended() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Suspended", reflect.TypeOf((*MockPeerManager)(nil).Suspended)) -} - -// UpdateKnownPeers mocks base method. -func (m *MockPeerManager) UpdateKnownPeers(arg0 []storage.KnownPeer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateKnownPeers", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// UpdateKnownPeers indicates an expected call of UpdateKnownPeers. -func (mr *MockPeerManagerMockRecorder) UpdateKnownPeers(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateKnownPeers", reflect.TypeOf((*MockPeerManager)(nil).UpdateKnownPeers), arg0) -} - -// UpdateScore mocks base method. -func (m *MockPeerManager) UpdateScore(p peer.Peer, score *proto.Score) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateScore", p, score) - ret0, _ := ret[0].(error) - return ret0 -} - -// UpdateScore indicates an expected call of UpdateScore. -func (mr *MockPeerManagerMockRecorder) UpdateScore(p, score interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateScore", reflect.TypeOf((*MockPeerManager)(nil).UpdateScore), p, score) -} diff --git a/pkg/mock/peer_storage.go b/pkg/mock/peer_storage.go deleted file mode 100644 index 36173b3b44..0000000000 --- a/pkg/mock/peer_storage.go +++ /dev/null @@ -1,302 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: pkg/node/peers/peer_storage.go - -// Package mock is a generated GoMock package. -package mock - -import ( - reflect "reflect" - time "time" - - gomock "github.com/golang/mock/gomock" - storage "github.com/wavesplatform/gowaves/pkg/node/peers/storage" -) - -// MockPeerStorage is a mock of PeerStorage interface. -type MockPeerStorage struct { - ctrl *gomock.Controller - recorder *MockPeerStorageMockRecorder -} - -// MockPeerStorageMockRecorder is the mock recorder for MockPeerStorage. -type MockPeerStorageMockRecorder struct { - mock *MockPeerStorage -} - -// NewMockPeerStorage creates a new mock instance. -func NewMockPeerStorage(ctrl *gomock.Controller) *MockPeerStorage { - mock := &MockPeerStorage{ctrl: ctrl} - mock.recorder = &MockPeerStorageMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockPeerStorage) EXPECT() *MockPeerStorageMockRecorder { - return m.recorder -} - -// AddOrUpdateKnown mocks base method. -func (m *MockPeerStorage) AddOrUpdateKnown(known []storage.KnownPeer, now time.Time) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddOrUpdateKnown", known, now) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddOrUpdateKnown indicates an expected call of AddOrUpdateKnown. -func (mr *MockPeerStorageMockRecorder) AddOrUpdateKnown(known, now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddOrUpdateKnown", reflect.TypeOf((*MockPeerStorage)(nil).AddOrUpdateKnown), known, now) -} - -// AddSuspended mocks base method. -func (m *MockPeerStorage) AddSuspended(suspended []storage.SuspendedPeer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddSuspended", suspended) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddSuspended indicates an expected call of AddSuspended. -func (mr *MockPeerStorageMockRecorder) AddSuspended(suspended interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddSuspended", reflect.TypeOf((*MockPeerStorage)(nil).AddSuspended), suspended) -} - -// AddToBlackList mocks base method. -func (m *MockPeerStorage) AddToBlackList(blackListed []storage.BlackListedPeer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddToBlackList", blackListed) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddToBlackList indicates an expected call of AddToBlackList. -func (mr *MockPeerStorageMockRecorder) AddToBlackList(blackListed interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddToBlackList", reflect.TypeOf((*MockPeerStorage)(nil).AddToBlackList), blackListed) -} - -// BlackList mocks base method. -func (m *MockPeerStorage) BlackList(now time.Time) []storage.BlackListedPeer { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlackList", now) - ret0, _ := ret[0].([]storage.BlackListedPeer) - return ret0 -} - -// BlackList indicates an expected call of BlackList. -func (mr *MockPeerStorageMockRecorder) BlackList(now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlackList", reflect.TypeOf((*MockPeerStorage)(nil).BlackList), now) -} - -// DeleteBlackListedByIP mocks base method. -func (m *MockPeerStorage) DeleteBlackListedByIP(blackListed []storage.BlackListedPeer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteBlackListedByIP", blackListed) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteBlackListedByIP indicates an expected call of DeleteBlackListedByIP. -func (mr *MockPeerStorageMockRecorder) DeleteBlackListedByIP(blackListed interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBlackListedByIP", reflect.TypeOf((*MockPeerStorage)(nil).DeleteBlackListedByIP), blackListed) -} - -// DeleteKnown mocks base method. -func (m *MockPeerStorage) DeleteKnown(known []storage.KnownPeer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteKnown", known) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteKnown indicates an expected call of DeleteKnown. -func (mr *MockPeerStorageMockRecorder) DeleteKnown(known interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteKnown", reflect.TypeOf((*MockPeerStorage)(nil).DeleteKnown), known) -} - -// DeleteSuspendedByIP mocks base method. -func (m *MockPeerStorage) DeleteSuspendedByIP(suspended []storage.SuspendedPeer) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteSuspendedByIP", suspended) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteSuspendedByIP indicates an expected call of DeleteSuspendedByIP. -func (mr *MockPeerStorageMockRecorder) DeleteSuspendedByIP(suspended interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSuspendedByIP", reflect.TypeOf((*MockPeerStorage)(nil).DeleteSuspendedByIP), suspended) -} - -// DropBlackList mocks base method. -func (m *MockPeerStorage) DropBlackList() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DropBlackList") - ret0, _ := ret[0].(error) - return ret0 -} - -// DropBlackList indicates an expected call of DropBlackList. -func (mr *MockPeerStorageMockRecorder) DropBlackList() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropBlackList", reflect.TypeOf((*MockPeerStorage)(nil).DropBlackList)) -} - -// DropKnown mocks base method. -func (m *MockPeerStorage) DropKnown() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DropKnown") - ret0, _ := ret[0].(error) - return ret0 -} - -// DropKnown indicates an expected call of DropKnown. -func (mr *MockPeerStorageMockRecorder) DropKnown() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropKnown", reflect.TypeOf((*MockPeerStorage)(nil).DropKnown)) -} - -// DropStorage mocks base method. -func (m *MockPeerStorage) DropStorage() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DropStorage") - ret0, _ := ret[0].(error) - return ret0 -} - -// DropStorage indicates an expected call of DropStorage. -func (mr *MockPeerStorageMockRecorder) DropStorage() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropStorage", reflect.TypeOf((*MockPeerStorage)(nil).DropStorage)) -} - -// DropSuspended mocks base method. -func (m *MockPeerStorage) DropSuspended() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DropSuspended") - ret0, _ := ret[0].(error) - return ret0 -} - -// DropSuspended indicates an expected call of DropSuspended. -func (mr *MockPeerStorageMockRecorder) DropSuspended() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropSuspended", reflect.TypeOf((*MockPeerStorage)(nil).DropSuspended)) -} - -// IsBlackListedIP mocks base method. -func (m *MockPeerStorage) IsBlackListedIP(ip storage.IP, now time.Time) bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsBlackListedIP", ip, now) - ret0, _ := ret[0].(bool) - return ret0 -} - -// IsBlackListedIP indicates an expected call of IsBlackListedIP. -func (mr *MockPeerStorageMockRecorder) IsBlackListedIP(ip, now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsBlackListedIP", reflect.TypeOf((*MockPeerStorage)(nil).IsBlackListedIP), ip, now) -} - -// IsBlackListedIPs mocks base method. -func (m *MockPeerStorage) IsBlackListedIPs(ips []storage.IP, now time.Time) []bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsBlackListedIPs", ips, now) - ret0, _ := ret[0].([]bool) - return ret0 -} - -// IsBlackListedIPs indicates an expected call of IsBlackListedIPs. -func (mr *MockPeerStorageMockRecorder) IsBlackListedIPs(ips, now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsBlackListedIPs", reflect.TypeOf((*MockPeerStorage)(nil).IsBlackListedIPs), ips, now) -} - -// IsSuspendedIP mocks base method. -func (m *MockPeerStorage) IsSuspendedIP(ip storage.IP, now time.Time) bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsSuspendedIP", ip, now) - ret0, _ := ret[0].(bool) - return ret0 -} - -// IsSuspendedIP indicates an expected call of IsSuspendedIP. -func (mr *MockPeerStorageMockRecorder) IsSuspendedIP(ip, now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSuspendedIP", reflect.TypeOf((*MockPeerStorage)(nil).IsSuspendedIP), ip, now) -} - -// IsSuspendedIPs mocks base method. -func (m *MockPeerStorage) IsSuspendedIPs(ips []storage.IP, now time.Time) []bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsSuspendedIPs", ips, now) - ret0, _ := ret[0].([]bool) - return ret0 -} - -// IsSuspendedIPs indicates an expected call of IsSuspendedIPs. -func (mr *MockPeerStorageMockRecorder) IsSuspendedIPs(ips, now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSuspendedIPs", reflect.TypeOf((*MockPeerStorage)(nil).IsSuspendedIPs), ips, now) -} - -// Known mocks base method. -func (m *MockPeerStorage) Known(limit int) []storage.KnownPeer { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Known", limit) - ret0, _ := ret[0].([]storage.KnownPeer) - return ret0 -} - -// Known indicates an expected call of Known. -func (mr *MockPeerStorageMockRecorder) Known(limit interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Known", reflect.TypeOf((*MockPeerStorage)(nil).Known), limit) -} - -// RefreshBlackList mocks base method. -func (m *MockPeerStorage) RefreshBlackList(now time.Time) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RefreshBlackList", now) - ret0, _ := ret[0].(error) - return ret0 -} - -// RefreshBlackList indicates an expected call of RefreshBlackList. -func (mr *MockPeerStorageMockRecorder) RefreshBlackList(now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RefreshBlackList", reflect.TypeOf((*MockPeerStorage)(nil).RefreshBlackList), now) -} - -// RefreshSuspended mocks base method. -func (m *MockPeerStorage) RefreshSuspended(now time.Time) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RefreshSuspended", now) - ret0, _ := ret[0].(error) - return ret0 -} - -// RefreshSuspended indicates an expected call of RefreshSuspended. -func (mr *MockPeerStorageMockRecorder) RefreshSuspended(now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RefreshSuspended", reflect.TypeOf((*MockPeerStorage)(nil).RefreshSuspended), now) -} - -// Suspended mocks base method. -func (m *MockPeerStorage) Suspended(now time.Time) []storage.SuspendedPeer { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Suspended", now) - ret0, _ := ret[0].([]storage.SuspendedPeer) - return ret0 -} - -// Suspended indicates an expected call of Suspended. -func (mr *MockPeerStorageMockRecorder) Suspended(now interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Suspended", reflect.TypeOf((*MockPeerStorage)(nil).Suspended), now) -} diff --git a/pkg/mock/state.go b/pkg/mock/state.go deleted file mode 100644 index c5e5f76720..0000000000 --- a/pkg/mock/state.go +++ /dev/null @@ -1,2697 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: pkg/state/api.go - -// Package mock is a generated GoMock package. -package mock - -import ( - big "math/big" - reflect "reflect" - - gomock "github.com/golang/mock/gomock" - crypto "github.com/wavesplatform/gowaves/pkg/crypto" - proto "github.com/wavesplatform/gowaves/pkg/proto" - ast "github.com/wavesplatform/gowaves/pkg/ride/ast" - settings "github.com/wavesplatform/gowaves/pkg/settings" - state "github.com/wavesplatform/gowaves/pkg/state" -) - -// MockTransactionIterator is a mock of TransactionIterator interface. -type MockTransactionIterator struct { - ctrl *gomock.Controller - recorder *MockTransactionIteratorMockRecorder -} - -// MockTransactionIteratorMockRecorder is the mock recorder for MockTransactionIterator. -type MockTransactionIteratorMockRecorder struct { - mock *MockTransactionIterator -} - -// NewMockTransactionIterator creates a new mock instance. -func NewMockTransactionIterator(ctrl *gomock.Controller) *MockTransactionIterator { - mock := &MockTransactionIterator{ctrl: ctrl} - mock.recorder = &MockTransactionIteratorMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockTransactionIterator) EXPECT() *MockTransactionIteratorMockRecorder { - return m.recorder -} - -// Error mocks base method. -func (m *MockTransactionIterator) Error() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Error") - ret0, _ := ret[0].(error) - return ret0 -} - -// Error indicates an expected call of Error. -func (mr *MockTransactionIteratorMockRecorder) Error() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Error", reflect.TypeOf((*MockTransactionIterator)(nil).Error)) -} - -// Next mocks base method. -func (m *MockTransactionIterator) Next() bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Next") - ret0, _ := ret[0].(bool) - return ret0 -} - -// Next indicates an expected call of Next. -func (mr *MockTransactionIteratorMockRecorder) Next() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Next", reflect.TypeOf((*MockTransactionIterator)(nil).Next)) -} - -// Release mocks base method. -func (m *MockTransactionIterator) Release() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Release") -} - -// Release indicates an expected call of Release. -func (mr *MockTransactionIteratorMockRecorder) Release() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Release", reflect.TypeOf((*MockTransactionIterator)(nil).Release)) -} - -// Transaction mocks base method. -func (m *MockTransactionIterator) Transaction() (proto.Transaction, proto.TransactionStatus, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Transaction") - ret0, _ := ret[0].(proto.Transaction) - ret1, _ := ret[1].(proto.TransactionStatus) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// Transaction indicates an expected call of Transaction. -func (mr *MockTransactionIteratorMockRecorder) Transaction() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Transaction", reflect.TypeOf((*MockTransactionIterator)(nil).Transaction)) -} - -// MockStateInfo is a mock of StateInfo interface. -type MockStateInfo struct { - ctrl *gomock.Controller - recorder *MockStateInfoMockRecorder -} - -// MockStateInfoMockRecorder is the mock recorder for MockStateInfo. -type MockStateInfoMockRecorder struct { - mock *MockStateInfo -} - -// NewMockStateInfo creates a new mock instance. -func NewMockStateInfo(ctrl *gomock.Controller) *MockStateInfo { - mock := &MockStateInfo{ctrl: ctrl} - mock.recorder = &MockStateInfoMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockStateInfo) EXPECT() *MockStateInfoMockRecorder { - return m.recorder -} - -// ActivationHeight mocks base method. -func (m *MockStateInfo) ActivationHeight(featureID int16) (proto.Height, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ActivationHeight", featureID) - ret0, _ := ret[0].(proto.Height) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ActivationHeight indicates an expected call of ActivationHeight. -func (mr *MockStateInfoMockRecorder) ActivationHeight(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActivationHeight", reflect.TypeOf((*MockStateInfo)(nil).ActivationHeight), featureID) -} - -// AddrByAlias mocks base method. -func (m *MockStateInfo) AddrByAlias(alias proto.Alias) (proto.WavesAddress, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddrByAlias", alias) - ret0, _ := ret[0].(proto.WavesAddress) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddrByAlias indicates an expected call of AddrByAlias. -func (mr *MockStateInfoMockRecorder) AddrByAlias(alias interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddrByAlias", reflect.TypeOf((*MockStateInfo)(nil).AddrByAlias), alias) -} - -// AliasesByAddr mocks base method. -func (m *MockStateInfo) AliasesByAddr(addr proto.WavesAddress) ([]string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AliasesByAddr", addr) - ret0, _ := ret[0].([]string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AliasesByAddr indicates an expected call of AliasesByAddr. -func (mr *MockStateInfoMockRecorder) AliasesByAddr(addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AliasesByAddr", reflect.TypeOf((*MockStateInfo)(nil).AliasesByAddr), addr) -} - -// AllFeatures mocks base method. -func (m *MockStateInfo) AllFeatures() ([]int16, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AllFeatures") - ret0, _ := ret[0].([]int16) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AllFeatures indicates an expected call of AllFeatures. -func (mr *MockStateInfoMockRecorder) AllFeatures() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AllFeatures", reflect.TypeOf((*MockStateInfo)(nil).AllFeatures)) -} - -// ApprovalHeight mocks base method. -func (m *MockStateInfo) ApprovalHeight(featureID int16) (proto.Height, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ApprovalHeight", featureID) - ret0, _ := ret[0].(proto.Height) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ApprovalHeight indicates an expected call of ApprovalHeight. -func (mr *MockStateInfoMockRecorder) ApprovalHeight(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApprovalHeight", reflect.TypeOf((*MockStateInfo)(nil).ApprovalHeight), featureID) -} - -// AssetBalance mocks base method. -func (m *MockStateInfo) AssetBalance(account proto.Recipient, assetID proto.AssetID) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AssetBalance", account, assetID) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AssetBalance indicates an expected call of AssetBalance. -func (mr *MockStateInfoMockRecorder) AssetBalance(account, assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssetBalance", reflect.TypeOf((*MockStateInfo)(nil).AssetBalance), account, assetID) -} - -// AssetInfo mocks base method. -func (m *MockStateInfo) AssetInfo(assetID proto.AssetID) (*proto.AssetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AssetInfo", assetID) - ret0, _ := ret[0].(*proto.AssetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AssetInfo indicates an expected call of AssetInfo. -func (mr *MockStateInfoMockRecorder) AssetInfo(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssetInfo", reflect.TypeOf((*MockStateInfo)(nil).AssetInfo), assetID) -} - -// AssetIsSponsored mocks base method. -func (m *MockStateInfo) AssetIsSponsored(assetID proto.AssetID) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AssetIsSponsored", assetID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AssetIsSponsored indicates an expected call of AssetIsSponsored. -func (mr *MockStateInfoMockRecorder) AssetIsSponsored(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssetIsSponsored", reflect.TypeOf((*MockStateInfo)(nil).AssetIsSponsored), assetID) -} - -// Block mocks base method. -func (m *MockStateInfo) Block(blockID proto.BlockID) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Block", blockID) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Block indicates an expected call of Block. -func (mr *MockStateInfoMockRecorder) Block(blockID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Block", reflect.TypeOf((*MockStateInfo)(nil).Block), blockID) -} - -// BlockByHeight mocks base method. -func (m *MockStateInfo) BlockByHeight(height proto.Height) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockByHeight", height) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockByHeight indicates an expected call of BlockByHeight. -func (mr *MockStateInfoMockRecorder) BlockByHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockByHeight", reflect.TypeOf((*MockStateInfo)(nil).BlockByHeight), height) -} - -// BlockIDToHeight mocks base method. -func (m *MockStateInfo) BlockIDToHeight(blockID proto.BlockID) (proto.Height, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockIDToHeight", blockID) - ret0, _ := ret[0].(proto.Height) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockIDToHeight indicates an expected call of BlockIDToHeight. -func (mr *MockStateInfoMockRecorder) BlockIDToHeight(blockID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockIDToHeight", reflect.TypeOf((*MockStateInfo)(nil).BlockIDToHeight), blockID) -} - -// BlockRewards mocks base method. -func (m *MockStateInfo) BlockRewards(generator proto.WavesAddress, height proto.Height) (proto.Rewards, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockRewards", generator, height) - ret0, _ := ret[0].(proto.Rewards) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockRewards indicates an expected call of BlockRewards. -func (mr *MockStateInfoMockRecorder) BlockRewards(generator, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockRewards", reflect.TypeOf((*MockStateInfo)(nil).BlockRewards), generator, height) -} - -// BlockVRF mocks base method. -func (m *MockStateInfo) BlockVRF(blockHeader *proto.BlockHeader, blockHeight proto.Height) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockVRF", blockHeader, blockHeight) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockVRF indicates an expected call of BlockVRF. -func (mr *MockStateInfoMockRecorder) BlockVRF(blockHeader, blockHeight interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockVRF", reflect.TypeOf((*MockStateInfo)(nil).BlockVRF), blockHeader, blockHeight) -} - -// BlockchainSettings mocks base method. -func (m *MockStateInfo) BlockchainSettings() (*settings.BlockchainSettings, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockchainSettings") - ret0, _ := ret[0].(*settings.BlockchainSettings) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockchainSettings indicates an expected call of BlockchainSettings. -func (mr *MockStateInfoMockRecorder) BlockchainSettings() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockchainSettings", reflect.TypeOf((*MockStateInfo)(nil).BlockchainSettings)) -} - -// CurrentScore mocks base method. -func (m *MockStateInfo) CurrentScore() (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CurrentScore") - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CurrentScore indicates an expected call of CurrentScore. -func (mr *MockStateInfoMockRecorder) CurrentScore() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentScore", reflect.TypeOf((*MockStateInfo)(nil).CurrentScore)) -} - -// EnrichedFullAssetInfo mocks base method. -func (m *MockStateInfo) EnrichedFullAssetInfo(assetID proto.AssetID) (*proto.EnrichedFullAssetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EnrichedFullAssetInfo", assetID) - ret0, _ := ret[0].(*proto.EnrichedFullAssetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// EnrichedFullAssetInfo indicates an expected call of EnrichedFullAssetInfo. -func (mr *MockStateInfoMockRecorder) EnrichedFullAssetInfo(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnrichedFullAssetInfo", reflect.TypeOf((*MockStateInfo)(nil).EnrichedFullAssetInfo), assetID) -} - -// EstimatorVersion mocks base method. -func (m *MockStateInfo) EstimatorVersion() (int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EstimatorVersion") - ret0, _ := ret[0].(int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// EstimatorVersion indicates an expected call of EstimatorVersion. -func (mr *MockStateInfoMockRecorder) EstimatorVersion() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimatorVersion", reflect.TypeOf((*MockStateInfo)(nil).EstimatorVersion)) -} - -// FullAssetInfo mocks base method. -func (m *MockStateInfo) FullAssetInfo(assetID proto.AssetID) (*proto.FullAssetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FullAssetInfo", assetID) - ret0, _ := ret[0].(*proto.FullAssetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// FullAssetInfo indicates an expected call of FullAssetInfo. -func (mr *MockStateInfoMockRecorder) FullAssetInfo(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FullAssetInfo", reflect.TypeOf((*MockStateInfo)(nil).FullAssetInfo), assetID) -} - -// FullWavesBalance mocks base method. -func (m *MockStateInfo) FullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FullWavesBalance", account) - ret0, _ := ret[0].(*proto.FullWavesBalance) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// FullWavesBalance indicates an expected call of FullWavesBalance. -func (mr *MockStateInfoMockRecorder) FullWavesBalance(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FullWavesBalance", reflect.TypeOf((*MockStateInfo)(nil).FullWavesBalance), account) -} - -// GeneratingBalance mocks base method. -func (m *MockStateInfo) GeneratingBalance(account proto.Recipient, height proto.Height) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GeneratingBalance", account, height) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GeneratingBalance indicates an expected call of GeneratingBalance. -func (mr *MockStateInfoMockRecorder) GeneratingBalance(account, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GeneratingBalance", reflect.TypeOf((*MockStateInfo)(nil).GeneratingBalance), account, height) -} - -// Header mocks base method. -func (m *MockStateInfo) Header(blockID proto.BlockID) (*proto.BlockHeader, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Header", blockID) - ret0, _ := ret[0].(*proto.BlockHeader) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Header indicates an expected call of Header. -func (mr *MockStateInfoMockRecorder) Header(blockID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockStateInfo)(nil).Header), blockID) -} - -// HeaderByHeight mocks base method. -func (m *MockStateInfo) HeaderByHeight(height proto.Height) (*proto.BlockHeader, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HeaderByHeight", height) - ret0, _ := ret[0].(*proto.BlockHeader) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HeaderByHeight indicates an expected call of HeaderByHeight. -func (mr *MockStateInfoMockRecorder) HeaderByHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByHeight", reflect.TypeOf((*MockStateInfo)(nil).HeaderByHeight), height) -} - -// Height mocks base method. -func (m *MockStateInfo) Height() (proto.Height, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Height") - ret0, _ := ret[0].(proto.Height) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Height indicates an expected call of Height. -func (mr *MockStateInfoMockRecorder) Height() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Height", reflect.TypeOf((*MockStateInfo)(nil).Height)) -} - -// HeightToBlockID mocks base method. -func (m *MockStateInfo) HeightToBlockID(height proto.Height) (proto.BlockID, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HeightToBlockID", height) - ret0, _ := ret[0].(proto.BlockID) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HeightToBlockID indicates an expected call of HeightToBlockID. -func (mr *MockStateInfoMockRecorder) HeightToBlockID(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeightToBlockID", reflect.TypeOf((*MockStateInfo)(nil).HeightToBlockID), height) -} - -// HitSourceAtHeight mocks base method. -func (m *MockStateInfo) HitSourceAtHeight(height proto.Height) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HitSourceAtHeight", height) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HitSourceAtHeight indicates an expected call of HitSourceAtHeight. -func (mr *MockStateInfoMockRecorder) HitSourceAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HitSourceAtHeight", reflect.TypeOf((*MockStateInfo)(nil).HitSourceAtHeight), height) -} - -// InvokeResultByID mocks base method. -func (m *MockStateInfo) InvokeResultByID(invokeID crypto.Digest) (*proto.ScriptResult, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InvokeResultByID", invokeID) - ret0, _ := ret[0].(*proto.ScriptResult) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// InvokeResultByID indicates an expected call of InvokeResultByID. -func (mr *MockStateInfoMockRecorder) InvokeResultByID(invokeID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InvokeResultByID", reflect.TypeOf((*MockStateInfo)(nil).InvokeResultByID), invokeID) -} - -// IsActivated mocks base method. -func (m *MockStateInfo) IsActivated(featureID int16) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsActivated", featureID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsActivated indicates an expected call of IsActivated. -func (mr *MockStateInfoMockRecorder) IsActivated(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActivated", reflect.TypeOf((*MockStateInfo)(nil).IsActivated), featureID) -} - -// IsActiveAtHeight mocks base method. -func (m *MockStateInfo) IsActiveAtHeight(featureID int16, height proto.Height) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsActiveAtHeight", featureID, height) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsActiveAtHeight indicates an expected call of IsActiveAtHeight. -func (mr *MockStateInfoMockRecorder) IsActiveAtHeight(featureID, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActiveAtHeight", reflect.TypeOf((*MockStateInfo)(nil).IsActiveAtHeight), featureID, height) -} - -// IsActiveLeasing mocks base method. -func (m *MockStateInfo) IsActiveLeasing(leaseID crypto.Digest) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsActiveLeasing", leaseID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsActiveLeasing indicates an expected call of IsActiveLeasing. -func (mr *MockStateInfoMockRecorder) IsActiveLeasing(leaseID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActiveLeasing", reflect.TypeOf((*MockStateInfo)(nil).IsActiveLeasing), leaseID) -} - -// IsActiveLightNodeNewBlocksFields mocks base method. -func (m *MockStateInfo) IsActiveLightNodeNewBlocksFields(blockHeight proto.Height) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsActiveLightNodeNewBlocksFields", blockHeight) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsActiveLightNodeNewBlocksFields indicates an expected call of IsActiveLightNodeNewBlocksFields. -func (mr *MockStateInfoMockRecorder) IsActiveLightNodeNewBlocksFields(blockHeight interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActiveLightNodeNewBlocksFields", reflect.TypeOf((*MockStateInfo)(nil).IsActiveLightNodeNewBlocksFields), blockHeight) -} - -// IsApproved mocks base method. -func (m *MockStateInfo) IsApproved(featureID int16) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsApproved", featureID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsApproved indicates an expected call of IsApproved. -func (mr *MockStateInfoMockRecorder) IsApproved(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsApproved", reflect.TypeOf((*MockStateInfo)(nil).IsApproved), featureID) -} - -// IsApprovedAtHeight mocks base method. -func (m *MockStateInfo) IsApprovedAtHeight(featureID int16, height proto.Height) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsApprovedAtHeight", featureID, height) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsApprovedAtHeight indicates an expected call of IsApprovedAtHeight. -func (mr *MockStateInfoMockRecorder) IsApprovedAtHeight(featureID, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsApprovedAtHeight", reflect.TypeOf((*MockStateInfo)(nil).IsApprovedAtHeight), featureID, height) -} - -// IsAssetExist mocks base method. -func (m *MockStateInfo) IsAssetExist(assetID proto.AssetID) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsAssetExist", assetID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsAssetExist indicates an expected call of IsAssetExist. -func (mr *MockStateInfoMockRecorder) IsAssetExist(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAssetExist", reflect.TypeOf((*MockStateInfo)(nil).IsAssetExist), assetID) -} - -// LegacyStateHashAtHeight mocks base method. -func (m *MockStateInfo) LegacyStateHashAtHeight(height proto.Height) (*proto.StateHash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LegacyStateHashAtHeight", height) - ret0, _ := ret[0].(*proto.StateHash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// LegacyStateHashAtHeight indicates an expected call of LegacyStateHashAtHeight. -func (mr *MockStateInfoMockRecorder) LegacyStateHashAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LegacyStateHashAtHeight", reflect.TypeOf((*MockStateInfo)(nil).LegacyStateHashAtHeight), height) -} - -// MapR mocks base method. -func (m *MockStateInfo) MapR(arg0 func(state.StateInfo) (any, error)) (any, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MapR", arg0) - ret0, _ := ret[0].(any) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// MapR indicates an expected call of MapR. -func (mr *MockStateInfoMockRecorder) MapR(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MapR", reflect.TypeOf((*MockStateInfo)(nil).MapR), arg0) -} - -// NFTList mocks base method. -func (m *MockStateInfo) NFTList(account proto.Recipient, limit uint64, afterAssetID *proto.AssetID) ([]*proto.FullAssetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NFTList", account, limit, afterAssetID) - ret0, _ := ret[0].([]*proto.FullAssetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NFTList indicates an expected call of NFTList. -func (mr *MockStateInfoMockRecorder) NFTList(account, limit, afterAssetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NFTList", reflect.TypeOf((*MockStateInfo)(nil).NFTList), account, limit, afterAssetID) -} - -// NewAddrTransactionsIterator mocks base method. -func (m *MockStateInfo) NewAddrTransactionsIterator(addr proto.Address) (state.TransactionIterator, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewAddrTransactionsIterator", addr) - ret0, _ := ret[0].(state.TransactionIterator) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewAddrTransactionsIterator indicates an expected call of NewAddrTransactionsIterator. -func (mr *MockStateInfoMockRecorder) NewAddrTransactionsIterator(addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAddrTransactionsIterator", reflect.TypeOf((*MockStateInfo)(nil).NewAddrTransactionsIterator), addr) -} - -// NewestBlockInfoByHeight mocks base method. -func (m *MockStateInfo) NewestBlockInfoByHeight(height proto.Height) (*proto.BlockInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewestBlockInfoByHeight", height) - ret0, _ := ret[0].(*proto.BlockInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewestBlockInfoByHeight indicates an expected call of NewestBlockInfoByHeight. -func (mr *MockStateInfoMockRecorder) NewestBlockInfoByHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewestBlockInfoByHeight", reflect.TypeOf((*MockStateInfo)(nil).NewestBlockInfoByHeight), height) -} - -// NewestHeaderByHeight mocks base method. -func (m *MockStateInfo) NewestHeaderByHeight(height uint64) (*proto.BlockHeader, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewestHeaderByHeight", height) - ret0, _ := ret[0].(*proto.BlockHeader) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewestHeaderByHeight indicates an expected call of NewestHeaderByHeight. -func (mr *MockStateInfoMockRecorder) NewestHeaderByHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewestHeaderByHeight", reflect.TypeOf((*MockStateInfo)(nil).NewestHeaderByHeight), height) -} - -// NewestScriptByAccount mocks base method. -func (m *MockStateInfo) NewestScriptByAccount(account proto.Recipient) (*ast.Tree, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewestScriptByAccount", account) - ret0, _ := ret[0].(*ast.Tree) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewestScriptByAccount indicates an expected call of NewestScriptByAccount. -func (mr *MockStateInfoMockRecorder) NewestScriptByAccount(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewestScriptByAccount", reflect.TypeOf((*MockStateInfo)(nil).NewestScriptByAccount), account) -} - -// NewestScriptBytesByAccount mocks base method. -func (m *MockStateInfo) NewestScriptBytesByAccount(account proto.Recipient) (proto.Script, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewestScriptBytesByAccount", account) - ret0, _ := ret[0].(proto.Script) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewestScriptBytesByAccount indicates an expected call of NewestScriptBytesByAccount. -func (mr *MockStateInfoMockRecorder) NewestScriptBytesByAccount(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewestScriptBytesByAccount", reflect.TypeOf((*MockStateInfo)(nil).NewestScriptBytesByAccount), account) -} - -// ProvidesExtendedApi mocks base method. -func (m *MockStateInfo) ProvidesExtendedApi() (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProvidesExtendedApi") - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ProvidesExtendedApi indicates an expected call of ProvidesExtendedApi. -func (mr *MockStateInfoMockRecorder) ProvidesExtendedApi() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProvidesExtendedApi", reflect.TypeOf((*MockStateInfo)(nil).ProvidesExtendedApi)) -} - -// ProvidesStateHashes mocks base method. -func (m *MockStateInfo) ProvidesStateHashes() (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProvidesStateHashes") - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ProvidesStateHashes indicates an expected call of ProvidesStateHashes. -func (mr *MockStateInfoMockRecorder) ProvidesStateHashes() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProvidesStateHashes", reflect.TypeOf((*MockStateInfo)(nil).ProvidesStateHashes)) -} - -// RetrieveBinaryEntry mocks base method. -func (m *MockStateInfo) RetrieveBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveBinaryEntry", account, key) - ret0, _ := ret[0].(*proto.BinaryDataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveBinaryEntry indicates an expected call of RetrieveBinaryEntry. -func (mr *MockStateInfoMockRecorder) RetrieveBinaryEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveBinaryEntry", reflect.TypeOf((*MockStateInfo)(nil).RetrieveBinaryEntry), account, key) -} - -// RetrieveBooleanEntry mocks base method. -func (m *MockStateInfo) RetrieveBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveBooleanEntry", account, key) - ret0, _ := ret[0].(*proto.BooleanDataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveBooleanEntry indicates an expected call of RetrieveBooleanEntry. -func (mr *MockStateInfoMockRecorder) RetrieveBooleanEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveBooleanEntry", reflect.TypeOf((*MockStateInfo)(nil).RetrieveBooleanEntry), account, key) -} - -// RetrieveEntries mocks base method. -func (m *MockStateInfo) RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveEntries", account) - ret0, _ := ret[0].([]proto.DataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveEntries indicates an expected call of RetrieveEntries. -func (mr *MockStateInfoMockRecorder) RetrieveEntries(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveEntries", reflect.TypeOf((*MockStateInfo)(nil).RetrieveEntries), account) -} - -// RetrieveEntry mocks base method. -func (m *MockStateInfo) RetrieveEntry(account proto.Recipient, key string) (proto.DataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveEntry", account, key) - ret0, _ := ret[0].(proto.DataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveEntry indicates an expected call of RetrieveEntry. -func (mr *MockStateInfoMockRecorder) RetrieveEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveEntry", reflect.TypeOf((*MockStateInfo)(nil).RetrieveEntry), account, key) -} - -// RetrieveIntegerEntry mocks base method. -func (m *MockStateInfo) RetrieveIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveIntegerEntry", account, key) - ret0, _ := ret[0].(*proto.IntegerDataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveIntegerEntry indicates an expected call of RetrieveIntegerEntry. -func (mr *MockStateInfoMockRecorder) RetrieveIntegerEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIntegerEntry", reflect.TypeOf((*MockStateInfo)(nil).RetrieveIntegerEntry), account, key) -} - -// RetrieveStringEntry mocks base method. -func (m *MockStateInfo) RetrieveStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveStringEntry", account, key) - ret0, _ := ret[0].(*proto.StringDataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveStringEntry indicates an expected call of RetrieveStringEntry. -func (mr *MockStateInfoMockRecorder) RetrieveStringEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveStringEntry", reflect.TypeOf((*MockStateInfo)(nil).RetrieveStringEntry), account, key) -} - -// RewardAtHeight mocks base method. -func (m *MockStateInfo) RewardAtHeight(height proto.Height) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RewardAtHeight", height) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RewardAtHeight indicates an expected call of RewardAtHeight. -func (mr *MockStateInfoMockRecorder) RewardAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RewardAtHeight", reflect.TypeOf((*MockStateInfo)(nil).RewardAtHeight), height) -} - -// RewardVotes mocks base method. -func (m *MockStateInfo) RewardVotes(height proto.Height) (proto.RewardVotes, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RewardVotes", height) - ret0, _ := ret[0].(proto.RewardVotes) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RewardVotes indicates an expected call of RewardVotes. -func (mr *MockStateInfoMockRecorder) RewardVotes(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RewardVotes", reflect.TypeOf((*MockStateInfo)(nil).RewardVotes), height) -} - -// ScoreAtHeight mocks base method. -func (m *MockStateInfo) ScoreAtHeight(height proto.Height) (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScoreAtHeight", height) - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScoreAtHeight indicates an expected call of ScoreAtHeight. -func (mr *MockStateInfoMockRecorder) ScoreAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScoreAtHeight", reflect.TypeOf((*MockStateInfo)(nil).ScoreAtHeight), height) -} - -// ScriptBasicInfoByAccount mocks base method. -func (m *MockStateInfo) ScriptBasicInfoByAccount(account proto.Recipient) (*proto.ScriptBasicInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScriptBasicInfoByAccount", account) - ret0, _ := ret[0].(*proto.ScriptBasicInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScriptBasicInfoByAccount indicates an expected call of ScriptBasicInfoByAccount. -func (mr *MockStateInfoMockRecorder) ScriptBasicInfoByAccount(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScriptBasicInfoByAccount", reflect.TypeOf((*MockStateInfo)(nil).ScriptBasicInfoByAccount), account) -} - -// ScriptInfoByAccount mocks base method. -func (m *MockStateInfo) ScriptInfoByAccount(account proto.Recipient) (*proto.ScriptInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScriptInfoByAccount", account) - ret0, _ := ret[0].(*proto.ScriptInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScriptInfoByAccount indicates an expected call of ScriptInfoByAccount. -func (mr *MockStateInfoMockRecorder) ScriptInfoByAccount(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScriptInfoByAccount", reflect.TypeOf((*MockStateInfo)(nil).ScriptInfoByAccount), account) -} - -// ScriptInfoByAsset mocks base method. -func (m *MockStateInfo) ScriptInfoByAsset(assetID proto.AssetID) (*proto.ScriptInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScriptInfoByAsset", assetID) - ret0, _ := ret[0].(*proto.ScriptInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScriptInfoByAsset indicates an expected call of ScriptInfoByAsset. -func (mr *MockStateInfoMockRecorder) ScriptInfoByAsset(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScriptInfoByAsset", reflect.TypeOf((*MockStateInfo)(nil).ScriptInfoByAsset), assetID) -} - -// ShouldPersistAddressTransactions mocks base method. -func (m *MockStateInfo) ShouldPersistAddressTransactions() (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ShouldPersistAddressTransactions") - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ShouldPersistAddressTransactions indicates an expected call of ShouldPersistAddressTransactions. -func (mr *MockStateInfoMockRecorder) ShouldPersistAddressTransactions() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShouldPersistAddressTransactions", reflect.TypeOf((*MockStateInfo)(nil).ShouldPersistAddressTransactions)) -} - -// SnapshotStateHashAtHeight mocks base method. -func (m *MockStateInfo) SnapshotStateHashAtHeight(height proto.Height) (crypto.Digest, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SnapshotStateHashAtHeight", height) - ret0, _ := ret[0].(crypto.Digest) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SnapshotStateHashAtHeight indicates an expected call of SnapshotStateHashAtHeight. -func (mr *MockStateInfoMockRecorder) SnapshotStateHashAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SnapshotStateHashAtHeight", reflect.TypeOf((*MockStateInfo)(nil).SnapshotStateHashAtHeight), height) -} - -// SnapshotsAtHeight mocks base method. -func (m *MockStateInfo) SnapshotsAtHeight(height proto.Height) (proto.BlockSnapshot, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SnapshotsAtHeight", height) - ret0, _ := ret[0].(proto.BlockSnapshot) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SnapshotsAtHeight indicates an expected call of SnapshotsAtHeight. -func (mr *MockStateInfoMockRecorder) SnapshotsAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SnapshotsAtHeight", reflect.TypeOf((*MockStateInfo)(nil).SnapshotsAtHeight), height) -} - -// TopBlock mocks base method. -func (m *MockStateInfo) TopBlock() *proto.Block { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TopBlock") - ret0, _ := ret[0].(*proto.Block) - return ret0 -} - -// TopBlock indicates an expected call of TopBlock. -func (mr *MockStateInfoMockRecorder) TopBlock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TopBlock", reflect.TypeOf((*MockStateInfo)(nil).TopBlock)) -} - -// TotalWavesAmount mocks base method. -func (m *MockStateInfo) TotalWavesAmount(height proto.Height) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TotalWavesAmount", height) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TotalWavesAmount indicates an expected call of TotalWavesAmount. -func (mr *MockStateInfoMockRecorder) TotalWavesAmount(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TotalWavesAmount", reflect.TypeOf((*MockStateInfo)(nil).TotalWavesAmount), height) -} - -// TransactionByID mocks base method. -func (m *MockStateInfo) TransactionByID(id []byte) (proto.Transaction, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionByID", id) - ret0, _ := ret[0].(proto.Transaction) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TransactionByID indicates an expected call of TransactionByID. -func (mr *MockStateInfoMockRecorder) TransactionByID(id interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionByID", reflect.TypeOf((*MockStateInfo)(nil).TransactionByID), id) -} - -// TransactionByIDWithStatus mocks base method. -func (m *MockStateInfo) TransactionByIDWithStatus(id []byte) (proto.Transaction, proto.TransactionStatus, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionByIDWithStatus", id) - ret0, _ := ret[0].(proto.Transaction) - ret1, _ := ret[1].(proto.TransactionStatus) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// TransactionByIDWithStatus indicates an expected call of TransactionByIDWithStatus. -func (mr *MockStateInfoMockRecorder) TransactionByIDWithStatus(id interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionByIDWithStatus", reflect.TypeOf((*MockStateInfo)(nil).TransactionByIDWithStatus), id) -} - -// TransactionHeightByID mocks base method. -func (m *MockStateInfo) TransactionHeightByID(id []byte) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionHeightByID", id) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TransactionHeightByID indicates an expected call of TransactionHeightByID. -func (mr *MockStateInfoMockRecorder) TransactionHeightByID(id interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionHeightByID", reflect.TypeOf((*MockStateInfo)(nil).TransactionHeightByID), id) -} - -// VotesNum mocks base method. -func (m *MockStateInfo) VotesNum(featureID int16) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VotesNum", featureID) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// VotesNum indicates an expected call of VotesNum. -func (mr *MockStateInfoMockRecorder) VotesNum(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VotesNum", reflect.TypeOf((*MockStateInfo)(nil).VotesNum), featureID) -} - -// VotesNumAtHeight mocks base method. -func (m *MockStateInfo) VotesNumAtHeight(featureID int16, height proto.Height) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VotesNumAtHeight", featureID, height) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// VotesNumAtHeight indicates an expected call of VotesNumAtHeight. -func (mr *MockStateInfoMockRecorder) VotesNumAtHeight(featureID, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VotesNumAtHeight", reflect.TypeOf((*MockStateInfo)(nil).VotesNumAtHeight), featureID, height) -} - -// WavesAddressesNumber mocks base method. -func (m *MockStateInfo) WavesAddressesNumber() (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WavesAddressesNumber") - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WavesAddressesNumber indicates an expected call of WavesAddressesNumber. -func (mr *MockStateInfoMockRecorder) WavesAddressesNumber() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WavesAddressesNumber", reflect.TypeOf((*MockStateInfo)(nil).WavesAddressesNumber)) -} - -// WavesBalance mocks base method. -func (m *MockStateInfo) WavesBalance(account proto.Recipient) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WavesBalance", account) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WavesBalance indicates an expected call of WavesBalance. -func (mr *MockStateInfoMockRecorder) WavesBalance(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WavesBalance", reflect.TypeOf((*MockStateInfo)(nil).WavesBalance), account) -} - -// MockStateModifier is a mock of StateModifier interface. -type MockStateModifier struct { - ctrl *gomock.Controller - recorder *MockStateModifierMockRecorder -} - -// MockStateModifierMockRecorder is the mock recorder for MockStateModifier. -type MockStateModifierMockRecorder struct { - mock *MockStateModifier -} - -// NewMockStateModifier creates a new mock instance. -func NewMockStateModifier(ctrl *gomock.Controller) *MockStateModifier { - mock := &MockStateModifier{ctrl: ctrl} - mock.recorder = &MockStateModifierMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockStateModifier) EXPECT() *MockStateModifierMockRecorder { - return m.recorder -} - -// AddBlock mocks base method. -func (m *MockStateModifier) AddBlock(block []byte) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBlock", block) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddBlock indicates an expected call of AddBlock. -func (mr *MockStateModifierMockRecorder) AddBlock(block interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*MockStateModifier)(nil).AddBlock), block) -} - -// AddBlocks mocks base method. -func (m *MockStateModifier) AddBlocks(blocks [][]byte) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBlocks", blocks) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddBlocks indicates an expected call of AddBlocks. -func (mr *MockStateModifierMockRecorder) AddBlocks(blocks interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlocks", reflect.TypeOf((*MockStateModifier)(nil).AddBlocks), blocks) -} - -// AddBlocksWithSnapshots mocks base method. -func (m *MockStateModifier) AddBlocksWithSnapshots(blocks [][]byte, snapshots []*proto.BlockSnapshot) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBlocksWithSnapshots", blocks, snapshots) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddBlocksWithSnapshots indicates an expected call of AddBlocksWithSnapshots. -func (mr *MockStateModifierMockRecorder) AddBlocksWithSnapshots(blocks, snapshots interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlocksWithSnapshots", reflect.TypeOf((*MockStateModifier)(nil).AddBlocksWithSnapshots), blocks, snapshots) -} - -// AddDeserializedBlock mocks base method. -func (m *MockStateModifier) AddDeserializedBlock(block *proto.Block) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddDeserializedBlock", block) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddDeserializedBlock indicates an expected call of AddDeserializedBlock. -func (mr *MockStateModifierMockRecorder) AddDeserializedBlock(block interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDeserializedBlock", reflect.TypeOf((*MockStateModifier)(nil).AddDeserializedBlock), block) -} - -// AddDeserializedBlocks mocks base method. -func (m *MockStateModifier) AddDeserializedBlocks(blocks []*proto.Block) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddDeserializedBlocks", blocks) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddDeserializedBlocks indicates an expected call of AddDeserializedBlocks. -func (mr *MockStateModifierMockRecorder) AddDeserializedBlocks(blocks interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDeserializedBlocks", reflect.TypeOf((*MockStateModifier)(nil).AddDeserializedBlocks), blocks) -} - -// AddDeserializedBlocksWithSnapshots mocks base method. -func (m *MockStateModifier) AddDeserializedBlocksWithSnapshots(blocks []*proto.Block, snapshots []*proto.BlockSnapshot) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddDeserializedBlocksWithSnapshots", blocks, snapshots) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddDeserializedBlocksWithSnapshots indicates an expected call of AddDeserializedBlocksWithSnapshots. -func (mr *MockStateModifierMockRecorder) AddDeserializedBlocksWithSnapshots(blocks, snapshots interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDeserializedBlocksWithSnapshots", reflect.TypeOf((*MockStateModifier)(nil).AddDeserializedBlocksWithSnapshots), blocks, snapshots) -} - -// Close mocks base method. -func (m *MockStateModifier) Close() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close") - ret0, _ := ret[0].(error) - return ret0 -} - -// Close indicates an expected call of Close. -func (mr *MockStateModifierMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockStateModifier)(nil).Close)) -} - -// CreateNextSnapshotHash mocks base method. -func (m *MockStateModifier) CreateNextSnapshotHash(block *proto.Block) (crypto.Digest, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateNextSnapshotHash", block) - ret0, _ := ret[0].(crypto.Digest) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CreateNextSnapshotHash indicates an expected call of CreateNextSnapshotHash. -func (mr *MockStateModifierMockRecorder) CreateNextSnapshotHash(block interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNextSnapshotHash", reflect.TypeOf((*MockStateModifier)(nil).CreateNextSnapshotHash), block) -} - -// Map mocks base method. -func (m *MockStateModifier) Map(arg0 func(state.NonThreadSafeState) error) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Map", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// Map indicates an expected call of Map. -func (mr *MockStateModifierMockRecorder) Map(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockStateModifier)(nil).Map), arg0) -} - -// MapUnsafe mocks base method. -func (m *MockStateModifier) MapUnsafe(arg0 func(state.NonThreadSafeState) error) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MapUnsafe", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// MapUnsafe indicates an expected call of MapUnsafe. -func (mr *MockStateModifierMockRecorder) MapUnsafe(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MapUnsafe", reflect.TypeOf((*MockStateModifier)(nil).MapUnsafe), arg0) -} - -// PersistAddressTransactions mocks base method. -func (m *MockStateModifier) PersistAddressTransactions() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PersistAddressTransactions") - ret0, _ := ret[0].(error) - return ret0 -} - -// PersistAddressTransactions indicates an expected call of PersistAddressTransactions. -func (mr *MockStateModifierMockRecorder) PersistAddressTransactions() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PersistAddressTransactions", reflect.TypeOf((*MockStateModifier)(nil).PersistAddressTransactions)) -} - -// ResetValidationList mocks base method. -func (m *MockStateModifier) ResetValidationList() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "ResetValidationList") -} - -// ResetValidationList indicates an expected call of ResetValidationList. -func (mr *MockStateModifierMockRecorder) ResetValidationList() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetValidationList", reflect.TypeOf((*MockStateModifier)(nil).ResetValidationList)) -} - -// RollbackTo mocks base method. -func (m *MockStateModifier) RollbackTo(removalEdge proto.BlockID) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RollbackTo", removalEdge) - ret0, _ := ret[0].(error) - return ret0 -} - -// RollbackTo indicates an expected call of RollbackTo. -func (mr *MockStateModifierMockRecorder) RollbackTo(removalEdge interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollbackTo", reflect.TypeOf((*MockStateModifier)(nil).RollbackTo), removalEdge) -} - -// RollbackToHeight mocks base method. -func (m *MockStateModifier) RollbackToHeight(height proto.Height) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RollbackToHeight", height) - ret0, _ := ret[0].(error) - return ret0 -} - -// RollbackToHeight indicates an expected call of RollbackToHeight. -func (mr *MockStateModifierMockRecorder) RollbackToHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollbackToHeight", reflect.TypeOf((*MockStateModifier)(nil).RollbackToHeight), height) -} - -// StartProvidingExtendedApi mocks base method. -func (m *MockStateModifier) StartProvidingExtendedApi() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StartProvidingExtendedApi") - ret0, _ := ret[0].(error) - return ret0 -} - -// StartProvidingExtendedApi indicates an expected call of StartProvidingExtendedApi. -func (mr *MockStateModifierMockRecorder) StartProvidingExtendedApi() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartProvidingExtendedApi", reflect.TypeOf((*MockStateModifier)(nil).StartProvidingExtendedApi)) -} - -// TxValidation mocks base method. -func (m *MockStateModifier) TxValidation(arg0 func(state.TxValidation) error) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TxValidation", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// TxValidation indicates an expected call of TxValidation. -func (mr *MockStateModifierMockRecorder) TxValidation(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TxValidation", reflect.TypeOf((*MockStateModifier)(nil).TxValidation), arg0) -} - -// ValidateNextTx mocks base method. -func (m *MockStateModifier) ValidateNextTx(tx proto.Transaction, currentTimestamp, parentTimestamp uint64, blockVersion proto.BlockVersion, acceptFailed bool) ([]proto.AtomicSnapshot, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateNextTx", tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) - ret0, _ := ret[0].([]proto.AtomicSnapshot) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ValidateNextTx indicates an expected call of ValidateNextTx. -func (mr *MockStateModifierMockRecorder) ValidateNextTx(tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateNextTx", reflect.TypeOf((*MockStateModifier)(nil).ValidateNextTx), tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) -} - -// MockTxValidation is a mock of TxValidation interface. -type MockTxValidation struct { - ctrl *gomock.Controller - recorder *MockTxValidationMockRecorder -} - -// MockTxValidationMockRecorder is the mock recorder for MockTxValidation. -type MockTxValidationMockRecorder struct { - mock *MockTxValidation -} - -// NewMockTxValidation creates a new mock instance. -func NewMockTxValidation(ctrl *gomock.Controller) *MockTxValidation { - mock := &MockTxValidation{ctrl: ctrl} - mock.recorder = &MockTxValidationMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockTxValidation) EXPECT() *MockTxValidationMockRecorder { - return m.recorder -} - -// ValidateNextTx mocks base method. -func (m *MockTxValidation) ValidateNextTx(tx proto.Transaction, currentTimestamp, parentTimestamp uint64, blockVersion proto.BlockVersion, acceptFailed bool) ([]proto.AtomicSnapshot, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateNextTx", tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) - ret0, _ := ret[0].([]proto.AtomicSnapshot) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ValidateNextTx indicates an expected call of ValidateNextTx. -func (mr *MockTxValidationMockRecorder) ValidateNextTx(tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateNextTx", reflect.TypeOf((*MockTxValidation)(nil).ValidateNextTx), tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) -} - -// MockState is a mock of State interface. -type MockState struct { - ctrl *gomock.Controller - recorder *MockStateMockRecorder -} - -// MockStateMockRecorder is the mock recorder for MockState. -type MockStateMockRecorder struct { - mock *MockState -} - -// NewMockState creates a new mock instance. -func NewMockState(ctrl *gomock.Controller) *MockState { - mock := &MockState{ctrl: ctrl} - mock.recorder = &MockStateMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockState) EXPECT() *MockStateMockRecorder { - return m.recorder -} - -// ActivationHeight mocks base method. -func (m *MockState) ActivationHeight(featureID int16) (proto.Height, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ActivationHeight", featureID) - ret0, _ := ret[0].(proto.Height) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ActivationHeight indicates an expected call of ActivationHeight. -func (mr *MockStateMockRecorder) ActivationHeight(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActivationHeight", reflect.TypeOf((*MockState)(nil).ActivationHeight), featureID) -} - -// AddBlock mocks base method. -func (m *MockState) AddBlock(block []byte) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBlock", block) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddBlock indicates an expected call of AddBlock. -func (mr *MockStateMockRecorder) AddBlock(block interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*MockState)(nil).AddBlock), block) -} - -// AddBlocks mocks base method. -func (m *MockState) AddBlocks(blocks [][]byte) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBlocks", blocks) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddBlocks indicates an expected call of AddBlocks. -func (mr *MockStateMockRecorder) AddBlocks(blocks interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlocks", reflect.TypeOf((*MockState)(nil).AddBlocks), blocks) -} - -// AddBlocksWithSnapshots mocks base method. -func (m *MockState) AddBlocksWithSnapshots(blocks [][]byte, snapshots []*proto.BlockSnapshot) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBlocksWithSnapshots", blocks, snapshots) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddBlocksWithSnapshots indicates an expected call of AddBlocksWithSnapshots. -func (mr *MockStateMockRecorder) AddBlocksWithSnapshots(blocks, snapshots interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlocksWithSnapshots", reflect.TypeOf((*MockState)(nil).AddBlocksWithSnapshots), blocks, snapshots) -} - -// AddDeserializedBlock mocks base method. -func (m *MockState) AddDeserializedBlock(block *proto.Block) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddDeserializedBlock", block) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddDeserializedBlock indicates an expected call of AddDeserializedBlock. -func (mr *MockStateMockRecorder) AddDeserializedBlock(block interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDeserializedBlock", reflect.TypeOf((*MockState)(nil).AddDeserializedBlock), block) -} - -// AddDeserializedBlocks mocks base method. -func (m *MockState) AddDeserializedBlocks(blocks []*proto.Block) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddDeserializedBlocks", blocks) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddDeserializedBlocks indicates an expected call of AddDeserializedBlocks. -func (mr *MockStateMockRecorder) AddDeserializedBlocks(blocks interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDeserializedBlocks", reflect.TypeOf((*MockState)(nil).AddDeserializedBlocks), blocks) -} - -// AddDeserializedBlocksWithSnapshots mocks base method. -func (m *MockState) AddDeserializedBlocksWithSnapshots(blocks []*proto.Block, snapshots []*proto.BlockSnapshot) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddDeserializedBlocksWithSnapshots", blocks, snapshots) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddDeserializedBlocksWithSnapshots indicates an expected call of AddDeserializedBlocksWithSnapshots. -func (mr *MockStateMockRecorder) AddDeserializedBlocksWithSnapshots(blocks, snapshots interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDeserializedBlocksWithSnapshots", reflect.TypeOf((*MockState)(nil).AddDeserializedBlocksWithSnapshots), blocks, snapshots) -} - -// AddrByAlias mocks base method. -func (m *MockState) AddrByAlias(alias proto.Alias) (proto.WavesAddress, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddrByAlias", alias) - ret0, _ := ret[0].(proto.WavesAddress) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddrByAlias indicates an expected call of AddrByAlias. -func (mr *MockStateMockRecorder) AddrByAlias(alias interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddrByAlias", reflect.TypeOf((*MockState)(nil).AddrByAlias), alias) -} - -// AliasesByAddr mocks base method. -func (m *MockState) AliasesByAddr(addr proto.WavesAddress) ([]string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AliasesByAddr", addr) - ret0, _ := ret[0].([]string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AliasesByAddr indicates an expected call of AliasesByAddr. -func (mr *MockStateMockRecorder) AliasesByAddr(addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AliasesByAddr", reflect.TypeOf((*MockState)(nil).AliasesByAddr), addr) -} - -// AllFeatures mocks base method. -func (m *MockState) AllFeatures() ([]int16, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AllFeatures") - ret0, _ := ret[0].([]int16) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AllFeatures indicates an expected call of AllFeatures. -func (mr *MockStateMockRecorder) AllFeatures() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AllFeatures", reflect.TypeOf((*MockState)(nil).AllFeatures)) -} - -// ApprovalHeight mocks base method. -func (m *MockState) ApprovalHeight(featureID int16) (proto.Height, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ApprovalHeight", featureID) - ret0, _ := ret[0].(proto.Height) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ApprovalHeight indicates an expected call of ApprovalHeight. -func (mr *MockStateMockRecorder) ApprovalHeight(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApprovalHeight", reflect.TypeOf((*MockState)(nil).ApprovalHeight), featureID) -} - -// AssetBalance mocks base method. -func (m *MockState) AssetBalance(account proto.Recipient, assetID proto.AssetID) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AssetBalance", account, assetID) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AssetBalance indicates an expected call of AssetBalance. -func (mr *MockStateMockRecorder) AssetBalance(account, assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssetBalance", reflect.TypeOf((*MockState)(nil).AssetBalance), account, assetID) -} - -// AssetInfo mocks base method. -func (m *MockState) AssetInfo(assetID proto.AssetID) (*proto.AssetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AssetInfo", assetID) - ret0, _ := ret[0].(*proto.AssetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AssetInfo indicates an expected call of AssetInfo. -func (mr *MockStateMockRecorder) AssetInfo(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssetInfo", reflect.TypeOf((*MockState)(nil).AssetInfo), assetID) -} - -// AssetIsSponsored mocks base method. -func (m *MockState) AssetIsSponsored(assetID proto.AssetID) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AssetIsSponsored", assetID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AssetIsSponsored indicates an expected call of AssetIsSponsored. -func (mr *MockStateMockRecorder) AssetIsSponsored(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssetIsSponsored", reflect.TypeOf((*MockState)(nil).AssetIsSponsored), assetID) -} - -// Block mocks base method. -func (m *MockState) Block(blockID proto.BlockID) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Block", blockID) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Block indicates an expected call of Block. -func (mr *MockStateMockRecorder) Block(blockID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Block", reflect.TypeOf((*MockState)(nil).Block), blockID) -} - -// BlockByHeight mocks base method. -func (m *MockState) BlockByHeight(height proto.Height) (*proto.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockByHeight", height) - ret0, _ := ret[0].(*proto.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockByHeight indicates an expected call of BlockByHeight. -func (mr *MockStateMockRecorder) BlockByHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockByHeight", reflect.TypeOf((*MockState)(nil).BlockByHeight), height) -} - -// BlockIDToHeight mocks base method. -func (m *MockState) BlockIDToHeight(blockID proto.BlockID) (proto.Height, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockIDToHeight", blockID) - ret0, _ := ret[0].(proto.Height) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockIDToHeight indicates an expected call of BlockIDToHeight. -func (mr *MockStateMockRecorder) BlockIDToHeight(blockID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockIDToHeight", reflect.TypeOf((*MockState)(nil).BlockIDToHeight), blockID) -} - -// BlockRewards mocks base method. -func (m *MockState) BlockRewards(generator proto.WavesAddress, height proto.Height) (proto.Rewards, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockRewards", generator, height) - ret0, _ := ret[0].(proto.Rewards) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockRewards indicates an expected call of BlockRewards. -func (mr *MockStateMockRecorder) BlockRewards(generator, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockRewards", reflect.TypeOf((*MockState)(nil).BlockRewards), generator, height) -} - -// BlockVRF mocks base method. -func (m *MockState) BlockVRF(blockHeader *proto.BlockHeader, blockHeight proto.Height) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockVRF", blockHeader, blockHeight) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockVRF indicates an expected call of BlockVRF. -func (mr *MockStateMockRecorder) BlockVRF(blockHeader, blockHeight interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockVRF", reflect.TypeOf((*MockState)(nil).BlockVRF), blockHeader, blockHeight) -} - -// BlockchainSettings mocks base method. -func (m *MockState) BlockchainSettings() (*settings.BlockchainSettings, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BlockchainSettings") - ret0, _ := ret[0].(*settings.BlockchainSettings) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BlockchainSettings indicates an expected call of BlockchainSettings. -func (mr *MockStateMockRecorder) BlockchainSettings() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockchainSettings", reflect.TypeOf((*MockState)(nil).BlockchainSettings)) -} - -// Close mocks base method. -func (m *MockState) Close() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close") - ret0, _ := ret[0].(error) - return ret0 -} - -// Close indicates an expected call of Close. -func (mr *MockStateMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockState)(nil).Close)) -} - -// CreateNextSnapshotHash mocks base method. -func (m *MockState) CreateNextSnapshotHash(block *proto.Block) (crypto.Digest, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateNextSnapshotHash", block) - ret0, _ := ret[0].(crypto.Digest) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CreateNextSnapshotHash indicates an expected call of CreateNextSnapshotHash. -func (mr *MockStateMockRecorder) CreateNextSnapshotHash(block interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNextSnapshotHash", reflect.TypeOf((*MockState)(nil).CreateNextSnapshotHash), block) -} - -// CurrentScore mocks base method. -func (m *MockState) CurrentScore() (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CurrentScore") - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CurrentScore indicates an expected call of CurrentScore. -func (mr *MockStateMockRecorder) CurrentScore() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentScore", reflect.TypeOf((*MockState)(nil).CurrentScore)) -} - -// EnrichedFullAssetInfo mocks base method. -func (m *MockState) EnrichedFullAssetInfo(assetID proto.AssetID) (*proto.EnrichedFullAssetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EnrichedFullAssetInfo", assetID) - ret0, _ := ret[0].(*proto.EnrichedFullAssetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// EnrichedFullAssetInfo indicates an expected call of EnrichedFullAssetInfo. -func (mr *MockStateMockRecorder) EnrichedFullAssetInfo(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnrichedFullAssetInfo", reflect.TypeOf((*MockState)(nil).EnrichedFullAssetInfo), assetID) -} - -// EstimatorVersion mocks base method. -func (m *MockState) EstimatorVersion() (int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EstimatorVersion") - ret0, _ := ret[0].(int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// EstimatorVersion indicates an expected call of EstimatorVersion. -func (mr *MockStateMockRecorder) EstimatorVersion() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimatorVersion", reflect.TypeOf((*MockState)(nil).EstimatorVersion)) -} - -// FullAssetInfo mocks base method. -func (m *MockState) FullAssetInfo(assetID proto.AssetID) (*proto.FullAssetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FullAssetInfo", assetID) - ret0, _ := ret[0].(*proto.FullAssetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// FullAssetInfo indicates an expected call of FullAssetInfo. -func (mr *MockStateMockRecorder) FullAssetInfo(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FullAssetInfo", reflect.TypeOf((*MockState)(nil).FullAssetInfo), assetID) -} - -// FullWavesBalance mocks base method. -func (m *MockState) FullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FullWavesBalance", account) - ret0, _ := ret[0].(*proto.FullWavesBalance) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// FullWavesBalance indicates an expected call of FullWavesBalance. -func (mr *MockStateMockRecorder) FullWavesBalance(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FullWavesBalance", reflect.TypeOf((*MockState)(nil).FullWavesBalance), account) -} - -// GeneratingBalance mocks base method. -func (m *MockState) GeneratingBalance(account proto.Recipient, height proto.Height) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GeneratingBalance", account, height) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GeneratingBalance indicates an expected call of GeneratingBalance. -func (mr *MockStateMockRecorder) GeneratingBalance(account, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GeneratingBalance", reflect.TypeOf((*MockState)(nil).GeneratingBalance), account, height) -} - -// Header mocks base method. -func (m *MockState) Header(blockID proto.BlockID) (*proto.BlockHeader, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Header", blockID) - ret0, _ := ret[0].(*proto.BlockHeader) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Header indicates an expected call of Header. -func (mr *MockStateMockRecorder) Header(blockID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockState)(nil).Header), blockID) -} - -// HeaderByHeight mocks base method. -func (m *MockState) HeaderByHeight(height proto.Height) (*proto.BlockHeader, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HeaderByHeight", height) - ret0, _ := ret[0].(*proto.BlockHeader) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HeaderByHeight indicates an expected call of HeaderByHeight. -func (mr *MockStateMockRecorder) HeaderByHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByHeight", reflect.TypeOf((*MockState)(nil).HeaderByHeight), height) -} - -// Height mocks base method. -func (m *MockState) Height() (proto.Height, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Height") - ret0, _ := ret[0].(proto.Height) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Height indicates an expected call of Height. -func (mr *MockStateMockRecorder) Height() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Height", reflect.TypeOf((*MockState)(nil).Height)) -} - -// HeightToBlockID mocks base method. -func (m *MockState) HeightToBlockID(height proto.Height) (proto.BlockID, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HeightToBlockID", height) - ret0, _ := ret[0].(proto.BlockID) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HeightToBlockID indicates an expected call of HeightToBlockID. -func (mr *MockStateMockRecorder) HeightToBlockID(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeightToBlockID", reflect.TypeOf((*MockState)(nil).HeightToBlockID), height) -} - -// HitSourceAtHeight mocks base method. -func (m *MockState) HitSourceAtHeight(height proto.Height) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HitSourceAtHeight", height) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HitSourceAtHeight indicates an expected call of HitSourceAtHeight. -func (mr *MockStateMockRecorder) HitSourceAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HitSourceAtHeight", reflect.TypeOf((*MockState)(nil).HitSourceAtHeight), height) -} - -// InvokeResultByID mocks base method. -func (m *MockState) InvokeResultByID(invokeID crypto.Digest) (*proto.ScriptResult, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InvokeResultByID", invokeID) - ret0, _ := ret[0].(*proto.ScriptResult) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// InvokeResultByID indicates an expected call of InvokeResultByID. -func (mr *MockStateMockRecorder) InvokeResultByID(invokeID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InvokeResultByID", reflect.TypeOf((*MockState)(nil).InvokeResultByID), invokeID) -} - -// IsActivated mocks base method. -func (m *MockState) IsActivated(featureID int16) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsActivated", featureID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsActivated indicates an expected call of IsActivated. -func (mr *MockStateMockRecorder) IsActivated(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActivated", reflect.TypeOf((*MockState)(nil).IsActivated), featureID) -} - -// IsActiveAtHeight mocks base method. -func (m *MockState) IsActiveAtHeight(featureID int16, height proto.Height) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsActiveAtHeight", featureID, height) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsActiveAtHeight indicates an expected call of IsActiveAtHeight. -func (mr *MockStateMockRecorder) IsActiveAtHeight(featureID, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActiveAtHeight", reflect.TypeOf((*MockState)(nil).IsActiveAtHeight), featureID, height) -} - -// IsActiveLeasing mocks base method. -func (m *MockState) IsActiveLeasing(leaseID crypto.Digest) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsActiveLeasing", leaseID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsActiveLeasing indicates an expected call of IsActiveLeasing. -func (mr *MockStateMockRecorder) IsActiveLeasing(leaseID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActiveLeasing", reflect.TypeOf((*MockState)(nil).IsActiveLeasing), leaseID) -} - -// IsActiveLightNodeNewBlocksFields mocks base method. -func (m *MockState) IsActiveLightNodeNewBlocksFields(blockHeight proto.Height) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsActiveLightNodeNewBlocksFields", blockHeight) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsActiveLightNodeNewBlocksFields indicates an expected call of IsActiveLightNodeNewBlocksFields. -func (mr *MockStateMockRecorder) IsActiveLightNodeNewBlocksFields(blockHeight interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsActiveLightNodeNewBlocksFields", reflect.TypeOf((*MockState)(nil).IsActiveLightNodeNewBlocksFields), blockHeight) -} - -// IsApproved mocks base method. -func (m *MockState) IsApproved(featureID int16) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsApproved", featureID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsApproved indicates an expected call of IsApproved. -func (mr *MockStateMockRecorder) IsApproved(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsApproved", reflect.TypeOf((*MockState)(nil).IsApproved), featureID) -} - -// IsApprovedAtHeight mocks base method. -func (m *MockState) IsApprovedAtHeight(featureID int16, height proto.Height) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsApprovedAtHeight", featureID, height) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsApprovedAtHeight indicates an expected call of IsApprovedAtHeight. -func (mr *MockStateMockRecorder) IsApprovedAtHeight(featureID, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsApprovedAtHeight", reflect.TypeOf((*MockState)(nil).IsApprovedAtHeight), featureID, height) -} - -// IsAssetExist mocks base method. -func (m *MockState) IsAssetExist(assetID proto.AssetID) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsAssetExist", assetID) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// IsAssetExist indicates an expected call of IsAssetExist. -func (mr *MockStateMockRecorder) IsAssetExist(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAssetExist", reflect.TypeOf((*MockState)(nil).IsAssetExist), assetID) -} - -// LegacyStateHashAtHeight mocks base method. -func (m *MockState) LegacyStateHashAtHeight(height proto.Height) (*proto.StateHash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LegacyStateHashAtHeight", height) - ret0, _ := ret[0].(*proto.StateHash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// LegacyStateHashAtHeight indicates an expected call of LegacyStateHashAtHeight. -func (mr *MockStateMockRecorder) LegacyStateHashAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LegacyStateHashAtHeight", reflect.TypeOf((*MockState)(nil).LegacyStateHashAtHeight), height) -} - -// Map mocks base method. -func (m *MockState) Map(arg0 func(state.NonThreadSafeState) error) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Map", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// Map indicates an expected call of Map. -func (mr *MockStateMockRecorder) Map(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockState)(nil).Map), arg0) -} - -// MapR mocks base method. -func (m *MockState) MapR(arg0 func(state.StateInfo) (any, error)) (any, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MapR", arg0) - ret0, _ := ret[0].(any) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// MapR indicates an expected call of MapR. -func (mr *MockStateMockRecorder) MapR(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MapR", reflect.TypeOf((*MockState)(nil).MapR), arg0) -} - -// MapUnsafe mocks base method. -func (m *MockState) MapUnsafe(arg0 func(state.NonThreadSafeState) error) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MapUnsafe", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// MapUnsafe indicates an expected call of MapUnsafe. -func (mr *MockStateMockRecorder) MapUnsafe(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MapUnsafe", reflect.TypeOf((*MockState)(nil).MapUnsafe), arg0) -} - -// NFTList mocks base method. -func (m *MockState) NFTList(account proto.Recipient, limit uint64, afterAssetID *proto.AssetID) ([]*proto.FullAssetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NFTList", account, limit, afterAssetID) - ret0, _ := ret[0].([]*proto.FullAssetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NFTList indicates an expected call of NFTList. -func (mr *MockStateMockRecorder) NFTList(account, limit, afterAssetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NFTList", reflect.TypeOf((*MockState)(nil).NFTList), account, limit, afterAssetID) -} - -// NewAddrTransactionsIterator mocks base method. -func (m *MockState) NewAddrTransactionsIterator(addr proto.Address) (state.TransactionIterator, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewAddrTransactionsIterator", addr) - ret0, _ := ret[0].(state.TransactionIterator) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewAddrTransactionsIterator indicates an expected call of NewAddrTransactionsIterator. -func (mr *MockStateMockRecorder) NewAddrTransactionsIterator(addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAddrTransactionsIterator", reflect.TypeOf((*MockState)(nil).NewAddrTransactionsIterator), addr) -} - -// NewestBlockInfoByHeight mocks base method. -func (m *MockState) NewestBlockInfoByHeight(height proto.Height) (*proto.BlockInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewestBlockInfoByHeight", height) - ret0, _ := ret[0].(*proto.BlockInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewestBlockInfoByHeight indicates an expected call of NewestBlockInfoByHeight. -func (mr *MockStateMockRecorder) NewestBlockInfoByHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewestBlockInfoByHeight", reflect.TypeOf((*MockState)(nil).NewestBlockInfoByHeight), height) -} - -// NewestHeaderByHeight mocks base method. -func (m *MockState) NewestHeaderByHeight(height uint64) (*proto.BlockHeader, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewestHeaderByHeight", height) - ret0, _ := ret[0].(*proto.BlockHeader) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewestHeaderByHeight indicates an expected call of NewestHeaderByHeight. -func (mr *MockStateMockRecorder) NewestHeaderByHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewestHeaderByHeight", reflect.TypeOf((*MockState)(nil).NewestHeaderByHeight), height) -} - -// NewestScriptByAccount mocks base method. -func (m *MockState) NewestScriptByAccount(account proto.Recipient) (*ast.Tree, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewestScriptByAccount", account) - ret0, _ := ret[0].(*ast.Tree) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewestScriptByAccount indicates an expected call of NewestScriptByAccount. -func (mr *MockStateMockRecorder) NewestScriptByAccount(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewestScriptByAccount", reflect.TypeOf((*MockState)(nil).NewestScriptByAccount), account) -} - -// NewestScriptBytesByAccount mocks base method. -func (m *MockState) NewestScriptBytesByAccount(account proto.Recipient) (proto.Script, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewestScriptBytesByAccount", account) - ret0, _ := ret[0].(proto.Script) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewestScriptBytesByAccount indicates an expected call of NewestScriptBytesByAccount. -func (mr *MockStateMockRecorder) NewestScriptBytesByAccount(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewestScriptBytesByAccount", reflect.TypeOf((*MockState)(nil).NewestScriptBytesByAccount), account) -} - -// PersistAddressTransactions mocks base method. -func (m *MockState) PersistAddressTransactions() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PersistAddressTransactions") - ret0, _ := ret[0].(error) - return ret0 -} - -// PersistAddressTransactions indicates an expected call of PersistAddressTransactions. -func (mr *MockStateMockRecorder) PersistAddressTransactions() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PersistAddressTransactions", reflect.TypeOf((*MockState)(nil).PersistAddressTransactions)) -} - -// ProvidesExtendedApi mocks base method. -func (m *MockState) ProvidesExtendedApi() (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProvidesExtendedApi") - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ProvidesExtendedApi indicates an expected call of ProvidesExtendedApi. -func (mr *MockStateMockRecorder) ProvidesExtendedApi() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProvidesExtendedApi", reflect.TypeOf((*MockState)(nil).ProvidesExtendedApi)) -} - -// ProvidesStateHashes mocks base method. -func (m *MockState) ProvidesStateHashes() (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProvidesStateHashes") - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ProvidesStateHashes indicates an expected call of ProvidesStateHashes. -func (mr *MockStateMockRecorder) ProvidesStateHashes() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProvidesStateHashes", reflect.TypeOf((*MockState)(nil).ProvidesStateHashes)) -} - -// ResetValidationList mocks base method. -func (m *MockState) ResetValidationList() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "ResetValidationList") -} - -// ResetValidationList indicates an expected call of ResetValidationList. -func (mr *MockStateMockRecorder) ResetValidationList() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetValidationList", reflect.TypeOf((*MockState)(nil).ResetValidationList)) -} - -// RetrieveBinaryEntry mocks base method. -func (m *MockState) RetrieveBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveBinaryEntry", account, key) - ret0, _ := ret[0].(*proto.BinaryDataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveBinaryEntry indicates an expected call of RetrieveBinaryEntry. -func (mr *MockStateMockRecorder) RetrieveBinaryEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveBinaryEntry", reflect.TypeOf((*MockState)(nil).RetrieveBinaryEntry), account, key) -} - -// RetrieveBooleanEntry mocks base method. -func (m *MockState) RetrieveBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveBooleanEntry", account, key) - ret0, _ := ret[0].(*proto.BooleanDataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveBooleanEntry indicates an expected call of RetrieveBooleanEntry. -func (mr *MockStateMockRecorder) RetrieveBooleanEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveBooleanEntry", reflect.TypeOf((*MockState)(nil).RetrieveBooleanEntry), account, key) -} - -// RetrieveEntries mocks base method. -func (m *MockState) RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveEntries", account) - ret0, _ := ret[0].([]proto.DataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveEntries indicates an expected call of RetrieveEntries. -func (mr *MockStateMockRecorder) RetrieveEntries(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveEntries", reflect.TypeOf((*MockState)(nil).RetrieveEntries), account) -} - -// RetrieveEntry mocks base method. -func (m *MockState) RetrieveEntry(account proto.Recipient, key string) (proto.DataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveEntry", account, key) - ret0, _ := ret[0].(proto.DataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveEntry indicates an expected call of RetrieveEntry. -func (mr *MockStateMockRecorder) RetrieveEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveEntry", reflect.TypeOf((*MockState)(nil).RetrieveEntry), account, key) -} - -// RetrieveIntegerEntry mocks base method. -func (m *MockState) RetrieveIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveIntegerEntry", account, key) - ret0, _ := ret[0].(*proto.IntegerDataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveIntegerEntry indicates an expected call of RetrieveIntegerEntry. -func (mr *MockStateMockRecorder) RetrieveIntegerEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIntegerEntry", reflect.TypeOf((*MockState)(nil).RetrieveIntegerEntry), account, key) -} - -// RetrieveStringEntry mocks base method. -func (m *MockState) RetrieveStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RetrieveStringEntry", account, key) - ret0, _ := ret[0].(*proto.StringDataEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RetrieveStringEntry indicates an expected call of RetrieveStringEntry. -func (mr *MockStateMockRecorder) RetrieveStringEntry(account, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveStringEntry", reflect.TypeOf((*MockState)(nil).RetrieveStringEntry), account, key) -} - -// RewardAtHeight mocks base method. -func (m *MockState) RewardAtHeight(height proto.Height) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RewardAtHeight", height) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RewardAtHeight indicates an expected call of RewardAtHeight. -func (mr *MockStateMockRecorder) RewardAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RewardAtHeight", reflect.TypeOf((*MockState)(nil).RewardAtHeight), height) -} - -// RewardVotes mocks base method. -func (m *MockState) RewardVotes(height proto.Height) (proto.RewardVotes, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RewardVotes", height) - ret0, _ := ret[0].(proto.RewardVotes) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RewardVotes indicates an expected call of RewardVotes. -func (mr *MockStateMockRecorder) RewardVotes(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RewardVotes", reflect.TypeOf((*MockState)(nil).RewardVotes), height) -} - -// RollbackTo mocks base method. -func (m *MockState) RollbackTo(removalEdge proto.BlockID) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RollbackTo", removalEdge) - ret0, _ := ret[0].(error) - return ret0 -} - -// RollbackTo indicates an expected call of RollbackTo. -func (mr *MockStateMockRecorder) RollbackTo(removalEdge interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollbackTo", reflect.TypeOf((*MockState)(nil).RollbackTo), removalEdge) -} - -// RollbackToHeight mocks base method. -func (m *MockState) RollbackToHeight(height proto.Height) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RollbackToHeight", height) - ret0, _ := ret[0].(error) - return ret0 -} - -// RollbackToHeight indicates an expected call of RollbackToHeight. -func (mr *MockStateMockRecorder) RollbackToHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollbackToHeight", reflect.TypeOf((*MockState)(nil).RollbackToHeight), height) -} - -// ScoreAtHeight mocks base method. -func (m *MockState) ScoreAtHeight(height proto.Height) (*big.Int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScoreAtHeight", height) - ret0, _ := ret[0].(*big.Int) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScoreAtHeight indicates an expected call of ScoreAtHeight. -func (mr *MockStateMockRecorder) ScoreAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScoreAtHeight", reflect.TypeOf((*MockState)(nil).ScoreAtHeight), height) -} - -// ScriptBasicInfoByAccount mocks base method. -func (m *MockState) ScriptBasicInfoByAccount(account proto.Recipient) (*proto.ScriptBasicInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScriptBasicInfoByAccount", account) - ret0, _ := ret[0].(*proto.ScriptBasicInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScriptBasicInfoByAccount indicates an expected call of ScriptBasicInfoByAccount. -func (mr *MockStateMockRecorder) ScriptBasicInfoByAccount(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScriptBasicInfoByAccount", reflect.TypeOf((*MockState)(nil).ScriptBasicInfoByAccount), account) -} - -// ScriptInfoByAccount mocks base method. -func (m *MockState) ScriptInfoByAccount(account proto.Recipient) (*proto.ScriptInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScriptInfoByAccount", account) - ret0, _ := ret[0].(*proto.ScriptInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScriptInfoByAccount indicates an expected call of ScriptInfoByAccount. -func (mr *MockStateMockRecorder) ScriptInfoByAccount(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScriptInfoByAccount", reflect.TypeOf((*MockState)(nil).ScriptInfoByAccount), account) -} - -// ScriptInfoByAsset mocks base method. -func (m *MockState) ScriptInfoByAsset(assetID proto.AssetID) (*proto.ScriptInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ScriptInfoByAsset", assetID) - ret0, _ := ret[0].(*proto.ScriptInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ScriptInfoByAsset indicates an expected call of ScriptInfoByAsset. -func (mr *MockStateMockRecorder) ScriptInfoByAsset(assetID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScriptInfoByAsset", reflect.TypeOf((*MockState)(nil).ScriptInfoByAsset), assetID) -} - -// ShouldPersistAddressTransactions mocks base method. -func (m *MockState) ShouldPersistAddressTransactions() (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ShouldPersistAddressTransactions") - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ShouldPersistAddressTransactions indicates an expected call of ShouldPersistAddressTransactions. -func (mr *MockStateMockRecorder) ShouldPersistAddressTransactions() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShouldPersistAddressTransactions", reflect.TypeOf((*MockState)(nil).ShouldPersistAddressTransactions)) -} - -// SnapshotStateHashAtHeight mocks base method. -func (m *MockState) SnapshotStateHashAtHeight(height proto.Height) (crypto.Digest, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SnapshotStateHashAtHeight", height) - ret0, _ := ret[0].(crypto.Digest) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SnapshotStateHashAtHeight indicates an expected call of SnapshotStateHashAtHeight. -func (mr *MockStateMockRecorder) SnapshotStateHashAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SnapshotStateHashAtHeight", reflect.TypeOf((*MockState)(nil).SnapshotStateHashAtHeight), height) -} - -// SnapshotsAtHeight mocks base method. -func (m *MockState) SnapshotsAtHeight(height proto.Height) (proto.BlockSnapshot, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SnapshotsAtHeight", height) - ret0, _ := ret[0].(proto.BlockSnapshot) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// SnapshotsAtHeight indicates an expected call of SnapshotsAtHeight. -func (mr *MockStateMockRecorder) SnapshotsAtHeight(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SnapshotsAtHeight", reflect.TypeOf((*MockState)(nil).SnapshotsAtHeight), height) -} - -// StartProvidingExtendedApi mocks base method. -func (m *MockState) StartProvidingExtendedApi() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StartProvidingExtendedApi") - ret0, _ := ret[0].(error) - return ret0 -} - -// StartProvidingExtendedApi indicates an expected call of StartProvidingExtendedApi. -func (mr *MockStateMockRecorder) StartProvidingExtendedApi() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartProvidingExtendedApi", reflect.TypeOf((*MockState)(nil).StartProvidingExtendedApi)) -} - -// TopBlock mocks base method. -func (m *MockState) TopBlock() *proto.Block { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TopBlock") - ret0, _ := ret[0].(*proto.Block) - return ret0 -} - -// TopBlock indicates an expected call of TopBlock. -func (mr *MockStateMockRecorder) TopBlock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TopBlock", reflect.TypeOf((*MockState)(nil).TopBlock)) -} - -// TotalWavesAmount mocks base method. -func (m *MockState) TotalWavesAmount(height proto.Height) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TotalWavesAmount", height) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TotalWavesAmount indicates an expected call of TotalWavesAmount. -func (mr *MockStateMockRecorder) TotalWavesAmount(height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TotalWavesAmount", reflect.TypeOf((*MockState)(nil).TotalWavesAmount), height) -} - -// TransactionByID mocks base method. -func (m *MockState) TransactionByID(id []byte) (proto.Transaction, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionByID", id) - ret0, _ := ret[0].(proto.Transaction) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TransactionByID indicates an expected call of TransactionByID. -func (mr *MockStateMockRecorder) TransactionByID(id interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionByID", reflect.TypeOf((*MockState)(nil).TransactionByID), id) -} - -// TransactionByIDWithStatus mocks base method. -func (m *MockState) TransactionByIDWithStatus(id []byte) (proto.Transaction, proto.TransactionStatus, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionByIDWithStatus", id) - ret0, _ := ret[0].(proto.Transaction) - ret1, _ := ret[1].(proto.TransactionStatus) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// TransactionByIDWithStatus indicates an expected call of TransactionByIDWithStatus. -func (mr *MockStateMockRecorder) TransactionByIDWithStatus(id interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionByIDWithStatus", reflect.TypeOf((*MockState)(nil).TransactionByIDWithStatus), id) -} - -// TransactionHeightByID mocks base method. -func (m *MockState) TransactionHeightByID(id []byte) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransactionHeightByID", id) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// TransactionHeightByID indicates an expected call of TransactionHeightByID. -func (mr *MockStateMockRecorder) TransactionHeightByID(id interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransactionHeightByID", reflect.TypeOf((*MockState)(nil).TransactionHeightByID), id) -} - -// TxValidation mocks base method. -func (m *MockState) TxValidation(arg0 func(state.TxValidation) error) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TxValidation", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// TxValidation indicates an expected call of TxValidation. -func (mr *MockStateMockRecorder) TxValidation(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TxValidation", reflect.TypeOf((*MockState)(nil).TxValidation), arg0) -} - -// ValidateNextTx mocks base method. -func (m *MockState) ValidateNextTx(tx proto.Transaction, currentTimestamp, parentTimestamp uint64, blockVersion proto.BlockVersion, acceptFailed bool) ([]proto.AtomicSnapshot, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateNextTx", tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) - ret0, _ := ret[0].([]proto.AtomicSnapshot) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ValidateNextTx indicates an expected call of ValidateNextTx. -func (mr *MockStateMockRecorder) ValidateNextTx(tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateNextTx", reflect.TypeOf((*MockState)(nil).ValidateNextTx), tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) -} - -// VotesNum mocks base method. -func (m *MockState) VotesNum(featureID int16) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VotesNum", featureID) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// VotesNum indicates an expected call of VotesNum. -func (mr *MockStateMockRecorder) VotesNum(featureID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VotesNum", reflect.TypeOf((*MockState)(nil).VotesNum), featureID) -} - -// VotesNumAtHeight mocks base method. -func (m *MockState) VotesNumAtHeight(featureID int16, height proto.Height) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VotesNumAtHeight", featureID, height) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// VotesNumAtHeight indicates an expected call of VotesNumAtHeight. -func (mr *MockStateMockRecorder) VotesNumAtHeight(featureID, height interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VotesNumAtHeight", reflect.TypeOf((*MockState)(nil).VotesNumAtHeight), featureID, height) -} - -// WavesAddressesNumber mocks base method. -func (m *MockState) WavesAddressesNumber() (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WavesAddressesNumber") - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WavesAddressesNumber indicates an expected call of WavesAddressesNumber. -func (mr *MockStateMockRecorder) WavesAddressesNumber() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WavesAddressesNumber", reflect.TypeOf((*MockState)(nil).WavesAddressesNumber)) -} - -// WavesBalance mocks base method. -func (m *MockState) WavesBalance(account proto.Recipient) (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WavesBalance", account) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WavesBalance indicates an expected call of WavesBalance. -func (mr *MockStateMockRecorder) WavesBalance(account interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WavesBalance", reflect.TypeOf((*MockState)(nil).WavesBalance), account) -} diff --git a/pkg/node/actions_by_type_test.go b/pkg/node/actions_by_type_test.go index 1dbd958ca3..c413982c28 100644 --- a/pkg/node/actions_by_type_test.go +++ b/pkg/node/actions_by_type_test.go @@ -5,10 +5,9 @@ import ( "net" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "github.com/wavesplatform/gowaves/pkg/mock" + "github.com/wavesplatform/gowaves/pkg/node/peers" "github.com/wavesplatform/gowaves/pkg/node/peers/storage" "github.com/wavesplatform/gowaves/pkg/p2p/peer" "github.com/wavesplatform/gowaves/pkg/proto" @@ -16,12 +15,10 @@ import ( ) func TestPeersAction(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - m := mock.NewMockPeerManager(ctrl) + m := peers.NewMockPeerManager(t) m.EXPECT().KnownPeers().Return([]storage.KnownPeer{}) addr := proto.NewTCPAddr(net.ParseIP("127.0.0.1"), 6868).ToIpPort() - m.EXPECT().UpdateKnownPeers([]storage.KnownPeer{storage.KnownPeer(addr)}) + m.EXPECT().UpdateKnownPeers([]storage.KnownPeer{storage.KnownPeer(addr)}).Return(nil) _, err := PeersAction(services.Services{ Peers: m, diff --git a/pkg/node/blocks_applier/blocks_applier_test.go b/pkg/node/blocks_applier/blocks_applier_test.go index 225bc4eadf..94bbe0ce17 100644 --- a/pkg/node/blocks_applier/blocks_applier_test.go +++ b/pkg/node/blocks_applier/blocks_applier_test.go @@ -4,12 +4,13 @@ import ( "math/big" "testing" - "github.com/golang/mock/gomock" "github.com/pkg/errors" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/wavesplatform/gowaves/pkg/crypto" - "github.com/wavesplatform/gowaves/pkg/mock" "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/state" ) var genesisSign = crypto.MustSignatureFromBase58("31oSQjtBqNjyj37qmrkocHvoazMtycbaw1shbznXoN66d3nfwczqTr4FKdGmqvaVGyxtrpiKdF6RGiZWNa9rEEkY") @@ -60,9 +61,6 @@ func TestApply_ValidBlockWithRollback(t *testing.T) { // in this test we check that block rollback previous deleted block, when try to add new block. // Emulate new blocks have error, so we can't accept them, and rollbacked blocks apply again func TestApply_InvalidBlockWithRollback(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - block1 := &proto.Block{ BlockHeader: proto.BlockHeader{ Parent: genesisId, @@ -84,7 +82,7 @@ func TestApply_InvalidBlockWithRollback(t *testing.T) { }, } - stateMock := mock.NewMockState(ctrl) + stateMock := state.NewMockState(t) stateMock.EXPECT().Block(block2.BlockID()).Return(nil, proto.ErrNotFound) stateMock.EXPECT().Height().Return(proto.Height(2), nil) // this returns current height @@ -98,9 +96,13 @@ func TestApply_InvalidBlockWithRollback(t *testing.T) { // rollback to first(genesis) block stateMock.EXPECT().RollbackToHeight(proto.Height(1)).Return(nil) // adding new blocks, and have error on applying - stateMock.EXPECT().AddDeserializedBlocks([]*proto.Block{block2}).Return(nil, errors.New("error message")) + stateMock.EXPECT().AddDeserializedBlocks(mock.MatchedBy(func(blocks []*proto.Block) bool { + return len(blocks) == 1 && blocks[0] == block2 + })).Return(nil, errors.New("error message")) // return blocks - stateMock.EXPECT().AddDeserializedBlocks([]*proto.Block{block1}).Return(nil, nil) + stateMock.EXPECT().AddDeserializedBlocks(mock.MatchedBy(func(blocks []*proto.Block) bool { + return len(blocks) == 1 && blocks[0] == block1 + })).Return(nil, nil) ba := innerBlocksApplier{} _, err := ba.apply(stateMock, []*proto.Block{block2}) diff --git a/pkg/node/fsm/time_moq.go b/pkg/node/fsm/time_moq.go deleted file mode 100644 index e1192663ac..0000000000 --- a/pkg/node/fsm/time_moq.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package fsm - -import ( - "sync" - "time" - - "github.com/wavesplatform/gowaves/pkg/types" -) - -// Ensure, that MockTime does implement types.Time. -// If this is not the case, regenerate this file with moq. -var _ types.Time = &MockTime{} - -// MockTime is a mock implementation of types.Time. -// -// func TestSomethingThatUsesTime(t *testing.T) { -// -// // make and configure a mocked types.Time -// mockedTime := &MockTime{ -// NowFunc: func() time.Time { -// panic("mock out the Now method") -// }, -// } -// -// // use mockedTime in code that requires types.Time -// // and then make assertions. -// -// } -type MockTime struct { - // NowFunc mocks the Now method. - NowFunc func() time.Time - - // calls tracks calls to the methods. - calls struct { - // Now holds details about calls to the Now method. - Now []struct { - } - } - lockNow sync.RWMutex -} - -// Now calls NowFunc. -func (mock *MockTime) Now() time.Time { - if mock.NowFunc == nil { - panic("MockTime.NowFunc: method is nil but Time.Now was just called") - } - callInfo := struct { - }{} - mock.lockNow.Lock() - mock.calls.Now = append(mock.calls.Now, callInfo) - mock.lockNow.Unlock() - return mock.NowFunc() -} - -// NowCalls gets all the calls that were made to Now. -// Check the length with: -// -// len(mockedTime.NowCalls()) -func (mock *MockTime) NowCalls() []struct { -} { - var calls []struct { - } - mock.lockNow.RLock() - calls = mock.calls.Now - mock.lockNow.RUnlock() - return calls -} diff --git a/pkg/node/peers/mock_peer_manager.go b/pkg/node/peers/mock_peer_manager.go new file mode 100644 index 0000000000..9c209b48c1 --- /dev/null +++ b/pkg/node/peers/mock_peer_manager.go @@ -0,0 +1,1075 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package peers + +import ( + "context" + "net" + "time" + + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/node/peers/storage" + "github.com/wavesplatform/gowaves/pkg/p2p/peer" + "github.com/wavesplatform/gowaves/pkg/proto" +) + +// NewMockPeerManager creates a new instance of MockPeerManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockPeerManager(t interface { + mock.TestingT + Cleanup(func()) +}) *MockPeerManager { + mock := &MockPeerManager{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockPeerManager is an autogenerated mock type for the PeerManager type +type MockPeerManager struct { + mock.Mock +} + +type MockPeerManager_Expecter struct { + mock *mock.Mock +} + +func (_m *MockPeerManager) EXPECT() *MockPeerManager_Expecter { + return &MockPeerManager_Expecter{mock: &_m.Mock} +} + +// AddToBlackList provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) AddToBlackList(peer1 peer.Peer, blockTime time.Time, reason string) { + _mock.Called(peer1, blockTime, reason) + return +} + +// MockPeerManager_AddToBlackList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddToBlackList' +type MockPeerManager_AddToBlackList_Call struct { + *mock.Call +} + +// AddToBlackList is a helper method to define mock.On call +// - peer1 peer.Peer +// - blockTime time.Time +// - reason string +func (_e *MockPeerManager_Expecter) AddToBlackList(peer1 interface{}, blockTime interface{}, reason interface{}) *MockPeerManager_AddToBlackList_Call { + return &MockPeerManager_AddToBlackList_Call{Call: _e.mock.On("AddToBlackList", peer1, blockTime, reason)} +} + +func (_c *MockPeerManager_AddToBlackList_Call) Run(run func(peer1 peer.Peer, blockTime time.Time, reason string)) *MockPeerManager_AddToBlackList_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 peer.Peer + if args[0] != nil { + arg0 = args[0].(peer.Peer) + } + var arg1 time.Time + if args[1] != nil { + arg1 = args[1].(time.Time) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockPeerManager_AddToBlackList_Call) Return() *MockPeerManager_AddToBlackList_Call { + _c.Call.Return() + return _c +} + +func (_c *MockPeerManager_AddToBlackList_Call) RunAndReturn(run func(peer1 peer.Peer, blockTime time.Time, reason string)) *MockPeerManager_AddToBlackList_Call { + _c.Run(run) + return _c +} + +// AskPeers provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) AskPeers() { + _mock.Called() + return +} + +// MockPeerManager_AskPeers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AskPeers' +type MockPeerManager_AskPeers_Call struct { + *mock.Call +} + +// AskPeers is a helper method to define mock.On call +func (_e *MockPeerManager_Expecter) AskPeers() *MockPeerManager_AskPeers_Call { + return &MockPeerManager_AskPeers_Call{Call: _e.mock.On("AskPeers")} +} + +func (_c *MockPeerManager_AskPeers_Call) Run(run func()) *MockPeerManager_AskPeers_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerManager_AskPeers_Call) Return() *MockPeerManager_AskPeers_Call { + _c.Call.Return() + return _c +} + +func (_c *MockPeerManager_AskPeers_Call) RunAndReturn(run func()) *MockPeerManager_AskPeers_Call { + _c.Run(run) + return _c +} + +// BlackList provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) BlackList() []storage.BlackListedPeer { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for BlackList") + } + + var r0 []storage.BlackListedPeer + if returnFunc, ok := ret.Get(0).(func() []storage.BlackListedPeer); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]storage.BlackListedPeer) + } + } + return r0 +} + +// MockPeerManager_BlackList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlackList' +type MockPeerManager_BlackList_Call struct { + *mock.Call +} + +// BlackList is a helper method to define mock.On call +func (_e *MockPeerManager_Expecter) BlackList() *MockPeerManager_BlackList_Call { + return &MockPeerManager_BlackList_Call{Call: _e.mock.On("BlackList")} +} + +func (_c *MockPeerManager_BlackList_Call) Run(run func()) *MockPeerManager_BlackList_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerManager_BlackList_Call) Return(vs []storage.BlackListedPeer) *MockPeerManager_BlackList_Call { + _c.Call.Return(vs) + return _c +} + +func (_c *MockPeerManager_BlackList_Call) RunAndReturn(run func() []storage.BlackListedPeer) *MockPeerManager_BlackList_Call { + _c.Call.Return(run) + return _c +} + +// CheckPeerInLargestScoreGroup provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) CheckPeerInLargestScoreGroup(p peer.Peer) (peer.Peer, bool) { + ret := _mock.Called(p) + + if len(ret) == 0 { + panic("no return value specified for CheckPeerInLargestScoreGroup") + } + + var r0 peer.Peer + var r1 bool + if returnFunc, ok := ret.Get(0).(func(peer.Peer) (peer.Peer, bool)); ok { + return returnFunc(p) + } + if returnFunc, ok := ret.Get(0).(func(peer.Peer) peer.Peer); ok { + r0 = returnFunc(p) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(peer.Peer) + } + } + if returnFunc, ok := ret.Get(1).(func(peer.Peer) bool); ok { + r1 = returnFunc(p) + } else { + r1 = ret.Get(1).(bool) + } + return r0, r1 +} + +// MockPeerManager_CheckPeerInLargestScoreGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckPeerInLargestScoreGroup' +type MockPeerManager_CheckPeerInLargestScoreGroup_Call struct { + *mock.Call +} + +// CheckPeerInLargestScoreGroup is a helper method to define mock.On call +// - p peer.Peer +func (_e *MockPeerManager_Expecter) CheckPeerInLargestScoreGroup(p interface{}) *MockPeerManager_CheckPeerInLargestScoreGroup_Call { + return &MockPeerManager_CheckPeerInLargestScoreGroup_Call{Call: _e.mock.On("CheckPeerInLargestScoreGroup", p)} +} + +func (_c *MockPeerManager_CheckPeerInLargestScoreGroup_Call) Run(run func(p peer.Peer)) *MockPeerManager_CheckPeerInLargestScoreGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 peer.Peer + if args[0] != nil { + arg0 = args[0].(peer.Peer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerManager_CheckPeerInLargestScoreGroup_Call) Return(peer1 peer.Peer, b bool) *MockPeerManager_CheckPeerInLargestScoreGroup_Call { + _c.Call.Return(peer1, b) + return _c +} + +func (_c *MockPeerManager_CheckPeerInLargestScoreGroup_Call) RunAndReturn(run func(p peer.Peer) (peer.Peer, bool)) *MockPeerManager_CheckPeerInLargestScoreGroup_Call { + _c.Call.Return(run) + return _c +} + +// CheckPeerWithMaxScore provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) CheckPeerWithMaxScore(p peer.Peer) (peer.Peer, bool) { + ret := _mock.Called(p) + + if len(ret) == 0 { + panic("no return value specified for CheckPeerWithMaxScore") + } + + var r0 peer.Peer + var r1 bool + if returnFunc, ok := ret.Get(0).(func(peer.Peer) (peer.Peer, bool)); ok { + return returnFunc(p) + } + if returnFunc, ok := ret.Get(0).(func(peer.Peer) peer.Peer); ok { + r0 = returnFunc(p) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(peer.Peer) + } + } + if returnFunc, ok := ret.Get(1).(func(peer.Peer) bool); ok { + r1 = returnFunc(p) + } else { + r1 = ret.Get(1).(bool) + } + return r0, r1 +} + +// MockPeerManager_CheckPeerWithMaxScore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckPeerWithMaxScore' +type MockPeerManager_CheckPeerWithMaxScore_Call struct { + *mock.Call +} + +// CheckPeerWithMaxScore is a helper method to define mock.On call +// - p peer.Peer +func (_e *MockPeerManager_Expecter) CheckPeerWithMaxScore(p interface{}) *MockPeerManager_CheckPeerWithMaxScore_Call { + return &MockPeerManager_CheckPeerWithMaxScore_Call{Call: _e.mock.On("CheckPeerWithMaxScore", p)} +} + +func (_c *MockPeerManager_CheckPeerWithMaxScore_Call) Run(run func(p peer.Peer)) *MockPeerManager_CheckPeerWithMaxScore_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 peer.Peer + if args[0] != nil { + arg0 = args[0].(peer.Peer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerManager_CheckPeerWithMaxScore_Call) Return(peer1 peer.Peer, b bool) *MockPeerManager_CheckPeerWithMaxScore_Call { + _c.Call.Return(peer1, b) + return _c +} + +func (_c *MockPeerManager_CheckPeerWithMaxScore_Call) RunAndReturn(run func(p peer.Peer) (peer.Peer, bool)) *MockPeerManager_CheckPeerWithMaxScore_Call { + _c.Call.Return(run) + return _c +} + +// ClearBlackList provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) ClearBlackList() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for ClearBlackList") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerManager_ClearBlackList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearBlackList' +type MockPeerManager_ClearBlackList_Call struct { + *mock.Call +} + +// ClearBlackList is a helper method to define mock.On call +func (_e *MockPeerManager_Expecter) ClearBlackList() *MockPeerManager_ClearBlackList_Call { + return &MockPeerManager_ClearBlackList_Call{Call: _e.mock.On("ClearBlackList")} +} + +func (_c *MockPeerManager_ClearBlackList_Call) Run(run func()) *MockPeerManager_ClearBlackList_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerManager_ClearBlackList_Call) Return(err error) *MockPeerManager_ClearBlackList_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerManager_ClearBlackList_Call) RunAndReturn(run func() error) *MockPeerManager_ClearBlackList_Call { + _c.Call.Return(run) + return _c +} + +// Close provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) Close() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Close") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerManager_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type MockPeerManager_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *MockPeerManager_Expecter) Close() *MockPeerManager_Close_Call { + return &MockPeerManager_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *MockPeerManager_Close_Call) Run(run func()) *MockPeerManager_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerManager_Close_Call) Return(err error) *MockPeerManager_Close_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerManager_Close_Call) RunAndReturn(run func() error) *MockPeerManager_Close_Call { + _c.Call.Return(run) + return _c +} + +// Connect provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) Connect(context1 context.Context, tCPAddr proto.TCPAddr) error { + ret := _mock.Called(context1, tCPAddr) + + if len(ret) == 0 { + panic("no return value specified for Connect") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, proto.TCPAddr) error); ok { + r0 = returnFunc(context1, tCPAddr) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerManager_Connect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Connect' +type MockPeerManager_Connect_Call struct { + *mock.Call +} + +// Connect is a helper method to define mock.On call +// - context1 context.Context +// - tCPAddr proto.TCPAddr +func (_e *MockPeerManager_Expecter) Connect(context1 interface{}, tCPAddr interface{}) *MockPeerManager_Connect_Call { + return &MockPeerManager_Connect_Call{Call: _e.mock.On("Connect", context1, tCPAddr)} +} + +func (_c *MockPeerManager_Connect_Call) Run(run func(context1 context.Context, tCPAddr proto.TCPAddr)) *MockPeerManager_Connect_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 proto.TCPAddr + if args[1] != nil { + arg1 = args[1].(proto.TCPAddr) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockPeerManager_Connect_Call) Return(err error) *MockPeerManager_Connect_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerManager_Connect_Call) RunAndReturn(run func(context1 context.Context, tCPAddr proto.TCPAddr) error) *MockPeerManager_Connect_Call { + _c.Call.Return(run) + return _c +} + +// ConnectedCount provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) ConnectedCount() int { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for ConnectedCount") + } + + var r0 int + if returnFunc, ok := ret.Get(0).(func() int); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(int) + } + return r0 +} + +// MockPeerManager_ConnectedCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConnectedCount' +type MockPeerManager_ConnectedCount_Call struct { + *mock.Call +} + +// ConnectedCount is a helper method to define mock.On call +func (_e *MockPeerManager_Expecter) ConnectedCount() *MockPeerManager_ConnectedCount_Call { + return &MockPeerManager_ConnectedCount_Call{Call: _e.mock.On("ConnectedCount")} +} + +func (_c *MockPeerManager_ConnectedCount_Call) Run(run func()) *MockPeerManager_ConnectedCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerManager_ConnectedCount_Call) Return(n int) *MockPeerManager_ConnectedCount_Call { + _c.Call.Return(n) + return _c +} + +func (_c *MockPeerManager_ConnectedCount_Call) RunAndReturn(run func() int) *MockPeerManager_ConnectedCount_Call { + _c.Call.Return(run) + return _c +} + +// Disconnect provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) Disconnect(peer1 peer.Peer) { + _mock.Called(peer1) + return +} + +// MockPeerManager_Disconnect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Disconnect' +type MockPeerManager_Disconnect_Call struct { + *mock.Call +} + +// Disconnect is a helper method to define mock.On call +// - peer1 peer.Peer +func (_e *MockPeerManager_Expecter) Disconnect(peer1 interface{}) *MockPeerManager_Disconnect_Call { + return &MockPeerManager_Disconnect_Call{Call: _e.mock.On("Disconnect", peer1)} +} + +func (_c *MockPeerManager_Disconnect_Call) Run(run func(peer1 peer.Peer)) *MockPeerManager_Disconnect_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 peer.Peer + if args[0] != nil { + arg0 = args[0].(peer.Peer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerManager_Disconnect_Call) Return() *MockPeerManager_Disconnect_Call { + _c.Call.Return() + return _c +} + +func (_c *MockPeerManager_Disconnect_Call) RunAndReturn(run func(peer1 peer.Peer)) *MockPeerManager_Disconnect_Call { + _c.Run(run) + return _c +} + +// EachConnected provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) EachConnected(fn func(peer.Peer, *proto.Score)) { + _mock.Called(fn) + return +} + +// MockPeerManager_EachConnected_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EachConnected' +type MockPeerManager_EachConnected_Call struct { + *mock.Call +} + +// EachConnected is a helper method to define mock.On call +// - fn func(peer.Peer, *proto.Score) +func (_e *MockPeerManager_Expecter) EachConnected(fn interface{}) *MockPeerManager_EachConnected_Call { + return &MockPeerManager_EachConnected_Call{Call: _e.mock.On("EachConnected", fn)} +} + +func (_c *MockPeerManager_EachConnected_Call) Run(run func(fn func(peer.Peer, *proto.Score))) *MockPeerManager_EachConnected_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 func(peer.Peer, *proto.Score) + if args[0] != nil { + arg0 = args[0].(func(peer.Peer, *proto.Score)) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerManager_EachConnected_Call) Return() *MockPeerManager_EachConnected_Call { + _c.Call.Return() + return _c +} + +func (_c *MockPeerManager_EachConnected_Call) RunAndReturn(run func(fn func(peer.Peer, *proto.Score))) *MockPeerManager_EachConnected_Call { + _c.Run(run) + return _c +} + +// KnownPeers provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) KnownPeers() []storage.KnownPeer { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for KnownPeers") + } + + var r0 []storage.KnownPeer + if returnFunc, ok := ret.Get(0).(func() []storage.KnownPeer); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]storage.KnownPeer) + } + } + return r0 +} + +// MockPeerManager_KnownPeers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'KnownPeers' +type MockPeerManager_KnownPeers_Call struct { + *mock.Call +} + +// KnownPeers is a helper method to define mock.On call +func (_e *MockPeerManager_Expecter) KnownPeers() *MockPeerManager_KnownPeers_Call { + return &MockPeerManager_KnownPeers_Call{Call: _e.mock.On("KnownPeers")} +} + +func (_c *MockPeerManager_KnownPeers_Call) Run(run func()) *MockPeerManager_KnownPeers_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerManager_KnownPeers_Call) Return(knownPeers []storage.KnownPeer) *MockPeerManager_KnownPeers_Call { + _c.Call.Return(knownPeers) + return _c +} + +func (_c *MockPeerManager_KnownPeers_Call) RunAndReturn(run func() []storage.KnownPeer) *MockPeerManager_KnownPeers_Call { + _c.Call.Return(run) + return _c +} + +// NewConnection provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) NewConnection(peer1 peer.Peer) error { + ret := _mock.Called(peer1) + + if len(ret) == 0 { + panic("no return value specified for NewConnection") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(peer.Peer) error); ok { + r0 = returnFunc(peer1) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerManager_NewConnection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewConnection' +type MockPeerManager_NewConnection_Call struct { + *mock.Call +} + +// NewConnection is a helper method to define mock.On call +// - peer1 peer.Peer +func (_e *MockPeerManager_Expecter) NewConnection(peer1 interface{}) *MockPeerManager_NewConnection_Call { + return &MockPeerManager_NewConnection_Call{Call: _e.mock.On("NewConnection", peer1)} +} + +func (_c *MockPeerManager_NewConnection_Call) Run(run func(peer1 peer.Peer)) *MockPeerManager_NewConnection_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 peer.Peer + if args[0] != nil { + arg0 = args[0].(peer.Peer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerManager_NewConnection_Call) Return(err error) *MockPeerManager_NewConnection_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerManager_NewConnection_Call) RunAndReturn(run func(peer1 peer.Peer) error) *MockPeerManager_NewConnection_Call { + _c.Call.Return(run) + return _c +} + +// Score provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) Score(p peer.Peer) (*proto.Score, error) { + ret := _mock.Called(p) + + if len(ret) == 0 { + panic("no return value specified for Score") + } + + var r0 *proto.Score + var r1 error + if returnFunc, ok := ret.Get(0).(func(peer.Peer) (*proto.Score, error)); ok { + return returnFunc(p) + } + if returnFunc, ok := ret.Get(0).(func(peer.Peer) *proto.Score); ok { + r0 = returnFunc(p) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.Score) + } + } + if returnFunc, ok := ret.Get(1).(func(peer.Peer) error); ok { + r1 = returnFunc(p) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockPeerManager_Score_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Score' +type MockPeerManager_Score_Call struct { + *mock.Call +} + +// Score is a helper method to define mock.On call +// - p peer.Peer +func (_e *MockPeerManager_Expecter) Score(p interface{}) *MockPeerManager_Score_Call { + return &MockPeerManager_Score_Call{Call: _e.mock.On("Score", p)} +} + +func (_c *MockPeerManager_Score_Call) Run(run func(p peer.Peer)) *MockPeerManager_Score_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 peer.Peer + if args[0] != nil { + arg0 = args[0].(peer.Peer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerManager_Score_Call) Return(v *proto.Score, err error) *MockPeerManager_Score_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockPeerManager_Score_Call) RunAndReturn(run func(p peer.Peer) (*proto.Score, error)) *MockPeerManager_Score_Call { + _c.Call.Return(run) + return _c +} + +// SpawnIncomingConnection provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) SpawnIncomingConnection(ctx context.Context, conn net.Conn) error { + ret := _mock.Called(ctx, conn) + + if len(ret) == 0 { + panic("no return value specified for SpawnIncomingConnection") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, net.Conn) error); ok { + r0 = returnFunc(ctx, conn) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerManager_SpawnIncomingConnection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SpawnIncomingConnection' +type MockPeerManager_SpawnIncomingConnection_Call struct { + *mock.Call +} + +// SpawnIncomingConnection is a helper method to define mock.On call +// - ctx context.Context +// - conn net.Conn +func (_e *MockPeerManager_Expecter) SpawnIncomingConnection(ctx interface{}, conn interface{}) *MockPeerManager_SpawnIncomingConnection_Call { + return &MockPeerManager_SpawnIncomingConnection_Call{Call: _e.mock.On("SpawnIncomingConnection", ctx, conn)} +} + +func (_c *MockPeerManager_SpawnIncomingConnection_Call) Run(run func(ctx context.Context, conn net.Conn)) *MockPeerManager_SpawnIncomingConnection_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 net.Conn + if args[1] != nil { + arg1 = args[1].(net.Conn) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockPeerManager_SpawnIncomingConnection_Call) Return(err error) *MockPeerManager_SpawnIncomingConnection_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerManager_SpawnIncomingConnection_Call) RunAndReturn(run func(ctx context.Context, conn net.Conn) error) *MockPeerManager_SpawnIncomingConnection_Call { + _c.Call.Return(run) + return _c +} + +// SpawnOutgoingConnections provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) SpawnOutgoingConnections(context1 context.Context) { + _mock.Called(context1) + return +} + +// MockPeerManager_SpawnOutgoingConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SpawnOutgoingConnections' +type MockPeerManager_SpawnOutgoingConnections_Call struct { + *mock.Call +} + +// SpawnOutgoingConnections is a helper method to define mock.On call +// - context1 context.Context +func (_e *MockPeerManager_Expecter) SpawnOutgoingConnections(context1 interface{}) *MockPeerManager_SpawnOutgoingConnections_Call { + return &MockPeerManager_SpawnOutgoingConnections_Call{Call: _e.mock.On("SpawnOutgoingConnections", context1)} +} + +func (_c *MockPeerManager_SpawnOutgoingConnections_Call) Run(run func(context1 context.Context)) *MockPeerManager_SpawnOutgoingConnections_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerManager_SpawnOutgoingConnections_Call) Return() *MockPeerManager_SpawnOutgoingConnections_Call { + _c.Call.Return() + return _c +} + +func (_c *MockPeerManager_SpawnOutgoingConnections_Call) RunAndReturn(run func(context1 context.Context)) *MockPeerManager_SpawnOutgoingConnections_Call { + _c.Run(run) + return _c +} + +// Spawned provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) Spawned() []proto.IpPort { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Spawned") + } + + var r0 []proto.IpPort + if returnFunc, ok := ret.Get(0).(func() []proto.IpPort); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]proto.IpPort) + } + } + return r0 +} + +// MockPeerManager_Spawned_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Spawned' +type MockPeerManager_Spawned_Call struct { + *mock.Call +} + +// Spawned is a helper method to define mock.On call +func (_e *MockPeerManager_Expecter) Spawned() *MockPeerManager_Spawned_Call { + return &MockPeerManager_Spawned_Call{Call: _e.mock.On("Spawned")} +} + +func (_c *MockPeerManager_Spawned_Call) Run(run func()) *MockPeerManager_Spawned_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerManager_Spawned_Call) Return(ipPorts []proto.IpPort) *MockPeerManager_Spawned_Call { + _c.Call.Return(ipPorts) + return _c +} + +func (_c *MockPeerManager_Spawned_Call) RunAndReturn(run func() []proto.IpPort) *MockPeerManager_Spawned_Call { + _c.Call.Return(run) + return _c +} + +// Suspend provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) Suspend(peer1 peer.Peer, suspendTime time.Time, reason string) { + _mock.Called(peer1, suspendTime, reason) + return +} + +// MockPeerManager_Suspend_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Suspend' +type MockPeerManager_Suspend_Call struct { + *mock.Call +} + +// Suspend is a helper method to define mock.On call +// - peer1 peer.Peer +// - suspendTime time.Time +// - reason string +func (_e *MockPeerManager_Expecter) Suspend(peer1 interface{}, suspendTime interface{}, reason interface{}) *MockPeerManager_Suspend_Call { + return &MockPeerManager_Suspend_Call{Call: _e.mock.On("Suspend", peer1, suspendTime, reason)} +} + +func (_c *MockPeerManager_Suspend_Call) Run(run func(peer1 peer.Peer, suspendTime time.Time, reason string)) *MockPeerManager_Suspend_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 peer.Peer + if args[0] != nil { + arg0 = args[0].(peer.Peer) + } + var arg1 time.Time + if args[1] != nil { + arg1 = args[1].(time.Time) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockPeerManager_Suspend_Call) Return() *MockPeerManager_Suspend_Call { + _c.Call.Return() + return _c +} + +func (_c *MockPeerManager_Suspend_Call) RunAndReturn(run func(peer1 peer.Peer, suspendTime time.Time, reason string)) *MockPeerManager_Suspend_Call { + _c.Run(run) + return _c +} + +// Suspended provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) Suspended() []storage.SuspendedPeer { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Suspended") + } + + var r0 []storage.SuspendedPeer + if returnFunc, ok := ret.Get(0).(func() []storage.SuspendedPeer); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]storage.SuspendedPeer) + } + } + return r0 +} + +// MockPeerManager_Suspended_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Suspended' +type MockPeerManager_Suspended_Call struct { + *mock.Call +} + +// Suspended is a helper method to define mock.On call +func (_e *MockPeerManager_Expecter) Suspended() *MockPeerManager_Suspended_Call { + return &MockPeerManager_Suspended_Call{Call: _e.mock.On("Suspended")} +} + +func (_c *MockPeerManager_Suspended_Call) Run(run func()) *MockPeerManager_Suspended_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerManager_Suspended_Call) Return(vs []storage.SuspendedPeer) *MockPeerManager_Suspended_Call { + _c.Call.Return(vs) + return _c +} + +func (_c *MockPeerManager_Suspended_Call) RunAndReturn(run func() []storage.SuspendedPeer) *MockPeerManager_Suspended_Call { + _c.Call.Return(run) + return _c +} + +// UpdateKnownPeers provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) UpdateKnownPeers(knownPeers []storage.KnownPeer) error { + ret := _mock.Called(knownPeers) + + if len(ret) == 0 { + panic("no return value specified for UpdateKnownPeers") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([]storage.KnownPeer) error); ok { + r0 = returnFunc(knownPeers) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerManager_UpdateKnownPeers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateKnownPeers' +type MockPeerManager_UpdateKnownPeers_Call struct { + *mock.Call +} + +// UpdateKnownPeers is a helper method to define mock.On call +// - knownPeers []storage.KnownPeer +func (_e *MockPeerManager_Expecter) UpdateKnownPeers(knownPeers interface{}) *MockPeerManager_UpdateKnownPeers_Call { + return &MockPeerManager_UpdateKnownPeers_Call{Call: _e.mock.On("UpdateKnownPeers", knownPeers)} +} + +func (_c *MockPeerManager_UpdateKnownPeers_Call) Run(run func(knownPeers []storage.KnownPeer)) *MockPeerManager_UpdateKnownPeers_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.KnownPeer + if args[0] != nil { + arg0 = args[0].([]storage.KnownPeer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerManager_UpdateKnownPeers_Call) Return(err error) *MockPeerManager_UpdateKnownPeers_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerManager_UpdateKnownPeers_Call) RunAndReturn(run func(knownPeers []storage.KnownPeer) error) *MockPeerManager_UpdateKnownPeers_Call { + _c.Call.Return(run) + return _c +} + +// UpdateScore provides a mock function for the type MockPeerManager +func (_mock *MockPeerManager) UpdateScore(p peer.Peer, score *proto.Score) error { + ret := _mock.Called(p, score) + + if len(ret) == 0 { + panic("no return value specified for UpdateScore") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(peer.Peer, *proto.Score) error); ok { + r0 = returnFunc(p, score) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerManager_UpdateScore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateScore' +type MockPeerManager_UpdateScore_Call struct { + *mock.Call +} + +// UpdateScore is a helper method to define mock.On call +// - p peer.Peer +// - score *proto.Score +func (_e *MockPeerManager_Expecter) UpdateScore(p interface{}, score interface{}) *MockPeerManager_UpdateScore_Call { + return &MockPeerManager_UpdateScore_Call{Call: _e.mock.On("UpdateScore", p, score)} +} + +func (_c *MockPeerManager_UpdateScore_Call) Run(run func(p peer.Peer, score *proto.Score)) *MockPeerManager_UpdateScore_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 peer.Peer + if args[0] != nil { + arg0 = args[0].(peer.Peer) + } + var arg1 *proto.Score + if args[1] != nil { + arg1 = args[1].(*proto.Score) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockPeerManager_UpdateScore_Call) Return(err error) *MockPeerManager_UpdateScore_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerManager_UpdateScore_Call) RunAndReturn(run func(p peer.Peer, score *proto.Score) error) *MockPeerManager_UpdateScore_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/node/peers/mock_peer_storage_test.go b/pkg/node/peers/mock_peer_storage_test.go new file mode 100644 index 0000000000..f0a51439a2 --- /dev/null +++ b/pkg/node/peers/mock_peer_storage_test.go @@ -0,0 +1,1020 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package peers + +import ( + "time" + + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/node/peers/storage" +) + +// NewMockPeerStorage creates a new instance of MockPeerStorage. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockPeerStorage(t interface { + mock.TestingT + Cleanup(func()) +}) *MockPeerStorage { + mock := &MockPeerStorage{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockPeerStorage is an autogenerated mock type for the PeerStorage type +type MockPeerStorage struct { + mock.Mock +} + +type MockPeerStorage_Expecter struct { + mock *mock.Mock +} + +func (_m *MockPeerStorage) EXPECT() *MockPeerStorage_Expecter { + return &MockPeerStorage_Expecter{mock: &_m.Mock} +} + +// AddOrUpdateKnown provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) AddOrUpdateKnown(known []storage.KnownPeer, now time.Time) error { + ret := _mock.Called(known, now) + + if len(ret) == 0 { + panic("no return value specified for AddOrUpdateKnown") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([]storage.KnownPeer, time.Time) error); ok { + r0 = returnFunc(known, now) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_AddOrUpdateKnown_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddOrUpdateKnown' +type MockPeerStorage_AddOrUpdateKnown_Call struct { + *mock.Call +} + +// AddOrUpdateKnown is a helper method to define mock.On call +// - known []storage.KnownPeer +// - now time.Time +func (_e *MockPeerStorage_Expecter) AddOrUpdateKnown(known interface{}, now interface{}) *MockPeerStorage_AddOrUpdateKnown_Call { + return &MockPeerStorage_AddOrUpdateKnown_Call{Call: _e.mock.On("AddOrUpdateKnown", known, now)} +} + +func (_c *MockPeerStorage_AddOrUpdateKnown_Call) Run(run func(known []storage.KnownPeer, now time.Time)) *MockPeerStorage_AddOrUpdateKnown_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.KnownPeer + if args[0] != nil { + arg0 = args[0].([]storage.KnownPeer) + } + var arg1 time.Time + if args[1] != nil { + arg1 = args[1].(time.Time) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockPeerStorage_AddOrUpdateKnown_Call) Return(err error) *MockPeerStorage_AddOrUpdateKnown_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_AddOrUpdateKnown_Call) RunAndReturn(run func(known []storage.KnownPeer, now time.Time) error) *MockPeerStorage_AddOrUpdateKnown_Call { + _c.Call.Return(run) + return _c +} + +// AddSuspended provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) AddSuspended(suspended []storage.SuspendedPeer) error { + ret := _mock.Called(suspended) + + if len(ret) == 0 { + panic("no return value specified for AddSuspended") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([]storage.SuspendedPeer) error); ok { + r0 = returnFunc(suspended) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_AddSuspended_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddSuspended' +type MockPeerStorage_AddSuspended_Call struct { + *mock.Call +} + +// AddSuspended is a helper method to define mock.On call +// - suspended []storage.SuspendedPeer +func (_e *MockPeerStorage_Expecter) AddSuspended(suspended interface{}) *MockPeerStorage_AddSuspended_Call { + return &MockPeerStorage_AddSuspended_Call{Call: _e.mock.On("AddSuspended", suspended)} +} + +func (_c *MockPeerStorage_AddSuspended_Call) Run(run func(suspended []storage.SuspendedPeer)) *MockPeerStorage_AddSuspended_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.SuspendedPeer + if args[0] != nil { + arg0 = args[0].([]storage.SuspendedPeer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_AddSuspended_Call) Return(err error) *MockPeerStorage_AddSuspended_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_AddSuspended_Call) RunAndReturn(run func(suspended []storage.SuspendedPeer) error) *MockPeerStorage_AddSuspended_Call { + _c.Call.Return(run) + return _c +} + +// AddToBlackList provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) AddToBlackList(blackListed []storage.BlackListedPeer) error { + ret := _mock.Called(blackListed) + + if len(ret) == 0 { + panic("no return value specified for AddToBlackList") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([]storage.BlackListedPeer) error); ok { + r0 = returnFunc(blackListed) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_AddToBlackList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddToBlackList' +type MockPeerStorage_AddToBlackList_Call struct { + *mock.Call +} + +// AddToBlackList is a helper method to define mock.On call +// - blackListed []storage.BlackListedPeer +func (_e *MockPeerStorage_Expecter) AddToBlackList(blackListed interface{}) *MockPeerStorage_AddToBlackList_Call { + return &MockPeerStorage_AddToBlackList_Call{Call: _e.mock.On("AddToBlackList", blackListed)} +} + +func (_c *MockPeerStorage_AddToBlackList_Call) Run(run func(blackListed []storage.BlackListedPeer)) *MockPeerStorage_AddToBlackList_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.BlackListedPeer + if args[0] != nil { + arg0 = args[0].([]storage.BlackListedPeer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_AddToBlackList_Call) Return(err error) *MockPeerStorage_AddToBlackList_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_AddToBlackList_Call) RunAndReturn(run func(blackListed []storage.BlackListedPeer) error) *MockPeerStorage_AddToBlackList_Call { + _c.Call.Return(run) + return _c +} + +// BlackList provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) BlackList(now time.Time) []storage.BlackListedPeer { + ret := _mock.Called(now) + + if len(ret) == 0 { + panic("no return value specified for BlackList") + } + + var r0 []storage.BlackListedPeer + if returnFunc, ok := ret.Get(0).(func(time.Time) []storage.BlackListedPeer); ok { + r0 = returnFunc(now) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]storage.BlackListedPeer) + } + } + return r0 +} + +// MockPeerStorage_BlackList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlackList' +type MockPeerStorage_BlackList_Call struct { + *mock.Call +} + +// BlackList is a helper method to define mock.On call +// - now time.Time +func (_e *MockPeerStorage_Expecter) BlackList(now interface{}) *MockPeerStorage_BlackList_Call { + return &MockPeerStorage_BlackList_Call{Call: _e.mock.On("BlackList", now)} +} + +func (_c *MockPeerStorage_BlackList_Call) Run(run func(now time.Time)) *MockPeerStorage_BlackList_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 time.Time + if args[0] != nil { + arg0 = args[0].(time.Time) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_BlackList_Call) Return(vs []storage.BlackListedPeer) *MockPeerStorage_BlackList_Call { + _c.Call.Return(vs) + return _c +} + +func (_c *MockPeerStorage_BlackList_Call) RunAndReturn(run func(now time.Time) []storage.BlackListedPeer) *MockPeerStorage_BlackList_Call { + _c.Call.Return(run) + return _c +} + +// DeleteBlackListedByIP provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) DeleteBlackListedByIP(blackListed []storage.BlackListedPeer) error { + ret := _mock.Called(blackListed) + + if len(ret) == 0 { + panic("no return value specified for DeleteBlackListedByIP") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([]storage.BlackListedPeer) error); ok { + r0 = returnFunc(blackListed) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_DeleteBlackListedByIP_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBlackListedByIP' +type MockPeerStorage_DeleteBlackListedByIP_Call struct { + *mock.Call +} + +// DeleteBlackListedByIP is a helper method to define mock.On call +// - blackListed []storage.BlackListedPeer +func (_e *MockPeerStorage_Expecter) DeleteBlackListedByIP(blackListed interface{}) *MockPeerStorage_DeleteBlackListedByIP_Call { + return &MockPeerStorage_DeleteBlackListedByIP_Call{Call: _e.mock.On("DeleteBlackListedByIP", blackListed)} +} + +func (_c *MockPeerStorage_DeleteBlackListedByIP_Call) Run(run func(blackListed []storage.BlackListedPeer)) *MockPeerStorage_DeleteBlackListedByIP_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.BlackListedPeer + if args[0] != nil { + arg0 = args[0].([]storage.BlackListedPeer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_DeleteBlackListedByIP_Call) Return(err error) *MockPeerStorage_DeleteBlackListedByIP_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_DeleteBlackListedByIP_Call) RunAndReturn(run func(blackListed []storage.BlackListedPeer) error) *MockPeerStorage_DeleteBlackListedByIP_Call { + _c.Call.Return(run) + return _c +} + +// DeleteKnown provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) DeleteKnown(known []storage.KnownPeer) error { + ret := _mock.Called(known) + + if len(ret) == 0 { + panic("no return value specified for DeleteKnown") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([]storage.KnownPeer) error); ok { + r0 = returnFunc(known) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_DeleteKnown_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteKnown' +type MockPeerStorage_DeleteKnown_Call struct { + *mock.Call +} + +// DeleteKnown is a helper method to define mock.On call +// - known []storage.KnownPeer +func (_e *MockPeerStorage_Expecter) DeleteKnown(known interface{}) *MockPeerStorage_DeleteKnown_Call { + return &MockPeerStorage_DeleteKnown_Call{Call: _e.mock.On("DeleteKnown", known)} +} + +func (_c *MockPeerStorage_DeleteKnown_Call) Run(run func(known []storage.KnownPeer)) *MockPeerStorage_DeleteKnown_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.KnownPeer + if args[0] != nil { + arg0 = args[0].([]storage.KnownPeer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_DeleteKnown_Call) Return(err error) *MockPeerStorage_DeleteKnown_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_DeleteKnown_Call) RunAndReturn(run func(known []storage.KnownPeer) error) *MockPeerStorage_DeleteKnown_Call { + _c.Call.Return(run) + return _c +} + +// DeleteSuspendedByIP provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) DeleteSuspendedByIP(suspended []storage.SuspendedPeer) error { + ret := _mock.Called(suspended) + + if len(ret) == 0 { + panic("no return value specified for DeleteSuspendedByIP") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([]storage.SuspendedPeer) error); ok { + r0 = returnFunc(suspended) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_DeleteSuspendedByIP_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteSuspendedByIP' +type MockPeerStorage_DeleteSuspendedByIP_Call struct { + *mock.Call +} + +// DeleteSuspendedByIP is a helper method to define mock.On call +// - suspended []storage.SuspendedPeer +func (_e *MockPeerStorage_Expecter) DeleteSuspendedByIP(suspended interface{}) *MockPeerStorage_DeleteSuspendedByIP_Call { + return &MockPeerStorage_DeleteSuspendedByIP_Call{Call: _e.mock.On("DeleteSuspendedByIP", suspended)} +} + +func (_c *MockPeerStorage_DeleteSuspendedByIP_Call) Run(run func(suspended []storage.SuspendedPeer)) *MockPeerStorage_DeleteSuspendedByIP_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.SuspendedPeer + if args[0] != nil { + arg0 = args[0].([]storage.SuspendedPeer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_DeleteSuspendedByIP_Call) Return(err error) *MockPeerStorage_DeleteSuspendedByIP_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_DeleteSuspendedByIP_Call) RunAndReturn(run func(suspended []storage.SuspendedPeer) error) *MockPeerStorage_DeleteSuspendedByIP_Call { + _c.Call.Return(run) + return _c +} + +// DropBlackList provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) DropBlackList() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for DropBlackList") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_DropBlackList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropBlackList' +type MockPeerStorage_DropBlackList_Call struct { + *mock.Call +} + +// DropBlackList is a helper method to define mock.On call +func (_e *MockPeerStorage_Expecter) DropBlackList() *MockPeerStorage_DropBlackList_Call { + return &MockPeerStorage_DropBlackList_Call{Call: _e.mock.On("DropBlackList")} +} + +func (_c *MockPeerStorage_DropBlackList_Call) Run(run func()) *MockPeerStorage_DropBlackList_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerStorage_DropBlackList_Call) Return(err error) *MockPeerStorage_DropBlackList_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_DropBlackList_Call) RunAndReturn(run func() error) *MockPeerStorage_DropBlackList_Call { + _c.Call.Return(run) + return _c +} + +// DropKnown provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) DropKnown() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for DropKnown") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_DropKnown_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropKnown' +type MockPeerStorage_DropKnown_Call struct { + *mock.Call +} + +// DropKnown is a helper method to define mock.On call +func (_e *MockPeerStorage_Expecter) DropKnown() *MockPeerStorage_DropKnown_Call { + return &MockPeerStorage_DropKnown_Call{Call: _e.mock.On("DropKnown")} +} + +func (_c *MockPeerStorage_DropKnown_Call) Run(run func()) *MockPeerStorage_DropKnown_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerStorage_DropKnown_Call) Return(err error) *MockPeerStorage_DropKnown_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_DropKnown_Call) RunAndReturn(run func() error) *MockPeerStorage_DropKnown_Call { + _c.Call.Return(run) + return _c +} + +// DropStorage provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) DropStorage() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for DropStorage") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_DropStorage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropStorage' +type MockPeerStorage_DropStorage_Call struct { + *mock.Call +} + +// DropStorage is a helper method to define mock.On call +func (_e *MockPeerStorage_Expecter) DropStorage() *MockPeerStorage_DropStorage_Call { + return &MockPeerStorage_DropStorage_Call{Call: _e.mock.On("DropStorage")} +} + +func (_c *MockPeerStorage_DropStorage_Call) Run(run func()) *MockPeerStorage_DropStorage_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerStorage_DropStorage_Call) Return(err error) *MockPeerStorage_DropStorage_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_DropStorage_Call) RunAndReturn(run func() error) *MockPeerStorage_DropStorage_Call { + _c.Call.Return(run) + return _c +} + +// DropSuspended provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) DropSuspended() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for DropSuspended") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_DropSuspended_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropSuspended' +type MockPeerStorage_DropSuspended_Call struct { + *mock.Call +} + +// DropSuspended is a helper method to define mock.On call +func (_e *MockPeerStorage_Expecter) DropSuspended() *MockPeerStorage_DropSuspended_Call { + return &MockPeerStorage_DropSuspended_Call{Call: _e.mock.On("DropSuspended")} +} + +func (_c *MockPeerStorage_DropSuspended_Call) Run(run func()) *MockPeerStorage_DropSuspended_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeerStorage_DropSuspended_Call) Return(err error) *MockPeerStorage_DropSuspended_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_DropSuspended_Call) RunAndReturn(run func() error) *MockPeerStorage_DropSuspended_Call { + _c.Call.Return(run) + return _c +} + +// IsBlackListedIP provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) IsBlackListedIP(ip storage.IP, now time.Time) bool { + ret := _mock.Called(ip, now) + + if len(ret) == 0 { + panic("no return value specified for IsBlackListedIP") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(storage.IP, time.Time) bool); ok { + r0 = returnFunc(ip, now) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockPeerStorage_IsBlackListedIP_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsBlackListedIP' +type MockPeerStorage_IsBlackListedIP_Call struct { + *mock.Call +} + +// IsBlackListedIP is a helper method to define mock.On call +// - ip storage.IP +// - now time.Time +func (_e *MockPeerStorage_Expecter) IsBlackListedIP(ip interface{}, now interface{}) *MockPeerStorage_IsBlackListedIP_Call { + return &MockPeerStorage_IsBlackListedIP_Call{Call: _e.mock.On("IsBlackListedIP", ip, now)} +} + +func (_c *MockPeerStorage_IsBlackListedIP_Call) Run(run func(ip storage.IP, now time.Time)) *MockPeerStorage_IsBlackListedIP_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 storage.IP + if args[0] != nil { + arg0 = args[0].(storage.IP) + } + var arg1 time.Time + if args[1] != nil { + arg1 = args[1].(time.Time) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockPeerStorage_IsBlackListedIP_Call) Return(b bool) *MockPeerStorage_IsBlackListedIP_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockPeerStorage_IsBlackListedIP_Call) RunAndReturn(run func(ip storage.IP, now time.Time) bool) *MockPeerStorage_IsBlackListedIP_Call { + _c.Call.Return(run) + return _c +} + +// IsBlackListedIPs provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) IsBlackListedIPs(ips []storage.IP, now time.Time) []bool { + ret := _mock.Called(ips, now) + + if len(ret) == 0 { + panic("no return value specified for IsBlackListedIPs") + } + + var r0 []bool + if returnFunc, ok := ret.Get(0).(func([]storage.IP, time.Time) []bool); ok { + r0 = returnFunc(ips, now) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]bool) + } + } + return r0 +} + +// MockPeerStorage_IsBlackListedIPs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsBlackListedIPs' +type MockPeerStorage_IsBlackListedIPs_Call struct { + *mock.Call +} + +// IsBlackListedIPs is a helper method to define mock.On call +// - ips []storage.IP +// - now time.Time +func (_e *MockPeerStorage_Expecter) IsBlackListedIPs(ips interface{}, now interface{}) *MockPeerStorage_IsBlackListedIPs_Call { + return &MockPeerStorage_IsBlackListedIPs_Call{Call: _e.mock.On("IsBlackListedIPs", ips, now)} +} + +func (_c *MockPeerStorage_IsBlackListedIPs_Call) Run(run func(ips []storage.IP, now time.Time)) *MockPeerStorage_IsBlackListedIPs_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.IP + if args[0] != nil { + arg0 = args[0].([]storage.IP) + } + var arg1 time.Time + if args[1] != nil { + arg1 = args[1].(time.Time) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockPeerStorage_IsBlackListedIPs_Call) Return(bools []bool) *MockPeerStorage_IsBlackListedIPs_Call { + _c.Call.Return(bools) + return _c +} + +func (_c *MockPeerStorage_IsBlackListedIPs_Call) RunAndReturn(run func(ips []storage.IP, now time.Time) []bool) *MockPeerStorage_IsBlackListedIPs_Call { + _c.Call.Return(run) + return _c +} + +// IsSuspendedIP provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) IsSuspendedIP(ip storage.IP, now time.Time) bool { + ret := _mock.Called(ip, now) + + if len(ret) == 0 { + panic("no return value specified for IsSuspendedIP") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(storage.IP, time.Time) bool); ok { + r0 = returnFunc(ip, now) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockPeerStorage_IsSuspendedIP_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsSuspendedIP' +type MockPeerStorage_IsSuspendedIP_Call struct { + *mock.Call +} + +// IsSuspendedIP is a helper method to define mock.On call +// - ip storage.IP +// - now time.Time +func (_e *MockPeerStorage_Expecter) IsSuspendedIP(ip interface{}, now interface{}) *MockPeerStorage_IsSuspendedIP_Call { + return &MockPeerStorage_IsSuspendedIP_Call{Call: _e.mock.On("IsSuspendedIP", ip, now)} +} + +func (_c *MockPeerStorage_IsSuspendedIP_Call) Run(run func(ip storage.IP, now time.Time)) *MockPeerStorage_IsSuspendedIP_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 storage.IP + if args[0] != nil { + arg0 = args[0].(storage.IP) + } + var arg1 time.Time + if args[1] != nil { + arg1 = args[1].(time.Time) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockPeerStorage_IsSuspendedIP_Call) Return(b bool) *MockPeerStorage_IsSuspendedIP_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockPeerStorage_IsSuspendedIP_Call) RunAndReturn(run func(ip storage.IP, now time.Time) bool) *MockPeerStorage_IsSuspendedIP_Call { + _c.Call.Return(run) + return _c +} + +// IsSuspendedIPs provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) IsSuspendedIPs(ips []storage.IP, now time.Time) []bool { + ret := _mock.Called(ips, now) + + if len(ret) == 0 { + panic("no return value specified for IsSuspendedIPs") + } + + var r0 []bool + if returnFunc, ok := ret.Get(0).(func([]storage.IP, time.Time) []bool); ok { + r0 = returnFunc(ips, now) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]bool) + } + } + return r0 +} + +// MockPeerStorage_IsSuspendedIPs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsSuspendedIPs' +type MockPeerStorage_IsSuspendedIPs_Call struct { + *mock.Call +} + +// IsSuspendedIPs is a helper method to define mock.On call +// - ips []storage.IP +// - now time.Time +func (_e *MockPeerStorage_Expecter) IsSuspendedIPs(ips interface{}, now interface{}) *MockPeerStorage_IsSuspendedIPs_Call { + return &MockPeerStorage_IsSuspendedIPs_Call{Call: _e.mock.On("IsSuspendedIPs", ips, now)} +} + +func (_c *MockPeerStorage_IsSuspendedIPs_Call) Run(run func(ips []storage.IP, now time.Time)) *MockPeerStorage_IsSuspendedIPs_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []storage.IP + if args[0] != nil { + arg0 = args[0].([]storage.IP) + } + var arg1 time.Time + if args[1] != nil { + arg1 = args[1].(time.Time) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockPeerStorage_IsSuspendedIPs_Call) Return(bools []bool) *MockPeerStorage_IsSuspendedIPs_Call { + _c.Call.Return(bools) + return _c +} + +func (_c *MockPeerStorage_IsSuspendedIPs_Call) RunAndReturn(run func(ips []storage.IP, now time.Time) []bool) *MockPeerStorage_IsSuspendedIPs_Call { + _c.Call.Return(run) + return _c +} + +// Known provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) Known(limit int) []storage.KnownPeer { + ret := _mock.Called(limit) + + if len(ret) == 0 { + panic("no return value specified for Known") + } + + var r0 []storage.KnownPeer + if returnFunc, ok := ret.Get(0).(func(int) []storage.KnownPeer); ok { + r0 = returnFunc(limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]storage.KnownPeer) + } + } + return r0 +} + +// MockPeerStorage_Known_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Known' +type MockPeerStorage_Known_Call struct { + *mock.Call +} + +// Known is a helper method to define mock.On call +// - limit int +func (_e *MockPeerStorage_Expecter) Known(limit interface{}) *MockPeerStorage_Known_Call { + return &MockPeerStorage_Known_Call{Call: _e.mock.On("Known", limit)} +} + +func (_c *MockPeerStorage_Known_Call) Run(run func(limit int)) *MockPeerStorage_Known_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int + if args[0] != nil { + arg0 = args[0].(int) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_Known_Call) Return(knownPeers []storage.KnownPeer) *MockPeerStorage_Known_Call { + _c.Call.Return(knownPeers) + return _c +} + +func (_c *MockPeerStorage_Known_Call) RunAndReturn(run func(limit int) []storage.KnownPeer) *MockPeerStorage_Known_Call { + _c.Call.Return(run) + return _c +} + +// RefreshBlackList provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) RefreshBlackList(now time.Time) error { + ret := _mock.Called(now) + + if len(ret) == 0 { + panic("no return value specified for RefreshBlackList") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(time.Time) error); ok { + r0 = returnFunc(now) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_RefreshBlackList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshBlackList' +type MockPeerStorage_RefreshBlackList_Call struct { + *mock.Call +} + +// RefreshBlackList is a helper method to define mock.On call +// - now time.Time +func (_e *MockPeerStorage_Expecter) RefreshBlackList(now interface{}) *MockPeerStorage_RefreshBlackList_Call { + return &MockPeerStorage_RefreshBlackList_Call{Call: _e.mock.On("RefreshBlackList", now)} +} + +func (_c *MockPeerStorage_RefreshBlackList_Call) Run(run func(now time.Time)) *MockPeerStorage_RefreshBlackList_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 time.Time + if args[0] != nil { + arg0 = args[0].(time.Time) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_RefreshBlackList_Call) Return(err error) *MockPeerStorage_RefreshBlackList_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_RefreshBlackList_Call) RunAndReturn(run func(now time.Time) error) *MockPeerStorage_RefreshBlackList_Call { + _c.Call.Return(run) + return _c +} + +// RefreshSuspended provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) RefreshSuspended(now time.Time) error { + ret := _mock.Called(now) + + if len(ret) == 0 { + panic("no return value specified for RefreshSuspended") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(time.Time) error); ok { + r0 = returnFunc(now) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeerStorage_RefreshSuspended_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshSuspended' +type MockPeerStorage_RefreshSuspended_Call struct { + *mock.Call +} + +// RefreshSuspended is a helper method to define mock.On call +// - now time.Time +func (_e *MockPeerStorage_Expecter) RefreshSuspended(now interface{}) *MockPeerStorage_RefreshSuspended_Call { + return &MockPeerStorage_RefreshSuspended_Call{Call: _e.mock.On("RefreshSuspended", now)} +} + +func (_c *MockPeerStorage_RefreshSuspended_Call) Run(run func(now time.Time)) *MockPeerStorage_RefreshSuspended_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 time.Time + if args[0] != nil { + arg0 = args[0].(time.Time) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_RefreshSuspended_Call) Return(err error) *MockPeerStorage_RefreshSuspended_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeerStorage_RefreshSuspended_Call) RunAndReturn(run func(now time.Time) error) *MockPeerStorage_RefreshSuspended_Call { + _c.Call.Return(run) + return _c +} + +// Suspended provides a mock function for the type MockPeerStorage +func (_mock *MockPeerStorage) Suspended(now time.Time) []storage.SuspendedPeer { + ret := _mock.Called(now) + + if len(ret) == 0 { + panic("no return value specified for Suspended") + } + + var r0 []storage.SuspendedPeer + if returnFunc, ok := ret.Get(0).(func(time.Time) []storage.SuspendedPeer); ok { + r0 = returnFunc(now) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]storage.SuspendedPeer) + } + } + return r0 +} + +// MockPeerStorage_Suspended_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Suspended' +type MockPeerStorage_Suspended_Call struct { + *mock.Call +} + +// Suspended is a helper method to define mock.On call +// - now time.Time +func (_e *MockPeerStorage_Expecter) Suspended(now interface{}) *MockPeerStorage_Suspended_Call { + return &MockPeerStorage_Suspended_Call{Call: _e.mock.On("Suspended", now)} +} + +func (_c *MockPeerStorage_Suspended_Call) Run(run func(now time.Time)) *MockPeerStorage_Suspended_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 time.Time + if args[0] != nil { + arg0 = args[0].(time.Time) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeerStorage_Suspended_Call) Return(vs []storage.SuspendedPeer) *MockPeerStorage_Suspended_Call { + _c.Call.Return(vs) + return _c +} + +func (_c *MockPeerStorage_Suspended_Call) RunAndReturn(run func(now time.Time) []storage.SuspendedPeer) *MockPeerStorage_Suspended_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/node/peers/peer_storage_internal_test.go b/pkg/node/peers/peer_storage_internal_test.go index a14179e34d..4267a5d0a4 100644 --- a/pkg/node/peers/peer_storage_internal_test.go +++ b/pkg/node/peers/peer_storage_internal_test.go @@ -5,36 +5,29 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" - - "github.com/wavesplatform/gowaves/pkg/mock" "github.com/wavesplatform/gowaves/pkg/node/peers/storage" + "github.com/wavesplatform/gowaves/pkg/p2p/peer" "github.com/wavesplatform/gowaves/pkg/proto" ) func TestPeerManagerImpl_Suspend(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - now := time.Now() tcpAddr := proto.NewTCPAddrFromString("32.34.46.1:4535") reason := "some-reason" - p := mock.NewMockPeer(ctrl) - gomock.InOrder( - p.EXPECT().ID(), - p.EXPECT().Close(), - p.EXPECT().RemoteAddr().Return(tcpAddr), - p.EXPECT().ID(), - ) + p := peer.NewMockPeer(t) + p.EXPECT().ID().Return(nil) + p.EXPECT().Close().Return(nil) + p.EXPECT().RemoteAddr().Return(tcpAddr) + p.EXPECT().ID().Return(nil) - peerStorage := mock.NewMockPeerStorage(ctrl) + peerStorage := NewMockPeerStorage(t) peerStorage.EXPECT().AddSuspended([]storage.SuspendedPeer{{ IP: storage.IpFromIpPort(tcpAddr.ToIpPort()), RestrictTimestampMillis: now.UnixMilli(), RestrictDuration: suspendDuration, Reason: reason, - }}) + }}).Return(nil) manager := PeerManagerImpl{ peerStorage: peerStorage, diff --git a/pkg/p2p/conn/conn.go b/pkg/p2p/conn/conn.go index b672cc9663..aea154ce38 100644 --- a/pkg/p2p/conn/conn.go +++ b/pkg/p2p/conn/conn.go @@ -34,7 +34,6 @@ type readDeadlineSetter interface { SetReadDeadline(t time.Time) error } -//go:generate moq -out deadline_reader_moq.go ./ deadlineReader:mockDeadlineReader type deadlineReader interface { io.Reader readDeadlineSetter diff --git a/pkg/p2p/conn/conn_test.go b/pkg/p2p/conn/conn_test.go index 280ec41fc7..88cdad4e9d 100644 --- a/pkg/p2p/conn/conn_test.go +++ b/pkg/p2p/conn/conn_test.go @@ -10,8 +10,10 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/valyala/bytebufferpool" + "github.com/wavesplatform/gowaves/pkg/proto" "github.com/wavesplatform/gowaves/pkg/util/byte_helpers" ) @@ -65,22 +67,22 @@ func TestRecvFromRemote_Transaction(t *testing.T) { nowFn := func() time.Time { return now } filter := func(headerBytes proto.Header) bool { return false } - var rdr *mockDeadlineReader - rdr = &mockDeadlineReader{ - ReadFunc: bytes.NewReader(messBytes).Read, - SetReadDeadlineFunc: func(tm time.Time) error { - if len(rdr.SetReadDeadlineCalls())%2 == 1 { - assert.Equal(t, now.Add(MaxConnIdleIODuration), tm) - } else { - assert.Equal(t, now.Add(maxConnIODurationPerMessage), tm) - } - return nil - }, - } + rdr := NewMockDeadlineReader(t) + rdr.EXPECT().Read(mock.Anything).RunAndReturn(bytes.NewReader(messBytes).Read).Maybe() + setDeadlineCallCount := 0 + rdr.EXPECT().SetReadDeadline(mock.Anything).RunAndReturn(func(tm time.Time) error { + setDeadlineCallCount++ + if setDeadlineCallCount%2 == 1 { + assert.Equal(t, now.Add(MaxConnIdleIODuration), tm) + } else { + assert.Equal(t, now.Add(maxConnIODurationPerMessage), tm) + } + return nil + }).Maybe() err := receiveFromRemote(rdr, fromRemoteCh, filter, "test", nowFn, slog.New(slog.DiscardHandler)) require.ErrorIs(t, err, io.EOF) - assert.Len(t, rdr.SetReadDeadlineCalls(), 3) + assert.Equal(t, 3, setDeadlineCallCount) bb := <-fromRemoteCh assert.Equal(t, messBytes, bb.Bytes()) diff --git a/pkg/p2p/conn/deadline_reader_moq.go b/pkg/p2p/conn/deadline_reader_moq.go deleted file mode 100644 index 5138a321a7..0000000000 --- a/pkg/p2p/conn/deadline_reader_moq.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package conn - -import ( - "sync" - "time" -) - -// Ensure, that mockDeadlineReader does implement deadlineReader. -// If this is not the case, regenerate this file with moq. -var _ deadlineReader = &mockDeadlineReader{} - -// mockDeadlineReader is a mock implementation of deadlineReader. -// -// func TestSomethingThatUsesdeadlineReader(t *testing.T) { -// -// // make and configure a mocked deadlineReader -// mockeddeadlineReader := &mockDeadlineReader{ -// ReadFunc: func(p []byte) (int, error) { -// panic("mock out the Read method") -// }, -// SetReadDeadlineFunc: func(t time.Time) error { -// panic("mock out the SetReadDeadline method") -// }, -// } -// -// // use mockeddeadlineReader in code that requires deadlineReader -// // and then make assertions. -// -// } -type mockDeadlineReader struct { - // ReadFunc mocks the Read method. - ReadFunc func(p []byte) (int, error) - - // SetReadDeadlineFunc mocks the SetReadDeadline method. - SetReadDeadlineFunc func(t time.Time) error - - // calls tracks calls to the methods. - calls struct { - // Read holds details about calls to the Read method. - Read []struct { - // P is the p argument value. - P []byte - } - // SetReadDeadline holds details about calls to the SetReadDeadline method. - SetReadDeadline []struct { - // T is the t argument value. - T time.Time - } - } - lockRead sync.RWMutex - lockSetReadDeadline sync.RWMutex -} - -// Read calls ReadFunc. -func (mock *mockDeadlineReader) Read(p []byte) (int, error) { - if mock.ReadFunc == nil { - panic("mockDeadlineReader.ReadFunc: method is nil but deadlineReader.Read was just called") - } - callInfo := struct { - P []byte - }{ - P: p, - } - mock.lockRead.Lock() - mock.calls.Read = append(mock.calls.Read, callInfo) - mock.lockRead.Unlock() - return mock.ReadFunc(p) -} - -// ReadCalls gets all the calls that were made to Read. -// Check the length with: -// -// len(mockeddeadlineReader.ReadCalls()) -func (mock *mockDeadlineReader) ReadCalls() []struct { - P []byte -} { - var calls []struct { - P []byte - } - mock.lockRead.RLock() - calls = mock.calls.Read - mock.lockRead.RUnlock() - return calls -} - -// SetReadDeadline calls SetReadDeadlineFunc. -func (mock *mockDeadlineReader) SetReadDeadline(t time.Time) error { - if mock.SetReadDeadlineFunc == nil { - panic("mockDeadlineReader.SetReadDeadlineFunc: method is nil but deadlineReader.SetReadDeadline was just called") - } - callInfo := struct { - T time.Time - }{ - T: t, - } - mock.lockSetReadDeadline.Lock() - mock.calls.SetReadDeadline = append(mock.calls.SetReadDeadline, callInfo) - mock.lockSetReadDeadline.Unlock() - return mock.SetReadDeadlineFunc(t) -} - -// SetReadDeadlineCalls gets all the calls that were made to SetReadDeadline. -// Check the length with: -// -// len(mockeddeadlineReader.SetReadDeadlineCalls()) -func (mock *mockDeadlineReader) SetReadDeadlineCalls() []struct { - T time.Time -} { - var calls []struct { - T time.Time - } - mock.lockSetReadDeadline.RLock() - calls = mock.calls.SetReadDeadline - mock.lockSetReadDeadline.RUnlock() - return calls -} diff --git a/pkg/p2p/conn/mock_deadline_reader_test.go b/pkg/p2p/conn/mock_deadline_reader_test.go new file mode 100644 index 0000000000..3dbd14aae6 --- /dev/null +++ b/pkg/p2p/conn/mock_deadline_reader_test.go @@ -0,0 +1,149 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package conn + +import ( + "time" + + mock "github.com/stretchr/testify/mock" +) + +// NewMockDeadlineReader creates a new instance of MockDeadlineReader. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockDeadlineReader(t interface { + mock.TestingT + Cleanup(func()) +}) *MockDeadlineReader { + mock := &MockDeadlineReader{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockDeadlineReader is an autogenerated mock type for the deadlineReader type +type MockDeadlineReader struct { + mock.Mock +} + +type MockDeadlineReader_Expecter struct { + mock *mock.Mock +} + +func (_m *MockDeadlineReader) EXPECT() *MockDeadlineReader_Expecter { + return &MockDeadlineReader_Expecter{mock: &_m.Mock} +} + +// Read provides a mock function for the type MockDeadlineReader +func (_mock *MockDeadlineReader) Read(p []byte) (int, error) { + ret := _mock.Called(p) + + if len(ret) == 0 { + panic("no return value specified for Read") + } + + var r0 int + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (int, error)); ok { + return returnFunc(p) + } + if returnFunc, ok := ret.Get(0).(func([]byte) int); ok { + r0 = returnFunc(p) + } else { + r0 = ret.Get(0).(int) + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(p) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockDeadlineReader_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read' +type MockDeadlineReader_Read_Call struct { + *mock.Call +} + +// Read is a helper method to define mock.On call +// - p []byte +func (_e *MockDeadlineReader_Expecter) Read(p interface{}) *MockDeadlineReader_Read_Call { + return &MockDeadlineReader_Read_Call{Call: _e.mock.On("Read", p)} +} + +func (_c *MockDeadlineReader_Read_Call) Run(run func(p []byte)) *MockDeadlineReader_Read_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockDeadlineReader_Read_Call) Return(n int, err error) *MockDeadlineReader_Read_Call { + _c.Call.Return(n, err) + return _c +} + +func (_c *MockDeadlineReader_Read_Call) RunAndReturn(run func(p []byte) (int, error)) *MockDeadlineReader_Read_Call { + _c.Call.Return(run) + return _c +} + +// SetReadDeadline provides a mock function for the type MockDeadlineReader +func (_mock *MockDeadlineReader) SetReadDeadline(t time.Time) error { + ret := _mock.Called(t) + + if len(ret) == 0 { + panic("no return value specified for SetReadDeadline") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(time.Time) error); ok { + r0 = returnFunc(t) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockDeadlineReader_SetReadDeadline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetReadDeadline' +type MockDeadlineReader_SetReadDeadline_Call struct { + *mock.Call +} + +// SetReadDeadline is a helper method to define mock.On call +// - t time.Time +func (_e *MockDeadlineReader_Expecter) SetReadDeadline(t interface{}) *MockDeadlineReader_SetReadDeadline_Call { + return &MockDeadlineReader_SetReadDeadline_Call{Call: _e.mock.On("SetReadDeadline", t)} +} + +func (_c *MockDeadlineReader_SetReadDeadline_Call) Run(run func(t time.Time)) *MockDeadlineReader_SetReadDeadline_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 time.Time + if args[0] != nil { + arg0 = args[0].(time.Time) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockDeadlineReader_SetReadDeadline_Call) Return(err error) *MockDeadlineReader_SetReadDeadline_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockDeadlineReader_SetReadDeadline_Call) RunAndReturn(run func(t time.Time) error) *MockDeadlineReader_SetReadDeadline_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/p2p/peer/handle_test.go b/pkg/p2p/peer/handle_test.go index 4b43ba12d9..81213ebddc 100644 --- a/pkg/p2p/peer/handle_test.go +++ b/pkg/p2p/peer/handle_test.go @@ -32,10 +32,10 @@ func TestHandleStopContext(t *testing.T) { }() parent := NewParent(false) remote := NewRemote() - peer := &mockPeer{CloseFunc: func() error { return nil }} + peer := NewMockPeer(t) + peer.EXPECT().Close().Return(nil).Times(1) err := Handle(ctx, peer, parent, remote, slog.New(slog.DiscardHandler), slog.New(slog.DiscardHandler)) assert.NoError(t, err) - assert.Len(t, peer.CloseCalls(), 1) require.Len(t, parent.InfoCh, 1) connected := (<-parent.InfoCh).Value.(*Connected) connectedPeer := connected.Peer.(*peerOnceCloser).Peer @@ -49,12 +49,10 @@ func TestHandleReceive(t *testing.T) { var wg sync.WaitGroup wg.Add(1) go func() { - peer := &mockPeer{ - CloseFunc: func() error { return nil }, - IDFunc: func() ID { return &mockID{id: "test-peer-id"} }, - } + peer := NewMockPeer(t) + peer.EXPECT().Close().Return(nil).Times(1) + peer.EXPECT().ID().Return(&mockID{id: "test-peer-id"}).Maybe() _ = Handle(ctx, peer, parent, remote, slog.New(slog.DiscardHandler), slog.New(slog.DiscardHandler)) - assert.Len(t, peer.CloseCalls(), 1) wg.Done() }() _ = (<-parent.InfoCh).Value.(*Connected).Peer.(*peerOnceCloser).Peer // fist message should be notification about connection @@ -74,9 +72,9 @@ func TestHandleError(t *testing.T) { var wg sync.WaitGroup wg.Add(1) go func() { - peer := &mockPeer{CloseFunc: func() error { return nil }} + peer := NewMockPeer(t) + peer.EXPECT().Close().Return(nil).Times(1) _ = Handle(ctx, peer, parent, remote, slog.New(slog.DiscardHandler), slog.New(slog.DiscardHandler)) - assert.Len(t, peer.CloseCalls(), 1) wg.Done() }() _ = (<-parent.InfoCh).Value.(*Connected).Peer.(*peerOnceCloser).Peer // fist message should be notification about connection diff --git a/pkg/p2p/peer/mock_peer_exported.go b/pkg/p2p/peer/mock_peer_exported.go new file mode 100644 index 0000000000..c14b497ce3 --- /dev/null +++ b/pkg/p2p/peer/mock_peer_exported.go @@ -0,0 +1,397 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package peer + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/p2p/conn" + "github.com/wavesplatform/gowaves/pkg/proto" +) + +// NewMockPeer creates a new instance of MockPeer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockPeer(t interface { + mock.TestingT + Cleanup(func()) +}) *MockPeer { + mock := &MockPeer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockPeer is an autogenerated mock type for the Peer type +type MockPeer struct { + mock.Mock +} + +type MockPeer_Expecter struct { + mock *mock.Mock +} + +func (_m *MockPeer) EXPECT() *MockPeer_Expecter { + return &MockPeer_Expecter{mock: &_m.Mock} +} + +// Close provides a mock function for the type MockPeer +func (_mock *MockPeer) Close() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Close") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockPeer_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type MockPeer_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *MockPeer_Expecter) Close() *MockPeer_Close_Call { + return &MockPeer_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *MockPeer_Close_Call) Run(run func()) *MockPeer_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeer_Close_Call) Return(err error) *MockPeer_Close_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockPeer_Close_Call) RunAndReturn(run func() error) *MockPeer_Close_Call { + _c.Call.Return(run) + return _c +} + +// Connection provides a mock function for the type MockPeer +func (_mock *MockPeer) Connection() conn.Connection { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Connection") + } + + var r0 conn.Connection + if returnFunc, ok := ret.Get(0).(func() conn.Connection); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(conn.Connection) + } + } + return r0 +} + +// MockPeer_Connection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Connection' +type MockPeer_Connection_Call struct { + *mock.Call +} + +// Connection is a helper method to define mock.On call +func (_e *MockPeer_Expecter) Connection() *MockPeer_Connection_Call { + return &MockPeer_Connection_Call{Call: _e.mock.On("Connection")} +} + +func (_c *MockPeer_Connection_Call) Run(run func()) *MockPeer_Connection_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeer_Connection_Call) Return(connection conn.Connection) *MockPeer_Connection_Call { + _c.Call.Return(connection) + return _c +} + +func (_c *MockPeer_Connection_Call) RunAndReturn(run func() conn.Connection) *MockPeer_Connection_Call { + _c.Call.Return(run) + return _c +} + +// Direction provides a mock function for the type MockPeer +func (_mock *MockPeer) Direction() Direction { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Direction") + } + + var r0 Direction + if returnFunc, ok := ret.Get(0).(func() Direction); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(Direction) + } + return r0 +} + +// MockPeer_Direction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Direction' +type MockPeer_Direction_Call struct { + *mock.Call +} + +// Direction is a helper method to define mock.On call +func (_e *MockPeer_Expecter) Direction() *MockPeer_Direction_Call { + return &MockPeer_Direction_Call{Call: _e.mock.On("Direction")} +} + +func (_c *MockPeer_Direction_Call) Run(run func()) *MockPeer_Direction_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeer_Direction_Call) Return(direction Direction) *MockPeer_Direction_Call { + _c.Call.Return(direction) + return _c +} + +func (_c *MockPeer_Direction_Call) RunAndReturn(run func() Direction) *MockPeer_Direction_Call { + _c.Call.Return(run) + return _c +} + +// Equal provides a mock function for the type MockPeer +func (_mock *MockPeer) Equal(peer Peer) bool { + ret := _mock.Called(peer) + + if len(ret) == 0 { + panic("no return value specified for Equal") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(Peer) bool); ok { + r0 = returnFunc(peer) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockPeer_Equal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Equal' +type MockPeer_Equal_Call struct { + *mock.Call +} + +// Equal is a helper method to define mock.On call +// - peer Peer +func (_e *MockPeer_Expecter) Equal(peer interface{}) *MockPeer_Equal_Call { + return &MockPeer_Equal_Call{Call: _e.mock.On("Equal", peer)} +} + +func (_c *MockPeer_Equal_Call) Run(run func(peer Peer)) *MockPeer_Equal_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 Peer + if args[0] != nil { + arg0 = args[0].(Peer) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeer_Equal_Call) Return(b bool) *MockPeer_Equal_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockPeer_Equal_Call) RunAndReturn(run func(peer Peer) bool) *MockPeer_Equal_Call { + _c.Call.Return(run) + return _c +} + +// Handshake provides a mock function for the type MockPeer +func (_mock *MockPeer) Handshake() proto.Handshake { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Handshake") + } + + var r0 proto.Handshake + if returnFunc, ok := ret.Get(0).(func() proto.Handshake); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(proto.Handshake) + } + return r0 +} + +// MockPeer_Handshake_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Handshake' +type MockPeer_Handshake_Call struct { + *mock.Call +} + +// Handshake is a helper method to define mock.On call +func (_e *MockPeer_Expecter) Handshake() *MockPeer_Handshake_Call { + return &MockPeer_Handshake_Call{Call: _e.mock.On("Handshake")} +} + +func (_c *MockPeer_Handshake_Call) Run(run func()) *MockPeer_Handshake_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeer_Handshake_Call) Return(handshake proto.Handshake) *MockPeer_Handshake_Call { + _c.Call.Return(handshake) + return _c +} + +func (_c *MockPeer_Handshake_Call) RunAndReturn(run func() proto.Handshake) *MockPeer_Handshake_Call { + _c.Call.Return(run) + return _c +} + +// ID provides a mock function for the type MockPeer +func (_mock *MockPeer) ID() ID { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for ID") + } + + var r0 ID + if returnFunc, ok := ret.Get(0).(func() ID); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(ID) + } + } + return r0 +} + +// MockPeer_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type MockPeer_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *MockPeer_Expecter) ID() *MockPeer_ID_Call { + return &MockPeer_ID_Call{Call: _e.mock.On("ID")} +} + +func (_c *MockPeer_ID_Call) Run(run func()) *MockPeer_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeer_ID_Call) Return(iD ID) *MockPeer_ID_Call { + _c.Call.Return(iD) + return _c +} + +func (_c *MockPeer_ID_Call) RunAndReturn(run func() ID) *MockPeer_ID_Call { + _c.Call.Return(run) + return _c +} + +// RemoteAddr provides a mock function for the type MockPeer +func (_mock *MockPeer) RemoteAddr() proto.TCPAddr { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for RemoteAddr") + } + + var r0 proto.TCPAddr + if returnFunc, ok := ret.Get(0).(func() proto.TCPAddr); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(proto.TCPAddr) + } + return r0 +} + +// MockPeer_RemoteAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoteAddr' +type MockPeer_RemoteAddr_Call struct { + *mock.Call +} + +// RemoteAddr is a helper method to define mock.On call +func (_e *MockPeer_Expecter) RemoteAddr() *MockPeer_RemoteAddr_Call { + return &MockPeer_RemoteAddr_Call{Call: _e.mock.On("RemoteAddr")} +} + +func (_c *MockPeer_RemoteAddr_Call) Run(run func()) *MockPeer_RemoteAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockPeer_RemoteAddr_Call) Return(tCPAddr proto.TCPAddr) *MockPeer_RemoteAddr_Call { + _c.Call.Return(tCPAddr) + return _c +} + +func (_c *MockPeer_RemoteAddr_Call) RunAndReturn(run func() proto.TCPAddr) *MockPeer_RemoteAddr_Call { + _c.Call.Return(run) + return _c +} + +// SendMessage provides a mock function for the type MockPeer +func (_mock *MockPeer) SendMessage(message proto.Message) { + _mock.Called(message) + return +} + +// MockPeer_SendMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendMessage' +type MockPeer_SendMessage_Call struct { + *mock.Call +} + +// SendMessage is a helper method to define mock.On call +// - message proto.Message +func (_e *MockPeer_Expecter) SendMessage(message interface{}) *MockPeer_SendMessage_Call { + return &MockPeer_SendMessage_Call{Call: _e.mock.On("SendMessage", message)} +} + +func (_c *MockPeer_SendMessage_Call) Run(run func(message proto.Message)) *MockPeer_SendMessage_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Message + if args[0] != nil { + arg0 = args[0].(proto.Message) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockPeer_SendMessage_Call) Return() *MockPeer_SendMessage_Call { + _c.Call.Return() + return _c +} + +func (_c *MockPeer_SendMessage_Call) RunAndReturn(run func(message proto.Message)) *MockPeer_SendMessage_Call { + _c.Run(run) + return _c +} diff --git a/pkg/p2p/peer/peer.go b/pkg/p2p/peer/peer.go index 3e63e36f8c..6797b6b1a2 100644 --- a/pkg/p2p/peer/peer.go +++ b/pkg/p2p/peer/peer.go @@ -51,7 +51,6 @@ func NewParent(enableLightNode bool) Parent { } } -//go:generate moq -out peer_moq.go . Peer:mockPeer type Peer interface { Direction() Direction Close() error diff --git a/pkg/p2p/peer/peer_moq.go b/pkg/p2p/peer/peer_moq.go deleted file mode 100644 index bffad10619..0000000000 --- a/pkg/p2p/peer/peer_moq.go +++ /dev/null @@ -1,342 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package peer - -import ( - "github.com/wavesplatform/gowaves/pkg/p2p/conn" - "github.com/wavesplatform/gowaves/pkg/proto" - "sync" -) - -// Ensure, that mockPeer does implement Peer. -// If this is not the case, regenerate this file with moq. -var _ Peer = &mockPeer{} - -// mockPeer is a mock implementation of Peer. -// -// func TestSomethingThatUsesPeer(t *testing.T) { -// -// // make and configure a mocked Peer -// mockedPeer := &mockPeer{ -// CloseFunc: func() error { -// panic("mock out the Close method") -// }, -// ConnectionFunc: func() conn.Connection { -// panic("mock out the Connection method") -// }, -// DirectionFunc: func() Direction { -// panic("mock out the Direction method") -// }, -// EqualFunc: func(peer Peer) bool { -// panic("mock out the Equal method") -// }, -// HandshakeFunc: func() proto.Handshake { -// panic("mock out the Handshake method") -// }, -// IDFunc: func() ID { -// panic("mock out the ID method") -// }, -// RemoteAddrFunc: func() proto.TCPAddr { -// panic("mock out the RemoteAddr method") -// }, -// SendMessageFunc: func(message proto.Message) { -// panic("mock out the SendMessage method") -// }, -// } -// -// // use mockedPeer in code that requires Peer -// // and then make assertions. -// -// } -type mockPeer struct { - // CloseFunc mocks the Close method. - CloseFunc func() error - - // ConnectionFunc mocks the Connection method. - ConnectionFunc func() conn.Connection - - // DirectionFunc mocks the Direction method. - DirectionFunc func() Direction - - // EqualFunc mocks the Equal method. - EqualFunc func(peer Peer) bool - - // HandshakeFunc mocks the Handshake method. - HandshakeFunc func() proto.Handshake - - // IDFunc mocks the ID method. - IDFunc func() ID - - // RemoteAddrFunc mocks the RemoteAddr method. - RemoteAddrFunc func() proto.TCPAddr - - // SendMessageFunc mocks the SendMessage method. - SendMessageFunc func(message proto.Message) - - // calls tracks calls to the methods. - calls struct { - // Close holds details about calls to the Close method. - Close []struct { - } - // Connection holds details about calls to the Connection method. - Connection []struct { - } - // Direction holds details about calls to the Direction method. - Direction []struct { - } - // Equal holds details about calls to the Equal method. - Equal []struct { - // Peer is the peer argument value. - Peer Peer - } - // Handshake holds details about calls to the Handshake method. - Handshake []struct { - } - // ID holds details about calls to the ID method. - ID []struct { - } - // RemoteAddr holds details about calls to the RemoteAddr method. - RemoteAddr []struct { - } - // SendMessage holds details about calls to the SendMessage method. - SendMessage []struct { - // Message is the message argument value. - Message proto.Message - } - } - lockClose sync.RWMutex - lockConnection sync.RWMutex - lockDirection sync.RWMutex - lockEqual sync.RWMutex - lockHandshake sync.RWMutex - lockID sync.RWMutex - lockRemoteAddr sync.RWMutex - lockSendMessage sync.RWMutex -} - -// Close calls CloseFunc. -func (mock *mockPeer) Close() error { - if mock.CloseFunc == nil { - panic("mockPeer.CloseFunc: method is nil but Peer.Close was just called") - } - callInfo := struct { - }{} - mock.lockClose.Lock() - mock.calls.Close = append(mock.calls.Close, callInfo) - mock.lockClose.Unlock() - return mock.CloseFunc() -} - -// CloseCalls gets all the calls that were made to Close. -// Check the length with: -// -// len(mockedPeer.CloseCalls()) -func (mock *mockPeer) CloseCalls() []struct { -} { - var calls []struct { - } - mock.lockClose.RLock() - calls = mock.calls.Close - mock.lockClose.RUnlock() - return calls -} - -// Connection calls ConnectionFunc. -func (mock *mockPeer) Connection() conn.Connection { - if mock.ConnectionFunc == nil { - panic("mockPeer.ConnectionFunc: method is nil but Peer.Connection was just called") - } - callInfo := struct { - }{} - mock.lockConnection.Lock() - mock.calls.Connection = append(mock.calls.Connection, callInfo) - mock.lockConnection.Unlock() - return mock.ConnectionFunc() -} - -// ConnectionCalls gets all the calls that were made to Connection. -// Check the length with: -// -// len(mockedPeer.ConnectionCalls()) -func (mock *mockPeer) ConnectionCalls() []struct { -} { - var calls []struct { - } - mock.lockConnection.RLock() - calls = mock.calls.Connection - mock.lockConnection.RUnlock() - return calls -} - -// Direction calls DirectionFunc. -func (mock *mockPeer) Direction() Direction { - if mock.DirectionFunc == nil { - panic("mockPeer.DirectionFunc: method is nil but Peer.Direction was just called") - } - callInfo := struct { - }{} - mock.lockDirection.Lock() - mock.calls.Direction = append(mock.calls.Direction, callInfo) - mock.lockDirection.Unlock() - return mock.DirectionFunc() -} - -// DirectionCalls gets all the calls that were made to Direction. -// Check the length with: -// -// len(mockedPeer.DirectionCalls()) -func (mock *mockPeer) DirectionCalls() []struct { -} { - var calls []struct { - } - mock.lockDirection.RLock() - calls = mock.calls.Direction - mock.lockDirection.RUnlock() - return calls -} - -// Equal calls EqualFunc. -func (mock *mockPeer) Equal(peer Peer) bool { - if mock.EqualFunc == nil { - panic("mockPeer.EqualFunc: method is nil but Peer.Equal was just called") - } - callInfo := struct { - Peer Peer - }{ - Peer: peer, - } - mock.lockEqual.Lock() - mock.calls.Equal = append(mock.calls.Equal, callInfo) - mock.lockEqual.Unlock() - return mock.EqualFunc(peer) -} - -// EqualCalls gets all the calls that were made to Equal. -// Check the length with: -// -// len(mockedPeer.EqualCalls()) -func (mock *mockPeer) EqualCalls() []struct { - Peer Peer -} { - var calls []struct { - Peer Peer - } - mock.lockEqual.RLock() - calls = mock.calls.Equal - mock.lockEqual.RUnlock() - return calls -} - -// Handshake calls HandshakeFunc. -func (mock *mockPeer) Handshake() proto.Handshake { - if mock.HandshakeFunc == nil { - panic("mockPeer.HandshakeFunc: method is nil but Peer.Handshake was just called") - } - callInfo := struct { - }{} - mock.lockHandshake.Lock() - mock.calls.Handshake = append(mock.calls.Handshake, callInfo) - mock.lockHandshake.Unlock() - return mock.HandshakeFunc() -} - -// HandshakeCalls gets all the calls that were made to Handshake. -// Check the length with: -// -// len(mockedPeer.HandshakeCalls()) -func (mock *mockPeer) HandshakeCalls() []struct { -} { - var calls []struct { - } - mock.lockHandshake.RLock() - calls = mock.calls.Handshake - mock.lockHandshake.RUnlock() - return calls -} - -// ID calls IDFunc. -func (mock *mockPeer) ID() ID { - if mock.IDFunc == nil { - panic("mockPeer.IDFunc: method is nil but Peer.ID was just called") - } - callInfo := struct { - }{} - mock.lockID.Lock() - mock.calls.ID = append(mock.calls.ID, callInfo) - mock.lockID.Unlock() - return mock.IDFunc() -} - -// IDCalls gets all the calls that were made to ID. -// Check the length with: -// -// len(mockedPeer.IDCalls()) -func (mock *mockPeer) IDCalls() []struct { -} { - var calls []struct { - } - mock.lockID.RLock() - calls = mock.calls.ID - mock.lockID.RUnlock() - return calls -} - -// RemoteAddr calls RemoteAddrFunc. -func (mock *mockPeer) RemoteAddr() proto.TCPAddr { - if mock.RemoteAddrFunc == nil { - panic("mockPeer.RemoteAddrFunc: method is nil but Peer.RemoteAddr was just called") - } - callInfo := struct { - }{} - mock.lockRemoteAddr.Lock() - mock.calls.RemoteAddr = append(mock.calls.RemoteAddr, callInfo) - mock.lockRemoteAddr.Unlock() - return mock.RemoteAddrFunc() -} - -// RemoteAddrCalls gets all the calls that were made to RemoteAddr. -// Check the length with: -// -// len(mockedPeer.RemoteAddrCalls()) -func (mock *mockPeer) RemoteAddrCalls() []struct { -} { - var calls []struct { - } - mock.lockRemoteAddr.RLock() - calls = mock.calls.RemoteAddr - mock.lockRemoteAddr.RUnlock() - return calls -} - -// SendMessage calls SendMessageFunc. -func (mock *mockPeer) SendMessage(message proto.Message) { - if mock.SendMessageFunc == nil { - panic("mockPeer.SendMessageFunc: method is nil but Peer.SendMessage was just called") - } - callInfo := struct { - Message proto.Message - }{ - Message: message, - } - mock.lockSendMessage.Lock() - mock.calls.SendMessage = append(mock.calls.SendMessage, callInfo) - mock.lockSendMessage.Unlock() - mock.SendMessageFunc(message) -} - -// SendMessageCalls gets all the calls that were made to SendMessage. -// Check the length with: -// -// len(mockedPeer.SendMessageCalls()) -func (mock *mockPeer) SendMessageCalls() []struct { - Message proto.Message -} { - var calls []struct { - Message proto.Message - } - mock.lockSendMessage.RLock() - calls = mock.calls.SendMessage - mock.lockSendMessage.RUnlock() - return calls -} diff --git a/pkg/ride/diff_state_test.go b/pkg/ride/diff_state_test.go index 5548945eff..4129881892 100644 --- a/pkg/ride/diff_state_test.go +++ b/pkg/ride/diff_state_test.go @@ -4,8 +4,11 @@ import ( "errors" "testing" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" + "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/types" ) const ( @@ -32,15 +35,16 @@ func TestDataDiffTestSuite(t *testing.T) { } func (s *DataDiffTestSuite) SetupTest() { - mock := &MockSmartState{ - NewestRecipientToAddressFunc: func(recipient proto.Recipient) (proto.WavesAddress, error) { + m := types.NewMockEnrichedSmartState(s.T()) + m.EXPECT().NewestRecipientToAddress(mock.Anything).RunAndReturn( + func(recipient proto.Recipient) (proto.WavesAddress, error) { if recipient.Eq(validRecipient) { return validAddress, nil } return proto.WavesAddress{}, errors.New("not found") }, - } - s.diff = newDiffState(mock) + ).Maybe() + s.diff = newDiffState(m) } func (s *DataDiffTestSuite) TestPutGetBinaryEntry() { diff --git a/pkg/ride/functions_bytes_test.go b/pkg/ride/functions_bytes_test.go index e618709972..d7e84b6ea8 100644 --- a/pkg/ride/functions_bytes_test.go +++ b/pkg/ride/functions_bytes_test.go @@ -10,6 +10,7 @@ import ( "github.com/mr-tron/base58" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/proto" @@ -99,7 +100,8 @@ func TestDropBytes(t *testing.T) { } func TestConcatBytes(t *testing.T) { - te := &mockRideEnvironment{checkMessageLengthFunc: bytesSizeCheckV1V2} + te := NewMockEnvironment(t) + te.EXPECT().checkMessageLength(mock.Anything).RunAndReturn(bytesSizeCheckV1V2).Maybe() for _, test := range []struct { args []rideType fail bool diff --git a/pkg/ride/functions_int_test.go b/pkg/ride/functions_int_test.go index c51f8dca6f..979884d98a 100644 --- a/pkg/ride/functions_int_test.go +++ b/pkg/ride/functions_int_test.go @@ -404,11 +404,8 @@ func TestPow(t *testing.T) { } func BenchmarkPow(b *testing.B) { - e := &mockRideEnvironment{ - validateInternalPaymentsFunc: func() bool { - return true - }, - } + e := NewMockEnvironment(b) + e.EXPECT().validateInternalPayments().Return(true).Maybe() //98765432, 8, -$max, 0, 8, DOWN -> error args := []rideType{rideInt(98765432), rideInt(8), rideInt(math.MinInt64), rideInt(0), rideInt(8), newDown(nil)} diff --git a/pkg/ride/functions_proto_test.go b/pkg/ride/functions_proto_test.go index 9b6df4af4a..8a2f670961 100644 --- a/pkg/ride/functions_proto_test.go +++ b/pkg/ride/functions_proto_test.go @@ -15,6 +15,7 @@ import ( "github.com/mr-tron/base58" "github.com/pkg/errors" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" @@ -27,20 +28,10 @@ import ( "github.com/wavesplatform/gowaves/pkg/util/byte_helpers" ) -var ( - v5takeString = takeRideString - noRideV6 = func() bool { - return false - } -) - func TestAddressFromString(t *testing.T) { - te := &mockRideEnvironment{ - schemeFunc: func() byte { - return 'W' - }, - rideV6ActivatedFunc: noRideV6, - } + te := NewMockEnvironment(t) + te.EXPECT().scheme().Return(byte('W')).Maybe() + te.EXPECT().rideV6Activated().Return(false).Maybe() ma, err := proto.NewAddressFromString("3PJaDyprvekvPXPuAtxrapacuDJopgJRaU3") require.NoError(t, err) for _, test := range []struct { @@ -67,9 +58,8 @@ func TestAddressFromString(t *testing.T) { } func TestAddressValueFromString(t *testing.T) { - te := &mockRideEnvironment{schemeFunc: func() byte { - return 'W' - }} + te := NewMockEnvironment(t) + te.EXPECT().scheme().Return(byte('W')).Maybe() ma, err := proto.NewAddressFromString("3PJaDyprvekvPXPuAtxrapacuDJopgJRaU3") require.NoError(t, err) for _, test := range []struct { @@ -104,18 +94,16 @@ func TestTransactionHeightByID(t *testing.T) { } func TestAssetBalanceV3(t *testing.T) { - te := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - NewestAssetBalanceFunc: func(account proto.Recipient, assetID crypto.Digest) (uint64, error) { - return 42, nil - }, - NewestWavesBalanceFunc: func(account proto.Recipient) (uint64, error) { - return 21, nil - }, - } - }, - } + ss := types.NewMockSmartState(t) + ss.EXPECT().NewestAssetBalance(mock.Anything, mock.Anything).RunAndReturn( + func(_ proto.Recipient, _ crypto.Digest) (uint64, error) { + return 42, nil + }).Maybe() + ss.EXPECT().NewestWavesBalance(mock.Anything).RunAndReturn(func(_ proto.Recipient) (uint64, error) { + return 21, nil + }).Maybe() + te := NewMockEnvironment(t) + te.EXPECT().state().Return(ss).Maybe() testCases := []struct { expectedBalance rideType assetID rideType @@ -141,18 +129,16 @@ func TestAssetBalanceV3(t *testing.T) { } func TestAssetBalanceV4(t *testing.T) { - te := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - NewestAssetBalanceFunc: func(account proto.Recipient, assetID crypto.Digest) (uint64, error) { - return 42, nil - }, - NewestWavesBalanceFunc: func(account proto.Recipient) (uint64, error) { - return 21, nil - }, - } - }, - } + ss := types.NewMockSmartState(t) + ss.EXPECT().NewestAssetBalance(mock.Anything, mock.Anything).RunAndReturn( + func(_ proto.Recipient, _ crypto.Digest) (uint64, error) { + return 42, nil + }).Maybe() + ss.EXPECT().NewestWavesBalance(mock.Anything).RunAndReturn(func(_ proto.Recipient) (uint64, error) { + return 21, nil + }).Maybe() + te := NewMockEnvironment(t) + te.EXPECT().state().Return(ss).Maybe() testCases := []struct { expectedBalance rideType assetID rideType @@ -186,21 +172,19 @@ func TestIntFromState(t *testing.T) { correctAliasRecipient := proto.NewRecipientFromAlias(*correctAlias) incorrectAddressRecipient := proto.NewRecipientFromAddress(incorrectAddress) incorrectAliasRecipient := proto.NewRecipientFromAlias(*incorrectAlias) - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestIntegerEntryFunc: func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { - return &proto.IntegerDataEntry{Key: "key", Value: 100500}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestIntegerEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { + return &proto.IntegerDataEntry{Key: "key", Value: 100500}, nil } - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -240,21 +224,19 @@ func TestBytesFromState(t *testing.T) { correctAliasRecipient := proto.NewRecipientFromAlias(*correctAlias) incorrectAddressRecipient := proto.NewRecipientFromAddress(incorrectAddress) incorrectAliasRecipient := proto.NewRecipientFromAlias(*incorrectAlias) - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestBinaryEntryFunc: func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { - return &proto.BinaryDataEntry{Key: "key", Value: []byte("value")}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestBinaryEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { + return &proto.BinaryDataEntry{Key: "key", Value: []byte("value")}, nil } - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -294,21 +276,19 @@ func TestStringFromState(t *testing.T) { correctAliasRecipient := proto.NewRecipientFromAlias(*correctAlias) incorrectAddressRecipient := proto.NewRecipientFromAddress(incorrectAddress) incorrectAliasRecipient := proto.NewRecipientFromAlias(*incorrectAlias) - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestStringEntryFunc: func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { - return &proto.StringDataEntry{Key: "key", Value: "value"}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestStringEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { + if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { + return &proto.StringDataEntry{Key: "key", Value: "value"}, nil } - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -348,21 +328,19 @@ func TestBooleanFromState(t *testing.T) { correctAliasRecipient := proto.NewRecipientFromAlias(*correctAlias) incorrectAddressRecipient := proto.NewRecipientFromAddress(incorrectAddress) incorrectAliasRecipient := proto.NewRecipientFromAlias(*incorrectAlias) - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestBooleanEntryFunc: func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { - return &proto.BooleanDataEntry{Key: "key", Value: true}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestBooleanEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { + return &proto.BooleanDataEntry{Key: "key", Value: true}, nil } - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -395,24 +373,20 @@ func TestBooleanFromState(t *testing.T) { func TestIntFromSelfState(t *testing.T) { notFoundErr := errors.New("not found") correctAddress := proto.MustAddressFromString("3Myqjf1D44wR8Vko4Tr5CwSzRNo2Vg9S7u7") - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestIntegerEntryFunc: func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - if *account.Address() == correctAddress && key == "key" { - return &proto.IntegerDataEntry{Key: "key", Value: 100500}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestIntegerEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + if *account.Address() == correctAddress && key == "key" { + return &proto.IntegerDataEntry{Key: "key", Value: 100500}, nil } - }, - thisFunc: func() rideType { - return rideAddress(correctAddress) - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() + env.EXPECT().this().Return(rideAddress(correctAddress)).Maybe() for _, test := range []struct { args []rideType fail bool @@ -437,24 +411,20 @@ func TestIntFromSelfState(t *testing.T) { func TestBytesFromSelfState(t *testing.T) { notFoundErr := errors.New("not found") correctAddress := proto.MustAddressFromString("3Myqjf1D44wR8Vko4Tr5CwSzRNo2Vg9S7u7") - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestBinaryEntryFunc: func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - if *account.Address() == correctAddress && key == "key" { - return &proto.BinaryDataEntry{Key: "key", Value: []byte("value")}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestBinaryEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + if *account.Address() == correctAddress && key == "key" { + return &proto.BinaryDataEntry{Key: "key", Value: []byte("value")}, nil } - }, - thisFunc: func() rideType { - return rideAddress(correctAddress) - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() + env.EXPECT().this().Return(rideAddress(correctAddress)).Maybe() for _, test := range []struct { args []rideType fail bool @@ -479,24 +449,20 @@ func TestBytesFromSelfState(t *testing.T) { func TestStringFromSelfState(t *testing.T) { notFoundErr := errors.New("not found") correctAddress := proto.MustAddressFromString("3Myqjf1D44wR8Vko4Tr5CwSzRNo2Vg9S7u7") - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestStringEntryFunc: func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - if *account.Address() == correctAddress && key == "key" { - return &proto.StringDataEntry{Key: "key", Value: "value"}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestStringEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { + if *account.Address() == correctAddress && key == "key" { + return &proto.StringDataEntry{Key: "key", Value: "value"}, nil } - }, - thisFunc: func() rideType { - return rideAddress(correctAddress) - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() + env.EXPECT().this().Return(rideAddress(correctAddress)).Maybe() for _, test := range []struct { args []rideType fail bool @@ -521,24 +487,20 @@ func TestStringFromSelfState(t *testing.T) { func TestBooleanFromSelfState(t *testing.T) { notFoundErr := errors.New("not found") correctAddress := proto.MustAddressFromString("3Myqjf1D44wR8Vko4Tr5CwSzRNo2Vg9S7u7") - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestBooleanEntryFunc: func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - if *account.Address() == correctAddress && key == "key" { - return &proto.BooleanDataEntry{Key: "key", Value: true}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestBooleanEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + if *account.Address() == correctAddress && key == "key" { + return &proto.BooleanDataEntry{Key: "key", Value: true}, nil } - }, - thisFunc: func() rideType { - return rideAddress(correctAddress) - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() + env.EXPECT().this().Return(rideAddress(correctAddress)).Maybe() for _, test := range []struct { args []rideType fail bool @@ -563,26 +525,18 @@ func TestBooleanFromSelfState(t *testing.T) { func TestAddressFromRecipient(t *testing.T) { addr, err := proto.NewAddressFromString("3N9WtaPoD1tMrDZRG26wA142Byd35tLhnLU") require.NoError(t, err) - s := &MockSmartState{ - NewestAddrByAliasFunc: func(alias proto.Alias) (proto.WavesAddress, error) { - if alias.Alias == "correct" { - return addr, nil - } - return proto.WavesAddress{}, errors.New("unexpected test address") - }, - } + ss := types.NewMockSmartState(t) + ss.EXPECT().NewestAddrByAlias(mock.Anything).RunAndReturn(func(alias proto.Alias) (proto.WavesAddress, error) { + if alias.Alias == "correct" { + return addr, nil + } + return proto.WavesAddress{}, errors.New("unexpected test address") + }).Maybe() alias := proto.NewAlias('T', "correct") - e := &mockRideEnvironment{ - schemeFunc: func() byte { - return 'T' - }, - stateFunc: func() types.SmartState { - return s - }, - validateInternalPaymentsFunc: func() bool { - return false - }, - } + e := NewMockEnvironment(t) + e.EXPECT().scheme().Return(byte('T')).Maybe() + e.EXPECT().state().Return(ss).Maybe() + e.EXPECT().validateInternalPayments().Return(false).Maybe() for _, test := range []struct { args []rideType fail bool @@ -615,32 +569,37 @@ func TestSigVerify(t *testing.T) { require.NoError(t, err) pk, err := hex.DecodeString("ba9e7203ca62efbaa49098ec408bdf8a3dfed5a7fa7c200ece40aade905e535f") require.NoError(t, err) - big := bytes.Repeat([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0xDE, 0xAD, 0xBE, 0xEF}, 19201) + large := bytes.Repeat([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0xDE, 0xAD, 0xBE, 0xEF}, 19201) for _, test := range []struct { args []rideType check func(int) bool fail bool r rideType }{ - {[]rideType{rideByteVector(msg), rideByteVector(sig), rideByteVector(pk)}, bytesSizeCheckV1V2, false, rideBoolean(true)}, - {[]rideType{rideByteVector(msg), rideByteVector(bad), rideByteVector(pk)}, bytesSizeCheckV1V2, false, rideBoolean(false)}, - {[]rideType{rideByteVector(msg), rideByteVector(sig), rideByteVector(pk[:10])}, bytesSizeCheckV1V2, false, rideBoolean(false)}, - {[]rideType{rideString("MESSAGE"), rideByteVector(sig), rideByteVector(pk)}, bytesSizeCheckV1V2, true, nil}, - {[]rideType{rideByteVector(big), rideByteVector(sig), rideByteVector(pk)}, bytesSizeCheckV1V2, false, rideBoolean(false)}, - {[]rideType{rideByteVector(big), rideByteVector(sig), rideByteVector(pk)}, bytesSizeCheckV3V6, true, nil}, - {[]rideType{rideByteVector(msg), rideString("SIGNATURE"), rideByteVector(pk)}, bytesSizeCheckV1V2, true, nil}, - {[]rideType{rideByteVector(msg), rideByteVector(sig), rideString("PUBLIC KEY")}, bytesSizeCheckV1V2, true, nil}, + {[]rideType{rideByteVector(msg), rideByteVector(sig), rideByteVector(pk)}, bytesSizeCheckV1V2, + false, rideBoolean(true)}, + {[]rideType{rideByteVector(msg), rideByteVector(bad), rideByteVector(pk)}, bytesSizeCheckV1V2, + false, rideBoolean(false)}, + {[]rideType{rideByteVector(msg), rideByteVector(sig), rideByteVector(pk[:10])}, bytesSizeCheckV1V2, + false, rideBoolean(false)}, + {[]rideType{rideString("MESSAGE"), rideByteVector(sig), rideByteVector(pk)}, bytesSizeCheckV1V2, + true, nil}, + {[]rideType{rideByteVector(large), rideByteVector(sig), rideByteVector(pk)}, bytesSizeCheckV1V2, + false, rideBoolean(false)}, + {[]rideType{rideByteVector(large), rideByteVector(sig), rideByteVector(pk)}, bytesSizeCheckV3V6, + true, nil}, + {[]rideType{rideByteVector(msg), rideString("SIGNATURE"), rideByteVector(pk)}, bytesSizeCheckV1V2, + true, nil}, + {[]rideType{rideByteVector(msg), rideByteVector(sig), rideString("PUBLIC KEY")}, bytesSizeCheckV1V2, + true, nil}, {[]rideType{rideUnit{}}, bytesSizeCheckV1V2, true, nil}, {[]rideType{}, bytesSizeCheckV1V2, true, nil}, {[]rideType{rideInt(12345)}, bytesSizeCheckV1V2, true, nil}, {[]rideType{rideString("dsfjsadfl"), rideInt(12345)}, bytesSizeCheckV1V2, true, nil}, } { - te := &mockRideEnvironment{ - checkMessageLengthFunc: test.check, - libVersionFunc: func() (ast.LibraryVersion, error) { - return ast.LibV3, nil - }, - } + te := NewMockEnvironment(t) + te.EXPECT().checkMessageLength(mock.Anything).RunAndReturn(test.check).Maybe() + te.EXPECT().libVersion().Return(ast.LibV3, nil).Maybe() r, err := sigVerify(te, test.args...) if test.fail { assert.Error(t, err) @@ -660,7 +619,7 @@ func TestKeccak256(t *testing.T) { require.NoError(t, err) digest3, err := hex.DecodeString("fe0a57a797d6cb60a92548f2b43bd5e425212f55e0b7adb772ddabd85d21943e") require.NoError(t, err) - big := bytes.Repeat([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0xDE, 0xAD, 0xBE, 0xEF}, 19201) + large := bytes.Repeat([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0xDE, 0xAD, 0xBE, 0xEF}, 19201) for _, test := range []struct { args []rideType check func(int) bool @@ -669,18 +628,20 @@ func TestKeccak256(t *testing.T) { }{ {[]rideType{rideByteVector(data)}, bytesSizeCheckV1V2, false, rideByteVector(digest1)}, {[]rideType{rideString("123")}, bytesSizeCheckV1V2, false, rideByteVector(digest2)}, - {[]rideType{rideByteVector(big)}, bytesSizeCheckV1V2, false, rideByteVector(digest3)}, - {[]rideType{rideByteVector(big)}, bytesSizeCheckV3V6, true, nil}, + {[]rideType{rideByteVector(large)}, bytesSizeCheckV1V2, false, rideByteVector(digest3)}, + {[]rideType{rideByteVector(large)}, bytesSizeCheckV3V6, true, nil}, {[]rideType{rideUnit{}}, bytesSizeCheckV1V2, true, nil}, {[]rideType{}, bytesSizeCheckV1V2, true, nil}, {[]rideType{rideInt(12345)}, bytesSizeCheckV1V2, true, nil}, {[]rideType{rideString("dsfjsadfl"), rideInt(12345)}, bytesSizeCheckV1V2, true, nil}, } { - r, err := keccak256(&mockRideEnvironment{checkMessageLengthFunc: test.check}, test.args...) + me := NewMockEnvironment(t) + me.EXPECT().checkMessageLength(mock.Anything).RunAndReturn(test.check).Maybe() + r, kErr := keccak256(me, test.args...) if test.fail { - assert.Error(t, err) + assert.Error(t, kErr) } else { - require.NoError(t, err) + require.NoError(t, kErr) assert.Equal(t, test.r, r) } } @@ -695,7 +656,7 @@ func TestBlake2b256(t *testing.T) { require.NoError(t, err) digest3, err := hex.DecodeString("336bccfd826a5bf6a5c2c07a289e39b05cb68447c379fb1acdaf9afd3b3d8c67") require.NoError(t, err) - big := bytes.Repeat([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0xDE, 0xAD, 0xBE, 0xEF}, 19201) + large := bytes.Repeat([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0xDE, 0xAD, 0xBE, 0xEF}, 19201) for _, test := range []struct { args []rideType check func(int) bool @@ -704,18 +665,20 @@ func TestBlake2b256(t *testing.T) { }{ {[]rideType{rideByteVector(data)}, bytesSizeCheckV1V2, false, rideByteVector(digest1)}, {[]rideType{rideString("123")}, bytesSizeCheckV1V2, false, rideByteVector(digest2)}, - {[]rideType{rideByteVector(big)}, bytesSizeCheckV1V2, false, rideByteVector(digest3)}, - {[]rideType{rideByteVector(big)}, bytesSizeCheckV3V6, true, nil}, + {[]rideType{rideByteVector(large)}, bytesSizeCheckV1V2, false, rideByteVector(digest3)}, + {[]rideType{rideByteVector(large)}, bytesSizeCheckV3V6, true, nil}, {[]rideType{rideUnit{}}, bytesSizeCheckV1V2, true, nil}, {[]rideType{}, bytesSizeCheckV1V2, true, nil}, {[]rideType{rideInt(12345)}, bytesSizeCheckV1V2, true, nil}, {[]rideType{rideString("dsfjsadfl"), rideInt(12345)}, bytesSizeCheckV1V2, true, nil}, } { - r, err := blake2b256(&mockRideEnvironment{checkMessageLengthFunc: test.check}, test.args...) + me := NewMockEnvironment(t) + me.EXPECT().checkMessageLength(mock.Anything).RunAndReturn(test.check).Maybe() + r, bErr := blake2b256(me, test.args...) if test.fail { - assert.Error(t, err) + assert.Error(t, bErr) } else { - require.NoError(t, err) + require.NoError(t, bErr) assert.Equal(t, test.r, r) } } @@ -730,7 +693,7 @@ func TestSha256(t *testing.T) { require.NoError(t, err) digest3, err := hex.DecodeString("956731b38f852244d2d20f8ae618f1f916a6d0694062f90f7a2d9eec9c2ece4e") require.NoError(t, err) - big := bytes.Repeat([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0xDE, 0xAD, 0xBE, 0xEF}, 19201) + large := bytes.Repeat([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0xDE, 0xAD, 0xBE, 0xEF}, 19201) for _, test := range []struct { args []rideType check func(int) bool @@ -739,18 +702,20 @@ func TestSha256(t *testing.T) { }{ {[]rideType{rideByteVector(data1)}, bytesSizeCheckV1V2, false, rideByteVector(digest1)}, {[]rideType{rideString("123")}, bytesSizeCheckV1V2, false, rideByteVector(digest2)}, - {[]rideType{rideByteVector(big)}, bytesSizeCheckV1V2, false, rideByteVector(digest3)}, - {[]rideType{rideByteVector(big)}, bytesSizeCheckV3V6, true, nil}, + {[]rideType{rideByteVector(large)}, bytesSizeCheckV1V2, false, rideByteVector(digest3)}, + {[]rideType{rideByteVector(large)}, bytesSizeCheckV3V6, true, nil}, {[]rideType{rideUnit{}}, bytesSizeCheckV1V2, true, nil}, {[]rideType{}, bytesSizeCheckV1V2, true, nil}, {[]rideType{rideInt(12345)}, bytesSizeCheckV1V2, true, nil}, {[]rideType{rideString("dsfjsadfl"), rideInt(12345)}, bytesSizeCheckV1V2, true, nil}, } { - r, err := sha256(&mockRideEnvironment{checkMessageLengthFunc: test.check}, test.args...) + me := NewMockEnvironment(t) + me.EXPECT().checkMessageLength(mock.Anything).RunAndReturn(test.check).Maybe() + r, sErr := sha256(me, test.args...) if test.fail { - assert.Error(t, err) + assert.Error(t, sErr) } else { - require.NoError(t, err) + require.NoError(t, sErr) assert.Equal(t, test.r, r) } } @@ -1046,21 +1011,19 @@ func TestIntValueFromState(t *testing.T) { correctAliasRecipient := proto.NewRecipientFromAlias(*correctAlias) incorrectAddressRecipient := proto.NewRecipientFromAddress(incorrectAddress) incorrectAliasRecipient := proto.NewRecipientFromAlias(*incorrectAlias) - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestIntegerEntryFunc: func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { - return &proto.IntegerDataEntry{Key: "key", Value: 100500}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestIntegerEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { + return &proto.IntegerDataEntry{Key: "key", Value: 100500}, nil } - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1100,21 +1063,19 @@ func TestBytesValueFromState(t *testing.T) { correctAliasRecipient := proto.NewRecipientFromAlias(*correctAlias) incorrectAddressRecipient := proto.NewRecipientFromAddress(incorrectAddress) incorrectAliasRecipient := proto.NewRecipientFromAlias(*incorrectAlias) - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestBinaryEntryFunc: func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { - return &proto.BinaryDataEntry{Key: "key", Value: []byte("value")}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestBinaryEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { + return &proto.BinaryDataEntry{Key: "key", Value: []byte("value")}, nil } - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1154,21 +1115,19 @@ func TestStringValueFromState(t *testing.T) { correctAliasRecipient := proto.NewRecipientFromAlias(*correctAlias) incorrectAddressRecipient := proto.NewRecipientFromAddress(incorrectAddress) incorrectAliasRecipient := proto.NewRecipientFromAlias(*incorrectAlias) - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestStringEntryFunc: func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { - return &proto.StringDataEntry{Key: "key", Value: "value"}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestStringEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { + if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { + return &proto.StringDataEntry{Key: "key", Value: "value"}, nil } - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1208,21 +1167,19 @@ func TestBooleanValueFromState(t *testing.T) { correctAliasRecipient := proto.NewRecipientFromAlias(*correctAlias) incorrectAddressRecipient := proto.NewRecipientFromAddress(incorrectAddress) incorrectAliasRecipient := proto.NewRecipientFromAlias(*incorrectAlias) - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestBooleanEntryFunc: func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { - return &proto.BooleanDataEntry{Key: "key", Value: true}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestBooleanEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + if (account.Eq(correctAddressRecipient) || account.Eq(correctAliasRecipient)) && key == "key" { + return &proto.BooleanDataEntry{Key: "key", Value: true}, nil } - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1254,24 +1211,20 @@ func TestBooleanValueFromState(t *testing.T) { func TestIntValueFromSelfState(t *testing.T) { notFoundErr := errors.New("not found") correctAddress := proto.MustAddressFromString("3Myqjf1D44wR8Vko4Tr5CwSzRNo2Vg9S7u7") - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestIntegerEntryFunc: func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - if *account.Address() == correctAddress && key == "key" { - return &proto.IntegerDataEntry{Key: "key", Value: 100500}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestIntegerEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + if *account.Address() == correctAddress && key == "key" { + return &proto.IntegerDataEntry{Key: "key", Value: 100500}, nil } - }, - thisFunc: func() rideType { - return rideAddress(correctAddress) - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() + env.EXPECT().this().Return(rideAddress(correctAddress)).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1296,24 +1249,20 @@ func TestIntValueFromSelfState(t *testing.T) { func TestBytesValueFromSelfState(t *testing.T) { notFoundErr := errors.New("not found") correctAddress := proto.MustAddressFromString("3Myqjf1D44wR8Vko4Tr5CwSzRNo2Vg9S7u7") - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestBinaryEntryFunc: func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - if *account.Address() == correctAddress && key == "key" { - return &proto.BinaryDataEntry{Key: "key", Value: []byte("value")}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestBinaryEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + if *account.Address() == correctAddress && key == "key" { + return &proto.BinaryDataEntry{Key: "key", Value: []byte("value")}, nil } - }, - thisFunc: func() rideType { - return rideAddress(correctAddress) - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() + env.EXPECT().this().Return(rideAddress(correctAddress)).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1338,24 +1287,20 @@ func TestBytesValueFromSelfState(t *testing.T) { func TestStringValueFromSelfState(t *testing.T) { notFoundErr := errors.New("not found") correctAddress := proto.MustAddressFromString("3Myqjf1D44wR8Vko4Tr5CwSzRNo2Vg9S7u7") - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestStringEntryFunc: func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - if *account.Address() == correctAddress && key == "key" { - return &proto.StringDataEntry{Key: "key", Value: "value"}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestStringEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { + if *account.Address() == correctAddress && key == "key" { + return &proto.StringDataEntry{Key: "key", Value: "value"}, nil } - }, - thisFunc: func() rideType { - return rideAddress(correctAddress) - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() + env.EXPECT().this().Return(rideAddress(correctAddress)).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1380,24 +1325,20 @@ func TestStringValueFromSelfState(t *testing.T) { func TestBooleanValueFromSelfState(t *testing.T) { notFoundErr := errors.New("not found") correctAddress := proto.MustAddressFromString("3Myqjf1D44wR8Vko4Tr5CwSzRNo2Vg9S7u7") - env := &mockRideEnvironment{ - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestBooleanEntryFunc: func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - if *account.Address() == correctAddress && key == "key" { - return &proto.BooleanDataEntry{Key: "key", Value: true}, nil - } - return nil, notFoundErr - }, - IsNotFoundFunc: func(err error) bool { - return errors.Is(err, notFoundErr) - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestBooleanEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + if *account.Address() == correctAddress && key == "key" { + return &proto.BooleanDataEntry{Key: "key", Value: true}, nil } - }, - thisFunc: func() rideType { - return rideAddress(correctAddress) - }, - } + return nil, notFoundErr + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { + return errors.Is(err, notFoundErr) + }).Maybe() + env := NewMockEnvironment(t) + env.EXPECT().state().Return(ss).Maybe() + env.EXPECT().this().Return(rideAddress(correctAddress)).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1421,9 +1362,8 @@ func TestBooleanValueFromSelfState(t *testing.T) { func TestTransferFromProtobuf(t *testing.T) { var scheme byte = 'T' - te := &mockRideEnvironment{schemeFunc: func() byte { - return 'T' - }} + te := NewMockEnvironment(t) + te.EXPECT().scheme().Return(byte('T')).Maybe() seed, err := base58.Decode("3TUPTbbpiM5UmZDhMmzdsKKNgMvyHwZQncKWfJrxk3bc") require.NoError(t, err) sk, pk, err := crypto.GenerateKeyPair(seed) @@ -1533,7 +1473,7 @@ func TestBN256Groth16Verify(t *testing.T) { } func TestECRecover(t *testing.T) { - te := &mockRideEnvironment{} + te := NewMockEnvironment(t) t.Run("Positive", func(t *testing.T) { const ( msg = "da74793f1299abeb213430596f281261355e29af0fdf5d359fe23cd9aca824c8" @@ -1623,9 +1563,8 @@ func TestECRecover(t *testing.T) { } func TestAddressFromPublicKeyStrict(t *testing.T) { - te := &mockRideEnvironment{schemeFunc: func() byte { - return 'T' - }} + te := NewMockEnvironment(t) + te.EXPECT().scheme().Return(byte('T')).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1663,27 +1602,23 @@ func TestHashScriptAtAddress(t *testing.T) { s2 := []byte("fake script bytes 2") d2, err := crypto.FastHash(s2) require.NoError(t, err) - te := &mockRideEnvironment{ - schemeFunc: func() byte { - return 'T' - }, - stateFunc: func() types.SmartState { - return &MockSmartState{ - NewestScriptBytesByAccountFunc: func(recipient proto.Recipient) (proto.Script, error) { - switch { - case recipient.Eq(r1): - return s1, nil - case recipient.Eq(r2): - return s2, nil - case recipient.Eq(r3), recipient.Eq(r4): - return nil, errors.Wrap(keyvalue.ErrNotFound, "blah-blah") - default: - return nil, errors.New("other error") - } - }, + ss := types.NewMockSmartState(t) + ss.EXPECT().NewestScriptBytesByAccount(mock.Anything).RunAndReturn( + func(recipient proto.Recipient) (proto.Script, error) { + switch { + case recipient.Eq(r1): + return s1, nil + case recipient.Eq(r2): + return s2, nil + case recipient.Eq(r3), recipient.Eq(r4): + return nil, errors.Wrap(keyvalue.ErrNotFound, "blah-blah") + default: + return nil, errors.New("other error") } - }, - } + }).Maybe() + te := NewMockEnvironment(t) + te.EXPECT().scheme().Return(byte('T')).Maybe() + te.EXPECT().state().Return(ss).Maybe() for _, test := range []struct { args []rideType fail bool @@ -1718,11 +1653,8 @@ func TestHashScriptAtAddress(t *testing.T) { func TestCalculateDelay(t *testing.T) { addr := proto.WavesAddress(bytes.Repeat([]byte{0x01}, 26)) vrf := crypto.MustDigestFromBase58("5AFgQTfL1GhVUZr64N6tkmF8usX9QZsPcJbZmsX32VgK") - te := &mockRideEnvironment{ - blockFunc: func() rideType { - return rideBlockInfoV7{baseTarget: 142244892, vrf: rideByteVector(vrf.Bytes())} - }, - } + te := NewMockEnvironment(t) + te.EXPECT().block().Return(rideBlockInfoV7{baseTarget: 142244892, vrf: rideByteVector(vrf.Bytes())}).Maybe() for _, test := range []struct { args []rideType @@ -1748,7 +1680,7 @@ func TestCalculateDelay(t *testing.T) { } func TestGroth16VerifyInvalidArguments(t *testing.T) { - te := &mockRideEnvironment{} + te := NewMockEnvironment(t) large := rideByteVector(make([]byte, 1000)) for i, tc := range []struct { args []rideType diff --git a/pkg/ride/functions_strings_test.go b/pkg/ride/functions_strings_test.go index 777f366ec2..cff00e9a67 100644 --- a/pkg/ride/functions_strings_test.go +++ b/pkg/ride/functions_strings_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" ) @@ -38,9 +39,8 @@ func TestConcatStrings(t *testing.T) { } func TestTakeString(t *testing.T) { - env := &mockRideEnvironment{ - takeStringFunc: v5takeString, - } + env := NewMockEnvironment(t) + env.EXPECT().takeString(mock.Anything, mock.Anything).RunAndReturn(takeRideString).Maybe() for _, test := range []struct { args []rideType fail bool @@ -72,9 +72,8 @@ func TestTakeString(t *testing.T) { } func TestIncorrectTakeString(t *testing.T) { - env := &mockRideEnvironment{ - takeStringFunc: takeRideStringWrong, - } + env := NewMockEnvironment(t) + env.EXPECT().takeString(mock.Anything, mock.Anything).RunAndReturn(takeRideStringWrong).Maybe() for _, test := range []struct { args []rideType fail bool @@ -208,10 +207,13 @@ func TestIndexOfSubstringWithOffset(t *testing.T) { {[]rideType{rideInt(1), rideString("x")}, true, nil}, {[]rideType{rideInt(1)}, true, nil}, {[]rideType{}, true, nil}, - // scala tests from https://github.com/wavesplatform/Waves/pull/3367 - {[]rideType{rideString("x冬xqweqwe"), rideString("x冬xqw"), rideInt(0)}, false, rideInt(0)}, // unicode indexOf with zero offset - {[]rideType{rideString("冬weqwe"), rideString("we"), rideInt(2)}, false, rideInt(4)}, // unicode indexOf with start offset - {[]rideType{rideString(""), rideString("x冬x"), rideInt(1)}, false, rideUnit{}}, // unicode indexOf from empty string with offset + // Scala tests from https://github.com/wavesplatform/Waves/pull/3367. + // Unicode indexOf with zero offset. + {[]rideType{rideString("x冬xqweqwe"), rideString("x冬xqw"), rideInt(0)}, false, rideInt(0)}, + // Unicode indexOf with start offset. + {[]rideType{rideString("冬weqwe"), rideString("we"), rideInt(2)}, false, rideInt(4)}, + // Unicode indexOf from empty string with offset. + {[]rideType{rideString(""), rideString("x冬x"), rideInt(1)}, false, rideUnit{}}, } { r, err := indexOfSubstringWithOffset(nil, test.args...) if test.fail { diff --git a/pkg/ride/mock_environment_test.go b/pkg/ride/mock_environment_test.go new file mode 100644 index 0000000000..5546a313ea --- /dev/null +++ b/pkg/ride/mock_environment_test.go @@ -0,0 +1,1298 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package ride + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/ride/ast" + "github.com/wavesplatform/gowaves/pkg/types" +) + +// NewMockEnvironment creates a new instance of MockEnvironment. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockEnvironment(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEnvironment { + mock := &MockEnvironment{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockEnvironment is an autogenerated mock type for the environment type +type MockEnvironment struct { + mock.Mock +} + +type MockEnvironment_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEnvironment) EXPECT() *MockEnvironment_Expecter { + return &MockEnvironment_Expecter{mock: &_m.Mock} +} + +// block provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) block() rideType { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for block") + } + + var r0 rideType + if returnFunc, ok := ret.Get(0).(func() rideType); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(rideType) + } + } + return r0 +} + +// MockEnvironment_block_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'block' +type MockEnvironment_block_Call struct { + *mock.Call +} + +// block is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) block() *MockEnvironment_block_Call { + return &MockEnvironment_block_Call{Call: _e.mock.On("block")} +} + +func (_c *MockEnvironment_block_Call) Run(run func()) *MockEnvironment_block_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_block_Call) Return(rideTypeMoqParam rideType) *MockEnvironment_block_Call { + _c.Call.Return(rideTypeMoqParam) + return _c +} + +func (_c *MockEnvironment_block_Call) RunAndReturn(run func() rideType) *MockEnvironment_block_Call { + _c.Call.Return(run) + return _c +} + +// blockRewardDistributionActivated provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) blockRewardDistributionActivated() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for blockRewardDistributionActivated") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_blockRewardDistributionActivated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'blockRewardDistributionActivated' +type MockEnvironment_blockRewardDistributionActivated_Call struct { + *mock.Call +} + +// blockRewardDistributionActivated is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) blockRewardDistributionActivated() *MockEnvironment_blockRewardDistributionActivated_Call { + return &MockEnvironment_blockRewardDistributionActivated_Call{Call: _e.mock.On("blockRewardDistributionActivated")} +} + +func (_c *MockEnvironment_blockRewardDistributionActivated_Call) Run(run func()) *MockEnvironment_blockRewardDistributionActivated_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_blockRewardDistributionActivated_Call) Return(b bool) *MockEnvironment_blockRewardDistributionActivated_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_blockRewardDistributionActivated_Call) RunAndReturn(run func() bool) *MockEnvironment_blockRewardDistributionActivated_Call { + _c.Call.Return(run) + return _c +} + +// blockV5Activated provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) blockV5Activated() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for blockV5Activated") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_blockV5Activated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'blockV5Activated' +type MockEnvironment_blockV5Activated_Call struct { + *mock.Call +} + +// blockV5Activated is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) blockV5Activated() *MockEnvironment_blockV5Activated_Call { + return &MockEnvironment_blockV5Activated_Call{Call: _e.mock.On("blockV5Activated")} +} + +func (_c *MockEnvironment_blockV5Activated_Call) Run(run func()) *MockEnvironment_blockV5Activated_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_blockV5Activated_Call) Return(b bool) *MockEnvironment_blockV5Activated_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_blockV5Activated_Call) RunAndReturn(run func() bool) *MockEnvironment_blockV5Activated_Call { + _c.Call.Return(run) + return _c +} + +// checkMessageLength provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) checkMessageLength(n int) bool { + ret := _mock.Called(n) + + if len(ret) == 0 { + panic("no return value specified for checkMessageLength") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(int) bool); ok { + r0 = returnFunc(n) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_checkMessageLength_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'checkMessageLength' +type MockEnvironment_checkMessageLength_Call struct { + *mock.Call +} + +// checkMessageLength is a helper method to define mock.On call +// - n int +func (_e *MockEnvironment_Expecter) checkMessageLength(n interface{}) *MockEnvironment_checkMessageLength_Call { + return &MockEnvironment_checkMessageLength_Call{Call: _e.mock.On("checkMessageLength", n)} +} + +func (_c *MockEnvironment_checkMessageLength_Call) Run(run func(n int)) *MockEnvironment_checkMessageLength_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int + if args[0] != nil { + arg0 = args[0].(int) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnvironment_checkMessageLength_Call) Return(b bool) *MockEnvironment_checkMessageLength_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_checkMessageLength_Call) RunAndReturn(run func(n int) bool) *MockEnvironment_checkMessageLength_Call { + _c.Call.Return(run) + return _c +} + +// complexityCalculator provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) complexityCalculator() complexityCalculator { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for complexityCalculator") + } + + var r0 complexityCalculator + if returnFunc, ok := ret.Get(0).(func() complexityCalculator); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(complexityCalculator) + } + } + return r0 +} + +// MockEnvironment_complexityCalculator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'complexityCalculator' +type MockEnvironment_complexityCalculator_Call struct { + *mock.Call +} + +// complexityCalculator is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) complexityCalculator() *MockEnvironment_complexityCalculator_Call { + return &MockEnvironment_complexityCalculator_Call{Call: _e.mock.On("complexityCalculator")} +} + +func (_c *MockEnvironment_complexityCalculator_Call) Run(run func()) *MockEnvironment_complexityCalculator_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_complexityCalculator_Call) Return(complexityCalculatorMoqParam complexityCalculator) *MockEnvironment_complexityCalculator_Call { + _c.Call.Return(complexityCalculatorMoqParam) + return _c +} + +func (_c *MockEnvironment_complexityCalculator_Call) RunAndReturn(run func() complexityCalculator) *MockEnvironment_complexityCalculator_Call { + _c.Call.Return(run) + return _c +} + +// consensusImprovementsActivated provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) consensusImprovementsActivated() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for consensusImprovementsActivated") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_consensusImprovementsActivated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'consensusImprovementsActivated' +type MockEnvironment_consensusImprovementsActivated_Call struct { + *mock.Call +} + +// consensusImprovementsActivated is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) consensusImprovementsActivated() *MockEnvironment_consensusImprovementsActivated_Call { + return &MockEnvironment_consensusImprovementsActivated_Call{Call: _e.mock.On("consensusImprovementsActivated")} +} + +func (_c *MockEnvironment_consensusImprovementsActivated_Call) Run(run func()) *MockEnvironment_consensusImprovementsActivated_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_consensusImprovementsActivated_Call) Return(b bool) *MockEnvironment_consensusImprovementsActivated_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_consensusImprovementsActivated_Call) RunAndReturn(run func() bool) *MockEnvironment_consensusImprovementsActivated_Call { + _c.Call.Return(run) + return _c +} + +// height provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) height() rideInt { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for height") + } + + var r0 rideInt + if returnFunc, ok := ret.Get(0).(func() rideInt); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(rideInt) + } + return r0 +} + +// MockEnvironment_height_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'height' +type MockEnvironment_height_Call struct { + *mock.Call +} + +// height is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) height() *MockEnvironment_height_Call { + return &MockEnvironment_height_Call{Call: _e.mock.On("height")} +} + +func (_c *MockEnvironment_height_Call) Run(run func()) *MockEnvironment_height_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_height_Call) Return(rideIntMoqParam rideInt) *MockEnvironment_height_Call { + _c.Call.Return(rideIntMoqParam) + return _c +} + +func (_c *MockEnvironment_height_Call) RunAndReturn(run func() rideInt) *MockEnvironment_height_Call { + _c.Call.Return(run) + return _c +} + +// internalPaymentsValidationHeight provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) internalPaymentsValidationHeight() proto.Height { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for internalPaymentsValidationHeight") + } + + var r0 proto.Height + if returnFunc, ok := ret.Get(0).(func() proto.Height); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(proto.Height) + } + return r0 +} + +// MockEnvironment_internalPaymentsValidationHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'internalPaymentsValidationHeight' +type MockEnvironment_internalPaymentsValidationHeight_Call struct { + *mock.Call +} + +// internalPaymentsValidationHeight is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) internalPaymentsValidationHeight() *MockEnvironment_internalPaymentsValidationHeight_Call { + return &MockEnvironment_internalPaymentsValidationHeight_Call{Call: _e.mock.On("internalPaymentsValidationHeight")} +} + +func (_c *MockEnvironment_internalPaymentsValidationHeight_Call) Run(run func()) *MockEnvironment_internalPaymentsValidationHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_internalPaymentsValidationHeight_Call) Return(v proto.Height) *MockEnvironment_internalPaymentsValidationHeight_Call { + _c.Call.Return(v) + return _c +} + +func (_c *MockEnvironment_internalPaymentsValidationHeight_Call) RunAndReturn(run func() proto.Height) *MockEnvironment_internalPaymentsValidationHeight_Call { + _c.Call.Return(run) + return _c +} + +// invocation provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) invocation() rideType { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for invocation") + } + + var r0 rideType + if returnFunc, ok := ret.Get(0).(func() rideType); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(rideType) + } + } + return r0 +} + +// MockEnvironment_invocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'invocation' +type MockEnvironment_invocation_Call struct { + *mock.Call +} + +// invocation is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) invocation() *MockEnvironment_invocation_Call { + return &MockEnvironment_invocation_Call{Call: _e.mock.On("invocation")} +} + +func (_c *MockEnvironment_invocation_Call) Run(run func()) *MockEnvironment_invocation_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_invocation_Call) Return(rideTypeMoqParam rideType) *MockEnvironment_invocation_Call { + _c.Call.Return(rideTypeMoqParam) + return _c +} + +func (_c *MockEnvironment_invocation_Call) RunAndReturn(run func() rideType) *MockEnvironment_invocation_Call { + _c.Call.Return(run) + return _c +} + +// isProtobufTx provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) isProtobufTx() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for isProtobufTx") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_isProtobufTx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'isProtobufTx' +type MockEnvironment_isProtobufTx_Call struct { + *mock.Call +} + +// isProtobufTx is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) isProtobufTx() *MockEnvironment_isProtobufTx_Call { + return &MockEnvironment_isProtobufTx_Call{Call: _e.mock.On("isProtobufTx")} +} + +func (_c *MockEnvironment_isProtobufTx_Call) Run(run func()) *MockEnvironment_isProtobufTx_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_isProtobufTx_Call) Return(b bool) *MockEnvironment_isProtobufTx_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_isProtobufTx_Call) RunAndReturn(run func() bool) *MockEnvironment_isProtobufTx_Call { + _c.Call.Return(run) + return _c +} + +// libVersion provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) libVersion() (ast.LibraryVersion, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for libVersion") + } + + var r0 ast.LibraryVersion + var r1 error + if returnFunc, ok := ret.Get(0).(func() (ast.LibraryVersion, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() ast.LibraryVersion); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(ast.LibraryVersion) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnvironment_libVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'libVersion' +type MockEnvironment_libVersion_Call struct { + *mock.Call +} + +// libVersion is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) libVersion() *MockEnvironment_libVersion_Call { + return &MockEnvironment_libVersion_Call{Call: _e.mock.On("libVersion")} +} + +func (_c *MockEnvironment_libVersion_Call) Run(run func()) *MockEnvironment_libVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_libVersion_Call) Return(libraryVersion ast.LibraryVersion, err error) *MockEnvironment_libVersion_Call { + _c.Call.Return(libraryVersion, err) + return _c +} + +func (_c *MockEnvironment_libVersion_Call) RunAndReturn(run func() (ast.LibraryVersion, error)) *MockEnvironment_libVersion_Call { + _c.Call.Return(run) + return _c +} + +// lightNodeActivated provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) lightNodeActivated() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for lightNodeActivated") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_lightNodeActivated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'lightNodeActivated' +type MockEnvironment_lightNodeActivated_Call struct { + *mock.Call +} + +// lightNodeActivated is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) lightNodeActivated() *MockEnvironment_lightNodeActivated_Call { + return &MockEnvironment_lightNodeActivated_Call{Call: _e.mock.On("lightNodeActivated")} +} + +func (_c *MockEnvironment_lightNodeActivated_Call) Run(run func()) *MockEnvironment_lightNodeActivated_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_lightNodeActivated_Call) Return(b bool) *MockEnvironment_lightNodeActivated_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_lightNodeActivated_Call) RunAndReturn(run func() bool) *MockEnvironment_lightNodeActivated_Call { + _c.Call.Return(run) + return _c +} + +// maxDataEntriesSize provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) maxDataEntriesSize() int { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for maxDataEntriesSize") + } + + var r0 int + if returnFunc, ok := ret.Get(0).(func() int); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(int) + } + return r0 +} + +// MockEnvironment_maxDataEntriesSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'maxDataEntriesSize' +type MockEnvironment_maxDataEntriesSize_Call struct { + *mock.Call +} + +// maxDataEntriesSize is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) maxDataEntriesSize() *MockEnvironment_maxDataEntriesSize_Call { + return &MockEnvironment_maxDataEntriesSize_Call{Call: _e.mock.On("maxDataEntriesSize")} +} + +func (_c *MockEnvironment_maxDataEntriesSize_Call) Run(run func()) *MockEnvironment_maxDataEntriesSize_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_maxDataEntriesSize_Call) Return(n int) *MockEnvironment_maxDataEntriesSize_Call { + _c.Call.Return(n) + return _c +} + +func (_c *MockEnvironment_maxDataEntriesSize_Call) RunAndReturn(run func() int) *MockEnvironment_maxDataEntriesSize_Call { + _c.Call.Return(run) + return _c +} + +// paymentsFixActivated provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) paymentsFixActivated() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for paymentsFixActivated") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_paymentsFixActivated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'paymentsFixActivated' +type MockEnvironment_paymentsFixActivated_Call struct { + *mock.Call +} + +// paymentsFixActivated is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) paymentsFixActivated() *MockEnvironment_paymentsFixActivated_Call { + return &MockEnvironment_paymentsFixActivated_Call{Call: _e.mock.On("paymentsFixActivated")} +} + +func (_c *MockEnvironment_paymentsFixActivated_Call) Run(run func()) *MockEnvironment_paymentsFixActivated_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_paymentsFixActivated_Call) Return(b bool) *MockEnvironment_paymentsFixActivated_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_paymentsFixActivated_Call) RunAndReturn(run func() bool) *MockEnvironment_paymentsFixActivated_Call { + _c.Call.Return(run) + return _c +} + +// paymentsFixAfterHeight provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) paymentsFixAfterHeight() proto.Height { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for paymentsFixAfterHeight") + } + + var r0 proto.Height + if returnFunc, ok := ret.Get(0).(func() proto.Height); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(proto.Height) + } + return r0 +} + +// MockEnvironment_paymentsFixAfterHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'paymentsFixAfterHeight' +type MockEnvironment_paymentsFixAfterHeight_Call struct { + *mock.Call +} + +// paymentsFixAfterHeight is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) paymentsFixAfterHeight() *MockEnvironment_paymentsFixAfterHeight_Call { + return &MockEnvironment_paymentsFixAfterHeight_Call{Call: _e.mock.On("paymentsFixAfterHeight")} +} + +func (_c *MockEnvironment_paymentsFixAfterHeight_Call) Run(run func()) *MockEnvironment_paymentsFixAfterHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_paymentsFixAfterHeight_Call) Return(v proto.Height) *MockEnvironment_paymentsFixAfterHeight_Call { + _c.Call.Return(v) + return _c +} + +func (_c *MockEnvironment_paymentsFixAfterHeight_Call) RunAndReturn(run func() proto.Height) *MockEnvironment_paymentsFixAfterHeight_Call { + _c.Call.Return(run) + return _c +} + +// rideV6Activated provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) rideV6Activated() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for rideV6Activated") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_rideV6Activated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'rideV6Activated' +type MockEnvironment_rideV6Activated_Call struct { + *mock.Call +} + +// rideV6Activated is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) rideV6Activated() *MockEnvironment_rideV6Activated_Call { + return &MockEnvironment_rideV6Activated_Call{Call: _e.mock.On("rideV6Activated")} +} + +func (_c *MockEnvironment_rideV6Activated_Call) Run(run func()) *MockEnvironment_rideV6Activated_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_rideV6Activated_Call) Return(b bool) *MockEnvironment_rideV6Activated_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_rideV6Activated_Call) RunAndReturn(run func() bool) *MockEnvironment_rideV6Activated_Call { + _c.Call.Return(run) + return _c +} + +// scheme provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) scheme() byte { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for scheme") + } + + var r0 byte + if returnFunc, ok := ret.Get(0).(func() byte); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(byte) + } + return r0 +} + +// MockEnvironment_scheme_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'scheme' +type MockEnvironment_scheme_Call struct { + *mock.Call +} + +// scheme is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) scheme() *MockEnvironment_scheme_Call { + return &MockEnvironment_scheme_Call{Call: _e.mock.On("scheme")} +} + +func (_c *MockEnvironment_scheme_Call) Run(run func()) *MockEnvironment_scheme_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_scheme_Call) Return(v byte) *MockEnvironment_scheme_Call { + _c.Call.Return(v) + return _c +} + +func (_c *MockEnvironment_scheme_Call) RunAndReturn(run func() byte) *MockEnvironment_scheme_Call { + _c.Call.Return(run) + return _c +} + +// setComplexityCalculator provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) setComplexityCalculator(cc complexityCalculator) { + _mock.Called(cc) + return +} + +// MockEnvironment_setComplexityCalculator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'setComplexityCalculator' +type MockEnvironment_setComplexityCalculator_Call struct { + *mock.Call +} + +// setComplexityCalculator is a helper method to define mock.On call +// - cc complexityCalculator +func (_e *MockEnvironment_Expecter) setComplexityCalculator(cc interface{}) *MockEnvironment_setComplexityCalculator_Call { + return &MockEnvironment_setComplexityCalculator_Call{Call: _e.mock.On("setComplexityCalculator", cc)} +} + +func (_c *MockEnvironment_setComplexityCalculator_Call) Run(run func(cc complexityCalculator)) *MockEnvironment_setComplexityCalculator_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 complexityCalculator + if args[0] != nil { + arg0 = args[0].(complexityCalculator) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnvironment_setComplexityCalculator_Call) Return() *MockEnvironment_setComplexityCalculator_Call { + _c.Call.Return() + return _c +} + +func (_c *MockEnvironment_setComplexityCalculator_Call) RunAndReturn(run func(cc complexityCalculator)) *MockEnvironment_setComplexityCalculator_Call { + _c.Run(run) + return _c +} + +// setInvocation provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) setInvocation(inv rideType) { + _mock.Called(inv) + return +} + +// MockEnvironment_setInvocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'setInvocation' +type MockEnvironment_setInvocation_Call struct { + *mock.Call +} + +// setInvocation is a helper method to define mock.On call +// - inv rideType +func (_e *MockEnvironment_Expecter) setInvocation(inv interface{}) *MockEnvironment_setInvocation_Call { + return &MockEnvironment_setInvocation_Call{Call: _e.mock.On("setInvocation", inv)} +} + +func (_c *MockEnvironment_setInvocation_Call) Run(run func(inv rideType)) *MockEnvironment_setInvocation_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 rideType + if args[0] != nil { + arg0 = args[0].(rideType) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnvironment_setInvocation_Call) Return() *MockEnvironment_setInvocation_Call { + _c.Call.Return() + return _c +} + +func (_c *MockEnvironment_setInvocation_Call) RunAndReturn(run func(inv rideType)) *MockEnvironment_setInvocation_Call { + _c.Run(run) + return _c +} + +// setLibVersion provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) setLibVersion(v ast.LibraryVersion) { + _mock.Called(v) + return +} + +// MockEnvironment_setLibVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'setLibVersion' +type MockEnvironment_setLibVersion_Call struct { + *mock.Call +} + +// setLibVersion is a helper method to define mock.On call +// - v ast.LibraryVersion +func (_e *MockEnvironment_Expecter) setLibVersion(v interface{}) *MockEnvironment_setLibVersion_Call { + return &MockEnvironment_setLibVersion_Call{Call: _e.mock.On("setLibVersion", v)} +} + +func (_c *MockEnvironment_setLibVersion_Call) Run(run func(v ast.LibraryVersion)) *MockEnvironment_setLibVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 ast.LibraryVersion + if args[0] != nil { + arg0 = args[0].(ast.LibraryVersion) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnvironment_setLibVersion_Call) Return() *MockEnvironment_setLibVersion_Call { + _c.Call.Return() + return _c +} + +func (_c *MockEnvironment_setLibVersion_Call) RunAndReturn(run func(v ast.LibraryVersion)) *MockEnvironment_setLibVersion_Call { + _c.Run(run) + return _c +} + +// setNewDAppAddress provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) setNewDAppAddress(address proto.WavesAddress) { + _mock.Called(address) + return +} + +// MockEnvironment_setNewDAppAddress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'setNewDAppAddress' +type MockEnvironment_setNewDAppAddress_Call struct { + *mock.Call +} + +// setNewDAppAddress is a helper method to define mock.On call +// - address proto.WavesAddress +func (_e *MockEnvironment_Expecter) setNewDAppAddress(address interface{}) *MockEnvironment_setNewDAppAddress_Call { + return &MockEnvironment_setNewDAppAddress_Call{Call: _e.mock.On("setNewDAppAddress", address)} +} + +func (_c *MockEnvironment_setNewDAppAddress_Call) Run(run func(address proto.WavesAddress)) *MockEnvironment_setNewDAppAddress_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnvironment_setNewDAppAddress_Call) Return() *MockEnvironment_setNewDAppAddress_Call { + _c.Call.Return() + return _c +} + +func (_c *MockEnvironment_setNewDAppAddress_Call) RunAndReturn(run func(address proto.WavesAddress)) *MockEnvironment_setNewDAppAddress_Call { + _c.Run(run) + return _c +} + +// state provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) state() types.SmartState { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for state") + } + + var r0 types.SmartState + if returnFunc, ok := ret.Get(0).(func() types.SmartState); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.SmartState) + } + } + return r0 +} + +// MockEnvironment_state_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'state' +type MockEnvironment_state_Call struct { + *mock.Call +} + +// state is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) state() *MockEnvironment_state_Call { + return &MockEnvironment_state_Call{Call: _e.mock.On("state")} +} + +func (_c *MockEnvironment_state_Call) Run(run func()) *MockEnvironment_state_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_state_Call) Return(smartState types.SmartState) *MockEnvironment_state_Call { + _c.Call.Return(smartState) + return _c +} + +func (_c *MockEnvironment_state_Call) RunAndReturn(run func() types.SmartState) *MockEnvironment_state_Call { + _c.Call.Return(run) + return _c +} + +// takeString provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) takeString(s string, n int) rideString { + ret := _mock.Called(s, n) + + if len(ret) == 0 { + panic("no return value specified for takeString") + } + + var r0 rideString + if returnFunc, ok := ret.Get(0).(func(string, int) rideString); ok { + r0 = returnFunc(s, n) + } else { + r0 = ret.Get(0).(rideString) + } + return r0 +} + +// MockEnvironment_takeString_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'takeString' +type MockEnvironment_takeString_Call struct { + *mock.Call +} + +// takeString is a helper method to define mock.On call +// - s string +// - n int +func (_e *MockEnvironment_Expecter) takeString(s interface{}, n interface{}) *MockEnvironment_takeString_Call { + return &MockEnvironment_takeString_Call{Call: _e.mock.On("takeString", s, n)} +} + +func (_c *MockEnvironment_takeString_Call) Run(run func(s string, n int)) *MockEnvironment_takeString_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + var arg1 int + if args[1] != nil { + arg1 = args[1].(int) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockEnvironment_takeString_Call) Return(rideStringMoqParam rideString) *MockEnvironment_takeString_Call { + _c.Call.Return(rideStringMoqParam) + return _c +} + +func (_c *MockEnvironment_takeString_Call) RunAndReturn(run func(s string, n int) rideString) *MockEnvironment_takeString_Call { + _c.Call.Return(run) + return _c +} + +// this provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) this() rideType { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for this") + } + + var r0 rideType + if returnFunc, ok := ret.Get(0).(func() rideType); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(rideType) + } + } + return r0 +} + +// MockEnvironment_this_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'this' +type MockEnvironment_this_Call struct { + *mock.Call +} + +// this is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) this() *MockEnvironment_this_Call { + return &MockEnvironment_this_Call{Call: _e.mock.On("this")} +} + +func (_c *MockEnvironment_this_Call) Run(run func()) *MockEnvironment_this_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_this_Call) Return(rideTypeMoqParam rideType) *MockEnvironment_this_Call { + _c.Call.Return(rideTypeMoqParam) + return _c +} + +func (_c *MockEnvironment_this_Call) RunAndReturn(run func() rideType) *MockEnvironment_this_Call { + _c.Call.Return(run) + return _c +} + +// timestamp provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) timestamp() uint64 { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for timestamp") + } + + var r0 uint64 + if returnFunc, ok := ret.Get(0).(func() uint64); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(uint64) + } + return r0 +} + +// MockEnvironment_timestamp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'timestamp' +type MockEnvironment_timestamp_Call struct { + *mock.Call +} + +// timestamp is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) timestamp() *MockEnvironment_timestamp_Call { + return &MockEnvironment_timestamp_Call{Call: _e.mock.On("timestamp")} +} + +func (_c *MockEnvironment_timestamp_Call) Run(run func()) *MockEnvironment_timestamp_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_timestamp_Call) Return(v uint64) *MockEnvironment_timestamp_Call { + _c.Call.Return(v) + return _c +} + +func (_c *MockEnvironment_timestamp_Call) RunAndReturn(run func() uint64) *MockEnvironment_timestamp_Call { + _c.Call.Return(run) + return _c +} + +// transaction provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) transaction() rideType { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for transaction") + } + + var r0 rideType + if returnFunc, ok := ret.Get(0).(func() rideType); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(rideType) + } + } + return r0 +} + +// MockEnvironment_transaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'transaction' +type MockEnvironment_transaction_Call struct { + *mock.Call +} + +// transaction is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) transaction() *MockEnvironment_transaction_Call { + return &MockEnvironment_transaction_Call{Call: _e.mock.On("transaction")} +} + +func (_c *MockEnvironment_transaction_Call) Run(run func()) *MockEnvironment_transaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_transaction_Call) Return(rideTypeMoqParam rideType) *MockEnvironment_transaction_Call { + _c.Call.Return(rideTypeMoqParam) + return _c +} + +func (_c *MockEnvironment_transaction_Call) RunAndReturn(run func() rideType) *MockEnvironment_transaction_Call { + _c.Call.Return(run) + return _c +} + +// txID provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) txID() rideType { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for txID") + } + + var r0 rideType + if returnFunc, ok := ret.Get(0).(func() rideType); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(rideType) + } + } + return r0 +} + +// MockEnvironment_txID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'txID' +type MockEnvironment_txID_Call struct { + *mock.Call +} + +// txID is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) txID() *MockEnvironment_txID_Call { + return &MockEnvironment_txID_Call{Call: _e.mock.On("txID")} +} + +func (_c *MockEnvironment_txID_Call) Run(run func()) *MockEnvironment_txID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_txID_Call) Return(rideTypeMoqParam rideType) *MockEnvironment_txID_Call { + _c.Call.Return(rideTypeMoqParam) + return _c +} + +func (_c *MockEnvironment_txID_Call) RunAndReturn(run func() rideType) *MockEnvironment_txID_Call { + _c.Call.Return(run) + return _c +} + +// validateInternalPayments provides a mock function for the type MockEnvironment +func (_mock *MockEnvironment) validateInternalPayments() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for validateInternalPayments") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnvironment_validateInternalPayments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'validateInternalPayments' +type MockEnvironment_validateInternalPayments_Call struct { + *mock.Call +} + +// validateInternalPayments is a helper method to define mock.On call +func (_e *MockEnvironment_Expecter) validateInternalPayments() *MockEnvironment_validateInternalPayments_Call { + return &MockEnvironment_validateInternalPayments_Call{Call: _e.mock.On("validateInternalPayments")} +} + +func (_c *MockEnvironment_validateInternalPayments_Call) Run(run func()) *MockEnvironment_validateInternalPayments_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnvironment_validateInternalPayments_Call) Return(b bool) *MockEnvironment_validateInternalPayments_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnvironment_validateInternalPayments_Call) RunAndReturn(run func() bool) *MockEnvironment_validateInternalPayments_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/ride/runtime.go b/pkg/ride/runtime.go index 163c2c06ee..e680640f3f 100644 --- a/pkg/ride/runtime.go +++ b/pkg/ride/runtime.go @@ -420,7 +420,6 @@ func fieldLines(key string, valueLines []string) []string { return r } -//go:generate moq -out runtime_moq_test.go . environment:mockRideEnvironment type environment interface { scheme() byte height() rideInt diff --git a/pkg/ride/runtime_moq_test.go b/pkg/ride/runtime_moq_test.go deleted file mode 100644 index 2a66d13d9f..0000000000 --- a/pkg/ride/runtime_moq_test.go +++ /dev/null @@ -1,1117 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package ride - -import ( - "github.com/wavesplatform/gowaves/pkg/proto" - "github.com/wavesplatform/gowaves/pkg/ride/ast" - "github.com/wavesplatform/gowaves/pkg/types" - "sync" -) - -// Ensure, that mockRideEnvironment does implement environment. -// If this is not the case, regenerate this file with moq. -var _ environment = &mockRideEnvironment{} - -// mockRideEnvironment is a mock implementation of environment. -// -// func TestSomethingThatUsesenvironment(t *testing.T) { -// -// // make and configure a mocked environment -// mockedenvironment := &mockRideEnvironment{ -// blockFunc: func() rideType { -// panic("mock out the block method") -// }, -// blockRewardDistributionActivatedFunc: func() bool { -// panic("mock out the blockRewardDistributionActivated method") -// }, -// blockV5ActivatedFunc: func() bool { -// panic("mock out the blockV5Activated method") -// }, -// checkMessageLengthFunc: func(n int) bool { -// panic("mock out the checkMessageLength method") -// }, -// complexityCalculatorFunc: func() complexityCalculator { -// panic("mock out the complexityCalculator method") -// }, -// consensusImprovementsActivatedFunc: func() bool { -// panic("mock out the consensusImprovementsActivated method") -// }, -// heightFunc: func() rideInt { -// panic("mock out the height method") -// }, -// internalPaymentsValidationHeightFunc: func() uint64 { -// panic("mock out the internalPaymentsValidationHeight method") -// }, -// invocationFunc: func() rideType { -// panic("mock out the invocation method") -// }, -// isProtobufTxFunc: func() bool { -// panic("mock out the isProtobufTx method") -// }, -// libVersionFunc: func() (ast.LibraryVersion, error) { -// panic("mock out the libVersion method") -// }, -// lightNodeActivatedFunc: func() bool { -// panic("mock out the lightNodeActivated method") -// }, -// maxDataEntriesSizeFunc: func() int { -// panic("mock out the maxDataEntriesSize method") -// }, -// paymentsFixActivatedFunc: func() bool { -// panic("mock out the paymentsFixActivated method") -// }, -// paymentsFixAfterHeightFunc: func() uint64 { -// panic("mock out the paymentsFixAfterHeight method") -// }, -// rideV6ActivatedFunc: func() bool { -// panic("mock out the rideV6Activated method") -// }, -// schemeFunc: func() byte { -// panic("mock out the scheme method") -// }, -// setComplexityCalculatorFunc: func(cc complexityCalculator) { -// panic("mock out the setComplexityCalculator method") -// }, -// setInvocationFunc: func(inv rideType) { -// panic("mock out the setInvocation method") -// }, -// setLibVersionFunc: func(v ast.LibraryVersion) { -// panic("mock out the setLibVersion method") -// }, -// setNewDAppAddressFunc: func(address proto.WavesAddress) { -// panic("mock out the setNewDAppAddress method") -// }, -// stateFunc: func() types.SmartState { -// panic("mock out the state method") -// }, -// takeStringFunc: func(s string, n int) rideString { -// panic("mock out the takeString method") -// }, -// thisFunc: func() rideType { -// panic("mock out the this method") -// }, -// timestampFunc: func() uint64 { -// panic("mock out the timestamp method") -// }, -// transactionFunc: func() rideType { -// panic("mock out the transaction method") -// }, -// txIDFunc: func() rideType { -// panic("mock out the txID method") -// }, -// validateInternalPaymentsFunc: func() bool { -// panic("mock out the validateInternalPayments method") -// }, -// } -// -// // use mockedenvironment in code that requires environment -// // and then make assertions. -// -// } -type mockRideEnvironment struct { - // blockFunc mocks the block method. - blockFunc func() rideType - - // blockRewardDistributionActivatedFunc mocks the blockRewardDistributionActivated method. - blockRewardDistributionActivatedFunc func() bool - - // blockV5ActivatedFunc mocks the blockV5Activated method. - blockV5ActivatedFunc func() bool - - // checkMessageLengthFunc mocks the checkMessageLength method. - checkMessageLengthFunc func(n int) bool - - // complexityCalculatorFunc mocks the complexityCalculator method. - complexityCalculatorFunc func() complexityCalculator - - // consensusImprovementsActivatedFunc mocks the consensusImprovementsActivated method. - consensusImprovementsActivatedFunc func() bool - - // heightFunc mocks the height method. - heightFunc func() rideInt - - // internalPaymentsValidationHeightFunc mocks the internalPaymentsValidationHeight method. - internalPaymentsValidationHeightFunc func() uint64 - - // invocationFunc mocks the invocation method. - invocationFunc func() rideType - - // isProtobufTxFunc mocks the isProtobufTx method. - isProtobufTxFunc func() bool - - // libVersionFunc mocks the libVersion method. - libVersionFunc func() (ast.LibraryVersion, error) - - // lightNodeActivatedFunc mocks the lightNodeActivated method. - lightNodeActivatedFunc func() bool - - // maxDataEntriesSizeFunc mocks the maxDataEntriesSize method. - maxDataEntriesSizeFunc func() int - - // paymentsFixActivatedFunc mocks the paymentsFixActivated method. - paymentsFixActivatedFunc func() bool - - // paymentsFixAfterHeightFunc mocks the paymentsFixAfterHeight method. - paymentsFixAfterHeightFunc func() uint64 - - // rideV6ActivatedFunc mocks the rideV6Activated method. - rideV6ActivatedFunc func() bool - - // schemeFunc mocks the scheme method. - schemeFunc func() byte - - // setComplexityCalculatorFunc mocks the setComplexityCalculator method. - setComplexityCalculatorFunc func(cc complexityCalculator) - - // setInvocationFunc mocks the setInvocation method. - setInvocationFunc func(inv rideType) - - // setLibVersionFunc mocks the setLibVersion method. - setLibVersionFunc func(v ast.LibraryVersion) - - // setNewDAppAddressFunc mocks the setNewDAppAddress method. - setNewDAppAddressFunc func(address proto.WavesAddress) - - // stateFunc mocks the state method. - stateFunc func() types.SmartState - - // takeStringFunc mocks the takeString method. - takeStringFunc func(s string, n int) rideString - - // thisFunc mocks the this method. - thisFunc func() rideType - - // timestampFunc mocks the timestamp method. - timestampFunc func() uint64 - - // transactionFunc mocks the transaction method. - transactionFunc func() rideType - - // txIDFunc mocks the txID method. - txIDFunc func() rideType - - // validateInternalPaymentsFunc mocks the validateInternalPayments method. - validateInternalPaymentsFunc func() bool - - // calls tracks calls to the methods. - calls struct { - // block holds details about calls to the block method. - block []struct { - } - // blockRewardDistributionActivated holds details about calls to the blockRewardDistributionActivated method. - blockRewardDistributionActivated []struct { - } - // blockV5Activated holds details about calls to the blockV5Activated method. - blockV5Activated []struct { - } - // checkMessageLength holds details about calls to the checkMessageLength method. - checkMessageLength []struct { - // N is the n argument value. - N int - } - // complexityCalculator holds details about calls to the complexityCalculator method. - complexityCalculator []struct { - } - // consensusImprovementsActivated holds details about calls to the consensusImprovementsActivated method. - consensusImprovementsActivated []struct { - } - // height holds details about calls to the height method. - height []struct { - } - // internalPaymentsValidationHeight holds details about calls to the internalPaymentsValidationHeight method. - internalPaymentsValidationHeight []struct { - } - // invocation holds details about calls to the invocation method. - invocation []struct { - } - // isProtobufTx holds details about calls to the isProtobufTx method. - isProtobufTx []struct { - } - // libVersion holds details about calls to the libVersion method. - libVersion []struct { - } - // lightNodeActivated holds details about calls to the lightNodeActivated method. - lightNodeActivated []struct { - } - // maxDataEntriesSize holds details about calls to the maxDataEntriesSize method. - maxDataEntriesSize []struct { - } - // paymentsFixActivated holds details about calls to the paymentsFixActivated method. - paymentsFixActivated []struct { - } - // paymentsFixAfterHeight holds details about calls to the paymentsFixAfterHeight method. - paymentsFixAfterHeight []struct { - } - // rideV6Activated holds details about calls to the rideV6Activated method. - rideV6Activated []struct { - } - // scheme holds details about calls to the scheme method. - scheme []struct { - } - // setComplexityCalculator holds details about calls to the setComplexityCalculator method. - setComplexityCalculator []struct { - // Cc is the cc argument value. - Cc complexityCalculator - } - // setInvocation holds details about calls to the setInvocation method. - setInvocation []struct { - // Inv is the inv argument value. - Inv rideType - } - // setLibVersion holds details about calls to the setLibVersion method. - setLibVersion []struct { - // V is the v argument value. - V ast.LibraryVersion - } - // setNewDAppAddress holds details about calls to the setNewDAppAddress method. - setNewDAppAddress []struct { - // Address is the address argument value. - Address proto.WavesAddress - } - // state holds details about calls to the state method. - state []struct { - } - // takeString holds details about calls to the takeString method. - takeString []struct { - // S is the s argument value. - S string - // N is the n argument value. - N int - } - // this holds details about calls to the this method. - this []struct { - } - // timestamp holds details about calls to the timestamp method. - timestamp []struct { - } - // transaction holds details about calls to the transaction method. - transaction []struct { - } - // txID holds details about calls to the txID method. - txID []struct { - } - // validateInternalPayments holds details about calls to the validateInternalPayments method. - validateInternalPayments []struct { - } - } - lockblock sync.RWMutex - lockblockRewardDistributionActivated sync.RWMutex - lockblockV5Activated sync.RWMutex - lockcheckMessageLength sync.RWMutex - lockcomplexityCalculator sync.RWMutex - lockconsensusImprovementsActivated sync.RWMutex - lockheight sync.RWMutex - lockinternalPaymentsValidationHeight sync.RWMutex - lockinvocation sync.RWMutex - lockisProtobufTx sync.RWMutex - locklibVersion sync.RWMutex - locklightNodeActivated sync.RWMutex - lockmaxDataEntriesSize sync.RWMutex - lockpaymentsFixActivated sync.RWMutex - lockpaymentsFixAfterHeight sync.RWMutex - lockrideV6Activated sync.RWMutex - lockscheme sync.RWMutex - locksetComplexityCalculator sync.RWMutex - locksetInvocation sync.RWMutex - locksetLibVersion sync.RWMutex - locksetNewDAppAddress sync.RWMutex - lockstate sync.RWMutex - locktakeString sync.RWMutex - lockthis sync.RWMutex - locktimestamp sync.RWMutex - locktransaction sync.RWMutex - locktxID sync.RWMutex - lockvalidateInternalPayments sync.RWMutex -} - -// block calls blockFunc. -func (mock *mockRideEnvironment) block() rideType { - if mock.blockFunc == nil { - panic("mockRideEnvironment.blockFunc: method is nil but environment.block was just called") - } - callInfo := struct { - }{} - mock.lockblock.Lock() - mock.calls.block = append(mock.calls.block, callInfo) - mock.lockblock.Unlock() - return mock.blockFunc() -} - -// blockCalls gets all the calls that were made to block. -// Check the length with: -// -// len(mockedenvironment.blockCalls()) -func (mock *mockRideEnvironment) blockCalls() []struct { -} { - var calls []struct { - } - mock.lockblock.RLock() - calls = mock.calls.block - mock.lockblock.RUnlock() - return calls -} - -// blockRewardDistributionActivated calls blockRewardDistributionActivatedFunc. -func (mock *mockRideEnvironment) blockRewardDistributionActivated() bool { - if mock.blockRewardDistributionActivatedFunc == nil { - panic("mockRideEnvironment.blockRewardDistributionActivatedFunc: method is nil but environment.blockRewardDistributionActivated was just called") - } - callInfo := struct { - }{} - mock.lockblockRewardDistributionActivated.Lock() - mock.calls.blockRewardDistributionActivated = append(mock.calls.blockRewardDistributionActivated, callInfo) - mock.lockblockRewardDistributionActivated.Unlock() - return mock.blockRewardDistributionActivatedFunc() -} - -// blockRewardDistributionActivatedCalls gets all the calls that were made to blockRewardDistributionActivated. -// Check the length with: -// -// len(mockedenvironment.blockRewardDistributionActivatedCalls()) -func (mock *mockRideEnvironment) blockRewardDistributionActivatedCalls() []struct { -} { - var calls []struct { - } - mock.lockblockRewardDistributionActivated.RLock() - calls = mock.calls.blockRewardDistributionActivated - mock.lockblockRewardDistributionActivated.RUnlock() - return calls -} - -// blockV5Activated calls blockV5ActivatedFunc. -func (mock *mockRideEnvironment) blockV5Activated() bool { - if mock.blockV5ActivatedFunc == nil { - panic("mockRideEnvironment.blockV5ActivatedFunc: method is nil but environment.blockV5Activated was just called") - } - callInfo := struct { - }{} - mock.lockblockV5Activated.Lock() - mock.calls.blockV5Activated = append(mock.calls.blockV5Activated, callInfo) - mock.lockblockV5Activated.Unlock() - return mock.blockV5ActivatedFunc() -} - -// blockV5ActivatedCalls gets all the calls that were made to blockV5Activated. -// Check the length with: -// -// len(mockedenvironment.blockV5ActivatedCalls()) -func (mock *mockRideEnvironment) blockV5ActivatedCalls() []struct { -} { - var calls []struct { - } - mock.lockblockV5Activated.RLock() - calls = mock.calls.blockV5Activated - mock.lockblockV5Activated.RUnlock() - return calls -} - -// checkMessageLength calls checkMessageLengthFunc. -func (mock *mockRideEnvironment) checkMessageLength(n int) bool { - if mock.checkMessageLengthFunc == nil { - panic("mockRideEnvironment.checkMessageLengthFunc: method is nil but environment.checkMessageLength was just called") - } - callInfo := struct { - N int - }{ - N: n, - } - mock.lockcheckMessageLength.Lock() - mock.calls.checkMessageLength = append(mock.calls.checkMessageLength, callInfo) - mock.lockcheckMessageLength.Unlock() - return mock.checkMessageLengthFunc(n) -} - -// checkMessageLengthCalls gets all the calls that were made to checkMessageLength. -// Check the length with: -// -// len(mockedenvironment.checkMessageLengthCalls()) -func (mock *mockRideEnvironment) checkMessageLengthCalls() []struct { - N int -} { - var calls []struct { - N int - } - mock.lockcheckMessageLength.RLock() - calls = mock.calls.checkMessageLength - mock.lockcheckMessageLength.RUnlock() - return calls -} - -// complexityCalculator calls complexityCalculatorFunc. -func (mock *mockRideEnvironment) complexityCalculator() complexityCalculator { - if mock.complexityCalculatorFunc == nil { - panic("mockRideEnvironment.complexityCalculatorFunc: method is nil but environment.complexityCalculator was just called") - } - callInfo := struct { - }{} - mock.lockcomplexityCalculator.Lock() - mock.calls.complexityCalculator = append(mock.calls.complexityCalculator, callInfo) - mock.lockcomplexityCalculator.Unlock() - return mock.complexityCalculatorFunc() -} - -// complexityCalculatorCalls gets all the calls that were made to complexityCalculator. -// Check the length with: -// -// len(mockedenvironment.complexityCalculatorCalls()) -func (mock *mockRideEnvironment) complexityCalculatorCalls() []struct { -} { - var calls []struct { - } - mock.lockcomplexityCalculator.RLock() - calls = mock.calls.complexityCalculator - mock.lockcomplexityCalculator.RUnlock() - return calls -} - -// consensusImprovementsActivated calls consensusImprovementsActivatedFunc. -func (mock *mockRideEnvironment) consensusImprovementsActivated() bool { - if mock.consensusImprovementsActivatedFunc == nil { - panic("mockRideEnvironment.consensusImprovementsActivatedFunc: method is nil but environment.consensusImprovementsActivated was just called") - } - callInfo := struct { - }{} - mock.lockconsensusImprovementsActivated.Lock() - mock.calls.consensusImprovementsActivated = append(mock.calls.consensusImprovementsActivated, callInfo) - mock.lockconsensusImprovementsActivated.Unlock() - return mock.consensusImprovementsActivatedFunc() -} - -// consensusImprovementsActivatedCalls gets all the calls that were made to consensusImprovementsActivated. -// Check the length with: -// -// len(mockedenvironment.consensusImprovementsActivatedCalls()) -func (mock *mockRideEnvironment) consensusImprovementsActivatedCalls() []struct { -} { - var calls []struct { - } - mock.lockconsensusImprovementsActivated.RLock() - calls = mock.calls.consensusImprovementsActivated - mock.lockconsensusImprovementsActivated.RUnlock() - return calls -} - -// height calls heightFunc. -func (mock *mockRideEnvironment) height() rideInt { - if mock.heightFunc == nil { - panic("mockRideEnvironment.heightFunc: method is nil but environment.height was just called") - } - callInfo := struct { - }{} - mock.lockheight.Lock() - mock.calls.height = append(mock.calls.height, callInfo) - mock.lockheight.Unlock() - return mock.heightFunc() -} - -// heightCalls gets all the calls that were made to height. -// Check the length with: -// -// len(mockedenvironment.heightCalls()) -func (mock *mockRideEnvironment) heightCalls() []struct { -} { - var calls []struct { - } - mock.lockheight.RLock() - calls = mock.calls.height - mock.lockheight.RUnlock() - return calls -} - -// internalPaymentsValidationHeight calls internalPaymentsValidationHeightFunc. -func (mock *mockRideEnvironment) internalPaymentsValidationHeight() uint64 { - if mock.internalPaymentsValidationHeightFunc == nil { - panic("mockRideEnvironment.internalPaymentsValidationHeightFunc: method is nil but environment.internalPaymentsValidationHeight was just called") - } - callInfo := struct { - }{} - mock.lockinternalPaymentsValidationHeight.Lock() - mock.calls.internalPaymentsValidationHeight = append(mock.calls.internalPaymentsValidationHeight, callInfo) - mock.lockinternalPaymentsValidationHeight.Unlock() - return mock.internalPaymentsValidationHeightFunc() -} - -// internalPaymentsValidationHeightCalls gets all the calls that were made to internalPaymentsValidationHeight. -// Check the length with: -// -// len(mockedenvironment.internalPaymentsValidationHeightCalls()) -func (mock *mockRideEnvironment) internalPaymentsValidationHeightCalls() []struct { -} { - var calls []struct { - } - mock.lockinternalPaymentsValidationHeight.RLock() - calls = mock.calls.internalPaymentsValidationHeight - mock.lockinternalPaymentsValidationHeight.RUnlock() - return calls -} - -// invocation calls invocationFunc. -func (mock *mockRideEnvironment) invocation() rideType { - if mock.invocationFunc == nil { - panic("mockRideEnvironment.invocationFunc: method is nil but environment.invocation was just called") - } - callInfo := struct { - }{} - mock.lockinvocation.Lock() - mock.calls.invocation = append(mock.calls.invocation, callInfo) - mock.lockinvocation.Unlock() - return mock.invocationFunc() -} - -// invocationCalls gets all the calls that were made to invocation. -// Check the length with: -// -// len(mockedenvironment.invocationCalls()) -func (mock *mockRideEnvironment) invocationCalls() []struct { -} { - var calls []struct { - } - mock.lockinvocation.RLock() - calls = mock.calls.invocation - mock.lockinvocation.RUnlock() - return calls -} - -// isProtobufTx calls isProtobufTxFunc. -func (mock *mockRideEnvironment) isProtobufTx() bool { - if mock.isProtobufTxFunc == nil { - panic("mockRideEnvironment.isProtobufTxFunc: method is nil but environment.isProtobufTx was just called") - } - callInfo := struct { - }{} - mock.lockisProtobufTx.Lock() - mock.calls.isProtobufTx = append(mock.calls.isProtobufTx, callInfo) - mock.lockisProtobufTx.Unlock() - return mock.isProtobufTxFunc() -} - -// isProtobufTxCalls gets all the calls that were made to isProtobufTx. -// Check the length with: -// -// len(mockedenvironment.isProtobufTxCalls()) -func (mock *mockRideEnvironment) isProtobufTxCalls() []struct { -} { - var calls []struct { - } - mock.lockisProtobufTx.RLock() - calls = mock.calls.isProtobufTx - mock.lockisProtobufTx.RUnlock() - return calls -} - -// libVersion calls libVersionFunc. -func (mock *mockRideEnvironment) libVersion() (ast.LibraryVersion, error) { - if mock.libVersionFunc == nil { - panic("mockRideEnvironment.libVersionFunc: method is nil but environment.libVersion was just called") - } - callInfo := struct { - }{} - mock.locklibVersion.Lock() - mock.calls.libVersion = append(mock.calls.libVersion, callInfo) - mock.locklibVersion.Unlock() - return mock.libVersionFunc() -} - -// libVersionCalls gets all the calls that were made to libVersion. -// Check the length with: -// -// len(mockedenvironment.libVersionCalls()) -func (mock *mockRideEnvironment) libVersionCalls() []struct { -} { - var calls []struct { - } - mock.locklibVersion.RLock() - calls = mock.calls.libVersion - mock.locklibVersion.RUnlock() - return calls -} - -// lightNodeActivated calls lightNodeActivatedFunc. -func (mock *mockRideEnvironment) lightNodeActivated() bool { - if mock.lightNodeActivatedFunc == nil { - panic("mockRideEnvironment.lightNodeActivatedFunc: method is nil but environment.lightNodeActivated was just called") - } - callInfo := struct { - }{} - mock.locklightNodeActivated.Lock() - mock.calls.lightNodeActivated = append(mock.calls.lightNodeActivated, callInfo) - mock.locklightNodeActivated.Unlock() - return mock.lightNodeActivatedFunc() -} - -// lightNodeActivatedCalls gets all the calls that were made to lightNodeActivated. -// Check the length with: -// -// len(mockedenvironment.lightNodeActivatedCalls()) -func (mock *mockRideEnvironment) lightNodeActivatedCalls() []struct { -} { - var calls []struct { - } - mock.locklightNodeActivated.RLock() - calls = mock.calls.lightNodeActivated - mock.locklightNodeActivated.RUnlock() - return calls -} - -// maxDataEntriesSize calls maxDataEntriesSizeFunc. -func (mock *mockRideEnvironment) maxDataEntriesSize() int { - if mock.maxDataEntriesSizeFunc == nil { - panic("mockRideEnvironment.maxDataEntriesSizeFunc: method is nil but environment.maxDataEntriesSize was just called") - } - callInfo := struct { - }{} - mock.lockmaxDataEntriesSize.Lock() - mock.calls.maxDataEntriesSize = append(mock.calls.maxDataEntriesSize, callInfo) - mock.lockmaxDataEntriesSize.Unlock() - return mock.maxDataEntriesSizeFunc() -} - -// maxDataEntriesSizeCalls gets all the calls that were made to maxDataEntriesSize. -// Check the length with: -// -// len(mockedenvironment.maxDataEntriesSizeCalls()) -func (mock *mockRideEnvironment) maxDataEntriesSizeCalls() []struct { -} { - var calls []struct { - } - mock.lockmaxDataEntriesSize.RLock() - calls = mock.calls.maxDataEntriesSize - mock.lockmaxDataEntriesSize.RUnlock() - return calls -} - -// paymentsFixActivated calls paymentsFixActivatedFunc. -func (mock *mockRideEnvironment) paymentsFixActivated() bool { - if mock.paymentsFixActivatedFunc == nil { - panic("mockRideEnvironment.paymentsFixActivatedFunc: method is nil but environment.paymentsFixActivated was just called") - } - callInfo := struct { - }{} - mock.lockpaymentsFixActivated.Lock() - mock.calls.paymentsFixActivated = append(mock.calls.paymentsFixActivated, callInfo) - mock.lockpaymentsFixActivated.Unlock() - return mock.paymentsFixActivatedFunc() -} - -// paymentsFixActivatedCalls gets all the calls that were made to paymentsFixActivated. -// Check the length with: -// -// len(mockedenvironment.paymentsFixActivatedCalls()) -func (mock *mockRideEnvironment) paymentsFixActivatedCalls() []struct { -} { - var calls []struct { - } - mock.lockpaymentsFixActivated.RLock() - calls = mock.calls.paymentsFixActivated - mock.lockpaymentsFixActivated.RUnlock() - return calls -} - -// paymentsFixAfterHeight calls paymentsFixAfterHeightFunc. -func (mock *mockRideEnvironment) paymentsFixAfterHeight() uint64 { - if mock.paymentsFixAfterHeightFunc == nil { - panic("mockRideEnvironment.paymentsFixAfterHeightFunc: method is nil but environment.paymentsFixAfterHeight was just called") - } - callInfo := struct { - }{} - mock.lockpaymentsFixAfterHeight.Lock() - mock.calls.paymentsFixAfterHeight = append(mock.calls.paymentsFixAfterHeight, callInfo) - mock.lockpaymentsFixAfterHeight.Unlock() - return mock.paymentsFixAfterHeightFunc() -} - -// paymentsFixAfterHeightCalls gets all the calls that were made to paymentsFixAfterHeight. -// Check the length with: -// -// len(mockedenvironment.paymentsFixAfterHeightCalls()) -func (mock *mockRideEnvironment) paymentsFixAfterHeightCalls() []struct { -} { - var calls []struct { - } - mock.lockpaymentsFixAfterHeight.RLock() - calls = mock.calls.paymentsFixAfterHeight - mock.lockpaymentsFixAfterHeight.RUnlock() - return calls -} - -// rideV6Activated calls rideV6ActivatedFunc. -func (mock *mockRideEnvironment) rideV6Activated() bool { - if mock.rideV6ActivatedFunc == nil { - panic("mockRideEnvironment.rideV6ActivatedFunc: method is nil but environment.rideV6Activated was just called") - } - callInfo := struct { - }{} - mock.lockrideV6Activated.Lock() - mock.calls.rideV6Activated = append(mock.calls.rideV6Activated, callInfo) - mock.lockrideV6Activated.Unlock() - return mock.rideV6ActivatedFunc() -} - -// rideV6ActivatedCalls gets all the calls that were made to rideV6Activated. -// Check the length with: -// -// len(mockedenvironment.rideV6ActivatedCalls()) -func (mock *mockRideEnvironment) rideV6ActivatedCalls() []struct { -} { - var calls []struct { - } - mock.lockrideV6Activated.RLock() - calls = mock.calls.rideV6Activated - mock.lockrideV6Activated.RUnlock() - return calls -} - -// scheme calls schemeFunc. -func (mock *mockRideEnvironment) scheme() byte { - if mock.schemeFunc == nil { - panic("mockRideEnvironment.schemeFunc: method is nil but environment.scheme was just called") - } - callInfo := struct { - }{} - mock.lockscheme.Lock() - mock.calls.scheme = append(mock.calls.scheme, callInfo) - mock.lockscheme.Unlock() - return mock.schemeFunc() -} - -// schemeCalls gets all the calls that were made to scheme. -// Check the length with: -// -// len(mockedenvironment.schemeCalls()) -func (mock *mockRideEnvironment) schemeCalls() []struct { -} { - var calls []struct { - } - mock.lockscheme.RLock() - calls = mock.calls.scheme - mock.lockscheme.RUnlock() - return calls -} - -// setComplexityCalculator calls setComplexityCalculatorFunc. -func (mock *mockRideEnvironment) setComplexityCalculator(cc complexityCalculator) { - if mock.setComplexityCalculatorFunc == nil { - panic("mockRideEnvironment.setComplexityCalculatorFunc: method is nil but environment.setComplexityCalculator was just called") - } - callInfo := struct { - Cc complexityCalculator - }{ - Cc: cc, - } - mock.locksetComplexityCalculator.Lock() - mock.calls.setComplexityCalculator = append(mock.calls.setComplexityCalculator, callInfo) - mock.locksetComplexityCalculator.Unlock() - mock.setComplexityCalculatorFunc(cc) -} - -// setComplexityCalculatorCalls gets all the calls that were made to setComplexityCalculator. -// Check the length with: -// -// len(mockedenvironment.setComplexityCalculatorCalls()) -func (mock *mockRideEnvironment) setComplexityCalculatorCalls() []struct { - Cc complexityCalculator -} { - var calls []struct { - Cc complexityCalculator - } - mock.locksetComplexityCalculator.RLock() - calls = mock.calls.setComplexityCalculator - mock.locksetComplexityCalculator.RUnlock() - return calls -} - -// setInvocation calls setInvocationFunc. -func (mock *mockRideEnvironment) setInvocation(inv rideType) { - if mock.setInvocationFunc == nil { - panic("mockRideEnvironment.setInvocationFunc: method is nil but environment.setInvocation was just called") - } - callInfo := struct { - Inv rideType - }{ - Inv: inv, - } - mock.locksetInvocation.Lock() - mock.calls.setInvocation = append(mock.calls.setInvocation, callInfo) - mock.locksetInvocation.Unlock() - mock.setInvocationFunc(inv) -} - -// setInvocationCalls gets all the calls that were made to setInvocation. -// Check the length with: -// -// len(mockedenvironment.setInvocationCalls()) -func (mock *mockRideEnvironment) setInvocationCalls() []struct { - Inv rideType -} { - var calls []struct { - Inv rideType - } - mock.locksetInvocation.RLock() - calls = mock.calls.setInvocation - mock.locksetInvocation.RUnlock() - return calls -} - -// setLibVersion calls setLibVersionFunc. -func (mock *mockRideEnvironment) setLibVersion(v ast.LibraryVersion) { - if mock.setLibVersionFunc == nil { - panic("mockRideEnvironment.setLibVersionFunc: method is nil but environment.setLibVersion was just called") - } - callInfo := struct { - V ast.LibraryVersion - }{ - V: v, - } - mock.locksetLibVersion.Lock() - mock.calls.setLibVersion = append(mock.calls.setLibVersion, callInfo) - mock.locksetLibVersion.Unlock() - mock.setLibVersionFunc(v) -} - -// setLibVersionCalls gets all the calls that were made to setLibVersion. -// Check the length with: -// -// len(mockedenvironment.setLibVersionCalls()) -func (mock *mockRideEnvironment) setLibVersionCalls() []struct { - V ast.LibraryVersion -} { - var calls []struct { - V ast.LibraryVersion - } - mock.locksetLibVersion.RLock() - calls = mock.calls.setLibVersion - mock.locksetLibVersion.RUnlock() - return calls -} - -// setNewDAppAddress calls setNewDAppAddressFunc. -func (mock *mockRideEnvironment) setNewDAppAddress(address proto.WavesAddress) { - if mock.setNewDAppAddressFunc == nil { - panic("mockRideEnvironment.setNewDAppAddressFunc: method is nil but environment.setNewDAppAddress was just called") - } - callInfo := struct { - Address proto.WavesAddress - }{ - Address: address, - } - mock.locksetNewDAppAddress.Lock() - mock.calls.setNewDAppAddress = append(mock.calls.setNewDAppAddress, callInfo) - mock.locksetNewDAppAddress.Unlock() - mock.setNewDAppAddressFunc(address) -} - -// setNewDAppAddressCalls gets all the calls that were made to setNewDAppAddress. -// Check the length with: -// -// len(mockedenvironment.setNewDAppAddressCalls()) -func (mock *mockRideEnvironment) setNewDAppAddressCalls() []struct { - Address proto.WavesAddress -} { - var calls []struct { - Address proto.WavesAddress - } - mock.locksetNewDAppAddress.RLock() - calls = mock.calls.setNewDAppAddress - mock.locksetNewDAppAddress.RUnlock() - return calls -} - -// state calls stateFunc. -func (mock *mockRideEnvironment) state() types.SmartState { - if mock.stateFunc == nil { - panic("mockRideEnvironment.stateFunc: method is nil but environment.state was just called") - } - callInfo := struct { - }{} - mock.lockstate.Lock() - mock.calls.state = append(mock.calls.state, callInfo) - mock.lockstate.Unlock() - return mock.stateFunc() -} - -// stateCalls gets all the calls that were made to state. -// Check the length with: -// -// len(mockedenvironment.stateCalls()) -func (mock *mockRideEnvironment) stateCalls() []struct { -} { - var calls []struct { - } - mock.lockstate.RLock() - calls = mock.calls.state - mock.lockstate.RUnlock() - return calls -} - -// takeString calls takeStringFunc. -func (mock *mockRideEnvironment) takeString(s string, n int) rideString { - if mock.takeStringFunc == nil { - panic("mockRideEnvironment.takeStringFunc: method is nil but environment.takeString was just called") - } - callInfo := struct { - S string - N int - }{ - S: s, - N: n, - } - mock.locktakeString.Lock() - mock.calls.takeString = append(mock.calls.takeString, callInfo) - mock.locktakeString.Unlock() - return mock.takeStringFunc(s, n) -} - -// takeStringCalls gets all the calls that were made to takeString. -// Check the length with: -// -// len(mockedenvironment.takeStringCalls()) -func (mock *mockRideEnvironment) takeStringCalls() []struct { - S string - N int -} { - var calls []struct { - S string - N int - } - mock.locktakeString.RLock() - calls = mock.calls.takeString - mock.locktakeString.RUnlock() - return calls -} - -// this calls thisFunc. -func (mock *mockRideEnvironment) this() rideType { - if mock.thisFunc == nil { - panic("mockRideEnvironment.thisFunc: method is nil but environment.this was just called") - } - callInfo := struct { - }{} - mock.lockthis.Lock() - mock.calls.this = append(mock.calls.this, callInfo) - mock.lockthis.Unlock() - return mock.thisFunc() -} - -// thisCalls gets all the calls that were made to this. -// Check the length with: -// -// len(mockedenvironment.thisCalls()) -func (mock *mockRideEnvironment) thisCalls() []struct { -} { - var calls []struct { - } - mock.lockthis.RLock() - calls = mock.calls.this - mock.lockthis.RUnlock() - return calls -} - -// timestamp calls timestampFunc. -func (mock *mockRideEnvironment) timestamp() uint64 { - if mock.timestampFunc == nil { - panic("mockRideEnvironment.timestampFunc: method is nil but environment.timestamp was just called") - } - callInfo := struct { - }{} - mock.locktimestamp.Lock() - mock.calls.timestamp = append(mock.calls.timestamp, callInfo) - mock.locktimestamp.Unlock() - return mock.timestampFunc() -} - -// timestampCalls gets all the calls that were made to timestamp. -// Check the length with: -// -// len(mockedenvironment.timestampCalls()) -func (mock *mockRideEnvironment) timestampCalls() []struct { -} { - var calls []struct { - } - mock.locktimestamp.RLock() - calls = mock.calls.timestamp - mock.locktimestamp.RUnlock() - return calls -} - -// transaction calls transactionFunc. -func (mock *mockRideEnvironment) transaction() rideType { - if mock.transactionFunc == nil { - panic("mockRideEnvironment.transactionFunc: method is nil but environment.transaction was just called") - } - callInfo := struct { - }{} - mock.locktransaction.Lock() - mock.calls.transaction = append(mock.calls.transaction, callInfo) - mock.locktransaction.Unlock() - return mock.transactionFunc() -} - -// transactionCalls gets all the calls that were made to transaction. -// Check the length with: -// -// len(mockedenvironment.transactionCalls()) -func (mock *mockRideEnvironment) transactionCalls() []struct { -} { - var calls []struct { - } - mock.locktransaction.RLock() - calls = mock.calls.transaction - mock.locktransaction.RUnlock() - return calls -} - -// txID calls txIDFunc. -func (mock *mockRideEnvironment) txID() rideType { - if mock.txIDFunc == nil { - panic("mockRideEnvironment.txIDFunc: method is nil but environment.txID was just called") - } - callInfo := struct { - }{} - mock.locktxID.Lock() - mock.calls.txID = append(mock.calls.txID, callInfo) - mock.locktxID.Unlock() - return mock.txIDFunc() -} - -// txIDCalls gets all the calls that were made to txID. -// Check the length with: -// -// len(mockedenvironment.txIDCalls()) -func (mock *mockRideEnvironment) txIDCalls() []struct { -} { - var calls []struct { - } - mock.locktxID.RLock() - calls = mock.calls.txID - mock.locktxID.RUnlock() - return calls -} - -// validateInternalPayments calls validateInternalPaymentsFunc. -func (mock *mockRideEnvironment) validateInternalPayments() bool { - if mock.validateInternalPaymentsFunc == nil { - panic("mockRideEnvironment.validateInternalPaymentsFunc: method is nil but environment.validateInternalPayments was just called") - } - callInfo := struct { - }{} - mock.lockvalidateInternalPayments.Lock() - mock.calls.validateInternalPayments = append(mock.calls.validateInternalPayments, callInfo) - mock.lockvalidateInternalPayments.Unlock() - return mock.validateInternalPaymentsFunc() -} - -// validateInternalPaymentsCalls gets all the calls that were made to validateInternalPayments. -// Check the length with: -// -// len(mockedenvironment.validateInternalPaymentsCalls()) -func (mock *mockRideEnvironment) validateInternalPaymentsCalls() []struct { -} { - var calls []struct { - } - mock.lockvalidateInternalPayments.RLock() - calls = mock.calls.validateInternalPayments - mock.lockvalidateInternalPayments.RUnlock() - return calls -} diff --git a/pkg/ride/smart_state_moq_test.go b/pkg/ride/smart_state_moq_test.go deleted file mode 100644 index 21755cd21f..0000000000 --- a/pkg/ride/smart_state_moq_test.go +++ /dev/null @@ -1,1288 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package ride - -import ( - "github.com/wavesplatform/gowaves/pkg/crypto" - "github.com/wavesplatform/gowaves/pkg/proto" - "github.com/wavesplatform/gowaves/pkg/ride/ast" - "github.com/wavesplatform/gowaves/pkg/types" - "sync" -) - -// Ensure, that MockSmartState does implement types.SmartState. -// If this is not the case, regenerate this file with moq. -var _ types.SmartState = &MockSmartState{} - -// MockSmartState is a mock implementation of types.SmartState. -// -// func TestSomethingThatUsesSmartState(t *testing.T) { -// -// // make and configure a mocked types.SmartState -// mockedSmartState := &MockSmartState{ -// AddingBlockHeightFunc: func() (uint64, error) { -// panic("mock out the AddingBlockHeight method") -// }, -// EstimatorVersionFunc: func() (int, error) { -// panic("mock out the EstimatorVersion method") -// }, -// IsNotFoundFunc: func(err error) bool { -// panic("mock out the IsNotFound method") -// }, -// IsStateUntouchedFunc: func(account proto.Recipient) (bool, error) { -// panic("mock out the IsStateUntouched method") -// }, -// NewestAddrByAliasFunc: func(alias proto.Alias) (proto.WavesAddress, error) { -// panic("mock out the NewestAddrByAlias method") -// }, -// NewestAssetBalanceFunc: func(account proto.Recipient, assetID crypto.Digest) (uint64, error) { -// panic("mock out the NewestAssetBalance method") -// }, -// NewestAssetBalanceByAddressIDFunc: func(id proto.AddressID, asset crypto.Digest) (uint64, error) { -// panic("mock out the NewestAssetBalanceByAddressID method") -// }, -// NewestAssetConstInfoFunc: func(assetID proto.AssetID) (*proto.AssetConstInfo, error) { -// panic("mock out the NewestAssetConstInfo method") -// }, -// NewestAssetInfoFunc: func(assetID crypto.Digest) (*proto.AssetInfo, error) { -// panic("mock out the NewestAssetInfo method") -// }, -// NewestAssetIsSponsoredFunc: func(assetID crypto.Digest) (bool, error) { -// panic("mock out the NewestAssetIsSponsored method") -// }, -// NewestBlockInfoByHeightFunc: func(height uint64) (*proto.BlockInfo, error) { -// panic("mock out the NewestBlockInfoByHeight method") -// }, -// NewestFullAssetInfoFunc: func(assetID crypto.Digest) (*proto.FullAssetInfo, error) { -// panic("mock out the NewestFullAssetInfo method") -// }, -// NewestFullWavesBalanceFunc: func(account proto.Recipient) (*proto.FullWavesBalance, error) { -// panic("mock out the NewestFullWavesBalance method") -// }, -// NewestLeasingInfoFunc: func(id crypto.Digest) (*proto.LeaseInfo, error) { -// panic("mock out the NewestLeasingInfo method") -// }, -// NewestRecipientToAddressFunc: func(recipient proto.Recipient) (proto.WavesAddress, error) { -// panic("mock out the NewestRecipientToAddress method") -// }, -// NewestScriptByAccountFunc: func(account proto.Recipient) (*ast.Tree, error) { -// panic("mock out the NewestScriptByAccount method") -// }, -// NewestScriptByAssetFunc: func(assetID crypto.Digest) (*ast.Tree, error) { -// panic("mock out the NewestScriptByAsset method") -// }, -// NewestScriptBytesByAccountFunc: func(account proto.Recipient) (proto.Script, error) { -// panic("mock out the NewestScriptBytesByAccount method") -// }, -// NewestScriptPKByAddrFunc: func(addr proto.WavesAddress) (crypto.PublicKey, error) { -// panic("mock out the NewestScriptPKByAddr method") -// }, -// NewestTransactionByIDFunc: func(bytes []byte) (proto.Transaction, error) { -// panic("mock out the NewestTransactionByID method") -// }, -// NewestTransactionHeightByIDFunc: func(bytes []byte) (uint64, error) { -// panic("mock out the NewestTransactionHeightByID method") -// }, -// NewestWavesBalanceFunc: func(account proto.Recipient) (uint64, error) { -// panic("mock out the NewestWavesBalance method") -// }, -// RetrieveEntriesFunc: func(account proto.Recipient) ([]proto.DataEntry, error) { -// panic("mock out the RetrieveEntries method") -// }, -// RetrieveNewestBinaryEntryFunc: func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { -// panic("mock out the RetrieveNewestBinaryEntry method") -// }, -// RetrieveNewestBooleanEntryFunc: func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { -// panic("mock out the RetrieveNewestBooleanEntry method") -// }, -// RetrieveNewestIntegerEntryFunc: func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { -// panic("mock out the RetrieveNewestIntegerEntry method") -// }, -// RetrieveNewestStringEntryFunc: func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { -// panic("mock out the RetrieveNewestStringEntry method") -// }, -// WavesBalanceProfileFunc: func(id proto.AddressID) (*types.WavesBalanceProfile, error) { -// panic("mock out the WavesBalanceProfile method") -// }, -// } -// -// // use mockedSmartState in code that requires types.SmartState -// // and then make assertions. -// -// } -type MockSmartState struct { - // AddingBlockHeightFunc mocks the AddingBlockHeight method. - AddingBlockHeightFunc func() (uint64, error) - - // EstimatorVersionFunc mocks the EstimatorVersion method. - EstimatorVersionFunc func() (int, error) - - // IsNotFoundFunc mocks the IsNotFound method. - IsNotFoundFunc func(err error) bool - - // IsStateUntouchedFunc mocks the IsStateUntouched method. - IsStateUntouchedFunc func(account proto.Recipient) (bool, error) - - // NewestAddrByAliasFunc mocks the NewestAddrByAlias method. - NewestAddrByAliasFunc func(alias proto.Alias) (proto.WavesAddress, error) - - // NewestAssetBalanceFunc mocks the NewestAssetBalance method. - NewestAssetBalanceFunc func(account proto.Recipient, assetID crypto.Digest) (uint64, error) - - // NewestAssetBalanceByAddressIDFunc mocks the NewestAssetBalanceByAddressID method. - NewestAssetBalanceByAddressIDFunc func(id proto.AddressID, asset crypto.Digest) (uint64, error) - - // NewestAssetConstInfoFunc mocks the NewestAssetConstInfo method. - NewestAssetConstInfoFunc func(assetID proto.AssetID) (*proto.AssetConstInfo, error) - - // NewestAssetInfoFunc mocks the NewestAssetInfo method. - NewestAssetInfoFunc func(assetID crypto.Digest) (*proto.AssetInfo, error) - - // NewestAssetIsSponsoredFunc mocks the NewestAssetIsSponsored method. - NewestAssetIsSponsoredFunc func(assetID crypto.Digest) (bool, error) - - // NewestBlockInfoByHeightFunc mocks the NewestBlockInfoByHeight method. - NewestBlockInfoByHeightFunc func(height uint64) (*proto.BlockInfo, error) - - // NewestFullAssetInfoFunc mocks the NewestFullAssetInfo method. - NewestFullAssetInfoFunc func(assetID crypto.Digest) (*proto.FullAssetInfo, error) - - // NewestFullWavesBalanceFunc mocks the NewestFullWavesBalance method. - NewestFullWavesBalanceFunc func(account proto.Recipient) (*proto.FullWavesBalance, error) - - // NewestLeasingInfoFunc mocks the NewestLeasingInfo method. - NewestLeasingInfoFunc func(id crypto.Digest) (*proto.LeaseInfo, error) - - // NewestRecipientToAddressFunc mocks the NewestRecipientToAddress method. - NewestRecipientToAddressFunc func(recipient proto.Recipient) (proto.WavesAddress, error) - - // NewestScriptByAccountFunc mocks the NewestScriptByAccount method. - NewestScriptByAccountFunc func(account proto.Recipient) (*ast.Tree, error) - - // NewestScriptByAssetFunc mocks the NewestScriptByAsset method. - NewestScriptByAssetFunc func(assetID crypto.Digest) (*ast.Tree, error) - - // NewestScriptBytesByAccountFunc mocks the NewestScriptBytesByAccount method. - NewestScriptBytesByAccountFunc func(account proto.Recipient) (proto.Script, error) - - // NewestScriptPKByAddrFunc mocks the NewestScriptPKByAddr method. - NewestScriptPKByAddrFunc func(addr proto.WavesAddress) (crypto.PublicKey, error) - - // NewestTransactionByIDFunc mocks the NewestTransactionByID method. - NewestTransactionByIDFunc func(bytes []byte) (proto.Transaction, error) - - // NewestTransactionHeightByIDFunc mocks the NewestTransactionHeightByID method. - NewestTransactionHeightByIDFunc func(bytes []byte) (uint64, error) - - // NewestWavesBalanceFunc mocks the NewestWavesBalance method. - NewestWavesBalanceFunc func(account proto.Recipient) (uint64, error) - - // RetrieveEntriesFunc mocks the RetrieveEntries method. - RetrieveEntriesFunc func(account proto.Recipient) ([]proto.DataEntry, error) - - // RetrieveNewestBinaryEntryFunc mocks the RetrieveNewestBinaryEntry method. - RetrieveNewestBinaryEntryFunc func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) - - // RetrieveNewestBooleanEntryFunc mocks the RetrieveNewestBooleanEntry method. - RetrieveNewestBooleanEntryFunc func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) - - // RetrieveNewestIntegerEntryFunc mocks the RetrieveNewestIntegerEntry method. - RetrieveNewestIntegerEntryFunc func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) - - // RetrieveNewestStringEntryFunc mocks the RetrieveNewestStringEntry method. - RetrieveNewestStringEntryFunc func(account proto.Recipient, key string) (*proto.StringDataEntry, error) - - // WavesBalanceProfileFunc mocks the WavesBalanceProfile method. - WavesBalanceProfileFunc func(id proto.AddressID) (*types.WavesBalanceProfile, error) - - // calls tracks calls to the methods. - calls struct { - // AddingBlockHeight holds details about calls to the AddingBlockHeight method. - AddingBlockHeight []struct { - } - // EstimatorVersion holds details about calls to the EstimatorVersion method. - EstimatorVersion []struct { - } - // IsNotFound holds details about calls to the IsNotFound method. - IsNotFound []struct { - // Err is the err argument value. - Err error - } - // IsStateUntouched holds details about calls to the IsStateUntouched method. - IsStateUntouched []struct { - // Account is the account argument value. - Account proto.Recipient - } - // NewestAddrByAlias holds details about calls to the NewestAddrByAlias method. - NewestAddrByAlias []struct { - // Alias is the alias argument value. - Alias proto.Alias - } - // NewestAssetBalance holds details about calls to the NewestAssetBalance method. - NewestAssetBalance []struct { - // Account is the account argument value. - Account proto.Recipient - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestAssetBalanceByAddressID holds details about calls to the NewestAssetBalanceByAddressID method. - NewestAssetBalanceByAddressID []struct { - // ID is the id argument value. - ID proto.AddressID - // Asset is the asset argument value. - Asset crypto.Digest - } - // NewestAssetConstInfo holds details about calls to the NewestAssetConstInfo method. - NewestAssetConstInfo []struct { - // AssetID is the assetID argument value. - AssetID proto.AssetID - } - // NewestAssetInfo holds details about calls to the NewestAssetInfo method. - NewestAssetInfo []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestAssetIsSponsored holds details about calls to the NewestAssetIsSponsored method. - NewestAssetIsSponsored []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestBlockInfoByHeight holds details about calls to the NewestBlockInfoByHeight method. - NewestBlockInfoByHeight []struct { - // Height is the height argument value. - Height uint64 - } - // NewestFullAssetInfo holds details about calls to the NewestFullAssetInfo method. - NewestFullAssetInfo []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestFullWavesBalance holds details about calls to the NewestFullWavesBalance method. - NewestFullWavesBalance []struct { - // Account is the account argument value. - Account proto.Recipient - } - // NewestLeasingInfo holds details about calls to the NewestLeasingInfo method. - NewestLeasingInfo []struct { - // ID is the id argument value. - ID crypto.Digest - } - // NewestRecipientToAddress holds details about calls to the NewestRecipientToAddress method. - NewestRecipientToAddress []struct { - // Recipient is the recipient argument value. - Recipient proto.Recipient - } - // NewestScriptByAccount holds details about calls to the NewestScriptByAccount method. - NewestScriptByAccount []struct { - // Account is the account argument value. - Account proto.Recipient - } - // NewestScriptByAsset holds details about calls to the NewestScriptByAsset method. - NewestScriptByAsset []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestScriptBytesByAccount holds details about calls to the NewestScriptBytesByAccount method. - NewestScriptBytesByAccount []struct { - // Account is the account argument value. - Account proto.Recipient - } - // NewestScriptPKByAddr holds details about calls to the NewestScriptPKByAddr method. - NewestScriptPKByAddr []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // NewestTransactionByID holds details about calls to the NewestTransactionByID method. - NewestTransactionByID []struct { - // Bytes is the bytes argument value. - Bytes []byte - } - // NewestTransactionHeightByID holds details about calls to the NewestTransactionHeightByID method. - NewestTransactionHeightByID []struct { - // Bytes is the bytes argument value. - Bytes []byte - } - // NewestWavesBalance holds details about calls to the NewestWavesBalance method. - NewestWavesBalance []struct { - // Account is the account argument value. - Account proto.Recipient - } - // RetrieveEntries holds details about calls to the RetrieveEntries method. - RetrieveEntries []struct { - // Account is the account argument value. - Account proto.Recipient - } - // RetrieveNewestBinaryEntry holds details about calls to the RetrieveNewestBinaryEntry method. - RetrieveNewestBinaryEntry []struct { - // Account is the account argument value. - Account proto.Recipient - // Key is the key argument value. - Key string - } - // RetrieveNewestBooleanEntry holds details about calls to the RetrieveNewestBooleanEntry method. - RetrieveNewestBooleanEntry []struct { - // Account is the account argument value. - Account proto.Recipient - // Key is the key argument value. - Key string - } - // RetrieveNewestIntegerEntry holds details about calls to the RetrieveNewestIntegerEntry method. - RetrieveNewestIntegerEntry []struct { - // Account is the account argument value. - Account proto.Recipient - // Key is the key argument value. - Key string - } - // RetrieveNewestStringEntry holds details about calls to the RetrieveNewestStringEntry method. - RetrieveNewestStringEntry []struct { - // Account is the account argument value. - Account proto.Recipient - // Key is the key argument value. - Key string - } - // WavesBalanceProfile holds details about calls to the WavesBalanceProfile method. - WavesBalanceProfile []struct { - // ID is the id argument value. - ID proto.AddressID - } - } - lockAddingBlockHeight sync.RWMutex - lockEstimatorVersion sync.RWMutex - lockIsNotFound sync.RWMutex - lockIsStateUntouched sync.RWMutex - lockNewestAddrByAlias sync.RWMutex - lockNewestAssetBalance sync.RWMutex - lockNewestAssetBalanceByAddressID sync.RWMutex - lockNewestAssetConstInfo sync.RWMutex - lockNewestAssetInfo sync.RWMutex - lockNewestAssetIsSponsored sync.RWMutex - lockNewestBlockInfoByHeight sync.RWMutex - lockNewestFullAssetInfo sync.RWMutex - lockNewestFullWavesBalance sync.RWMutex - lockNewestLeasingInfo sync.RWMutex - lockNewestRecipientToAddress sync.RWMutex - lockNewestScriptByAccount sync.RWMutex - lockNewestScriptByAsset sync.RWMutex - lockNewestScriptBytesByAccount sync.RWMutex - lockNewestScriptPKByAddr sync.RWMutex - lockNewestTransactionByID sync.RWMutex - lockNewestTransactionHeightByID sync.RWMutex - lockNewestWavesBalance sync.RWMutex - lockRetrieveEntries sync.RWMutex - lockRetrieveNewestBinaryEntry sync.RWMutex - lockRetrieveNewestBooleanEntry sync.RWMutex - lockRetrieveNewestIntegerEntry sync.RWMutex - lockRetrieveNewestStringEntry sync.RWMutex - lockWavesBalanceProfile sync.RWMutex -} - -// AddingBlockHeight calls AddingBlockHeightFunc. -func (mock *MockSmartState) AddingBlockHeight() (uint64, error) { - if mock.AddingBlockHeightFunc == nil { - panic("MockSmartState.AddingBlockHeightFunc: method is nil but SmartState.AddingBlockHeight was just called") - } - callInfo := struct { - }{} - mock.lockAddingBlockHeight.Lock() - mock.calls.AddingBlockHeight = append(mock.calls.AddingBlockHeight, callInfo) - mock.lockAddingBlockHeight.Unlock() - return mock.AddingBlockHeightFunc() -} - -// AddingBlockHeightCalls gets all the calls that were made to AddingBlockHeight. -// Check the length with: -// -// len(mockedSmartState.AddingBlockHeightCalls()) -func (mock *MockSmartState) AddingBlockHeightCalls() []struct { -} { - var calls []struct { - } - mock.lockAddingBlockHeight.RLock() - calls = mock.calls.AddingBlockHeight - mock.lockAddingBlockHeight.RUnlock() - return calls -} - -// EstimatorVersion calls EstimatorVersionFunc. -func (mock *MockSmartState) EstimatorVersion() (int, error) { - if mock.EstimatorVersionFunc == nil { - panic("MockSmartState.EstimatorVersionFunc: method is nil but SmartState.EstimatorVersion was just called") - } - callInfo := struct { - }{} - mock.lockEstimatorVersion.Lock() - mock.calls.EstimatorVersion = append(mock.calls.EstimatorVersion, callInfo) - mock.lockEstimatorVersion.Unlock() - return mock.EstimatorVersionFunc() -} - -// EstimatorVersionCalls gets all the calls that were made to EstimatorVersion. -// Check the length with: -// -// len(mockedSmartState.EstimatorVersionCalls()) -func (mock *MockSmartState) EstimatorVersionCalls() []struct { -} { - var calls []struct { - } - mock.lockEstimatorVersion.RLock() - calls = mock.calls.EstimatorVersion - mock.lockEstimatorVersion.RUnlock() - return calls -} - -// IsNotFound calls IsNotFoundFunc. -func (mock *MockSmartState) IsNotFound(err error) bool { - if mock.IsNotFoundFunc == nil { - panic("MockSmartState.IsNotFoundFunc: method is nil but SmartState.IsNotFound was just called") - } - callInfo := struct { - Err error - }{ - Err: err, - } - mock.lockIsNotFound.Lock() - mock.calls.IsNotFound = append(mock.calls.IsNotFound, callInfo) - mock.lockIsNotFound.Unlock() - return mock.IsNotFoundFunc(err) -} - -// IsNotFoundCalls gets all the calls that were made to IsNotFound. -// Check the length with: -// -// len(mockedSmartState.IsNotFoundCalls()) -func (mock *MockSmartState) IsNotFoundCalls() []struct { - Err error -} { - var calls []struct { - Err error - } - mock.lockIsNotFound.RLock() - calls = mock.calls.IsNotFound - mock.lockIsNotFound.RUnlock() - return calls -} - -// IsStateUntouched calls IsStateUntouchedFunc. -func (mock *MockSmartState) IsStateUntouched(account proto.Recipient) (bool, error) { - if mock.IsStateUntouchedFunc == nil { - panic("MockSmartState.IsStateUntouchedFunc: method is nil but SmartState.IsStateUntouched was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockIsStateUntouched.Lock() - mock.calls.IsStateUntouched = append(mock.calls.IsStateUntouched, callInfo) - mock.lockIsStateUntouched.Unlock() - return mock.IsStateUntouchedFunc(account) -} - -// IsStateUntouchedCalls gets all the calls that were made to IsStateUntouched. -// Check the length with: -// -// len(mockedSmartState.IsStateUntouchedCalls()) -func (mock *MockSmartState) IsStateUntouchedCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockIsStateUntouched.RLock() - calls = mock.calls.IsStateUntouched - mock.lockIsStateUntouched.RUnlock() - return calls -} - -// NewestAddrByAlias calls NewestAddrByAliasFunc. -func (mock *MockSmartState) NewestAddrByAlias(alias proto.Alias) (proto.WavesAddress, error) { - if mock.NewestAddrByAliasFunc == nil { - panic("MockSmartState.NewestAddrByAliasFunc: method is nil but SmartState.NewestAddrByAlias was just called") - } - callInfo := struct { - Alias proto.Alias - }{ - Alias: alias, - } - mock.lockNewestAddrByAlias.Lock() - mock.calls.NewestAddrByAlias = append(mock.calls.NewestAddrByAlias, callInfo) - mock.lockNewestAddrByAlias.Unlock() - return mock.NewestAddrByAliasFunc(alias) -} - -// NewestAddrByAliasCalls gets all the calls that were made to NewestAddrByAlias. -// Check the length with: -// -// len(mockedSmartState.NewestAddrByAliasCalls()) -func (mock *MockSmartState) NewestAddrByAliasCalls() []struct { - Alias proto.Alias -} { - var calls []struct { - Alias proto.Alias - } - mock.lockNewestAddrByAlias.RLock() - calls = mock.calls.NewestAddrByAlias - mock.lockNewestAddrByAlias.RUnlock() - return calls -} - -// NewestAssetBalance calls NewestAssetBalanceFunc. -func (mock *MockSmartState) NewestAssetBalance(account proto.Recipient, assetID crypto.Digest) (uint64, error) { - if mock.NewestAssetBalanceFunc == nil { - panic("MockSmartState.NewestAssetBalanceFunc: method is nil but SmartState.NewestAssetBalance was just called") - } - callInfo := struct { - Account proto.Recipient - AssetID crypto.Digest - }{ - Account: account, - AssetID: assetID, - } - mock.lockNewestAssetBalance.Lock() - mock.calls.NewestAssetBalance = append(mock.calls.NewestAssetBalance, callInfo) - mock.lockNewestAssetBalance.Unlock() - return mock.NewestAssetBalanceFunc(account, assetID) -} - -// NewestAssetBalanceCalls gets all the calls that were made to NewestAssetBalance. -// Check the length with: -// -// len(mockedSmartState.NewestAssetBalanceCalls()) -func (mock *MockSmartState) NewestAssetBalanceCalls() []struct { - Account proto.Recipient - AssetID crypto.Digest -} { - var calls []struct { - Account proto.Recipient - AssetID crypto.Digest - } - mock.lockNewestAssetBalance.RLock() - calls = mock.calls.NewestAssetBalance - mock.lockNewestAssetBalance.RUnlock() - return calls -} - -// NewestAssetBalanceByAddressID calls NewestAssetBalanceByAddressIDFunc. -func (mock *MockSmartState) NewestAssetBalanceByAddressID(id proto.AddressID, asset crypto.Digest) (uint64, error) { - if mock.NewestAssetBalanceByAddressIDFunc == nil { - panic("MockSmartState.NewestAssetBalanceByAddressIDFunc: method is nil but SmartState.NewestAssetBalanceByAddressID was just called") - } - callInfo := struct { - ID proto.AddressID - Asset crypto.Digest - }{ - ID: id, - Asset: asset, - } - mock.lockNewestAssetBalanceByAddressID.Lock() - mock.calls.NewestAssetBalanceByAddressID = append(mock.calls.NewestAssetBalanceByAddressID, callInfo) - mock.lockNewestAssetBalanceByAddressID.Unlock() - return mock.NewestAssetBalanceByAddressIDFunc(id, asset) -} - -// NewestAssetBalanceByAddressIDCalls gets all the calls that were made to NewestAssetBalanceByAddressID. -// Check the length with: -// -// len(mockedSmartState.NewestAssetBalanceByAddressIDCalls()) -func (mock *MockSmartState) NewestAssetBalanceByAddressIDCalls() []struct { - ID proto.AddressID - Asset crypto.Digest -} { - var calls []struct { - ID proto.AddressID - Asset crypto.Digest - } - mock.lockNewestAssetBalanceByAddressID.RLock() - calls = mock.calls.NewestAssetBalanceByAddressID - mock.lockNewestAssetBalanceByAddressID.RUnlock() - return calls -} - -// NewestAssetConstInfo calls NewestAssetConstInfoFunc. -func (mock *MockSmartState) NewestAssetConstInfo(assetID proto.AssetID) (*proto.AssetConstInfo, error) { - if mock.NewestAssetConstInfoFunc == nil { - panic("MockSmartState.NewestAssetConstInfoFunc: method is nil but SmartState.NewestAssetConstInfo was just called") - } - callInfo := struct { - AssetID proto.AssetID - }{ - AssetID: assetID, - } - mock.lockNewestAssetConstInfo.Lock() - mock.calls.NewestAssetConstInfo = append(mock.calls.NewestAssetConstInfo, callInfo) - mock.lockNewestAssetConstInfo.Unlock() - return mock.NewestAssetConstInfoFunc(assetID) -} - -// NewestAssetConstInfoCalls gets all the calls that were made to NewestAssetConstInfo. -// Check the length with: -// -// len(mockedSmartState.NewestAssetConstInfoCalls()) -func (mock *MockSmartState) NewestAssetConstInfoCalls() []struct { - AssetID proto.AssetID -} { - var calls []struct { - AssetID proto.AssetID - } - mock.lockNewestAssetConstInfo.RLock() - calls = mock.calls.NewestAssetConstInfo - mock.lockNewestAssetConstInfo.RUnlock() - return calls -} - -// NewestAssetInfo calls NewestAssetInfoFunc. -func (mock *MockSmartState) NewestAssetInfo(assetID crypto.Digest) (*proto.AssetInfo, error) { - if mock.NewestAssetInfoFunc == nil { - panic("MockSmartState.NewestAssetInfoFunc: method is nil but SmartState.NewestAssetInfo was just called") - } - callInfo := struct { - AssetID crypto.Digest - }{ - AssetID: assetID, - } - mock.lockNewestAssetInfo.Lock() - mock.calls.NewestAssetInfo = append(mock.calls.NewestAssetInfo, callInfo) - mock.lockNewestAssetInfo.Unlock() - return mock.NewestAssetInfoFunc(assetID) -} - -// NewestAssetInfoCalls gets all the calls that were made to NewestAssetInfo. -// Check the length with: -// -// len(mockedSmartState.NewestAssetInfoCalls()) -func (mock *MockSmartState) NewestAssetInfoCalls() []struct { - AssetID crypto.Digest -} { - var calls []struct { - AssetID crypto.Digest - } - mock.lockNewestAssetInfo.RLock() - calls = mock.calls.NewestAssetInfo - mock.lockNewestAssetInfo.RUnlock() - return calls -} - -// NewestAssetIsSponsored calls NewestAssetIsSponsoredFunc. -func (mock *MockSmartState) NewestAssetIsSponsored(assetID crypto.Digest) (bool, error) { - if mock.NewestAssetIsSponsoredFunc == nil { - panic("MockSmartState.NewestAssetIsSponsoredFunc: method is nil but SmartState.NewestAssetIsSponsored was just called") - } - callInfo := struct { - AssetID crypto.Digest - }{ - AssetID: assetID, - } - mock.lockNewestAssetIsSponsored.Lock() - mock.calls.NewestAssetIsSponsored = append(mock.calls.NewestAssetIsSponsored, callInfo) - mock.lockNewestAssetIsSponsored.Unlock() - return mock.NewestAssetIsSponsoredFunc(assetID) -} - -// NewestAssetIsSponsoredCalls gets all the calls that were made to NewestAssetIsSponsored. -// Check the length with: -// -// len(mockedSmartState.NewestAssetIsSponsoredCalls()) -func (mock *MockSmartState) NewestAssetIsSponsoredCalls() []struct { - AssetID crypto.Digest -} { - var calls []struct { - AssetID crypto.Digest - } - mock.lockNewestAssetIsSponsored.RLock() - calls = mock.calls.NewestAssetIsSponsored - mock.lockNewestAssetIsSponsored.RUnlock() - return calls -} - -// NewestBlockInfoByHeight calls NewestBlockInfoByHeightFunc. -func (mock *MockSmartState) NewestBlockInfoByHeight(height uint64) (*proto.BlockInfo, error) { - if mock.NewestBlockInfoByHeightFunc == nil { - panic("MockSmartState.NewestBlockInfoByHeightFunc: method is nil but SmartState.NewestBlockInfoByHeight was just called") - } - callInfo := struct { - Height uint64 - }{ - Height: height, - } - mock.lockNewestBlockInfoByHeight.Lock() - mock.calls.NewestBlockInfoByHeight = append(mock.calls.NewestBlockInfoByHeight, callInfo) - mock.lockNewestBlockInfoByHeight.Unlock() - return mock.NewestBlockInfoByHeightFunc(height) -} - -// NewestBlockInfoByHeightCalls gets all the calls that were made to NewestBlockInfoByHeight. -// Check the length with: -// -// len(mockedSmartState.NewestBlockInfoByHeightCalls()) -func (mock *MockSmartState) NewestBlockInfoByHeightCalls() []struct { - Height uint64 -} { - var calls []struct { - Height uint64 - } - mock.lockNewestBlockInfoByHeight.RLock() - calls = mock.calls.NewestBlockInfoByHeight - mock.lockNewestBlockInfoByHeight.RUnlock() - return calls -} - -// NewestFullAssetInfo calls NewestFullAssetInfoFunc. -func (mock *MockSmartState) NewestFullAssetInfo(assetID crypto.Digest) (*proto.FullAssetInfo, error) { - if mock.NewestFullAssetInfoFunc == nil { - panic("MockSmartState.NewestFullAssetInfoFunc: method is nil but SmartState.NewestFullAssetInfo was just called") - } - callInfo := struct { - AssetID crypto.Digest - }{ - AssetID: assetID, - } - mock.lockNewestFullAssetInfo.Lock() - mock.calls.NewestFullAssetInfo = append(mock.calls.NewestFullAssetInfo, callInfo) - mock.lockNewestFullAssetInfo.Unlock() - return mock.NewestFullAssetInfoFunc(assetID) -} - -// NewestFullAssetInfoCalls gets all the calls that were made to NewestFullAssetInfo. -// Check the length with: -// -// len(mockedSmartState.NewestFullAssetInfoCalls()) -func (mock *MockSmartState) NewestFullAssetInfoCalls() []struct { - AssetID crypto.Digest -} { - var calls []struct { - AssetID crypto.Digest - } - mock.lockNewestFullAssetInfo.RLock() - calls = mock.calls.NewestFullAssetInfo - mock.lockNewestFullAssetInfo.RUnlock() - return calls -} - -// NewestFullWavesBalance calls NewestFullWavesBalanceFunc. -func (mock *MockSmartState) NewestFullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error) { - if mock.NewestFullWavesBalanceFunc == nil { - panic("MockSmartState.NewestFullWavesBalanceFunc: method is nil but SmartState.NewestFullWavesBalance was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockNewestFullWavesBalance.Lock() - mock.calls.NewestFullWavesBalance = append(mock.calls.NewestFullWavesBalance, callInfo) - mock.lockNewestFullWavesBalance.Unlock() - return mock.NewestFullWavesBalanceFunc(account) -} - -// NewestFullWavesBalanceCalls gets all the calls that were made to NewestFullWavesBalance. -// Check the length with: -// -// len(mockedSmartState.NewestFullWavesBalanceCalls()) -func (mock *MockSmartState) NewestFullWavesBalanceCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockNewestFullWavesBalance.RLock() - calls = mock.calls.NewestFullWavesBalance - mock.lockNewestFullWavesBalance.RUnlock() - return calls -} - -// NewestLeasingInfo calls NewestLeasingInfoFunc. -func (mock *MockSmartState) NewestLeasingInfo(id crypto.Digest) (*proto.LeaseInfo, error) { - if mock.NewestLeasingInfoFunc == nil { - panic("MockSmartState.NewestLeasingInfoFunc: method is nil but SmartState.NewestLeasingInfo was just called") - } - callInfo := struct { - ID crypto.Digest - }{ - ID: id, - } - mock.lockNewestLeasingInfo.Lock() - mock.calls.NewestLeasingInfo = append(mock.calls.NewestLeasingInfo, callInfo) - mock.lockNewestLeasingInfo.Unlock() - return mock.NewestLeasingInfoFunc(id) -} - -// NewestLeasingInfoCalls gets all the calls that were made to NewestLeasingInfo. -// Check the length with: -// -// len(mockedSmartState.NewestLeasingInfoCalls()) -func (mock *MockSmartState) NewestLeasingInfoCalls() []struct { - ID crypto.Digest -} { - var calls []struct { - ID crypto.Digest - } - mock.lockNewestLeasingInfo.RLock() - calls = mock.calls.NewestLeasingInfo - mock.lockNewestLeasingInfo.RUnlock() - return calls -} - -// NewestRecipientToAddress calls NewestRecipientToAddressFunc. -func (mock *MockSmartState) NewestRecipientToAddress(recipient proto.Recipient) (proto.WavesAddress, error) { - if mock.NewestRecipientToAddressFunc == nil { - panic("MockSmartState.NewestRecipientToAddressFunc: method is nil but SmartState.NewestRecipientToAddress was just called") - } - callInfo := struct { - Recipient proto.Recipient - }{ - Recipient: recipient, - } - mock.lockNewestRecipientToAddress.Lock() - mock.calls.NewestRecipientToAddress = append(mock.calls.NewestRecipientToAddress, callInfo) - mock.lockNewestRecipientToAddress.Unlock() - return mock.NewestRecipientToAddressFunc(recipient) -} - -// NewestRecipientToAddressCalls gets all the calls that were made to NewestRecipientToAddress. -// Check the length with: -// -// len(mockedSmartState.NewestRecipientToAddressCalls()) -func (mock *MockSmartState) NewestRecipientToAddressCalls() []struct { - Recipient proto.Recipient -} { - var calls []struct { - Recipient proto.Recipient - } - mock.lockNewestRecipientToAddress.RLock() - calls = mock.calls.NewestRecipientToAddress - mock.lockNewestRecipientToAddress.RUnlock() - return calls -} - -// NewestScriptByAccount calls NewestScriptByAccountFunc. -func (mock *MockSmartState) NewestScriptByAccount(account proto.Recipient) (*ast.Tree, error) { - if mock.NewestScriptByAccountFunc == nil { - panic("MockSmartState.NewestScriptByAccountFunc: method is nil but SmartState.NewestScriptByAccount was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockNewestScriptByAccount.Lock() - mock.calls.NewestScriptByAccount = append(mock.calls.NewestScriptByAccount, callInfo) - mock.lockNewestScriptByAccount.Unlock() - return mock.NewestScriptByAccountFunc(account) -} - -// NewestScriptByAccountCalls gets all the calls that were made to NewestScriptByAccount. -// Check the length with: -// -// len(mockedSmartState.NewestScriptByAccountCalls()) -func (mock *MockSmartState) NewestScriptByAccountCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockNewestScriptByAccount.RLock() - calls = mock.calls.NewestScriptByAccount - mock.lockNewestScriptByAccount.RUnlock() - return calls -} - -// NewestScriptByAsset calls NewestScriptByAssetFunc. -func (mock *MockSmartState) NewestScriptByAsset(assetID crypto.Digest) (*ast.Tree, error) { - if mock.NewestScriptByAssetFunc == nil { - panic("MockSmartState.NewestScriptByAssetFunc: method is nil but SmartState.NewestScriptByAsset was just called") - } - callInfo := struct { - AssetID crypto.Digest - }{ - AssetID: assetID, - } - mock.lockNewestScriptByAsset.Lock() - mock.calls.NewestScriptByAsset = append(mock.calls.NewestScriptByAsset, callInfo) - mock.lockNewestScriptByAsset.Unlock() - return mock.NewestScriptByAssetFunc(assetID) -} - -// NewestScriptByAssetCalls gets all the calls that were made to NewestScriptByAsset. -// Check the length with: -// -// len(mockedSmartState.NewestScriptByAssetCalls()) -func (mock *MockSmartState) NewestScriptByAssetCalls() []struct { - AssetID crypto.Digest -} { - var calls []struct { - AssetID crypto.Digest - } - mock.lockNewestScriptByAsset.RLock() - calls = mock.calls.NewestScriptByAsset - mock.lockNewestScriptByAsset.RUnlock() - return calls -} - -// NewestScriptBytesByAccount calls NewestScriptBytesByAccountFunc. -func (mock *MockSmartState) NewestScriptBytesByAccount(account proto.Recipient) (proto.Script, error) { - if mock.NewestScriptBytesByAccountFunc == nil { - panic("MockSmartState.NewestScriptBytesByAccountFunc: method is nil but SmartState.NewestScriptBytesByAccount was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockNewestScriptBytesByAccount.Lock() - mock.calls.NewestScriptBytesByAccount = append(mock.calls.NewestScriptBytesByAccount, callInfo) - mock.lockNewestScriptBytesByAccount.Unlock() - return mock.NewestScriptBytesByAccountFunc(account) -} - -// NewestScriptBytesByAccountCalls gets all the calls that were made to NewestScriptBytesByAccount. -// Check the length with: -// -// len(mockedSmartState.NewestScriptBytesByAccountCalls()) -func (mock *MockSmartState) NewestScriptBytesByAccountCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockNewestScriptBytesByAccount.RLock() - calls = mock.calls.NewestScriptBytesByAccount - mock.lockNewestScriptBytesByAccount.RUnlock() - return calls -} - -// NewestScriptPKByAddr calls NewestScriptPKByAddrFunc. -func (mock *MockSmartState) NewestScriptPKByAddr(addr proto.WavesAddress) (crypto.PublicKey, error) { - if mock.NewestScriptPKByAddrFunc == nil { - panic("MockSmartState.NewestScriptPKByAddrFunc: method is nil but SmartState.NewestScriptPKByAddr was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.lockNewestScriptPKByAddr.Lock() - mock.calls.NewestScriptPKByAddr = append(mock.calls.NewestScriptPKByAddr, callInfo) - mock.lockNewestScriptPKByAddr.Unlock() - return mock.NewestScriptPKByAddrFunc(addr) -} - -// NewestScriptPKByAddrCalls gets all the calls that were made to NewestScriptPKByAddr. -// Check the length with: -// -// len(mockedSmartState.NewestScriptPKByAddrCalls()) -func (mock *MockSmartState) NewestScriptPKByAddrCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.lockNewestScriptPKByAddr.RLock() - calls = mock.calls.NewestScriptPKByAddr - mock.lockNewestScriptPKByAddr.RUnlock() - return calls -} - -// NewestTransactionByID calls NewestTransactionByIDFunc. -func (mock *MockSmartState) NewestTransactionByID(bytes []byte) (proto.Transaction, error) { - if mock.NewestTransactionByIDFunc == nil { - panic("MockSmartState.NewestTransactionByIDFunc: method is nil but SmartState.NewestTransactionByID was just called") - } - callInfo := struct { - Bytes []byte - }{ - Bytes: bytes, - } - mock.lockNewestTransactionByID.Lock() - mock.calls.NewestTransactionByID = append(mock.calls.NewestTransactionByID, callInfo) - mock.lockNewestTransactionByID.Unlock() - return mock.NewestTransactionByIDFunc(bytes) -} - -// NewestTransactionByIDCalls gets all the calls that were made to NewestTransactionByID. -// Check the length with: -// -// len(mockedSmartState.NewestTransactionByIDCalls()) -func (mock *MockSmartState) NewestTransactionByIDCalls() []struct { - Bytes []byte -} { - var calls []struct { - Bytes []byte - } - mock.lockNewestTransactionByID.RLock() - calls = mock.calls.NewestTransactionByID - mock.lockNewestTransactionByID.RUnlock() - return calls -} - -// NewestTransactionHeightByID calls NewestTransactionHeightByIDFunc. -func (mock *MockSmartState) NewestTransactionHeightByID(bytes []byte) (uint64, error) { - if mock.NewestTransactionHeightByIDFunc == nil { - panic("MockSmartState.NewestTransactionHeightByIDFunc: method is nil but SmartState.NewestTransactionHeightByID was just called") - } - callInfo := struct { - Bytes []byte - }{ - Bytes: bytes, - } - mock.lockNewestTransactionHeightByID.Lock() - mock.calls.NewestTransactionHeightByID = append(mock.calls.NewestTransactionHeightByID, callInfo) - mock.lockNewestTransactionHeightByID.Unlock() - return mock.NewestTransactionHeightByIDFunc(bytes) -} - -// NewestTransactionHeightByIDCalls gets all the calls that were made to NewestTransactionHeightByID. -// Check the length with: -// -// len(mockedSmartState.NewestTransactionHeightByIDCalls()) -func (mock *MockSmartState) NewestTransactionHeightByIDCalls() []struct { - Bytes []byte -} { - var calls []struct { - Bytes []byte - } - mock.lockNewestTransactionHeightByID.RLock() - calls = mock.calls.NewestTransactionHeightByID - mock.lockNewestTransactionHeightByID.RUnlock() - return calls -} - -// NewestWavesBalance calls NewestWavesBalanceFunc. -func (mock *MockSmartState) NewestWavesBalance(account proto.Recipient) (uint64, error) { - if mock.NewestWavesBalanceFunc == nil { - panic("MockSmartState.NewestWavesBalanceFunc: method is nil but SmartState.NewestWavesBalance was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockNewestWavesBalance.Lock() - mock.calls.NewestWavesBalance = append(mock.calls.NewestWavesBalance, callInfo) - mock.lockNewestWavesBalance.Unlock() - return mock.NewestWavesBalanceFunc(account) -} - -// NewestWavesBalanceCalls gets all the calls that were made to NewestWavesBalance. -// Check the length with: -// -// len(mockedSmartState.NewestWavesBalanceCalls()) -func (mock *MockSmartState) NewestWavesBalanceCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockNewestWavesBalance.RLock() - calls = mock.calls.NewestWavesBalance - mock.lockNewestWavesBalance.RUnlock() - return calls -} - -// RetrieveEntries calls RetrieveEntriesFunc. -func (mock *MockSmartState) RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error) { - if mock.RetrieveEntriesFunc == nil { - panic("MockSmartState.RetrieveEntriesFunc: method is nil but SmartState.RetrieveEntries was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockRetrieveEntries.Lock() - mock.calls.RetrieveEntries = append(mock.calls.RetrieveEntries, callInfo) - mock.lockRetrieveEntries.Unlock() - return mock.RetrieveEntriesFunc(account) -} - -// RetrieveEntriesCalls gets all the calls that were made to RetrieveEntries. -// Check the length with: -// -// len(mockedSmartState.RetrieveEntriesCalls()) -func (mock *MockSmartState) RetrieveEntriesCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockRetrieveEntries.RLock() - calls = mock.calls.RetrieveEntries - mock.lockRetrieveEntries.RUnlock() - return calls -} - -// RetrieveNewestBinaryEntry calls RetrieveNewestBinaryEntryFunc. -func (mock *MockSmartState) RetrieveNewestBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - if mock.RetrieveNewestBinaryEntryFunc == nil { - panic("MockSmartState.RetrieveNewestBinaryEntryFunc: method is nil but SmartState.RetrieveNewestBinaryEntry was just called") - } - callInfo := struct { - Account proto.Recipient - Key string - }{ - Account: account, - Key: key, - } - mock.lockRetrieveNewestBinaryEntry.Lock() - mock.calls.RetrieveNewestBinaryEntry = append(mock.calls.RetrieveNewestBinaryEntry, callInfo) - mock.lockRetrieveNewestBinaryEntry.Unlock() - return mock.RetrieveNewestBinaryEntryFunc(account, key) -} - -// RetrieveNewestBinaryEntryCalls gets all the calls that were made to RetrieveNewestBinaryEntry. -// Check the length with: -// -// len(mockedSmartState.RetrieveNewestBinaryEntryCalls()) -func (mock *MockSmartState) RetrieveNewestBinaryEntryCalls() []struct { - Account proto.Recipient - Key string -} { - var calls []struct { - Account proto.Recipient - Key string - } - mock.lockRetrieveNewestBinaryEntry.RLock() - calls = mock.calls.RetrieveNewestBinaryEntry - mock.lockRetrieveNewestBinaryEntry.RUnlock() - return calls -} - -// RetrieveNewestBooleanEntry calls RetrieveNewestBooleanEntryFunc. -func (mock *MockSmartState) RetrieveNewestBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - if mock.RetrieveNewestBooleanEntryFunc == nil { - panic("MockSmartState.RetrieveNewestBooleanEntryFunc: method is nil but SmartState.RetrieveNewestBooleanEntry was just called") - } - callInfo := struct { - Account proto.Recipient - Key string - }{ - Account: account, - Key: key, - } - mock.lockRetrieveNewestBooleanEntry.Lock() - mock.calls.RetrieveNewestBooleanEntry = append(mock.calls.RetrieveNewestBooleanEntry, callInfo) - mock.lockRetrieveNewestBooleanEntry.Unlock() - return mock.RetrieveNewestBooleanEntryFunc(account, key) -} - -// RetrieveNewestBooleanEntryCalls gets all the calls that were made to RetrieveNewestBooleanEntry. -// Check the length with: -// -// len(mockedSmartState.RetrieveNewestBooleanEntryCalls()) -func (mock *MockSmartState) RetrieveNewestBooleanEntryCalls() []struct { - Account proto.Recipient - Key string -} { - var calls []struct { - Account proto.Recipient - Key string - } - mock.lockRetrieveNewestBooleanEntry.RLock() - calls = mock.calls.RetrieveNewestBooleanEntry - mock.lockRetrieveNewestBooleanEntry.RUnlock() - return calls -} - -// RetrieveNewestIntegerEntry calls RetrieveNewestIntegerEntryFunc. -func (mock *MockSmartState) RetrieveNewestIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - if mock.RetrieveNewestIntegerEntryFunc == nil { - panic("MockSmartState.RetrieveNewestIntegerEntryFunc: method is nil but SmartState.RetrieveNewestIntegerEntry was just called") - } - callInfo := struct { - Account proto.Recipient - Key string - }{ - Account: account, - Key: key, - } - mock.lockRetrieveNewestIntegerEntry.Lock() - mock.calls.RetrieveNewestIntegerEntry = append(mock.calls.RetrieveNewestIntegerEntry, callInfo) - mock.lockRetrieveNewestIntegerEntry.Unlock() - return mock.RetrieveNewestIntegerEntryFunc(account, key) -} - -// RetrieveNewestIntegerEntryCalls gets all the calls that were made to RetrieveNewestIntegerEntry. -// Check the length with: -// -// len(mockedSmartState.RetrieveNewestIntegerEntryCalls()) -func (mock *MockSmartState) RetrieveNewestIntegerEntryCalls() []struct { - Account proto.Recipient - Key string -} { - var calls []struct { - Account proto.Recipient - Key string - } - mock.lockRetrieveNewestIntegerEntry.RLock() - calls = mock.calls.RetrieveNewestIntegerEntry - mock.lockRetrieveNewestIntegerEntry.RUnlock() - return calls -} - -// RetrieveNewestStringEntry calls RetrieveNewestStringEntryFunc. -func (mock *MockSmartState) RetrieveNewestStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - if mock.RetrieveNewestStringEntryFunc == nil { - panic("MockSmartState.RetrieveNewestStringEntryFunc: method is nil but SmartState.RetrieveNewestStringEntry was just called") - } - callInfo := struct { - Account proto.Recipient - Key string - }{ - Account: account, - Key: key, - } - mock.lockRetrieveNewestStringEntry.Lock() - mock.calls.RetrieveNewestStringEntry = append(mock.calls.RetrieveNewestStringEntry, callInfo) - mock.lockRetrieveNewestStringEntry.Unlock() - return mock.RetrieveNewestStringEntryFunc(account, key) -} - -// RetrieveNewestStringEntryCalls gets all the calls that were made to RetrieveNewestStringEntry. -// Check the length with: -// -// len(mockedSmartState.RetrieveNewestStringEntryCalls()) -func (mock *MockSmartState) RetrieveNewestStringEntryCalls() []struct { - Account proto.Recipient - Key string -} { - var calls []struct { - Account proto.Recipient - Key string - } - mock.lockRetrieveNewestStringEntry.RLock() - calls = mock.calls.RetrieveNewestStringEntry - mock.lockRetrieveNewestStringEntry.RUnlock() - return calls -} - -// WavesBalanceProfile calls WavesBalanceProfileFunc. -func (mock *MockSmartState) WavesBalanceProfile(id proto.AddressID) (*types.WavesBalanceProfile, error) { - if mock.WavesBalanceProfileFunc == nil { - panic("MockSmartState.WavesBalanceProfileFunc: method is nil but SmartState.WavesBalanceProfile was just called") - } - callInfo := struct { - ID proto.AddressID - }{ - ID: id, - } - mock.lockWavesBalanceProfile.Lock() - mock.calls.WavesBalanceProfile = append(mock.calls.WavesBalanceProfile, callInfo) - mock.lockWavesBalanceProfile.Unlock() - return mock.WavesBalanceProfileFunc(id) -} - -// WavesBalanceProfileCalls gets all the calls that were made to WavesBalanceProfile. -// Check the length with: -// -// len(mockedSmartState.WavesBalanceProfileCalls()) -func (mock *MockSmartState) WavesBalanceProfileCalls() []struct { - ID proto.AddressID -} { - var calls []struct { - ID proto.AddressID - } - mock.lockWavesBalanceProfile.RLock() - calls = mock.calls.WavesBalanceProfile - mock.lockWavesBalanceProfile.RUnlock() - return calls -} diff --git a/pkg/ride/test_helpers_test.go b/pkg/ride/test_helpers_test.go index 5c75de8f2b..63cd1f268a 100644 --- a/pkg/ride/test_helpers_test.go +++ b/pkg/ride/test_helpers_test.go @@ -11,6 +11,7 @@ import ( "github.com/mr-tron/base58" "github.com/pkg/errors" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" @@ -20,6 +21,37 @@ import ( "github.com/wavesplatform/gowaves/pkg/types" ) +func unsetMockCalls(m *mock.Mock, methodName string) { + var toUnset []*mock.Call + for _, c := range m.ExpectedCalls { + if c.Method == methodName { + toUnset = append(toUnset, c) + } + } + for _, c := range toUnset { + c.Unset() + } +} + +func countMockCalls(m *mock.Mock, methodName string) int { + count := 0 + for _, c := range m.Calls { + if c.Method == methodName { + count++ + } + } + return count +} + +func hasMockExpectation(m *mock.Mock, methodName string) bool { + for _, c := range m.ExpectedCalls { + if c.Method == methodName { + return true + } + } + return false +} + type testAccount struct { sk crypto.SecretKey pk crypto.PublicKey @@ -71,7 +103,7 @@ func newTestAccountFromAddress(addr proto.WavesAddress) *testAccount { } // Can be used only when secret and public keys aren't required by test -func newTestAccountFromAddresString(t *testing.T, addr string) *testAccount { +func newTestAccountFromAddressString(t *testing.T, addr string) *testAccount { ad, err := proto.NewAddressFromString(addr) require.NoError(t, err, "failed to create test account") return newTestAccountFromAddress(ad) @@ -100,8 +132,8 @@ type testEnv struct { this proto.WavesAddress dAppAddr proto.WavesAddress inv rideType - me *mockRideEnvironment - ms *MockSmartState + me *MockEnvironment + ms *types.MockEnrichedSmartState ws *WrappedState recipients map[string]proto.WavesAddress accounts map[proto.WavesAddress]*testAccount @@ -118,43 +150,22 @@ type testEnv struct { } func newTestEnv(t *testing.T) *testEnv { - me := &mockRideEnvironment{ - schemeFunc: func() byte { - return proto.TestNetScheme - }, - blockV5ActivatedFunc: func() bool { - return false - }, - isProtobufTxFunc: func() bool { - return false - }, - maxDataEntriesSizeFunc: func() int { - return proto.MaxDataEntriesScriptActionsSizeInBytesV1 // V1 by default - }, - checkMessageLengthFunc: bytesSizeCheckV1V2, - validateInternalPaymentsFunc: func() bool { - return false - }, - rideV6ActivatedFunc: func() bool { - return false - }, - consensusImprovementsActivatedFunc: func() bool { - return false - }, - blockRewardDistributionActivatedFunc: func() bool { - return false - }, - lightNodeActivatedFunc: func() bool { - return false - }, - paymentsFixActivatedFunc: func() bool { - return false - }, - } + me := NewMockEnvironment(t) + me.EXPECT().scheme().Return(proto.TestNetScheme).Maybe() + me.EXPECT().blockV5Activated().Return(false).Maybe() + me.EXPECT().isProtobufTx().Return(false).Maybe() + me.EXPECT().maxDataEntriesSize().Return(proto.MaxDataEntriesScriptActionsSizeInBytesV1).Maybe() + me.EXPECT().checkMessageLength(mock.Anything).RunAndReturn(bytesSizeCheckV1V2).Maybe() + me.EXPECT().validateInternalPayments().Return(false).Maybe() + me.EXPECT().rideV6Activated().Return(false).Maybe() + me.EXPECT().consensusImprovementsActivated().Return(false).Maybe() + me.EXPECT().blockRewardDistributionActivated().Return(false).Maybe() + me.EXPECT().lightNodeActivated().Return(false).Maybe() + me.EXPECT().paymentsFixActivated().Return(false).Maybe() r := &testEnv{ t: t, me: me, - ms: &MockSmartState{}, + ms: types.NewMockEnrichedSmartState(t), recipients: map[string]proto.WavesAddress{}, accounts: map[proto.WavesAddress]*testAccount{}, entries: map[proto.WavesAddress]map[string]proto.DataEntry{}, @@ -168,80 +179,87 @@ func newTestEnv(t *testing.T) *testEnv { scripts: map[proto.WavesAddress]proto.Script{}, notFoundErr: errors.New("not found"), } - r.me.stateFunc = func() types.SmartState { + me.EXPECT().state().RunAndReturn(func() types.SmartState { return r.ms - } - r.ms.NewestRecipientToAddressFunc = func(recipient proto.Recipient) (proto.WavesAddress, error) { - if a, ok := r.recipients[recipient.String()]; ok { - return a, nil - } - return proto.WavesAddress{}, errors.Errorf("unknown recipient '%s'", recipient.String()) - } - r.ms.NewestScriptPKByAddrFunc = func(addr proto.WavesAddress) (crypto.PublicKey, error) { - if acc, ok := r.accounts[addr]; ok { - return acc.publicKey(), nil - } - return crypto.PublicKey{}, errors.Errorf("unknown address '%s'", addr.String()) - } - r.ms.NewestScriptByAccountFunc = func(account proto.Recipient) (*ast.Tree, error) { - addr, err := r.resolveRecipient(account) - if err != nil { - return nil, err - } - if t, ok := r.trees[addr]; ok { - return t, nil - } - return nil, errors.Errorf("unknown address '%s'", addr.String()) - } - r.ms.RetrieveNewestBinaryEntryFunc = func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - e, err := r.retrieveEntry(account, key) - if err != nil { - return nil, err - } - if be, ok := e.(*proto.BinaryDataEntry); ok { - return be, nil - } - return nil, errors.Wrapf(r.notFoundErr, // consider as not found, because it is not a binary data entry - "unexpected type '%T' of entry at '%s' by key '%s'", e, account.String(), key, - ) - } - r.ms.RetrieveNewestBooleanEntryFunc = func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - e, err := r.retrieveEntry(account, key) - if err != nil { - return nil, err - } - if be, ok := e.(*proto.BooleanDataEntry); ok { - return be, nil - } - return nil, errors.Wrapf(r.notFoundErr, // consider as not found, because it is not a boolean data entry - "unexpected type '%T' of entry at '%s' by key '%s'", e, account.String(), key, - ) - } - r.ms.RetrieveNewestIntegerEntryFunc = func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - e, err := r.retrieveEntry(account, key) - if err != nil { - return nil, err - } - if be, ok := e.(*proto.IntegerDataEntry); ok { - return be, nil - } - return nil, errors.Wrapf(r.notFoundErr, // consider as not found, because it is not a integer data entry - "unexpected type '%T' of entry at '%s' by key '%s'", e, account.String(), key, - ) - } - r.ms.RetrieveNewestStringEntryFunc = func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - e, err := r.retrieveEntry(account, key) - if err != nil { - return nil, err - } - if be, ok := e.(*proto.StringDataEntry); ok { - return be, nil - } - return nil, errors.Wrapf(r.notFoundErr, // consider as not found, because it is not a string data entry - "unexpected type '%T' of entry at '%s' by key '%s'", e, account.String(), key, - ) - } - r.ms.NewestWavesBalanceFunc = func(account proto.Recipient) (uint64, error) { + }).Maybe() + r.ms.EXPECT().NewestRecipientToAddress(mock.Anything).RunAndReturn( + func(recipient proto.Recipient) (proto.WavesAddress, error) { + if a, ok := r.recipients[recipient.String()]; ok { + return a, nil + } + return proto.WavesAddress{}, errors.Errorf("unknown recipient '%s'", recipient.String()) + }).Maybe() + r.ms.EXPECT().NewestScriptPKByAddr(mock.Anything).RunAndReturn( + func(addr proto.WavesAddress) (crypto.PublicKey, error) { + if acc, ok := r.accounts[addr]; ok { + return acc.publicKey(), nil + } + return crypto.PublicKey{}, errors.Errorf("unknown address '%s'", addr.String()) + }).Maybe() + r.ms.EXPECT().NewestScriptByAccount(mock.Anything).RunAndReturn( + func(account proto.Recipient) (*ast.Tree, error) { + addr, err := r.resolveRecipient(account) + if err != nil { + return nil, err + } + if t, ok := r.trees[addr]; ok { + return t, nil + } + return nil, errors.Errorf("unknown address '%s'", addr.String()) + }).Maybe() + r.ms.EXPECT().RetrieveNewestBinaryEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + e, err := r.retrieveEntry(account, key) + if err != nil { + return nil, err + } + if be, ok := e.(*proto.BinaryDataEntry); ok { + return be, nil + } + return nil, errors.Wrapf(r.notFoundErr, // consider as not found, because it is not a binary data entry + "unexpected type '%T' of entry at '%s' by key '%s'", e, account.String(), key, + ) + }).Maybe() + r.ms.EXPECT().RetrieveNewestBooleanEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + e, err := r.retrieveEntry(account, key) + if err != nil { + return nil, err + } + if be, ok := e.(*proto.BooleanDataEntry); ok { + return be, nil + } + return nil, errors.Wrapf(r.notFoundErr, // consider as not found, because it is not a boolean data entry + "unexpected type '%T' of entry at '%s' by key '%s'", e, account.String(), key, + ) + }).Maybe() + r.ms.EXPECT().RetrieveNewestIntegerEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + e, err := r.retrieveEntry(account, key) + if err != nil { + return nil, err + } + if be, ok := e.(*proto.IntegerDataEntry); ok { + return be, nil + } + return nil, errors.Wrapf(r.notFoundErr, // Consider as not found, because it is not an integer data entry. + "unexpected type '%T' of entry at '%s' by key '%s'", e, account.String(), key, + ) + }).Maybe() + r.ms.EXPECT().RetrieveNewestStringEntry(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { + e, err := r.retrieveEntry(account, key) + if err != nil { + return nil, err + } + if be, ok := e.(*proto.StringDataEntry); ok { + return be, nil + } + return nil, errors.Wrapf(r.notFoundErr, // consider as not found, because it is not a string data entry + "unexpected type '%T' of entry at '%s' by key '%s'", e, account.String(), key, + ) + }).Maybe() + r.ms.EXPECT().NewestWavesBalance(mock.Anything).RunAndReturn(func(account proto.Recipient) (uint64, error) { addr, err := r.resolveRecipient(account) if err != nil { return 0, err @@ -250,140 +268,154 @@ func newTestEnv(t *testing.T) *testEnv { return profile.Balance, nil } return 0, errors.Errorf("no balance profile for address '%s'", addr.String()) - } - r.ms.WavesBalanceProfileFunc = func(id proto.AddressID) (*types.WavesBalanceProfile, error) { - addr, err := id.ToWavesAddress(r.me.scheme()) - require.NoError(r.t, err) - if profile, ok := r.waves[addr]; ok { - return profile, nil - } - return nil, errors.Errorf("no balance profile for address '%s'", addr.String()) - } - r.ms.NewestFullWavesBalanceFunc = func(account proto.Recipient) (*proto.FullWavesBalance, error) { - addr, err := r.resolveRecipient(account) - if err != nil { - return nil, err - } - if profile, ok := r.waves[addr]; ok { - eff := int64(profile.Balance) + profile.LeaseIn - profile.LeaseOut - if eff < 0 { - return nil, errors.New("negative effective balance") + }).Maybe() + r.ms.EXPECT().WavesBalanceProfile(mock.Anything).RunAndReturn( + func(id proto.AddressID) (*types.WavesBalanceProfile, error) { + addr, err := id.ToWavesAddress(r.me.scheme()) + require.NoError(r.t, err) + if profile, ok := r.waves[addr]; ok { + return profile, nil } - spb := int64(profile.Balance) - profile.LeaseOut - if spb < 0 { - return nil, errors.New("negative spendable balance") + return nil, errors.Errorf("no balance profile for address '%s'", addr.String()) + }).Maybe() + r.ms.EXPECT().NewestFullWavesBalance(mock.Anything).RunAndReturn( + func(account proto.Recipient) (*proto.FullWavesBalance, error) { + addr, err := r.resolveRecipient(account) + if err != nil { + return nil, err } - return &proto.FullWavesBalance{ - Regular: profile.Balance, - Generating: profile.Generating, - Available: uint64(spb), - Effective: uint64(eff), - LeaseIn: uint64(profile.LeaseIn), - LeaseOut: uint64(profile.LeaseOut), - }, nil - } - return nil, errors.Errorf("no balance profile for address '%s'", addr.String()) - } - r.ms.NewestAddrByAliasFunc = func(alias proto.Alias) (proto.WavesAddress, error) { - if a, ok := r.aliases[alias]; ok { - return a, nil - } - return proto.WavesAddress{}, errors.Errorf("unknown alias '%s'", alias.String()) - } - r.ms.NewestAssetIsSponsoredFunc = func(assetID crypto.Digest) (bool, error) { - aID := proto.AssetIDFromDigest(assetID) - if s, ok := r.sponsorship[aID]; ok { - return s, nil - } - return false, errors.Errorf("unknown asset '%s'", assetID.String()) - } - r.ms.NewestAssetConstInfoFunc = func(assetID proto.AssetID) (*proto.AssetConstInfo, error) { - if ai, ok := r.assets[assetID]; ok { - return &ai.AssetConstInfo, nil - } - return nil, errors.Errorf("unknown asset '%s'", assetID.String()) - } - r.ms.NewestAssetInfoFunc = func(assetID crypto.Digest) (*proto.AssetInfo, error) { - aID := proto.AssetIDFromDigest(assetID) - if ai, ok := r.assets[aID]; ok { - return &ai.AssetInfo, nil - } - return nil, errors.Errorf("unknown asset '%s'", assetID.String()) - } - r.ms.NewestFullAssetInfoFunc = func(assetID crypto.Digest) (*proto.FullAssetInfo, error) { - aID := proto.AssetIDFromDigest(assetID) - if ai, ok := r.assets[aID]; ok { - return ai, nil - } - return nil, errors.Errorf("unknown asset '%s'", assetID.String()) - } - r.ms.NewestAssetBalanceFunc = func(account proto.Recipient, assetID crypto.Digest) (uint64, error) { - addr, err := r.resolveRecipient(account) - if err != nil { - return 0, err - } - if balances, ok := r.tokens[addr]; ok { - if b, ok := balances[assetID]; ok { - return b, nil + if profile, ok := r.waves[addr]; ok { + eff := int64(profile.Balance) + profile.LeaseIn - profile.LeaseOut + if eff < 0 { + return nil, errors.New("negative effective balance") + } + spb := int64(profile.Balance) - profile.LeaseOut + if spb < 0 { + return nil, errors.New("negative spendable balance") + } + return &proto.FullWavesBalance{ + Regular: profile.Balance, + Generating: profile.Generating, + Available: uint64(spb), + Effective: uint64(eff), + LeaseIn: uint64(profile.LeaseIn), + LeaseOut: uint64(profile.LeaseOut), + }, nil } - return 0, errors.Errorf("unknown asset '%s' for address '%s'", assetID.String(), addr.String()) - } - return 0, errors.Errorf("no asset balances for address '%s'", addr.String()) - } - r.ms.NewestAssetBalanceByAddressIDFunc = func(id proto.AddressID, a crypto.Digest) (uint64, error) { - addr, err := id.ToWavesAddress(r.me.scheme()) - require.NoError(r.t, err) - if t, ok := r.tokens[addr]; ok { - if b, ok := t[a]; ok { - return b, nil + return nil, errors.Errorf("no balance profile for address '%s'", addr.String()) + }).Maybe() + r.ms.EXPECT().NewestAddrByAlias(mock.Anything).RunAndReturn( + func(alias proto.Alias) (proto.WavesAddress, error) { + if a, ok := r.aliases[alias]; ok { + return a, nil } - return 0, errors.Errorf("unknown asset '%s' for address '%s'", a.String(), addr.String()) - } - return 0, errors.Errorf("no asset balances for address '%s'", addr.String()) - } - r.ms.NewestLeasingInfoFunc = func(id crypto.Digest) (*proto.LeaseInfo, error) { - if l, ok := r.leasings[id]; ok { - return l, nil - } - return nil, errors.Errorf("no leasing '%s'", id.String()) - } - r.ms.NewestScriptBytesByAccountFunc = func(recipient proto.Recipient) (proto.Script, error) { - addr, err := r.resolveRecipient(recipient) - if err != nil { - return nil, err - } - if s, ok := r.scripts[addr]; ok { - return s, nil - } - return nil, nil - } - r.ms.IsNotFoundFunc = func(err error) bool { + return proto.WavesAddress{}, errors.Errorf("unknown alias '%s'", alias.String()) + }).Maybe() + r.ms.EXPECT().NewestAssetIsSponsored(mock.Anything).RunAndReturn( + func(assetID crypto.Digest) (bool, error) { + aID := proto.AssetIDFromDigest(assetID) + if s, ok := r.sponsorship[aID]; ok { + return s, nil + } + return false, errors.Errorf("unknown asset '%s'", assetID.String()) + }).Maybe() + r.ms.EXPECT().NewestAssetConstInfo(mock.Anything).RunAndReturn( + func(assetID proto.AssetID) (*proto.AssetConstInfo, error) { + if ai, ok := r.assets[assetID]; ok { + return &ai.AssetConstInfo, nil + } + return nil, errors.Errorf("unknown asset '%s'", assetID.String()) + }).Maybe() + r.ms.EXPECT().NewestAssetInfo(mock.Anything).RunAndReturn( + func(assetID crypto.Digest) (*proto.AssetInfo, error) { + aID := proto.AssetIDFromDigest(assetID) + if ai, ok := r.assets[aID]; ok { + return &ai.AssetInfo, nil + } + return nil, errors.Errorf("unknown asset '%s'", assetID.String()) + }).Maybe() + r.ms.EXPECT().NewestFullAssetInfo(mock.Anything).RunAndReturn( + func(assetID crypto.Digest) (*proto.FullAssetInfo, error) { + aID := proto.AssetIDFromDigest(assetID) + if ai, ok := r.assets[aID]; ok { + return ai, nil + } + return nil, errors.Errorf("unknown asset '%s'", assetID.String()) + }).Maybe() + r.ms.EXPECT().NewestAssetBalance(mock.Anything, mock.Anything).RunAndReturn( + func(account proto.Recipient, assetID crypto.Digest) (uint64, error) { + addr, err := r.resolveRecipient(account) + if err != nil { + return 0, err + } + if balances, ok := r.tokens[addr]; ok { + if b, bOK := balances[assetID]; bOK { + return b, nil + } + return 0, errors.Errorf("unknown asset '%s' for address '%s'", assetID.String(), addr.String()) + } + return 0, errors.Errorf("no asset balances for address '%s'", addr.String()) + }).Maybe() + r.ms.EXPECT().NewestAssetBalanceByAddressID(mock.Anything, mock.Anything).RunAndReturn( + func(id proto.AddressID, a crypto.Digest) (uint64, error) { + addr, err := id.ToWavesAddress(r.me.scheme()) + require.NoError(r.t, err) + if t, ok := r.tokens[addr]; ok { + if b, tOK := t[a]; tOK { + return b, nil + } + return 0, errors.Errorf("unknown asset '%s' for address '%s'", a.String(), addr.String()) + } + return 0, errors.Errorf("no asset balances for address '%s'", addr.String()) + }).Maybe() + r.ms.EXPECT().NewestLeasingInfo(mock.Anything).RunAndReturn( + func(id crypto.Digest) (*proto.LeaseInfo, error) { + if l, ok := r.leasings[id]; ok { + return l, nil + } + return nil, errors.Errorf("no leasing '%s'", id.String()) + }).Maybe() + r.ms.EXPECT().NewestScriptBytesByAccount(mock.Anything).RunAndReturn( + func(recipient proto.Recipient) (proto.Script, error) { + addr, err := r.resolveRecipient(recipient) + if err != nil { + return nil, err + } + if s, ok := r.scripts[addr]; ok { + return s, nil + } + return nil, nil + }).Maybe() + r.ms.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(err error) bool { return errors.Is(err, r.notFoundErr) - } + }).Maybe() return r } func (e *testEnv) withScheme(scheme byte) *testEnv { - e.me.schemeFunc = func() byte { - return scheme - } + unsetMockCalls(&e.me.Mock, "scheme") + e.me.EXPECT().scheme().Return(scheme).Maybe() return e } func (e *testEnv) withLibVersion(v ast.LibraryVersion) *testEnv { - e.me.libVersionFunc = func() (ast.LibraryVersion, error) { + unsetMockCalls(&e.me.Mock, "libVersion") + unsetMockCalls(&e.me.Mock, "setLibVersion") + e.me.EXPECT().libVersion().RunAndReturn(func() (ast.LibraryVersion, error) { return v, nil - } - e.me.setLibVersionFunc = func(newV ast.LibraryVersion) { + }).Maybe() + e.me.EXPECT().setLibVersion(mock.Anything).Run(func(newV ast.LibraryVersion) { v = newV - } + }).Return().Maybe() return e } func (e *testEnv) withComplexityLimit(limit int) *testEnv { require.True(e.t, limit >= 0) var cc complexityCalculator - e.me.complexityCalculatorFunc = func() complexityCalculator { + unsetMockCalls(&e.me.Mock, "complexityCalculator") + unsetMockCalls(&e.me.Mock, "setComplexityCalculator") + e.me.EXPECT().complexityCalculator().RunAndReturn(func() complexityCalculator { if cc != nil { // already initialized return cc } @@ -392,106 +424,100 @@ func (e *testEnv) withComplexityLimit(limit int) *testEnv { cc = newComplexityCalculatorByRideV6Activation(isRideV6Activated) cc.setLimit(uint32(limit)) return cc - } - e.me.setComplexityCalculatorFunc = func(newCC complexityCalculator) { + }).Maybe() + e.me.EXPECT().setComplexityCalculator(mock.Anything).Run(func(newCC complexityCalculator) { cc = newCC - } + }).Return().Maybe() return e } func (e *testEnv) withBlockV5Activated() *testEnv { - e.me.blockV5ActivatedFunc = func() bool { - return true - } + unsetMockCalls(&e.me.Mock, "blockV5Activated") + e.me.EXPECT().blockV5Activated().Return(true).Maybe() return e } func (e *testEnv) withBlock(blockInfo *proto.BlockInfo) *testEnv { - e.me.blockFunc = func() rideType { + unsetMockCalls(&e.me.Mock, "block") + e.me.EXPECT().block().RunAndReturn(func() rideType { v, err := e.me.libVersion() if err != nil { panic(err) } return blockInfoToObject(blockInfo, v) - } - e.ms.AddingBlockHeightFunc = func() (uint64, error) { + }).Maybe() + e.ms.EXPECT().AddingBlockHeight().RunAndReturn(func() (uint64, error) { return blockInfo.Height, nil - } - e.ms.NewestBlockInfoByHeightFunc = func(height uint64) (*proto.BlockInfo, error) { + }).Maybe() + e.ms.EXPECT().NewestBlockInfoByHeight(mock.Anything).RunAndReturn(func(height uint64) (*proto.BlockInfo, error) { if height == blockInfo.Height { return blockInfo, nil } return nil, errors.Errorf("unexpected test height %d", height) - } + }).Maybe() return e } func (e *testEnv) withProtobufTx() *testEnv { - e.me.isProtobufTxFunc = func() bool { - return true - } + unsetMockCalls(&e.me.Mock, "isProtobufTx") + e.me.EXPECT().isProtobufTx().Return(true).Maybe() return e } func (e *testEnv) withDataEntriesSizeV2() *testEnv { - e.me.maxDataEntriesSizeFunc = func() int { - return proto.MaxDataEntriesScriptActionsSizeInBytesV2 - } + unsetMockCalls(&e.me.Mock, "maxDataEntriesSize") + e.me.EXPECT().maxDataEntriesSize().Return(proto.MaxDataEntriesScriptActionsSizeInBytesV2).Maybe() return e } func (e *testEnv) withMessageLengthV3() *testEnv { - e.me.checkMessageLengthFunc = bytesSizeCheckV3V6 + unsetMockCalls(&e.me.Mock, "checkMessageLength") + e.me.EXPECT().checkMessageLength(mock.Anything).RunAndReturn(bytesSizeCheckV3V6).Maybe() return e } func (e *testEnv) withRideV6Activated() *testEnv { - e.me.rideV6ActivatedFunc = func() bool { - return true - } + unsetMockCalls(&e.me.Mock, "rideV6Activated") + e.me.EXPECT().rideV6Activated().Return(true).Maybe() return e } func (e *testEnv) withConsensusImprovementsActivatedFunc() *testEnv { - e.me.consensusImprovementsActivatedFunc = func() bool { - return true - } + unsetMockCalls(&e.me.Mock, "consensusImprovementsActivated") + e.me.EXPECT().consensusImprovementsActivated().Return(true).Maybe() return e } func (e *testEnv) withBlockRewardDistribution() *testEnv { - e.me.blockRewardDistributionActivatedFunc = func() bool { - return true - } + unsetMockCalls(&e.me.Mock, "blockRewardDistributionActivated") + e.me.EXPECT().blockRewardDistributionActivated().Return(true).Maybe() return e } func (e *testEnv) withLightNodeActivated() *testEnv { - e.me.lightNodeActivatedFunc = func() bool { - return true - } + unsetMockCalls(&e.me.Mock, "lightNodeActivated") + e.me.EXPECT().lightNodeActivated().Return(true).Maybe() return e } func (e *testEnv) withValidateInternalPayments() *testEnv { - e.me.validateInternalPaymentsFunc = func() bool { - return true - } + unsetMockCalls(&e.me.Mock, "validateInternalPayments") + e.me.EXPECT().validateInternalPayments().Return(true).Maybe() return e } func (e *testEnv) withPaymentsFix() *testEnv { - e.me.paymentsFixActivatedFunc = func() bool { - return true - } + unsetMockCalls(&e.me.Mock, "paymentsFixActivated") + e.me.EXPECT().paymentsFixActivated().Return(true).Maybe() return e } func (e *testEnv) withThis(acc *testAccount) *testEnv { e.this = acc.address() - e.me.thisFunc = func() rideType { + unsetMockCalls(&e.me.Mock, "this") + e.me.EXPECT().this().RunAndReturn(func() rideType { return rideAddress(e.this) - } + }).Maybe() return e } @@ -506,13 +532,14 @@ func (e *testEnv) withSender(acc *testAccount) *testEnv { func (e *testEnv) withDApp(acc *testAccount) *testEnv { e.dApp = acc e.dAppAddr = e.dApp.address() - e.me.setNewDAppAddressFunc = func(address proto.WavesAddress) { + unsetMockCalls(&e.me.Mock, "setNewDAppAddress") + e.me.EXPECT().setNewDAppAddress(mock.Anything).Run(func(address proto.WavesAddress) { e.dAppAddr = address e.this = address if e.ws != nil { e.ws.cle = rideAddress(address) // We have to update wrapped state's `cle` if any } - } + }).Return().Maybe() rcp := acc.recipient() e.recipients[rcp.String()] = acc.address() e.accounts[acc.address()] = acc @@ -568,43 +595,46 @@ func (e *testEnv) withInvocation(fn string, opts ...testInvocationOption) *testE } func (e *testEnv) withFullScriptTransfer(transfer *proto.FullScriptTransfer) *testEnv { - e.me.transactionFunc = func() rideType { + unsetMockCalls(&e.me.Mock, "transaction") + e.me.EXPECT().transaction().RunAndReturn(func() rideType { return scriptTransferToTransferTransactionObject(transfer) - } + }).Maybe() return e } func (e *testEnv) withTransaction(tx proto.Transaction) *testEnv { - e.me.transactionFunc = func() rideType { + unsetMockCalls(&e.me.Mock, "transaction") + e.me.EXPECT().transaction().RunAndReturn(func() rideType { txo, err := transactionToObject(e.me, tx) require.NoError(e.t, err, "failed to set transaction") return txo - } - e.ms.NewestTransactionByIDFunc = func(id []byte) (proto.Transaction, error) { + }).Maybe() + e.ms.EXPECT().NewestTransactionByID(mock.Anything).RunAndReturn(func(_ []byte) (proto.Transaction, error) { return tx, nil - } + }).Maybe() id, err := tx.GetID(e.me.scheme()) require.NoError(e.t, err) - e.me.txIDFunc = func() rideType { + unsetMockCalls(&e.me.Mock, "txID") + e.me.EXPECT().txID().RunAndReturn(func() rideType { return rideByteVector(id) - } + }).Maybe() return e } func (e *testEnv) withTransactionID(id crypto.Digest) *testEnv { - e.me.txIDFunc = func() rideType { + unsetMockCalls(&e.me.Mock, "txID") + e.me.EXPECT().txID().RunAndReturn(func() rideType { return rideByteVector(id.Bytes()) - } + }).Maybe() return e } func (e *testEnv) withHeight(h int) *testEnv { - e.me.heightFunc = func() rideInt { - return rideInt(h) - } - e.ms.AddingBlockHeightFunc = func() (uint64, error) { + unsetMockCalls(&e.me.Mock, "height") + e.me.EXPECT().height().Return(rideInt(h)).Maybe() + e.ms.EXPECT().AddingBlockHeight().RunAndReturn(func() (uint64, error) { return uint64(h), nil - } + }).Maybe() return e } @@ -649,14 +679,15 @@ func (e *testEnv) withDataFromJSON(s string) *testEnv { func (e *testEnv) withWrappedState() *testEnv { v, err := e.me.libVersion() require.NoError(e.t, err) - if e.me.heightFunc == nil { // create stub height function` - e.me.heightFunc = func() rideInt { return 0 } - defer func() { e.me.heightFunc = nil }() + if !hasMockExpectation(&e.me.Mock, "height") { // create stub height expectation + e.me.EXPECT().height().Return(rideInt(0)).Maybe() + defer func() { unsetMockCalls(&e.me.Mock, "height") }() } e.ws = newWrappedState(e.me, e.ms, v) - e.me.stateFunc = func() types.SmartState { + unsetMockCalls(&e.me.Mock, "state") + e.me.EXPECT().state().RunAndReturn(func() types.SmartState { return e.ws - } + }).Maybe() return e } func (e *testEnv) withDataEntries(acc *testAccount, entries ...proto.DataEntry) *testEnv { @@ -735,11 +766,12 @@ func (e *testEnv) withAssetBalance(acc *testAccount, asset crypto.Digest, balanc } func (e *testEnv) withTakeStringV5() *testEnv { - e.me.takeStringFunc = takeRideString + unsetMockCalls(&e.me.Mock, "takeString") + e.me.EXPECT().takeString(mock.Anything, mock.Anything).RunAndReturn(takeRideString).Maybe() return e } -func (e *testEnv) toEnv() *mockRideEnvironment { +func (e *testEnv) toEnv() *MockEnvironment { return e.me } @@ -758,12 +790,9 @@ func (e *testEnv) retrieveEntry(account proto.Recipient, key string) (proto.Data } func (e *testEnv) withNoTransactionAtHeight() *testEnv { - e.ms.NewestTransactionHeightByIDFunc = func(_ []byte) (uint64, error) { - return 0, proto.ErrNotFound - } - e.ms.IsNotFoundFunc = func(err error) bool { - return true - } + e.ms.EXPECT().NewestTransactionHeightByID(mock.Anything).RunAndReturn(func(_ []byte) (uint64, error) { + return 0, e.notFoundErr + }).Maybe() return e } @@ -778,7 +807,7 @@ func (e *testEnv) resolveRecipient(rcp proto.Recipient) (proto.WavesAddress, err } func (e *testEnv) withUntouchedState(acc *testAccount) *testEnv { - e.ms.IsStateUntouchedFunc = func(recipient proto.Recipient) (bool, error) { + e.ms.EXPECT().IsStateUntouched(mock.Anything).RunAndReturn(func(recipient proto.Recipient) (bool, error) { addr, err := e.resolveRecipient(recipient) if err != nil { return false, err @@ -787,7 +816,7 @@ func (e *testEnv) withUntouchedState(acc *testAccount) *testEnv { return true, nil } return false, errors.Errorf("unexpected recipient '%s'", recipient.String()) - } + }).Maybe() return e } @@ -799,20 +828,24 @@ func (e *testEnv) withInvokeTransaction(tx *proto.InvokeScriptWithProofs) *testE } e.inv, err = invocationToObject(v, e.me.scheme(), tx) require.NoError(e.t, err) - e.me.invocationFunc = func() rideType { + unsetMockCalls(&e.me.Mock, "invocation") + e.me.EXPECT().invocation().RunAndReturn(func() rideType { return e.inv - } + }).Maybe() txo, err := transactionToObject(e.me, tx) require.NoError(e.t, err) - e.me.transactionFunc = func() rideType { + unsetMockCalls(&e.me.Mock, "transaction") + e.me.EXPECT().transaction().RunAndReturn(func() rideType { return txo - } - e.me.setInvocationFunc = func(inv rideType) { + }).Maybe() + unsetMockCalls(&e.me.Mock, "setInvocation") + e.me.EXPECT().setInvocation(mock.Anything).Run(func(inv rideType) { e.inv = inv - } - e.me.txIDFunc = func() rideType { + }).Return().Maybe() + unsetMockCalls(&e.me.Mock, "txID") + e.me.EXPECT().txID().RunAndReturn(func() rideType { return rideByteVector(tx.ID.Bytes()) - } + }).Maybe() return e } diff --git a/pkg/ride/tree_evaluation_test.go b/pkg/ride/tree_evaluation_test.go index bffb580e53..4bf1bb33c9 100644 --- a/pkg/ride/tree_evaluation_test.go +++ b/pkg/ride/tree_evaluation_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" @@ -2670,7 +2671,7 @@ func TestFailSript2(t *testing.T) { tx := new(proto.ExchangeWithProofs) err := json.Unmarshal([]byte(transaction), tx) require.NoError(t, err) - adminAcc := newTestAccountFromAddresString(t, "3PEyLyxu4yGJAEmuVRy3G4FvEBUYV6ykQWF") + adminAcc := newTestAccountFromAddressString(t, "3PEyLyxu4yGJAEmuVRy3G4FvEBUYV6ykQWF") te := newTestEnv(t).withLibVersion(tree.LibVersion).withComplexityLimit(2000). withScheme(proto.TestNetScheme).withHeight(368430).withTransaction(tx). @@ -4485,9 +4486,16 @@ func TestFailRejectMultiLevelInvokesBeforeRideV6(t *testing.T) { _, err := CallFunction(env.toEnv(), tree, proto.NewFunctionCall("call", proto.Arguments{&proto.IntegerArgument{Value: 10}})) require.Error(t, err) assert.Equal(t, RuntimeError, GetEvaluationErrorType(err)) - calls := env.ms.NewestAddrByAliasCalls() - require.Len(t, calls, 1) - require.Equal(t, alias, calls[0].Alias) + var aliasCalls []mock.Call + for _, c := range env.ms.Calls { + if c.Method == "NewestAddrByAlias" { + aliasCalls = append(aliasCalls, c) + } + } + require.Len(t, aliasCalls, 1) + aa, ok := aliasCalls[0].Arguments.Get(0).(proto.Alias) + require.True(t, ok) + require.Equal(t, alias, aa) _, err = CallFunction(env.toEnv(), tree, proto.NewFunctionCall("call", proto.Arguments{&proto.IntegerArgument{Value: 1}})) require.Error(t, err) @@ -5380,7 +5388,7 @@ func TestInvokePaymentsCheckBeforeAndAfterInvoke(t *testing.T) { assert.Equal(t, UserError, GetEvaluationErrorType(err)) // the call happens only once in `WrappedState.validatePaymentAction` during payment application // payments check after application are not performed because of throw - assert.Len(t, rideEnv.calls.validateInternalPayments, 1) + assert.Equal(t, 1, countMockCalls(&rideEnv.Mock, "validateInternalPayments")) }) t.Run("AfterLightNodeActivationWithoutPaymentsFix", func(t *testing.T) { env := prepareEnv().withLightNodeActivated() @@ -5393,7 +5401,7 @@ func TestInvokePaymentsCheckBeforeAndAfterInvoke(t *testing.T) { // in `performInvoke` function // in `checkPaymentsApplication` inside `WrappedState.validateBalancesAfterPaymentsApplication` // payments check after application are not second time because of throw - assert.Len(t, rideEnv.calls.validateInternalPayments, 2) + assert.Equal(t, 2, countMockCalls(&rideEnv.Mock, "validateInternalPayments")) }) t.Run("AfterLightNodeActivationAndPaymentsFix", func(t *testing.T) { env := prepareEnv().withLightNodeActivated().withPaymentsFix() @@ -5406,7 +5414,7 @@ func TestInvokePaymentsCheckBeforeAndAfterInvoke(t *testing.T) { // in `performInvoke` function // in `checkPaymentsApplication` inside `WrappedState.validateBalancesAfterPaymentsApplication` // successfully fails before invoke because of negative balance - assert.Len(t, rideEnv.calls.validateInternalPayments, 2) + assert.Equal(t, 2, countMockCalls(&rideEnv.Mock, "validateInternalPayments")) }) } @@ -6176,7 +6184,8 @@ func TestZeroComplexitySanityCheckInComplexityCalculator(t *testing.T) { withThis(dApp1).withDApp(dApp1).withSender(sender). withInvocation("call", withTransactionID(crypto.Digest{})).withTree(dApp1, tree1). withWrappedState().toEnv() - env.complexityCalculatorFunc = func() complexityCalculator { return cc } + unsetMockCalls(&env.Mock, "complexityCalculator") + env.EXPECT().complexityCalculator().Return(cc).Maybe() return env } t.Run("complexity_calculator_v1", func(t *testing.T) { diff --git a/pkg/ride/vm_test.go b/pkg/ride/vm_test.go index 8e4b6ddc42..5c787d7d43 100644 --- a/pkg/ride/vm_test.go +++ b/pkg/ride/vm_test.go @@ -7,6 +7,7 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" @@ -16,8 +17,6 @@ import ( "github.com/wavesplatform/gowaves/pkg/types" ) -//go:generate moq -pkg ride -out smart_state_moq_test.go ../types SmartState:MockSmartState - func TestExecution(t *testing.T) { te := newTestEnv(t).withTransaction(testTransferWithProofs(t)) for _, test := range []struct { @@ -126,68 +125,67 @@ func TestFunctions(t *testing.T) { exchange := newExchangeTransaction() // data := newDataTransaction() require.NoError(t, err) - env := &mockRideEnvironment{ - checkMessageLengthFunc: bytesSizeCheckV3V6, - schemeFunc: func() byte { - return 'W' - }, - heightFunc: func() rideInt { - return 5 - }, - transactionFunc: func() rideType { - obj, err := transferWithProofsToObject('W', transfer) - if err != nil { - panic(err) + ss := types.NewMockSmartState(t) + ss.EXPECT().RetrieveNewestIntegerEntry(mock.Anything, mock.Anything).RunAndReturn( + func(_ proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + if key == "integer" { + return &proto.IntegerDataEntry{Key: "integer", Value: 100500}, nil } - return obj - }, - stateFunc: func() types.SmartState { - return &MockSmartState{ - RetrieveNewestIntegerEntryFunc: func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - if key == "integer" { - return &proto.IntegerDataEntry{Key: "integer", Value: 100500}, nil - } - return nil, errors.New("not found") - }, - RetrieveNewestBooleanEntryFunc: func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - if key == "boolean" { - return &proto.BooleanDataEntry{Key: "boolean", Value: true}, nil - } - return nil, errors.New("not found") - }, - RetrieveNewestBinaryEntryFunc: func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - if key == "binary" { - return &proto.BinaryDataEntry{Key: "binary", Value: []byte("hello")}, nil - } - return nil, errors.New("not found") - }, - RetrieveNewestStringEntryFunc: func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - if key == "string" { - return &proto.StringDataEntry{Key: "string", Value: "world"}, nil - } - return nil, errors.New("not found") - }, - NewestWavesBalanceFunc: func(account proto.Recipient) (uint64, error) { - return 5, nil - }, - NewestAssetBalanceFunc: func(account proto.Recipient, assetID crypto.Digest) (uint64, error) { - if assetID == d { - return 5, nil - } - return 0, nil - }, - NewestTransactionByIDFunc: func(id []byte) (proto.Transaction, error) { - return transfer, nil - }, - NewestTransactionHeightByIDFunc: func(_ []byte) (uint64, error) { - return 0, proto.ErrNotFound - }, - IsNotFoundFunc: func(err error) bool { - return true - }, + return nil, errors.New("not found") + }).Maybe() + ss.EXPECT().RetrieveNewestBooleanEntry(mock.Anything, mock.Anything).RunAndReturn( + func(_ proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + if key == "boolean" { + return &proto.BooleanDataEntry{Key: "boolean", Value: true}, nil } - }, - } + return nil, errors.New("not found") + }).Maybe() + ss.EXPECT().RetrieveNewestBinaryEntry(mock.Anything, mock.Anything).RunAndReturn( + func(_ proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + if key == "binary" { + return &proto.BinaryDataEntry{Key: "binary", Value: []byte("hello")}, nil + } + return nil, errors.New("not found") + }).Maybe() + ss.EXPECT().RetrieveNewestStringEntry(mock.Anything, mock.Anything).RunAndReturn( + func(_ proto.Recipient, key string) (*proto.StringDataEntry, error) { + if key == "string" { + return &proto.StringDataEntry{Key: "string", Value: "world"}, nil + } + return nil, errors.New("not found") + }).Maybe() + ss.EXPECT().NewestWavesBalance(mock.Anything).RunAndReturn(func(_ proto.Recipient) (uint64, error) { + return 5, nil + }).Maybe() + ss.EXPECT().NewestAssetBalance(mock.Anything, mock.Anything).RunAndReturn( + func(_ proto.Recipient, assetID crypto.Digest) (uint64, error) { + if assetID == d { + return 5, nil + } + return 0, nil + }).Maybe() + ss.EXPECT().NewestTransactionByID(mock.Anything).RunAndReturn(func(_ []byte) (proto.Transaction, error) { + return transfer, nil + }).Maybe() + ss.EXPECT().NewestTransactionHeightByID(mock.Anything).RunAndReturn(func(_ []byte) (uint64, error) { + return 0, proto.ErrNotFound + }).Maybe() + ss.EXPECT().IsNotFound(mock.Anything).RunAndReturn(func(_ error) bool { + return true + }).Maybe() + + env := NewMockEnvironment(t) + env.EXPECT().checkMessageLength(mock.Anything).RunAndReturn(bytesSizeCheckV3V6).Maybe() + env.EXPECT().scheme().Return(byte('W')).Maybe() + env.EXPECT().height().Return(rideInt(5)).Maybe() + env.EXPECT().transaction().RunAndReturn(func() rideType { + obj, trErr := transferWithProofsToObject('W', transfer) + if trErr != nil { + panic(trErr) + } + return obj + }).Maybe() + env.EXPECT().state().Return(ss).Maybe() // envWithDataTX := &mockRideEnvironment{ // transactionFunc: func() rideType { // obj, err := dataWithProofsToObject('W', data) @@ -197,16 +195,15 @@ func TestFunctions(t *testing.T) { // return obj // }, // } - envWithExchangeTX := &mockRideEnvironment{ - transactionFunc: func() rideType { - var obj rideExchangeTransaction - obj, err = exchangeWithProofsToObject(ast.LibV6, 'W', exchange) - if err != nil { - panic(err) - } - return obj - }, - } + envWithExchangeTX := NewMockEnvironment(t) + envWithExchangeTX.EXPECT().transaction().RunAndReturn(func() rideType { + var obj rideExchangeTransaction + obj, err = exchangeWithProofsToObject(ast.LibV6, 'W', exchange) + if err != nil { + panic(err) + } + return obj + }).Maybe() for _, test := range []struct { name string text string diff --git a/pkg/state/ethereum_tx_test.go b/pkg/state/ethereum_tx_test.go index 69924522f9..24d9dbeae9 100644 --- a/pkg/state/ethereum_tx_test.go +++ b/pkg/state/ethereum_tx_test.go @@ -8,6 +8,7 @@ import ( "github.com/mr-tron/base58" "github.com/pkg/errors" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" @@ -29,12 +30,13 @@ func defaultTxAppender(t *testing.T, storage scriptStorageState, state types.Enr settings.Ride4DApps: {}, settings.RideV6: {}, } - feat := &mockFeaturesState{ - newestIsActivatedFunc: func(featureID int16) (bool, error) { - _, ok := activatedFeatures[settings.Feature(featureID)] - return ok, nil - }, - newestIsActivatedForNBlocksFunc: func(featureID int16, n int) (bool, error) { + feat := NewMockFeaturesState(t) + feat.EXPECT().newestIsActivated(mock.Anything).RunAndReturn(func(featureID int16) (bool, error) { + _, ok := activatedFeatures[settings.Feature(featureID)] + return ok, nil + }).Maybe() + feat.EXPECT().newestIsActivatedForNBlocks(mock.Anything, mock.Anything).RunAndReturn( + func(featureID int16, n int) (bool, error) { const ( expectedFeature = int16(settings.NG) expectedN = 1 @@ -45,8 +47,7 @@ func defaultTxAppender(t *testing.T, storage scriptStorageState, state types.Enr return false, errors.Errorf("unexpected values: got (featureID=%d,n=%d), want (featureID=%d,n=%d)", featureID, n, expectedFeature, expectedN, ) - }, - } + }).Maybe() sett := settings.MustMainNetSettings() sett.AddressSchemeCharacter = scheme sett.SponsorshipSingleActivationPeriod = true @@ -121,11 +122,8 @@ func defaultEthereumLegacyTxData(value int64, to *proto.EthereumAddress, data [] } func TestEthereumTransferWaves(t *testing.T) { appendTxParams := defaultAppendTxParams() - storage := &mockScriptStorageState{ - newestAccountHasVerifierFunc: func(addr proto.WavesAddress) (bool, error) { - return false, nil - }, - } + storage := NewMockScriptStorageState(t) + storage.EXPECT().newestAccountHasVerifier(mock.Anything).Return(false, nil).Maybe() //assetsUncertain := newAssets txAppend := defaultTxAppender(t, storage, nil, nil, appendTxParams) senderPK, err := proto.NewEthereumPublicKeyFromHexString("c4f926702fee2456ac5f3d91c9b7aa578ff191d0792fa80b6e65200f2485d9810a89c1bb5830e6618119fb3f2036db47fac027f7883108cbc7b2953539b9cb53") @@ -159,17 +157,13 @@ func TestEthereumTransferWaves(t *testing.T) { } func TestEthereumTransferAssets(t *testing.T) { - storage := &mockScriptStorageState{ - newestScriptBasicInfoByAddressIDFunc: func(id proto.AddressID) (scriptBasicInfoRecord, error) { - return scriptBasicInfoRecord{PK: crypto.MustPublicKeyFromBase58("pmDSxpnULiroUAerTDFBajffTpqgwVJjtMipQq6DQM5")}, nil - }, - newestIsSmartAssetFunc: func(assetID proto.AssetID) (bool, error) { - return false, nil - }, - newestAccountHasVerifierFunc: func(addr proto.WavesAddress) (bool, error) { - return false, nil - }, - } + storage := NewMockScriptStorageState(t) + storage.EXPECT().newestScriptBasicInfoByAddressID(mock.Anything).Return( + scriptBasicInfoRecord{ + PK: crypto.MustPublicKeyFromBase58("pmDSxpnULiroUAerTDFBajffTpqgwVJjtMipQq6DQM5"), + }, nil).Maybe() + storage.EXPECT().newestIsSmartAsset(mock.Anything).Return(false, nil).Maybe() + storage.EXPECT().newestAccountHasVerifier(mock.Anything).Return(false, nil).Maybe() appendTxParams := defaultAppendTxParams() senderPK, err := proto.NewEthereumPublicKeyFromHexString("c4f926702fee2456ac5f3d91c9b7aa578ff191d0792fa80b6e65200f2485d9810a89c1bb5830e6618119fb3f2036db47fac027f7883108cbc7b2953539b9cb53") @@ -181,7 +175,7 @@ func TestEthereumTransferAssets(t *testing.T) { assetsUncertain := map[proto.AssetID]wrappedUncertainInfo{ proto.AssetID(recipientEth): {}, } - txAppend := defaultTxAppender(t, storage, &AnotherMockSmartState{}, + txAppend := defaultTxAppender(t, storage, types.NewMockEnrichedSmartState(t), assetsUncertain, appendTxParams) /* from https://etherscan.io/tx/0x363f979b58c82614db71229c2a57ed760e7bc454ee29c2f8fd1df99028667ea5 @@ -273,27 +267,22 @@ func TestEthereumInvoke(t *testing.T) { assert.NotNil(t, tree) return tree, nil } - storage := &mockScriptStorageState{ - newestScriptByAddrFunc: newestScriptByAddrFunc, - scriptByAddrFunc: newestScriptByAddrFunc, - newestScriptBasicInfoByAddressIDFunc: func(id proto.AddressID) (scriptBasicInfoRecord, error) { - return scriptBasicInfoRecord{PK: crypto.MustPublicKeyFromBase58("pmDSxpnULiroUAerTDFBajffTpqgwVJjtMipQq6DQM5")}, nil - }, - newestIsSmartAssetFunc: func(assetID proto.AssetID) (bool, error) { - return false, nil - }, - newestAccountHasVerifierFunc: func(addr proto.WavesAddress) (bool, error) { - return false, nil - }, - } - state := &AnotherMockSmartState{ - AddingBlockHeightFunc: func() (uint64, error) { - return 1000, nil - }, - EstimatorVersionFunc: func() (int, error) { - return 3, nil - }, - } + storage := NewMockScriptStorageState(t) + storage.EXPECT().newestScriptByAddr(mock.Anything).RunAndReturn(newestScriptByAddrFunc).Maybe() + storage.EXPECT().scriptByAddr(mock.Anything).RunAndReturn(newestScriptByAddrFunc).Maybe() + storage.EXPECT().newestScriptBasicInfoByAddressID(mock.Anything).Return( + scriptBasicInfoRecord{ + PK: crypto.MustPublicKeyFromBase58("pmDSxpnULiroUAerTDFBajffTpqgwVJjtMipQq6DQM5"), + }, nil).Maybe() + storage.EXPECT().newestIsSmartAsset(mock.Anything).Return(false, nil).Maybe() + storage.EXPECT().newestAccountHasVerifier(mock.Anything).Return(false, nil).Maybe() + state := types.NewMockEnrichedSmartState(t) + state.EXPECT().AddingBlockHeight().RunAndReturn(func() (uint64, error) { + return 1000, nil + }).Maybe() + state.EXPECT().EstimatorVersion().RunAndReturn(func() (int, error) { + return 3, nil + }).Maybe() senderPK, err := proto.NewEthereumPublicKeyFromHexString("c4f926702fee2456ac5f3d91c9b7aa578ff191d0792fa80b6e65200f2485d9810a89c1bb5830e6618119fb3f2036db47fac027f7883108cbc7b2953539b9cb53") assert.NoError(t, err) sender, err := senderPK.EthereumAddress().ToWavesAddress(0) @@ -408,27 +397,22 @@ func TestEthereumInvokeWithoutPaymentsAndArguments(t *testing.T) { assert.NotNil(t, tree) return tree, nil } - storage := &mockScriptStorageState{ - newestScriptByAddrFunc: newestScriptByAddrFunc, - scriptByAddrFunc: newestScriptByAddrFunc, - newestScriptBasicInfoByAddressIDFunc: func(id proto.AddressID) (scriptBasicInfoRecord, error) { - return scriptBasicInfoRecord{PK: crypto.MustPublicKeyFromBase58("pmDSxpnULiroUAerTDFBajffTpqgwVJjtMipQq6DQM5")}, nil - }, - newestIsSmartAssetFunc: func(assetID proto.AssetID) (bool, error) { - return false, nil - }, - newestAccountHasVerifierFunc: func(addr proto.WavesAddress) (bool, error) { - return false, nil - }, - } - state := &AnotherMockSmartState{ - AddingBlockHeightFunc: func() (uint64, error) { - return 1000, nil - }, - EstimatorVersionFunc: func() (int, error) { - return 3, nil - }, - } + storage := NewMockScriptStorageState(t) + storage.EXPECT().newestScriptByAddr(mock.Anything).RunAndReturn(newestScriptByAddrFunc).Maybe() + storage.EXPECT().scriptByAddr(mock.Anything).RunAndReturn(newestScriptByAddrFunc).Maybe() + storage.EXPECT().newestScriptBasicInfoByAddressID(mock.Anything).Return( + scriptBasicInfoRecord{ + PK: crypto.MustPublicKeyFromBase58("pmDSxpnULiroUAerTDFBajffTpqgwVJjtMipQq6DQM5"), + }, nil).Maybe() + storage.EXPECT().newestIsSmartAsset(mock.Anything).Return(false, nil).Maybe() + storage.EXPECT().newestAccountHasVerifier(mock.Anything).Return(false, nil).Maybe() + state := types.NewMockEnrichedSmartState(t) + state.EXPECT().AddingBlockHeight().RunAndReturn(func() (uint64, error) { + return 1000, nil + }).Maybe() + state.EXPECT().EstimatorVersion().RunAndReturn(func() (int, error) { + return 3, nil + }).Maybe() txAppend := defaultTxAppender(t, storage, state, nil, appendTxParams) senderPK, err := proto.NewEthereumPublicKeyFromHexString("c4f926702fee2456ac5f3d91c9b7aa578ff191d0792fa80b6e65200f2485d9810a89c1bb5830e6618119fb3f2036db47fac027f7883108cbc7b2953539b9cb53") assert.NoError(t, err) @@ -479,27 +463,22 @@ func TestEthereumInvokeAllArguments(t *testing.T) { assert.NotNil(t, tree) return tree, nil } - storage := &mockScriptStorageState{ - newestScriptByAddrFunc: newestScriptByAddrFunc, - scriptByAddrFunc: newestScriptByAddrFunc, - newestScriptBasicInfoByAddressIDFunc: func(id proto.AddressID) (scriptBasicInfoRecord, error) { - return scriptBasicInfoRecord{PK: crypto.MustPublicKeyFromBase58("pmDSxpnULiroUAerTDFBajffTpqgwVJjtMipQq6DQM5")}, nil - }, - newestIsSmartAssetFunc: func(assetID proto.AssetID) (bool, error) { - return false, nil - }, - newestAccountHasVerifierFunc: func(addr proto.WavesAddress) (bool, error) { - return false, nil - }, - } - state := &AnotherMockSmartState{ - AddingBlockHeightFunc: func() (uint64, error) { - return 1000, nil - }, - EstimatorVersionFunc: func() (int, error) { - return 3, nil - }, - } + storage := NewMockScriptStorageState(t) + storage.EXPECT().newestScriptByAddr(mock.Anything).RunAndReturn(newestScriptByAddrFunc).Maybe() + storage.EXPECT().scriptByAddr(mock.Anything).RunAndReturn(newestScriptByAddrFunc).Maybe() + storage.EXPECT().newestScriptBasicInfoByAddressID(mock.Anything).Return( + scriptBasicInfoRecord{ + PK: crypto.MustPublicKeyFromBase58("pmDSxpnULiroUAerTDFBajffTpqgwVJjtMipQq6DQM5"), + }, nil).Maybe() + storage.EXPECT().newestIsSmartAsset(mock.Anything).Return(false, nil).Maybe() + storage.EXPECT().newestAccountHasVerifier(mock.Anything).Return(false, nil).Maybe() + state := types.NewMockEnrichedSmartState(t) + state.EXPECT().AddingBlockHeight().RunAndReturn(func() (uint64, error) { + return 1000, nil + }).Maybe() + state.EXPECT().EstimatorVersion().RunAndReturn(func() (int, error) { + return 3, nil + }).Maybe() txAppend := defaultTxAppender(t, storage, state, nil, appendTxParams) senderPK, err := proto.NewEthereumPublicKeyFromHexString("c4f926702fee2456ac5f3d91c9b7aa578ff191d0792fa80b6e65200f2485d9810a89c1bb5830e6618119fb3f2036db47fac027f7883108cbc7b2953539b9cb53") assert.NoError(t, err) diff --git a/pkg/state/feautures_interface.go b/pkg/state/feautures_interface.go index 666f67861d..c9a2012a13 100644 --- a/pkg/state/feautures_interface.go +++ b/pkg/state/feautures_interface.go @@ -2,7 +2,6 @@ package state import "github.com/wavesplatform/gowaves/pkg/proto" -//go:generate moq -out feautures_moq_test.go . featuresState:mockFeaturesState type featuresState interface { isActivated(featureID int16) (bool, error) newestIsActivated(featureID int16) (bool, error) diff --git a/pkg/state/feautures_moq_test.go b/pkg/state/feautures_moq_test.go deleted file mode 100644 index d61eec2d3d..0000000000 --- a/pkg/state/feautures_moq_test.go +++ /dev/null @@ -1,1007 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package state - -import ( - "github.com/wavesplatform/gowaves/pkg/proto" - "sync" -) - -// Ensure, that mockFeaturesState does implement featuresState. -// If this is not the case, regenerate this file with moq. -var _ featuresState = &mockFeaturesState{} - -// mockFeaturesState is a mock implementation of featuresState. -// -// func TestSomethingThatUsesfeaturesState(t *testing.T) { -// -// // make and configure a mocked featuresState -// mockedfeaturesState := &mockFeaturesState{ -// activateFeatureFunc: func(featureID int16, r *activatedFeaturesRecord, blockID proto.BlockID) error { -// panic("mock out the activateFeature method") -// }, -// activationHeightFunc: func(featureID int16) (uint64, error) { -// panic("mock out the activationHeight method") -// }, -// addVoteFunc: func(featureID int16, blockID proto.BlockID) error { -// panic("mock out the addVote method") -// }, -// allFeaturesFunc: func() ([]int16, error) { -// panic("mock out the allFeatures method") -// }, -// approvalHeightFunc: func(featureID int16) (uint64, error) { -// panic("mock out the approvalHeight method") -// }, -// approveFeatureFunc: func(featureID int16, r *approvedFeaturesRecord, blockID proto.BlockID) error { -// panic("mock out the approveFeature method") -// }, -// clearCacheFunc: func() { -// panic("mock out the clearCache method") -// }, -// featureVotesFunc: func(featureID int16) (uint64, error) { -// panic("mock out the featureVotes method") -// }, -// featureVotesAtHeightFunc: func(featureID int16, height uint64) (uint64, error) { -// panic("mock out the featureVotesAtHeight method") -// }, -// finishVotingFunc: func(curHeight uint64, blockID proto.BlockID) error { -// panic("mock out the finishVoting method") -// }, -// isActivatedFunc: func(featureID int16) (bool, error) { -// panic("mock out the isActivated method") -// }, -// isActivatedAtHeightFunc: func(featureID int16, height uint64) bool { -// panic("mock out the isActivatedAtHeight method") -// }, -// isApprovedFunc: func(featureID int16) (bool, error) { -// panic("mock out the isApproved method") -// }, -// isApprovedAtHeightFunc: func(featureID int16, height uint64) bool { -// panic("mock out the isApprovedAtHeight method") -// }, -// newestActivationHeightFunc: func(featureID int16) (uint64, error) { -// panic("mock out the newestActivationHeight method") -// }, -// newestApprovalHeightFunc: func(featureID int16) (uint64, error) { -// panic("mock out the newestApprovalHeight method") -// }, -// newestIsActivatedFunc: func(featureID int16) (bool, error) { -// panic("mock out the newestIsActivated method") -// }, -// newestIsActivatedAtHeightFunc: func(featureID int16, height uint64) bool { -// panic("mock out the newestIsActivatedAtHeight method") -// }, -// newestIsActivatedForNBlocksFunc: func(featureID int16, n int) (bool, error) { -// panic("mock out the newestIsActivatedForNBlocks method") -// }, -// newestIsApprovedFunc: func(featureID int16) (bool, error) { -// panic("mock out the newestIsApproved method") -// }, -// resetVotesFunc: func(blockID proto.BlockID) error { -// panic("mock out the resetVotes method") -// }, -// } -// -// // use mockedfeaturesState in code that requires featuresState -// // and then make assertions. -// -// } -type mockFeaturesState struct { - // activateFeatureFunc mocks the activateFeature method. - activateFeatureFunc func(featureID int16, r *activatedFeaturesRecord, blockID proto.BlockID) error - - // activationHeightFunc mocks the activationHeight method. - activationHeightFunc func(featureID int16) (uint64, error) - - // addVoteFunc mocks the addVote method. - addVoteFunc func(featureID int16, blockID proto.BlockID) error - - // allFeaturesFunc mocks the allFeatures method. - allFeaturesFunc func() ([]int16, error) - - // approvalHeightFunc mocks the approvalHeight method. - approvalHeightFunc func(featureID int16) (uint64, error) - - // approveFeatureFunc mocks the approveFeature method. - approveFeatureFunc func(featureID int16, r *approvedFeaturesRecord, blockID proto.BlockID) error - - // clearCacheFunc mocks the clearCache method. - clearCacheFunc func() - - // featureVotesFunc mocks the featureVotes method. - featureVotesFunc func(featureID int16) (uint64, error) - - // featureVotesAtHeightFunc mocks the featureVotesAtHeight method. - featureVotesAtHeightFunc func(featureID int16, height uint64) (uint64, error) - - // finishVotingFunc mocks the finishVoting method. - finishVotingFunc func(curHeight uint64, blockID proto.BlockID) error - - // isActivatedFunc mocks the isActivated method. - isActivatedFunc func(featureID int16) (bool, error) - - // isActivatedAtHeightFunc mocks the isActivatedAtHeight method. - isActivatedAtHeightFunc func(featureID int16, height uint64) bool - - // isApprovedFunc mocks the isApproved method. - isApprovedFunc func(featureID int16) (bool, error) - - // isApprovedAtHeightFunc mocks the isApprovedAtHeight method. - isApprovedAtHeightFunc func(featureID int16, height uint64) bool - - // newestActivationHeightFunc mocks the newestActivationHeight method. - newestActivationHeightFunc func(featureID int16) (uint64, error) - - // newestApprovalHeightFunc mocks the newestApprovalHeight method. - newestApprovalHeightFunc func(featureID int16) (uint64, error) - - // newestIsActivatedFunc mocks the newestIsActivated method. - newestIsActivatedFunc func(featureID int16) (bool, error) - - // newestIsActivatedAtHeightFunc mocks the newestIsActivatedAtHeight method. - newestIsActivatedAtHeightFunc func(featureID int16, height uint64) bool - - // newestIsActivatedForNBlocksFunc mocks the newestIsActivatedForNBlocks method. - newestIsActivatedForNBlocksFunc func(featureID int16, n int) (bool, error) - - // newestIsApprovedFunc mocks the newestIsApproved method. - newestIsApprovedFunc func(featureID int16) (bool, error) - - // resetVotesFunc mocks the resetVotes method. - resetVotesFunc func(blockID proto.BlockID) error - - // calls tracks calls to the methods. - calls struct { - // activateFeature holds details about calls to the activateFeature method. - activateFeature []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // R is the r argument value. - R *activatedFeaturesRecord - // BlockID is the blockID argument value. - BlockID proto.BlockID - } - // activationHeight holds details about calls to the activationHeight method. - activationHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // addVote holds details about calls to the addVote method. - addVote []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // BlockID is the blockID argument value. - BlockID proto.BlockID - } - // allFeatures holds details about calls to the allFeatures method. - allFeatures []struct { - } - // approvalHeight holds details about calls to the approvalHeight method. - approvalHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // approveFeature holds details about calls to the approveFeature method. - approveFeature []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // R is the r argument value. - R *approvedFeaturesRecord - // BlockID is the blockID argument value. - BlockID proto.BlockID - } - // clearCache holds details about calls to the clearCache method. - clearCache []struct { - } - // featureVotes holds details about calls to the featureVotes method. - featureVotes []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // featureVotesAtHeight holds details about calls to the featureVotesAtHeight method. - featureVotesAtHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // Height is the height argument value. - Height uint64 - } - // finishVoting holds details about calls to the finishVoting method. - finishVoting []struct { - // CurHeight is the curHeight argument value. - CurHeight uint64 - // BlockID is the blockID argument value. - BlockID proto.BlockID - } - // isActivated holds details about calls to the isActivated method. - isActivated []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // isActivatedAtHeight holds details about calls to the isActivatedAtHeight method. - isActivatedAtHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // Height is the height argument value. - Height uint64 - } - // isApproved holds details about calls to the isApproved method. - isApproved []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // isApprovedAtHeight holds details about calls to the isApprovedAtHeight method. - isApprovedAtHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // Height is the height argument value. - Height uint64 - } - // newestActivationHeight holds details about calls to the newestActivationHeight method. - newestActivationHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // newestApprovalHeight holds details about calls to the newestApprovalHeight method. - newestApprovalHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // newestIsActivated holds details about calls to the newestIsActivated method. - newestIsActivated []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // newestIsActivatedAtHeight holds details about calls to the newestIsActivatedAtHeight method. - newestIsActivatedAtHeight []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // Height is the height argument value. - Height uint64 - } - // newestIsActivatedForNBlocks holds details about calls to the newestIsActivatedForNBlocks method. - newestIsActivatedForNBlocks []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - // N is the n argument value. - N int - } - // newestIsApproved holds details about calls to the newestIsApproved method. - newestIsApproved []struct { - // FeatureID is the featureID argument value. - FeatureID int16 - } - // resetVotes holds details about calls to the resetVotes method. - resetVotes []struct { - // BlockID is the blockID argument value. - BlockID proto.BlockID - } - } - lockactivateFeature sync.RWMutex - lockactivationHeight sync.RWMutex - lockaddVote sync.RWMutex - lockallFeatures sync.RWMutex - lockapprovalHeight sync.RWMutex - lockapproveFeature sync.RWMutex - lockclearCache sync.RWMutex - lockfeatureVotes sync.RWMutex - lockfeatureVotesAtHeight sync.RWMutex - lockfinishVoting sync.RWMutex - lockisActivated sync.RWMutex - lockisActivatedAtHeight sync.RWMutex - lockisApproved sync.RWMutex - lockisApprovedAtHeight sync.RWMutex - locknewestActivationHeight sync.RWMutex - locknewestApprovalHeight sync.RWMutex - locknewestIsActivated sync.RWMutex - locknewestIsActivatedAtHeight sync.RWMutex - locknewestIsActivatedForNBlocks sync.RWMutex - locknewestIsApproved sync.RWMutex - lockresetVotes sync.RWMutex -} - -// activateFeature calls activateFeatureFunc. -func (mock *mockFeaturesState) activateFeature(featureID int16, r *activatedFeaturesRecord, blockID proto.BlockID) error { - if mock.activateFeatureFunc == nil { - panic("mockFeaturesState.activateFeatureFunc: method is nil but featuresState.activateFeature was just called") - } - callInfo := struct { - FeatureID int16 - R *activatedFeaturesRecord - BlockID proto.BlockID - }{ - FeatureID: featureID, - R: r, - BlockID: blockID, - } - mock.lockactivateFeature.Lock() - mock.calls.activateFeature = append(mock.calls.activateFeature, callInfo) - mock.lockactivateFeature.Unlock() - return mock.activateFeatureFunc(featureID, r, blockID) -} - -// activateFeatureCalls gets all the calls that were made to activateFeature. -// Check the length with: -// -// len(mockedfeaturesState.activateFeatureCalls()) -func (mock *mockFeaturesState) activateFeatureCalls() []struct { - FeatureID int16 - R *activatedFeaturesRecord - BlockID proto.BlockID -} { - var calls []struct { - FeatureID int16 - R *activatedFeaturesRecord - BlockID proto.BlockID - } - mock.lockactivateFeature.RLock() - calls = mock.calls.activateFeature - mock.lockactivateFeature.RUnlock() - return calls -} - -// activationHeight calls activationHeightFunc. -func (mock *mockFeaturesState) activationHeight(featureID int16) (uint64, error) { - if mock.activationHeightFunc == nil { - panic("mockFeaturesState.activationHeightFunc: method is nil but featuresState.activationHeight was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.lockactivationHeight.Lock() - mock.calls.activationHeight = append(mock.calls.activationHeight, callInfo) - mock.lockactivationHeight.Unlock() - return mock.activationHeightFunc(featureID) -} - -// activationHeightCalls gets all the calls that were made to activationHeight. -// Check the length with: -// -// len(mockedfeaturesState.activationHeightCalls()) -func (mock *mockFeaturesState) activationHeightCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.lockactivationHeight.RLock() - calls = mock.calls.activationHeight - mock.lockactivationHeight.RUnlock() - return calls -} - -// addVote calls addVoteFunc. -func (mock *mockFeaturesState) addVote(featureID int16, blockID proto.BlockID) error { - if mock.addVoteFunc == nil { - panic("mockFeaturesState.addVoteFunc: method is nil but featuresState.addVote was just called") - } - callInfo := struct { - FeatureID int16 - BlockID proto.BlockID - }{ - FeatureID: featureID, - BlockID: blockID, - } - mock.lockaddVote.Lock() - mock.calls.addVote = append(mock.calls.addVote, callInfo) - mock.lockaddVote.Unlock() - return mock.addVoteFunc(featureID, blockID) -} - -// addVoteCalls gets all the calls that were made to addVote. -// Check the length with: -// -// len(mockedfeaturesState.addVoteCalls()) -func (mock *mockFeaturesState) addVoteCalls() []struct { - FeatureID int16 - BlockID proto.BlockID -} { - var calls []struct { - FeatureID int16 - BlockID proto.BlockID - } - mock.lockaddVote.RLock() - calls = mock.calls.addVote - mock.lockaddVote.RUnlock() - return calls -} - -// allFeatures calls allFeaturesFunc. -func (mock *mockFeaturesState) allFeatures() ([]int16, error) { - if mock.allFeaturesFunc == nil { - panic("mockFeaturesState.allFeaturesFunc: method is nil but featuresState.allFeatures was just called") - } - callInfo := struct { - }{} - mock.lockallFeatures.Lock() - mock.calls.allFeatures = append(mock.calls.allFeatures, callInfo) - mock.lockallFeatures.Unlock() - return mock.allFeaturesFunc() -} - -// allFeaturesCalls gets all the calls that were made to allFeatures. -// Check the length with: -// -// len(mockedfeaturesState.allFeaturesCalls()) -func (mock *mockFeaturesState) allFeaturesCalls() []struct { -} { - var calls []struct { - } - mock.lockallFeatures.RLock() - calls = mock.calls.allFeatures - mock.lockallFeatures.RUnlock() - return calls -} - -// approvalHeight calls approvalHeightFunc. -func (mock *mockFeaturesState) approvalHeight(featureID int16) (uint64, error) { - if mock.approvalHeightFunc == nil { - panic("mockFeaturesState.approvalHeightFunc: method is nil but featuresState.approvalHeight was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.lockapprovalHeight.Lock() - mock.calls.approvalHeight = append(mock.calls.approvalHeight, callInfo) - mock.lockapprovalHeight.Unlock() - return mock.approvalHeightFunc(featureID) -} - -// approvalHeightCalls gets all the calls that were made to approvalHeight. -// Check the length with: -// -// len(mockedfeaturesState.approvalHeightCalls()) -func (mock *mockFeaturesState) approvalHeightCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.lockapprovalHeight.RLock() - calls = mock.calls.approvalHeight - mock.lockapprovalHeight.RUnlock() - return calls -} - -// approveFeature calls approveFeatureFunc. -func (mock *mockFeaturesState) approveFeature(featureID int16, r *approvedFeaturesRecord, blockID proto.BlockID) error { - if mock.approveFeatureFunc == nil { - panic("mockFeaturesState.approveFeatureFunc: method is nil but featuresState.approveFeature was just called") - } - callInfo := struct { - FeatureID int16 - R *approvedFeaturesRecord - BlockID proto.BlockID - }{ - FeatureID: featureID, - R: r, - BlockID: blockID, - } - mock.lockapproveFeature.Lock() - mock.calls.approveFeature = append(mock.calls.approveFeature, callInfo) - mock.lockapproveFeature.Unlock() - return mock.approveFeatureFunc(featureID, r, blockID) -} - -// approveFeatureCalls gets all the calls that were made to approveFeature. -// Check the length with: -// -// len(mockedfeaturesState.approveFeatureCalls()) -func (mock *mockFeaturesState) approveFeatureCalls() []struct { - FeatureID int16 - R *approvedFeaturesRecord - BlockID proto.BlockID -} { - var calls []struct { - FeatureID int16 - R *approvedFeaturesRecord - BlockID proto.BlockID - } - mock.lockapproveFeature.RLock() - calls = mock.calls.approveFeature - mock.lockapproveFeature.RUnlock() - return calls -} - -// clearCache calls clearCacheFunc. -func (mock *mockFeaturesState) clearCache() { - if mock.clearCacheFunc == nil { - panic("mockFeaturesState.clearCacheFunc: method is nil but featuresState.clearCache was just called") - } - callInfo := struct { - }{} - mock.lockclearCache.Lock() - mock.calls.clearCache = append(mock.calls.clearCache, callInfo) - mock.lockclearCache.Unlock() - mock.clearCacheFunc() -} - -// clearCacheCalls gets all the calls that were made to clearCache. -// Check the length with: -// -// len(mockedfeaturesState.clearCacheCalls()) -func (mock *mockFeaturesState) clearCacheCalls() []struct { -} { - var calls []struct { - } - mock.lockclearCache.RLock() - calls = mock.calls.clearCache - mock.lockclearCache.RUnlock() - return calls -} - -// featureVotes calls featureVotesFunc. -func (mock *mockFeaturesState) featureVotes(featureID int16) (uint64, error) { - if mock.featureVotesFunc == nil { - panic("mockFeaturesState.featureVotesFunc: method is nil but featuresState.featureVotes was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.lockfeatureVotes.Lock() - mock.calls.featureVotes = append(mock.calls.featureVotes, callInfo) - mock.lockfeatureVotes.Unlock() - return mock.featureVotesFunc(featureID) -} - -// featureVotesCalls gets all the calls that were made to featureVotes. -// Check the length with: -// -// len(mockedfeaturesState.featureVotesCalls()) -func (mock *mockFeaturesState) featureVotesCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.lockfeatureVotes.RLock() - calls = mock.calls.featureVotes - mock.lockfeatureVotes.RUnlock() - return calls -} - -// featureVotesAtHeight calls featureVotesAtHeightFunc. -func (mock *mockFeaturesState) featureVotesAtHeight(featureID int16, height uint64) (uint64, error) { - if mock.featureVotesAtHeightFunc == nil { - panic("mockFeaturesState.featureVotesAtHeightFunc: method is nil but featuresState.featureVotesAtHeight was just called") - } - callInfo := struct { - FeatureID int16 - Height uint64 - }{ - FeatureID: featureID, - Height: height, - } - mock.lockfeatureVotesAtHeight.Lock() - mock.calls.featureVotesAtHeight = append(mock.calls.featureVotesAtHeight, callInfo) - mock.lockfeatureVotesAtHeight.Unlock() - return mock.featureVotesAtHeightFunc(featureID, height) -} - -// featureVotesAtHeightCalls gets all the calls that were made to featureVotesAtHeight. -// Check the length with: -// -// len(mockedfeaturesState.featureVotesAtHeightCalls()) -func (mock *mockFeaturesState) featureVotesAtHeightCalls() []struct { - FeatureID int16 - Height uint64 -} { - var calls []struct { - FeatureID int16 - Height uint64 - } - mock.lockfeatureVotesAtHeight.RLock() - calls = mock.calls.featureVotesAtHeight - mock.lockfeatureVotesAtHeight.RUnlock() - return calls -} - -// finishVoting calls finishVotingFunc. -func (mock *mockFeaturesState) finishVoting(curHeight uint64, blockID proto.BlockID) error { - if mock.finishVotingFunc == nil { - panic("mockFeaturesState.finishVotingFunc: method is nil but featuresState.finishVoting was just called") - } - callInfo := struct { - CurHeight uint64 - BlockID proto.BlockID - }{ - CurHeight: curHeight, - BlockID: blockID, - } - mock.lockfinishVoting.Lock() - mock.calls.finishVoting = append(mock.calls.finishVoting, callInfo) - mock.lockfinishVoting.Unlock() - return mock.finishVotingFunc(curHeight, blockID) -} - -// finishVotingCalls gets all the calls that were made to finishVoting. -// Check the length with: -// -// len(mockedfeaturesState.finishVotingCalls()) -func (mock *mockFeaturesState) finishVotingCalls() []struct { - CurHeight uint64 - BlockID proto.BlockID -} { - var calls []struct { - CurHeight uint64 - BlockID proto.BlockID - } - mock.lockfinishVoting.RLock() - calls = mock.calls.finishVoting - mock.lockfinishVoting.RUnlock() - return calls -} - -// isActivated calls isActivatedFunc. -func (mock *mockFeaturesState) isActivated(featureID int16) (bool, error) { - if mock.isActivatedFunc == nil { - panic("mockFeaturesState.isActivatedFunc: method is nil but featuresState.isActivated was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.lockisActivated.Lock() - mock.calls.isActivated = append(mock.calls.isActivated, callInfo) - mock.lockisActivated.Unlock() - return mock.isActivatedFunc(featureID) -} - -// isActivatedCalls gets all the calls that were made to isActivated. -// Check the length with: -// -// len(mockedfeaturesState.isActivatedCalls()) -func (mock *mockFeaturesState) isActivatedCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.lockisActivated.RLock() - calls = mock.calls.isActivated - mock.lockisActivated.RUnlock() - return calls -} - -// isActivatedAtHeight calls isActivatedAtHeightFunc. -func (mock *mockFeaturesState) isActivatedAtHeight(featureID int16, height uint64) bool { - if mock.isActivatedAtHeightFunc == nil { - panic("mockFeaturesState.isActivatedAtHeightFunc: method is nil but featuresState.isActivatedAtHeight was just called") - } - callInfo := struct { - FeatureID int16 - Height uint64 - }{ - FeatureID: featureID, - Height: height, - } - mock.lockisActivatedAtHeight.Lock() - mock.calls.isActivatedAtHeight = append(mock.calls.isActivatedAtHeight, callInfo) - mock.lockisActivatedAtHeight.Unlock() - return mock.isActivatedAtHeightFunc(featureID, height) -} - -// isActivatedAtHeightCalls gets all the calls that were made to isActivatedAtHeight. -// Check the length with: -// -// len(mockedfeaturesState.isActivatedAtHeightCalls()) -func (mock *mockFeaturesState) isActivatedAtHeightCalls() []struct { - FeatureID int16 - Height uint64 -} { - var calls []struct { - FeatureID int16 - Height uint64 - } - mock.lockisActivatedAtHeight.RLock() - calls = mock.calls.isActivatedAtHeight - mock.lockisActivatedAtHeight.RUnlock() - return calls -} - -// isApproved calls isApprovedFunc. -func (mock *mockFeaturesState) isApproved(featureID int16) (bool, error) { - if mock.isApprovedFunc == nil { - panic("mockFeaturesState.isApprovedFunc: method is nil but featuresState.isApproved was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.lockisApproved.Lock() - mock.calls.isApproved = append(mock.calls.isApproved, callInfo) - mock.lockisApproved.Unlock() - return mock.isApprovedFunc(featureID) -} - -// isApprovedCalls gets all the calls that were made to isApproved. -// Check the length with: -// -// len(mockedfeaturesState.isApprovedCalls()) -func (mock *mockFeaturesState) isApprovedCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.lockisApproved.RLock() - calls = mock.calls.isApproved - mock.lockisApproved.RUnlock() - return calls -} - -// isApprovedAtHeight calls isApprovedAtHeightFunc. -func (mock *mockFeaturesState) isApprovedAtHeight(featureID int16, height uint64) bool { - if mock.isApprovedAtHeightFunc == nil { - panic("mockFeaturesState.isApprovedAtHeightFunc: method is nil but featuresState.isApprovedAtHeight was just called") - } - callInfo := struct { - FeatureID int16 - Height uint64 - }{ - FeatureID: featureID, - Height: height, - } - mock.lockisApprovedAtHeight.Lock() - mock.calls.isApprovedAtHeight = append(mock.calls.isApprovedAtHeight, callInfo) - mock.lockisApprovedAtHeight.Unlock() - return mock.isApprovedAtHeightFunc(featureID, height) -} - -// isApprovedAtHeightCalls gets all the calls that were made to isApprovedAtHeight. -// Check the length with: -// -// len(mockedfeaturesState.isApprovedAtHeightCalls()) -func (mock *mockFeaturesState) isApprovedAtHeightCalls() []struct { - FeatureID int16 - Height uint64 -} { - var calls []struct { - FeatureID int16 - Height uint64 - } - mock.lockisApprovedAtHeight.RLock() - calls = mock.calls.isApprovedAtHeight - mock.lockisApprovedAtHeight.RUnlock() - return calls -} - -// newestActivationHeight calls newestActivationHeightFunc. -func (mock *mockFeaturesState) newestActivationHeight(featureID int16) (uint64, error) { - if mock.newestActivationHeightFunc == nil { - panic("mockFeaturesState.newestActivationHeightFunc: method is nil but featuresState.newestActivationHeight was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.locknewestActivationHeight.Lock() - mock.calls.newestActivationHeight = append(mock.calls.newestActivationHeight, callInfo) - mock.locknewestActivationHeight.Unlock() - return mock.newestActivationHeightFunc(featureID) -} - -// newestActivationHeightCalls gets all the calls that were made to newestActivationHeight. -// Check the length with: -// -// len(mockedfeaturesState.newestActivationHeightCalls()) -func (mock *mockFeaturesState) newestActivationHeightCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.locknewestActivationHeight.RLock() - calls = mock.calls.newestActivationHeight - mock.locknewestActivationHeight.RUnlock() - return calls -} - -// newestApprovalHeight calls newestApprovalHeightFunc. -func (mock *mockFeaturesState) newestApprovalHeight(featureID int16) (uint64, error) { - if mock.newestApprovalHeightFunc == nil { - panic("mockFeaturesState.newestApprovalHeightFunc: method is nil but featuresState.newestApprovalHeight was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.locknewestApprovalHeight.Lock() - mock.calls.newestApprovalHeight = append(mock.calls.newestApprovalHeight, callInfo) - mock.locknewestApprovalHeight.Unlock() - return mock.newestApprovalHeightFunc(featureID) -} - -// newestApprovalHeightCalls gets all the calls that were made to newestApprovalHeight. -// Check the length with: -// -// len(mockedfeaturesState.newestApprovalHeightCalls()) -func (mock *mockFeaturesState) newestApprovalHeightCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.locknewestApprovalHeight.RLock() - calls = mock.calls.newestApprovalHeight - mock.locknewestApprovalHeight.RUnlock() - return calls -} - -// newestIsActivated calls newestIsActivatedFunc. -func (mock *mockFeaturesState) newestIsActivated(featureID int16) (bool, error) { - if mock.newestIsActivatedFunc == nil { - panic("mockFeaturesState.newestIsActivatedFunc: method is nil but featuresState.newestIsActivated was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.locknewestIsActivated.Lock() - mock.calls.newestIsActivated = append(mock.calls.newestIsActivated, callInfo) - mock.locknewestIsActivated.Unlock() - return mock.newestIsActivatedFunc(featureID) -} - -// newestIsActivatedCalls gets all the calls that were made to newestIsActivated. -// Check the length with: -// -// len(mockedfeaturesState.newestIsActivatedCalls()) -func (mock *mockFeaturesState) newestIsActivatedCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.locknewestIsActivated.RLock() - calls = mock.calls.newestIsActivated - mock.locknewestIsActivated.RUnlock() - return calls -} - -// newestIsActivatedAtHeight calls newestIsActivatedAtHeightFunc. -func (mock *mockFeaturesState) newestIsActivatedAtHeight(featureID int16, height uint64) bool { - if mock.newestIsActivatedAtHeightFunc == nil { - panic("mockFeaturesState.newestIsActivatedAtHeightFunc: method is nil but featuresState.newestIsActivatedAtHeight was just called") - } - callInfo := struct { - FeatureID int16 - Height uint64 - }{ - FeatureID: featureID, - Height: height, - } - mock.locknewestIsActivatedAtHeight.Lock() - mock.calls.newestIsActivatedAtHeight = append(mock.calls.newestIsActivatedAtHeight, callInfo) - mock.locknewestIsActivatedAtHeight.Unlock() - return mock.newestIsActivatedAtHeightFunc(featureID, height) -} - -// newestIsActivatedAtHeightCalls gets all the calls that were made to newestIsActivatedAtHeight. -// Check the length with: -// -// len(mockedfeaturesState.newestIsActivatedAtHeightCalls()) -func (mock *mockFeaturesState) newestIsActivatedAtHeightCalls() []struct { - FeatureID int16 - Height uint64 -} { - var calls []struct { - FeatureID int16 - Height uint64 - } - mock.locknewestIsActivatedAtHeight.RLock() - calls = mock.calls.newestIsActivatedAtHeight - mock.locknewestIsActivatedAtHeight.RUnlock() - return calls -} - -// newestIsActivatedForNBlocks calls newestIsActivatedForNBlocksFunc. -func (mock *mockFeaturesState) newestIsActivatedForNBlocks(featureID int16, n int) (bool, error) { - if mock.newestIsActivatedForNBlocksFunc == nil { - panic("mockFeaturesState.newestIsActivatedForNBlocksFunc: method is nil but featuresState.newestIsActivatedForNBlocks was just called") - } - callInfo := struct { - FeatureID int16 - N int - }{ - FeatureID: featureID, - N: n, - } - mock.locknewestIsActivatedForNBlocks.Lock() - mock.calls.newestIsActivatedForNBlocks = append(mock.calls.newestIsActivatedForNBlocks, callInfo) - mock.locknewestIsActivatedForNBlocks.Unlock() - return mock.newestIsActivatedForNBlocksFunc(featureID, n) -} - -// newestIsActivatedForNBlocksCalls gets all the calls that were made to newestIsActivatedForNBlocks. -// Check the length with: -// -// len(mockedfeaturesState.newestIsActivatedForNBlocksCalls()) -func (mock *mockFeaturesState) newestIsActivatedForNBlocksCalls() []struct { - FeatureID int16 - N int -} { - var calls []struct { - FeatureID int16 - N int - } - mock.locknewestIsActivatedForNBlocks.RLock() - calls = mock.calls.newestIsActivatedForNBlocks - mock.locknewestIsActivatedForNBlocks.RUnlock() - return calls -} - -// newestIsApproved calls newestIsApprovedFunc. -func (mock *mockFeaturesState) newestIsApproved(featureID int16) (bool, error) { - if mock.newestIsApprovedFunc == nil { - panic("mockFeaturesState.newestIsApprovedFunc: method is nil but featuresState.newestIsApproved was just called") - } - callInfo := struct { - FeatureID int16 - }{ - FeatureID: featureID, - } - mock.locknewestIsApproved.Lock() - mock.calls.newestIsApproved = append(mock.calls.newestIsApproved, callInfo) - mock.locknewestIsApproved.Unlock() - return mock.newestIsApprovedFunc(featureID) -} - -// newestIsApprovedCalls gets all the calls that were made to newestIsApproved. -// Check the length with: -// -// len(mockedfeaturesState.newestIsApprovedCalls()) -func (mock *mockFeaturesState) newestIsApprovedCalls() []struct { - FeatureID int16 -} { - var calls []struct { - FeatureID int16 - } - mock.locknewestIsApproved.RLock() - calls = mock.calls.newestIsApproved - mock.locknewestIsApproved.RUnlock() - return calls -} - -// resetVotes calls resetVotesFunc. -func (mock *mockFeaturesState) resetVotes(blockID proto.BlockID) error { - if mock.resetVotesFunc == nil { - panic("mockFeaturesState.resetVotesFunc: method is nil but featuresState.resetVotes was just called") - } - callInfo := struct { - BlockID proto.BlockID - }{ - BlockID: blockID, - } - mock.lockresetVotes.Lock() - mock.calls.resetVotes = append(mock.calls.resetVotes, callInfo) - mock.lockresetVotes.Unlock() - return mock.resetVotesFunc(blockID) -} - -// resetVotesCalls gets all the calls that were made to resetVotes. -// Check the length with: -// -// len(mockedfeaturesState.resetVotesCalls()) -func (mock *mockFeaturesState) resetVotesCalls() []struct { - BlockID proto.BlockID -} { - var calls []struct { - BlockID proto.BlockID - } - mock.lockresetVotes.RLock() - calls = mock.calls.resetVotes - mock.lockresetVotes.RUnlock() - return calls -} diff --git a/pkg/state/mock_features_state_test.go b/pkg/state/mock_features_state_test.go new file mode 100644 index 0000000000..399cb58287 --- /dev/null +++ b/pkg/state/mock_features_state_test.go @@ -0,0 +1,1259 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package state + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/proto" +) + +// NewMockFeaturesState creates a new instance of MockFeaturesState. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockFeaturesState(t interface { + mock.TestingT + Cleanup(func()) +}) *MockFeaturesState { + mock := &MockFeaturesState{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockFeaturesState is an autogenerated mock type for the featuresState type +type MockFeaturesState struct { + mock.Mock +} + +type MockFeaturesState_Expecter struct { + mock *mock.Mock +} + +func (_m *MockFeaturesState) EXPECT() *MockFeaturesState_Expecter { + return &MockFeaturesState_Expecter{mock: &_m.Mock} +} + +// activateFeature provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) activateFeature(featureID int16, r *activatedFeaturesRecord, blockID proto.BlockID) error { + ret := _mock.Called(featureID, r, blockID) + + if len(ret) == 0 { + panic("no return value specified for activateFeature") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(int16, *activatedFeaturesRecord, proto.BlockID) error); ok { + r0 = returnFunc(featureID, r, blockID) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockFeaturesState_activateFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'activateFeature' +type MockFeaturesState_activateFeature_Call struct { + *mock.Call +} + +// activateFeature is a helper method to define mock.On call +// - featureID int16 +// - r *activatedFeaturesRecord +// - blockID proto.BlockID +func (_e *MockFeaturesState_Expecter) activateFeature(featureID interface{}, r interface{}, blockID interface{}) *MockFeaturesState_activateFeature_Call { + return &MockFeaturesState_activateFeature_Call{Call: _e.mock.On("activateFeature", featureID, r, blockID)} +} + +func (_c *MockFeaturesState_activateFeature_Call) Run(run func(featureID int16, r *activatedFeaturesRecord, blockID proto.BlockID)) *MockFeaturesState_activateFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 *activatedFeaturesRecord + if args[1] != nil { + arg1 = args[1].(*activatedFeaturesRecord) + } + var arg2 proto.BlockID + if args[2] != nil { + arg2 = args[2].(proto.BlockID) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockFeaturesState_activateFeature_Call) Return(err error) *MockFeaturesState_activateFeature_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockFeaturesState_activateFeature_Call) RunAndReturn(run func(featureID int16, r *activatedFeaturesRecord, blockID proto.BlockID) error) *MockFeaturesState_activateFeature_Call { + _c.Call.Return(run) + return _c +} + +// activationHeight provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) activationHeight(featureID int16) (uint64, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for activationHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (uint64, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) uint64); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_activationHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'activationHeight' +type MockFeaturesState_activationHeight_Call struct { + *mock.Call +} + +// activationHeight is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) activationHeight(featureID interface{}) *MockFeaturesState_activationHeight_Call { + return &MockFeaturesState_activationHeight_Call{Call: _e.mock.On("activationHeight", featureID)} +} + +func (_c *MockFeaturesState_activationHeight_Call) Run(run func(featureID int16)) *MockFeaturesState_activationHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_activationHeight_Call) Return(v uint64, err error) *MockFeaturesState_activationHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockFeaturesState_activationHeight_Call) RunAndReturn(run func(featureID int16) (uint64, error)) *MockFeaturesState_activationHeight_Call { + _c.Call.Return(run) + return _c +} + +// addVote provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) addVote(featureID int16, blockID proto.BlockID) error { + ret := _mock.Called(featureID, blockID) + + if len(ret) == 0 { + panic("no return value specified for addVote") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(int16, proto.BlockID) error); ok { + r0 = returnFunc(featureID, blockID) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockFeaturesState_addVote_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'addVote' +type MockFeaturesState_addVote_Call struct { + *mock.Call +} + +// addVote is a helper method to define mock.On call +// - featureID int16 +// - blockID proto.BlockID +func (_e *MockFeaturesState_Expecter) addVote(featureID interface{}, blockID interface{}) *MockFeaturesState_addVote_Call { + return &MockFeaturesState_addVote_Call{Call: _e.mock.On("addVote", featureID, blockID)} +} + +func (_c *MockFeaturesState_addVote_Call) Run(run func(featureID int16, blockID proto.BlockID)) *MockFeaturesState_addVote_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 proto.BlockID + if args[1] != nil { + arg1 = args[1].(proto.BlockID) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockFeaturesState_addVote_Call) Return(err error) *MockFeaturesState_addVote_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockFeaturesState_addVote_Call) RunAndReturn(run func(featureID int16, blockID proto.BlockID) error) *MockFeaturesState_addVote_Call { + _c.Call.Return(run) + return _c +} + +// allFeatures provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) allFeatures() ([]int16, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for allFeatures") + } + + var r0 []int16 + var r1 error + if returnFunc, ok := ret.Get(0).(func() ([]int16, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() []int16); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]int16) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_allFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'allFeatures' +type MockFeaturesState_allFeatures_Call struct { + *mock.Call +} + +// allFeatures is a helper method to define mock.On call +func (_e *MockFeaturesState_Expecter) allFeatures() *MockFeaturesState_allFeatures_Call { + return &MockFeaturesState_allFeatures_Call{Call: _e.mock.On("allFeatures")} +} + +func (_c *MockFeaturesState_allFeatures_Call) Run(run func()) *MockFeaturesState_allFeatures_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockFeaturesState_allFeatures_Call) Return(int16s []int16, err error) *MockFeaturesState_allFeatures_Call { + _c.Call.Return(int16s, err) + return _c +} + +func (_c *MockFeaturesState_allFeatures_Call) RunAndReturn(run func() ([]int16, error)) *MockFeaturesState_allFeatures_Call { + _c.Call.Return(run) + return _c +} + +// approvalHeight provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) approvalHeight(featureID int16) (uint64, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for approvalHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (uint64, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) uint64); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_approvalHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'approvalHeight' +type MockFeaturesState_approvalHeight_Call struct { + *mock.Call +} + +// approvalHeight is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) approvalHeight(featureID interface{}) *MockFeaturesState_approvalHeight_Call { + return &MockFeaturesState_approvalHeight_Call{Call: _e.mock.On("approvalHeight", featureID)} +} + +func (_c *MockFeaturesState_approvalHeight_Call) Run(run func(featureID int16)) *MockFeaturesState_approvalHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_approvalHeight_Call) Return(v uint64, err error) *MockFeaturesState_approvalHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockFeaturesState_approvalHeight_Call) RunAndReturn(run func(featureID int16) (uint64, error)) *MockFeaturesState_approvalHeight_Call { + _c.Call.Return(run) + return _c +} + +// approveFeature provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) approveFeature(featureID int16, r *approvedFeaturesRecord, blockID proto.BlockID) error { + ret := _mock.Called(featureID, r, blockID) + + if len(ret) == 0 { + panic("no return value specified for approveFeature") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(int16, *approvedFeaturesRecord, proto.BlockID) error); ok { + r0 = returnFunc(featureID, r, blockID) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockFeaturesState_approveFeature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'approveFeature' +type MockFeaturesState_approveFeature_Call struct { + *mock.Call +} + +// approveFeature is a helper method to define mock.On call +// - featureID int16 +// - r *approvedFeaturesRecord +// - blockID proto.BlockID +func (_e *MockFeaturesState_Expecter) approveFeature(featureID interface{}, r interface{}, blockID interface{}) *MockFeaturesState_approveFeature_Call { + return &MockFeaturesState_approveFeature_Call{Call: _e.mock.On("approveFeature", featureID, r, blockID)} +} + +func (_c *MockFeaturesState_approveFeature_Call) Run(run func(featureID int16, r *approvedFeaturesRecord, blockID proto.BlockID)) *MockFeaturesState_approveFeature_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 *approvedFeaturesRecord + if args[1] != nil { + arg1 = args[1].(*approvedFeaturesRecord) + } + var arg2 proto.BlockID + if args[2] != nil { + arg2 = args[2].(proto.BlockID) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockFeaturesState_approveFeature_Call) Return(err error) *MockFeaturesState_approveFeature_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockFeaturesState_approveFeature_Call) RunAndReturn(run func(featureID int16, r *approvedFeaturesRecord, blockID proto.BlockID) error) *MockFeaturesState_approveFeature_Call { + _c.Call.Return(run) + return _c +} + +// clearCache provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) clearCache() { + _mock.Called() + return +} + +// MockFeaturesState_clearCache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'clearCache' +type MockFeaturesState_clearCache_Call struct { + *mock.Call +} + +// clearCache is a helper method to define mock.On call +func (_e *MockFeaturesState_Expecter) clearCache() *MockFeaturesState_clearCache_Call { + return &MockFeaturesState_clearCache_Call{Call: _e.mock.On("clearCache")} +} + +func (_c *MockFeaturesState_clearCache_Call) Run(run func()) *MockFeaturesState_clearCache_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockFeaturesState_clearCache_Call) Return() *MockFeaturesState_clearCache_Call { + _c.Call.Return() + return _c +} + +func (_c *MockFeaturesState_clearCache_Call) RunAndReturn(run func()) *MockFeaturesState_clearCache_Call { + _c.Run(run) + return _c +} + +// featureVotes provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) featureVotes(featureID int16) (uint64, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for featureVotes") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (uint64, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) uint64); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_featureVotes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'featureVotes' +type MockFeaturesState_featureVotes_Call struct { + *mock.Call +} + +// featureVotes is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) featureVotes(featureID interface{}) *MockFeaturesState_featureVotes_Call { + return &MockFeaturesState_featureVotes_Call{Call: _e.mock.On("featureVotes", featureID)} +} + +func (_c *MockFeaturesState_featureVotes_Call) Run(run func(featureID int16)) *MockFeaturesState_featureVotes_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_featureVotes_Call) Return(v uint64, err error) *MockFeaturesState_featureVotes_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockFeaturesState_featureVotes_Call) RunAndReturn(run func(featureID int16) (uint64, error)) *MockFeaturesState_featureVotes_Call { + _c.Call.Return(run) + return _c +} + +// featureVotesAtHeight provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) featureVotesAtHeight(featureID int16, height uint64) (uint64, error) { + ret := _mock.Called(featureID, height) + + if len(ret) == 0 { + panic("no return value specified for featureVotesAtHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16, uint64) (uint64, error)); ok { + return returnFunc(featureID, height) + } + if returnFunc, ok := ret.Get(0).(func(int16, uint64) uint64); ok { + r0 = returnFunc(featureID, height) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16, uint64) error); ok { + r1 = returnFunc(featureID, height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_featureVotesAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'featureVotesAtHeight' +type MockFeaturesState_featureVotesAtHeight_Call struct { + *mock.Call +} + +// featureVotesAtHeight is a helper method to define mock.On call +// - featureID int16 +// - height uint64 +func (_e *MockFeaturesState_Expecter) featureVotesAtHeight(featureID interface{}, height interface{}) *MockFeaturesState_featureVotesAtHeight_Call { + return &MockFeaturesState_featureVotesAtHeight_Call{Call: _e.mock.On("featureVotesAtHeight", featureID, height)} +} + +func (_c *MockFeaturesState_featureVotesAtHeight_Call) Run(run func(featureID int16, height uint64)) *MockFeaturesState_featureVotesAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 uint64 + if args[1] != nil { + arg1 = args[1].(uint64) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockFeaturesState_featureVotesAtHeight_Call) Return(v uint64, err error) *MockFeaturesState_featureVotesAtHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockFeaturesState_featureVotesAtHeight_Call) RunAndReturn(run func(featureID int16, height uint64) (uint64, error)) *MockFeaturesState_featureVotesAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// finishVoting provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) finishVoting(curHeight uint64, blockID proto.BlockID) error { + ret := _mock.Called(curHeight, blockID) + + if len(ret) == 0 { + panic("no return value specified for finishVoting") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(uint64, proto.BlockID) error); ok { + r0 = returnFunc(curHeight, blockID) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockFeaturesState_finishVoting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'finishVoting' +type MockFeaturesState_finishVoting_Call struct { + *mock.Call +} + +// finishVoting is a helper method to define mock.On call +// - curHeight uint64 +// - blockID proto.BlockID +func (_e *MockFeaturesState_Expecter) finishVoting(curHeight interface{}, blockID interface{}) *MockFeaturesState_finishVoting_Call { + return &MockFeaturesState_finishVoting_Call{Call: _e.mock.On("finishVoting", curHeight, blockID)} +} + +func (_c *MockFeaturesState_finishVoting_Call) Run(run func(curHeight uint64, blockID proto.BlockID)) *MockFeaturesState_finishVoting_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 uint64 + if args[0] != nil { + arg0 = args[0].(uint64) + } + var arg1 proto.BlockID + if args[1] != nil { + arg1 = args[1].(proto.BlockID) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockFeaturesState_finishVoting_Call) Return(err error) *MockFeaturesState_finishVoting_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockFeaturesState_finishVoting_Call) RunAndReturn(run func(curHeight uint64, blockID proto.BlockID) error) *MockFeaturesState_finishVoting_Call { + _c.Call.Return(run) + return _c +} + +// isActivated provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) isActivated(featureID int16) (bool, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for isActivated") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (bool, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) bool); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_isActivated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'isActivated' +type MockFeaturesState_isActivated_Call struct { + *mock.Call +} + +// isActivated is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) isActivated(featureID interface{}) *MockFeaturesState_isActivated_Call { + return &MockFeaturesState_isActivated_Call{Call: _e.mock.On("isActivated", featureID)} +} + +func (_c *MockFeaturesState_isActivated_Call) Run(run func(featureID int16)) *MockFeaturesState_isActivated_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_isActivated_Call) Return(b bool, err error) *MockFeaturesState_isActivated_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockFeaturesState_isActivated_Call) RunAndReturn(run func(featureID int16) (bool, error)) *MockFeaturesState_isActivated_Call { + _c.Call.Return(run) + return _c +} + +// isActivatedAtHeight provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) isActivatedAtHeight(featureID int16, height uint64) bool { + ret := _mock.Called(featureID, height) + + if len(ret) == 0 { + panic("no return value specified for isActivatedAtHeight") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(int16, uint64) bool); ok { + r0 = returnFunc(featureID, height) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockFeaturesState_isActivatedAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'isActivatedAtHeight' +type MockFeaturesState_isActivatedAtHeight_Call struct { + *mock.Call +} + +// isActivatedAtHeight is a helper method to define mock.On call +// - featureID int16 +// - height uint64 +func (_e *MockFeaturesState_Expecter) isActivatedAtHeight(featureID interface{}, height interface{}) *MockFeaturesState_isActivatedAtHeight_Call { + return &MockFeaturesState_isActivatedAtHeight_Call{Call: _e.mock.On("isActivatedAtHeight", featureID, height)} +} + +func (_c *MockFeaturesState_isActivatedAtHeight_Call) Run(run func(featureID int16, height uint64)) *MockFeaturesState_isActivatedAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 uint64 + if args[1] != nil { + arg1 = args[1].(uint64) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockFeaturesState_isActivatedAtHeight_Call) Return(b bool) *MockFeaturesState_isActivatedAtHeight_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockFeaturesState_isActivatedAtHeight_Call) RunAndReturn(run func(featureID int16, height uint64) bool) *MockFeaturesState_isActivatedAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// isApproved provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) isApproved(featureID int16) (bool, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for isApproved") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (bool, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) bool); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_isApproved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'isApproved' +type MockFeaturesState_isApproved_Call struct { + *mock.Call +} + +// isApproved is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) isApproved(featureID interface{}) *MockFeaturesState_isApproved_Call { + return &MockFeaturesState_isApproved_Call{Call: _e.mock.On("isApproved", featureID)} +} + +func (_c *MockFeaturesState_isApproved_Call) Run(run func(featureID int16)) *MockFeaturesState_isApproved_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_isApproved_Call) Return(b bool, err error) *MockFeaturesState_isApproved_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockFeaturesState_isApproved_Call) RunAndReturn(run func(featureID int16) (bool, error)) *MockFeaturesState_isApproved_Call { + _c.Call.Return(run) + return _c +} + +// isApprovedAtHeight provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) isApprovedAtHeight(featureID int16, height uint64) bool { + ret := _mock.Called(featureID, height) + + if len(ret) == 0 { + panic("no return value specified for isApprovedAtHeight") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(int16, uint64) bool); ok { + r0 = returnFunc(featureID, height) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockFeaturesState_isApprovedAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'isApprovedAtHeight' +type MockFeaturesState_isApprovedAtHeight_Call struct { + *mock.Call +} + +// isApprovedAtHeight is a helper method to define mock.On call +// - featureID int16 +// - height uint64 +func (_e *MockFeaturesState_Expecter) isApprovedAtHeight(featureID interface{}, height interface{}) *MockFeaturesState_isApprovedAtHeight_Call { + return &MockFeaturesState_isApprovedAtHeight_Call{Call: _e.mock.On("isApprovedAtHeight", featureID, height)} +} + +func (_c *MockFeaturesState_isApprovedAtHeight_Call) Run(run func(featureID int16, height uint64)) *MockFeaturesState_isApprovedAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 uint64 + if args[1] != nil { + arg1 = args[1].(uint64) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockFeaturesState_isApprovedAtHeight_Call) Return(b bool) *MockFeaturesState_isApprovedAtHeight_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockFeaturesState_isApprovedAtHeight_Call) RunAndReturn(run func(featureID int16, height uint64) bool) *MockFeaturesState_isApprovedAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// newestActivationHeight provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) newestActivationHeight(featureID int16) (uint64, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for newestActivationHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (uint64, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) uint64); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_newestActivationHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestActivationHeight' +type MockFeaturesState_newestActivationHeight_Call struct { + *mock.Call +} + +// newestActivationHeight is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) newestActivationHeight(featureID interface{}) *MockFeaturesState_newestActivationHeight_Call { + return &MockFeaturesState_newestActivationHeight_Call{Call: _e.mock.On("newestActivationHeight", featureID)} +} + +func (_c *MockFeaturesState_newestActivationHeight_Call) Run(run func(featureID int16)) *MockFeaturesState_newestActivationHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_newestActivationHeight_Call) Return(v uint64, err error) *MockFeaturesState_newestActivationHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockFeaturesState_newestActivationHeight_Call) RunAndReturn(run func(featureID int16) (uint64, error)) *MockFeaturesState_newestActivationHeight_Call { + _c.Call.Return(run) + return _c +} + +// newestApprovalHeight provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) newestApprovalHeight(featureID int16) (uint64, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for newestApprovalHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (uint64, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) uint64); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_newestApprovalHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestApprovalHeight' +type MockFeaturesState_newestApprovalHeight_Call struct { + *mock.Call +} + +// newestApprovalHeight is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) newestApprovalHeight(featureID interface{}) *MockFeaturesState_newestApprovalHeight_Call { + return &MockFeaturesState_newestApprovalHeight_Call{Call: _e.mock.On("newestApprovalHeight", featureID)} +} + +func (_c *MockFeaturesState_newestApprovalHeight_Call) Run(run func(featureID int16)) *MockFeaturesState_newestApprovalHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_newestApprovalHeight_Call) Return(v uint64, err error) *MockFeaturesState_newestApprovalHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockFeaturesState_newestApprovalHeight_Call) RunAndReturn(run func(featureID int16) (uint64, error)) *MockFeaturesState_newestApprovalHeight_Call { + _c.Call.Return(run) + return _c +} + +// newestIsActivated provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) newestIsActivated(featureID int16) (bool, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for newestIsActivated") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (bool, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) bool); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_newestIsActivated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestIsActivated' +type MockFeaturesState_newestIsActivated_Call struct { + *mock.Call +} + +// newestIsActivated is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) newestIsActivated(featureID interface{}) *MockFeaturesState_newestIsActivated_Call { + return &MockFeaturesState_newestIsActivated_Call{Call: _e.mock.On("newestIsActivated", featureID)} +} + +func (_c *MockFeaturesState_newestIsActivated_Call) Run(run func(featureID int16)) *MockFeaturesState_newestIsActivated_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_newestIsActivated_Call) Return(b bool, err error) *MockFeaturesState_newestIsActivated_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockFeaturesState_newestIsActivated_Call) RunAndReturn(run func(featureID int16) (bool, error)) *MockFeaturesState_newestIsActivated_Call { + _c.Call.Return(run) + return _c +} + +// newestIsActivatedAtHeight provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) newestIsActivatedAtHeight(featureID int16, height uint64) bool { + ret := _mock.Called(featureID, height) + + if len(ret) == 0 { + panic("no return value specified for newestIsActivatedAtHeight") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(int16, uint64) bool); ok { + r0 = returnFunc(featureID, height) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockFeaturesState_newestIsActivatedAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestIsActivatedAtHeight' +type MockFeaturesState_newestIsActivatedAtHeight_Call struct { + *mock.Call +} + +// newestIsActivatedAtHeight is a helper method to define mock.On call +// - featureID int16 +// - height uint64 +func (_e *MockFeaturesState_Expecter) newestIsActivatedAtHeight(featureID interface{}, height interface{}) *MockFeaturesState_newestIsActivatedAtHeight_Call { + return &MockFeaturesState_newestIsActivatedAtHeight_Call{Call: _e.mock.On("newestIsActivatedAtHeight", featureID, height)} +} + +func (_c *MockFeaturesState_newestIsActivatedAtHeight_Call) Run(run func(featureID int16, height uint64)) *MockFeaturesState_newestIsActivatedAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 uint64 + if args[1] != nil { + arg1 = args[1].(uint64) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockFeaturesState_newestIsActivatedAtHeight_Call) Return(b bool) *MockFeaturesState_newestIsActivatedAtHeight_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockFeaturesState_newestIsActivatedAtHeight_Call) RunAndReturn(run func(featureID int16, height uint64) bool) *MockFeaturesState_newestIsActivatedAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// newestIsActivatedForNBlocks provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) newestIsActivatedForNBlocks(featureID int16, n int) (bool, error) { + ret := _mock.Called(featureID, n) + + if len(ret) == 0 { + panic("no return value specified for newestIsActivatedForNBlocks") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16, int) (bool, error)); ok { + return returnFunc(featureID, n) + } + if returnFunc, ok := ret.Get(0).(func(int16, int) bool); ok { + r0 = returnFunc(featureID, n) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16, int) error); ok { + r1 = returnFunc(featureID, n) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_newestIsActivatedForNBlocks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestIsActivatedForNBlocks' +type MockFeaturesState_newestIsActivatedForNBlocks_Call struct { + *mock.Call +} + +// newestIsActivatedForNBlocks is a helper method to define mock.On call +// - featureID int16 +// - n int +func (_e *MockFeaturesState_Expecter) newestIsActivatedForNBlocks(featureID interface{}, n interface{}) *MockFeaturesState_newestIsActivatedForNBlocks_Call { + return &MockFeaturesState_newestIsActivatedForNBlocks_Call{Call: _e.mock.On("newestIsActivatedForNBlocks", featureID, n)} +} + +func (_c *MockFeaturesState_newestIsActivatedForNBlocks_Call) Run(run func(featureID int16, n int)) *MockFeaturesState_newestIsActivatedForNBlocks_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 int + if args[1] != nil { + arg1 = args[1].(int) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockFeaturesState_newestIsActivatedForNBlocks_Call) Return(b bool, err error) *MockFeaturesState_newestIsActivatedForNBlocks_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockFeaturesState_newestIsActivatedForNBlocks_Call) RunAndReturn(run func(featureID int16, n int) (bool, error)) *MockFeaturesState_newestIsActivatedForNBlocks_Call { + _c.Call.Return(run) + return _c +} + +// newestIsApproved provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) newestIsApproved(featureID int16) (bool, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for newestIsApproved") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (bool, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) bool); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFeaturesState_newestIsApproved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestIsApproved' +type MockFeaturesState_newestIsApproved_Call struct { + *mock.Call +} + +// newestIsApproved is a helper method to define mock.On call +// - featureID int16 +func (_e *MockFeaturesState_Expecter) newestIsApproved(featureID interface{}) *MockFeaturesState_newestIsApproved_Call { + return &MockFeaturesState_newestIsApproved_Call{Call: _e.mock.On("newestIsApproved", featureID)} +} + +func (_c *MockFeaturesState_newestIsApproved_Call) Run(run func(featureID int16)) *MockFeaturesState_newestIsApproved_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_newestIsApproved_Call) Return(b bool, err error) *MockFeaturesState_newestIsApproved_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockFeaturesState_newestIsApproved_Call) RunAndReturn(run func(featureID int16) (bool, error)) *MockFeaturesState_newestIsApproved_Call { + _c.Call.Return(run) + return _c +} + +// resetVotes provides a mock function for the type MockFeaturesState +func (_mock *MockFeaturesState) resetVotes(blockID proto.BlockID) error { + ret := _mock.Called(blockID) + + if len(ret) == 0 { + panic("no return value specified for resetVotes") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) error); ok { + r0 = returnFunc(blockID) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockFeaturesState_resetVotes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'resetVotes' +type MockFeaturesState_resetVotes_Call struct { + *mock.Call +} + +// resetVotes is a helper method to define mock.On call +// - blockID proto.BlockID +func (_e *MockFeaturesState_Expecter) resetVotes(blockID interface{}) *MockFeaturesState_resetVotes_Call { + return &MockFeaturesState_resetVotes_Call{Call: _e.mock.On("resetVotes", blockID)} +} + +func (_c *MockFeaturesState_resetVotes_Call) Run(run func(blockID proto.BlockID)) *MockFeaturesState_resetVotes_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.BlockID + if args[0] != nil { + arg0 = args[0].(proto.BlockID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFeaturesState_resetVotes_Call) Return(err error) *MockFeaturesState_resetVotes_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockFeaturesState_resetVotes_Call) RunAndReturn(run func(blockID proto.BlockID) error) *MockFeaturesState_resetVotes_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/state/mock_script_storage_state_test.go b/pkg/state/mock_script_storage_state_test.go new file mode 100644 index 0000000000..4f4bfbe616 --- /dev/null +++ b/pkg/state/mock_script_storage_state_test.go @@ -0,0 +1,1673 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package state + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/crypto" + "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/ride/ast" +) + +// NewMockScriptStorageState creates a new instance of MockScriptStorageState. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockScriptStorageState(t interface { + mock.TestingT + Cleanup(func()) +}) *MockScriptStorageState { + mock := &MockScriptStorageState{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockScriptStorageState is an autogenerated mock type for the scriptStorageState type +type MockScriptStorageState struct { + mock.Mock +} + +type MockScriptStorageState_Expecter struct { + mock *mock.Mock +} + +func (_m *MockScriptStorageState) EXPECT() *MockScriptStorageState_Expecter { + return &MockScriptStorageState_Expecter{mock: &_m.Mock} +} + +// accountHasScript provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) accountHasScript(addr proto.WavesAddress) (bool, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for accountHasScript") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (bool, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) bool); ok { + r0 = returnFunc(addr) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_accountHasScript_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'accountHasScript' +type MockScriptStorageState_accountHasScript_Call struct { + *mock.Call +} + +// accountHasScript is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) accountHasScript(addr interface{}) *MockScriptStorageState_accountHasScript_Call { + return &MockScriptStorageState_accountHasScript_Call{Call: _e.mock.On("accountHasScript", addr)} +} + +func (_c *MockScriptStorageState_accountHasScript_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_accountHasScript_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_accountHasScript_Call) Return(b bool, err error) *MockScriptStorageState_accountHasScript_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockScriptStorageState_accountHasScript_Call) RunAndReturn(run func(addr proto.WavesAddress) (bool, error)) *MockScriptStorageState_accountHasScript_Call { + _c.Call.Return(run) + return _c +} + +// accountHasVerifier provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) accountHasVerifier(addr proto.WavesAddress) (bool, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for accountHasVerifier") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (bool, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) bool); ok { + r0 = returnFunc(addr) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_accountHasVerifier_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'accountHasVerifier' +type MockScriptStorageState_accountHasVerifier_Call struct { + *mock.Call +} + +// accountHasVerifier is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) accountHasVerifier(addr interface{}) *MockScriptStorageState_accountHasVerifier_Call { + return &MockScriptStorageState_accountHasVerifier_Call{Call: _e.mock.On("accountHasVerifier", addr)} +} + +func (_c *MockScriptStorageState_accountHasVerifier_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_accountHasVerifier_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_accountHasVerifier_Call) Return(b bool, err error) *MockScriptStorageState_accountHasVerifier_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockScriptStorageState_accountHasVerifier_Call) RunAndReturn(run func(addr proto.WavesAddress) (bool, error)) *MockScriptStorageState_accountHasVerifier_Call { + _c.Call.Return(run) + return _c +} + +// accountIsDApp provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) accountIsDApp(addr proto.WavesAddress) (bool, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for accountIsDApp") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (bool, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) bool); ok { + r0 = returnFunc(addr) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_accountIsDApp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'accountIsDApp' +type MockScriptStorageState_accountIsDApp_Call struct { + *mock.Call +} + +// accountIsDApp is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) accountIsDApp(addr interface{}) *MockScriptStorageState_accountIsDApp_Call { + return &MockScriptStorageState_accountIsDApp_Call{Call: _e.mock.On("accountIsDApp", addr)} +} + +func (_c *MockScriptStorageState_accountIsDApp_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_accountIsDApp_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_accountIsDApp_Call) Return(b bool, err error) *MockScriptStorageState_accountIsDApp_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockScriptStorageState_accountIsDApp_Call) RunAndReturn(run func(addr proto.WavesAddress) (bool, error)) *MockScriptStorageState_accountIsDApp_Call { + _c.Call.Return(run) + return _c +} + +// clearCache provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) clearCache() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for clearCache") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockScriptStorageState_clearCache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'clearCache' +type MockScriptStorageState_clearCache_Call struct { + *mock.Call +} + +// clearCache is a helper method to define mock.On call +func (_e *MockScriptStorageState_Expecter) clearCache() *MockScriptStorageState_clearCache_Call { + return &MockScriptStorageState_clearCache_Call{Call: _e.mock.On("clearCache")} +} + +func (_c *MockScriptStorageState_clearCache_Call) Run(run func()) *MockScriptStorageState_clearCache_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockScriptStorageState_clearCache_Call) Return(err error) *MockScriptStorageState_clearCache_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockScriptStorageState_clearCache_Call) RunAndReturn(run func() error) *MockScriptStorageState_clearCache_Call { + _c.Call.Return(run) + return _c +} + +// commitUncertain provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) commitUncertain(blockID proto.BlockID) error { + ret := _mock.Called(blockID) + + if len(ret) == 0 { + panic("no return value specified for commitUncertain") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) error); ok { + r0 = returnFunc(blockID) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockScriptStorageState_commitUncertain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'commitUncertain' +type MockScriptStorageState_commitUncertain_Call struct { + *mock.Call +} + +// commitUncertain is a helper method to define mock.On call +// - blockID proto.BlockID +func (_e *MockScriptStorageState_Expecter) commitUncertain(blockID interface{}) *MockScriptStorageState_commitUncertain_Call { + return &MockScriptStorageState_commitUncertain_Call{Call: _e.mock.On("commitUncertain", blockID)} +} + +func (_c *MockScriptStorageState_commitUncertain_Call) Run(run func(blockID proto.BlockID)) *MockScriptStorageState_commitUncertain_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.BlockID + if args[0] != nil { + arg0 = args[0].(proto.BlockID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_commitUncertain_Call) Return(err error) *MockScriptStorageState_commitUncertain_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockScriptStorageState_commitUncertain_Call) RunAndReturn(run func(blockID proto.BlockID) error) *MockScriptStorageState_commitUncertain_Call { + _c.Call.Return(run) + return _c +} + +// dropUncertain provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) dropUncertain() { + _mock.Called() + return +} + +// MockScriptStorageState_dropUncertain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'dropUncertain' +type MockScriptStorageState_dropUncertain_Call struct { + *mock.Call +} + +// dropUncertain is a helper method to define mock.On call +func (_e *MockScriptStorageState_Expecter) dropUncertain() *MockScriptStorageState_dropUncertain_Call { + return &MockScriptStorageState_dropUncertain_Call{Call: _e.mock.On("dropUncertain")} +} + +func (_c *MockScriptStorageState_dropUncertain_Call) Run(run func()) *MockScriptStorageState_dropUncertain_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockScriptStorageState_dropUncertain_Call) Return() *MockScriptStorageState_dropUncertain_Call { + _c.Call.Return() + return _c +} + +func (_c *MockScriptStorageState_dropUncertain_Call) RunAndReturn(run func()) *MockScriptStorageState_dropUncertain_Call { + _c.Run(run) + return _c +} + +// getAccountScriptsHasher provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) getAccountScriptsHasher() *stateHasher { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for getAccountScriptsHasher") + } + + var r0 *stateHasher + if returnFunc, ok := ret.Get(0).(func() *stateHasher); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*stateHasher) + } + } + return r0 +} + +// MockScriptStorageState_getAccountScriptsHasher_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'getAccountScriptsHasher' +type MockScriptStorageState_getAccountScriptsHasher_Call struct { + *mock.Call +} + +// getAccountScriptsHasher is a helper method to define mock.On call +func (_e *MockScriptStorageState_Expecter) getAccountScriptsHasher() *MockScriptStorageState_getAccountScriptsHasher_Call { + return &MockScriptStorageState_getAccountScriptsHasher_Call{Call: _e.mock.On("getAccountScriptsHasher")} +} + +func (_c *MockScriptStorageState_getAccountScriptsHasher_Call) Run(run func()) *MockScriptStorageState_getAccountScriptsHasher_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockScriptStorageState_getAccountScriptsHasher_Call) Return(stateHasherMoqParam *stateHasher) *MockScriptStorageState_getAccountScriptsHasher_Call { + _c.Call.Return(stateHasherMoqParam) + return _c +} + +func (_c *MockScriptStorageState_getAccountScriptsHasher_Call) RunAndReturn(run func() *stateHasher) *MockScriptStorageState_getAccountScriptsHasher_Call { + _c.Call.Return(run) + return _c +} + +// getAssetScriptsHasher provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) getAssetScriptsHasher() *stateHasher { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for getAssetScriptsHasher") + } + + var r0 *stateHasher + if returnFunc, ok := ret.Get(0).(func() *stateHasher); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*stateHasher) + } + } + return r0 +} + +// MockScriptStorageState_getAssetScriptsHasher_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'getAssetScriptsHasher' +type MockScriptStorageState_getAssetScriptsHasher_Call struct { + *mock.Call +} + +// getAssetScriptsHasher is a helper method to define mock.On call +func (_e *MockScriptStorageState_Expecter) getAssetScriptsHasher() *MockScriptStorageState_getAssetScriptsHasher_Call { + return &MockScriptStorageState_getAssetScriptsHasher_Call{Call: _e.mock.On("getAssetScriptsHasher")} +} + +func (_c *MockScriptStorageState_getAssetScriptsHasher_Call) Run(run func()) *MockScriptStorageState_getAssetScriptsHasher_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockScriptStorageState_getAssetScriptsHasher_Call) Return(stateHasherMoqParam *stateHasher) *MockScriptStorageState_getAssetScriptsHasher_Call { + _c.Call.Return(stateHasherMoqParam) + return _c +} + +func (_c *MockScriptStorageState_getAssetScriptsHasher_Call) RunAndReturn(run func() *stateHasher) *MockScriptStorageState_getAssetScriptsHasher_Call { + _c.Call.Return(run) + return _c +} + +// isSmartAsset provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) isSmartAsset(assetID proto.AssetID) (bool, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for isSmartAsset") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (bool, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) bool); ok { + r0 = returnFunc(assetID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_isSmartAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'isSmartAsset' +type MockScriptStorageState_isSmartAsset_Call struct { + *mock.Call +} + +// isSmartAsset is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockScriptStorageState_Expecter) isSmartAsset(assetID interface{}) *MockScriptStorageState_isSmartAsset_Call { + return &MockScriptStorageState_isSmartAsset_Call{Call: _e.mock.On("isSmartAsset", assetID)} +} + +func (_c *MockScriptStorageState_isSmartAsset_Call) Run(run func(assetID proto.AssetID)) *MockScriptStorageState_isSmartAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_isSmartAsset_Call) Return(b bool, err error) *MockScriptStorageState_isSmartAsset_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockScriptStorageState_isSmartAsset_Call) RunAndReturn(run func(assetID proto.AssetID) (bool, error)) *MockScriptStorageState_isSmartAsset_Call { + _c.Call.Return(run) + return _c +} + +// newestAccountHasScript provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestAccountHasScript(addr proto.WavesAddress) (bool, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for newestAccountHasScript") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (bool, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) bool); ok { + r0 = returnFunc(addr) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestAccountHasScript_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestAccountHasScript' +type MockScriptStorageState_newestAccountHasScript_Call struct { + *mock.Call +} + +// newestAccountHasScript is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) newestAccountHasScript(addr interface{}) *MockScriptStorageState_newestAccountHasScript_Call { + return &MockScriptStorageState_newestAccountHasScript_Call{Call: _e.mock.On("newestAccountHasScript", addr)} +} + +func (_c *MockScriptStorageState_newestAccountHasScript_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_newestAccountHasScript_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestAccountHasScript_Call) Return(b bool, err error) *MockScriptStorageState_newestAccountHasScript_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockScriptStorageState_newestAccountHasScript_Call) RunAndReturn(run func(addr proto.WavesAddress) (bool, error)) *MockScriptStorageState_newestAccountHasScript_Call { + _c.Call.Return(run) + return _c +} + +// newestAccountHasVerifier provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestAccountHasVerifier(addr proto.WavesAddress) (bool, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for newestAccountHasVerifier") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (bool, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) bool); ok { + r0 = returnFunc(addr) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestAccountHasVerifier_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestAccountHasVerifier' +type MockScriptStorageState_newestAccountHasVerifier_Call struct { + *mock.Call +} + +// newestAccountHasVerifier is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) newestAccountHasVerifier(addr interface{}) *MockScriptStorageState_newestAccountHasVerifier_Call { + return &MockScriptStorageState_newestAccountHasVerifier_Call{Call: _e.mock.On("newestAccountHasVerifier", addr)} +} + +func (_c *MockScriptStorageState_newestAccountHasVerifier_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_newestAccountHasVerifier_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestAccountHasVerifier_Call) Return(b bool, err error) *MockScriptStorageState_newestAccountHasVerifier_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockScriptStorageState_newestAccountHasVerifier_Call) RunAndReturn(run func(addr proto.WavesAddress) (bool, error)) *MockScriptStorageState_newestAccountHasVerifier_Call { + _c.Call.Return(run) + return _c +} + +// newestAccountIsDApp provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestAccountIsDApp(addr proto.WavesAddress) (bool, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for newestAccountIsDApp") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (bool, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) bool); ok { + r0 = returnFunc(addr) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestAccountIsDApp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestAccountIsDApp' +type MockScriptStorageState_newestAccountIsDApp_Call struct { + *mock.Call +} + +// newestAccountIsDApp is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) newestAccountIsDApp(addr interface{}) *MockScriptStorageState_newestAccountIsDApp_Call { + return &MockScriptStorageState_newestAccountIsDApp_Call{Call: _e.mock.On("newestAccountIsDApp", addr)} +} + +func (_c *MockScriptStorageState_newestAccountIsDApp_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_newestAccountIsDApp_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestAccountIsDApp_Call) Return(b bool, err error) *MockScriptStorageState_newestAccountIsDApp_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockScriptStorageState_newestAccountIsDApp_Call) RunAndReturn(run func(addr proto.WavesAddress) (bool, error)) *MockScriptStorageState_newestAccountIsDApp_Call { + _c.Call.Return(run) + return _c +} + +// newestIsSmartAsset provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestIsSmartAsset(assetID proto.AssetID) (bool, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for newestIsSmartAsset") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (bool, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) bool); ok { + r0 = returnFunc(assetID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestIsSmartAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestIsSmartAsset' +type MockScriptStorageState_newestIsSmartAsset_Call struct { + *mock.Call +} + +// newestIsSmartAsset is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockScriptStorageState_Expecter) newestIsSmartAsset(assetID interface{}) *MockScriptStorageState_newestIsSmartAsset_Call { + return &MockScriptStorageState_newestIsSmartAsset_Call{Call: _e.mock.On("newestIsSmartAsset", assetID)} +} + +func (_c *MockScriptStorageState_newestIsSmartAsset_Call) Run(run func(assetID proto.AssetID)) *MockScriptStorageState_newestIsSmartAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestIsSmartAsset_Call) Return(b bool, err error) *MockScriptStorageState_newestIsSmartAsset_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockScriptStorageState_newestIsSmartAsset_Call) RunAndReturn(run func(assetID proto.AssetID) (bool, error)) *MockScriptStorageState_newestIsSmartAsset_Call { + _c.Call.Return(run) + return _c +} + +// newestScriptBasicInfoByAddressID provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestScriptBasicInfoByAddressID(addressID proto.AddressID) (scriptBasicInfoRecord, error) { + ret := _mock.Called(addressID) + + if len(ret) == 0 { + panic("no return value specified for newestScriptBasicInfoByAddressID") + } + + var r0 scriptBasicInfoRecord + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AddressID) (scriptBasicInfoRecord, error)); ok { + return returnFunc(addressID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AddressID) scriptBasicInfoRecord); ok { + r0 = returnFunc(addressID) + } else { + r0 = ret.Get(0).(scriptBasicInfoRecord) + } + if returnFunc, ok := ret.Get(1).(func(proto.AddressID) error); ok { + r1 = returnFunc(addressID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestScriptBasicInfoByAddressID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestScriptBasicInfoByAddressID' +type MockScriptStorageState_newestScriptBasicInfoByAddressID_Call struct { + *mock.Call +} + +// newestScriptBasicInfoByAddressID is a helper method to define mock.On call +// - addressID proto.AddressID +func (_e *MockScriptStorageState_Expecter) newestScriptBasicInfoByAddressID(addressID interface{}) *MockScriptStorageState_newestScriptBasicInfoByAddressID_Call { + return &MockScriptStorageState_newestScriptBasicInfoByAddressID_Call{Call: _e.mock.On("newestScriptBasicInfoByAddressID", addressID)} +} + +func (_c *MockScriptStorageState_newestScriptBasicInfoByAddressID_Call) Run(run func(addressID proto.AddressID)) *MockScriptStorageState_newestScriptBasicInfoByAddressID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AddressID + if args[0] != nil { + arg0 = args[0].(proto.AddressID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestScriptBasicInfoByAddressID_Call) Return(scriptBasicInfoRecordMoqParam scriptBasicInfoRecord, err error) *MockScriptStorageState_newestScriptBasicInfoByAddressID_Call { + _c.Call.Return(scriptBasicInfoRecordMoqParam, err) + return _c +} + +func (_c *MockScriptStorageState_newestScriptBasicInfoByAddressID_Call) RunAndReturn(run func(addressID proto.AddressID) (scriptBasicInfoRecord, error)) *MockScriptStorageState_newestScriptBasicInfoByAddressID_Call { + _c.Call.Return(run) + return _c +} + +// newestScriptByAddr provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestScriptByAddr(addr proto.WavesAddress) (*ast.Tree, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for newestScriptByAddr") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (*ast.Tree, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) *ast.Tree); ok { + r0 = returnFunc(addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestScriptByAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestScriptByAddr' +type MockScriptStorageState_newestScriptByAddr_Call struct { + *mock.Call +} + +// newestScriptByAddr is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) newestScriptByAddr(addr interface{}) *MockScriptStorageState_newestScriptByAddr_Call { + return &MockScriptStorageState_newestScriptByAddr_Call{Call: _e.mock.On("newestScriptByAddr", addr)} +} + +func (_c *MockScriptStorageState_newestScriptByAddr_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_newestScriptByAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestScriptByAddr_Call) Return(tree *ast.Tree, err error) *MockScriptStorageState_newestScriptByAddr_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockScriptStorageState_newestScriptByAddr_Call) RunAndReturn(run func(addr proto.WavesAddress) (*ast.Tree, error)) *MockScriptStorageState_newestScriptByAddr_Call { + _c.Call.Return(run) + return _c +} + +// newestScriptByAsset provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestScriptByAsset(assetID proto.AssetID) (*ast.Tree, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for newestScriptByAsset") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (*ast.Tree, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) *ast.Tree); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestScriptByAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestScriptByAsset' +type MockScriptStorageState_newestScriptByAsset_Call struct { + *mock.Call +} + +// newestScriptByAsset is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockScriptStorageState_Expecter) newestScriptByAsset(assetID interface{}) *MockScriptStorageState_newestScriptByAsset_Call { + return &MockScriptStorageState_newestScriptByAsset_Call{Call: _e.mock.On("newestScriptByAsset", assetID)} +} + +func (_c *MockScriptStorageState_newestScriptByAsset_Call) Run(run func(assetID proto.AssetID)) *MockScriptStorageState_newestScriptByAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestScriptByAsset_Call) Return(tree *ast.Tree, err error) *MockScriptStorageState_newestScriptByAsset_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockScriptStorageState_newestScriptByAsset_Call) RunAndReturn(run func(assetID proto.AssetID) (*ast.Tree, error)) *MockScriptStorageState_newestScriptByAsset_Call { + _c.Call.Return(run) + return _c +} + +// newestScriptBytesByAddr provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestScriptBytesByAddr(addr proto.WavesAddress) (proto.Script, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for newestScriptBytesByAddr") + } + + var r0 proto.Script + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (proto.Script, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) proto.Script); ok { + r0 = returnFunc(addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Script) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestScriptBytesByAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestScriptBytesByAddr' +type MockScriptStorageState_newestScriptBytesByAddr_Call struct { + *mock.Call +} + +// newestScriptBytesByAddr is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) newestScriptBytesByAddr(addr interface{}) *MockScriptStorageState_newestScriptBytesByAddr_Call { + return &MockScriptStorageState_newestScriptBytesByAddr_Call{Call: _e.mock.On("newestScriptBytesByAddr", addr)} +} + +func (_c *MockScriptStorageState_newestScriptBytesByAddr_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_newestScriptBytesByAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestScriptBytesByAddr_Call) Return(script proto.Script, err error) *MockScriptStorageState_newestScriptBytesByAddr_Call { + _c.Call.Return(script, err) + return _c +} + +func (_c *MockScriptStorageState_newestScriptBytesByAddr_Call) RunAndReturn(run func(addr proto.WavesAddress) (proto.Script, error)) *MockScriptStorageState_newestScriptBytesByAddr_Call { + _c.Call.Return(run) + return _c +} + +// newestScriptBytesByAsset provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) newestScriptBytesByAsset(assetID proto.AssetID) (proto.Script, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for newestScriptBytesByAsset") + } + + var r0 proto.Script + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (proto.Script, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) proto.Script); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Script) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_newestScriptBytesByAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'newestScriptBytesByAsset' +type MockScriptStorageState_newestScriptBytesByAsset_Call struct { + *mock.Call +} + +// newestScriptBytesByAsset is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockScriptStorageState_Expecter) newestScriptBytesByAsset(assetID interface{}) *MockScriptStorageState_newestScriptBytesByAsset_Call { + return &MockScriptStorageState_newestScriptBytesByAsset_Call{Call: _e.mock.On("newestScriptBytesByAsset", assetID)} +} + +func (_c *MockScriptStorageState_newestScriptBytesByAsset_Call) Run(run func(assetID proto.AssetID)) *MockScriptStorageState_newestScriptBytesByAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_newestScriptBytesByAsset_Call) Return(script proto.Script, err error) *MockScriptStorageState_newestScriptBytesByAsset_Call { + _c.Call.Return(script, err) + return _c +} + +func (_c *MockScriptStorageState_newestScriptBytesByAsset_Call) RunAndReturn(run func(assetID proto.AssetID) (proto.Script, error)) *MockScriptStorageState_newestScriptBytesByAsset_Call { + _c.Call.Return(run) + return _c +} + +// prepareHashes provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) prepareHashes() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for prepareHashes") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockScriptStorageState_prepareHashes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'prepareHashes' +type MockScriptStorageState_prepareHashes_Call struct { + *mock.Call +} + +// prepareHashes is a helper method to define mock.On call +func (_e *MockScriptStorageState_Expecter) prepareHashes() *MockScriptStorageState_prepareHashes_Call { + return &MockScriptStorageState_prepareHashes_Call{Call: _e.mock.On("prepareHashes")} +} + +func (_c *MockScriptStorageState_prepareHashes_Call) Run(run func()) *MockScriptStorageState_prepareHashes_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockScriptStorageState_prepareHashes_Call) Return(err error) *MockScriptStorageState_prepareHashes_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockScriptStorageState_prepareHashes_Call) RunAndReturn(run func() error) *MockScriptStorageState_prepareHashes_Call { + _c.Call.Return(run) + return _c +} + +// reset provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) reset() { + _mock.Called() + return +} + +// MockScriptStorageState_reset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'reset' +type MockScriptStorageState_reset_Call struct { + *mock.Call +} + +// reset is a helper method to define mock.On call +func (_e *MockScriptStorageState_Expecter) reset() *MockScriptStorageState_reset_Call { + return &MockScriptStorageState_reset_Call{Call: _e.mock.On("reset")} +} + +func (_c *MockScriptStorageState_reset_Call) Run(run func()) *MockScriptStorageState_reset_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockScriptStorageState_reset_Call) Return() *MockScriptStorageState_reset_Call { + _c.Call.Return() + return _c +} + +func (_c *MockScriptStorageState_reset_Call) RunAndReturn(run func()) *MockScriptStorageState_reset_Call { + _c.Run(run) + return _c +} + +// scriptBasicInfoByAddressID provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) scriptBasicInfoByAddressID(addressID proto.AddressID) (scriptBasicInfoRecord, error) { + ret := _mock.Called(addressID) + + if len(ret) == 0 { + panic("no return value specified for scriptBasicInfoByAddressID") + } + + var r0 scriptBasicInfoRecord + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AddressID) (scriptBasicInfoRecord, error)); ok { + return returnFunc(addressID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AddressID) scriptBasicInfoRecord); ok { + r0 = returnFunc(addressID) + } else { + r0 = ret.Get(0).(scriptBasicInfoRecord) + } + if returnFunc, ok := ret.Get(1).(func(proto.AddressID) error); ok { + r1 = returnFunc(addressID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_scriptBasicInfoByAddressID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'scriptBasicInfoByAddressID' +type MockScriptStorageState_scriptBasicInfoByAddressID_Call struct { + *mock.Call +} + +// scriptBasicInfoByAddressID is a helper method to define mock.On call +// - addressID proto.AddressID +func (_e *MockScriptStorageState_Expecter) scriptBasicInfoByAddressID(addressID interface{}) *MockScriptStorageState_scriptBasicInfoByAddressID_Call { + return &MockScriptStorageState_scriptBasicInfoByAddressID_Call{Call: _e.mock.On("scriptBasicInfoByAddressID", addressID)} +} + +func (_c *MockScriptStorageState_scriptBasicInfoByAddressID_Call) Run(run func(addressID proto.AddressID)) *MockScriptStorageState_scriptBasicInfoByAddressID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AddressID + if args[0] != nil { + arg0 = args[0].(proto.AddressID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_scriptBasicInfoByAddressID_Call) Return(scriptBasicInfoRecordMoqParam scriptBasicInfoRecord, err error) *MockScriptStorageState_scriptBasicInfoByAddressID_Call { + _c.Call.Return(scriptBasicInfoRecordMoqParam, err) + return _c +} + +func (_c *MockScriptStorageState_scriptBasicInfoByAddressID_Call) RunAndReturn(run func(addressID proto.AddressID) (scriptBasicInfoRecord, error)) *MockScriptStorageState_scriptBasicInfoByAddressID_Call { + _c.Call.Return(run) + return _c +} + +// scriptByAddr provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) scriptByAddr(addr proto.WavesAddress) (*ast.Tree, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for scriptByAddr") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (*ast.Tree, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) *ast.Tree); ok { + r0 = returnFunc(addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_scriptByAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'scriptByAddr' +type MockScriptStorageState_scriptByAddr_Call struct { + *mock.Call +} + +// scriptByAddr is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) scriptByAddr(addr interface{}) *MockScriptStorageState_scriptByAddr_Call { + return &MockScriptStorageState_scriptByAddr_Call{Call: _e.mock.On("scriptByAddr", addr)} +} + +func (_c *MockScriptStorageState_scriptByAddr_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_scriptByAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_scriptByAddr_Call) Return(tree *ast.Tree, err error) *MockScriptStorageState_scriptByAddr_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockScriptStorageState_scriptByAddr_Call) RunAndReturn(run func(addr proto.WavesAddress) (*ast.Tree, error)) *MockScriptStorageState_scriptByAddr_Call { + _c.Call.Return(run) + return _c +} + +// scriptByAsset provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) scriptByAsset(assetID proto.AssetID) (*ast.Tree, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for scriptByAsset") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (*ast.Tree, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) *ast.Tree); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_scriptByAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'scriptByAsset' +type MockScriptStorageState_scriptByAsset_Call struct { + *mock.Call +} + +// scriptByAsset is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockScriptStorageState_Expecter) scriptByAsset(assetID interface{}) *MockScriptStorageState_scriptByAsset_Call { + return &MockScriptStorageState_scriptByAsset_Call{Call: _e.mock.On("scriptByAsset", assetID)} +} + +func (_c *MockScriptStorageState_scriptByAsset_Call) Run(run func(assetID proto.AssetID)) *MockScriptStorageState_scriptByAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_scriptByAsset_Call) Return(tree *ast.Tree, err error) *MockScriptStorageState_scriptByAsset_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockScriptStorageState_scriptByAsset_Call) RunAndReturn(run func(assetID proto.AssetID) (*ast.Tree, error)) *MockScriptStorageState_scriptByAsset_Call { + _c.Call.Return(run) + return _c +} + +// scriptBytesByAddr provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) scriptBytesByAddr(addr proto.WavesAddress) (proto.Script, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for scriptBytesByAddr") + } + + var r0 proto.Script + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (proto.Script, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) proto.Script); ok { + r0 = returnFunc(addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Script) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_scriptBytesByAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'scriptBytesByAddr' +type MockScriptStorageState_scriptBytesByAddr_Call struct { + *mock.Call +} + +// scriptBytesByAddr is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockScriptStorageState_Expecter) scriptBytesByAddr(addr interface{}) *MockScriptStorageState_scriptBytesByAddr_Call { + return &MockScriptStorageState_scriptBytesByAddr_Call{Call: _e.mock.On("scriptBytesByAddr", addr)} +} + +func (_c *MockScriptStorageState_scriptBytesByAddr_Call) Run(run func(addr proto.WavesAddress)) *MockScriptStorageState_scriptBytesByAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_scriptBytesByAddr_Call) Return(script proto.Script, err error) *MockScriptStorageState_scriptBytesByAddr_Call { + _c.Call.Return(script, err) + return _c +} + +func (_c *MockScriptStorageState_scriptBytesByAddr_Call) RunAndReturn(run func(addr proto.WavesAddress) (proto.Script, error)) *MockScriptStorageState_scriptBytesByAddr_Call { + _c.Call.Return(run) + return _c +} + +// scriptBytesByAsset provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) scriptBytesByAsset(assetID proto.AssetID) (proto.Script, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for scriptBytesByAsset") + } + + var r0 proto.Script + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (proto.Script, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) proto.Script); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Script) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockScriptStorageState_scriptBytesByAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'scriptBytesByAsset' +type MockScriptStorageState_scriptBytesByAsset_Call struct { + *mock.Call +} + +// scriptBytesByAsset is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockScriptStorageState_Expecter) scriptBytesByAsset(assetID interface{}) *MockScriptStorageState_scriptBytesByAsset_Call { + return &MockScriptStorageState_scriptBytesByAsset_Call{Call: _e.mock.On("scriptBytesByAsset", assetID)} +} + +func (_c *MockScriptStorageState_scriptBytesByAsset_Call) Run(run func(assetID proto.AssetID)) *MockScriptStorageState_scriptBytesByAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_scriptBytesByAsset_Call) Return(script proto.Script, err error) *MockScriptStorageState_scriptBytesByAsset_Call { + _c.Call.Return(script, err) + return _c +} + +func (_c *MockScriptStorageState_scriptBytesByAsset_Call) RunAndReturn(run func(assetID proto.AssetID) (proto.Script, error)) *MockScriptStorageState_scriptBytesByAsset_Call { + _c.Call.Return(run) + return _c +} + +// setAccountScript provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) setAccountScript(addr proto.WavesAddress, script proto.Script, pk crypto.PublicKey, blockID proto.BlockID) error { + ret := _mock.Called(addr, script, pk, blockID) + + if len(ret) == 0 { + panic("no return value specified for setAccountScript") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress, proto.Script, crypto.PublicKey, proto.BlockID) error); ok { + r0 = returnFunc(addr, script, pk, blockID) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockScriptStorageState_setAccountScript_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'setAccountScript' +type MockScriptStorageState_setAccountScript_Call struct { + *mock.Call +} + +// setAccountScript is a helper method to define mock.On call +// - addr proto.WavesAddress +// - script proto.Script +// - pk crypto.PublicKey +// - blockID proto.BlockID +func (_e *MockScriptStorageState_Expecter) setAccountScript(addr interface{}, script interface{}, pk interface{}, blockID interface{}) *MockScriptStorageState_setAccountScript_Call { + return &MockScriptStorageState_setAccountScript_Call{Call: _e.mock.On("setAccountScript", addr, script, pk, blockID)} +} + +func (_c *MockScriptStorageState_setAccountScript_Call) Run(run func(addr proto.WavesAddress, script proto.Script, pk crypto.PublicKey, blockID proto.BlockID)) *MockScriptStorageState_setAccountScript_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + var arg1 proto.Script + if args[1] != nil { + arg1 = args[1].(proto.Script) + } + var arg2 crypto.PublicKey + if args[2] != nil { + arg2 = args[2].(crypto.PublicKey) + } + var arg3 proto.BlockID + if args[3] != nil { + arg3 = args[3].(proto.BlockID) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_setAccountScript_Call) Return(err error) *MockScriptStorageState_setAccountScript_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockScriptStorageState_setAccountScript_Call) RunAndReturn(run func(addr proto.WavesAddress, script proto.Script, pk crypto.PublicKey, blockID proto.BlockID) error) *MockScriptStorageState_setAccountScript_Call { + _c.Call.Return(run) + return _c +} + +// setAssetScript provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) setAssetScript(assetID crypto.Digest, script proto.Script, blockID proto.BlockID) error { + ret := _mock.Called(assetID, script, blockID) + + if len(ret) == 0 { + panic("no return value specified for setAssetScript") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest, proto.Script, proto.BlockID) error); ok { + r0 = returnFunc(assetID, script, blockID) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockScriptStorageState_setAssetScript_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'setAssetScript' +type MockScriptStorageState_setAssetScript_Call struct { + *mock.Call +} + +// setAssetScript is a helper method to define mock.On call +// - assetID crypto.Digest +// - script proto.Script +// - blockID proto.BlockID +func (_e *MockScriptStorageState_Expecter) setAssetScript(assetID interface{}, script interface{}, blockID interface{}) *MockScriptStorageState_setAssetScript_Call { + return &MockScriptStorageState_setAssetScript_Call{Call: _e.mock.On("setAssetScript", assetID, script, blockID)} +} + +func (_c *MockScriptStorageState_setAssetScript_Call) Run(run func(assetID crypto.Digest, script proto.Script, blockID proto.BlockID)) *MockScriptStorageState_setAssetScript_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + var arg1 proto.Script + if args[1] != nil { + arg1 = args[1].(proto.Script) + } + var arg2 proto.BlockID + if args[2] != nil { + arg2 = args[2].(proto.BlockID) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_setAssetScript_Call) Return(err error) *MockScriptStorageState_setAssetScript_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockScriptStorageState_setAssetScript_Call) RunAndReturn(run func(assetID crypto.Digest, script proto.Script, blockID proto.BlockID) error) *MockScriptStorageState_setAssetScript_Call { + _c.Call.Return(run) + return _c +} + +// setAssetScriptUncertain provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) setAssetScriptUncertain(fullAssetID crypto.Digest, script proto.Script, pk crypto.PublicKey) error { + ret := _mock.Called(fullAssetID, script, pk) + + if len(ret) == 0 { + panic("no return value specified for setAssetScriptUncertain") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest, proto.Script, crypto.PublicKey) error); ok { + r0 = returnFunc(fullAssetID, script, pk) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockScriptStorageState_setAssetScriptUncertain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'setAssetScriptUncertain' +type MockScriptStorageState_setAssetScriptUncertain_Call struct { + *mock.Call +} + +// setAssetScriptUncertain is a helper method to define mock.On call +// - fullAssetID crypto.Digest +// - script proto.Script +// - pk crypto.PublicKey +func (_e *MockScriptStorageState_Expecter) setAssetScriptUncertain(fullAssetID interface{}, script interface{}, pk interface{}) *MockScriptStorageState_setAssetScriptUncertain_Call { + return &MockScriptStorageState_setAssetScriptUncertain_Call{Call: _e.mock.On("setAssetScriptUncertain", fullAssetID, script, pk)} +} + +func (_c *MockScriptStorageState_setAssetScriptUncertain_Call) Run(run func(fullAssetID crypto.Digest, script proto.Script, pk crypto.PublicKey)) *MockScriptStorageState_setAssetScriptUncertain_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + var arg1 proto.Script + if args[1] != nil { + arg1 = args[1].(proto.Script) + } + var arg2 crypto.PublicKey + if args[2] != nil { + arg2 = args[2].(crypto.PublicKey) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockScriptStorageState_setAssetScriptUncertain_Call) Return(err error) *MockScriptStorageState_setAssetScriptUncertain_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockScriptStorageState_setAssetScriptUncertain_Call) RunAndReturn(run func(fullAssetID crypto.Digest, script proto.Script, pk crypto.PublicKey) error) *MockScriptStorageState_setAssetScriptUncertain_Call { + _c.Call.Return(run) + return _c +} + +// uncertainAssetScriptsCopy provides a mock function for the type MockScriptStorageState +func (_mock *MockScriptStorageState) uncertainAssetScriptsCopy() map[proto.AssetID]assetScriptRecordWithAssetIDTail { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for uncertainAssetScriptsCopy") + } + + var r0 map[proto.AssetID]assetScriptRecordWithAssetIDTail + if returnFunc, ok := ret.Get(0).(func() map[proto.AssetID]assetScriptRecordWithAssetIDTail); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[proto.AssetID]assetScriptRecordWithAssetIDTail) + } + } + return r0 +} + +// MockScriptStorageState_uncertainAssetScriptsCopy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'uncertainAssetScriptsCopy' +type MockScriptStorageState_uncertainAssetScriptsCopy_Call struct { + *mock.Call +} + +// uncertainAssetScriptsCopy is a helper method to define mock.On call +func (_e *MockScriptStorageState_Expecter) uncertainAssetScriptsCopy() *MockScriptStorageState_uncertainAssetScriptsCopy_Call { + return &MockScriptStorageState_uncertainAssetScriptsCopy_Call{Call: _e.mock.On("uncertainAssetScriptsCopy")} +} + +func (_c *MockScriptStorageState_uncertainAssetScriptsCopy_Call) Run(run func()) *MockScriptStorageState_uncertainAssetScriptsCopy_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockScriptStorageState_uncertainAssetScriptsCopy_Call) Return(assetIDToAssetScriptRecordWithAssetIDTailMoqParam map[proto.AssetID]assetScriptRecordWithAssetIDTail) *MockScriptStorageState_uncertainAssetScriptsCopy_Call { + _c.Call.Return(assetIDToAssetScriptRecordWithAssetIDTailMoqParam) + return _c +} + +func (_c *MockScriptStorageState_uncertainAssetScriptsCopy_Call) RunAndReturn(run func() map[proto.AssetID]assetScriptRecordWithAssetIDTail) *MockScriptStorageState_uncertainAssetScriptsCopy_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/state/mock_state.go b/pkg/state/mock_state.go new file mode 100644 index 0000000000..f330583cfd --- /dev/null +++ b/pkg/state/mock_state.go @@ -0,0 +1,5081 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package state + +import ( + "math/big" + + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/crypto" + "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/ride/ast" + "github.com/wavesplatform/gowaves/pkg/settings" +) + +// NewMockState creates a new instance of MockState. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockState(t interface { + mock.TestingT + Cleanup(func()) +}) *MockState { + mock := &MockState{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockState is an autogenerated mock type for the State type +type MockState struct { + mock.Mock +} + +type MockState_Expecter struct { + mock *mock.Mock +} + +func (_m *MockState) EXPECT() *MockState_Expecter { + return &MockState_Expecter{mock: &_m.Mock} +} + +// ActivationHeight provides a mock function for the type MockState +func (_mock *MockState) ActivationHeight(featureID int16) (proto.Height, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for ActivationHeight") + } + + var r0 proto.Height + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (proto.Height, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) proto.Height); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(proto.Height) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ActivationHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ActivationHeight' +type MockState_ActivationHeight_Call struct { + *mock.Call +} + +// ActivationHeight is a helper method to define mock.On call +// - featureID int16 +func (_e *MockState_Expecter) ActivationHeight(featureID interface{}) *MockState_ActivationHeight_Call { + return &MockState_ActivationHeight_Call{Call: _e.mock.On("ActivationHeight", featureID)} +} + +func (_c *MockState_ActivationHeight_Call) Run(run func(featureID int16)) *MockState_ActivationHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_ActivationHeight_Call) Return(v proto.Height, err error) *MockState_ActivationHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_ActivationHeight_Call) RunAndReturn(run func(featureID int16) (proto.Height, error)) *MockState_ActivationHeight_Call { + _c.Call.Return(run) + return _c +} + +// AddBlock provides a mock function for the type MockState +func (_mock *MockState) AddBlock(block []byte) (*proto.Block, error) { + ret := _mock.Called(block) + + if len(ret) == 0 { + panic("no return value specified for AddBlock") + } + + var r0 *proto.Block + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (*proto.Block, error)); ok { + return returnFunc(block) + } + if returnFunc, ok := ret.Get(0).(func([]byte) *proto.Block); ok { + r0 = returnFunc(block) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.Block) + } + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(block) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AddBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddBlock' +type MockState_AddBlock_Call struct { + *mock.Call +} + +// AddBlock is a helper method to define mock.On call +// - block []byte +func (_e *MockState_Expecter) AddBlock(block interface{}) *MockState_AddBlock_Call { + return &MockState_AddBlock_Call{Call: _e.mock.On("AddBlock", block)} +} + +func (_c *MockState_AddBlock_Call) Run(run func(block []byte)) *MockState_AddBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_AddBlock_Call) Return(block1 *proto.Block, err error) *MockState_AddBlock_Call { + _c.Call.Return(block1, err) + return _c +} + +func (_c *MockState_AddBlock_Call) RunAndReturn(run func(block []byte) (*proto.Block, error)) *MockState_AddBlock_Call { + _c.Call.Return(run) + return _c +} + +// AddBlocks provides a mock function for the type MockState +func (_mock *MockState) AddBlocks(blocks [][]byte) error { + ret := _mock.Called(blocks) + + if len(ret) == 0 { + panic("no return value specified for AddBlocks") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([][]byte) error); ok { + r0 = returnFunc(blocks) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_AddBlocks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddBlocks' +type MockState_AddBlocks_Call struct { + *mock.Call +} + +// AddBlocks is a helper method to define mock.On call +// - blocks [][]byte +func (_e *MockState_Expecter) AddBlocks(blocks interface{}) *MockState_AddBlocks_Call { + return &MockState_AddBlocks_Call{Call: _e.mock.On("AddBlocks", blocks)} +} + +func (_c *MockState_AddBlocks_Call) Run(run func(blocks [][]byte)) *MockState_AddBlocks_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 [][]byte + if args[0] != nil { + arg0 = args[0].([][]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_AddBlocks_Call) Return(err error) *MockState_AddBlocks_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_AddBlocks_Call) RunAndReturn(run func(blocks [][]byte) error) *MockState_AddBlocks_Call { + _c.Call.Return(run) + return _c +} + +// AddBlocksWithSnapshots provides a mock function for the type MockState +func (_mock *MockState) AddBlocksWithSnapshots(blocks [][]byte, snapshots []*proto.BlockSnapshot) error { + ret := _mock.Called(blocks, snapshots) + + if len(ret) == 0 { + panic("no return value specified for AddBlocksWithSnapshots") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func([][]byte, []*proto.BlockSnapshot) error); ok { + r0 = returnFunc(blocks, snapshots) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_AddBlocksWithSnapshots_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddBlocksWithSnapshots' +type MockState_AddBlocksWithSnapshots_Call struct { + *mock.Call +} + +// AddBlocksWithSnapshots is a helper method to define mock.On call +// - blocks [][]byte +// - snapshots []*proto.BlockSnapshot +func (_e *MockState_Expecter) AddBlocksWithSnapshots(blocks interface{}, snapshots interface{}) *MockState_AddBlocksWithSnapshots_Call { + return &MockState_AddBlocksWithSnapshots_Call{Call: _e.mock.On("AddBlocksWithSnapshots", blocks, snapshots)} +} + +func (_c *MockState_AddBlocksWithSnapshots_Call) Run(run func(blocks [][]byte, snapshots []*proto.BlockSnapshot)) *MockState_AddBlocksWithSnapshots_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 [][]byte + if args[0] != nil { + arg0 = args[0].([][]byte) + } + var arg1 []*proto.BlockSnapshot + if args[1] != nil { + arg1 = args[1].([]*proto.BlockSnapshot) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_AddBlocksWithSnapshots_Call) Return(err error) *MockState_AddBlocksWithSnapshots_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_AddBlocksWithSnapshots_Call) RunAndReturn(run func(blocks [][]byte, snapshots []*proto.BlockSnapshot) error) *MockState_AddBlocksWithSnapshots_Call { + _c.Call.Return(run) + return _c +} + +// AddDeserializedBlock provides a mock function for the type MockState +func (_mock *MockState) AddDeserializedBlock(block *proto.Block) (*proto.Block, error) { + ret := _mock.Called(block) + + if len(ret) == 0 { + panic("no return value specified for AddDeserializedBlock") + } + + var r0 *proto.Block + var r1 error + if returnFunc, ok := ret.Get(0).(func(*proto.Block) (*proto.Block, error)); ok { + return returnFunc(block) + } + if returnFunc, ok := ret.Get(0).(func(*proto.Block) *proto.Block); ok { + r0 = returnFunc(block) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.Block) + } + } + if returnFunc, ok := ret.Get(1).(func(*proto.Block) error); ok { + r1 = returnFunc(block) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AddDeserializedBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddDeserializedBlock' +type MockState_AddDeserializedBlock_Call struct { + *mock.Call +} + +// AddDeserializedBlock is a helper method to define mock.On call +// - block *proto.Block +func (_e *MockState_Expecter) AddDeserializedBlock(block interface{}) *MockState_AddDeserializedBlock_Call { + return &MockState_AddDeserializedBlock_Call{Call: _e.mock.On("AddDeserializedBlock", block)} +} + +func (_c *MockState_AddDeserializedBlock_Call) Run(run func(block *proto.Block)) *MockState_AddDeserializedBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *proto.Block + if args[0] != nil { + arg0 = args[0].(*proto.Block) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_AddDeserializedBlock_Call) Return(block1 *proto.Block, err error) *MockState_AddDeserializedBlock_Call { + _c.Call.Return(block1, err) + return _c +} + +func (_c *MockState_AddDeserializedBlock_Call) RunAndReturn(run func(block *proto.Block) (*proto.Block, error)) *MockState_AddDeserializedBlock_Call { + _c.Call.Return(run) + return _c +} + +// AddDeserializedBlocks provides a mock function for the type MockState +func (_mock *MockState) AddDeserializedBlocks(blocks []*proto.Block) (*proto.Block, error) { + ret := _mock.Called(blocks) + + if len(ret) == 0 { + panic("no return value specified for AddDeserializedBlocks") + } + + var r0 *proto.Block + var r1 error + if returnFunc, ok := ret.Get(0).(func([]*proto.Block) (*proto.Block, error)); ok { + return returnFunc(blocks) + } + if returnFunc, ok := ret.Get(0).(func([]*proto.Block) *proto.Block); ok { + r0 = returnFunc(blocks) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.Block) + } + } + if returnFunc, ok := ret.Get(1).(func([]*proto.Block) error); ok { + r1 = returnFunc(blocks) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AddDeserializedBlocks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddDeserializedBlocks' +type MockState_AddDeserializedBlocks_Call struct { + *mock.Call +} + +// AddDeserializedBlocks is a helper method to define mock.On call +// - blocks []*proto.Block +func (_e *MockState_Expecter) AddDeserializedBlocks(blocks interface{}) *MockState_AddDeserializedBlocks_Call { + return &MockState_AddDeserializedBlocks_Call{Call: _e.mock.On("AddDeserializedBlocks", blocks)} +} + +func (_c *MockState_AddDeserializedBlocks_Call) Run(run func(blocks []*proto.Block)) *MockState_AddDeserializedBlocks_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []*proto.Block + if args[0] != nil { + arg0 = args[0].([]*proto.Block) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_AddDeserializedBlocks_Call) Return(block *proto.Block, err error) *MockState_AddDeserializedBlocks_Call { + _c.Call.Return(block, err) + return _c +} + +func (_c *MockState_AddDeserializedBlocks_Call) RunAndReturn(run func(blocks []*proto.Block) (*proto.Block, error)) *MockState_AddDeserializedBlocks_Call { + _c.Call.Return(run) + return _c +} + +// AddDeserializedBlocksWithSnapshots provides a mock function for the type MockState +func (_mock *MockState) AddDeserializedBlocksWithSnapshots(blocks []*proto.Block, snapshots []*proto.BlockSnapshot) (*proto.Block, error) { + ret := _mock.Called(blocks, snapshots) + + if len(ret) == 0 { + panic("no return value specified for AddDeserializedBlocksWithSnapshots") + } + + var r0 *proto.Block + var r1 error + if returnFunc, ok := ret.Get(0).(func([]*proto.Block, []*proto.BlockSnapshot) (*proto.Block, error)); ok { + return returnFunc(blocks, snapshots) + } + if returnFunc, ok := ret.Get(0).(func([]*proto.Block, []*proto.BlockSnapshot) *proto.Block); ok { + r0 = returnFunc(blocks, snapshots) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.Block) + } + } + if returnFunc, ok := ret.Get(1).(func([]*proto.Block, []*proto.BlockSnapshot) error); ok { + r1 = returnFunc(blocks, snapshots) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AddDeserializedBlocksWithSnapshots_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddDeserializedBlocksWithSnapshots' +type MockState_AddDeserializedBlocksWithSnapshots_Call struct { + *mock.Call +} + +// AddDeserializedBlocksWithSnapshots is a helper method to define mock.On call +// - blocks []*proto.Block +// - snapshots []*proto.BlockSnapshot +func (_e *MockState_Expecter) AddDeserializedBlocksWithSnapshots(blocks interface{}, snapshots interface{}) *MockState_AddDeserializedBlocksWithSnapshots_Call { + return &MockState_AddDeserializedBlocksWithSnapshots_Call{Call: _e.mock.On("AddDeserializedBlocksWithSnapshots", blocks, snapshots)} +} + +func (_c *MockState_AddDeserializedBlocksWithSnapshots_Call) Run(run func(blocks []*proto.Block, snapshots []*proto.BlockSnapshot)) *MockState_AddDeserializedBlocksWithSnapshots_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []*proto.Block + if args[0] != nil { + arg0 = args[0].([]*proto.Block) + } + var arg1 []*proto.BlockSnapshot + if args[1] != nil { + arg1 = args[1].([]*proto.BlockSnapshot) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_AddDeserializedBlocksWithSnapshots_Call) Return(block *proto.Block, err error) *MockState_AddDeserializedBlocksWithSnapshots_Call { + _c.Call.Return(block, err) + return _c +} + +func (_c *MockState_AddDeserializedBlocksWithSnapshots_Call) RunAndReturn(run func(blocks []*proto.Block, snapshots []*proto.BlockSnapshot) (*proto.Block, error)) *MockState_AddDeserializedBlocksWithSnapshots_Call { + _c.Call.Return(run) + return _c +} + +// AddrByAlias provides a mock function for the type MockState +func (_mock *MockState) AddrByAlias(alias proto.Alias) (proto.WavesAddress, error) { + ret := _mock.Called(alias) + + if len(ret) == 0 { + panic("no return value specified for AddrByAlias") + } + + var r0 proto.WavesAddress + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Alias) (proto.WavesAddress, error)); ok { + return returnFunc(alias) + } + if returnFunc, ok := ret.Get(0).(func(proto.Alias) proto.WavesAddress); ok { + r0 = returnFunc(alias) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.WavesAddress) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Alias) error); ok { + r1 = returnFunc(alias) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AddrByAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddrByAlias' +type MockState_AddrByAlias_Call struct { + *mock.Call +} + +// AddrByAlias is a helper method to define mock.On call +// - alias proto.Alias +func (_e *MockState_Expecter) AddrByAlias(alias interface{}) *MockState_AddrByAlias_Call { + return &MockState_AddrByAlias_Call{Call: _e.mock.On("AddrByAlias", alias)} +} + +func (_c *MockState_AddrByAlias_Call) Run(run func(alias proto.Alias)) *MockState_AddrByAlias_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Alias + if args[0] != nil { + arg0 = args[0].(proto.Alias) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_AddrByAlias_Call) Return(wavesAddress proto.WavesAddress, err error) *MockState_AddrByAlias_Call { + _c.Call.Return(wavesAddress, err) + return _c +} + +func (_c *MockState_AddrByAlias_Call) RunAndReturn(run func(alias proto.Alias) (proto.WavesAddress, error)) *MockState_AddrByAlias_Call { + _c.Call.Return(run) + return _c +} + +// AliasesByAddr provides a mock function for the type MockState +func (_mock *MockState) AliasesByAddr(addr proto.WavesAddress) ([]string, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for AliasesByAddr") + } + + var r0 []string + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) ([]string, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) []string); ok { + r0 = returnFunc(addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AliasesByAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AliasesByAddr' +type MockState_AliasesByAddr_Call struct { + *mock.Call +} + +// AliasesByAddr is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockState_Expecter) AliasesByAddr(addr interface{}) *MockState_AliasesByAddr_Call { + return &MockState_AliasesByAddr_Call{Call: _e.mock.On("AliasesByAddr", addr)} +} + +func (_c *MockState_AliasesByAddr_Call) Run(run func(addr proto.WavesAddress)) *MockState_AliasesByAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_AliasesByAddr_Call) Return(strings []string, err error) *MockState_AliasesByAddr_Call { + _c.Call.Return(strings, err) + return _c +} + +func (_c *MockState_AliasesByAddr_Call) RunAndReturn(run func(addr proto.WavesAddress) ([]string, error)) *MockState_AliasesByAddr_Call { + _c.Call.Return(run) + return _c +} + +// AllFeatures provides a mock function for the type MockState +func (_mock *MockState) AllFeatures() ([]int16, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AllFeatures") + } + + var r0 []int16 + var r1 error + if returnFunc, ok := ret.Get(0).(func() ([]int16, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() []int16); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]int16) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AllFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AllFeatures' +type MockState_AllFeatures_Call struct { + *mock.Call +} + +// AllFeatures is a helper method to define mock.On call +func (_e *MockState_Expecter) AllFeatures() *MockState_AllFeatures_Call { + return &MockState_AllFeatures_Call{Call: _e.mock.On("AllFeatures")} +} + +func (_c *MockState_AllFeatures_Call) Run(run func()) *MockState_AllFeatures_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_AllFeatures_Call) Return(int16s []int16, err error) *MockState_AllFeatures_Call { + _c.Call.Return(int16s, err) + return _c +} + +func (_c *MockState_AllFeatures_Call) RunAndReturn(run func() ([]int16, error)) *MockState_AllFeatures_Call { + _c.Call.Return(run) + return _c +} + +// ApprovalHeight provides a mock function for the type MockState +func (_mock *MockState) ApprovalHeight(featureID int16) (proto.Height, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for ApprovalHeight") + } + + var r0 proto.Height + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (proto.Height, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) proto.Height); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(proto.Height) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ApprovalHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApprovalHeight' +type MockState_ApprovalHeight_Call struct { + *mock.Call +} + +// ApprovalHeight is a helper method to define mock.On call +// - featureID int16 +func (_e *MockState_Expecter) ApprovalHeight(featureID interface{}) *MockState_ApprovalHeight_Call { + return &MockState_ApprovalHeight_Call{Call: _e.mock.On("ApprovalHeight", featureID)} +} + +func (_c *MockState_ApprovalHeight_Call) Run(run func(featureID int16)) *MockState_ApprovalHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_ApprovalHeight_Call) Return(v proto.Height, err error) *MockState_ApprovalHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_ApprovalHeight_Call) RunAndReturn(run func(featureID int16) (proto.Height, error)) *MockState_ApprovalHeight_Call { + _c.Call.Return(run) + return _c +} + +// AssetBalance provides a mock function for the type MockState +func (_mock *MockState) AssetBalance(account proto.Recipient, assetID proto.AssetID) (uint64, error) { + ret := _mock.Called(account, assetID) + + if len(ret) == 0 { + panic("no return value specified for AssetBalance") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, proto.AssetID) (uint64, error)); ok { + return returnFunc(account, assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, proto.AssetID) uint64); ok { + r0 = returnFunc(account, assetID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, proto.AssetID) error); ok { + r1 = returnFunc(account, assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AssetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssetBalance' +type MockState_AssetBalance_Call struct { + *mock.Call +} + +// AssetBalance is a helper method to define mock.On call +// - account proto.Recipient +// - assetID proto.AssetID +func (_e *MockState_Expecter) AssetBalance(account interface{}, assetID interface{}) *MockState_AssetBalance_Call { + return &MockState_AssetBalance_Call{Call: _e.mock.On("AssetBalance", account, assetID)} +} + +func (_c *MockState_AssetBalance_Call) Run(run func(account proto.Recipient, assetID proto.AssetID)) *MockState_AssetBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 proto.AssetID + if args[1] != nil { + arg1 = args[1].(proto.AssetID) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_AssetBalance_Call) Return(v uint64, err error) *MockState_AssetBalance_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_AssetBalance_Call) RunAndReturn(run func(account proto.Recipient, assetID proto.AssetID) (uint64, error)) *MockState_AssetBalance_Call { + _c.Call.Return(run) + return _c +} + +// AssetInfo provides a mock function for the type MockState +func (_mock *MockState) AssetInfo(assetID proto.AssetID) (*proto.AssetInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for AssetInfo") + } + + var r0 *proto.AssetInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (*proto.AssetInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) *proto.AssetInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.AssetInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AssetInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssetInfo' +type MockState_AssetInfo_Call struct { + *mock.Call +} + +// AssetInfo is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockState_Expecter) AssetInfo(assetID interface{}) *MockState_AssetInfo_Call { + return &MockState_AssetInfo_Call{Call: _e.mock.On("AssetInfo", assetID)} +} + +func (_c *MockState_AssetInfo_Call) Run(run func(assetID proto.AssetID)) *MockState_AssetInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_AssetInfo_Call) Return(assetInfo *proto.AssetInfo, err error) *MockState_AssetInfo_Call { + _c.Call.Return(assetInfo, err) + return _c +} + +func (_c *MockState_AssetInfo_Call) RunAndReturn(run func(assetID proto.AssetID) (*proto.AssetInfo, error)) *MockState_AssetInfo_Call { + _c.Call.Return(run) + return _c +} + +// AssetIsSponsored provides a mock function for the type MockState +func (_mock *MockState) AssetIsSponsored(assetID proto.AssetID) (bool, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for AssetIsSponsored") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (bool, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) bool); ok { + r0 = returnFunc(assetID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_AssetIsSponsored_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssetIsSponsored' +type MockState_AssetIsSponsored_Call struct { + *mock.Call +} + +// AssetIsSponsored is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockState_Expecter) AssetIsSponsored(assetID interface{}) *MockState_AssetIsSponsored_Call { + return &MockState_AssetIsSponsored_Call{Call: _e.mock.On("AssetIsSponsored", assetID)} +} + +func (_c *MockState_AssetIsSponsored_Call) Run(run func(assetID proto.AssetID)) *MockState_AssetIsSponsored_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_AssetIsSponsored_Call) Return(b bool, err error) *MockState_AssetIsSponsored_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_AssetIsSponsored_Call) RunAndReturn(run func(assetID proto.AssetID) (bool, error)) *MockState_AssetIsSponsored_Call { + _c.Call.Return(run) + return _c +} + +// Block provides a mock function for the type MockState +func (_mock *MockState) Block(blockID proto.BlockID) (*proto.Block, error) { + ret := _mock.Called(blockID) + + if len(ret) == 0 { + panic("no return value specified for Block") + } + + var r0 *proto.Block + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) (*proto.Block, error)); ok { + return returnFunc(blockID) + } + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) *proto.Block); ok { + r0 = returnFunc(blockID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.Block) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.BlockID) error); ok { + r1 = returnFunc(blockID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_Block_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Block' +type MockState_Block_Call struct { + *mock.Call +} + +// Block is a helper method to define mock.On call +// - blockID proto.BlockID +func (_e *MockState_Expecter) Block(blockID interface{}) *MockState_Block_Call { + return &MockState_Block_Call{Call: _e.mock.On("Block", blockID)} +} + +func (_c *MockState_Block_Call) Run(run func(blockID proto.BlockID)) *MockState_Block_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.BlockID + if args[0] != nil { + arg0 = args[0].(proto.BlockID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_Block_Call) Return(block *proto.Block, err error) *MockState_Block_Call { + _c.Call.Return(block, err) + return _c +} + +func (_c *MockState_Block_Call) RunAndReturn(run func(blockID proto.BlockID) (*proto.Block, error)) *MockState_Block_Call { + _c.Call.Return(run) + return _c +} + +// BlockByHeight provides a mock function for the type MockState +func (_mock *MockState) BlockByHeight(height proto.Height) (*proto.Block, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for BlockByHeight") + } + + var r0 *proto.Block + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (*proto.Block, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) *proto.Block); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.Block) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_BlockByHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockByHeight' +type MockState_BlockByHeight_Call struct { + *mock.Call +} + +// BlockByHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) BlockByHeight(height interface{}) *MockState_BlockByHeight_Call { + return &MockState_BlockByHeight_Call{Call: _e.mock.On("BlockByHeight", height)} +} + +func (_c *MockState_BlockByHeight_Call) Run(run func(height proto.Height)) *MockState_BlockByHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_BlockByHeight_Call) Return(block *proto.Block, err error) *MockState_BlockByHeight_Call { + _c.Call.Return(block, err) + return _c +} + +func (_c *MockState_BlockByHeight_Call) RunAndReturn(run func(height proto.Height) (*proto.Block, error)) *MockState_BlockByHeight_Call { + _c.Call.Return(run) + return _c +} + +// BlockIDToHeight provides a mock function for the type MockState +func (_mock *MockState) BlockIDToHeight(blockID proto.BlockID) (proto.Height, error) { + ret := _mock.Called(blockID) + + if len(ret) == 0 { + panic("no return value specified for BlockIDToHeight") + } + + var r0 proto.Height + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) (proto.Height, error)); ok { + return returnFunc(blockID) + } + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) proto.Height); ok { + r0 = returnFunc(blockID) + } else { + r0 = ret.Get(0).(proto.Height) + } + if returnFunc, ok := ret.Get(1).(func(proto.BlockID) error); ok { + r1 = returnFunc(blockID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_BlockIDToHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockIDToHeight' +type MockState_BlockIDToHeight_Call struct { + *mock.Call +} + +// BlockIDToHeight is a helper method to define mock.On call +// - blockID proto.BlockID +func (_e *MockState_Expecter) BlockIDToHeight(blockID interface{}) *MockState_BlockIDToHeight_Call { + return &MockState_BlockIDToHeight_Call{Call: _e.mock.On("BlockIDToHeight", blockID)} +} + +func (_c *MockState_BlockIDToHeight_Call) Run(run func(blockID proto.BlockID)) *MockState_BlockIDToHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.BlockID + if args[0] != nil { + arg0 = args[0].(proto.BlockID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_BlockIDToHeight_Call) Return(v proto.Height, err error) *MockState_BlockIDToHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_BlockIDToHeight_Call) RunAndReturn(run func(blockID proto.BlockID) (proto.Height, error)) *MockState_BlockIDToHeight_Call { + _c.Call.Return(run) + return _c +} + +// BlockRewards provides a mock function for the type MockState +func (_mock *MockState) BlockRewards(generator proto.WavesAddress, height proto.Height) (proto.Rewards, error) { + ret := _mock.Called(generator, height) + + if len(ret) == 0 { + panic("no return value specified for BlockRewards") + } + + var r0 proto.Rewards + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress, proto.Height) (proto.Rewards, error)); ok { + return returnFunc(generator, height) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress, proto.Height) proto.Rewards); ok { + r0 = returnFunc(generator, height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Rewards) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress, proto.Height) error); ok { + r1 = returnFunc(generator, height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_BlockRewards_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockRewards' +type MockState_BlockRewards_Call struct { + *mock.Call +} + +// BlockRewards is a helper method to define mock.On call +// - generator proto.WavesAddress +// - height proto.Height +func (_e *MockState_Expecter) BlockRewards(generator interface{}, height interface{}) *MockState_BlockRewards_Call { + return &MockState_BlockRewards_Call{Call: _e.mock.On("BlockRewards", generator, height)} +} + +func (_c *MockState_BlockRewards_Call) Run(run func(generator proto.WavesAddress, height proto.Height)) *MockState_BlockRewards_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + var arg1 proto.Height + if args[1] != nil { + arg1 = args[1].(proto.Height) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_BlockRewards_Call) Return(rewards proto.Rewards, err error) *MockState_BlockRewards_Call { + _c.Call.Return(rewards, err) + return _c +} + +func (_c *MockState_BlockRewards_Call) RunAndReturn(run func(generator proto.WavesAddress, height proto.Height) (proto.Rewards, error)) *MockState_BlockRewards_Call { + _c.Call.Return(run) + return _c +} + +// BlockVRF provides a mock function for the type MockState +func (_mock *MockState) BlockVRF(blockHeader *proto.BlockHeader, blockHeight proto.Height) ([]byte, error) { + ret := _mock.Called(blockHeader, blockHeight) + + if len(ret) == 0 { + panic("no return value specified for BlockVRF") + } + + var r0 []byte + var r1 error + if returnFunc, ok := ret.Get(0).(func(*proto.BlockHeader, proto.Height) ([]byte, error)); ok { + return returnFunc(blockHeader, blockHeight) + } + if returnFunc, ok := ret.Get(0).(func(*proto.BlockHeader, proto.Height) []byte); ok { + r0 = returnFunc(blockHeader, blockHeight) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + if returnFunc, ok := ret.Get(1).(func(*proto.BlockHeader, proto.Height) error); ok { + r1 = returnFunc(blockHeader, blockHeight) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_BlockVRF_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockVRF' +type MockState_BlockVRF_Call struct { + *mock.Call +} + +// BlockVRF is a helper method to define mock.On call +// - blockHeader *proto.BlockHeader +// - blockHeight proto.Height +func (_e *MockState_Expecter) BlockVRF(blockHeader interface{}, blockHeight interface{}) *MockState_BlockVRF_Call { + return &MockState_BlockVRF_Call{Call: _e.mock.On("BlockVRF", blockHeader, blockHeight)} +} + +func (_c *MockState_BlockVRF_Call) Run(run func(blockHeader *proto.BlockHeader, blockHeight proto.Height)) *MockState_BlockVRF_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *proto.BlockHeader + if args[0] != nil { + arg0 = args[0].(*proto.BlockHeader) + } + var arg1 proto.Height + if args[1] != nil { + arg1 = args[1].(proto.Height) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_BlockVRF_Call) Return(bytes []byte, err error) *MockState_BlockVRF_Call { + _c.Call.Return(bytes, err) + return _c +} + +func (_c *MockState_BlockVRF_Call) RunAndReturn(run func(blockHeader *proto.BlockHeader, blockHeight proto.Height) ([]byte, error)) *MockState_BlockVRF_Call { + _c.Call.Return(run) + return _c +} + +// BlockchainSettings provides a mock function for the type MockState +func (_mock *MockState) BlockchainSettings() (*settings.BlockchainSettings, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for BlockchainSettings") + } + + var r0 *settings.BlockchainSettings + var r1 error + if returnFunc, ok := ret.Get(0).(func() (*settings.BlockchainSettings, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() *settings.BlockchainSettings); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*settings.BlockchainSettings) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_BlockchainSettings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockchainSettings' +type MockState_BlockchainSettings_Call struct { + *mock.Call +} + +// BlockchainSettings is a helper method to define mock.On call +func (_e *MockState_Expecter) BlockchainSettings() *MockState_BlockchainSettings_Call { + return &MockState_BlockchainSettings_Call{Call: _e.mock.On("BlockchainSettings")} +} + +func (_c *MockState_BlockchainSettings_Call) Run(run func()) *MockState_BlockchainSettings_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_BlockchainSettings_Call) Return(blockchainSettings *settings.BlockchainSettings, err error) *MockState_BlockchainSettings_Call { + _c.Call.Return(blockchainSettings, err) + return _c +} + +func (_c *MockState_BlockchainSettings_Call) RunAndReturn(run func() (*settings.BlockchainSettings, error)) *MockState_BlockchainSettings_Call { + _c.Call.Return(run) + return _c +} + +// Close provides a mock function for the type MockState +func (_mock *MockState) Close() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Close") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type MockState_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *MockState_Expecter) Close() *MockState_Close_Call { + return &MockState_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *MockState_Close_Call) Run(run func()) *MockState_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_Close_Call) Return(err error) *MockState_Close_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_Close_Call) RunAndReturn(run func() error) *MockState_Close_Call { + _c.Call.Return(run) + return _c +} + +// CreateNextSnapshotHash provides a mock function for the type MockState +func (_mock *MockState) CreateNextSnapshotHash(block *proto.Block) (crypto.Digest, error) { + ret := _mock.Called(block) + + if len(ret) == 0 { + panic("no return value specified for CreateNextSnapshotHash") + } + + var r0 crypto.Digest + var r1 error + if returnFunc, ok := ret.Get(0).(func(*proto.Block) (crypto.Digest, error)); ok { + return returnFunc(block) + } + if returnFunc, ok := ret.Get(0).(func(*proto.Block) crypto.Digest); ok { + r0 = returnFunc(block) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(crypto.Digest) + } + } + if returnFunc, ok := ret.Get(1).(func(*proto.Block) error); ok { + r1 = returnFunc(block) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_CreateNextSnapshotHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateNextSnapshotHash' +type MockState_CreateNextSnapshotHash_Call struct { + *mock.Call +} + +// CreateNextSnapshotHash is a helper method to define mock.On call +// - block *proto.Block +func (_e *MockState_Expecter) CreateNextSnapshotHash(block interface{}) *MockState_CreateNextSnapshotHash_Call { + return &MockState_CreateNextSnapshotHash_Call{Call: _e.mock.On("CreateNextSnapshotHash", block)} +} + +func (_c *MockState_CreateNextSnapshotHash_Call) Run(run func(block *proto.Block)) *MockState_CreateNextSnapshotHash_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 *proto.Block + if args[0] != nil { + arg0 = args[0].(*proto.Block) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_CreateNextSnapshotHash_Call) Return(digest crypto.Digest, err error) *MockState_CreateNextSnapshotHash_Call { + _c.Call.Return(digest, err) + return _c +} + +func (_c *MockState_CreateNextSnapshotHash_Call) RunAndReturn(run func(block *proto.Block) (crypto.Digest, error)) *MockState_CreateNextSnapshotHash_Call { + _c.Call.Return(run) + return _c +} + +// CurrentScore provides a mock function for the type MockState +func (_mock *MockState) CurrentScore() (*big.Int, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for CurrentScore") + } + + var r0 *big.Int + var r1 error + if returnFunc, ok := ret.Get(0).(func() (*big.Int, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() *big.Int); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*big.Int) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_CurrentScore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CurrentScore' +type MockState_CurrentScore_Call struct { + *mock.Call +} + +// CurrentScore is a helper method to define mock.On call +func (_e *MockState_Expecter) CurrentScore() *MockState_CurrentScore_Call { + return &MockState_CurrentScore_Call{Call: _e.mock.On("CurrentScore")} +} + +func (_c *MockState_CurrentScore_Call) Run(run func()) *MockState_CurrentScore_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_CurrentScore_Call) Return(intParam *big.Int, err error) *MockState_CurrentScore_Call { + _c.Call.Return(intParam, err) + return _c +} + +func (_c *MockState_CurrentScore_Call) RunAndReturn(run func() (*big.Int, error)) *MockState_CurrentScore_Call { + _c.Call.Return(run) + return _c +} + +// EnrichedFullAssetInfo provides a mock function for the type MockState +func (_mock *MockState) EnrichedFullAssetInfo(assetID proto.AssetID) (*proto.EnrichedFullAssetInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for EnrichedFullAssetInfo") + } + + var r0 *proto.EnrichedFullAssetInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (*proto.EnrichedFullAssetInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) *proto.EnrichedFullAssetInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.EnrichedFullAssetInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_EnrichedFullAssetInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnrichedFullAssetInfo' +type MockState_EnrichedFullAssetInfo_Call struct { + *mock.Call +} + +// EnrichedFullAssetInfo is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockState_Expecter) EnrichedFullAssetInfo(assetID interface{}) *MockState_EnrichedFullAssetInfo_Call { + return &MockState_EnrichedFullAssetInfo_Call{Call: _e.mock.On("EnrichedFullAssetInfo", assetID)} +} + +func (_c *MockState_EnrichedFullAssetInfo_Call) Run(run func(assetID proto.AssetID)) *MockState_EnrichedFullAssetInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_EnrichedFullAssetInfo_Call) Return(enrichedFullAssetInfo *proto.EnrichedFullAssetInfo, err error) *MockState_EnrichedFullAssetInfo_Call { + _c.Call.Return(enrichedFullAssetInfo, err) + return _c +} + +func (_c *MockState_EnrichedFullAssetInfo_Call) RunAndReturn(run func(assetID proto.AssetID) (*proto.EnrichedFullAssetInfo, error)) *MockState_EnrichedFullAssetInfo_Call { + _c.Call.Return(run) + return _c +} + +// EstimatorVersion provides a mock function for the type MockState +func (_mock *MockState) EstimatorVersion() (int, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for EstimatorVersion") + } + + var r0 int + var r1 error + if returnFunc, ok := ret.Get(0).(func() (int, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() int); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(int) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_EstimatorVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EstimatorVersion' +type MockState_EstimatorVersion_Call struct { + *mock.Call +} + +// EstimatorVersion is a helper method to define mock.On call +func (_e *MockState_Expecter) EstimatorVersion() *MockState_EstimatorVersion_Call { + return &MockState_EstimatorVersion_Call{Call: _e.mock.On("EstimatorVersion")} +} + +func (_c *MockState_EstimatorVersion_Call) Run(run func()) *MockState_EstimatorVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_EstimatorVersion_Call) Return(n int, err error) *MockState_EstimatorVersion_Call { + _c.Call.Return(n, err) + return _c +} + +func (_c *MockState_EstimatorVersion_Call) RunAndReturn(run func() (int, error)) *MockState_EstimatorVersion_Call { + _c.Call.Return(run) + return _c +} + +// FullAssetInfo provides a mock function for the type MockState +func (_mock *MockState) FullAssetInfo(assetID proto.AssetID) (*proto.FullAssetInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for FullAssetInfo") + } + + var r0 *proto.FullAssetInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (*proto.FullAssetInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) *proto.FullAssetInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.FullAssetInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_FullAssetInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FullAssetInfo' +type MockState_FullAssetInfo_Call struct { + *mock.Call +} + +// FullAssetInfo is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockState_Expecter) FullAssetInfo(assetID interface{}) *MockState_FullAssetInfo_Call { + return &MockState_FullAssetInfo_Call{Call: _e.mock.On("FullAssetInfo", assetID)} +} + +func (_c *MockState_FullAssetInfo_Call) Run(run func(assetID proto.AssetID)) *MockState_FullAssetInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_FullAssetInfo_Call) Return(fullAssetInfo *proto.FullAssetInfo, err error) *MockState_FullAssetInfo_Call { + _c.Call.Return(fullAssetInfo, err) + return _c +} + +func (_c *MockState_FullAssetInfo_Call) RunAndReturn(run func(assetID proto.AssetID) (*proto.FullAssetInfo, error)) *MockState_FullAssetInfo_Call { + _c.Call.Return(run) + return _c +} + +// FullWavesBalance provides a mock function for the type MockState +func (_mock *MockState) FullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for FullWavesBalance") + } + + var r0 *proto.FullWavesBalance + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (*proto.FullWavesBalance, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) *proto.FullWavesBalance); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.FullWavesBalance) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_FullWavesBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FullWavesBalance' +type MockState_FullWavesBalance_Call struct { + *mock.Call +} + +// FullWavesBalance is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockState_Expecter) FullWavesBalance(account interface{}) *MockState_FullWavesBalance_Call { + return &MockState_FullWavesBalance_Call{Call: _e.mock.On("FullWavesBalance", account)} +} + +func (_c *MockState_FullWavesBalance_Call) Run(run func(account proto.Recipient)) *MockState_FullWavesBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_FullWavesBalance_Call) Return(fullWavesBalance *proto.FullWavesBalance, err error) *MockState_FullWavesBalance_Call { + _c.Call.Return(fullWavesBalance, err) + return _c +} + +func (_c *MockState_FullWavesBalance_Call) RunAndReturn(run func(account proto.Recipient) (*proto.FullWavesBalance, error)) *MockState_FullWavesBalance_Call { + _c.Call.Return(run) + return _c +} + +// GeneratingBalance provides a mock function for the type MockState +func (_mock *MockState) GeneratingBalance(account proto.Recipient, height proto.Height) (uint64, error) { + ret := _mock.Called(account, height) + + if len(ret) == 0 { + panic("no return value specified for GeneratingBalance") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, proto.Height) (uint64, error)); ok { + return returnFunc(account, height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, proto.Height) uint64); ok { + r0 = returnFunc(account, height) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, proto.Height) error); ok { + r1 = returnFunc(account, height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_GeneratingBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GeneratingBalance' +type MockState_GeneratingBalance_Call struct { + *mock.Call +} + +// GeneratingBalance is a helper method to define mock.On call +// - account proto.Recipient +// - height proto.Height +func (_e *MockState_Expecter) GeneratingBalance(account interface{}, height interface{}) *MockState_GeneratingBalance_Call { + return &MockState_GeneratingBalance_Call{Call: _e.mock.On("GeneratingBalance", account, height)} +} + +func (_c *MockState_GeneratingBalance_Call) Run(run func(account proto.Recipient, height proto.Height)) *MockState_GeneratingBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 proto.Height + if args[1] != nil { + arg1 = args[1].(proto.Height) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_GeneratingBalance_Call) Return(v uint64, err error) *MockState_GeneratingBalance_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_GeneratingBalance_Call) RunAndReturn(run func(account proto.Recipient, height proto.Height) (uint64, error)) *MockState_GeneratingBalance_Call { + _c.Call.Return(run) + return _c +} + +// Header provides a mock function for the type MockState +func (_mock *MockState) Header(blockID proto.BlockID) (*proto.BlockHeader, error) { + ret := _mock.Called(blockID) + + if len(ret) == 0 { + panic("no return value specified for Header") + } + + var r0 *proto.BlockHeader + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) (*proto.BlockHeader, error)); ok { + return returnFunc(blockID) + } + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) *proto.BlockHeader); ok { + r0 = returnFunc(blockID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BlockHeader) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.BlockID) error); ok { + r1 = returnFunc(blockID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_Header_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Header' +type MockState_Header_Call struct { + *mock.Call +} + +// Header is a helper method to define mock.On call +// - blockID proto.BlockID +func (_e *MockState_Expecter) Header(blockID interface{}) *MockState_Header_Call { + return &MockState_Header_Call{Call: _e.mock.On("Header", blockID)} +} + +func (_c *MockState_Header_Call) Run(run func(blockID proto.BlockID)) *MockState_Header_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.BlockID + if args[0] != nil { + arg0 = args[0].(proto.BlockID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_Header_Call) Return(blockHeader *proto.BlockHeader, err error) *MockState_Header_Call { + _c.Call.Return(blockHeader, err) + return _c +} + +func (_c *MockState_Header_Call) RunAndReturn(run func(blockID proto.BlockID) (*proto.BlockHeader, error)) *MockState_Header_Call { + _c.Call.Return(run) + return _c +} + +// HeaderByHeight provides a mock function for the type MockState +func (_mock *MockState) HeaderByHeight(height proto.Height) (*proto.BlockHeader, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for HeaderByHeight") + } + + var r0 *proto.BlockHeader + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (*proto.BlockHeader, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) *proto.BlockHeader); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BlockHeader) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_HeaderByHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeaderByHeight' +type MockState_HeaderByHeight_Call struct { + *mock.Call +} + +// HeaderByHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) HeaderByHeight(height interface{}) *MockState_HeaderByHeight_Call { + return &MockState_HeaderByHeight_Call{Call: _e.mock.On("HeaderByHeight", height)} +} + +func (_c *MockState_HeaderByHeight_Call) Run(run func(height proto.Height)) *MockState_HeaderByHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_HeaderByHeight_Call) Return(blockHeader *proto.BlockHeader, err error) *MockState_HeaderByHeight_Call { + _c.Call.Return(blockHeader, err) + return _c +} + +func (_c *MockState_HeaderByHeight_Call) RunAndReturn(run func(height proto.Height) (*proto.BlockHeader, error)) *MockState_HeaderByHeight_Call { + _c.Call.Return(run) + return _c +} + +// Height provides a mock function for the type MockState +func (_mock *MockState) Height() (proto.Height, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Height") + } + + var r0 proto.Height + var r1 error + if returnFunc, ok := ret.Get(0).(func() (proto.Height, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() proto.Height); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(proto.Height) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_Height_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Height' +type MockState_Height_Call struct { + *mock.Call +} + +// Height is a helper method to define mock.On call +func (_e *MockState_Expecter) Height() *MockState_Height_Call { + return &MockState_Height_Call{Call: _e.mock.On("Height")} +} + +func (_c *MockState_Height_Call) Run(run func()) *MockState_Height_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_Height_Call) Return(v proto.Height, err error) *MockState_Height_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_Height_Call) RunAndReturn(run func() (proto.Height, error)) *MockState_Height_Call { + _c.Call.Return(run) + return _c +} + +// HeightToBlockID provides a mock function for the type MockState +func (_mock *MockState) HeightToBlockID(height proto.Height) (proto.BlockID, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for HeightToBlockID") + } + + var r0 proto.BlockID + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (proto.BlockID, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) proto.BlockID); ok { + r0 = returnFunc(height) + } else { + r0 = ret.Get(0).(proto.BlockID) + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_HeightToBlockID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeightToBlockID' +type MockState_HeightToBlockID_Call struct { + *mock.Call +} + +// HeightToBlockID is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) HeightToBlockID(height interface{}) *MockState_HeightToBlockID_Call { + return &MockState_HeightToBlockID_Call{Call: _e.mock.On("HeightToBlockID", height)} +} + +func (_c *MockState_HeightToBlockID_Call) Run(run func(height proto.Height)) *MockState_HeightToBlockID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_HeightToBlockID_Call) Return(blockID proto.BlockID, err error) *MockState_HeightToBlockID_Call { + _c.Call.Return(blockID, err) + return _c +} + +func (_c *MockState_HeightToBlockID_Call) RunAndReturn(run func(height proto.Height) (proto.BlockID, error)) *MockState_HeightToBlockID_Call { + _c.Call.Return(run) + return _c +} + +// HitSourceAtHeight provides a mock function for the type MockState +func (_mock *MockState) HitSourceAtHeight(height proto.Height) ([]byte, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for HitSourceAtHeight") + } + + var r0 []byte + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) ([]byte, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) []byte); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_HitSourceAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HitSourceAtHeight' +type MockState_HitSourceAtHeight_Call struct { + *mock.Call +} + +// HitSourceAtHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) HitSourceAtHeight(height interface{}) *MockState_HitSourceAtHeight_Call { + return &MockState_HitSourceAtHeight_Call{Call: _e.mock.On("HitSourceAtHeight", height)} +} + +func (_c *MockState_HitSourceAtHeight_Call) Run(run func(height proto.Height)) *MockState_HitSourceAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_HitSourceAtHeight_Call) Return(bytes []byte, err error) *MockState_HitSourceAtHeight_Call { + _c.Call.Return(bytes, err) + return _c +} + +func (_c *MockState_HitSourceAtHeight_Call) RunAndReturn(run func(height proto.Height) ([]byte, error)) *MockState_HitSourceAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// InvokeResultByID provides a mock function for the type MockState +func (_mock *MockState) InvokeResultByID(invokeID crypto.Digest) (*proto.ScriptResult, error) { + ret := _mock.Called(invokeID) + + if len(ret) == 0 { + panic("no return value specified for InvokeResultByID") + } + + var r0 *proto.ScriptResult + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*proto.ScriptResult, error)); ok { + return returnFunc(invokeID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *proto.ScriptResult); ok { + r0 = returnFunc(invokeID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.ScriptResult) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(invokeID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_InvokeResultByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InvokeResultByID' +type MockState_InvokeResultByID_Call struct { + *mock.Call +} + +// InvokeResultByID is a helper method to define mock.On call +// - invokeID crypto.Digest +func (_e *MockState_Expecter) InvokeResultByID(invokeID interface{}) *MockState_InvokeResultByID_Call { + return &MockState_InvokeResultByID_Call{Call: _e.mock.On("InvokeResultByID", invokeID)} +} + +func (_c *MockState_InvokeResultByID_Call) Run(run func(invokeID crypto.Digest)) *MockState_InvokeResultByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_InvokeResultByID_Call) Return(scriptResult *proto.ScriptResult, err error) *MockState_InvokeResultByID_Call { + _c.Call.Return(scriptResult, err) + return _c +} + +func (_c *MockState_InvokeResultByID_Call) RunAndReturn(run func(invokeID crypto.Digest) (*proto.ScriptResult, error)) *MockState_InvokeResultByID_Call { + _c.Call.Return(run) + return _c +} + +// IsActivated provides a mock function for the type MockState +func (_mock *MockState) IsActivated(featureID int16) (bool, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for IsActivated") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (bool, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) bool); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_IsActivated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsActivated' +type MockState_IsActivated_Call struct { + *mock.Call +} + +// IsActivated is a helper method to define mock.On call +// - featureID int16 +func (_e *MockState_Expecter) IsActivated(featureID interface{}) *MockState_IsActivated_Call { + return &MockState_IsActivated_Call{Call: _e.mock.On("IsActivated", featureID)} +} + +func (_c *MockState_IsActivated_Call) Run(run func(featureID int16)) *MockState_IsActivated_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_IsActivated_Call) Return(b bool, err error) *MockState_IsActivated_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_IsActivated_Call) RunAndReturn(run func(featureID int16) (bool, error)) *MockState_IsActivated_Call { + _c.Call.Return(run) + return _c +} + +// IsActiveAtHeight provides a mock function for the type MockState +func (_mock *MockState) IsActiveAtHeight(featureID int16, height proto.Height) (bool, error) { + ret := _mock.Called(featureID, height) + + if len(ret) == 0 { + panic("no return value specified for IsActiveAtHeight") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16, proto.Height) (bool, error)); ok { + return returnFunc(featureID, height) + } + if returnFunc, ok := ret.Get(0).(func(int16, proto.Height) bool); ok { + r0 = returnFunc(featureID, height) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16, proto.Height) error); ok { + r1 = returnFunc(featureID, height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_IsActiveAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsActiveAtHeight' +type MockState_IsActiveAtHeight_Call struct { + *mock.Call +} + +// IsActiveAtHeight is a helper method to define mock.On call +// - featureID int16 +// - height proto.Height +func (_e *MockState_Expecter) IsActiveAtHeight(featureID interface{}, height interface{}) *MockState_IsActiveAtHeight_Call { + return &MockState_IsActiveAtHeight_Call{Call: _e.mock.On("IsActiveAtHeight", featureID, height)} +} + +func (_c *MockState_IsActiveAtHeight_Call) Run(run func(featureID int16, height proto.Height)) *MockState_IsActiveAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 proto.Height + if args[1] != nil { + arg1 = args[1].(proto.Height) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_IsActiveAtHeight_Call) Return(b bool, err error) *MockState_IsActiveAtHeight_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_IsActiveAtHeight_Call) RunAndReturn(run func(featureID int16, height proto.Height) (bool, error)) *MockState_IsActiveAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// IsActiveLeasing provides a mock function for the type MockState +func (_mock *MockState) IsActiveLeasing(leaseID crypto.Digest) (bool, error) { + ret := _mock.Called(leaseID) + + if len(ret) == 0 { + panic("no return value specified for IsActiveLeasing") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (bool, error)); ok { + return returnFunc(leaseID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) bool); ok { + r0 = returnFunc(leaseID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(leaseID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_IsActiveLeasing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsActiveLeasing' +type MockState_IsActiveLeasing_Call struct { + *mock.Call +} + +// IsActiveLeasing is a helper method to define mock.On call +// - leaseID crypto.Digest +func (_e *MockState_Expecter) IsActiveLeasing(leaseID interface{}) *MockState_IsActiveLeasing_Call { + return &MockState_IsActiveLeasing_Call{Call: _e.mock.On("IsActiveLeasing", leaseID)} +} + +func (_c *MockState_IsActiveLeasing_Call) Run(run func(leaseID crypto.Digest)) *MockState_IsActiveLeasing_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_IsActiveLeasing_Call) Return(b bool, err error) *MockState_IsActiveLeasing_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_IsActiveLeasing_Call) RunAndReturn(run func(leaseID crypto.Digest) (bool, error)) *MockState_IsActiveLeasing_Call { + _c.Call.Return(run) + return _c +} + +// IsActiveLightNodeNewBlocksFields provides a mock function for the type MockState +func (_mock *MockState) IsActiveLightNodeNewBlocksFields(blockHeight proto.Height) (bool, error) { + ret := _mock.Called(blockHeight) + + if len(ret) == 0 { + panic("no return value specified for IsActiveLightNodeNewBlocksFields") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (bool, error)); ok { + return returnFunc(blockHeight) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) bool); ok { + r0 = returnFunc(blockHeight) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(blockHeight) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_IsActiveLightNodeNewBlocksFields_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsActiveLightNodeNewBlocksFields' +type MockState_IsActiveLightNodeNewBlocksFields_Call struct { + *mock.Call +} + +// IsActiveLightNodeNewBlocksFields is a helper method to define mock.On call +// - blockHeight proto.Height +func (_e *MockState_Expecter) IsActiveLightNodeNewBlocksFields(blockHeight interface{}) *MockState_IsActiveLightNodeNewBlocksFields_Call { + return &MockState_IsActiveLightNodeNewBlocksFields_Call{Call: _e.mock.On("IsActiveLightNodeNewBlocksFields", blockHeight)} +} + +func (_c *MockState_IsActiveLightNodeNewBlocksFields_Call) Run(run func(blockHeight proto.Height)) *MockState_IsActiveLightNodeNewBlocksFields_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_IsActiveLightNodeNewBlocksFields_Call) Return(b bool, err error) *MockState_IsActiveLightNodeNewBlocksFields_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_IsActiveLightNodeNewBlocksFields_Call) RunAndReturn(run func(blockHeight proto.Height) (bool, error)) *MockState_IsActiveLightNodeNewBlocksFields_Call { + _c.Call.Return(run) + return _c +} + +// IsApproved provides a mock function for the type MockState +func (_mock *MockState) IsApproved(featureID int16) (bool, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for IsApproved") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (bool, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) bool); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_IsApproved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsApproved' +type MockState_IsApproved_Call struct { + *mock.Call +} + +// IsApproved is a helper method to define mock.On call +// - featureID int16 +func (_e *MockState_Expecter) IsApproved(featureID interface{}) *MockState_IsApproved_Call { + return &MockState_IsApproved_Call{Call: _e.mock.On("IsApproved", featureID)} +} + +func (_c *MockState_IsApproved_Call) Run(run func(featureID int16)) *MockState_IsApproved_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_IsApproved_Call) Return(b bool, err error) *MockState_IsApproved_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_IsApproved_Call) RunAndReturn(run func(featureID int16) (bool, error)) *MockState_IsApproved_Call { + _c.Call.Return(run) + return _c +} + +// IsApprovedAtHeight provides a mock function for the type MockState +func (_mock *MockState) IsApprovedAtHeight(featureID int16, height proto.Height) (bool, error) { + ret := _mock.Called(featureID, height) + + if len(ret) == 0 { + panic("no return value specified for IsApprovedAtHeight") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16, proto.Height) (bool, error)); ok { + return returnFunc(featureID, height) + } + if returnFunc, ok := ret.Get(0).(func(int16, proto.Height) bool); ok { + r0 = returnFunc(featureID, height) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(int16, proto.Height) error); ok { + r1 = returnFunc(featureID, height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_IsApprovedAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsApprovedAtHeight' +type MockState_IsApprovedAtHeight_Call struct { + *mock.Call +} + +// IsApprovedAtHeight is a helper method to define mock.On call +// - featureID int16 +// - height proto.Height +func (_e *MockState_Expecter) IsApprovedAtHeight(featureID interface{}, height interface{}) *MockState_IsApprovedAtHeight_Call { + return &MockState_IsApprovedAtHeight_Call{Call: _e.mock.On("IsApprovedAtHeight", featureID, height)} +} + +func (_c *MockState_IsApprovedAtHeight_Call) Run(run func(featureID int16, height proto.Height)) *MockState_IsApprovedAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 proto.Height + if args[1] != nil { + arg1 = args[1].(proto.Height) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_IsApprovedAtHeight_Call) Return(b bool, err error) *MockState_IsApprovedAtHeight_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_IsApprovedAtHeight_Call) RunAndReturn(run func(featureID int16, height proto.Height) (bool, error)) *MockState_IsApprovedAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// IsAssetExist provides a mock function for the type MockState +func (_mock *MockState) IsAssetExist(assetID proto.AssetID) (bool, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for IsAssetExist") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (bool, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) bool); ok { + r0 = returnFunc(assetID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_IsAssetExist_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsAssetExist' +type MockState_IsAssetExist_Call struct { + *mock.Call +} + +// IsAssetExist is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockState_Expecter) IsAssetExist(assetID interface{}) *MockState_IsAssetExist_Call { + return &MockState_IsAssetExist_Call{Call: _e.mock.On("IsAssetExist", assetID)} +} + +func (_c *MockState_IsAssetExist_Call) Run(run func(assetID proto.AssetID)) *MockState_IsAssetExist_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_IsAssetExist_Call) Return(b bool, err error) *MockState_IsAssetExist_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_IsAssetExist_Call) RunAndReturn(run func(assetID proto.AssetID) (bool, error)) *MockState_IsAssetExist_Call { + _c.Call.Return(run) + return _c +} + +// LegacyStateHashAtHeight provides a mock function for the type MockState +func (_mock *MockState) LegacyStateHashAtHeight(height proto.Height) (*proto.StateHash, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for LegacyStateHashAtHeight") + } + + var r0 *proto.StateHash + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (*proto.StateHash, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) *proto.StateHash); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.StateHash) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_LegacyStateHashAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LegacyStateHashAtHeight' +type MockState_LegacyStateHashAtHeight_Call struct { + *mock.Call +} + +// LegacyStateHashAtHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) LegacyStateHashAtHeight(height interface{}) *MockState_LegacyStateHashAtHeight_Call { + return &MockState_LegacyStateHashAtHeight_Call{Call: _e.mock.On("LegacyStateHashAtHeight", height)} +} + +func (_c *MockState_LegacyStateHashAtHeight_Call) Run(run func(height proto.Height)) *MockState_LegacyStateHashAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_LegacyStateHashAtHeight_Call) Return(stateHash *proto.StateHash, err error) *MockState_LegacyStateHashAtHeight_Call { + _c.Call.Return(stateHash, err) + return _c +} + +func (_c *MockState_LegacyStateHashAtHeight_Call) RunAndReturn(run func(height proto.Height) (*proto.StateHash, error)) *MockState_LegacyStateHashAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// Map provides a mock function for the type MockState +func (_mock *MockState) Map(fn func(state NonThreadSafeState) error) error { + ret := _mock.Called(fn) + + if len(ret) == 0 { + panic("no return value specified for Map") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(func(state NonThreadSafeState) error) error); ok { + r0 = returnFunc(fn) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_Map_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Map' +type MockState_Map_Call struct { + *mock.Call +} + +// Map is a helper method to define mock.On call +// - fn func(state NonThreadSafeState) error +func (_e *MockState_Expecter) Map(fn interface{}) *MockState_Map_Call { + return &MockState_Map_Call{Call: _e.mock.On("Map", fn)} +} + +func (_c *MockState_Map_Call) Run(run func(fn func(state NonThreadSafeState) error)) *MockState_Map_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 func(state NonThreadSafeState) error + if args[0] != nil { + arg0 = args[0].(func(state NonThreadSafeState) error) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_Map_Call) Return(err error) *MockState_Map_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_Map_Call) RunAndReturn(run func(fn func(state NonThreadSafeState) error) error) *MockState_Map_Call { + _c.Call.Return(run) + return _c +} + +// MapR provides a mock function for the type MockState +func (_mock *MockState) MapR(fn func(StateInfo) (any, error)) (any, error) { + ret := _mock.Called(fn) + + if len(ret) == 0 { + panic("no return value specified for MapR") + } + + var r0 any + var r1 error + if returnFunc, ok := ret.Get(0).(func(func(StateInfo) (any, error)) (any, error)); ok { + return returnFunc(fn) + } + if returnFunc, ok := ret.Get(0).(func(func(StateInfo) (any, error)) any); ok { + r0 = returnFunc(fn) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(any) + } + } + if returnFunc, ok := ret.Get(1).(func(func(StateInfo) (any, error)) error); ok { + r1 = returnFunc(fn) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_MapR_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MapR' +type MockState_MapR_Call struct { + *mock.Call +} + +// MapR is a helper method to define mock.On call +// - fn func(StateInfo) (any, error) +func (_e *MockState_Expecter) MapR(fn interface{}) *MockState_MapR_Call { + return &MockState_MapR_Call{Call: _e.mock.On("MapR", fn)} +} + +func (_c *MockState_MapR_Call) Run(run func(fn func(StateInfo) (any, error))) *MockState_MapR_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 func(StateInfo) (any, error) + if args[0] != nil { + arg0 = args[0].(func(StateInfo) (any, error)) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_MapR_Call) Return(v any, err error) *MockState_MapR_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_MapR_Call) RunAndReturn(run func(fn func(StateInfo) (any, error)) (any, error)) *MockState_MapR_Call { + _c.Call.Return(run) + return _c +} + +// MapUnsafe provides a mock function for the type MockState +func (_mock *MockState) MapUnsafe(fn func(state NonThreadSafeState) error) error { + ret := _mock.Called(fn) + + if len(ret) == 0 { + panic("no return value specified for MapUnsafe") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(func(state NonThreadSafeState) error) error); ok { + r0 = returnFunc(fn) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_MapUnsafe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MapUnsafe' +type MockState_MapUnsafe_Call struct { + *mock.Call +} + +// MapUnsafe is a helper method to define mock.On call +// - fn func(state NonThreadSafeState) error +func (_e *MockState_Expecter) MapUnsafe(fn interface{}) *MockState_MapUnsafe_Call { + return &MockState_MapUnsafe_Call{Call: _e.mock.On("MapUnsafe", fn)} +} + +func (_c *MockState_MapUnsafe_Call) Run(run func(fn func(state NonThreadSafeState) error)) *MockState_MapUnsafe_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 func(state NonThreadSafeState) error + if args[0] != nil { + arg0 = args[0].(func(state NonThreadSafeState) error) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_MapUnsafe_Call) Return(err error) *MockState_MapUnsafe_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_MapUnsafe_Call) RunAndReturn(run func(fn func(state NonThreadSafeState) error) error) *MockState_MapUnsafe_Call { + _c.Call.Return(run) + return _c +} + +// NFTList provides a mock function for the type MockState +func (_mock *MockState) NFTList(account proto.Recipient, limit uint64, afterAssetID *proto.AssetID) ([]*proto.FullAssetInfo, error) { + ret := _mock.Called(account, limit, afterAssetID) + + if len(ret) == 0 { + panic("no return value specified for NFTList") + } + + var r0 []*proto.FullAssetInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, uint64, *proto.AssetID) ([]*proto.FullAssetInfo, error)); ok { + return returnFunc(account, limit, afterAssetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, uint64, *proto.AssetID) []*proto.FullAssetInfo); ok { + r0 = returnFunc(account, limit, afterAssetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*proto.FullAssetInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, uint64, *proto.AssetID) error); ok { + r1 = returnFunc(account, limit, afterAssetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_NFTList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NFTList' +type MockState_NFTList_Call struct { + *mock.Call +} + +// NFTList is a helper method to define mock.On call +// - account proto.Recipient +// - limit uint64 +// - afterAssetID *proto.AssetID +func (_e *MockState_Expecter) NFTList(account interface{}, limit interface{}, afterAssetID interface{}) *MockState_NFTList_Call { + return &MockState_NFTList_Call{Call: _e.mock.On("NFTList", account, limit, afterAssetID)} +} + +func (_c *MockState_NFTList_Call) Run(run func(account proto.Recipient, limit uint64, afterAssetID *proto.AssetID)) *MockState_NFTList_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 uint64 + if args[1] != nil { + arg1 = args[1].(uint64) + } + var arg2 *proto.AssetID + if args[2] != nil { + arg2 = args[2].(*proto.AssetID) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockState_NFTList_Call) Return(fullAssetInfos []*proto.FullAssetInfo, err error) *MockState_NFTList_Call { + _c.Call.Return(fullAssetInfos, err) + return _c +} + +func (_c *MockState_NFTList_Call) RunAndReturn(run func(account proto.Recipient, limit uint64, afterAssetID *proto.AssetID) ([]*proto.FullAssetInfo, error)) *MockState_NFTList_Call { + _c.Call.Return(run) + return _c +} + +// NewAddrTransactionsIterator provides a mock function for the type MockState +func (_mock *MockState) NewAddrTransactionsIterator(addr proto.Address) (TransactionIterator, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for NewAddrTransactionsIterator") + } + + var r0 TransactionIterator + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Address) (TransactionIterator, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.Address) TransactionIterator); ok { + r0 = returnFunc(addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(TransactionIterator) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Address) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_NewAddrTransactionsIterator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewAddrTransactionsIterator' +type MockState_NewAddrTransactionsIterator_Call struct { + *mock.Call +} + +// NewAddrTransactionsIterator is a helper method to define mock.On call +// - addr proto.Address +func (_e *MockState_Expecter) NewAddrTransactionsIterator(addr interface{}) *MockState_NewAddrTransactionsIterator_Call { + return &MockState_NewAddrTransactionsIterator_Call{Call: _e.mock.On("NewAddrTransactionsIterator", addr)} +} + +func (_c *MockState_NewAddrTransactionsIterator_Call) Run(run func(addr proto.Address)) *MockState_NewAddrTransactionsIterator_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Address + if args[0] != nil { + arg0 = args[0].(proto.Address) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_NewAddrTransactionsIterator_Call) Return(transactionIterator TransactionIterator, err error) *MockState_NewAddrTransactionsIterator_Call { + _c.Call.Return(transactionIterator, err) + return _c +} + +func (_c *MockState_NewAddrTransactionsIterator_Call) RunAndReturn(run func(addr proto.Address) (TransactionIterator, error)) *MockState_NewAddrTransactionsIterator_Call { + _c.Call.Return(run) + return _c +} + +// NewestBlockInfoByHeight provides a mock function for the type MockState +func (_mock *MockState) NewestBlockInfoByHeight(height proto.Height) (*proto.BlockInfo, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for NewestBlockInfoByHeight") + } + + var r0 *proto.BlockInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (*proto.BlockInfo, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) *proto.BlockInfo); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BlockInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_NewestBlockInfoByHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestBlockInfoByHeight' +type MockState_NewestBlockInfoByHeight_Call struct { + *mock.Call +} + +// NewestBlockInfoByHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) NewestBlockInfoByHeight(height interface{}) *MockState_NewestBlockInfoByHeight_Call { + return &MockState_NewestBlockInfoByHeight_Call{Call: _e.mock.On("NewestBlockInfoByHeight", height)} +} + +func (_c *MockState_NewestBlockInfoByHeight_Call) Run(run func(height proto.Height)) *MockState_NewestBlockInfoByHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_NewestBlockInfoByHeight_Call) Return(blockInfo *proto.BlockInfo, err error) *MockState_NewestBlockInfoByHeight_Call { + _c.Call.Return(blockInfo, err) + return _c +} + +func (_c *MockState_NewestBlockInfoByHeight_Call) RunAndReturn(run func(height proto.Height) (*proto.BlockInfo, error)) *MockState_NewestBlockInfoByHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewestHeaderByHeight provides a mock function for the type MockState +func (_mock *MockState) NewestHeaderByHeight(height uint64) (*proto.BlockHeader, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for NewestHeaderByHeight") + } + + var r0 *proto.BlockHeader + var r1 error + if returnFunc, ok := ret.Get(0).(func(uint64) (*proto.BlockHeader, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(uint64) *proto.BlockHeader); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BlockHeader) + } + } + if returnFunc, ok := ret.Get(1).(func(uint64) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_NewestHeaderByHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestHeaderByHeight' +type MockState_NewestHeaderByHeight_Call struct { + *mock.Call +} + +// NewestHeaderByHeight is a helper method to define mock.On call +// - height uint64 +func (_e *MockState_Expecter) NewestHeaderByHeight(height interface{}) *MockState_NewestHeaderByHeight_Call { + return &MockState_NewestHeaderByHeight_Call{Call: _e.mock.On("NewestHeaderByHeight", height)} +} + +func (_c *MockState_NewestHeaderByHeight_Call) Run(run func(height uint64)) *MockState_NewestHeaderByHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 uint64 + if args[0] != nil { + arg0 = args[0].(uint64) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_NewestHeaderByHeight_Call) Return(blockHeader *proto.BlockHeader, err error) *MockState_NewestHeaderByHeight_Call { + _c.Call.Return(blockHeader, err) + return _c +} + +func (_c *MockState_NewestHeaderByHeight_Call) RunAndReturn(run func(height uint64) (*proto.BlockHeader, error)) *MockState_NewestHeaderByHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptByAccount provides a mock function for the type MockState +func (_mock *MockState) NewestScriptByAccount(account proto.Recipient) (*ast.Tree, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptByAccount") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (*ast.Tree, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) *ast.Tree); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_NewestScriptByAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptByAccount' +type MockState_NewestScriptByAccount_Call struct { + *mock.Call +} + +// NewestScriptByAccount is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockState_Expecter) NewestScriptByAccount(account interface{}) *MockState_NewestScriptByAccount_Call { + return &MockState_NewestScriptByAccount_Call{Call: _e.mock.On("NewestScriptByAccount", account)} +} + +func (_c *MockState_NewestScriptByAccount_Call) Run(run func(account proto.Recipient)) *MockState_NewestScriptByAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_NewestScriptByAccount_Call) Return(tree *ast.Tree, err error) *MockState_NewestScriptByAccount_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockState_NewestScriptByAccount_Call) RunAndReturn(run func(account proto.Recipient) (*ast.Tree, error)) *MockState_NewestScriptByAccount_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptBytesByAccount provides a mock function for the type MockState +func (_mock *MockState) NewestScriptBytesByAccount(account proto.Recipient) (proto.Script, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptBytesByAccount") + } + + var r0 proto.Script + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (proto.Script, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) proto.Script); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Script) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_NewestScriptBytesByAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptBytesByAccount' +type MockState_NewestScriptBytesByAccount_Call struct { + *mock.Call +} + +// NewestScriptBytesByAccount is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockState_Expecter) NewestScriptBytesByAccount(account interface{}) *MockState_NewestScriptBytesByAccount_Call { + return &MockState_NewestScriptBytesByAccount_Call{Call: _e.mock.On("NewestScriptBytesByAccount", account)} +} + +func (_c *MockState_NewestScriptBytesByAccount_Call) Run(run func(account proto.Recipient)) *MockState_NewestScriptBytesByAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_NewestScriptBytesByAccount_Call) Return(script proto.Script, err error) *MockState_NewestScriptBytesByAccount_Call { + _c.Call.Return(script, err) + return _c +} + +func (_c *MockState_NewestScriptBytesByAccount_Call) RunAndReturn(run func(account proto.Recipient) (proto.Script, error)) *MockState_NewestScriptBytesByAccount_Call { + _c.Call.Return(run) + return _c +} + +// PersistAddressTransactions provides a mock function for the type MockState +func (_mock *MockState) PersistAddressTransactions() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for PersistAddressTransactions") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_PersistAddressTransactions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PersistAddressTransactions' +type MockState_PersistAddressTransactions_Call struct { + *mock.Call +} + +// PersistAddressTransactions is a helper method to define mock.On call +func (_e *MockState_Expecter) PersistAddressTransactions() *MockState_PersistAddressTransactions_Call { + return &MockState_PersistAddressTransactions_Call{Call: _e.mock.On("PersistAddressTransactions")} +} + +func (_c *MockState_PersistAddressTransactions_Call) Run(run func()) *MockState_PersistAddressTransactions_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_PersistAddressTransactions_Call) Return(err error) *MockState_PersistAddressTransactions_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_PersistAddressTransactions_Call) RunAndReturn(run func() error) *MockState_PersistAddressTransactions_Call { + _c.Call.Return(run) + return _c +} + +// ProvidesExtendedApi provides a mock function for the type MockState +func (_mock *MockState) ProvidesExtendedApi() (bool, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for ProvidesExtendedApi") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func() (bool, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ProvidesExtendedApi_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProvidesExtendedApi' +type MockState_ProvidesExtendedApi_Call struct { + *mock.Call +} + +// ProvidesExtendedApi is a helper method to define mock.On call +func (_e *MockState_Expecter) ProvidesExtendedApi() *MockState_ProvidesExtendedApi_Call { + return &MockState_ProvidesExtendedApi_Call{Call: _e.mock.On("ProvidesExtendedApi")} +} + +func (_c *MockState_ProvidesExtendedApi_Call) Run(run func()) *MockState_ProvidesExtendedApi_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_ProvidesExtendedApi_Call) Return(b bool, err error) *MockState_ProvidesExtendedApi_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_ProvidesExtendedApi_Call) RunAndReturn(run func() (bool, error)) *MockState_ProvidesExtendedApi_Call { + _c.Call.Return(run) + return _c +} + +// ProvidesStateHashes provides a mock function for the type MockState +func (_mock *MockState) ProvidesStateHashes() (bool, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for ProvidesStateHashes") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func() (bool, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ProvidesStateHashes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProvidesStateHashes' +type MockState_ProvidesStateHashes_Call struct { + *mock.Call +} + +// ProvidesStateHashes is a helper method to define mock.On call +func (_e *MockState_Expecter) ProvidesStateHashes() *MockState_ProvidesStateHashes_Call { + return &MockState_ProvidesStateHashes_Call{Call: _e.mock.On("ProvidesStateHashes")} +} + +func (_c *MockState_ProvidesStateHashes_Call) Run(run func()) *MockState_ProvidesStateHashes_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_ProvidesStateHashes_Call) Return(b bool, err error) *MockState_ProvidesStateHashes_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_ProvidesStateHashes_Call) RunAndReturn(run func() (bool, error)) *MockState_ProvidesStateHashes_Call { + _c.Call.Return(run) + return _c +} + +// ResetValidationList provides a mock function for the type MockState +func (_mock *MockState) ResetValidationList() { + _mock.Called() + return +} + +// MockState_ResetValidationList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResetValidationList' +type MockState_ResetValidationList_Call struct { + *mock.Call +} + +// ResetValidationList is a helper method to define mock.On call +func (_e *MockState_Expecter) ResetValidationList() *MockState_ResetValidationList_Call { + return &MockState_ResetValidationList_Call{Call: _e.mock.On("ResetValidationList")} +} + +func (_c *MockState_ResetValidationList_Call) Run(run func()) *MockState_ResetValidationList_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_ResetValidationList_Call) Return() *MockState_ResetValidationList_Call { + _c.Call.Return() + return _c +} + +func (_c *MockState_ResetValidationList_Call) RunAndReturn(run func()) *MockState_ResetValidationList_Call { + _c.Run(run) + return _c +} + +// RetrieveBinaryEntry provides a mock function for the type MockState +func (_mock *MockState) RetrieveBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveBinaryEntry") + } + + var r0 *proto.BinaryDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.BinaryDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.BinaryDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BinaryDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_RetrieveBinaryEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveBinaryEntry' +type MockState_RetrieveBinaryEntry_Call struct { + *mock.Call +} + +// RetrieveBinaryEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockState_Expecter) RetrieveBinaryEntry(account interface{}, key interface{}) *MockState_RetrieveBinaryEntry_Call { + return &MockState_RetrieveBinaryEntry_Call{Call: _e.mock.On("RetrieveBinaryEntry", account, key)} +} + +func (_c *MockState_RetrieveBinaryEntry_Call) Run(run func(account proto.Recipient, key string)) *MockState_RetrieveBinaryEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_RetrieveBinaryEntry_Call) Return(binaryDataEntry *proto.BinaryDataEntry, err error) *MockState_RetrieveBinaryEntry_Call { + _c.Call.Return(binaryDataEntry, err) + return _c +} + +func (_c *MockState_RetrieveBinaryEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error)) *MockState_RetrieveBinaryEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveBooleanEntry provides a mock function for the type MockState +func (_mock *MockState) RetrieveBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveBooleanEntry") + } + + var r0 *proto.BooleanDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.BooleanDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.BooleanDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BooleanDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_RetrieveBooleanEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveBooleanEntry' +type MockState_RetrieveBooleanEntry_Call struct { + *mock.Call +} + +// RetrieveBooleanEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockState_Expecter) RetrieveBooleanEntry(account interface{}, key interface{}) *MockState_RetrieveBooleanEntry_Call { + return &MockState_RetrieveBooleanEntry_Call{Call: _e.mock.On("RetrieveBooleanEntry", account, key)} +} + +func (_c *MockState_RetrieveBooleanEntry_Call) Run(run func(account proto.Recipient, key string)) *MockState_RetrieveBooleanEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_RetrieveBooleanEntry_Call) Return(booleanDataEntry *proto.BooleanDataEntry, err error) *MockState_RetrieveBooleanEntry_Call { + _c.Call.Return(booleanDataEntry, err) + return _c +} + +func (_c *MockState_RetrieveBooleanEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error)) *MockState_RetrieveBooleanEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveEntries provides a mock function for the type MockState +func (_mock *MockState) RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for RetrieveEntries") + } + + var r0 []proto.DataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) ([]proto.DataEntry, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) []proto.DataEntry); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]proto.DataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_RetrieveEntries_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntries' +type MockState_RetrieveEntries_Call struct { + *mock.Call +} + +// RetrieveEntries is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockState_Expecter) RetrieveEntries(account interface{}) *MockState_RetrieveEntries_Call { + return &MockState_RetrieveEntries_Call{Call: _e.mock.On("RetrieveEntries", account)} +} + +func (_c *MockState_RetrieveEntries_Call) Run(run func(account proto.Recipient)) *MockState_RetrieveEntries_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_RetrieveEntries_Call) Return(dataEntrys []proto.DataEntry, err error) *MockState_RetrieveEntries_Call { + _c.Call.Return(dataEntrys, err) + return _c +} + +func (_c *MockState_RetrieveEntries_Call) RunAndReturn(run func(account proto.Recipient) ([]proto.DataEntry, error)) *MockState_RetrieveEntries_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveEntry provides a mock function for the type MockState +func (_mock *MockState) RetrieveEntry(account proto.Recipient, key string) (proto.DataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveEntry") + } + + var r0 proto.DataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (proto.DataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) proto.DataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.DataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_RetrieveEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntry' +type MockState_RetrieveEntry_Call struct { + *mock.Call +} + +// RetrieveEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockState_Expecter) RetrieveEntry(account interface{}, key interface{}) *MockState_RetrieveEntry_Call { + return &MockState_RetrieveEntry_Call{Call: _e.mock.On("RetrieveEntry", account, key)} +} + +func (_c *MockState_RetrieveEntry_Call) Run(run func(account proto.Recipient, key string)) *MockState_RetrieveEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_RetrieveEntry_Call) Return(dataEntry proto.DataEntry, err error) *MockState_RetrieveEntry_Call { + _c.Call.Return(dataEntry, err) + return _c +} + +func (_c *MockState_RetrieveEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (proto.DataEntry, error)) *MockState_RetrieveEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveIntegerEntry provides a mock function for the type MockState +func (_mock *MockState) RetrieveIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveIntegerEntry") + } + + var r0 *proto.IntegerDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.IntegerDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.IntegerDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.IntegerDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_RetrieveIntegerEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveIntegerEntry' +type MockState_RetrieveIntegerEntry_Call struct { + *mock.Call +} + +// RetrieveIntegerEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockState_Expecter) RetrieveIntegerEntry(account interface{}, key interface{}) *MockState_RetrieveIntegerEntry_Call { + return &MockState_RetrieveIntegerEntry_Call{Call: _e.mock.On("RetrieveIntegerEntry", account, key)} +} + +func (_c *MockState_RetrieveIntegerEntry_Call) Run(run func(account proto.Recipient, key string)) *MockState_RetrieveIntegerEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_RetrieveIntegerEntry_Call) Return(integerDataEntry *proto.IntegerDataEntry, err error) *MockState_RetrieveIntegerEntry_Call { + _c.Call.Return(integerDataEntry, err) + return _c +} + +func (_c *MockState_RetrieveIntegerEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error)) *MockState_RetrieveIntegerEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveStringEntry provides a mock function for the type MockState +func (_mock *MockState) RetrieveStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveStringEntry") + } + + var r0 *proto.StringDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.StringDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.StringDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.StringDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_RetrieveStringEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveStringEntry' +type MockState_RetrieveStringEntry_Call struct { + *mock.Call +} + +// RetrieveStringEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockState_Expecter) RetrieveStringEntry(account interface{}, key interface{}) *MockState_RetrieveStringEntry_Call { + return &MockState_RetrieveStringEntry_Call{Call: _e.mock.On("RetrieveStringEntry", account, key)} +} + +func (_c *MockState_RetrieveStringEntry_Call) Run(run func(account proto.Recipient, key string)) *MockState_RetrieveStringEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_RetrieveStringEntry_Call) Return(stringDataEntry *proto.StringDataEntry, err error) *MockState_RetrieveStringEntry_Call { + _c.Call.Return(stringDataEntry, err) + return _c +} + +func (_c *MockState_RetrieveStringEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.StringDataEntry, error)) *MockState_RetrieveStringEntry_Call { + _c.Call.Return(run) + return _c +} + +// RewardAtHeight provides a mock function for the type MockState +func (_mock *MockState) RewardAtHeight(height proto.Height) (uint64, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for RewardAtHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (uint64, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) uint64); ok { + r0 = returnFunc(height) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_RewardAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RewardAtHeight' +type MockState_RewardAtHeight_Call struct { + *mock.Call +} + +// RewardAtHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) RewardAtHeight(height interface{}) *MockState_RewardAtHeight_Call { + return &MockState_RewardAtHeight_Call{Call: _e.mock.On("RewardAtHeight", height)} +} + +func (_c *MockState_RewardAtHeight_Call) Run(run func(height proto.Height)) *MockState_RewardAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_RewardAtHeight_Call) Return(v uint64, err error) *MockState_RewardAtHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_RewardAtHeight_Call) RunAndReturn(run func(height proto.Height) (uint64, error)) *MockState_RewardAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// RewardVotes provides a mock function for the type MockState +func (_mock *MockState) RewardVotes(height proto.Height) (proto.RewardVotes, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for RewardVotes") + } + + var r0 proto.RewardVotes + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (proto.RewardVotes, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) proto.RewardVotes); ok { + r0 = returnFunc(height) + } else { + r0 = ret.Get(0).(proto.RewardVotes) + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_RewardVotes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RewardVotes' +type MockState_RewardVotes_Call struct { + *mock.Call +} + +// RewardVotes is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) RewardVotes(height interface{}) *MockState_RewardVotes_Call { + return &MockState_RewardVotes_Call{Call: _e.mock.On("RewardVotes", height)} +} + +func (_c *MockState_RewardVotes_Call) Run(run func(height proto.Height)) *MockState_RewardVotes_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_RewardVotes_Call) Return(rewardVotes proto.RewardVotes, err error) *MockState_RewardVotes_Call { + _c.Call.Return(rewardVotes, err) + return _c +} + +func (_c *MockState_RewardVotes_Call) RunAndReturn(run func(height proto.Height) (proto.RewardVotes, error)) *MockState_RewardVotes_Call { + _c.Call.Return(run) + return _c +} + +// RollbackTo provides a mock function for the type MockState +func (_mock *MockState) RollbackTo(removalEdge proto.BlockID) error { + ret := _mock.Called(removalEdge) + + if len(ret) == 0 { + panic("no return value specified for RollbackTo") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(proto.BlockID) error); ok { + r0 = returnFunc(removalEdge) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_RollbackTo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RollbackTo' +type MockState_RollbackTo_Call struct { + *mock.Call +} + +// RollbackTo is a helper method to define mock.On call +// - removalEdge proto.BlockID +func (_e *MockState_Expecter) RollbackTo(removalEdge interface{}) *MockState_RollbackTo_Call { + return &MockState_RollbackTo_Call{Call: _e.mock.On("RollbackTo", removalEdge)} +} + +func (_c *MockState_RollbackTo_Call) Run(run func(removalEdge proto.BlockID)) *MockState_RollbackTo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.BlockID + if args[0] != nil { + arg0 = args[0].(proto.BlockID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_RollbackTo_Call) Return(err error) *MockState_RollbackTo_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_RollbackTo_Call) RunAndReturn(run func(removalEdge proto.BlockID) error) *MockState_RollbackTo_Call { + _c.Call.Return(run) + return _c +} + +// RollbackToHeight provides a mock function for the type MockState +func (_mock *MockState) RollbackToHeight(height proto.Height) error { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for RollbackToHeight") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) error); ok { + r0 = returnFunc(height) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_RollbackToHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RollbackToHeight' +type MockState_RollbackToHeight_Call struct { + *mock.Call +} + +// RollbackToHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) RollbackToHeight(height interface{}) *MockState_RollbackToHeight_Call { + return &MockState_RollbackToHeight_Call{Call: _e.mock.On("RollbackToHeight", height)} +} + +func (_c *MockState_RollbackToHeight_Call) Run(run func(height proto.Height)) *MockState_RollbackToHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_RollbackToHeight_Call) Return(err error) *MockState_RollbackToHeight_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_RollbackToHeight_Call) RunAndReturn(run func(height proto.Height) error) *MockState_RollbackToHeight_Call { + _c.Call.Return(run) + return _c +} + +// ScoreAtHeight provides a mock function for the type MockState +func (_mock *MockState) ScoreAtHeight(height proto.Height) (*big.Int, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for ScoreAtHeight") + } + + var r0 *big.Int + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (*big.Int, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) *big.Int); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*big.Int) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ScoreAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ScoreAtHeight' +type MockState_ScoreAtHeight_Call struct { + *mock.Call +} + +// ScoreAtHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) ScoreAtHeight(height interface{}) *MockState_ScoreAtHeight_Call { + return &MockState_ScoreAtHeight_Call{Call: _e.mock.On("ScoreAtHeight", height)} +} + +func (_c *MockState_ScoreAtHeight_Call) Run(run func(height proto.Height)) *MockState_ScoreAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_ScoreAtHeight_Call) Return(intParam *big.Int, err error) *MockState_ScoreAtHeight_Call { + _c.Call.Return(intParam, err) + return _c +} + +func (_c *MockState_ScoreAtHeight_Call) RunAndReturn(run func(height proto.Height) (*big.Int, error)) *MockState_ScoreAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// ScriptBasicInfoByAccount provides a mock function for the type MockState +func (_mock *MockState) ScriptBasicInfoByAccount(account proto.Recipient) (*proto.ScriptBasicInfo, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for ScriptBasicInfoByAccount") + } + + var r0 *proto.ScriptBasicInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (*proto.ScriptBasicInfo, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) *proto.ScriptBasicInfo); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.ScriptBasicInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ScriptBasicInfoByAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ScriptBasicInfoByAccount' +type MockState_ScriptBasicInfoByAccount_Call struct { + *mock.Call +} + +// ScriptBasicInfoByAccount is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockState_Expecter) ScriptBasicInfoByAccount(account interface{}) *MockState_ScriptBasicInfoByAccount_Call { + return &MockState_ScriptBasicInfoByAccount_Call{Call: _e.mock.On("ScriptBasicInfoByAccount", account)} +} + +func (_c *MockState_ScriptBasicInfoByAccount_Call) Run(run func(account proto.Recipient)) *MockState_ScriptBasicInfoByAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_ScriptBasicInfoByAccount_Call) Return(scriptBasicInfo *proto.ScriptBasicInfo, err error) *MockState_ScriptBasicInfoByAccount_Call { + _c.Call.Return(scriptBasicInfo, err) + return _c +} + +func (_c *MockState_ScriptBasicInfoByAccount_Call) RunAndReturn(run func(account proto.Recipient) (*proto.ScriptBasicInfo, error)) *MockState_ScriptBasicInfoByAccount_Call { + _c.Call.Return(run) + return _c +} + +// ScriptInfoByAccount provides a mock function for the type MockState +func (_mock *MockState) ScriptInfoByAccount(account proto.Recipient) (*proto.ScriptInfo, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for ScriptInfoByAccount") + } + + var r0 *proto.ScriptInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (*proto.ScriptInfo, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) *proto.ScriptInfo); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.ScriptInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ScriptInfoByAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ScriptInfoByAccount' +type MockState_ScriptInfoByAccount_Call struct { + *mock.Call +} + +// ScriptInfoByAccount is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockState_Expecter) ScriptInfoByAccount(account interface{}) *MockState_ScriptInfoByAccount_Call { + return &MockState_ScriptInfoByAccount_Call{Call: _e.mock.On("ScriptInfoByAccount", account)} +} + +func (_c *MockState_ScriptInfoByAccount_Call) Run(run func(account proto.Recipient)) *MockState_ScriptInfoByAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_ScriptInfoByAccount_Call) Return(scriptInfo *proto.ScriptInfo, err error) *MockState_ScriptInfoByAccount_Call { + _c.Call.Return(scriptInfo, err) + return _c +} + +func (_c *MockState_ScriptInfoByAccount_Call) RunAndReturn(run func(account proto.Recipient) (*proto.ScriptInfo, error)) *MockState_ScriptInfoByAccount_Call { + _c.Call.Return(run) + return _c +} + +// ScriptInfoByAsset provides a mock function for the type MockState +func (_mock *MockState) ScriptInfoByAsset(assetID proto.AssetID) (*proto.ScriptInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for ScriptInfoByAsset") + } + + var r0 *proto.ScriptInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (*proto.ScriptInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) *proto.ScriptInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.ScriptInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ScriptInfoByAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ScriptInfoByAsset' +type MockState_ScriptInfoByAsset_Call struct { + *mock.Call +} + +// ScriptInfoByAsset is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockState_Expecter) ScriptInfoByAsset(assetID interface{}) *MockState_ScriptInfoByAsset_Call { + return &MockState_ScriptInfoByAsset_Call{Call: _e.mock.On("ScriptInfoByAsset", assetID)} +} + +func (_c *MockState_ScriptInfoByAsset_Call) Run(run func(assetID proto.AssetID)) *MockState_ScriptInfoByAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_ScriptInfoByAsset_Call) Return(scriptInfo *proto.ScriptInfo, err error) *MockState_ScriptInfoByAsset_Call { + _c.Call.Return(scriptInfo, err) + return _c +} + +func (_c *MockState_ScriptInfoByAsset_Call) RunAndReturn(run func(assetID proto.AssetID) (*proto.ScriptInfo, error)) *MockState_ScriptInfoByAsset_Call { + _c.Call.Return(run) + return _c +} + +// ShouldPersistAddressTransactions provides a mock function for the type MockState +func (_mock *MockState) ShouldPersistAddressTransactions() (bool, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for ShouldPersistAddressTransactions") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func() (bool, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ShouldPersistAddressTransactions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShouldPersistAddressTransactions' +type MockState_ShouldPersistAddressTransactions_Call struct { + *mock.Call +} + +// ShouldPersistAddressTransactions is a helper method to define mock.On call +func (_e *MockState_Expecter) ShouldPersistAddressTransactions() *MockState_ShouldPersistAddressTransactions_Call { + return &MockState_ShouldPersistAddressTransactions_Call{Call: _e.mock.On("ShouldPersistAddressTransactions")} +} + +func (_c *MockState_ShouldPersistAddressTransactions_Call) Run(run func()) *MockState_ShouldPersistAddressTransactions_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_ShouldPersistAddressTransactions_Call) Return(b bool, err error) *MockState_ShouldPersistAddressTransactions_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockState_ShouldPersistAddressTransactions_Call) RunAndReturn(run func() (bool, error)) *MockState_ShouldPersistAddressTransactions_Call { + _c.Call.Return(run) + return _c +} + +// SnapshotStateHashAtHeight provides a mock function for the type MockState +func (_mock *MockState) SnapshotStateHashAtHeight(height proto.Height) (crypto.Digest, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for SnapshotStateHashAtHeight") + } + + var r0 crypto.Digest + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (crypto.Digest, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) crypto.Digest); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(crypto.Digest) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_SnapshotStateHashAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SnapshotStateHashAtHeight' +type MockState_SnapshotStateHashAtHeight_Call struct { + *mock.Call +} + +// SnapshotStateHashAtHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) SnapshotStateHashAtHeight(height interface{}) *MockState_SnapshotStateHashAtHeight_Call { + return &MockState_SnapshotStateHashAtHeight_Call{Call: _e.mock.On("SnapshotStateHashAtHeight", height)} +} + +func (_c *MockState_SnapshotStateHashAtHeight_Call) Run(run func(height proto.Height)) *MockState_SnapshotStateHashAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_SnapshotStateHashAtHeight_Call) Return(digest crypto.Digest, err error) *MockState_SnapshotStateHashAtHeight_Call { + _c.Call.Return(digest, err) + return _c +} + +func (_c *MockState_SnapshotStateHashAtHeight_Call) RunAndReturn(run func(height proto.Height) (crypto.Digest, error)) *MockState_SnapshotStateHashAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// SnapshotsAtHeight provides a mock function for the type MockState +func (_mock *MockState) SnapshotsAtHeight(height proto.Height) (proto.BlockSnapshot, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for SnapshotsAtHeight") + } + + var r0 proto.BlockSnapshot + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (proto.BlockSnapshot, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) proto.BlockSnapshot); ok { + r0 = returnFunc(height) + } else { + r0 = ret.Get(0).(proto.BlockSnapshot) + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_SnapshotsAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SnapshotsAtHeight' +type MockState_SnapshotsAtHeight_Call struct { + *mock.Call +} + +// SnapshotsAtHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) SnapshotsAtHeight(height interface{}) *MockState_SnapshotsAtHeight_Call { + return &MockState_SnapshotsAtHeight_Call{Call: _e.mock.On("SnapshotsAtHeight", height)} +} + +func (_c *MockState_SnapshotsAtHeight_Call) Run(run func(height proto.Height)) *MockState_SnapshotsAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_SnapshotsAtHeight_Call) Return(blockSnapshot proto.BlockSnapshot, err error) *MockState_SnapshotsAtHeight_Call { + _c.Call.Return(blockSnapshot, err) + return _c +} + +func (_c *MockState_SnapshotsAtHeight_Call) RunAndReturn(run func(height proto.Height) (proto.BlockSnapshot, error)) *MockState_SnapshotsAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// StartProvidingExtendedApi provides a mock function for the type MockState +func (_mock *MockState) StartProvidingExtendedApi() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for StartProvidingExtendedApi") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_StartProvidingExtendedApi_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartProvidingExtendedApi' +type MockState_StartProvidingExtendedApi_Call struct { + *mock.Call +} + +// StartProvidingExtendedApi is a helper method to define mock.On call +func (_e *MockState_Expecter) StartProvidingExtendedApi() *MockState_StartProvidingExtendedApi_Call { + return &MockState_StartProvidingExtendedApi_Call{Call: _e.mock.On("StartProvidingExtendedApi")} +} + +func (_c *MockState_StartProvidingExtendedApi_Call) Run(run func()) *MockState_StartProvidingExtendedApi_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_StartProvidingExtendedApi_Call) Return(err error) *MockState_StartProvidingExtendedApi_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_StartProvidingExtendedApi_Call) RunAndReturn(run func() error) *MockState_StartProvidingExtendedApi_Call { + _c.Call.Return(run) + return _c +} + +// TopBlock provides a mock function for the type MockState +func (_mock *MockState) TopBlock() *proto.Block { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for TopBlock") + } + + var r0 *proto.Block + if returnFunc, ok := ret.Get(0).(func() *proto.Block); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.Block) + } + } + return r0 +} + +// MockState_TopBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TopBlock' +type MockState_TopBlock_Call struct { + *mock.Call +} + +// TopBlock is a helper method to define mock.On call +func (_e *MockState_Expecter) TopBlock() *MockState_TopBlock_Call { + return &MockState_TopBlock_Call{Call: _e.mock.On("TopBlock")} +} + +func (_c *MockState_TopBlock_Call) Run(run func()) *MockState_TopBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_TopBlock_Call) Return(block *proto.Block) *MockState_TopBlock_Call { + _c.Call.Return(block) + return _c +} + +func (_c *MockState_TopBlock_Call) RunAndReturn(run func() *proto.Block) *MockState_TopBlock_Call { + _c.Call.Return(run) + return _c +} + +// TotalWavesAmount provides a mock function for the type MockState +func (_mock *MockState) TotalWavesAmount(height proto.Height) (uint64, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for TotalWavesAmount") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (uint64, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) uint64); ok { + r0 = returnFunc(height) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_TotalWavesAmount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TotalWavesAmount' +type MockState_TotalWavesAmount_Call struct { + *mock.Call +} + +// TotalWavesAmount is a helper method to define mock.On call +// - height proto.Height +func (_e *MockState_Expecter) TotalWavesAmount(height interface{}) *MockState_TotalWavesAmount_Call { + return &MockState_TotalWavesAmount_Call{Call: _e.mock.On("TotalWavesAmount", height)} +} + +func (_c *MockState_TotalWavesAmount_Call) Run(run func(height proto.Height)) *MockState_TotalWavesAmount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_TotalWavesAmount_Call) Return(v uint64, err error) *MockState_TotalWavesAmount_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_TotalWavesAmount_Call) RunAndReturn(run func(height proto.Height) (uint64, error)) *MockState_TotalWavesAmount_Call { + _c.Call.Return(run) + return _c +} + +// TransactionByID provides a mock function for the type MockState +func (_mock *MockState) TransactionByID(id []byte) (proto.Transaction, error) { + ret := _mock.Called(id) + + if len(ret) == 0 { + panic("no return value specified for TransactionByID") + } + + var r0 proto.Transaction + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (proto.Transaction, error)); ok { + return returnFunc(id) + } + if returnFunc, ok := ret.Get(0).(func([]byte) proto.Transaction); ok { + r0 = returnFunc(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Transaction) + } + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(id) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_TransactionByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransactionByID' +type MockState_TransactionByID_Call struct { + *mock.Call +} + +// TransactionByID is a helper method to define mock.On call +// - id []byte +func (_e *MockState_Expecter) TransactionByID(id interface{}) *MockState_TransactionByID_Call { + return &MockState_TransactionByID_Call{Call: _e.mock.On("TransactionByID", id)} +} + +func (_c *MockState_TransactionByID_Call) Run(run func(id []byte)) *MockState_TransactionByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_TransactionByID_Call) Return(transaction proto.Transaction, err error) *MockState_TransactionByID_Call { + _c.Call.Return(transaction, err) + return _c +} + +func (_c *MockState_TransactionByID_Call) RunAndReturn(run func(id []byte) (proto.Transaction, error)) *MockState_TransactionByID_Call { + _c.Call.Return(run) + return _c +} + +// TransactionByIDWithStatus provides a mock function for the type MockState +func (_mock *MockState) TransactionByIDWithStatus(id []byte) (proto.Transaction, proto.TransactionStatus, error) { + ret := _mock.Called(id) + + if len(ret) == 0 { + panic("no return value specified for TransactionByIDWithStatus") + } + + var r0 proto.Transaction + var r1 proto.TransactionStatus + var r2 error + if returnFunc, ok := ret.Get(0).(func([]byte) (proto.Transaction, proto.TransactionStatus, error)); ok { + return returnFunc(id) + } + if returnFunc, ok := ret.Get(0).(func([]byte) proto.Transaction); ok { + r0 = returnFunc(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Transaction) + } + } + if returnFunc, ok := ret.Get(1).(func([]byte) proto.TransactionStatus); ok { + r1 = returnFunc(id) + } else { + r1 = ret.Get(1).(proto.TransactionStatus) + } + if returnFunc, ok := ret.Get(2).(func([]byte) error); ok { + r2 = returnFunc(id) + } else { + r2 = ret.Error(2) + } + return r0, r1, r2 +} + +// MockState_TransactionByIDWithStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransactionByIDWithStatus' +type MockState_TransactionByIDWithStatus_Call struct { + *mock.Call +} + +// TransactionByIDWithStatus is a helper method to define mock.On call +// - id []byte +func (_e *MockState_Expecter) TransactionByIDWithStatus(id interface{}) *MockState_TransactionByIDWithStatus_Call { + return &MockState_TransactionByIDWithStatus_Call{Call: _e.mock.On("TransactionByIDWithStatus", id)} +} + +func (_c *MockState_TransactionByIDWithStatus_Call) Run(run func(id []byte)) *MockState_TransactionByIDWithStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_TransactionByIDWithStatus_Call) Return(transaction proto.Transaction, transactionStatus proto.TransactionStatus, err error) *MockState_TransactionByIDWithStatus_Call { + _c.Call.Return(transaction, transactionStatus, err) + return _c +} + +func (_c *MockState_TransactionByIDWithStatus_Call) RunAndReturn(run func(id []byte) (proto.Transaction, proto.TransactionStatus, error)) *MockState_TransactionByIDWithStatus_Call { + _c.Call.Return(run) + return _c +} + +// TransactionHeightByID provides a mock function for the type MockState +func (_mock *MockState) TransactionHeightByID(id []byte) (uint64, error) { + ret := _mock.Called(id) + + if len(ret) == 0 { + panic("no return value specified for TransactionHeightByID") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (uint64, error)); ok { + return returnFunc(id) + } + if returnFunc, ok := ret.Get(0).(func([]byte) uint64); ok { + r0 = returnFunc(id) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(id) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_TransactionHeightByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransactionHeightByID' +type MockState_TransactionHeightByID_Call struct { + *mock.Call +} + +// TransactionHeightByID is a helper method to define mock.On call +// - id []byte +func (_e *MockState_Expecter) TransactionHeightByID(id interface{}) *MockState_TransactionHeightByID_Call { + return &MockState_TransactionHeightByID_Call{Call: _e.mock.On("TransactionHeightByID", id)} +} + +func (_c *MockState_TransactionHeightByID_Call) Run(run func(id []byte)) *MockState_TransactionHeightByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_TransactionHeightByID_Call) Return(v uint64, err error) *MockState_TransactionHeightByID_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_TransactionHeightByID_Call) RunAndReturn(run func(id []byte) (uint64, error)) *MockState_TransactionHeightByID_Call { + _c.Call.Return(run) + return _c +} + +// TxValidation provides a mock function for the type MockState +func (_mock *MockState) TxValidation(fn func(validation TxValidation) error) error { + ret := _mock.Called(fn) + + if len(ret) == 0 { + panic("no return value specified for TxValidation") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(func(validation TxValidation) error) error); ok { + r0 = returnFunc(fn) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockState_TxValidation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TxValidation' +type MockState_TxValidation_Call struct { + *mock.Call +} + +// TxValidation is a helper method to define mock.On call +// - fn func(validation TxValidation) error +func (_e *MockState_Expecter) TxValidation(fn interface{}) *MockState_TxValidation_Call { + return &MockState_TxValidation_Call{Call: _e.mock.On("TxValidation", fn)} +} + +func (_c *MockState_TxValidation_Call) Run(run func(fn func(validation TxValidation) error)) *MockState_TxValidation_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 func(validation TxValidation) error + if args[0] != nil { + arg0 = args[0].(func(validation TxValidation) error) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_TxValidation_Call) Return(err error) *MockState_TxValidation_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockState_TxValidation_Call) RunAndReturn(run func(fn func(validation TxValidation) error) error) *MockState_TxValidation_Call { + _c.Call.Return(run) + return _c +} + +// ValidateNextTx provides a mock function for the type MockState +func (_mock *MockState) ValidateNextTx(tx proto.Transaction, currentTimestamp uint64, parentTimestamp uint64, blockVersion proto.BlockVersion, acceptFailed bool) ([]proto.AtomicSnapshot, error) { + ret := _mock.Called(tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) + + if len(ret) == 0 { + panic("no return value specified for ValidateNextTx") + } + + var r0 []proto.AtomicSnapshot + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Transaction, uint64, uint64, proto.BlockVersion, bool) ([]proto.AtomicSnapshot, error)); ok { + return returnFunc(tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) + } + if returnFunc, ok := ret.Get(0).(func(proto.Transaction, uint64, uint64, proto.BlockVersion, bool) []proto.AtomicSnapshot); ok { + r0 = returnFunc(tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]proto.AtomicSnapshot) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Transaction, uint64, uint64, proto.BlockVersion, bool) error); ok { + r1 = returnFunc(tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_ValidateNextTx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateNextTx' +type MockState_ValidateNextTx_Call struct { + *mock.Call +} + +// ValidateNextTx is a helper method to define mock.On call +// - tx proto.Transaction +// - currentTimestamp uint64 +// - parentTimestamp uint64 +// - blockVersion proto.BlockVersion +// - acceptFailed bool +func (_e *MockState_Expecter) ValidateNextTx(tx interface{}, currentTimestamp interface{}, parentTimestamp interface{}, blockVersion interface{}, acceptFailed interface{}) *MockState_ValidateNextTx_Call { + return &MockState_ValidateNextTx_Call{Call: _e.mock.On("ValidateNextTx", tx, currentTimestamp, parentTimestamp, blockVersion, acceptFailed)} +} + +func (_c *MockState_ValidateNextTx_Call) Run(run func(tx proto.Transaction, currentTimestamp uint64, parentTimestamp uint64, blockVersion proto.BlockVersion, acceptFailed bool)) *MockState_ValidateNextTx_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Transaction + if args[0] != nil { + arg0 = args[0].(proto.Transaction) + } + var arg1 uint64 + if args[1] != nil { + arg1 = args[1].(uint64) + } + var arg2 uint64 + if args[2] != nil { + arg2 = args[2].(uint64) + } + var arg3 proto.BlockVersion + if args[3] != nil { + arg3 = args[3].(proto.BlockVersion) + } + var arg4 bool + if args[4] != nil { + arg4 = args[4].(bool) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) + }) + return _c +} + +func (_c *MockState_ValidateNextTx_Call) Return(atomicSnapshots []proto.AtomicSnapshot, err error) *MockState_ValidateNextTx_Call { + _c.Call.Return(atomicSnapshots, err) + return _c +} + +func (_c *MockState_ValidateNextTx_Call) RunAndReturn(run func(tx proto.Transaction, currentTimestamp uint64, parentTimestamp uint64, blockVersion proto.BlockVersion, acceptFailed bool) ([]proto.AtomicSnapshot, error)) *MockState_ValidateNextTx_Call { + _c.Call.Return(run) + return _c +} + +// VotesNum provides a mock function for the type MockState +func (_mock *MockState) VotesNum(featureID int16) (uint64, error) { + ret := _mock.Called(featureID) + + if len(ret) == 0 { + panic("no return value specified for VotesNum") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16) (uint64, error)); ok { + return returnFunc(featureID) + } + if returnFunc, ok := ret.Get(0).(func(int16) uint64); ok { + r0 = returnFunc(featureID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16) error); ok { + r1 = returnFunc(featureID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_VotesNum_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VotesNum' +type MockState_VotesNum_Call struct { + *mock.Call +} + +// VotesNum is a helper method to define mock.On call +// - featureID int16 +func (_e *MockState_Expecter) VotesNum(featureID interface{}) *MockState_VotesNum_Call { + return &MockState_VotesNum_Call{Call: _e.mock.On("VotesNum", featureID)} +} + +func (_c *MockState_VotesNum_Call) Run(run func(featureID int16)) *MockState_VotesNum_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_VotesNum_Call) Return(v uint64, err error) *MockState_VotesNum_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_VotesNum_Call) RunAndReturn(run func(featureID int16) (uint64, error)) *MockState_VotesNum_Call { + _c.Call.Return(run) + return _c +} + +// VotesNumAtHeight provides a mock function for the type MockState +func (_mock *MockState) VotesNumAtHeight(featureID int16, height proto.Height) (uint64, error) { + ret := _mock.Called(featureID, height) + + if len(ret) == 0 { + panic("no return value specified for VotesNumAtHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(int16, proto.Height) (uint64, error)); ok { + return returnFunc(featureID, height) + } + if returnFunc, ok := ret.Get(0).(func(int16, proto.Height) uint64); ok { + r0 = returnFunc(featureID, height) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(int16, proto.Height) error); ok { + r1 = returnFunc(featureID, height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_VotesNumAtHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VotesNumAtHeight' +type MockState_VotesNumAtHeight_Call struct { + *mock.Call +} + +// VotesNumAtHeight is a helper method to define mock.On call +// - featureID int16 +// - height proto.Height +func (_e *MockState_Expecter) VotesNumAtHeight(featureID interface{}, height interface{}) *MockState_VotesNumAtHeight_Call { + return &MockState_VotesNumAtHeight_Call{Call: _e.mock.On("VotesNumAtHeight", featureID, height)} +} + +func (_c *MockState_VotesNumAtHeight_Call) Run(run func(featureID int16, height proto.Height)) *MockState_VotesNumAtHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 int16 + if args[0] != nil { + arg0 = args[0].(int16) + } + var arg1 proto.Height + if args[1] != nil { + arg1 = args[1].(proto.Height) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockState_VotesNumAtHeight_Call) Return(v uint64, err error) *MockState_VotesNumAtHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_VotesNumAtHeight_Call) RunAndReturn(run func(featureID int16, height proto.Height) (uint64, error)) *MockState_VotesNumAtHeight_Call { + _c.Call.Return(run) + return _c +} + +// WavesAddressesNumber provides a mock function for the type MockState +func (_mock *MockState) WavesAddressesNumber() (uint64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for WavesAddressesNumber") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() (uint64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() uint64); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_WavesAddressesNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WavesAddressesNumber' +type MockState_WavesAddressesNumber_Call struct { + *mock.Call +} + +// WavesAddressesNumber is a helper method to define mock.On call +func (_e *MockState_Expecter) WavesAddressesNumber() *MockState_WavesAddressesNumber_Call { + return &MockState_WavesAddressesNumber_Call{Call: _e.mock.On("WavesAddressesNumber")} +} + +func (_c *MockState_WavesAddressesNumber_Call) Run(run func()) *MockState_WavesAddressesNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockState_WavesAddressesNumber_Call) Return(v uint64, err error) *MockState_WavesAddressesNumber_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_WavesAddressesNumber_Call) RunAndReturn(run func() (uint64, error)) *MockState_WavesAddressesNumber_Call { + _c.Call.Return(run) + return _c +} + +// WavesBalance provides a mock function for the type MockState +func (_mock *MockState) WavesBalance(account proto.Recipient) (uint64, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for WavesBalance") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (uint64, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) uint64); ok { + r0 = returnFunc(account) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockState_WavesBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WavesBalance' +type MockState_WavesBalance_Call struct { + *mock.Call +} + +// WavesBalance is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockState_Expecter) WavesBalance(account interface{}) *MockState_WavesBalance_Call { + return &MockState_WavesBalance_Call{Call: _e.mock.On("WavesBalance", account)} +} + +func (_c *MockState_WavesBalance_Call) Run(run func(account proto.Recipient)) *MockState_WavesBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockState_WavesBalance_Call) Return(v uint64, err error) *MockState_WavesBalance_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockState_WavesBalance_Call) RunAndReturn(run func(account proto.Recipient) (uint64, error)) *MockState_WavesBalance_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/state/rewards_calculator_test.go b/pkg/state/rewards_calculator_test.go index 95d3906bd2..2ca733c659 100644 --- a/pkg/state/rewards_calculator_test.go +++ b/pkg/state/rewards_calculator_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/keyvalue" @@ -25,13 +26,14 @@ func makeTestNetRewards(t *testing.T, gen proto.WavesAddress, amounts ...uint64) return r } -func makeMockFeaturesStateForRewardsCalc(features ...settings.Feature) featuresStateForRewardsCalculator { +func makeMockFeaturesStateForRewardsCalc(t *testing.T, features ...settings.Feature) featuresStateForRewardsCalculator { enabledFeatures := make(map[int16]struct{}, len(features)) for _, f := range features { enabledFeatures[int16(f)] = struct{}{} } - mf := &mockFeaturesState{ - newestIsActivatedAtHeightFunc: func(featureID int16, height uint64) bool { + mf := NewMockFeaturesState(t) + mf.EXPECT().newestIsActivatedAtHeight(mock.Anything, mock.Anything).RunAndReturn( + func(featureID int16, height uint64) bool { _, isEnabled := enabledFeatures[featureID] switch settings.Feature(featureID) { case settings.BlockRewardDistribution: @@ -43,31 +45,30 @@ func makeMockFeaturesStateForRewardsCalc(features ...settings.Feature) featuresS default: return false } - }, - newestActivationHeightFunc: func(featureID int16) (uint64, error) { - _, enabled := enabledFeatures[featureID] - if !enabled { - return 0, keyvalue.ErrNotFound - } - switch settings.Feature(featureID) { //nolint:exhaustive // only relevant features - case settings.BlockRewardDistribution: - return 1000, nil - case settings.CappedRewards: - return 2000, nil - case settings.XTNBuyBackCessation: - return 3000, nil - case settings.BoostBlockReward: - return 4000, nil - default: - return 0, keyvalue.ErrNotFound - } - }, - } + }).Maybe() + mf.EXPECT().newestActivationHeight(mock.Anything).RunAndReturn(func(featureID int16) (uint64, error) { + _, enabled := enabledFeatures[featureID] + if !enabled { + return 0, keyvalue.ErrNotFound + } + switch settings.Feature(featureID) { //nolint:exhaustive // only relevant features + case settings.BlockRewardDistribution: + return 1000, nil + case settings.CappedRewards: + return 2000, nil + case settings.XTNBuyBackCessation: + return 3000, nil + case settings.BoostBlockReward: + return 4000, nil + default: + return 0, keyvalue.ErrNotFound + } + }).Maybe() return mf } -func newTestRewardsCalculator(features ...settings.Feature) *rewardCalculator { - mf := makeMockFeaturesStateForRewardsCalc(features...) +func newTestRewardsCalculator(t *testing.T, features ...settings.Feature) *rewardCalculator { + mf := makeMockFeaturesStateForRewardsCalc(t, features...) sets := settings.MustTestNetSettings() sets.MinXTNBuyBackPeriod = 3000 sets.BlockRewardBoostPeriod = 1000 @@ -79,7 +80,7 @@ func TestFeature19RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BlockRewardDistribution, ) for i, test := range []struct { @@ -108,7 +109,7 @@ func TestFeatures19And21RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BlockRewardDistribution, settings.XTNBuyBackCessation, ) @@ -137,7 +138,7 @@ func TestFeatures19And20RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BlockRewardDistribution, settings.CappedRewards, ) @@ -180,7 +181,7 @@ func TestFeatures19And20And21RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BlockRewardDistribution, settings.CappedRewards, settings.XTNBuyBackCessation, @@ -230,7 +231,7 @@ func TestFeatures23RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BoostBlockReward, ) for i, test := range []struct { @@ -261,7 +262,7 @@ func TestFeature19And23RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BlockRewardDistribution, settings.BoostBlockReward, ) @@ -299,7 +300,7 @@ func TestFeatures19And21And23RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BlockRewardDistribution, settings.XTNBuyBackCessation, settings.BoostBlockReward, @@ -329,7 +330,7 @@ func TestFeatures19And20And23RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BlockRewardDistribution, settings.CappedRewards, settings.BoostBlockReward, @@ -387,7 +388,7 @@ func TestFeatures19And20And21And23RewardCalculation(t *testing.T) { gen, err := proto.NewAddressFromString(testAddr) require.NoError(t, err) - c := newTestRewardsCalculator( + c := newTestRewardsCalculator(t, settings.BlockRewardDistribution, settings.CappedRewards, settings.XTNBuyBackCessation, diff --git a/pkg/state/scripts_storage_interface.go b/pkg/state/scripts_storage_interface.go index 69eda86caa..c21575b60c 100644 --- a/pkg/state/scripts_storage_interface.go +++ b/pkg/state/scripts_storage_interface.go @@ -6,7 +6,6 @@ import ( "github.com/wavesplatform/gowaves/pkg/ride/ast" ) -//go:generate moq -out scripts_storage_moq_test.go . scriptStorageState:mockScriptStorageState type scriptStorageState interface { commitUncertain(blockID proto.BlockID) error dropUncertain() diff --git a/pkg/state/scripts_storage_moq_test.go b/pkg/state/scripts_storage_moq_test.go deleted file mode 100644 index efc09f21ce..0000000000 --- a/pkg/state/scripts_storage_moq_test.go +++ /dev/null @@ -1,1302 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package state - -import ( - "github.com/wavesplatform/gowaves/pkg/crypto" - "github.com/wavesplatform/gowaves/pkg/proto" - "github.com/wavesplatform/gowaves/pkg/ride/ast" - "sync" -) - -// Ensure, that mockScriptStorageState does implement scriptStorageState. -// If this is not the case, regenerate this file with moq. -var _ scriptStorageState = &mockScriptStorageState{} - -// mockScriptStorageState is a mock implementation of scriptStorageState. -// -// func TestSomethingThatUsesscriptStorageState(t *testing.T) { -// -// // make and configure a mocked scriptStorageState -// mockedscriptStorageState := &mockScriptStorageState{ -// accountHasScriptFunc: func(addr proto.WavesAddress) (bool, error) { -// panic("mock out the accountHasScript method") -// }, -// accountHasVerifierFunc: func(addr proto.WavesAddress) (bool, error) { -// panic("mock out the accountHasVerifier method") -// }, -// accountIsDAppFunc: func(addr proto.WavesAddress) (bool, error) { -// panic("mock out the accountIsDApp method") -// }, -// clearCacheFunc: func() error { -// panic("mock out the clearCache method") -// }, -// commitUncertainFunc: func(blockID proto.BlockID) error { -// panic("mock out the commitUncertain method") -// }, -// dropUncertainFunc: func() { -// panic("mock out the dropUncertain method") -// }, -// getAccountScriptsHasherFunc: func() *stateHasher { -// panic("mock out the getAccountScriptsHasher method") -// }, -// getAssetScriptsHasherFunc: func() *stateHasher { -// panic("mock out the getAssetScriptsHasher method") -// }, -// isSmartAssetFunc: func(assetID proto.AssetID) (bool, error) { -// panic("mock out the isSmartAsset method") -// }, -// newestAccountHasScriptFunc: func(addr proto.WavesAddress) (bool, error) { -// panic("mock out the newestAccountHasScript method") -// }, -// newestAccountHasVerifierFunc: func(addr proto.WavesAddress) (bool, error) { -// panic("mock out the newestAccountHasVerifier method") -// }, -// newestAccountIsDAppFunc: func(addr proto.WavesAddress) (bool, error) { -// panic("mock out the newestAccountIsDApp method") -// }, -// newestIsSmartAssetFunc: func(assetID proto.AssetID) (bool, error) { -// panic("mock out the newestIsSmartAsset method") -// }, -// newestScriptBasicInfoByAddressIDFunc: func(addressID proto.AddressID) (scriptBasicInfoRecord, error) { -// panic("mock out the newestScriptBasicInfoByAddressID method") -// }, -// newestScriptByAddrFunc: func(addr proto.WavesAddress) (*ast.Tree, error) { -// panic("mock out the newestScriptByAddr method") -// }, -// newestScriptByAssetFunc: func(assetID proto.AssetID) (*ast.Tree, error) { -// panic("mock out the newestScriptByAsset method") -// }, -// newestScriptBytesByAddrFunc: func(addr proto.WavesAddress) (proto.Script, error) { -// panic("mock out the newestScriptBytesByAddr method") -// }, -// newestScriptBytesByAssetFunc: func(assetID proto.AssetID) (proto.Script, error) { -// panic("mock out the newestScriptBytesByAsset method") -// }, -// prepareHashesFunc: func() error { -// panic("mock out the prepareHashes method") -// }, -// resetFunc: func() { -// panic("mock out the reset method") -// }, -// scriptBasicInfoByAddressIDFunc: func(addressID proto.AddressID) (scriptBasicInfoRecord, error) { -// panic("mock out the scriptBasicInfoByAddressID method") -// }, -// scriptByAddrFunc: func(addr proto.WavesAddress) (*ast.Tree, error) { -// panic("mock out the scriptByAddr method") -// }, -// scriptByAssetFunc: func(assetID proto.AssetID) (*ast.Tree, error) { -// panic("mock out the scriptByAsset method") -// }, -// scriptBytesByAddrFunc: func(addr proto.WavesAddress) (proto.Script, error) { -// panic("mock out the scriptBytesByAddr method") -// }, -// scriptBytesByAssetFunc: func(assetID proto.AssetID) (proto.Script, error) { -// panic("mock out the scriptBytesByAsset method") -// }, -// setAccountScriptFunc: func(addr proto.WavesAddress, script proto.Script, pk crypto.PublicKey, blockID proto.BlockID) error { -// panic("mock out the setAccountScript method") -// }, -// setAssetScriptFunc: func(assetID crypto.Digest, script proto.Script, blockID proto.BlockID) error { -// panic("mock out the setAssetScript method") -// }, -// setAssetScriptUncertainFunc: func(fullAssetID crypto.Digest, script proto.Script, pk crypto.PublicKey) error { -// panic("mock out the setAssetScriptUncertain method") -// }, -// uncertainAssetScriptsCopyFunc: func() map[proto.AssetID]assetScriptRecordWithAssetIDTail { -// panic("mock out the uncertainAssetScriptsCopy method") -// }, -// } -// -// // use mockedscriptStorageState in code that requires scriptStorageState -// // and then make assertions. -// -// } -type mockScriptStorageState struct { - // accountHasScriptFunc mocks the accountHasScript method. - accountHasScriptFunc func(addr proto.WavesAddress) (bool, error) - - // accountHasVerifierFunc mocks the accountHasVerifier method. - accountHasVerifierFunc func(addr proto.WavesAddress) (bool, error) - - // accountIsDAppFunc mocks the accountIsDApp method. - accountIsDAppFunc func(addr proto.WavesAddress) (bool, error) - - // clearCacheFunc mocks the clearCache method. - clearCacheFunc func() error - - // commitUncertainFunc mocks the commitUncertain method. - commitUncertainFunc func(blockID proto.BlockID) error - - // dropUncertainFunc mocks the dropUncertain method. - dropUncertainFunc func() - - // getAccountScriptsHasherFunc mocks the getAccountScriptsHasher method. - getAccountScriptsHasherFunc func() *stateHasher - - // getAssetScriptsHasherFunc mocks the getAssetScriptsHasher method. - getAssetScriptsHasherFunc func() *stateHasher - - // isSmartAssetFunc mocks the isSmartAsset method. - isSmartAssetFunc func(assetID proto.AssetID) (bool, error) - - // newestAccountHasScriptFunc mocks the newestAccountHasScript method. - newestAccountHasScriptFunc func(addr proto.WavesAddress) (bool, error) - - // newestAccountHasVerifierFunc mocks the newestAccountHasVerifier method. - newestAccountHasVerifierFunc func(addr proto.WavesAddress) (bool, error) - - // newestAccountIsDAppFunc mocks the newestAccountIsDApp method. - newestAccountIsDAppFunc func(addr proto.WavesAddress) (bool, error) - - // newestIsSmartAssetFunc mocks the newestIsSmartAsset method. - newestIsSmartAssetFunc func(assetID proto.AssetID) (bool, error) - - // newestScriptBasicInfoByAddressIDFunc mocks the newestScriptBasicInfoByAddressID method. - newestScriptBasicInfoByAddressIDFunc func(addressID proto.AddressID) (scriptBasicInfoRecord, error) - - // newestScriptByAddrFunc mocks the newestScriptByAddr method. - newestScriptByAddrFunc func(addr proto.WavesAddress) (*ast.Tree, error) - - // newestScriptByAssetFunc mocks the newestScriptByAsset method. - newestScriptByAssetFunc func(assetID proto.AssetID) (*ast.Tree, error) - - // newestScriptBytesByAddrFunc mocks the newestScriptBytesByAddr method. - newestScriptBytesByAddrFunc func(addr proto.WavesAddress) (proto.Script, error) - - // newestScriptBytesByAssetFunc mocks the newestScriptBytesByAsset method. - newestScriptBytesByAssetFunc func(assetID proto.AssetID) (proto.Script, error) - - // prepareHashesFunc mocks the prepareHashes method. - prepareHashesFunc func() error - - // resetFunc mocks the reset method. - resetFunc func() - - // scriptBasicInfoByAddressIDFunc mocks the scriptBasicInfoByAddressID method. - scriptBasicInfoByAddressIDFunc func(addressID proto.AddressID) (scriptBasicInfoRecord, error) - - // scriptByAddrFunc mocks the scriptByAddr method. - scriptByAddrFunc func(addr proto.WavesAddress) (*ast.Tree, error) - - // scriptByAssetFunc mocks the scriptByAsset method. - scriptByAssetFunc func(assetID proto.AssetID) (*ast.Tree, error) - - // scriptBytesByAddrFunc mocks the scriptBytesByAddr method. - scriptBytesByAddrFunc func(addr proto.WavesAddress) (proto.Script, error) - - // scriptBytesByAssetFunc mocks the scriptBytesByAsset method. - scriptBytesByAssetFunc func(assetID proto.AssetID) (proto.Script, error) - - // setAccountScriptFunc mocks the setAccountScript method. - setAccountScriptFunc func(addr proto.WavesAddress, script proto.Script, pk crypto.PublicKey, blockID proto.BlockID) error - - // setAssetScriptFunc mocks the setAssetScript method. - setAssetScriptFunc func(assetID crypto.Digest, script proto.Script, blockID proto.BlockID) error - - // setAssetScriptUncertainFunc mocks the setAssetScriptUncertain method. - setAssetScriptUncertainFunc func(fullAssetID crypto.Digest, script proto.Script, pk crypto.PublicKey) error - - // uncertainAssetScriptsCopyFunc mocks the uncertainAssetScriptsCopy method. - uncertainAssetScriptsCopyFunc func() map[proto.AssetID]assetScriptRecordWithAssetIDTail - - // calls tracks calls to the methods. - calls struct { - // accountHasScript holds details about calls to the accountHasScript method. - accountHasScript []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // accountHasVerifier holds details about calls to the accountHasVerifier method. - accountHasVerifier []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // accountIsDApp holds details about calls to the accountIsDApp method. - accountIsDApp []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // clearCache holds details about calls to the clearCache method. - clearCache []struct { - } - // commitUncertain holds details about calls to the commitUncertain method. - commitUncertain []struct { - // BlockID is the blockID argument value. - BlockID proto.BlockID - } - // dropUncertain holds details about calls to the dropUncertain method. - dropUncertain []struct { - } - // getAccountScriptsHasher holds details about calls to the getAccountScriptsHasher method. - getAccountScriptsHasher []struct { - } - // getAssetScriptsHasher holds details about calls to the getAssetScriptsHasher method. - getAssetScriptsHasher []struct { - } - // isSmartAsset holds details about calls to the isSmartAsset method. - isSmartAsset []struct { - // AssetID is the assetID argument value. - AssetID proto.AssetID - } - // newestAccountHasScript holds details about calls to the newestAccountHasScript method. - newestAccountHasScript []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // newestAccountHasVerifier holds details about calls to the newestAccountHasVerifier method. - newestAccountHasVerifier []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // newestAccountIsDApp holds details about calls to the newestAccountIsDApp method. - newestAccountIsDApp []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // newestIsSmartAsset holds details about calls to the newestIsSmartAsset method. - newestIsSmartAsset []struct { - // AssetID is the assetID argument value. - AssetID proto.AssetID - } - // newestScriptBasicInfoByAddressID holds details about calls to the newestScriptBasicInfoByAddressID method. - newestScriptBasicInfoByAddressID []struct { - // AddressID is the addressID argument value. - AddressID proto.AddressID - } - // newestScriptByAddr holds details about calls to the newestScriptByAddr method. - newestScriptByAddr []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // newestScriptByAsset holds details about calls to the newestScriptByAsset method. - newestScriptByAsset []struct { - // AssetID is the assetID argument value. - AssetID proto.AssetID - } - // newestScriptBytesByAddr holds details about calls to the newestScriptBytesByAddr method. - newestScriptBytesByAddr []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // newestScriptBytesByAsset holds details about calls to the newestScriptBytesByAsset method. - newestScriptBytesByAsset []struct { - // AssetID is the assetID argument value. - AssetID proto.AssetID - } - // prepareHashes holds details about calls to the prepareHashes method. - prepareHashes []struct { - } - // reset holds details about calls to the reset method. - reset []struct { - } - // scriptBasicInfoByAddressID holds details about calls to the scriptBasicInfoByAddressID method. - scriptBasicInfoByAddressID []struct { - // AddressID is the addressID argument value. - AddressID proto.AddressID - } - // scriptByAddr holds details about calls to the scriptByAddr method. - scriptByAddr []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // scriptByAsset holds details about calls to the scriptByAsset method. - scriptByAsset []struct { - // AssetID is the assetID argument value. - AssetID proto.AssetID - } - // scriptBytesByAddr holds details about calls to the scriptBytesByAddr method. - scriptBytesByAddr []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // scriptBytesByAsset holds details about calls to the scriptBytesByAsset method. - scriptBytesByAsset []struct { - // AssetID is the assetID argument value. - AssetID proto.AssetID - } - // setAccountScript holds details about calls to the setAccountScript method. - setAccountScript []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - // Script is the script argument value. - Script proto.Script - // Pk is the pk argument value. - Pk crypto.PublicKey - // BlockID is the blockID argument value. - BlockID proto.BlockID - } - // setAssetScript holds details about calls to the setAssetScript method. - setAssetScript []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - // Script is the script argument value. - Script proto.Script - // BlockID is the blockID argument value. - BlockID proto.BlockID - } - // setAssetScriptUncertain holds details about calls to the setAssetScriptUncertain method. - setAssetScriptUncertain []struct { - // FullAssetID is the fullAssetID argument value. - FullAssetID crypto.Digest - // Script is the script argument value. - Script proto.Script - // Pk is the pk argument value. - Pk crypto.PublicKey - } - // uncertainAssetScriptsCopy holds details about calls to the uncertainAssetScriptsCopy method. - uncertainAssetScriptsCopy []struct { - } - } - lockaccountHasScript sync.RWMutex - lockaccountHasVerifier sync.RWMutex - lockaccountIsDApp sync.RWMutex - lockclearCache sync.RWMutex - lockcommitUncertain sync.RWMutex - lockdropUncertain sync.RWMutex - lockgetAccountScriptsHasher sync.RWMutex - lockgetAssetScriptsHasher sync.RWMutex - lockisSmartAsset sync.RWMutex - locknewestAccountHasScript sync.RWMutex - locknewestAccountHasVerifier sync.RWMutex - locknewestAccountIsDApp sync.RWMutex - locknewestIsSmartAsset sync.RWMutex - locknewestScriptBasicInfoByAddressID sync.RWMutex - locknewestScriptByAddr sync.RWMutex - locknewestScriptByAsset sync.RWMutex - locknewestScriptBytesByAddr sync.RWMutex - locknewestScriptBytesByAsset sync.RWMutex - lockprepareHashes sync.RWMutex - lockreset sync.RWMutex - lockscriptBasicInfoByAddressID sync.RWMutex - lockscriptByAddr sync.RWMutex - lockscriptByAsset sync.RWMutex - lockscriptBytesByAddr sync.RWMutex - lockscriptBytesByAsset sync.RWMutex - locksetAccountScript sync.RWMutex - locksetAssetScript sync.RWMutex - locksetAssetScriptUncertain sync.RWMutex - lockuncertainAssetScriptsCopy sync.RWMutex -} - -// accountHasScript calls accountHasScriptFunc. -func (mock *mockScriptStorageState) accountHasScript(addr proto.WavesAddress) (bool, error) { - if mock.accountHasScriptFunc == nil { - panic("mockScriptStorageState.accountHasScriptFunc: method is nil but scriptStorageState.accountHasScript was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.lockaccountHasScript.Lock() - mock.calls.accountHasScript = append(mock.calls.accountHasScript, callInfo) - mock.lockaccountHasScript.Unlock() - return mock.accountHasScriptFunc(addr) -} - -// accountHasScriptCalls gets all the calls that were made to accountHasScript. -// Check the length with: -// -// len(mockedscriptStorageState.accountHasScriptCalls()) -func (mock *mockScriptStorageState) accountHasScriptCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.lockaccountHasScript.RLock() - calls = mock.calls.accountHasScript - mock.lockaccountHasScript.RUnlock() - return calls -} - -// accountHasVerifier calls accountHasVerifierFunc. -func (mock *mockScriptStorageState) accountHasVerifier(addr proto.WavesAddress) (bool, error) { - if mock.accountHasVerifierFunc == nil { - panic("mockScriptStorageState.accountHasVerifierFunc: method is nil but scriptStorageState.accountHasVerifier was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.lockaccountHasVerifier.Lock() - mock.calls.accountHasVerifier = append(mock.calls.accountHasVerifier, callInfo) - mock.lockaccountHasVerifier.Unlock() - return mock.accountHasVerifierFunc(addr) -} - -// accountHasVerifierCalls gets all the calls that were made to accountHasVerifier. -// Check the length with: -// -// len(mockedscriptStorageState.accountHasVerifierCalls()) -func (mock *mockScriptStorageState) accountHasVerifierCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.lockaccountHasVerifier.RLock() - calls = mock.calls.accountHasVerifier - mock.lockaccountHasVerifier.RUnlock() - return calls -} - -// accountIsDApp calls accountIsDAppFunc. -func (mock *mockScriptStorageState) accountIsDApp(addr proto.WavesAddress) (bool, error) { - if mock.accountIsDAppFunc == nil { - panic("mockScriptStorageState.accountIsDAppFunc: method is nil but scriptStorageState.accountIsDApp was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.lockaccountIsDApp.Lock() - mock.calls.accountIsDApp = append(mock.calls.accountIsDApp, callInfo) - mock.lockaccountIsDApp.Unlock() - return mock.accountIsDAppFunc(addr) -} - -// accountIsDAppCalls gets all the calls that were made to accountIsDApp. -// Check the length with: -// -// len(mockedscriptStorageState.accountIsDAppCalls()) -func (mock *mockScriptStorageState) accountIsDAppCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.lockaccountIsDApp.RLock() - calls = mock.calls.accountIsDApp - mock.lockaccountIsDApp.RUnlock() - return calls -} - -// clearCache calls clearCacheFunc. -func (mock *mockScriptStorageState) clearCache() error { - if mock.clearCacheFunc == nil { - panic("mockScriptStorageState.clearCacheFunc: method is nil but scriptStorageState.clearCache was just called") - } - callInfo := struct { - }{} - mock.lockclearCache.Lock() - mock.calls.clearCache = append(mock.calls.clearCache, callInfo) - mock.lockclearCache.Unlock() - return mock.clearCacheFunc() -} - -// clearCacheCalls gets all the calls that were made to clearCache. -// Check the length with: -// -// len(mockedscriptStorageState.clearCacheCalls()) -func (mock *mockScriptStorageState) clearCacheCalls() []struct { -} { - var calls []struct { - } - mock.lockclearCache.RLock() - calls = mock.calls.clearCache - mock.lockclearCache.RUnlock() - return calls -} - -// commitUncertain calls commitUncertainFunc. -func (mock *mockScriptStorageState) commitUncertain(blockID proto.BlockID) error { - if mock.commitUncertainFunc == nil { - panic("mockScriptStorageState.commitUncertainFunc: method is nil but scriptStorageState.commitUncertain was just called") - } - callInfo := struct { - BlockID proto.BlockID - }{ - BlockID: blockID, - } - mock.lockcommitUncertain.Lock() - mock.calls.commitUncertain = append(mock.calls.commitUncertain, callInfo) - mock.lockcommitUncertain.Unlock() - return mock.commitUncertainFunc(blockID) -} - -// commitUncertainCalls gets all the calls that were made to commitUncertain. -// Check the length with: -// -// len(mockedscriptStorageState.commitUncertainCalls()) -func (mock *mockScriptStorageState) commitUncertainCalls() []struct { - BlockID proto.BlockID -} { - var calls []struct { - BlockID proto.BlockID - } - mock.lockcommitUncertain.RLock() - calls = mock.calls.commitUncertain - mock.lockcommitUncertain.RUnlock() - return calls -} - -// dropUncertain calls dropUncertainFunc. -func (mock *mockScriptStorageState) dropUncertain() { - if mock.dropUncertainFunc == nil { - panic("mockScriptStorageState.dropUncertainFunc: method is nil but scriptStorageState.dropUncertain was just called") - } - callInfo := struct { - }{} - mock.lockdropUncertain.Lock() - mock.calls.dropUncertain = append(mock.calls.dropUncertain, callInfo) - mock.lockdropUncertain.Unlock() - mock.dropUncertainFunc() -} - -// dropUncertainCalls gets all the calls that were made to dropUncertain. -// Check the length with: -// -// len(mockedscriptStorageState.dropUncertainCalls()) -func (mock *mockScriptStorageState) dropUncertainCalls() []struct { -} { - var calls []struct { - } - mock.lockdropUncertain.RLock() - calls = mock.calls.dropUncertain - mock.lockdropUncertain.RUnlock() - return calls -} - -// getAccountScriptsHasher calls getAccountScriptsHasherFunc. -func (mock *mockScriptStorageState) getAccountScriptsHasher() *stateHasher { - if mock.getAccountScriptsHasherFunc == nil { - panic("mockScriptStorageState.getAccountScriptsHasherFunc: method is nil but scriptStorageState.getAccountScriptsHasher was just called") - } - callInfo := struct { - }{} - mock.lockgetAccountScriptsHasher.Lock() - mock.calls.getAccountScriptsHasher = append(mock.calls.getAccountScriptsHasher, callInfo) - mock.lockgetAccountScriptsHasher.Unlock() - return mock.getAccountScriptsHasherFunc() -} - -// getAccountScriptsHasherCalls gets all the calls that were made to getAccountScriptsHasher. -// Check the length with: -// -// len(mockedscriptStorageState.getAccountScriptsHasherCalls()) -func (mock *mockScriptStorageState) getAccountScriptsHasherCalls() []struct { -} { - var calls []struct { - } - mock.lockgetAccountScriptsHasher.RLock() - calls = mock.calls.getAccountScriptsHasher - mock.lockgetAccountScriptsHasher.RUnlock() - return calls -} - -// getAssetScriptsHasher calls getAssetScriptsHasherFunc. -func (mock *mockScriptStorageState) getAssetScriptsHasher() *stateHasher { - if mock.getAssetScriptsHasherFunc == nil { - panic("mockScriptStorageState.getAssetScriptsHasherFunc: method is nil but scriptStorageState.getAssetScriptsHasher was just called") - } - callInfo := struct { - }{} - mock.lockgetAssetScriptsHasher.Lock() - mock.calls.getAssetScriptsHasher = append(mock.calls.getAssetScriptsHasher, callInfo) - mock.lockgetAssetScriptsHasher.Unlock() - return mock.getAssetScriptsHasherFunc() -} - -// getAssetScriptsHasherCalls gets all the calls that were made to getAssetScriptsHasher. -// Check the length with: -// -// len(mockedscriptStorageState.getAssetScriptsHasherCalls()) -func (mock *mockScriptStorageState) getAssetScriptsHasherCalls() []struct { -} { - var calls []struct { - } - mock.lockgetAssetScriptsHasher.RLock() - calls = mock.calls.getAssetScriptsHasher - mock.lockgetAssetScriptsHasher.RUnlock() - return calls -} - -// isSmartAsset calls isSmartAssetFunc. -func (mock *mockScriptStorageState) isSmartAsset(assetID proto.AssetID) (bool, error) { - if mock.isSmartAssetFunc == nil { - panic("mockScriptStorageState.isSmartAssetFunc: method is nil but scriptStorageState.isSmartAsset was just called") - } - callInfo := struct { - AssetID proto.AssetID - }{ - AssetID: assetID, - } - mock.lockisSmartAsset.Lock() - mock.calls.isSmartAsset = append(mock.calls.isSmartAsset, callInfo) - mock.lockisSmartAsset.Unlock() - return mock.isSmartAssetFunc(assetID) -} - -// isSmartAssetCalls gets all the calls that were made to isSmartAsset. -// Check the length with: -// -// len(mockedscriptStorageState.isSmartAssetCalls()) -func (mock *mockScriptStorageState) isSmartAssetCalls() []struct { - AssetID proto.AssetID -} { - var calls []struct { - AssetID proto.AssetID - } - mock.lockisSmartAsset.RLock() - calls = mock.calls.isSmartAsset - mock.lockisSmartAsset.RUnlock() - return calls -} - -// newestAccountHasScript calls newestAccountHasScriptFunc. -func (mock *mockScriptStorageState) newestAccountHasScript(addr proto.WavesAddress) (bool, error) { - if mock.newestAccountHasScriptFunc == nil { - panic("mockScriptStorageState.newestAccountHasScriptFunc: method is nil but scriptStorageState.newestAccountHasScript was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.locknewestAccountHasScript.Lock() - mock.calls.newestAccountHasScript = append(mock.calls.newestAccountHasScript, callInfo) - mock.locknewestAccountHasScript.Unlock() - return mock.newestAccountHasScriptFunc(addr) -} - -// newestAccountHasScriptCalls gets all the calls that were made to newestAccountHasScript. -// Check the length with: -// -// len(mockedscriptStorageState.newestAccountHasScriptCalls()) -func (mock *mockScriptStorageState) newestAccountHasScriptCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.locknewestAccountHasScript.RLock() - calls = mock.calls.newestAccountHasScript - mock.locknewestAccountHasScript.RUnlock() - return calls -} - -// newestAccountHasVerifier calls newestAccountHasVerifierFunc. -func (mock *mockScriptStorageState) newestAccountHasVerifier(addr proto.WavesAddress) (bool, error) { - if mock.newestAccountHasVerifierFunc == nil { - panic("mockScriptStorageState.newestAccountHasVerifierFunc: method is nil but scriptStorageState.newestAccountHasVerifier was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.locknewestAccountHasVerifier.Lock() - mock.calls.newestAccountHasVerifier = append(mock.calls.newestAccountHasVerifier, callInfo) - mock.locknewestAccountHasVerifier.Unlock() - return mock.newestAccountHasVerifierFunc(addr) -} - -// newestAccountHasVerifierCalls gets all the calls that were made to newestAccountHasVerifier. -// Check the length with: -// -// len(mockedscriptStorageState.newestAccountHasVerifierCalls()) -func (mock *mockScriptStorageState) newestAccountHasVerifierCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.locknewestAccountHasVerifier.RLock() - calls = mock.calls.newestAccountHasVerifier - mock.locknewestAccountHasVerifier.RUnlock() - return calls -} - -// newestAccountIsDApp calls newestAccountIsDAppFunc. -func (mock *mockScriptStorageState) newestAccountIsDApp(addr proto.WavesAddress) (bool, error) { - if mock.newestAccountIsDAppFunc == nil { - panic("mockScriptStorageState.newestAccountIsDAppFunc: method is nil but scriptStorageState.newestAccountIsDApp was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.locknewestAccountIsDApp.Lock() - mock.calls.newestAccountIsDApp = append(mock.calls.newestAccountIsDApp, callInfo) - mock.locknewestAccountIsDApp.Unlock() - return mock.newestAccountIsDAppFunc(addr) -} - -// newestAccountIsDAppCalls gets all the calls that were made to newestAccountIsDApp. -// Check the length with: -// -// len(mockedscriptStorageState.newestAccountIsDAppCalls()) -func (mock *mockScriptStorageState) newestAccountIsDAppCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.locknewestAccountIsDApp.RLock() - calls = mock.calls.newestAccountIsDApp - mock.locknewestAccountIsDApp.RUnlock() - return calls -} - -// newestIsSmartAsset calls newestIsSmartAssetFunc. -func (mock *mockScriptStorageState) newestIsSmartAsset(assetID proto.AssetID) (bool, error) { - if mock.newestIsSmartAssetFunc == nil { - panic("mockScriptStorageState.newestIsSmartAssetFunc: method is nil but scriptStorageState.newestIsSmartAsset was just called") - } - callInfo := struct { - AssetID proto.AssetID - }{ - AssetID: assetID, - } - mock.locknewestIsSmartAsset.Lock() - mock.calls.newestIsSmartAsset = append(mock.calls.newestIsSmartAsset, callInfo) - mock.locknewestIsSmartAsset.Unlock() - return mock.newestIsSmartAssetFunc(assetID) -} - -// newestIsSmartAssetCalls gets all the calls that were made to newestIsSmartAsset. -// Check the length with: -// -// len(mockedscriptStorageState.newestIsSmartAssetCalls()) -func (mock *mockScriptStorageState) newestIsSmartAssetCalls() []struct { - AssetID proto.AssetID -} { - var calls []struct { - AssetID proto.AssetID - } - mock.locknewestIsSmartAsset.RLock() - calls = mock.calls.newestIsSmartAsset - mock.locknewestIsSmartAsset.RUnlock() - return calls -} - -// newestScriptBasicInfoByAddressID calls newestScriptBasicInfoByAddressIDFunc. -func (mock *mockScriptStorageState) newestScriptBasicInfoByAddressID(addressID proto.AddressID) (scriptBasicInfoRecord, error) { - if mock.newestScriptBasicInfoByAddressIDFunc == nil { - panic("mockScriptStorageState.newestScriptBasicInfoByAddressIDFunc: method is nil but scriptStorageState.newestScriptBasicInfoByAddressID was just called") - } - callInfo := struct { - AddressID proto.AddressID - }{ - AddressID: addressID, - } - mock.locknewestScriptBasicInfoByAddressID.Lock() - mock.calls.newestScriptBasicInfoByAddressID = append(mock.calls.newestScriptBasicInfoByAddressID, callInfo) - mock.locknewestScriptBasicInfoByAddressID.Unlock() - return mock.newestScriptBasicInfoByAddressIDFunc(addressID) -} - -// newestScriptBasicInfoByAddressIDCalls gets all the calls that were made to newestScriptBasicInfoByAddressID. -// Check the length with: -// -// len(mockedscriptStorageState.newestScriptBasicInfoByAddressIDCalls()) -func (mock *mockScriptStorageState) newestScriptBasicInfoByAddressIDCalls() []struct { - AddressID proto.AddressID -} { - var calls []struct { - AddressID proto.AddressID - } - mock.locknewestScriptBasicInfoByAddressID.RLock() - calls = mock.calls.newestScriptBasicInfoByAddressID - mock.locknewestScriptBasicInfoByAddressID.RUnlock() - return calls -} - -// newestScriptByAddr calls newestScriptByAddrFunc. -func (mock *mockScriptStorageState) newestScriptByAddr(addr proto.WavesAddress) (*ast.Tree, error) { - if mock.newestScriptByAddrFunc == nil { - panic("mockScriptStorageState.newestScriptByAddrFunc: method is nil but scriptStorageState.newestScriptByAddr was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.locknewestScriptByAddr.Lock() - mock.calls.newestScriptByAddr = append(mock.calls.newestScriptByAddr, callInfo) - mock.locknewestScriptByAddr.Unlock() - return mock.newestScriptByAddrFunc(addr) -} - -// newestScriptByAddrCalls gets all the calls that were made to newestScriptByAddr. -// Check the length with: -// -// len(mockedscriptStorageState.newestScriptByAddrCalls()) -func (mock *mockScriptStorageState) newestScriptByAddrCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.locknewestScriptByAddr.RLock() - calls = mock.calls.newestScriptByAddr - mock.locknewestScriptByAddr.RUnlock() - return calls -} - -// newestScriptByAsset calls newestScriptByAssetFunc. -func (mock *mockScriptStorageState) newestScriptByAsset(assetID proto.AssetID) (*ast.Tree, error) { - if mock.newestScriptByAssetFunc == nil { - panic("mockScriptStorageState.newestScriptByAssetFunc: method is nil but scriptStorageState.newestScriptByAsset was just called") - } - callInfo := struct { - AssetID proto.AssetID - }{ - AssetID: assetID, - } - mock.locknewestScriptByAsset.Lock() - mock.calls.newestScriptByAsset = append(mock.calls.newestScriptByAsset, callInfo) - mock.locknewestScriptByAsset.Unlock() - return mock.newestScriptByAssetFunc(assetID) -} - -// newestScriptByAssetCalls gets all the calls that were made to newestScriptByAsset. -// Check the length with: -// -// len(mockedscriptStorageState.newestScriptByAssetCalls()) -func (mock *mockScriptStorageState) newestScriptByAssetCalls() []struct { - AssetID proto.AssetID -} { - var calls []struct { - AssetID proto.AssetID - } - mock.locknewestScriptByAsset.RLock() - calls = mock.calls.newestScriptByAsset - mock.locknewestScriptByAsset.RUnlock() - return calls -} - -// newestScriptBytesByAddr calls newestScriptBytesByAddrFunc. -func (mock *mockScriptStorageState) newestScriptBytesByAddr(addr proto.WavesAddress) (proto.Script, error) { - if mock.newestScriptBytesByAddrFunc == nil { - panic("mockScriptStorageState.newestScriptBytesByAddrFunc: method is nil but scriptStorageState.newestScriptBytesByAddr was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.locknewestScriptBytesByAddr.Lock() - mock.calls.newestScriptBytesByAddr = append(mock.calls.newestScriptBytesByAddr, callInfo) - mock.locknewestScriptBytesByAddr.Unlock() - return mock.newestScriptBytesByAddrFunc(addr) -} - -// newestScriptBytesByAddrCalls gets all the calls that were made to newestScriptBytesByAddr. -// Check the length with: -// -// len(mockedscriptStorageState.newestScriptBytesByAddrCalls()) -func (mock *mockScriptStorageState) newestScriptBytesByAddrCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.locknewestScriptBytesByAddr.RLock() - calls = mock.calls.newestScriptBytesByAddr - mock.locknewestScriptBytesByAddr.RUnlock() - return calls -} - -// newestScriptBytesByAsset calls newestScriptBytesByAssetFunc. -func (mock *mockScriptStorageState) newestScriptBytesByAsset(assetID proto.AssetID) (proto.Script, error) { - if mock.newestScriptBytesByAssetFunc == nil { - panic("mockScriptStorageState.newestScriptBytesByAssetFunc: method is nil but scriptStorageState.newestScriptBytesByAsset was just called") - } - callInfo := struct { - AssetID proto.AssetID - }{ - AssetID: assetID, - } - mock.locknewestScriptBytesByAsset.Lock() - mock.calls.newestScriptBytesByAsset = append(mock.calls.newestScriptBytesByAsset, callInfo) - mock.locknewestScriptBytesByAsset.Unlock() - return mock.newestScriptBytesByAssetFunc(assetID) -} - -// newestScriptBytesByAssetCalls gets all the calls that were made to newestScriptBytesByAsset. -// Check the length with: -// -// len(mockedscriptStorageState.newestScriptBytesByAssetCalls()) -func (mock *mockScriptStorageState) newestScriptBytesByAssetCalls() []struct { - AssetID proto.AssetID -} { - var calls []struct { - AssetID proto.AssetID - } - mock.locknewestScriptBytesByAsset.RLock() - calls = mock.calls.newestScriptBytesByAsset - mock.locknewestScriptBytesByAsset.RUnlock() - return calls -} - -// prepareHashes calls prepareHashesFunc. -func (mock *mockScriptStorageState) prepareHashes() error { - if mock.prepareHashesFunc == nil { - panic("mockScriptStorageState.prepareHashesFunc: method is nil but scriptStorageState.prepareHashes was just called") - } - callInfo := struct { - }{} - mock.lockprepareHashes.Lock() - mock.calls.prepareHashes = append(mock.calls.prepareHashes, callInfo) - mock.lockprepareHashes.Unlock() - return mock.prepareHashesFunc() -} - -// prepareHashesCalls gets all the calls that were made to prepareHashes. -// Check the length with: -// -// len(mockedscriptStorageState.prepareHashesCalls()) -func (mock *mockScriptStorageState) prepareHashesCalls() []struct { -} { - var calls []struct { - } - mock.lockprepareHashes.RLock() - calls = mock.calls.prepareHashes - mock.lockprepareHashes.RUnlock() - return calls -} - -// reset calls resetFunc. -func (mock *mockScriptStorageState) reset() { - if mock.resetFunc == nil { - panic("mockScriptStorageState.resetFunc: method is nil but scriptStorageState.reset was just called") - } - callInfo := struct { - }{} - mock.lockreset.Lock() - mock.calls.reset = append(mock.calls.reset, callInfo) - mock.lockreset.Unlock() - mock.resetFunc() -} - -// resetCalls gets all the calls that were made to reset. -// Check the length with: -// -// len(mockedscriptStorageState.resetCalls()) -func (mock *mockScriptStorageState) resetCalls() []struct { -} { - var calls []struct { - } - mock.lockreset.RLock() - calls = mock.calls.reset - mock.lockreset.RUnlock() - return calls -} - -// scriptBasicInfoByAddressID calls scriptBasicInfoByAddressIDFunc. -func (mock *mockScriptStorageState) scriptBasicInfoByAddressID(addressID proto.AddressID) (scriptBasicInfoRecord, error) { - if mock.scriptBasicInfoByAddressIDFunc == nil { - panic("mockScriptStorageState.scriptBasicInfoByAddressIDFunc: method is nil but scriptStorageState.scriptBasicInfoByAddressID was just called") - } - callInfo := struct { - AddressID proto.AddressID - }{ - AddressID: addressID, - } - mock.lockscriptBasicInfoByAddressID.Lock() - mock.calls.scriptBasicInfoByAddressID = append(mock.calls.scriptBasicInfoByAddressID, callInfo) - mock.lockscriptBasicInfoByAddressID.Unlock() - return mock.scriptBasicInfoByAddressIDFunc(addressID) -} - -// scriptBasicInfoByAddressIDCalls gets all the calls that were made to scriptBasicInfoByAddressID. -// Check the length with: -// -// len(mockedscriptStorageState.scriptBasicInfoByAddressIDCalls()) -func (mock *mockScriptStorageState) scriptBasicInfoByAddressIDCalls() []struct { - AddressID proto.AddressID -} { - var calls []struct { - AddressID proto.AddressID - } - mock.lockscriptBasicInfoByAddressID.RLock() - calls = mock.calls.scriptBasicInfoByAddressID - mock.lockscriptBasicInfoByAddressID.RUnlock() - return calls -} - -// scriptByAddr calls scriptByAddrFunc. -func (mock *mockScriptStorageState) scriptByAddr(addr proto.WavesAddress) (*ast.Tree, error) { - if mock.scriptByAddrFunc == nil { - panic("mockScriptStorageState.scriptByAddrFunc: method is nil but scriptStorageState.scriptByAddr was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.lockscriptByAddr.Lock() - mock.calls.scriptByAddr = append(mock.calls.scriptByAddr, callInfo) - mock.lockscriptByAddr.Unlock() - return mock.scriptByAddrFunc(addr) -} - -// scriptByAddrCalls gets all the calls that were made to scriptByAddr. -// Check the length with: -// -// len(mockedscriptStorageState.scriptByAddrCalls()) -func (mock *mockScriptStorageState) scriptByAddrCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.lockscriptByAddr.RLock() - calls = mock.calls.scriptByAddr - mock.lockscriptByAddr.RUnlock() - return calls -} - -// scriptByAsset calls scriptByAssetFunc. -func (mock *mockScriptStorageState) scriptByAsset(assetID proto.AssetID) (*ast.Tree, error) { - if mock.scriptByAssetFunc == nil { - panic("mockScriptStorageState.scriptByAssetFunc: method is nil but scriptStorageState.scriptByAsset was just called") - } - callInfo := struct { - AssetID proto.AssetID - }{ - AssetID: assetID, - } - mock.lockscriptByAsset.Lock() - mock.calls.scriptByAsset = append(mock.calls.scriptByAsset, callInfo) - mock.lockscriptByAsset.Unlock() - return mock.scriptByAssetFunc(assetID) -} - -// scriptByAssetCalls gets all the calls that were made to scriptByAsset. -// Check the length with: -// -// len(mockedscriptStorageState.scriptByAssetCalls()) -func (mock *mockScriptStorageState) scriptByAssetCalls() []struct { - AssetID proto.AssetID -} { - var calls []struct { - AssetID proto.AssetID - } - mock.lockscriptByAsset.RLock() - calls = mock.calls.scriptByAsset - mock.lockscriptByAsset.RUnlock() - return calls -} - -// scriptBytesByAddr calls scriptBytesByAddrFunc. -func (mock *mockScriptStorageState) scriptBytesByAddr(addr proto.WavesAddress) (proto.Script, error) { - if mock.scriptBytesByAddrFunc == nil { - panic("mockScriptStorageState.scriptBytesByAddrFunc: method is nil but scriptStorageState.scriptBytesByAddr was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.lockscriptBytesByAddr.Lock() - mock.calls.scriptBytesByAddr = append(mock.calls.scriptBytesByAddr, callInfo) - mock.lockscriptBytesByAddr.Unlock() - return mock.scriptBytesByAddrFunc(addr) -} - -// scriptBytesByAddrCalls gets all the calls that were made to scriptBytesByAddr. -// Check the length with: -// -// len(mockedscriptStorageState.scriptBytesByAddrCalls()) -func (mock *mockScriptStorageState) scriptBytesByAddrCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.lockscriptBytesByAddr.RLock() - calls = mock.calls.scriptBytesByAddr - mock.lockscriptBytesByAddr.RUnlock() - return calls -} - -// scriptBytesByAsset calls scriptBytesByAssetFunc. -func (mock *mockScriptStorageState) scriptBytesByAsset(assetID proto.AssetID) (proto.Script, error) { - if mock.scriptBytesByAssetFunc == nil { - panic("mockScriptStorageState.scriptBytesByAssetFunc: method is nil but scriptStorageState.scriptBytesByAsset was just called") - } - callInfo := struct { - AssetID proto.AssetID - }{ - AssetID: assetID, - } - mock.lockscriptBytesByAsset.Lock() - mock.calls.scriptBytesByAsset = append(mock.calls.scriptBytesByAsset, callInfo) - mock.lockscriptBytesByAsset.Unlock() - return mock.scriptBytesByAssetFunc(assetID) -} - -// scriptBytesByAssetCalls gets all the calls that were made to scriptBytesByAsset. -// Check the length with: -// -// len(mockedscriptStorageState.scriptBytesByAssetCalls()) -func (mock *mockScriptStorageState) scriptBytesByAssetCalls() []struct { - AssetID proto.AssetID -} { - var calls []struct { - AssetID proto.AssetID - } - mock.lockscriptBytesByAsset.RLock() - calls = mock.calls.scriptBytesByAsset - mock.lockscriptBytesByAsset.RUnlock() - return calls -} - -// setAccountScript calls setAccountScriptFunc. -func (mock *mockScriptStorageState) setAccountScript(addr proto.WavesAddress, script proto.Script, pk crypto.PublicKey, blockID proto.BlockID) error { - if mock.setAccountScriptFunc == nil { - panic("mockScriptStorageState.setAccountScriptFunc: method is nil but scriptStorageState.setAccountScript was just called") - } - callInfo := struct { - Addr proto.WavesAddress - Script proto.Script - Pk crypto.PublicKey - BlockID proto.BlockID - }{ - Addr: addr, - Script: script, - Pk: pk, - BlockID: blockID, - } - mock.locksetAccountScript.Lock() - mock.calls.setAccountScript = append(mock.calls.setAccountScript, callInfo) - mock.locksetAccountScript.Unlock() - return mock.setAccountScriptFunc(addr, script, pk, blockID) -} - -// setAccountScriptCalls gets all the calls that were made to setAccountScript. -// Check the length with: -// -// len(mockedscriptStorageState.setAccountScriptCalls()) -func (mock *mockScriptStorageState) setAccountScriptCalls() []struct { - Addr proto.WavesAddress - Script proto.Script - Pk crypto.PublicKey - BlockID proto.BlockID -} { - var calls []struct { - Addr proto.WavesAddress - Script proto.Script - Pk crypto.PublicKey - BlockID proto.BlockID - } - mock.locksetAccountScript.RLock() - calls = mock.calls.setAccountScript - mock.locksetAccountScript.RUnlock() - return calls -} - -// setAssetScript calls setAssetScriptFunc. -func (mock *mockScriptStorageState) setAssetScript(assetID crypto.Digest, script proto.Script, blockID proto.BlockID) error { - if mock.setAssetScriptFunc == nil { - panic("mockScriptStorageState.setAssetScriptFunc: method is nil but scriptStorageState.setAssetScript was just called") - } - callInfo := struct { - AssetID crypto.Digest - Script proto.Script - BlockID proto.BlockID - }{ - AssetID: assetID, - Script: script, - BlockID: blockID, - } - mock.locksetAssetScript.Lock() - mock.calls.setAssetScript = append(mock.calls.setAssetScript, callInfo) - mock.locksetAssetScript.Unlock() - return mock.setAssetScriptFunc(assetID, script, blockID) -} - -// setAssetScriptCalls gets all the calls that were made to setAssetScript. -// Check the length with: -// -// len(mockedscriptStorageState.setAssetScriptCalls()) -func (mock *mockScriptStorageState) setAssetScriptCalls() []struct { - AssetID crypto.Digest - Script proto.Script - BlockID proto.BlockID -} { - var calls []struct { - AssetID crypto.Digest - Script proto.Script - BlockID proto.BlockID - } - mock.locksetAssetScript.RLock() - calls = mock.calls.setAssetScript - mock.locksetAssetScript.RUnlock() - return calls -} - -// setAssetScriptUncertain calls setAssetScriptUncertainFunc. -func (mock *mockScriptStorageState) setAssetScriptUncertain(fullAssetID crypto.Digest, script proto.Script, pk crypto.PublicKey) error { - if mock.setAssetScriptUncertainFunc == nil { - panic("mockScriptStorageState.setAssetScriptUncertainFunc: method is nil but scriptStorageState.setAssetScriptUncertain was just called") - } - callInfo := struct { - FullAssetID crypto.Digest - Script proto.Script - Pk crypto.PublicKey - }{ - FullAssetID: fullAssetID, - Script: script, - Pk: pk, - } - mock.locksetAssetScriptUncertain.Lock() - mock.calls.setAssetScriptUncertain = append(mock.calls.setAssetScriptUncertain, callInfo) - mock.locksetAssetScriptUncertain.Unlock() - return mock.setAssetScriptUncertainFunc(fullAssetID, script, pk) -} - -// setAssetScriptUncertainCalls gets all the calls that were made to setAssetScriptUncertain. -// Check the length with: -// -// len(mockedscriptStorageState.setAssetScriptUncertainCalls()) -func (mock *mockScriptStorageState) setAssetScriptUncertainCalls() []struct { - FullAssetID crypto.Digest - Script proto.Script - Pk crypto.PublicKey -} { - var calls []struct { - FullAssetID crypto.Digest - Script proto.Script - Pk crypto.PublicKey - } - mock.locksetAssetScriptUncertain.RLock() - calls = mock.calls.setAssetScriptUncertain - mock.locksetAssetScriptUncertain.RUnlock() - return calls -} - -// uncertainAssetScriptsCopy calls uncertainAssetScriptsCopyFunc. -func (mock *mockScriptStorageState) uncertainAssetScriptsCopy() map[proto.AssetID]assetScriptRecordWithAssetIDTail { - if mock.uncertainAssetScriptsCopyFunc == nil { - panic("mockScriptStorageState.uncertainAssetScriptsCopyFunc: method is nil but scriptStorageState.uncertainAssetScriptsCopy was just called") - } - callInfo := struct { - }{} - mock.lockuncertainAssetScriptsCopy.Lock() - mock.calls.uncertainAssetScriptsCopy = append(mock.calls.uncertainAssetScriptsCopy, callInfo) - mock.lockuncertainAssetScriptsCopy.Unlock() - return mock.uncertainAssetScriptsCopyFunc() -} - -// uncertainAssetScriptsCopyCalls gets all the calls that were made to uncertainAssetScriptsCopy. -// Check the length with: -// -// len(mockedscriptStorageState.uncertainAssetScriptsCopyCalls()) -func (mock *mockScriptStorageState) uncertainAssetScriptsCopyCalls() []struct { -} { - var calls []struct { - } - mock.lockuncertainAssetScriptsCopy.RLock() - calls = mock.calls.uncertainAssetScriptsCopy - mock.lockuncertainAssetScriptsCopy.RUnlock() - return calls -} diff --git a/pkg/state/smart_state_moq_test.go b/pkg/state/smart_state_moq_test.go deleted file mode 100644 index 00d6789542..0000000000 --- a/pkg/state/smart_state_moq_test.go +++ /dev/null @@ -1,1288 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package state - -import ( - "github.com/wavesplatform/gowaves/pkg/crypto" - "github.com/wavesplatform/gowaves/pkg/proto" - "github.com/wavesplatform/gowaves/pkg/ride/ast" - "github.com/wavesplatform/gowaves/pkg/types" - "sync" -) - -// Ensure, that AnotherMockSmartState does implement types.EnrichedSmartState. -// If this is not the case, regenerate this file with moq. -var _ types.EnrichedSmartState = &AnotherMockSmartState{} - -// AnotherMockSmartState is a mock implementation of types.EnrichedSmartState. -// -// func TestSomethingThatUsesEnrichedSmartState(t *testing.T) { -// -// // make and configure a mocked types.EnrichedSmartState -// mockedEnrichedSmartState := &AnotherMockSmartState{ -// AddingBlockHeightFunc: func() (uint64, error) { -// panic("mock out the AddingBlockHeight method") -// }, -// EstimatorVersionFunc: func() (int, error) { -// panic("mock out the EstimatorVersion method") -// }, -// IsNotFoundFunc: func(err error) bool { -// panic("mock out the IsNotFound method") -// }, -// IsStateUntouchedFunc: func(account proto.Recipient) (bool, error) { -// panic("mock out the IsStateUntouched method") -// }, -// NewestAddrByAliasFunc: func(alias proto.Alias) (proto.WavesAddress, error) { -// panic("mock out the NewestAddrByAlias method") -// }, -// NewestAssetBalanceFunc: func(account proto.Recipient, assetID crypto.Digest) (uint64, error) { -// panic("mock out the NewestAssetBalance method") -// }, -// NewestAssetBalanceByAddressIDFunc: func(id proto.AddressID, asset crypto.Digest) (uint64, error) { -// panic("mock out the NewestAssetBalanceByAddressID method") -// }, -// NewestAssetConstInfoFunc: func(assetID proto.AssetID) (*proto.AssetConstInfo, error) { -// panic("mock out the NewestAssetConstInfo method") -// }, -// NewestAssetInfoFunc: func(assetID crypto.Digest) (*proto.AssetInfo, error) { -// panic("mock out the NewestAssetInfo method") -// }, -// NewestAssetIsSponsoredFunc: func(assetID crypto.Digest) (bool, error) { -// panic("mock out the NewestAssetIsSponsored method") -// }, -// NewestBlockInfoByHeightFunc: func(height uint64) (*proto.BlockInfo, error) { -// panic("mock out the NewestBlockInfoByHeight method") -// }, -// NewestFullAssetInfoFunc: func(assetID crypto.Digest) (*proto.FullAssetInfo, error) { -// panic("mock out the NewestFullAssetInfo method") -// }, -// NewestFullWavesBalanceFunc: func(account proto.Recipient) (*proto.FullWavesBalance, error) { -// panic("mock out the NewestFullWavesBalance method") -// }, -// NewestLeasingInfoFunc: func(id crypto.Digest) (*proto.LeaseInfo, error) { -// panic("mock out the NewestLeasingInfo method") -// }, -// NewestRecipientToAddressFunc: func(recipient proto.Recipient) (proto.WavesAddress, error) { -// panic("mock out the NewestRecipientToAddress method") -// }, -// NewestScriptByAccountFunc: func(account proto.Recipient) (*ast.Tree, error) { -// panic("mock out the NewestScriptByAccount method") -// }, -// NewestScriptByAssetFunc: func(assetID crypto.Digest) (*ast.Tree, error) { -// panic("mock out the NewestScriptByAsset method") -// }, -// NewestScriptBytesByAccountFunc: func(account proto.Recipient) (proto.Script, error) { -// panic("mock out the NewestScriptBytesByAccount method") -// }, -// NewestScriptPKByAddrFunc: func(addr proto.WavesAddress) (crypto.PublicKey, error) { -// panic("mock out the NewestScriptPKByAddr method") -// }, -// NewestTransactionByIDFunc: func(bytes []byte) (proto.Transaction, error) { -// panic("mock out the NewestTransactionByID method") -// }, -// NewestTransactionHeightByIDFunc: func(bytes []byte) (uint64, error) { -// panic("mock out the NewestTransactionHeightByID method") -// }, -// NewestWavesBalanceFunc: func(account proto.Recipient) (uint64, error) { -// panic("mock out the NewestWavesBalance method") -// }, -// RetrieveEntriesFunc: func(account proto.Recipient) ([]proto.DataEntry, error) { -// panic("mock out the RetrieveEntries method") -// }, -// RetrieveNewestBinaryEntryFunc: func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { -// panic("mock out the RetrieveNewestBinaryEntry method") -// }, -// RetrieveNewestBooleanEntryFunc: func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { -// panic("mock out the RetrieveNewestBooleanEntry method") -// }, -// RetrieveNewestIntegerEntryFunc: func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { -// panic("mock out the RetrieveNewestIntegerEntry method") -// }, -// RetrieveNewestStringEntryFunc: func(account proto.Recipient, key string) (*proto.StringDataEntry, error) { -// panic("mock out the RetrieveNewestStringEntry method") -// }, -// WavesBalanceProfileFunc: func(id proto.AddressID) (*types.WavesBalanceProfile, error) { -// panic("mock out the WavesBalanceProfile method") -// }, -// } -// -// // use mockedEnrichedSmartState in code that requires types.EnrichedSmartState -// // and then make assertions. -// -// } -type AnotherMockSmartState struct { - // AddingBlockHeightFunc mocks the AddingBlockHeight method. - AddingBlockHeightFunc func() (uint64, error) - - // EstimatorVersionFunc mocks the EstimatorVersion method. - EstimatorVersionFunc func() (int, error) - - // IsNotFoundFunc mocks the IsNotFound method. - IsNotFoundFunc func(err error) bool - - // IsStateUntouchedFunc mocks the IsStateUntouched method. - IsStateUntouchedFunc func(account proto.Recipient) (bool, error) - - // NewestAddrByAliasFunc mocks the NewestAddrByAlias method. - NewestAddrByAliasFunc func(alias proto.Alias) (proto.WavesAddress, error) - - // NewestAssetBalanceFunc mocks the NewestAssetBalance method. - NewestAssetBalanceFunc func(account proto.Recipient, assetID crypto.Digest) (uint64, error) - - // NewestAssetBalanceByAddressIDFunc mocks the NewestAssetBalanceByAddressID method. - NewestAssetBalanceByAddressIDFunc func(id proto.AddressID, asset crypto.Digest) (uint64, error) - - // NewestAssetConstInfoFunc mocks the NewestAssetConstInfo method. - NewestAssetConstInfoFunc func(assetID proto.AssetID) (*proto.AssetConstInfo, error) - - // NewestAssetInfoFunc mocks the NewestAssetInfo method. - NewestAssetInfoFunc func(assetID crypto.Digest) (*proto.AssetInfo, error) - - // NewestAssetIsSponsoredFunc mocks the NewestAssetIsSponsored method. - NewestAssetIsSponsoredFunc func(assetID crypto.Digest) (bool, error) - - // NewestBlockInfoByHeightFunc mocks the NewestBlockInfoByHeight method. - NewestBlockInfoByHeightFunc func(height uint64) (*proto.BlockInfo, error) - - // NewestFullAssetInfoFunc mocks the NewestFullAssetInfo method. - NewestFullAssetInfoFunc func(assetID crypto.Digest) (*proto.FullAssetInfo, error) - - // NewestFullWavesBalanceFunc mocks the NewestFullWavesBalance method. - NewestFullWavesBalanceFunc func(account proto.Recipient) (*proto.FullWavesBalance, error) - - // NewestLeasingInfoFunc mocks the NewestLeasingInfo method. - NewestLeasingInfoFunc func(id crypto.Digest) (*proto.LeaseInfo, error) - - // NewestRecipientToAddressFunc mocks the NewestRecipientToAddress method. - NewestRecipientToAddressFunc func(recipient proto.Recipient) (proto.WavesAddress, error) - - // NewestScriptByAccountFunc mocks the NewestScriptByAccount method. - NewestScriptByAccountFunc func(account proto.Recipient) (*ast.Tree, error) - - // NewestScriptByAssetFunc mocks the NewestScriptByAsset method. - NewestScriptByAssetFunc func(assetID crypto.Digest) (*ast.Tree, error) - - // NewestScriptBytesByAccountFunc mocks the NewestScriptBytesByAccount method. - NewestScriptBytesByAccountFunc func(account proto.Recipient) (proto.Script, error) - - // NewestScriptPKByAddrFunc mocks the NewestScriptPKByAddr method. - NewestScriptPKByAddrFunc func(addr proto.WavesAddress) (crypto.PublicKey, error) - - // NewestTransactionByIDFunc mocks the NewestTransactionByID method. - NewestTransactionByIDFunc func(bytes []byte) (proto.Transaction, error) - - // NewestTransactionHeightByIDFunc mocks the NewestTransactionHeightByID method. - NewestTransactionHeightByIDFunc func(bytes []byte) (uint64, error) - - // NewestWavesBalanceFunc mocks the NewestWavesBalance method. - NewestWavesBalanceFunc func(account proto.Recipient) (uint64, error) - - // RetrieveEntriesFunc mocks the RetrieveEntries method. - RetrieveEntriesFunc func(account proto.Recipient) ([]proto.DataEntry, error) - - // RetrieveNewestBinaryEntryFunc mocks the RetrieveNewestBinaryEntry method. - RetrieveNewestBinaryEntryFunc func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) - - // RetrieveNewestBooleanEntryFunc mocks the RetrieveNewestBooleanEntry method. - RetrieveNewestBooleanEntryFunc func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) - - // RetrieveNewestIntegerEntryFunc mocks the RetrieveNewestIntegerEntry method. - RetrieveNewestIntegerEntryFunc func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) - - // RetrieveNewestStringEntryFunc mocks the RetrieveNewestStringEntry method. - RetrieveNewestStringEntryFunc func(account proto.Recipient, key string) (*proto.StringDataEntry, error) - - // WavesBalanceProfileFunc mocks the WavesBalanceProfile method. - WavesBalanceProfileFunc func(id proto.AddressID) (*types.WavesBalanceProfile, error) - - // calls tracks calls to the methods. - calls struct { - // AddingBlockHeight holds details about calls to the AddingBlockHeight method. - AddingBlockHeight []struct { - } - // EstimatorVersion holds details about calls to the EstimatorVersion method. - EstimatorVersion []struct { - } - // IsNotFound holds details about calls to the IsNotFound method. - IsNotFound []struct { - // Err is the err argument value. - Err error - } - // IsStateUntouched holds details about calls to the IsStateUntouched method. - IsStateUntouched []struct { - // Account is the account argument value. - Account proto.Recipient - } - // NewestAddrByAlias holds details about calls to the NewestAddrByAlias method. - NewestAddrByAlias []struct { - // Alias is the alias argument value. - Alias proto.Alias - } - // NewestAssetBalance holds details about calls to the NewestAssetBalance method. - NewestAssetBalance []struct { - // Account is the account argument value. - Account proto.Recipient - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestAssetBalanceByAddressID holds details about calls to the NewestAssetBalanceByAddressID method. - NewestAssetBalanceByAddressID []struct { - // ID is the id argument value. - ID proto.AddressID - // Asset is the asset argument value. - Asset crypto.Digest - } - // NewestAssetConstInfo holds details about calls to the NewestAssetConstInfo method. - NewestAssetConstInfo []struct { - // AssetID is the assetID argument value. - AssetID proto.AssetID - } - // NewestAssetInfo holds details about calls to the NewestAssetInfo method. - NewestAssetInfo []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestAssetIsSponsored holds details about calls to the NewestAssetIsSponsored method. - NewestAssetIsSponsored []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestBlockInfoByHeight holds details about calls to the NewestBlockInfoByHeight method. - NewestBlockInfoByHeight []struct { - // Height is the height argument value. - Height uint64 - } - // NewestFullAssetInfo holds details about calls to the NewestFullAssetInfo method. - NewestFullAssetInfo []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestFullWavesBalance holds details about calls to the NewestFullWavesBalance method. - NewestFullWavesBalance []struct { - // Account is the account argument value. - Account proto.Recipient - } - // NewestLeasingInfo holds details about calls to the NewestLeasingInfo method. - NewestLeasingInfo []struct { - // ID is the id argument value. - ID crypto.Digest - } - // NewestRecipientToAddress holds details about calls to the NewestRecipientToAddress method. - NewestRecipientToAddress []struct { - // Recipient is the recipient argument value. - Recipient proto.Recipient - } - // NewestScriptByAccount holds details about calls to the NewestScriptByAccount method. - NewestScriptByAccount []struct { - // Account is the account argument value. - Account proto.Recipient - } - // NewestScriptByAsset holds details about calls to the NewestScriptByAsset method. - NewestScriptByAsset []struct { - // AssetID is the assetID argument value. - AssetID crypto.Digest - } - // NewestScriptBytesByAccount holds details about calls to the NewestScriptBytesByAccount method. - NewestScriptBytesByAccount []struct { - // Account is the account argument value. - Account proto.Recipient - } - // NewestScriptPKByAddr holds details about calls to the NewestScriptPKByAddr method. - NewestScriptPKByAddr []struct { - // Addr is the addr argument value. - Addr proto.WavesAddress - } - // NewestTransactionByID holds details about calls to the NewestTransactionByID method. - NewestTransactionByID []struct { - // Bytes is the bytes argument value. - Bytes []byte - } - // NewestTransactionHeightByID holds details about calls to the NewestTransactionHeightByID method. - NewestTransactionHeightByID []struct { - // Bytes is the bytes argument value. - Bytes []byte - } - // NewestWavesBalance holds details about calls to the NewestWavesBalance method. - NewestWavesBalance []struct { - // Account is the account argument value. - Account proto.Recipient - } - // RetrieveEntries holds details about calls to the RetrieveEntries method. - RetrieveEntries []struct { - // Account is the account argument value. - Account proto.Recipient - } - // RetrieveNewestBinaryEntry holds details about calls to the RetrieveNewestBinaryEntry method. - RetrieveNewestBinaryEntry []struct { - // Account is the account argument value. - Account proto.Recipient - // Key is the key argument value. - Key string - } - // RetrieveNewestBooleanEntry holds details about calls to the RetrieveNewestBooleanEntry method. - RetrieveNewestBooleanEntry []struct { - // Account is the account argument value. - Account proto.Recipient - // Key is the key argument value. - Key string - } - // RetrieveNewestIntegerEntry holds details about calls to the RetrieveNewestIntegerEntry method. - RetrieveNewestIntegerEntry []struct { - // Account is the account argument value. - Account proto.Recipient - // Key is the key argument value. - Key string - } - // RetrieveNewestStringEntry holds details about calls to the RetrieveNewestStringEntry method. - RetrieveNewestStringEntry []struct { - // Account is the account argument value. - Account proto.Recipient - // Key is the key argument value. - Key string - } - // WavesBalanceProfile holds details about calls to the WavesBalanceProfile method. - WavesBalanceProfile []struct { - // ID is the id argument value. - ID proto.AddressID - } - } - lockAddingBlockHeight sync.RWMutex - lockEstimatorVersion sync.RWMutex - lockIsNotFound sync.RWMutex - lockIsStateUntouched sync.RWMutex - lockNewestAddrByAlias sync.RWMutex - lockNewestAssetBalance sync.RWMutex - lockNewestAssetBalanceByAddressID sync.RWMutex - lockNewestAssetConstInfo sync.RWMutex - lockNewestAssetInfo sync.RWMutex - lockNewestAssetIsSponsored sync.RWMutex - lockNewestBlockInfoByHeight sync.RWMutex - lockNewestFullAssetInfo sync.RWMutex - lockNewestFullWavesBalance sync.RWMutex - lockNewestLeasingInfo sync.RWMutex - lockNewestRecipientToAddress sync.RWMutex - lockNewestScriptByAccount sync.RWMutex - lockNewestScriptByAsset sync.RWMutex - lockNewestScriptBytesByAccount sync.RWMutex - lockNewestScriptPKByAddr sync.RWMutex - lockNewestTransactionByID sync.RWMutex - lockNewestTransactionHeightByID sync.RWMutex - lockNewestWavesBalance sync.RWMutex - lockRetrieveEntries sync.RWMutex - lockRetrieveNewestBinaryEntry sync.RWMutex - lockRetrieveNewestBooleanEntry sync.RWMutex - lockRetrieveNewestIntegerEntry sync.RWMutex - lockRetrieveNewestStringEntry sync.RWMutex - lockWavesBalanceProfile sync.RWMutex -} - -// AddingBlockHeight calls AddingBlockHeightFunc. -func (mock *AnotherMockSmartState) AddingBlockHeight() (uint64, error) { - if mock.AddingBlockHeightFunc == nil { - panic("AnotherMockSmartState.AddingBlockHeightFunc: method is nil but EnrichedSmartState.AddingBlockHeight was just called") - } - callInfo := struct { - }{} - mock.lockAddingBlockHeight.Lock() - mock.calls.AddingBlockHeight = append(mock.calls.AddingBlockHeight, callInfo) - mock.lockAddingBlockHeight.Unlock() - return mock.AddingBlockHeightFunc() -} - -// AddingBlockHeightCalls gets all the calls that were made to AddingBlockHeight. -// Check the length with: -// -// len(mockedEnrichedSmartState.AddingBlockHeightCalls()) -func (mock *AnotherMockSmartState) AddingBlockHeightCalls() []struct { -} { - var calls []struct { - } - mock.lockAddingBlockHeight.RLock() - calls = mock.calls.AddingBlockHeight - mock.lockAddingBlockHeight.RUnlock() - return calls -} - -// EstimatorVersion calls EstimatorVersionFunc. -func (mock *AnotherMockSmartState) EstimatorVersion() (int, error) { - if mock.EstimatorVersionFunc == nil { - panic("AnotherMockSmartState.EstimatorVersionFunc: method is nil but EnrichedSmartState.EstimatorVersion was just called") - } - callInfo := struct { - }{} - mock.lockEstimatorVersion.Lock() - mock.calls.EstimatorVersion = append(mock.calls.EstimatorVersion, callInfo) - mock.lockEstimatorVersion.Unlock() - return mock.EstimatorVersionFunc() -} - -// EstimatorVersionCalls gets all the calls that were made to EstimatorVersion. -// Check the length with: -// -// len(mockedEnrichedSmartState.EstimatorVersionCalls()) -func (mock *AnotherMockSmartState) EstimatorVersionCalls() []struct { -} { - var calls []struct { - } - mock.lockEstimatorVersion.RLock() - calls = mock.calls.EstimatorVersion - mock.lockEstimatorVersion.RUnlock() - return calls -} - -// IsNotFound calls IsNotFoundFunc. -func (mock *AnotherMockSmartState) IsNotFound(err error) bool { - if mock.IsNotFoundFunc == nil { - panic("AnotherMockSmartState.IsNotFoundFunc: method is nil but EnrichedSmartState.IsNotFound was just called") - } - callInfo := struct { - Err error - }{ - Err: err, - } - mock.lockIsNotFound.Lock() - mock.calls.IsNotFound = append(mock.calls.IsNotFound, callInfo) - mock.lockIsNotFound.Unlock() - return mock.IsNotFoundFunc(err) -} - -// IsNotFoundCalls gets all the calls that were made to IsNotFound. -// Check the length with: -// -// len(mockedEnrichedSmartState.IsNotFoundCalls()) -func (mock *AnotherMockSmartState) IsNotFoundCalls() []struct { - Err error -} { - var calls []struct { - Err error - } - mock.lockIsNotFound.RLock() - calls = mock.calls.IsNotFound - mock.lockIsNotFound.RUnlock() - return calls -} - -// IsStateUntouched calls IsStateUntouchedFunc. -func (mock *AnotherMockSmartState) IsStateUntouched(account proto.Recipient) (bool, error) { - if mock.IsStateUntouchedFunc == nil { - panic("AnotherMockSmartState.IsStateUntouchedFunc: method is nil but EnrichedSmartState.IsStateUntouched was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockIsStateUntouched.Lock() - mock.calls.IsStateUntouched = append(mock.calls.IsStateUntouched, callInfo) - mock.lockIsStateUntouched.Unlock() - return mock.IsStateUntouchedFunc(account) -} - -// IsStateUntouchedCalls gets all the calls that were made to IsStateUntouched. -// Check the length with: -// -// len(mockedEnrichedSmartState.IsStateUntouchedCalls()) -func (mock *AnotherMockSmartState) IsStateUntouchedCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockIsStateUntouched.RLock() - calls = mock.calls.IsStateUntouched - mock.lockIsStateUntouched.RUnlock() - return calls -} - -// NewestAddrByAlias calls NewestAddrByAliasFunc. -func (mock *AnotherMockSmartState) NewestAddrByAlias(alias proto.Alias) (proto.WavesAddress, error) { - if mock.NewestAddrByAliasFunc == nil { - panic("AnotherMockSmartState.NewestAddrByAliasFunc: method is nil but EnrichedSmartState.NewestAddrByAlias was just called") - } - callInfo := struct { - Alias proto.Alias - }{ - Alias: alias, - } - mock.lockNewestAddrByAlias.Lock() - mock.calls.NewestAddrByAlias = append(mock.calls.NewestAddrByAlias, callInfo) - mock.lockNewestAddrByAlias.Unlock() - return mock.NewestAddrByAliasFunc(alias) -} - -// NewestAddrByAliasCalls gets all the calls that were made to NewestAddrByAlias. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestAddrByAliasCalls()) -func (mock *AnotherMockSmartState) NewestAddrByAliasCalls() []struct { - Alias proto.Alias -} { - var calls []struct { - Alias proto.Alias - } - mock.lockNewestAddrByAlias.RLock() - calls = mock.calls.NewestAddrByAlias - mock.lockNewestAddrByAlias.RUnlock() - return calls -} - -// NewestAssetBalance calls NewestAssetBalanceFunc. -func (mock *AnotherMockSmartState) NewestAssetBalance(account proto.Recipient, assetID crypto.Digest) (uint64, error) { - if mock.NewestAssetBalanceFunc == nil { - panic("AnotherMockSmartState.NewestAssetBalanceFunc: method is nil but EnrichedSmartState.NewestAssetBalance was just called") - } - callInfo := struct { - Account proto.Recipient - AssetID crypto.Digest - }{ - Account: account, - AssetID: assetID, - } - mock.lockNewestAssetBalance.Lock() - mock.calls.NewestAssetBalance = append(mock.calls.NewestAssetBalance, callInfo) - mock.lockNewestAssetBalance.Unlock() - return mock.NewestAssetBalanceFunc(account, assetID) -} - -// NewestAssetBalanceCalls gets all the calls that were made to NewestAssetBalance. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestAssetBalanceCalls()) -func (mock *AnotherMockSmartState) NewestAssetBalanceCalls() []struct { - Account proto.Recipient - AssetID crypto.Digest -} { - var calls []struct { - Account proto.Recipient - AssetID crypto.Digest - } - mock.lockNewestAssetBalance.RLock() - calls = mock.calls.NewestAssetBalance - mock.lockNewestAssetBalance.RUnlock() - return calls -} - -// NewestAssetBalanceByAddressID calls NewestAssetBalanceByAddressIDFunc. -func (mock *AnotherMockSmartState) NewestAssetBalanceByAddressID(id proto.AddressID, asset crypto.Digest) (uint64, error) { - if mock.NewestAssetBalanceByAddressIDFunc == nil { - panic("AnotherMockSmartState.NewestAssetBalanceByAddressIDFunc: method is nil but EnrichedSmartState.NewestAssetBalanceByAddressID was just called") - } - callInfo := struct { - ID proto.AddressID - Asset crypto.Digest - }{ - ID: id, - Asset: asset, - } - mock.lockNewestAssetBalanceByAddressID.Lock() - mock.calls.NewestAssetBalanceByAddressID = append(mock.calls.NewestAssetBalanceByAddressID, callInfo) - mock.lockNewestAssetBalanceByAddressID.Unlock() - return mock.NewestAssetBalanceByAddressIDFunc(id, asset) -} - -// NewestAssetBalanceByAddressIDCalls gets all the calls that were made to NewestAssetBalanceByAddressID. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestAssetBalanceByAddressIDCalls()) -func (mock *AnotherMockSmartState) NewestAssetBalanceByAddressIDCalls() []struct { - ID proto.AddressID - Asset crypto.Digest -} { - var calls []struct { - ID proto.AddressID - Asset crypto.Digest - } - mock.lockNewestAssetBalanceByAddressID.RLock() - calls = mock.calls.NewestAssetBalanceByAddressID - mock.lockNewestAssetBalanceByAddressID.RUnlock() - return calls -} - -// NewestAssetConstInfo calls NewestAssetConstInfoFunc. -func (mock *AnotherMockSmartState) NewestAssetConstInfo(assetID proto.AssetID) (*proto.AssetConstInfo, error) { - if mock.NewestAssetConstInfoFunc == nil { - panic("AnotherMockSmartState.NewestAssetConstInfoFunc: method is nil but EnrichedSmartState.NewestAssetConstInfo was just called") - } - callInfo := struct { - AssetID proto.AssetID - }{ - AssetID: assetID, - } - mock.lockNewestAssetConstInfo.Lock() - mock.calls.NewestAssetConstInfo = append(mock.calls.NewestAssetConstInfo, callInfo) - mock.lockNewestAssetConstInfo.Unlock() - return mock.NewestAssetConstInfoFunc(assetID) -} - -// NewestAssetConstInfoCalls gets all the calls that were made to NewestAssetConstInfo. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestAssetConstInfoCalls()) -func (mock *AnotherMockSmartState) NewestAssetConstInfoCalls() []struct { - AssetID proto.AssetID -} { - var calls []struct { - AssetID proto.AssetID - } - mock.lockNewestAssetConstInfo.RLock() - calls = mock.calls.NewestAssetConstInfo - mock.lockNewestAssetConstInfo.RUnlock() - return calls -} - -// NewestAssetInfo calls NewestAssetInfoFunc. -func (mock *AnotherMockSmartState) NewestAssetInfo(assetID crypto.Digest) (*proto.AssetInfo, error) { - if mock.NewestAssetInfoFunc == nil { - panic("AnotherMockSmartState.NewestAssetInfoFunc: method is nil but EnrichedSmartState.NewestAssetInfo was just called") - } - callInfo := struct { - AssetID crypto.Digest - }{ - AssetID: assetID, - } - mock.lockNewestAssetInfo.Lock() - mock.calls.NewestAssetInfo = append(mock.calls.NewestAssetInfo, callInfo) - mock.lockNewestAssetInfo.Unlock() - return mock.NewestAssetInfoFunc(assetID) -} - -// NewestAssetInfoCalls gets all the calls that were made to NewestAssetInfo. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestAssetInfoCalls()) -func (mock *AnotherMockSmartState) NewestAssetInfoCalls() []struct { - AssetID crypto.Digest -} { - var calls []struct { - AssetID crypto.Digest - } - mock.lockNewestAssetInfo.RLock() - calls = mock.calls.NewestAssetInfo - mock.lockNewestAssetInfo.RUnlock() - return calls -} - -// NewestAssetIsSponsored calls NewestAssetIsSponsoredFunc. -func (mock *AnotherMockSmartState) NewestAssetIsSponsored(assetID crypto.Digest) (bool, error) { - if mock.NewestAssetIsSponsoredFunc == nil { - panic("AnotherMockSmartState.NewestAssetIsSponsoredFunc: method is nil but EnrichedSmartState.NewestAssetIsSponsored was just called") - } - callInfo := struct { - AssetID crypto.Digest - }{ - AssetID: assetID, - } - mock.lockNewestAssetIsSponsored.Lock() - mock.calls.NewestAssetIsSponsored = append(mock.calls.NewestAssetIsSponsored, callInfo) - mock.lockNewestAssetIsSponsored.Unlock() - return mock.NewestAssetIsSponsoredFunc(assetID) -} - -// NewestAssetIsSponsoredCalls gets all the calls that were made to NewestAssetIsSponsored. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestAssetIsSponsoredCalls()) -func (mock *AnotherMockSmartState) NewestAssetIsSponsoredCalls() []struct { - AssetID crypto.Digest -} { - var calls []struct { - AssetID crypto.Digest - } - mock.lockNewestAssetIsSponsored.RLock() - calls = mock.calls.NewestAssetIsSponsored - mock.lockNewestAssetIsSponsored.RUnlock() - return calls -} - -// NewestBlockInfoByHeight calls NewestBlockInfoByHeightFunc. -func (mock *AnotherMockSmartState) NewestBlockInfoByHeight(height uint64) (*proto.BlockInfo, error) { - if mock.NewestBlockInfoByHeightFunc == nil { - panic("AnotherMockSmartState.NewestBlockInfoByHeightFunc: method is nil but EnrichedSmartState.NewestBlockInfoByHeight was just called") - } - callInfo := struct { - Height uint64 - }{ - Height: height, - } - mock.lockNewestBlockInfoByHeight.Lock() - mock.calls.NewestBlockInfoByHeight = append(mock.calls.NewestBlockInfoByHeight, callInfo) - mock.lockNewestBlockInfoByHeight.Unlock() - return mock.NewestBlockInfoByHeightFunc(height) -} - -// NewestBlockInfoByHeightCalls gets all the calls that were made to NewestBlockInfoByHeight. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestBlockInfoByHeightCalls()) -func (mock *AnotherMockSmartState) NewestBlockInfoByHeightCalls() []struct { - Height uint64 -} { - var calls []struct { - Height uint64 - } - mock.lockNewestBlockInfoByHeight.RLock() - calls = mock.calls.NewestBlockInfoByHeight - mock.lockNewestBlockInfoByHeight.RUnlock() - return calls -} - -// NewestFullAssetInfo calls NewestFullAssetInfoFunc. -func (mock *AnotherMockSmartState) NewestFullAssetInfo(assetID crypto.Digest) (*proto.FullAssetInfo, error) { - if mock.NewestFullAssetInfoFunc == nil { - panic("AnotherMockSmartState.NewestFullAssetInfoFunc: method is nil but EnrichedSmartState.NewestFullAssetInfo was just called") - } - callInfo := struct { - AssetID crypto.Digest - }{ - AssetID: assetID, - } - mock.lockNewestFullAssetInfo.Lock() - mock.calls.NewestFullAssetInfo = append(mock.calls.NewestFullAssetInfo, callInfo) - mock.lockNewestFullAssetInfo.Unlock() - return mock.NewestFullAssetInfoFunc(assetID) -} - -// NewestFullAssetInfoCalls gets all the calls that were made to NewestFullAssetInfo. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestFullAssetInfoCalls()) -func (mock *AnotherMockSmartState) NewestFullAssetInfoCalls() []struct { - AssetID crypto.Digest -} { - var calls []struct { - AssetID crypto.Digest - } - mock.lockNewestFullAssetInfo.RLock() - calls = mock.calls.NewestFullAssetInfo - mock.lockNewestFullAssetInfo.RUnlock() - return calls -} - -// NewestFullWavesBalance calls NewestFullWavesBalanceFunc. -func (mock *AnotherMockSmartState) NewestFullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error) { - if mock.NewestFullWavesBalanceFunc == nil { - panic("AnotherMockSmartState.NewestFullWavesBalanceFunc: method is nil but EnrichedSmartState.NewestFullWavesBalance was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockNewestFullWavesBalance.Lock() - mock.calls.NewestFullWavesBalance = append(mock.calls.NewestFullWavesBalance, callInfo) - mock.lockNewestFullWavesBalance.Unlock() - return mock.NewestFullWavesBalanceFunc(account) -} - -// NewestFullWavesBalanceCalls gets all the calls that were made to NewestFullWavesBalance. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestFullWavesBalanceCalls()) -func (mock *AnotherMockSmartState) NewestFullWavesBalanceCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockNewestFullWavesBalance.RLock() - calls = mock.calls.NewestFullWavesBalance - mock.lockNewestFullWavesBalance.RUnlock() - return calls -} - -// NewestLeasingInfo calls NewestLeasingInfoFunc. -func (mock *AnotherMockSmartState) NewestLeasingInfo(id crypto.Digest) (*proto.LeaseInfo, error) { - if mock.NewestLeasingInfoFunc == nil { - panic("AnotherMockSmartState.NewestLeasingInfoFunc: method is nil but EnrichedSmartState.NewestLeasingInfo was just called") - } - callInfo := struct { - ID crypto.Digest - }{ - ID: id, - } - mock.lockNewestLeasingInfo.Lock() - mock.calls.NewestLeasingInfo = append(mock.calls.NewestLeasingInfo, callInfo) - mock.lockNewestLeasingInfo.Unlock() - return mock.NewestLeasingInfoFunc(id) -} - -// NewestLeasingInfoCalls gets all the calls that were made to NewestLeasingInfo. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestLeasingInfoCalls()) -func (mock *AnotherMockSmartState) NewestLeasingInfoCalls() []struct { - ID crypto.Digest -} { - var calls []struct { - ID crypto.Digest - } - mock.lockNewestLeasingInfo.RLock() - calls = mock.calls.NewestLeasingInfo - mock.lockNewestLeasingInfo.RUnlock() - return calls -} - -// NewestRecipientToAddress calls NewestRecipientToAddressFunc. -func (mock *AnotherMockSmartState) NewestRecipientToAddress(recipient proto.Recipient) (proto.WavesAddress, error) { - if mock.NewestRecipientToAddressFunc == nil { - panic("AnotherMockSmartState.NewestRecipientToAddressFunc: method is nil but EnrichedSmartState.NewestRecipientToAddress was just called") - } - callInfo := struct { - Recipient proto.Recipient - }{ - Recipient: recipient, - } - mock.lockNewestRecipientToAddress.Lock() - mock.calls.NewestRecipientToAddress = append(mock.calls.NewestRecipientToAddress, callInfo) - mock.lockNewestRecipientToAddress.Unlock() - return mock.NewestRecipientToAddressFunc(recipient) -} - -// NewestRecipientToAddressCalls gets all the calls that were made to NewestRecipientToAddress. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestRecipientToAddressCalls()) -func (mock *AnotherMockSmartState) NewestRecipientToAddressCalls() []struct { - Recipient proto.Recipient -} { - var calls []struct { - Recipient proto.Recipient - } - mock.lockNewestRecipientToAddress.RLock() - calls = mock.calls.NewestRecipientToAddress - mock.lockNewestRecipientToAddress.RUnlock() - return calls -} - -// NewestScriptByAccount calls NewestScriptByAccountFunc. -func (mock *AnotherMockSmartState) NewestScriptByAccount(account proto.Recipient) (*ast.Tree, error) { - if mock.NewestScriptByAccountFunc == nil { - panic("AnotherMockSmartState.NewestScriptByAccountFunc: method is nil but EnrichedSmartState.NewestScriptByAccount was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockNewestScriptByAccount.Lock() - mock.calls.NewestScriptByAccount = append(mock.calls.NewestScriptByAccount, callInfo) - mock.lockNewestScriptByAccount.Unlock() - return mock.NewestScriptByAccountFunc(account) -} - -// NewestScriptByAccountCalls gets all the calls that were made to NewestScriptByAccount. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestScriptByAccountCalls()) -func (mock *AnotherMockSmartState) NewestScriptByAccountCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockNewestScriptByAccount.RLock() - calls = mock.calls.NewestScriptByAccount - mock.lockNewestScriptByAccount.RUnlock() - return calls -} - -// NewestScriptByAsset calls NewestScriptByAssetFunc. -func (mock *AnotherMockSmartState) NewestScriptByAsset(assetID crypto.Digest) (*ast.Tree, error) { - if mock.NewestScriptByAssetFunc == nil { - panic("AnotherMockSmartState.NewestScriptByAssetFunc: method is nil but EnrichedSmartState.NewestScriptByAsset was just called") - } - callInfo := struct { - AssetID crypto.Digest - }{ - AssetID: assetID, - } - mock.lockNewestScriptByAsset.Lock() - mock.calls.NewestScriptByAsset = append(mock.calls.NewestScriptByAsset, callInfo) - mock.lockNewestScriptByAsset.Unlock() - return mock.NewestScriptByAssetFunc(assetID) -} - -// NewestScriptByAssetCalls gets all the calls that were made to NewestScriptByAsset. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestScriptByAssetCalls()) -func (mock *AnotherMockSmartState) NewestScriptByAssetCalls() []struct { - AssetID crypto.Digest -} { - var calls []struct { - AssetID crypto.Digest - } - mock.lockNewestScriptByAsset.RLock() - calls = mock.calls.NewestScriptByAsset - mock.lockNewestScriptByAsset.RUnlock() - return calls -} - -// NewestScriptBytesByAccount calls NewestScriptBytesByAccountFunc. -func (mock *AnotherMockSmartState) NewestScriptBytesByAccount(account proto.Recipient) (proto.Script, error) { - if mock.NewestScriptBytesByAccountFunc == nil { - panic("AnotherMockSmartState.NewestScriptBytesByAccountFunc: method is nil but EnrichedSmartState.NewestScriptBytesByAccount was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockNewestScriptBytesByAccount.Lock() - mock.calls.NewestScriptBytesByAccount = append(mock.calls.NewestScriptBytesByAccount, callInfo) - mock.lockNewestScriptBytesByAccount.Unlock() - return mock.NewestScriptBytesByAccountFunc(account) -} - -// NewestScriptBytesByAccountCalls gets all the calls that were made to NewestScriptBytesByAccount. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestScriptBytesByAccountCalls()) -func (mock *AnotherMockSmartState) NewestScriptBytesByAccountCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockNewestScriptBytesByAccount.RLock() - calls = mock.calls.NewestScriptBytesByAccount - mock.lockNewestScriptBytesByAccount.RUnlock() - return calls -} - -// NewestScriptPKByAddr calls NewestScriptPKByAddrFunc. -func (mock *AnotherMockSmartState) NewestScriptPKByAddr(addr proto.WavesAddress) (crypto.PublicKey, error) { - if mock.NewestScriptPKByAddrFunc == nil { - panic("AnotherMockSmartState.NewestScriptPKByAddrFunc: method is nil but EnrichedSmartState.NewestScriptPKByAddr was just called") - } - callInfo := struct { - Addr proto.WavesAddress - }{ - Addr: addr, - } - mock.lockNewestScriptPKByAddr.Lock() - mock.calls.NewestScriptPKByAddr = append(mock.calls.NewestScriptPKByAddr, callInfo) - mock.lockNewestScriptPKByAddr.Unlock() - return mock.NewestScriptPKByAddrFunc(addr) -} - -// NewestScriptPKByAddrCalls gets all the calls that were made to NewestScriptPKByAddr. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestScriptPKByAddrCalls()) -func (mock *AnotherMockSmartState) NewestScriptPKByAddrCalls() []struct { - Addr proto.WavesAddress -} { - var calls []struct { - Addr proto.WavesAddress - } - mock.lockNewestScriptPKByAddr.RLock() - calls = mock.calls.NewestScriptPKByAddr - mock.lockNewestScriptPKByAddr.RUnlock() - return calls -} - -// NewestTransactionByID calls NewestTransactionByIDFunc. -func (mock *AnotherMockSmartState) NewestTransactionByID(bytes []byte) (proto.Transaction, error) { - if mock.NewestTransactionByIDFunc == nil { - panic("AnotherMockSmartState.NewestTransactionByIDFunc: method is nil but EnrichedSmartState.NewestTransactionByID was just called") - } - callInfo := struct { - Bytes []byte - }{ - Bytes: bytes, - } - mock.lockNewestTransactionByID.Lock() - mock.calls.NewestTransactionByID = append(mock.calls.NewestTransactionByID, callInfo) - mock.lockNewestTransactionByID.Unlock() - return mock.NewestTransactionByIDFunc(bytes) -} - -// NewestTransactionByIDCalls gets all the calls that were made to NewestTransactionByID. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestTransactionByIDCalls()) -func (mock *AnotherMockSmartState) NewestTransactionByIDCalls() []struct { - Bytes []byte -} { - var calls []struct { - Bytes []byte - } - mock.lockNewestTransactionByID.RLock() - calls = mock.calls.NewestTransactionByID - mock.lockNewestTransactionByID.RUnlock() - return calls -} - -// NewestTransactionHeightByID calls NewestTransactionHeightByIDFunc. -func (mock *AnotherMockSmartState) NewestTransactionHeightByID(bytes []byte) (uint64, error) { - if mock.NewestTransactionHeightByIDFunc == nil { - panic("AnotherMockSmartState.NewestTransactionHeightByIDFunc: method is nil but EnrichedSmartState.NewestTransactionHeightByID was just called") - } - callInfo := struct { - Bytes []byte - }{ - Bytes: bytes, - } - mock.lockNewestTransactionHeightByID.Lock() - mock.calls.NewestTransactionHeightByID = append(mock.calls.NewestTransactionHeightByID, callInfo) - mock.lockNewestTransactionHeightByID.Unlock() - return mock.NewestTransactionHeightByIDFunc(bytes) -} - -// NewestTransactionHeightByIDCalls gets all the calls that were made to NewestTransactionHeightByID. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestTransactionHeightByIDCalls()) -func (mock *AnotherMockSmartState) NewestTransactionHeightByIDCalls() []struct { - Bytes []byte -} { - var calls []struct { - Bytes []byte - } - mock.lockNewestTransactionHeightByID.RLock() - calls = mock.calls.NewestTransactionHeightByID - mock.lockNewestTransactionHeightByID.RUnlock() - return calls -} - -// NewestWavesBalance calls NewestWavesBalanceFunc. -func (mock *AnotherMockSmartState) NewestWavesBalance(account proto.Recipient) (uint64, error) { - if mock.NewestWavesBalanceFunc == nil { - panic("AnotherMockSmartState.NewestWavesBalanceFunc: method is nil but EnrichedSmartState.NewestWavesBalance was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockNewestWavesBalance.Lock() - mock.calls.NewestWavesBalance = append(mock.calls.NewestWavesBalance, callInfo) - mock.lockNewestWavesBalance.Unlock() - return mock.NewestWavesBalanceFunc(account) -} - -// NewestWavesBalanceCalls gets all the calls that were made to NewestWavesBalance. -// Check the length with: -// -// len(mockedEnrichedSmartState.NewestWavesBalanceCalls()) -func (mock *AnotherMockSmartState) NewestWavesBalanceCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockNewestWavesBalance.RLock() - calls = mock.calls.NewestWavesBalance - mock.lockNewestWavesBalance.RUnlock() - return calls -} - -// RetrieveEntries calls RetrieveEntriesFunc. -func (mock *AnotherMockSmartState) RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error) { - if mock.RetrieveEntriesFunc == nil { - panic("AnotherMockSmartState.RetrieveEntriesFunc: method is nil but SmartState.RetrieveEntries was just called") - } - callInfo := struct { - Account proto.Recipient - }{ - Account: account, - } - mock.lockRetrieveEntries.Lock() - mock.calls.RetrieveEntries = append(mock.calls.RetrieveEntries, callInfo) - mock.lockRetrieveEntries.Unlock() - return mock.RetrieveEntriesFunc(account) -} - -// RetrieveEntriesCalls gets all the calls that were made to RetrieveEntries. -// Check the length with: -// -// len(mockedSmartState.RetrieveEntriesCalls()) -func (mock *AnotherMockSmartState) RetrieveEntriesCalls() []struct { - Account proto.Recipient -} { - var calls []struct { - Account proto.Recipient - } - mock.lockRetrieveEntries.RLock() - calls = mock.calls.RetrieveEntries - mock.lockRetrieveEntries.RUnlock() - return calls -} - -// RetrieveNewestBinaryEntry calls RetrieveNewestBinaryEntryFunc. -func (mock *AnotherMockSmartState) RetrieveNewestBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { - if mock.RetrieveNewestBinaryEntryFunc == nil { - panic("AnotherMockSmartState.RetrieveNewestBinaryEntryFunc: method is nil but EnrichedSmartState.RetrieveNewestBinaryEntry was just called") - } - callInfo := struct { - Account proto.Recipient - Key string - }{ - Account: account, - Key: key, - } - mock.lockRetrieveNewestBinaryEntry.Lock() - mock.calls.RetrieveNewestBinaryEntry = append(mock.calls.RetrieveNewestBinaryEntry, callInfo) - mock.lockRetrieveNewestBinaryEntry.Unlock() - return mock.RetrieveNewestBinaryEntryFunc(account, key) -} - -// RetrieveNewestBinaryEntryCalls gets all the calls that were made to RetrieveNewestBinaryEntry. -// Check the length with: -// -// len(mockedEnrichedSmartState.RetrieveNewestBinaryEntryCalls()) -func (mock *AnotherMockSmartState) RetrieveNewestBinaryEntryCalls() []struct { - Account proto.Recipient - Key string -} { - var calls []struct { - Account proto.Recipient - Key string - } - mock.lockRetrieveNewestBinaryEntry.RLock() - calls = mock.calls.RetrieveNewestBinaryEntry - mock.lockRetrieveNewestBinaryEntry.RUnlock() - return calls -} - -// RetrieveNewestBooleanEntry calls RetrieveNewestBooleanEntryFunc. -func (mock *AnotherMockSmartState) RetrieveNewestBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { - if mock.RetrieveNewestBooleanEntryFunc == nil { - panic("AnotherMockSmartState.RetrieveNewestBooleanEntryFunc: method is nil but EnrichedSmartState.RetrieveNewestBooleanEntry was just called") - } - callInfo := struct { - Account proto.Recipient - Key string - }{ - Account: account, - Key: key, - } - mock.lockRetrieveNewestBooleanEntry.Lock() - mock.calls.RetrieveNewestBooleanEntry = append(mock.calls.RetrieveNewestBooleanEntry, callInfo) - mock.lockRetrieveNewestBooleanEntry.Unlock() - return mock.RetrieveNewestBooleanEntryFunc(account, key) -} - -// RetrieveNewestBooleanEntryCalls gets all the calls that were made to RetrieveNewestBooleanEntry. -// Check the length with: -// -// len(mockedEnrichedSmartState.RetrieveNewestBooleanEntryCalls()) -func (mock *AnotherMockSmartState) RetrieveNewestBooleanEntryCalls() []struct { - Account proto.Recipient - Key string -} { - var calls []struct { - Account proto.Recipient - Key string - } - mock.lockRetrieveNewestBooleanEntry.RLock() - calls = mock.calls.RetrieveNewestBooleanEntry - mock.lockRetrieveNewestBooleanEntry.RUnlock() - return calls -} - -// RetrieveNewestIntegerEntry calls RetrieveNewestIntegerEntryFunc. -func (mock *AnotherMockSmartState) RetrieveNewestIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { - if mock.RetrieveNewestIntegerEntryFunc == nil { - panic("AnotherMockSmartState.RetrieveNewestIntegerEntryFunc: method is nil but EnrichedSmartState.RetrieveNewestIntegerEntry was just called") - } - callInfo := struct { - Account proto.Recipient - Key string - }{ - Account: account, - Key: key, - } - mock.lockRetrieveNewestIntegerEntry.Lock() - mock.calls.RetrieveNewestIntegerEntry = append(mock.calls.RetrieveNewestIntegerEntry, callInfo) - mock.lockRetrieveNewestIntegerEntry.Unlock() - return mock.RetrieveNewestIntegerEntryFunc(account, key) -} - -// RetrieveNewestIntegerEntryCalls gets all the calls that were made to RetrieveNewestIntegerEntry. -// Check the length with: -// -// len(mockedEnrichedSmartState.RetrieveNewestIntegerEntryCalls()) -func (mock *AnotherMockSmartState) RetrieveNewestIntegerEntryCalls() []struct { - Account proto.Recipient - Key string -} { - var calls []struct { - Account proto.Recipient - Key string - } - mock.lockRetrieveNewestIntegerEntry.RLock() - calls = mock.calls.RetrieveNewestIntegerEntry - mock.lockRetrieveNewestIntegerEntry.RUnlock() - return calls -} - -// RetrieveNewestStringEntry calls RetrieveNewestStringEntryFunc. -func (mock *AnotherMockSmartState) RetrieveNewestStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error) { - if mock.RetrieveNewestStringEntryFunc == nil { - panic("AnotherMockSmartState.RetrieveNewestStringEntryFunc: method is nil but EnrichedSmartState.RetrieveNewestStringEntry was just called") - } - callInfo := struct { - Account proto.Recipient - Key string - }{ - Account: account, - Key: key, - } - mock.lockRetrieveNewestStringEntry.Lock() - mock.calls.RetrieveNewestStringEntry = append(mock.calls.RetrieveNewestStringEntry, callInfo) - mock.lockRetrieveNewestStringEntry.Unlock() - return mock.RetrieveNewestStringEntryFunc(account, key) -} - -// RetrieveNewestStringEntryCalls gets all the calls that were made to RetrieveNewestStringEntry. -// Check the length with: -// -// len(mockedEnrichedSmartState.RetrieveNewestStringEntryCalls()) -func (mock *AnotherMockSmartState) RetrieveNewestStringEntryCalls() []struct { - Account proto.Recipient - Key string -} { - var calls []struct { - Account proto.Recipient - Key string - } - mock.lockRetrieveNewestStringEntry.RLock() - calls = mock.calls.RetrieveNewestStringEntry - mock.lockRetrieveNewestStringEntry.RUnlock() - return calls -} - -// WavesBalanceProfile calls WavesBalanceProfileFunc. -func (mock *AnotherMockSmartState) WavesBalanceProfile(id proto.AddressID) (*types.WavesBalanceProfile, error) { - if mock.WavesBalanceProfileFunc == nil { - panic("AnotherMockSmartState.WavesBalanceProfileFunc: method is nil but EnrichedSmartState.WavesBalanceProfile was just called") - } - callInfo := struct { - ID proto.AddressID - }{ - ID: id, - } - mock.lockWavesBalanceProfile.Lock() - mock.calls.WavesBalanceProfile = append(mock.calls.WavesBalanceProfile, callInfo) - mock.lockWavesBalanceProfile.Unlock() - return mock.WavesBalanceProfileFunc(id) -} - -// WavesBalanceProfileCalls gets all the calls that were made to WavesBalanceProfile. -// Check the length with: -// -// len(mockedEnrichedSmartState.WavesBalanceProfileCalls()) -func (mock *AnotherMockSmartState) WavesBalanceProfileCalls() []struct { - ID proto.AddressID -} { - var calls []struct { - ID proto.AddressID - } - mock.lockWavesBalanceProfile.RLock() - calls = mock.calls.WavesBalanceProfile - mock.lockWavesBalanceProfile.RUnlock() - return calls -} diff --git a/pkg/state/transaction_checker_test.go b/pkg/state/transaction_checker_test.go index 6947d05ea0..05f01dbfeb 100644 --- a/pkg/state/transaction_checker_test.go +++ b/pkg/state/transaction_checker_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/wavesplatform/gowaves/pkg/crypto" @@ -1577,16 +1578,15 @@ func TestScriptActivation(t *testing.T) { {libVersion: ast.LibV8, active: uptoLightNode, valid: true}, } for i, test := range tests { - mfs := &mockFeaturesState{ - newestIsActivatedFunc: func(featureID int16) (bool, error) { - for _, f := range test.active { - if int16(f) == featureID { - return true, nil - } + mfs := NewMockFeaturesState(t) + mfs.EXPECT().newestIsActivated(mock.Anything).RunAndReturn(func(featureID int16) (bool, error) { + for _, f := range test.active { + if int16(f) == featureID { + return true, nil } - return false, nil - }, - } + } + return false, nil + }).Maybe() stor := &blockchainEntitiesStorage{features: mfs} checker, err := newTransactionChecker(proto.BlockID{}, stor, settings.MustTestNetSettings()) require.NoError(t, err) diff --git a/pkg/types/mock_enriched_smart_state.go b/pkg/types/mock_enriched_smart_state.go new file mode 100644 index 0000000000..237d8049b8 --- /dev/null +++ b/pkg/types/mock_enriched_smart_state.go @@ -0,0 +1,1770 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package types + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/crypto" + "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/ride/ast" +) + +// NewMockEnrichedSmartState creates a new instance of MockEnrichedSmartState. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockEnrichedSmartState(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEnrichedSmartState { + mock := &MockEnrichedSmartState{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockEnrichedSmartState is an autogenerated mock type for the EnrichedSmartState type +type MockEnrichedSmartState struct { + mock.Mock +} + +type MockEnrichedSmartState_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEnrichedSmartState) EXPECT() *MockEnrichedSmartState_Expecter { + return &MockEnrichedSmartState_Expecter{mock: &_m.Mock} +} + +// AddingBlockHeight provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) AddingBlockHeight() (uint64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddingBlockHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() (uint64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() uint64); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_AddingBlockHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddingBlockHeight' +type MockEnrichedSmartState_AddingBlockHeight_Call struct { + *mock.Call +} + +// AddingBlockHeight is a helper method to define mock.On call +func (_e *MockEnrichedSmartState_Expecter) AddingBlockHeight() *MockEnrichedSmartState_AddingBlockHeight_Call { + return &MockEnrichedSmartState_AddingBlockHeight_Call{Call: _e.mock.On("AddingBlockHeight")} +} + +func (_c *MockEnrichedSmartState_AddingBlockHeight_Call) Run(run func()) *MockEnrichedSmartState_AddingBlockHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnrichedSmartState_AddingBlockHeight_Call) Return(v uint64, err error) *MockEnrichedSmartState_AddingBlockHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockEnrichedSmartState_AddingBlockHeight_Call) RunAndReturn(run func() (uint64, error)) *MockEnrichedSmartState_AddingBlockHeight_Call { + _c.Call.Return(run) + return _c +} + +// EstimatorVersion provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) EstimatorVersion() (int, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for EstimatorVersion") + } + + var r0 int + var r1 error + if returnFunc, ok := ret.Get(0).(func() (int, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() int); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(int) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_EstimatorVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EstimatorVersion' +type MockEnrichedSmartState_EstimatorVersion_Call struct { + *mock.Call +} + +// EstimatorVersion is a helper method to define mock.On call +func (_e *MockEnrichedSmartState_Expecter) EstimatorVersion() *MockEnrichedSmartState_EstimatorVersion_Call { + return &MockEnrichedSmartState_EstimatorVersion_Call{Call: _e.mock.On("EstimatorVersion")} +} + +func (_c *MockEnrichedSmartState_EstimatorVersion_Call) Run(run func()) *MockEnrichedSmartState_EstimatorVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockEnrichedSmartState_EstimatorVersion_Call) Return(n int, err error) *MockEnrichedSmartState_EstimatorVersion_Call { + _c.Call.Return(n, err) + return _c +} + +func (_c *MockEnrichedSmartState_EstimatorVersion_Call) RunAndReturn(run func() (int, error)) *MockEnrichedSmartState_EstimatorVersion_Call { + _c.Call.Return(run) + return _c +} + +// IsNotFound provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) IsNotFound(err error) bool { + ret := _mock.Called(err) + + if len(ret) == 0 { + panic("no return value specified for IsNotFound") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(error) bool); ok { + r0 = returnFunc(err) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockEnrichedSmartState_IsNotFound_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsNotFound' +type MockEnrichedSmartState_IsNotFound_Call struct { + *mock.Call +} + +// IsNotFound is a helper method to define mock.On call +// - err error +func (_e *MockEnrichedSmartState_Expecter) IsNotFound(err interface{}) *MockEnrichedSmartState_IsNotFound_Call { + return &MockEnrichedSmartState_IsNotFound_Call{Call: _e.mock.On("IsNotFound", err)} +} + +func (_c *MockEnrichedSmartState_IsNotFound_Call) Run(run func(err error)) *MockEnrichedSmartState_IsNotFound_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 error + if args[0] != nil { + arg0 = args[0].(error) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_IsNotFound_Call) Return(b bool) *MockEnrichedSmartState_IsNotFound_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockEnrichedSmartState_IsNotFound_Call) RunAndReturn(run func(err error) bool) *MockEnrichedSmartState_IsNotFound_Call { + _c.Call.Return(run) + return _c +} + +// IsStateUntouched provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) IsStateUntouched(account proto.Recipient) (bool, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for IsStateUntouched") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (bool, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) bool); ok { + r0 = returnFunc(account) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_IsStateUntouched_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsStateUntouched' +type MockEnrichedSmartState_IsStateUntouched_Call struct { + *mock.Call +} + +// IsStateUntouched is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockEnrichedSmartState_Expecter) IsStateUntouched(account interface{}) *MockEnrichedSmartState_IsStateUntouched_Call { + return &MockEnrichedSmartState_IsStateUntouched_Call{Call: _e.mock.On("IsStateUntouched", account)} +} + +func (_c *MockEnrichedSmartState_IsStateUntouched_Call) Run(run func(account proto.Recipient)) *MockEnrichedSmartState_IsStateUntouched_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_IsStateUntouched_Call) Return(b bool, err error) *MockEnrichedSmartState_IsStateUntouched_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockEnrichedSmartState_IsStateUntouched_Call) RunAndReturn(run func(account proto.Recipient) (bool, error)) *MockEnrichedSmartState_IsStateUntouched_Call { + _c.Call.Return(run) + return _c +} + +// NewestAddrByAlias provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestAddrByAlias(alias proto.Alias) (proto.WavesAddress, error) { + ret := _mock.Called(alias) + + if len(ret) == 0 { + panic("no return value specified for NewestAddrByAlias") + } + + var r0 proto.WavesAddress + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Alias) (proto.WavesAddress, error)); ok { + return returnFunc(alias) + } + if returnFunc, ok := ret.Get(0).(func(proto.Alias) proto.WavesAddress); ok { + r0 = returnFunc(alias) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.WavesAddress) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Alias) error); ok { + r1 = returnFunc(alias) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestAddrByAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAddrByAlias' +type MockEnrichedSmartState_NewestAddrByAlias_Call struct { + *mock.Call +} + +// NewestAddrByAlias is a helper method to define mock.On call +// - alias proto.Alias +func (_e *MockEnrichedSmartState_Expecter) NewestAddrByAlias(alias interface{}) *MockEnrichedSmartState_NewestAddrByAlias_Call { + return &MockEnrichedSmartState_NewestAddrByAlias_Call{Call: _e.mock.On("NewestAddrByAlias", alias)} +} + +func (_c *MockEnrichedSmartState_NewestAddrByAlias_Call) Run(run func(alias proto.Alias)) *MockEnrichedSmartState_NewestAddrByAlias_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Alias + if args[0] != nil { + arg0 = args[0].(proto.Alias) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAddrByAlias_Call) Return(wavesAddress proto.WavesAddress, err error) *MockEnrichedSmartState_NewestAddrByAlias_Call { + _c.Call.Return(wavesAddress, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAddrByAlias_Call) RunAndReturn(run func(alias proto.Alias) (proto.WavesAddress, error)) *MockEnrichedSmartState_NewestAddrByAlias_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetBalance provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestAssetBalance(account proto.Recipient, assetID crypto.Digest) (uint64, error) { + ret := _mock.Called(account, assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetBalance") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, crypto.Digest) (uint64, error)); ok { + return returnFunc(account, assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, crypto.Digest) uint64); ok { + r0 = returnFunc(account, assetID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, crypto.Digest) error); ok { + r1 = returnFunc(account, assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestAssetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetBalance' +type MockEnrichedSmartState_NewestAssetBalance_Call struct { + *mock.Call +} + +// NewestAssetBalance is a helper method to define mock.On call +// - account proto.Recipient +// - assetID crypto.Digest +func (_e *MockEnrichedSmartState_Expecter) NewestAssetBalance(account interface{}, assetID interface{}) *MockEnrichedSmartState_NewestAssetBalance_Call { + return &MockEnrichedSmartState_NewestAssetBalance_Call{Call: _e.mock.On("NewestAssetBalance", account, assetID)} +} + +func (_c *MockEnrichedSmartState_NewestAssetBalance_Call) Run(run func(account proto.Recipient, assetID crypto.Digest)) *MockEnrichedSmartState_NewestAssetBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 crypto.Digest + if args[1] != nil { + arg1 = args[1].(crypto.Digest) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetBalance_Call) Return(v uint64, err error) *MockEnrichedSmartState_NewestAssetBalance_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetBalance_Call) RunAndReturn(run func(account proto.Recipient, assetID crypto.Digest) (uint64, error)) *MockEnrichedSmartState_NewestAssetBalance_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetBalanceByAddressID provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestAssetBalanceByAddressID(id proto.AddressID, asset crypto.Digest) (uint64, error) { + ret := _mock.Called(id, asset) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetBalanceByAddressID") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AddressID, crypto.Digest) (uint64, error)); ok { + return returnFunc(id, asset) + } + if returnFunc, ok := ret.Get(0).(func(proto.AddressID, crypto.Digest) uint64); ok { + r0 = returnFunc(id, asset) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.AddressID, crypto.Digest) error); ok { + r1 = returnFunc(id, asset) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetBalanceByAddressID' +type MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call struct { + *mock.Call +} + +// NewestAssetBalanceByAddressID is a helper method to define mock.On call +// - id proto.AddressID +// - asset crypto.Digest +func (_e *MockEnrichedSmartState_Expecter) NewestAssetBalanceByAddressID(id interface{}, asset interface{}) *MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call { + return &MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call{Call: _e.mock.On("NewestAssetBalanceByAddressID", id, asset)} +} + +func (_c *MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call) Run(run func(id proto.AddressID, asset crypto.Digest)) *MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AddressID + if args[0] != nil { + arg0 = args[0].(proto.AddressID) + } + var arg1 crypto.Digest + if args[1] != nil { + arg1 = args[1].(crypto.Digest) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call) Return(v uint64, err error) *MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call) RunAndReturn(run func(id proto.AddressID, asset crypto.Digest) (uint64, error)) *MockEnrichedSmartState_NewestAssetBalanceByAddressID_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetConstInfo provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestAssetConstInfo(assetID proto.AssetID) (*proto.AssetConstInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetConstInfo") + } + + var r0 *proto.AssetConstInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (*proto.AssetConstInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) *proto.AssetConstInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.AssetConstInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestAssetConstInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetConstInfo' +type MockEnrichedSmartState_NewestAssetConstInfo_Call struct { + *mock.Call +} + +// NewestAssetConstInfo is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockEnrichedSmartState_Expecter) NewestAssetConstInfo(assetID interface{}) *MockEnrichedSmartState_NewestAssetConstInfo_Call { + return &MockEnrichedSmartState_NewestAssetConstInfo_Call{Call: _e.mock.On("NewestAssetConstInfo", assetID)} +} + +func (_c *MockEnrichedSmartState_NewestAssetConstInfo_Call) Run(run func(assetID proto.AssetID)) *MockEnrichedSmartState_NewestAssetConstInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetConstInfo_Call) Return(assetConstInfo *proto.AssetConstInfo, err error) *MockEnrichedSmartState_NewestAssetConstInfo_Call { + _c.Call.Return(assetConstInfo, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetConstInfo_Call) RunAndReturn(run func(assetID proto.AssetID) (*proto.AssetConstInfo, error)) *MockEnrichedSmartState_NewestAssetConstInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetInfo provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestAssetInfo(assetID crypto.Digest) (*proto.AssetInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetInfo") + } + + var r0 *proto.AssetInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*proto.AssetInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *proto.AssetInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.AssetInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestAssetInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetInfo' +type MockEnrichedSmartState_NewestAssetInfo_Call struct { + *mock.Call +} + +// NewestAssetInfo is a helper method to define mock.On call +// - assetID crypto.Digest +func (_e *MockEnrichedSmartState_Expecter) NewestAssetInfo(assetID interface{}) *MockEnrichedSmartState_NewestAssetInfo_Call { + return &MockEnrichedSmartState_NewestAssetInfo_Call{Call: _e.mock.On("NewestAssetInfo", assetID)} +} + +func (_c *MockEnrichedSmartState_NewestAssetInfo_Call) Run(run func(assetID crypto.Digest)) *MockEnrichedSmartState_NewestAssetInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetInfo_Call) Return(assetInfo *proto.AssetInfo, err error) *MockEnrichedSmartState_NewestAssetInfo_Call { + _c.Call.Return(assetInfo, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetInfo_Call) RunAndReturn(run func(assetID crypto.Digest) (*proto.AssetInfo, error)) *MockEnrichedSmartState_NewestAssetInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetIsSponsored provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestAssetIsSponsored(assetID crypto.Digest) (bool, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetIsSponsored") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (bool, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) bool); ok { + r0 = returnFunc(assetID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestAssetIsSponsored_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetIsSponsored' +type MockEnrichedSmartState_NewestAssetIsSponsored_Call struct { + *mock.Call +} + +// NewestAssetIsSponsored is a helper method to define mock.On call +// - assetID crypto.Digest +func (_e *MockEnrichedSmartState_Expecter) NewestAssetIsSponsored(assetID interface{}) *MockEnrichedSmartState_NewestAssetIsSponsored_Call { + return &MockEnrichedSmartState_NewestAssetIsSponsored_Call{Call: _e.mock.On("NewestAssetIsSponsored", assetID)} +} + +func (_c *MockEnrichedSmartState_NewestAssetIsSponsored_Call) Run(run func(assetID crypto.Digest)) *MockEnrichedSmartState_NewestAssetIsSponsored_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetIsSponsored_Call) Return(b bool, err error) *MockEnrichedSmartState_NewestAssetIsSponsored_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestAssetIsSponsored_Call) RunAndReturn(run func(assetID crypto.Digest) (bool, error)) *MockEnrichedSmartState_NewestAssetIsSponsored_Call { + _c.Call.Return(run) + return _c +} + +// NewestBlockInfoByHeight provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestBlockInfoByHeight(height proto.Height) (*proto.BlockInfo, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for NewestBlockInfoByHeight") + } + + var r0 *proto.BlockInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (*proto.BlockInfo, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) *proto.BlockInfo); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BlockInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestBlockInfoByHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestBlockInfoByHeight' +type MockEnrichedSmartState_NewestBlockInfoByHeight_Call struct { + *mock.Call +} + +// NewestBlockInfoByHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockEnrichedSmartState_Expecter) NewestBlockInfoByHeight(height interface{}) *MockEnrichedSmartState_NewestBlockInfoByHeight_Call { + return &MockEnrichedSmartState_NewestBlockInfoByHeight_Call{Call: _e.mock.On("NewestBlockInfoByHeight", height)} +} + +func (_c *MockEnrichedSmartState_NewestBlockInfoByHeight_Call) Run(run func(height proto.Height)) *MockEnrichedSmartState_NewestBlockInfoByHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestBlockInfoByHeight_Call) Return(blockInfo *proto.BlockInfo, err error) *MockEnrichedSmartState_NewestBlockInfoByHeight_Call { + _c.Call.Return(blockInfo, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestBlockInfoByHeight_Call) RunAndReturn(run func(height proto.Height) (*proto.BlockInfo, error)) *MockEnrichedSmartState_NewestBlockInfoByHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewestFullAssetInfo provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestFullAssetInfo(assetID crypto.Digest) (*proto.FullAssetInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestFullAssetInfo") + } + + var r0 *proto.FullAssetInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*proto.FullAssetInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *proto.FullAssetInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.FullAssetInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestFullAssetInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestFullAssetInfo' +type MockEnrichedSmartState_NewestFullAssetInfo_Call struct { + *mock.Call +} + +// NewestFullAssetInfo is a helper method to define mock.On call +// - assetID crypto.Digest +func (_e *MockEnrichedSmartState_Expecter) NewestFullAssetInfo(assetID interface{}) *MockEnrichedSmartState_NewestFullAssetInfo_Call { + return &MockEnrichedSmartState_NewestFullAssetInfo_Call{Call: _e.mock.On("NewestFullAssetInfo", assetID)} +} + +func (_c *MockEnrichedSmartState_NewestFullAssetInfo_Call) Run(run func(assetID crypto.Digest)) *MockEnrichedSmartState_NewestFullAssetInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestFullAssetInfo_Call) Return(fullAssetInfo *proto.FullAssetInfo, err error) *MockEnrichedSmartState_NewestFullAssetInfo_Call { + _c.Call.Return(fullAssetInfo, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestFullAssetInfo_Call) RunAndReturn(run func(assetID crypto.Digest) (*proto.FullAssetInfo, error)) *MockEnrichedSmartState_NewestFullAssetInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewestFullWavesBalance provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestFullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestFullWavesBalance") + } + + var r0 *proto.FullWavesBalance + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (*proto.FullWavesBalance, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) *proto.FullWavesBalance); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.FullWavesBalance) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestFullWavesBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestFullWavesBalance' +type MockEnrichedSmartState_NewestFullWavesBalance_Call struct { + *mock.Call +} + +// NewestFullWavesBalance is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockEnrichedSmartState_Expecter) NewestFullWavesBalance(account interface{}) *MockEnrichedSmartState_NewestFullWavesBalance_Call { + return &MockEnrichedSmartState_NewestFullWavesBalance_Call{Call: _e.mock.On("NewestFullWavesBalance", account)} +} + +func (_c *MockEnrichedSmartState_NewestFullWavesBalance_Call) Run(run func(account proto.Recipient)) *MockEnrichedSmartState_NewestFullWavesBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestFullWavesBalance_Call) Return(fullWavesBalance *proto.FullWavesBalance, err error) *MockEnrichedSmartState_NewestFullWavesBalance_Call { + _c.Call.Return(fullWavesBalance, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestFullWavesBalance_Call) RunAndReturn(run func(account proto.Recipient) (*proto.FullWavesBalance, error)) *MockEnrichedSmartState_NewestFullWavesBalance_Call { + _c.Call.Return(run) + return _c +} + +// NewestLeasingInfo provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestLeasingInfo(id crypto.Digest) (*proto.LeaseInfo, error) { + ret := _mock.Called(id) + + if len(ret) == 0 { + panic("no return value specified for NewestLeasingInfo") + } + + var r0 *proto.LeaseInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*proto.LeaseInfo, error)); ok { + return returnFunc(id) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *proto.LeaseInfo); ok { + r0 = returnFunc(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.LeaseInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(id) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestLeasingInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestLeasingInfo' +type MockEnrichedSmartState_NewestLeasingInfo_Call struct { + *mock.Call +} + +// NewestLeasingInfo is a helper method to define mock.On call +// - id crypto.Digest +func (_e *MockEnrichedSmartState_Expecter) NewestLeasingInfo(id interface{}) *MockEnrichedSmartState_NewestLeasingInfo_Call { + return &MockEnrichedSmartState_NewestLeasingInfo_Call{Call: _e.mock.On("NewestLeasingInfo", id)} +} + +func (_c *MockEnrichedSmartState_NewestLeasingInfo_Call) Run(run func(id crypto.Digest)) *MockEnrichedSmartState_NewestLeasingInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestLeasingInfo_Call) Return(leaseInfo *proto.LeaseInfo, err error) *MockEnrichedSmartState_NewestLeasingInfo_Call { + _c.Call.Return(leaseInfo, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestLeasingInfo_Call) RunAndReturn(run func(id crypto.Digest) (*proto.LeaseInfo, error)) *MockEnrichedSmartState_NewestLeasingInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewestRecipientToAddress provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestRecipientToAddress(recipient proto.Recipient) (proto.WavesAddress, error) { + ret := _mock.Called(recipient) + + if len(ret) == 0 { + panic("no return value specified for NewestRecipientToAddress") + } + + var r0 proto.WavesAddress + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (proto.WavesAddress, error)); ok { + return returnFunc(recipient) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) proto.WavesAddress); ok { + r0 = returnFunc(recipient) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.WavesAddress) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(recipient) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestRecipientToAddress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestRecipientToAddress' +type MockEnrichedSmartState_NewestRecipientToAddress_Call struct { + *mock.Call +} + +// NewestRecipientToAddress is a helper method to define mock.On call +// - recipient proto.Recipient +func (_e *MockEnrichedSmartState_Expecter) NewestRecipientToAddress(recipient interface{}) *MockEnrichedSmartState_NewestRecipientToAddress_Call { + return &MockEnrichedSmartState_NewestRecipientToAddress_Call{Call: _e.mock.On("NewestRecipientToAddress", recipient)} +} + +func (_c *MockEnrichedSmartState_NewestRecipientToAddress_Call) Run(run func(recipient proto.Recipient)) *MockEnrichedSmartState_NewestRecipientToAddress_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestRecipientToAddress_Call) Return(wavesAddress proto.WavesAddress, err error) *MockEnrichedSmartState_NewestRecipientToAddress_Call { + _c.Call.Return(wavesAddress, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestRecipientToAddress_Call) RunAndReturn(run func(recipient proto.Recipient) (proto.WavesAddress, error)) *MockEnrichedSmartState_NewestRecipientToAddress_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptByAccount provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestScriptByAccount(account proto.Recipient) (*ast.Tree, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptByAccount") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (*ast.Tree, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) *ast.Tree); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestScriptByAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptByAccount' +type MockEnrichedSmartState_NewestScriptByAccount_Call struct { + *mock.Call +} + +// NewestScriptByAccount is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockEnrichedSmartState_Expecter) NewestScriptByAccount(account interface{}) *MockEnrichedSmartState_NewestScriptByAccount_Call { + return &MockEnrichedSmartState_NewestScriptByAccount_Call{Call: _e.mock.On("NewestScriptByAccount", account)} +} + +func (_c *MockEnrichedSmartState_NewestScriptByAccount_Call) Run(run func(account proto.Recipient)) *MockEnrichedSmartState_NewestScriptByAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestScriptByAccount_Call) Return(tree *ast.Tree, err error) *MockEnrichedSmartState_NewestScriptByAccount_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestScriptByAccount_Call) RunAndReturn(run func(account proto.Recipient) (*ast.Tree, error)) *MockEnrichedSmartState_NewestScriptByAccount_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptByAsset provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestScriptByAsset(assetID crypto.Digest) (*ast.Tree, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptByAsset") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*ast.Tree, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *ast.Tree); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestScriptByAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptByAsset' +type MockEnrichedSmartState_NewestScriptByAsset_Call struct { + *mock.Call +} + +// NewestScriptByAsset is a helper method to define mock.On call +// - assetID crypto.Digest +func (_e *MockEnrichedSmartState_Expecter) NewestScriptByAsset(assetID interface{}) *MockEnrichedSmartState_NewestScriptByAsset_Call { + return &MockEnrichedSmartState_NewestScriptByAsset_Call{Call: _e.mock.On("NewestScriptByAsset", assetID)} +} + +func (_c *MockEnrichedSmartState_NewestScriptByAsset_Call) Run(run func(assetID crypto.Digest)) *MockEnrichedSmartState_NewestScriptByAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestScriptByAsset_Call) Return(tree *ast.Tree, err error) *MockEnrichedSmartState_NewestScriptByAsset_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestScriptByAsset_Call) RunAndReturn(run func(assetID crypto.Digest) (*ast.Tree, error)) *MockEnrichedSmartState_NewestScriptByAsset_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptBytesByAccount provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestScriptBytesByAccount(account proto.Recipient) (proto.Script, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptBytesByAccount") + } + + var r0 proto.Script + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (proto.Script, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) proto.Script); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Script) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestScriptBytesByAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptBytesByAccount' +type MockEnrichedSmartState_NewestScriptBytesByAccount_Call struct { + *mock.Call +} + +// NewestScriptBytesByAccount is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockEnrichedSmartState_Expecter) NewestScriptBytesByAccount(account interface{}) *MockEnrichedSmartState_NewestScriptBytesByAccount_Call { + return &MockEnrichedSmartState_NewestScriptBytesByAccount_Call{Call: _e.mock.On("NewestScriptBytesByAccount", account)} +} + +func (_c *MockEnrichedSmartState_NewestScriptBytesByAccount_Call) Run(run func(account proto.Recipient)) *MockEnrichedSmartState_NewestScriptBytesByAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestScriptBytesByAccount_Call) Return(script proto.Script, err error) *MockEnrichedSmartState_NewestScriptBytesByAccount_Call { + _c.Call.Return(script, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestScriptBytesByAccount_Call) RunAndReturn(run func(account proto.Recipient) (proto.Script, error)) *MockEnrichedSmartState_NewestScriptBytesByAccount_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptPKByAddr provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestScriptPKByAddr(addr proto.WavesAddress) (crypto.PublicKey, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptPKByAddr") + } + + var r0 crypto.PublicKey + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (crypto.PublicKey, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) crypto.PublicKey); ok { + r0 = returnFunc(addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(crypto.PublicKey) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestScriptPKByAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptPKByAddr' +type MockEnrichedSmartState_NewestScriptPKByAddr_Call struct { + *mock.Call +} + +// NewestScriptPKByAddr is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockEnrichedSmartState_Expecter) NewestScriptPKByAddr(addr interface{}) *MockEnrichedSmartState_NewestScriptPKByAddr_Call { + return &MockEnrichedSmartState_NewestScriptPKByAddr_Call{Call: _e.mock.On("NewestScriptPKByAddr", addr)} +} + +func (_c *MockEnrichedSmartState_NewestScriptPKByAddr_Call) Run(run func(addr proto.WavesAddress)) *MockEnrichedSmartState_NewestScriptPKByAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestScriptPKByAddr_Call) Return(publicKey crypto.PublicKey, err error) *MockEnrichedSmartState_NewestScriptPKByAddr_Call { + _c.Call.Return(publicKey, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestScriptPKByAddr_Call) RunAndReturn(run func(addr proto.WavesAddress) (crypto.PublicKey, error)) *MockEnrichedSmartState_NewestScriptPKByAddr_Call { + _c.Call.Return(run) + return _c +} + +// NewestTransactionByID provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestTransactionByID(bytes []byte) (proto.Transaction, error) { + ret := _mock.Called(bytes) + + if len(ret) == 0 { + panic("no return value specified for NewestTransactionByID") + } + + var r0 proto.Transaction + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (proto.Transaction, error)); ok { + return returnFunc(bytes) + } + if returnFunc, ok := ret.Get(0).(func([]byte) proto.Transaction); ok { + r0 = returnFunc(bytes) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Transaction) + } + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(bytes) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestTransactionByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestTransactionByID' +type MockEnrichedSmartState_NewestTransactionByID_Call struct { + *mock.Call +} + +// NewestTransactionByID is a helper method to define mock.On call +// - bytes []byte +func (_e *MockEnrichedSmartState_Expecter) NewestTransactionByID(bytes interface{}) *MockEnrichedSmartState_NewestTransactionByID_Call { + return &MockEnrichedSmartState_NewestTransactionByID_Call{Call: _e.mock.On("NewestTransactionByID", bytes)} +} + +func (_c *MockEnrichedSmartState_NewestTransactionByID_Call) Run(run func(bytes []byte)) *MockEnrichedSmartState_NewestTransactionByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestTransactionByID_Call) Return(transaction proto.Transaction, err error) *MockEnrichedSmartState_NewestTransactionByID_Call { + _c.Call.Return(transaction, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestTransactionByID_Call) RunAndReturn(run func(bytes []byte) (proto.Transaction, error)) *MockEnrichedSmartState_NewestTransactionByID_Call { + _c.Call.Return(run) + return _c +} + +// NewestTransactionHeightByID provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestTransactionHeightByID(bytes []byte) (uint64, error) { + ret := _mock.Called(bytes) + + if len(ret) == 0 { + panic("no return value specified for NewestTransactionHeightByID") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (uint64, error)); ok { + return returnFunc(bytes) + } + if returnFunc, ok := ret.Get(0).(func([]byte) uint64); ok { + r0 = returnFunc(bytes) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(bytes) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestTransactionHeightByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestTransactionHeightByID' +type MockEnrichedSmartState_NewestTransactionHeightByID_Call struct { + *mock.Call +} + +// NewestTransactionHeightByID is a helper method to define mock.On call +// - bytes []byte +func (_e *MockEnrichedSmartState_Expecter) NewestTransactionHeightByID(bytes interface{}) *MockEnrichedSmartState_NewestTransactionHeightByID_Call { + return &MockEnrichedSmartState_NewestTransactionHeightByID_Call{Call: _e.mock.On("NewestTransactionHeightByID", bytes)} +} + +func (_c *MockEnrichedSmartState_NewestTransactionHeightByID_Call) Run(run func(bytes []byte)) *MockEnrichedSmartState_NewestTransactionHeightByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestTransactionHeightByID_Call) Return(v uint64, err error) *MockEnrichedSmartState_NewestTransactionHeightByID_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestTransactionHeightByID_Call) RunAndReturn(run func(bytes []byte) (uint64, error)) *MockEnrichedSmartState_NewestTransactionHeightByID_Call { + _c.Call.Return(run) + return _c +} + +// NewestWavesBalance provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) NewestWavesBalance(account proto.Recipient) (uint64, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestWavesBalance") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (uint64, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) uint64); ok { + r0 = returnFunc(account) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_NewestWavesBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestWavesBalance' +type MockEnrichedSmartState_NewestWavesBalance_Call struct { + *mock.Call +} + +// NewestWavesBalance is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockEnrichedSmartState_Expecter) NewestWavesBalance(account interface{}) *MockEnrichedSmartState_NewestWavesBalance_Call { + return &MockEnrichedSmartState_NewestWavesBalance_Call{Call: _e.mock.On("NewestWavesBalance", account)} +} + +func (_c *MockEnrichedSmartState_NewestWavesBalance_Call) Run(run func(account proto.Recipient)) *MockEnrichedSmartState_NewestWavesBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_NewestWavesBalance_Call) Return(v uint64, err error) *MockEnrichedSmartState_NewestWavesBalance_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockEnrichedSmartState_NewestWavesBalance_Call) RunAndReturn(run func(account proto.Recipient) (uint64, error)) *MockEnrichedSmartState_NewestWavesBalance_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveEntries provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for RetrieveEntries") + } + + var r0 []proto.DataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) ([]proto.DataEntry, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) []proto.DataEntry); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]proto.DataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_RetrieveEntries_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntries' +type MockEnrichedSmartState_RetrieveEntries_Call struct { + *mock.Call +} + +// RetrieveEntries is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockEnrichedSmartState_Expecter) RetrieveEntries(account interface{}) *MockEnrichedSmartState_RetrieveEntries_Call { + return &MockEnrichedSmartState_RetrieveEntries_Call{Call: _e.mock.On("RetrieveEntries", account)} +} + +func (_c *MockEnrichedSmartState_RetrieveEntries_Call) Run(run func(account proto.Recipient)) *MockEnrichedSmartState_RetrieveEntries_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveEntries_Call) Return(dataEntrys []proto.DataEntry, err error) *MockEnrichedSmartState_RetrieveEntries_Call { + _c.Call.Return(dataEntrys, err) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveEntries_Call) RunAndReturn(run func(account proto.Recipient) ([]proto.DataEntry, error)) *MockEnrichedSmartState_RetrieveEntries_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveNewestBinaryEntry provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) RetrieveNewestBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveNewestBinaryEntry") + } + + var r0 *proto.BinaryDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.BinaryDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.BinaryDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BinaryDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveNewestBinaryEntry' +type MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call struct { + *mock.Call +} + +// RetrieveNewestBinaryEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockEnrichedSmartState_Expecter) RetrieveNewestBinaryEntry(account interface{}, key interface{}) *MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call { + return &MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call{Call: _e.mock.On("RetrieveNewestBinaryEntry", account, key)} +} + +func (_c *MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call) Run(run func(account proto.Recipient, key string)) *MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call) Return(binaryDataEntry *proto.BinaryDataEntry, err error) *MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call { + _c.Call.Return(binaryDataEntry, err) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error)) *MockEnrichedSmartState_RetrieveNewestBinaryEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveNewestBooleanEntry provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) RetrieveNewestBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveNewestBooleanEntry") + } + + var r0 *proto.BooleanDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.BooleanDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.BooleanDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BooleanDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveNewestBooleanEntry' +type MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call struct { + *mock.Call +} + +// RetrieveNewestBooleanEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockEnrichedSmartState_Expecter) RetrieveNewestBooleanEntry(account interface{}, key interface{}) *MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call { + return &MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call{Call: _e.mock.On("RetrieveNewestBooleanEntry", account, key)} +} + +func (_c *MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call) Run(run func(account proto.Recipient, key string)) *MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call) Return(booleanDataEntry *proto.BooleanDataEntry, err error) *MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call { + _c.Call.Return(booleanDataEntry, err) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error)) *MockEnrichedSmartState_RetrieveNewestBooleanEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveNewestIntegerEntry provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) RetrieveNewestIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveNewestIntegerEntry") + } + + var r0 *proto.IntegerDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.IntegerDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.IntegerDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.IntegerDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveNewestIntegerEntry' +type MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call struct { + *mock.Call +} + +// RetrieveNewestIntegerEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockEnrichedSmartState_Expecter) RetrieveNewestIntegerEntry(account interface{}, key interface{}) *MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call { + return &MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call{Call: _e.mock.On("RetrieveNewestIntegerEntry", account, key)} +} + +func (_c *MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call) Run(run func(account proto.Recipient, key string)) *MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call) Return(integerDataEntry *proto.IntegerDataEntry, err error) *MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call { + _c.Call.Return(integerDataEntry, err) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error)) *MockEnrichedSmartState_RetrieveNewestIntegerEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveNewestStringEntry provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) RetrieveNewestStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveNewestStringEntry") + } + + var r0 *proto.StringDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.StringDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.StringDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.StringDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_RetrieveNewestStringEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveNewestStringEntry' +type MockEnrichedSmartState_RetrieveNewestStringEntry_Call struct { + *mock.Call +} + +// RetrieveNewestStringEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockEnrichedSmartState_Expecter) RetrieveNewestStringEntry(account interface{}, key interface{}) *MockEnrichedSmartState_RetrieveNewestStringEntry_Call { + return &MockEnrichedSmartState_RetrieveNewestStringEntry_Call{Call: _e.mock.On("RetrieveNewestStringEntry", account, key)} +} + +func (_c *MockEnrichedSmartState_RetrieveNewestStringEntry_Call) Run(run func(account proto.Recipient, key string)) *MockEnrichedSmartState_RetrieveNewestStringEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveNewestStringEntry_Call) Return(stringDataEntry *proto.StringDataEntry, err error) *MockEnrichedSmartState_RetrieveNewestStringEntry_Call { + _c.Call.Return(stringDataEntry, err) + return _c +} + +func (_c *MockEnrichedSmartState_RetrieveNewestStringEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.StringDataEntry, error)) *MockEnrichedSmartState_RetrieveNewestStringEntry_Call { + _c.Call.Return(run) + return _c +} + +// WavesBalanceProfile provides a mock function for the type MockEnrichedSmartState +func (_mock *MockEnrichedSmartState) WavesBalanceProfile(id proto.AddressID) (*WavesBalanceProfile, error) { + ret := _mock.Called(id) + + if len(ret) == 0 { + panic("no return value specified for WavesBalanceProfile") + } + + var r0 *WavesBalanceProfile + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AddressID) (*WavesBalanceProfile, error)); ok { + return returnFunc(id) + } + if returnFunc, ok := ret.Get(0).(func(proto.AddressID) *WavesBalanceProfile); ok { + r0 = returnFunc(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*WavesBalanceProfile) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AddressID) error); ok { + r1 = returnFunc(id) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockEnrichedSmartState_WavesBalanceProfile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WavesBalanceProfile' +type MockEnrichedSmartState_WavesBalanceProfile_Call struct { + *mock.Call +} + +// WavesBalanceProfile is a helper method to define mock.On call +// - id proto.AddressID +func (_e *MockEnrichedSmartState_Expecter) WavesBalanceProfile(id interface{}) *MockEnrichedSmartState_WavesBalanceProfile_Call { + return &MockEnrichedSmartState_WavesBalanceProfile_Call{Call: _e.mock.On("WavesBalanceProfile", id)} +} + +func (_c *MockEnrichedSmartState_WavesBalanceProfile_Call) Run(run func(id proto.AddressID)) *MockEnrichedSmartState_WavesBalanceProfile_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AddressID + if args[0] != nil { + arg0 = args[0].(proto.AddressID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockEnrichedSmartState_WavesBalanceProfile_Call) Return(wavesBalanceProfile *WavesBalanceProfile, err error) *MockEnrichedSmartState_WavesBalanceProfile_Call { + _c.Call.Return(wavesBalanceProfile, err) + return _c +} + +func (_c *MockEnrichedSmartState_WavesBalanceProfile_Call) RunAndReturn(run func(id proto.AddressID) (*WavesBalanceProfile, error)) *MockEnrichedSmartState_WavesBalanceProfile_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/types/mock_smart_state.go b/pkg/types/mock_smart_state.go new file mode 100644 index 0000000000..6aa2dc12da --- /dev/null +++ b/pkg/types/mock_smart_state.go @@ -0,0 +1,1642 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package types + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/wavesplatform/gowaves/pkg/crypto" + "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/ride/ast" +) + +// NewMockSmartState creates a new instance of MockSmartState. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockSmartState(t interface { + mock.TestingT + Cleanup(func()) +}) *MockSmartState { + mock := &MockSmartState{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockSmartState is an autogenerated mock type for the SmartState type +type MockSmartState struct { + mock.Mock +} + +type MockSmartState_Expecter struct { + mock *mock.Mock +} + +func (_m *MockSmartState) EXPECT() *MockSmartState_Expecter { + return &MockSmartState_Expecter{mock: &_m.Mock} +} + +// AddingBlockHeight provides a mock function for the type MockSmartState +func (_mock *MockSmartState) AddingBlockHeight() (uint64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddingBlockHeight") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() (uint64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() uint64); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_AddingBlockHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddingBlockHeight' +type MockSmartState_AddingBlockHeight_Call struct { + *mock.Call +} + +// AddingBlockHeight is a helper method to define mock.On call +func (_e *MockSmartState_Expecter) AddingBlockHeight() *MockSmartState_AddingBlockHeight_Call { + return &MockSmartState_AddingBlockHeight_Call{Call: _e.mock.On("AddingBlockHeight")} +} + +func (_c *MockSmartState_AddingBlockHeight_Call) Run(run func()) *MockSmartState_AddingBlockHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockSmartState_AddingBlockHeight_Call) Return(v uint64, err error) *MockSmartState_AddingBlockHeight_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockSmartState_AddingBlockHeight_Call) RunAndReturn(run func() (uint64, error)) *MockSmartState_AddingBlockHeight_Call { + _c.Call.Return(run) + return _c +} + +// EstimatorVersion provides a mock function for the type MockSmartState +func (_mock *MockSmartState) EstimatorVersion() (int, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for EstimatorVersion") + } + + var r0 int + var r1 error + if returnFunc, ok := ret.Get(0).(func() (int, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() int); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(int) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_EstimatorVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EstimatorVersion' +type MockSmartState_EstimatorVersion_Call struct { + *mock.Call +} + +// EstimatorVersion is a helper method to define mock.On call +func (_e *MockSmartState_Expecter) EstimatorVersion() *MockSmartState_EstimatorVersion_Call { + return &MockSmartState_EstimatorVersion_Call{Call: _e.mock.On("EstimatorVersion")} +} + +func (_c *MockSmartState_EstimatorVersion_Call) Run(run func()) *MockSmartState_EstimatorVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockSmartState_EstimatorVersion_Call) Return(n int, err error) *MockSmartState_EstimatorVersion_Call { + _c.Call.Return(n, err) + return _c +} + +func (_c *MockSmartState_EstimatorVersion_Call) RunAndReturn(run func() (int, error)) *MockSmartState_EstimatorVersion_Call { + _c.Call.Return(run) + return _c +} + +// IsNotFound provides a mock function for the type MockSmartState +func (_mock *MockSmartState) IsNotFound(err error) bool { + ret := _mock.Called(err) + + if len(ret) == 0 { + panic("no return value specified for IsNotFound") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(error) bool); ok { + r0 = returnFunc(err) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockSmartState_IsNotFound_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsNotFound' +type MockSmartState_IsNotFound_Call struct { + *mock.Call +} + +// IsNotFound is a helper method to define mock.On call +// - err error +func (_e *MockSmartState_Expecter) IsNotFound(err interface{}) *MockSmartState_IsNotFound_Call { + return &MockSmartState_IsNotFound_Call{Call: _e.mock.On("IsNotFound", err)} +} + +func (_c *MockSmartState_IsNotFound_Call) Run(run func(err error)) *MockSmartState_IsNotFound_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 error + if args[0] != nil { + arg0 = args[0].(error) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_IsNotFound_Call) Return(b bool) *MockSmartState_IsNotFound_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockSmartState_IsNotFound_Call) RunAndReturn(run func(err error) bool) *MockSmartState_IsNotFound_Call { + _c.Call.Return(run) + return _c +} + +// IsStateUntouched provides a mock function for the type MockSmartState +func (_mock *MockSmartState) IsStateUntouched(account proto.Recipient) (bool, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for IsStateUntouched") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (bool, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) bool); ok { + r0 = returnFunc(account) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_IsStateUntouched_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsStateUntouched' +type MockSmartState_IsStateUntouched_Call struct { + *mock.Call +} + +// IsStateUntouched is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockSmartState_Expecter) IsStateUntouched(account interface{}) *MockSmartState_IsStateUntouched_Call { + return &MockSmartState_IsStateUntouched_Call{Call: _e.mock.On("IsStateUntouched", account)} +} + +func (_c *MockSmartState_IsStateUntouched_Call) Run(run func(account proto.Recipient)) *MockSmartState_IsStateUntouched_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_IsStateUntouched_Call) Return(b bool, err error) *MockSmartState_IsStateUntouched_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockSmartState_IsStateUntouched_Call) RunAndReturn(run func(account proto.Recipient) (bool, error)) *MockSmartState_IsStateUntouched_Call { + _c.Call.Return(run) + return _c +} + +// NewestAddrByAlias provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestAddrByAlias(alias proto.Alias) (proto.WavesAddress, error) { + ret := _mock.Called(alias) + + if len(ret) == 0 { + panic("no return value specified for NewestAddrByAlias") + } + + var r0 proto.WavesAddress + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Alias) (proto.WavesAddress, error)); ok { + return returnFunc(alias) + } + if returnFunc, ok := ret.Get(0).(func(proto.Alias) proto.WavesAddress); ok { + r0 = returnFunc(alias) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.WavesAddress) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Alias) error); ok { + r1 = returnFunc(alias) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestAddrByAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAddrByAlias' +type MockSmartState_NewestAddrByAlias_Call struct { + *mock.Call +} + +// NewestAddrByAlias is a helper method to define mock.On call +// - alias proto.Alias +func (_e *MockSmartState_Expecter) NewestAddrByAlias(alias interface{}) *MockSmartState_NewestAddrByAlias_Call { + return &MockSmartState_NewestAddrByAlias_Call{Call: _e.mock.On("NewestAddrByAlias", alias)} +} + +func (_c *MockSmartState_NewestAddrByAlias_Call) Run(run func(alias proto.Alias)) *MockSmartState_NewestAddrByAlias_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Alias + if args[0] != nil { + arg0 = args[0].(proto.Alias) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestAddrByAlias_Call) Return(wavesAddress proto.WavesAddress, err error) *MockSmartState_NewestAddrByAlias_Call { + _c.Call.Return(wavesAddress, err) + return _c +} + +func (_c *MockSmartState_NewestAddrByAlias_Call) RunAndReturn(run func(alias proto.Alias) (proto.WavesAddress, error)) *MockSmartState_NewestAddrByAlias_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetBalance provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestAssetBalance(account proto.Recipient, assetID crypto.Digest) (uint64, error) { + ret := _mock.Called(account, assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetBalance") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, crypto.Digest) (uint64, error)); ok { + return returnFunc(account, assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, crypto.Digest) uint64); ok { + r0 = returnFunc(account, assetID) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, crypto.Digest) error); ok { + r1 = returnFunc(account, assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestAssetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetBalance' +type MockSmartState_NewestAssetBalance_Call struct { + *mock.Call +} + +// NewestAssetBalance is a helper method to define mock.On call +// - account proto.Recipient +// - assetID crypto.Digest +func (_e *MockSmartState_Expecter) NewestAssetBalance(account interface{}, assetID interface{}) *MockSmartState_NewestAssetBalance_Call { + return &MockSmartState_NewestAssetBalance_Call{Call: _e.mock.On("NewestAssetBalance", account, assetID)} +} + +func (_c *MockSmartState_NewestAssetBalance_Call) Run(run func(account proto.Recipient, assetID crypto.Digest)) *MockSmartState_NewestAssetBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 crypto.Digest + if args[1] != nil { + arg1 = args[1].(crypto.Digest) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestAssetBalance_Call) Return(v uint64, err error) *MockSmartState_NewestAssetBalance_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockSmartState_NewestAssetBalance_Call) RunAndReturn(run func(account proto.Recipient, assetID crypto.Digest) (uint64, error)) *MockSmartState_NewestAssetBalance_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetConstInfo provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestAssetConstInfo(assetID proto.AssetID) (*proto.AssetConstInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetConstInfo") + } + + var r0 *proto.AssetConstInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) (*proto.AssetConstInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(proto.AssetID) *proto.AssetConstInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.AssetConstInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.AssetID) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestAssetConstInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetConstInfo' +type MockSmartState_NewestAssetConstInfo_Call struct { + *mock.Call +} + +// NewestAssetConstInfo is a helper method to define mock.On call +// - assetID proto.AssetID +func (_e *MockSmartState_Expecter) NewestAssetConstInfo(assetID interface{}) *MockSmartState_NewestAssetConstInfo_Call { + return &MockSmartState_NewestAssetConstInfo_Call{Call: _e.mock.On("NewestAssetConstInfo", assetID)} +} + +func (_c *MockSmartState_NewestAssetConstInfo_Call) Run(run func(assetID proto.AssetID)) *MockSmartState_NewestAssetConstInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.AssetID + if args[0] != nil { + arg0 = args[0].(proto.AssetID) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestAssetConstInfo_Call) Return(assetConstInfo *proto.AssetConstInfo, err error) *MockSmartState_NewestAssetConstInfo_Call { + _c.Call.Return(assetConstInfo, err) + return _c +} + +func (_c *MockSmartState_NewestAssetConstInfo_Call) RunAndReturn(run func(assetID proto.AssetID) (*proto.AssetConstInfo, error)) *MockSmartState_NewestAssetConstInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetInfo provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestAssetInfo(assetID crypto.Digest) (*proto.AssetInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetInfo") + } + + var r0 *proto.AssetInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*proto.AssetInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *proto.AssetInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.AssetInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestAssetInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetInfo' +type MockSmartState_NewestAssetInfo_Call struct { + *mock.Call +} + +// NewestAssetInfo is a helper method to define mock.On call +// - assetID crypto.Digest +func (_e *MockSmartState_Expecter) NewestAssetInfo(assetID interface{}) *MockSmartState_NewestAssetInfo_Call { + return &MockSmartState_NewestAssetInfo_Call{Call: _e.mock.On("NewestAssetInfo", assetID)} +} + +func (_c *MockSmartState_NewestAssetInfo_Call) Run(run func(assetID crypto.Digest)) *MockSmartState_NewestAssetInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestAssetInfo_Call) Return(assetInfo *proto.AssetInfo, err error) *MockSmartState_NewestAssetInfo_Call { + _c.Call.Return(assetInfo, err) + return _c +} + +func (_c *MockSmartState_NewestAssetInfo_Call) RunAndReturn(run func(assetID crypto.Digest) (*proto.AssetInfo, error)) *MockSmartState_NewestAssetInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewestAssetIsSponsored provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestAssetIsSponsored(assetID crypto.Digest) (bool, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestAssetIsSponsored") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (bool, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) bool); ok { + r0 = returnFunc(assetID) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestAssetIsSponsored_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestAssetIsSponsored' +type MockSmartState_NewestAssetIsSponsored_Call struct { + *mock.Call +} + +// NewestAssetIsSponsored is a helper method to define mock.On call +// - assetID crypto.Digest +func (_e *MockSmartState_Expecter) NewestAssetIsSponsored(assetID interface{}) *MockSmartState_NewestAssetIsSponsored_Call { + return &MockSmartState_NewestAssetIsSponsored_Call{Call: _e.mock.On("NewestAssetIsSponsored", assetID)} +} + +func (_c *MockSmartState_NewestAssetIsSponsored_Call) Run(run func(assetID crypto.Digest)) *MockSmartState_NewestAssetIsSponsored_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestAssetIsSponsored_Call) Return(b bool, err error) *MockSmartState_NewestAssetIsSponsored_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockSmartState_NewestAssetIsSponsored_Call) RunAndReturn(run func(assetID crypto.Digest) (bool, error)) *MockSmartState_NewestAssetIsSponsored_Call { + _c.Call.Return(run) + return _c +} + +// NewestBlockInfoByHeight provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestBlockInfoByHeight(height proto.Height) (*proto.BlockInfo, error) { + ret := _mock.Called(height) + + if len(ret) == 0 { + panic("no return value specified for NewestBlockInfoByHeight") + } + + var r0 *proto.BlockInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Height) (*proto.BlockInfo, error)); ok { + return returnFunc(height) + } + if returnFunc, ok := ret.Get(0).(func(proto.Height) *proto.BlockInfo); ok { + r0 = returnFunc(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BlockInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Height) error); ok { + r1 = returnFunc(height) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestBlockInfoByHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestBlockInfoByHeight' +type MockSmartState_NewestBlockInfoByHeight_Call struct { + *mock.Call +} + +// NewestBlockInfoByHeight is a helper method to define mock.On call +// - height proto.Height +func (_e *MockSmartState_Expecter) NewestBlockInfoByHeight(height interface{}) *MockSmartState_NewestBlockInfoByHeight_Call { + return &MockSmartState_NewestBlockInfoByHeight_Call{Call: _e.mock.On("NewestBlockInfoByHeight", height)} +} + +func (_c *MockSmartState_NewestBlockInfoByHeight_Call) Run(run func(height proto.Height)) *MockSmartState_NewestBlockInfoByHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Height + if args[0] != nil { + arg0 = args[0].(proto.Height) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestBlockInfoByHeight_Call) Return(blockInfo *proto.BlockInfo, err error) *MockSmartState_NewestBlockInfoByHeight_Call { + _c.Call.Return(blockInfo, err) + return _c +} + +func (_c *MockSmartState_NewestBlockInfoByHeight_Call) RunAndReturn(run func(height proto.Height) (*proto.BlockInfo, error)) *MockSmartState_NewestBlockInfoByHeight_Call { + _c.Call.Return(run) + return _c +} + +// NewestFullAssetInfo provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestFullAssetInfo(assetID crypto.Digest) (*proto.FullAssetInfo, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestFullAssetInfo") + } + + var r0 *proto.FullAssetInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*proto.FullAssetInfo, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *proto.FullAssetInfo); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.FullAssetInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestFullAssetInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestFullAssetInfo' +type MockSmartState_NewestFullAssetInfo_Call struct { + *mock.Call +} + +// NewestFullAssetInfo is a helper method to define mock.On call +// - assetID crypto.Digest +func (_e *MockSmartState_Expecter) NewestFullAssetInfo(assetID interface{}) *MockSmartState_NewestFullAssetInfo_Call { + return &MockSmartState_NewestFullAssetInfo_Call{Call: _e.mock.On("NewestFullAssetInfo", assetID)} +} + +func (_c *MockSmartState_NewestFullAssetInfo_Call) Run(run func(assetID crypto.Digest)) *MockSmartState_NewestFullAssetInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestFullAssetInfo_Call) Return(fullAssetInfo *proto.FullAssetInfo, err error) *MockSmartState_NewestFullAssetInfo_Call { + _c.Call.Return(fullAssetInfo, err) + return _c +} + +func (_c *MockSmartState_NewestFullAssetInfo_Call) RunAndReturn(run func(assetID crypto.Digest) (*proto.FullAssetInfo, error)) *MockSmartState_NewestFullAssetInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewestFullWavesBalance provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestFullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestFullWavesBalance") + } + + var r0 *proto.FullWavesBalance + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (*proto.FullWavesBalance, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) *proto.FullWavesBalance); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.FullWavesBalance) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestFullWavesBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestFullWavesBalance' +type MockSmartState_NewestFullWavesBalance_Call struct { + *mock.Call +} + +// NewestFullWavesBalance is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockSmartState_Expecter) NewestFullWavesBalance(account interface{}) *MockSmartState_NewestFullWavesBalance_Call { + return &MockSmartState_NewestFullWavesBalance_Call{Call: _e.mock.On("NewestFullWavesBalance", account)} +} + +func (_c *MockSmartState_NewestFullWavesBalance_Call) Run(run func(account proto.Recipient)) *MockSmartState_NewestFullWavesBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestFullWavesBalance_Call) Return(fullWavesBalance *proto.FullWavesBalance, err error) *MockSmartState_NewestFullWavesBalance_Call { + _c.Call.Return(fullWavesBalance, err) + return _c +} + +func (_c *MockSmartState_NewestFullWavesBalance_Call) RunAndReturn(run func(account proto.Recipient) (*proto.FullWavesBalance, error)) *MockSmartState_NewestFullWavesBalance_Call { + _c.Call.Return(run) + return _c +} + +// NewestLeasingInfo provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestLeasingInfo(id crypto.Digest) (*proto.LeaseInfo, error) { + ret := _mock.Called(id) + + if len(ret) == 0 { + panic("no return value specified for NewestLeasingInfo") + } + + var r0 *proto.LeaseInfo + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*proto.LeaseInfo, error)); ok { + return returnFunc(id) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *proto.LeaseInfo); ok { + r0 = returnFunc(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.LeaseInfo) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(id) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestLeasingInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestLeasingInfo' +type MockSmartState_NewestLeasingInfo_Call struct { + *mock.Call +} + +// NewestLeasingInfo is a helper method to define mock.On call +// - id crypto.Digest +func (_e *MockSmartState_Expecter) NewestLeasingInfo(id interface{}) *MockSmartState_NewestLeasingInfo_Call { + return &MockSmartState_NewestLeasingInfo_Call{Call: _e.mock.On("NewestLeasingInfo", id)} +} + +func (_c *MockSmartState_NewestLeasingInfo_Call) Run(run func(id crypto.Digest)) *MockSmartState_NewestLeasingInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestLeasingInfo_Call) Return(leaseInfo *proto.LeaseInfo, err error) *MockSmartState_NewestLeasingInfo_Call { + _c.Call.Return(leaseInfo, err) + return _c +} + +func (_c *MockSmartState_NewestLeasingInfo_Call) RunAndReturn(run func(id crypto.Digest) (*proto.LeaseInfo, error)) *MockSmartState_NewestLeasingInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewestRecipientToAddress provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestRecipientToAddress(recipient proto.Recipient) (proto.WavesAddress, error) { + ret := _mock.Called(recipient) + + if len(ret) == 0 { + panic("no return value specified for NewestRecipientToAddress") + } + + var r0 proto.WavesAddress + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (proto.WavesAddress, error)); ok { + return returnFunc(recipient) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) proto.WavesAddress); ok { + r0 = returnFunc(recipient) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.WavesAddress) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(recipient) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestRecipientToAddress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestRecipientToAddress' +type MockSmartState_NewestRecipientToAddress_Call struct { + *mock.Call +} + +// NewestRecipientToAddress is a helper method to define mock.On call +// - recipient proto.Recipient +func (_e *MockSmartState_Expecter) NewestRecipientToAddress(recipient interface{}) *MockSmartState_NewestRecipientToAddress_Call { + return &MockSmartState_NewestRecipientToAddress_Call{Call: _e.mock.On("NewestRecipientToAddress", recipient)} +} + +func (_c *MockSmartState_NewestRecipientToAddress_Call) Run(run func(recipient proto.Recipient)) *MockSmartState_NewestRecipientToAddress_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestRecipientToAddress_Call) Return(wavesAddress proto.WavesAddress, err error) *MockSmartState_NewestRecipientToAddress_Call { + _c.Call.Return(wavesAddress, err) + return _c +} + +func (_c *MockSmartState_NewestRecipientToAddress_Call) RunAndReturn(run func(recipient proto.Recipient) (proto.WavesAddress, error)) *MockSmartState_NewestRecipientToAddress_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptByAccount provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestScriptByAccount(account proto.Recipient) (*ast.Tree, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptByAccount") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (*ast.Tree, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) *ast.Tree); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestScriptByAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptByAccount' +type MockSmartState_NewestScriptByAccount_Call struct { + *mock.Call +} + +// NewestScriptByAccount is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockSmartState_Expecter) NewestScriptByAccount(account interface{}) *MockSmartState_NewestScriptByAccount_Call { + return &MockSmartState_NewestScriptByAccount_Call{Call: _e.mock.On("NewestScriptByAccount", account)} +} + +func (_c *MockSmartState_NewestScriptByAccount_Call) Run(run func(account proto.Recipient)) *MockSmartState_NewestScriptByAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestScriptByAccount_Call) Return(tree *ast.Tree, err error) *MockSmartState_NewestScriptByAccount_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockSmartState_NewestScriptByAccount_Call) RunAndReturn(run func(account proto.Recipient) (*ast.Tree, error)) *MockSmartState_NewestScriptByAccount_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptByAsset provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestScriptByAsset(assetID crypto.Digest) (*ast.Tree, error) { + ret := _mock.Called(assetID) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptByAsset") + } + + var r0 *ast.Tree + var r1 error + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) (*ast.Tree, error)); ok { + return returnFunc(assetID) + } + if returnFunc, ok := ret.Get(0).(func(crypto.Digest) *ast.Tree); ok { + r0 = returnFunc(assetID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ast.Tree) + } + } + if returnFunc, ok := ret.Get(1).(func(crypto.Digest) error); ok { + r1 = returnFunc(assetID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestScriptByAsset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptByAsset' +type MockSmartState_NewestScriptByAsset_Call struct { + *mock.Call +} + +// NewestScriptByAsset is a helper method to define mock.On call +// - assetID crypto.Digest +func (_e *MockSmartState_Expecter) NewestScriptByAsset(assetID interface{}) *MockSmartState_NewestScriptByAsset_Call { + return &MockSmartState_NewestScriptByAsset_Call{Call: _e.mock.On("NewestScriptByAsset", assetID)} +} + +func (_c *MockSmartState_NewestScriptByAsset_Call) Run(run func(assetID crypto.Digest)) *MockSmartState_NewestScriptByAsset_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 crypto.Digest + if args[0] != nil { + arg0 = args[0].(crypto.Digest) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestScriptByAsset_Call) Return(tree *ast.Tree, err error) *MockSmartState_NewestScriptByAsset_Call { + _c.Call.Return(tree, err) + return _c +} + +func (_c *MockSmartState_NewestScriptByAsset_Call) RunAndReturn(run func(assetID crypto.Digest) (*ast.Tree, error)) *MockSmartState_NewestScriptByAsset_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptBytesByAccount provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestScriptBytesByAccount(account proto.Recipient) (proto.Script, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptBytesByAccount") + } + + var r0 proto.Script + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (proto.Script, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) proto.Script); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Script) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestScriptBytesByAccount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptBytesByAccount' +type MockSmartState_NewestScriptBytesByAccount_Call struct { + *mock.Call +} + +// NewestScriptBytesByAccount is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockSmartState_Expecter) NewestScriptBytesByAccount(account interface{}) *MockSmartState_NewestScriptBytesByAccount_Call { + return &MockSmartState_NewestScriptBytesByAccount_Call{Call: _e.mock.On("NewestScriptBytesByAccount", account)} +} + +func (_c *MockSmartState_NewestScriptBytesByAccount_Call) Run(run func(account proto.Recipient)) *MockSmartState_NewestScriptBytesByAccount_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestScriptBytesByAccount_Call) Return(script proto.Script, err error) *MockSmartState_NewestScriptBytesByAccount_Call { + _c.Call.Return(script, err) + return _c +} + +func (_c *MockSmartState_NewestScriptBytesByAccount_Call) RunAndReturn(run func(account proto.Recipient) (proto.Script, error)) *MockSmartState_NewestScriptBytesByAccount_Call { + _c.Call.Return(run) + return _c +} + +// NewestScriptPKByAddr provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestScriptPKByAddr(addr proto.WavesAddress) (crypto.PublicKey, error) { + ret := _mock.Called(addr) + + if len(ret) == 0 { + panic("no return value specified for NewestScriptPKByAddr") + } + + var r0 crypto.PublicKey + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) (crypto.PublicKey, error)); ok { + return returnFunc(addr) + } + if returnFunc, ok := ret.Get(0).(func(proto.WavesAddress) crypto.PublicKey); ok { + r0 = returnFunc(addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(crypto.PublicKey) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.WavesAddress) error); ok { + r1 = returnFunc(addr) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestScriptPKByAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestScriptPKByAddr' +type MockSmartState_NewestScriptPKByAddr_Call struct { + *mock.Call +} + +// NewestScriptPKByAddr is a helper method to define mock.On call +// - addr proto.WavesAddress +func (_e *MockSmartState_Expecter) NewestScriptPKByAddr(addr interface{}) *MockSmartState_NewestScriptPKByAddr_Call { + return &MockSmartState_NewestScriptPKByAddr_Call{Call: _e.mock.On("NewestScriptPKByAddr", addr)} +} + +func (_c *MockSmartState_NewestScriptPKByAddr_Call) Run(run func(addr proto.WavesAddress)) *MockSmartState_NewestScriptPKByAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.WavesAddress + if args[0] != nil { + arg0 = args[0].(proto.WavesAddress) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestScriptPKByAddr_Call) Return(publicKey crypto.PublicKey, err error) *MockSmartState_NewestScriptPKByAddr_Call { + _c.Call.Return(publicKey, err) + return _c +} + +func (_c *MockSmartState_NewestScriptPKByAddr_Call) RunAndReturn(run func(addr proto.WavesAddress) (crypto.PublicKey, error)) *MockSmartState_NewestScriptPKByAddr_Call { + _c.Call.Return(run) + return _c +} + +// NewestTransactionByID provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestTransactionByID(bytes []byte) (proto.Transaction, error) { + ret := _mock.Called(bytes) + + if len(ret) == 0 { + panic("no return value specified for NewestTransactionByID") + } + + var r0 proto.Transaction + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (proto.Transaction, error)); ok { + return returnFunc(bytes) + } + if returnFunc, ok := ret.Get(0).(func([]byte) proto.Transaction); ok { + r0 = returnFunc(bytes) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proto.Transaction) + } + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(bytes) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestTransactionByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestTransactionByID' +type MockSmartState_NewestTransactionByID_Call struct { + *mock.Call +} + +// NewestTransactionByID is a helper method to define mock.On call +// - bytes []byte +func (_e *MockSmartState_Expecter) NewestTransactionByID(bytes interface{}) *MockSmartState_NewestTransactionByID_Call { + return &MockSmartState_NewestTransactionByID_Call{Call: _e.mock.On("NewestTransactionByID", bytes)} +} + +func (_c *MockSmartState_NewestTransactionByID_Call) Run(run func(bytes []byte)) *MockSmartState_NewestTransactionByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestTransactionByID_Call) Return(transaction proto.Transaction, err error) *MockSmartState_NewestTransactionByID_Call { + _c.Call.Return(transaction, err) + return _c +} + +func (_c *MockSmartState_NewestTransactionByID_Call) RunAndReturn(run func(bytes []byte) (proto.Transaction, error)) *MockSmartState_NewestTransactionByID_Call { + _c.Call.Return(run) + return _c +} + +// NewestTransactionHeightByID provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestTransactionHeightByID(bytes []byte) (uint64, error) { + ret := _mock.Called(bytes) + + if len(ret) == 0 { + panic("no return value specified for NewestTransactionHeightByID") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (uint64, error)); ok { + return returnFunc(bytes) + } + if returnFunc, ok := ret.Get(0).(func([]byte) uint64); ok { + r0 = returnFunc(bytes) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(bytes) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestTransactionHeightByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestTransactionHeightByID' +type MockSmartState_NewestTransactionHeightByID_Call struct { + *mock.Call +} + +// NewestTransactionHeightByID is a helper method to define mock.On call +// - bytes []byte +func (_e *MockSmartState_Expecter) NewestTransactionHeightByID(bytes interface{}) *MockSmartState_NewestTransactionHeightByID_Call { + return &MockSmartState_NewestTransactionHeightByID_Call{Call: _e.mock.On("NewestTransactionHeightByID", bytes)} +} + +func (_c *MockSmartState_NewestTransactionHeightByID_Call) Run(run func(bytes []byte)) *MockSmartState_NewestTransactionHeightByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []byte + if args[0] != nil { + arg0 = args[0].([]byte) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestTransactionHeightByID_Call) Return(v uint64, err error) *MockSmartState_NewestTransactionHeightByID_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockSmartState_NewestTransactionHeightByID_Call) RunAndReturn(run func(bytes []byte) (uint64, error)) *MockSmartState_NewestTransactionHeightByID_Call { + _c.Call.Return(run) + return _c +} + +// NewestWavesBalance provides a mock function for the type MockSmartState +func (_mock *MockSmartState) NewestWavesBalance(account proto.Recipient) (uint64, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for NewestWavesBalance") + } + + var r0 uint64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) (uint64, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) uint64); ok { + r0 = returnFunc(account) + } else { + r0 = ret.Get(0).(uint64) + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_NewestWavesBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewestWavesBalance' +type MockSmartState_NewestWavesBalance_Call struct { + *mock.Call +} + +// NewestWavesBalance is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockSmartState_Expecter) NewestWavesBalance(account interface{}) *MockSmartState_NewestWavesBalance_Call { + return &MockSmartState_NewestWavesBalance_Call{Call: _e.mock.On("NewestWavesBalance", account)} +} + +func (_c *MockSmartState_NewestWavesBalance_Call) Run(run func(account proto.Recipient)) *MockSmartState_NewestWavesBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_NewestWavesBalance_Call) Return(v uint64, err error) *MockSmartState_NewestWavesBalance_Call { + _c.Call.Return(v, err) + return _c +} + +func (_c *MockSmartState_NewestWavesBalance_Call) RunAndReturn(run func(account proto.Recipient) (uint64, error)) *MockSmartState_NewestWavesBalance_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveEntries provides a mock function for the type MockSmartState +func (_mock *MockSmartState) RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error) { + ret := _mock.Called(account) + + if len(ret) == 0 { + panic("no return value specified for RetrieveEntries") + } + + var r0 []proto.DataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) ([]proto.DataEntry, error)); ok { + return returnFunc(account) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient) []proto.DataEntry); ok { + r0 = returnFunc(account) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]proto.DataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient) error); ok { + r1 = returnFunc(account) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_RetrieveEntries_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntries' +type MockSmartState_RetrieveEntries_Call struct { + *mock.Call +} + +// RetrieveEntries is a helper method to define mock.On call +// - account proto.Recipient +func (_e *MockSmartState_Expecter) RetrieveEntries(account interface{}) *MockSmartState_RetrieveEntries_Call { + return &MockSmartState_RetrieveEntries_Call{Call: _e.mock.On("RetrieveEntries", account)} +} + +func (_c *MockSmartState_RetrieveEntries_Call) Run(run func(account proto.Recipient)) *MockSmartState_RetrieveEntries_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockSmartState_RetrieveEntries_Call) Return(dataEntrys []proto.DataEntry, err error) *MockSmartState_RetrieveEntries_Call { + _c.Call.Return(dataEntrys, err) + return _c +} + +func (_c *MockSmartState_RetrieveEntries_Call) RunAndReturn(run func(account proto.Recipient) ([]proto.DataEntry, error)) *MockSmartState_RetrieveEntries_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveNewestBinaryEntry provides a mock function for the type MockSmartState +func (_mock *MockSmartState) RetrieveNewestBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveNewestBinaryEntry") + } + + var r0 *proto.BinaryDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.BinaryDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.BinaryDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BinaryDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_RetrieveNewestBinaryEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveNewestBinaryEntry' +type MockSmartState_RetrieveNewestBinaryEntry_Call struct { + *mock.Call +} + +// RetrieveNewestBinaryEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockSmartState_Expecter) RetrieveNewestBinaryEntry(account interface{}, key interface{}) *MockSmartState_RetrieveNewestBinaryEntry_Call { + return &MockSmartState_RetrieveNewestBinaryEntry_Call{Call: _e.mock.On("RetrieveNewestBinaryEntry", account, key)} +} + +func (_c *MockSmartState_RetrieveNewestBinaryEntry_Call) Run(run func(account proto.Recipient, key string)) *MockSmartState_RetrieveNewestBinaryEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSmartState_RetrieveNewestBinaryEntry_Call) Return(binaryDataEntry *proto.BinaryDataEntry, err error) *MockSmartState_RetrieveNewestBinaryEntry_Call { + _c.Call.Return(binaryDataEntry, err) + return _c +} + +func (_c *MockSmartState_RetrieveNewestBinaryEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.BinaryDataEntry, error)) *MockSmartState_RetrieveNewestBinaryEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveNewestBooleanEntry provides a mock function for the type MockSmartState +func (_mock *MockSmartState) RetrieveNewestBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveNewestBooleanEntry") + } + + var r0 *proto.BooleanDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.BooleanDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.BooleanDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.BooleanDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_RetrieveNewestBooleanEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveNewestBooleanEntry' +type MockSmartState_RetrieveNewestBooleanEntry_Call struct { + *mock.Call +} + +// RetrieveNewestBooleanEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockSmartState_Expecter) RetrieveNewestBooleanEntry(account interface{}, key interface{}) *MockSmartState_RetrieveNewestBooleanEntry_Call { + return &MockSmartState_RetrieveNewestBooleanEntry_Call{Call: _e.mock.On("RetrieveNewestBooleanEntry", account, key)} +} + +func (_c *MockSmartState_RetrieveNewestBooleanEntry_Call) Run(run func(account proto.Recipient, key string)) *MockSmartState_RetrieveNewestBooleanEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSmartState_RetrieveNewestBooleanEntry_Call) Return(booleanDataEntry *proto.BooleanDataEntry, err error) *MockSmartState_RetrieveNewestBooleanEntry_Call { + _c.Call.Return(booleanDataEntry, err) + return _c +} + +func (_c *MockSmartState_RetrieveNewestBooleanEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.BooleanDataEntry, error)) *MockSmartState_RetrieveNewestBooleanEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveNewestIntegerEntry provides a mock function for the type MockSmartState +func (_mock *MockSmartState) RetrieveNewestIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveNewestIntegerEntry") + } + + var r0 *proto.IntegerDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.IntegerDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.IntegerDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.IntegerDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_RetrieveNewestIntegerEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveNewestIntegerEntry' +type MockSmartState_RetrieveNewestIntegerEntry_Call struct { + *mock.Call +} + +// RetrieveNewestIntegerEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockSmartState_Expecter) RetrieveNewestIntegerEntry(account interface{}, key interface{}) *MockSmartState_RetrieveNewestIntegerEntry_Call { + return &MockSmartState_RetrieveNewestIntegerEntry_Call{Call: _e.mock.On("RetrieveNewestIntegerEntry", account, key)} +} + +func (_c *MockSmartState_RetrieveNewestIntegerEntry_Call) Run(run func(account proto.Recipient, key string)) *MockSmartState_RetrieveNewestIntegerEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSmartState_RetrieveNewestIntegerEntry_Call) Return(integerDataEntry *proto.IntegerDataEntry, err error) *MockSmartState_RetrieveNewestIntegerEntry_Call { + _c.Call.Return(integerDataEntry, err) + return _c +} + +func (_c *MockSmartState_RetrieveNewestIntegerEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.IntegerDataEntry, error)) *MockSmartState_RetrieveNewestIntegerEntry_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveNewestStringEntry provides a mock function for the type MockSmartState +func (_mock *MockSmartState) RetrieveNewestStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error) { + ret := _mock.Called(account, key) + + if len(ret) == 0 { + panic("no return value specified for RetrieveNewestStringEntry") + } + + var r0 *proto.StringDataEntry + var r1 error + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) (*proto.StringDataEntry, error)); ok { + return returnFunc(account, key) + } + if returnFunc, ok := ret.Get(0).(func(proto.Recipient, string) *proto.StringDataEntry); ok { + r0 = returnFunc(account, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*proto.StringDataEntry) + } + } + if returnFunc, ok := ret.Get(1).(func(proto.Recipient, string) error); ok { + r1 = returnFunc(account, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSmartState_RetrieveNewestStringEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveNewestStringEntry' +type MockSmartState_RetrieveNewestStringEntry_Call struct { + *mock.Call +} + +// RetrieveNewestStringEntry is a helper method to define mock.On call +// - account proto.Recipient +// - key string +func (_e *MockSmartState_Expecter) RetrieveNewestStringEntry(account interface{}, key interface{}) *MockSmartState_RetrieveNewestStringEntry_Call { + return &MockSmartState_RetrieveNewestStringEntry_Call{Call: _e.mock.On("RetrieveNewestStringEntry", account, key)} +} + +func (_c *MockSmartState_RetrieveNewestStringEntry_Call) Run(run func(account proto.Recipient, key string)) *MockSmartState_RetrieveNewestStringEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 proto.Recipient + if args[0] != nil { + arg0 = args[0].(proto.Recipient) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSmartState_RetrieveNewestStringEntry_Call) Return(stringDataEntry *proto.StringDataEntry, err error) *MockSmartState_RetrieveNewestStringEntry_Call { + _c.Call.Return(stringDataEntry, err) + return _c +} + +func (_c *MockSmartState_RetrieveNewestStringEntry_Call) RunAndReturn(run func(account proto.Recipient, key string) (*proto.StringDataEntry, error)) *MockSmartState_RetrieveNewestStringEntry_Call { + _c.Call.Return(run) + return _c +} diff --git a/pkg/types/types.go b/pkg/types/types.go index bf558992fc..94e28fa251 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -55,8 +55,6 @@ type TransactionWithBytes struct { var _ = SmartState(EnrichedSmartState(nil)) // check for go:generate command -//go:generate moq -out ../state/smart_state_moq_test.go -pkg state . EnrichedSmartState:AnotherMockSmartState - // WavesBalanceProfile contains essential parts of Waves balance and // must be used to pass this information if SmartState only. type WavesBalanceProfile struct { diff --git a/pkg/util/iterators/tx_by_id_test.go b/pkg/util/iterators/tx_by_id_test.go index 5a96edd0e6..b4127dbac8 100644 --- a/pkg/util/iterators/tx_by_id_test.go +++ b/pkg/util/iterators/tx_by_id_test.go @@ -3,21 +3,17 @@ package iterators import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "github.com/wavesplatform/gowaves/pkg/mock" "github.com/wavesplatform/gowaves/pkg/proto" + "github.com/wavesplatform/gowaves/pkg/state" "github.com/wavesplatform/gowaves/pkg/util/byte_helpers" ) func TestTxByIdIterator(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - ids := [][]byte{{'a'}} - stateMock := mock.NewMockState(ctrl) + stateMock := state.NewMockState(t) stateMock.EXPECT(). TransactionByIDWithStatus([]byte{'a'}). Return(byte_helpers.BurnWithProofs.Transaction, proto.TransactionSucceeded, nil)