ceremonyclient/consensus/mocks/voting_provider.go
2025-11-15 01:39:26 -06:00

284 lines
9.2 KiB
Go

// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
"source.quilibrium.com/quilibrium/monorepo/consensus"
models "source.quilibrium.com/quilibrium/monorepo/consensus/models"
)
// VotingProvider is an autogenerated mock type for the VotingProvider type
type VotingProvider[StateT models.Unique, VoteT models.Unique, PeerIDT models.Unique] struct {
mock.Mock
}
// FinalizeQuorumCertificate provides a mock function with given fields: ctx, state, aggregatedSignature
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) FinalizeQuorumCertificate(ctx context.Context, state *models.State[StateT], aggregatedSignature models.AggregatedSignature) (models.QuorumCertificate, error) {
ret := _m.Called(ctx, state, aggregatedSignature)
if len(ret) == 0 {
panic("no return value specified for FinalizeQuorumCertificate")
}
var r0 models.QuorumCertificate
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *models.State[StateT], models.AggregatedSignature) (models.QuorumCertificate, error)); ok {
return rf(ctx, state, aggregatedSignature)
}
if rf, ok := ret.Get(0).(func(context.Context, *models.State[StateT], models.AggregatedSignature) models.QuorumCertificate); ok {
r0 = rf(ctx, state, aggregatedSignature)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(models.QuorumCertificate)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *models.State[StateT], models.AggregatedSignature) error); ok {
r1 = rf(ctx, state, aggregatedSignature)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FinalizeTimeout provides a mock function with given fields: ctx, rank, latestQuorumCertificate, latestQuorumCertificateRanks, aggregatedSignature
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) FinalizeTimeout(ctx context.Context, rank uint64, latestQuorumCertificate models.QuorumCertificate, latestQuorumCertificateRanks []consensus.TimeoutSignerInfo, aggregatedSignature models.AggregatedSignature) (models.TimeoutCertificate, error) {
ret := _m.Called(ctx, rank, latestQuorumCertificate, latestQuorumCertificateRanks, aggregatedSignature)
if len(ret) == 0 {
panic("no return value specified for FinalizeTimeout")
}
var r0 models.TimeoutCertificate
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint64, models.QuorumCertificate, []consensus.TimeoutSignerInfo, models.AggregatedSignature) (models.TimeoutCertificate, error)); ok {
return rf(ctx, rank, latestQuorumCertificate, latestQuorumCertificateRanks, aggregatedSignature)
}
if rf, ok := ret.Get(0).(func(context.Context, uint64, models.QuorumCertificate, []consensus.TimeoutSignerInfo, models.AggregatedSignature) models.TimeoutCertificate); ok {
r0 = rf(ctx, rank, latestQuorumCertificate, latestQuorumCertificateRanks, aggregatedSignature)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(models.TimeoutCertificate)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint64, models.QuorumCertificate, []consensus.TimeoutSignerInfo, models.AggregatedSignature) error); ok {
r1 = rf(ctx, rank, latestQuorumCertificate, latestQuorumCertificateRanks, aggregatedSignature)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FinalizeVotes provides a mock function with given fields: ctx, proposals, proposalVotes
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) FinalizeVotes(ctx context.Context, proposals map[models.Identity]*StateT, proposalVotes map[models.Identity]*VoteT) (*StateT, PeerIDT, error) {
ret := _m.Called(ctx, proposals, proposalVotes)
if len(ret) == 0 {
panic("no return value specified for FinalizeVotes")
}
var r0 *StateT
var r1 PeerIDT
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, map[models.Identity]*StateT, map[models.Identity]*VoteT) (*StateT, PeerIDT, error)); ok {
return rf(ctx, proposals, proposalVotes)
}
if rf, ok := ret.Get(0).(func(context.Context, map[models.Identity]*StateT, map[models.Identity]*VoteT) *StateT); ok {
r0 = rf(ctx, proposals, proposalVotes)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*StateT)
}
}
if rf, ok := ret.Get(1).(func(context.Context, map[models.Identity]*StateT, map[models.Identity]*VoteT) PeerIDT); ok {
r1 = rf(ctx, proposals, proposalVotes)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(PeerIDT)
}
}
if rf, ok := ret.Get(2).(func(context.Context, map[models.Identity]*StateT, map[models.Identity]*VoteT) error); ok {
r2 = rf(ctx, proposals, proposalVotes)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// IsQuorum provides a mock function with given fields: ctx, proposalVotes
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) IsQuorum(ctx context.Context, proposalVotes map[models.Identity]*VoteT) (bool, error) {
ret := _m.Called(ctx, proposalVotes)
if len(ret) == 0 {
panic("no return value specified for IsQuorum")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, map[models.Identity]*VoteT) (bool, error)); ok {
return rf(ctx, proposalVotes)
}
if rf, ok := ret.Get(0).(func(context.Context, map[models.Identity]*VoteT) bool); ok {
r0 = rf(ctx, proposalVotes)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(context.Context, map[models.Identity]*VoteT) error); ok {
r1 = rf(ctx, proposalVotes)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SendConfirmation provides a mock function with given fields: ctx, finalized
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) SendConfirmation(ctx context.Context, finalized *StateT) error {
ret := _m.Called(ctx, finalized)
if len(ret) == 0 {
panic("no return value specified for SendConfirmation")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *StateT) error); ok {
r0 = rf(ctx, finalized)
} else {
r0 = ret.Error(0)
}
return r0
}
// SendProposal provides a mock function with given fields: ctx, proposal
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) SendProposal(ctx context.Context, proposal *StateT) error {
ret := _m.Called(ctx, proposal)
if len(ret) == 0 {
panic("no return value specified for SendProposal")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *StateT) error); ok {
r0 = rf(ctx, proposal)
} else {
r0 = ret.Error(0)
}
return r0
}
// SendVote provides a mock function with given fields: ctx, vote
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) SendVote(ctx context.Context, vote *VoteT) (PeerIDT, error) {
ret := _m.Called(ctx, vote)
if len(ret) == 0 {
panic("no return value specified for SendVote")
}
var r0 PeerIDT
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *VoteT) (PeerIDT, error)); ok {
return rf(ctx, vote)
}
if rf, ok := ret.Get(0).(func(context.Context, *VoteT) PeerIDT); ok {
r0 = rf(ctx, vote)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(PeerIDT)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *VoteT) error); ok {
r1 = rf(ctx, vote)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SignTimeoutVote provides a mock function with given fields: ctx, filter, currentRank, newestQuorumCertificateRank
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) SignTimeoutVote(ctx context.Context, filter []byte, currentRank uint64, newestQuorumCertificateRank uint64) (*VoteT, error) {
ret := _m.Called(ctx, filter, currentRank, newestQuorumCertificateRank)
if len(ret) == 0 {
panic("no return value specified for SignTimeoutVote")
}
var r0 *VoteT
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, []byte, uint64, uint64) (*VoteT, error)); ok {
return rf(ctx, filter, currentRank, newestQuorumCertificateRank)
}
if rf, ok := ret.Get(0).(func(context.Context, []byte, uint64, uint64) *VoteT); ok {
r0 = rf(ctx, filter, currentRank, newestQuorumCertificateRank)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*VoteT)
}
}
if rf, ok := ret.Get(1).(func(context.Context, []byte, uint64, uint64) error); ok {
r1 = rf(ctx, filter, currentRank, newestQuorumCertificateRank)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SignVote provides a mock function with given fields: ctx, state
func (_m *VotingProvider[StateT, VoteT, PeerIDT]) SignVote(ctx context.Context, state *models.State[StateT]) (*VoteT, error) {
ret := _m.Called(ctx, state)
if len(ret) == 0 {
panic("no return value specified for SignVote")
}
var r0 *VoteT
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *models.State[StateT]) (*VoteT, error)); ok {
return rf(ctx, state)
}
if rf, ok := ret.Get(0).(func(context.Context, *models.State[StateT]) *VoteT); ok {
r0 = rf(ctx, state)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*VoteT)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *models.State[StateT]) error); ok {
r1 = rf(ctx, state)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewVotingProvider creates a new instance of VotingProvider. 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 NewVotingProvider[StateT models.Unique, VoteT models.Unique, PeerIDT models.Unique](t interface {
mock.TestingT
Cleanup(func())
}) *VotingProvider[StateT, VoteT, PeerIDT] {
mock := &VotingProvider[StateT, VoteT, PeerIDT]{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}