ceremonyclient/consensus/mocks/consumer.go
Cassandra Heart c797d482f9
v2.1.0.5 (#457)
* wip: conversion of hotstuff from flow into Q-oriented model

* bulk of tests

* remaining non-integration tests

* add integration test, adjust log interface, small tweaks

* further adjustments, restore full pacemaker shape

* add component lifecycle management+supervisor

* further refinements

* resolve timeout hanging

* mostly finalized state for consensus

* bulk of engine swap out

* lifecycle-ify most types

* wiring nearly complete, missing needed hooks for proposals

* plugged in, vetting message validation paths

* global consensus, plugged in and verified

* app shard now wired in too

* do not decode empty keys.yml (#456)

* remove obsolete engine.maxFrames config parameter (#454)

* default to Info log level unless debug is enabled (#453)

* respect config's  "logging" section params, remove obsolete single-file logging (#452)

* Trivial code cleanup aiming to reduce Go compiler warnings (#451)

* simplify range traversal

* simplify channel read for single select case

* delete rand.Seed() deprecated in Go 1.20 and no-op as of Go 1.24

* simplify range traversal

* simplify channel read for single select case

* remove redundant type from array

* simplify range traversal

* simplify channel read for single select case

* RC slate

* finalize 2.1.0.5

* Update comments in StrictMonotonicCounter

Fix comment formatting and clarify description.

---------

Co-authored-by: Black Swan <3999712+blacks1ne@users.noreply.github.com>
2025-11-11 05:00:17 -06:00

127 lines
4.9 KiB
Go

// Code generated by mockery. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
consensus "source.quilibrium.com/quilibrium/monorepo/consensus"
models "source.quilibrium.com/quilibrium/monorepo/consensus/models"
time "time"
)
// Consumer is an autogenerated mock type for the Consumer type
type Consumer[StateT models.Unique, VoteT models.Unique] struct {
mock.Mock
}
// OnCurrentRankDetails provides a mock function with given fields: currentRank, finalizedRank, currentLeader
func (_m *Consumer[StateT, VoteT]) OnCurrentRankDetails(currentRank uint64, finalizedRank uint64, currentLeader models.Identity) {
_m.Called(currentRank, finalizedRank, currentLeader)
}
// OnDoubleProposeDetected provides a mock function with given fields: _a0, _a1
func (_m *Consumer[StateT, VoteT]) OnDoubleProposeDetected(_a0 *models.State[StateT], _a1 *models.State[StateT]) {
_m.Called(_a0, _a1)
}
// OnEventProcessed provides a mock function with no fields
func (_m *Consumer[StateT, VoteT]) OnEventProcessed() {
_m.Called()
}
// OnFinalizedState provides a mock function with given fields: _a0
func (_m *Consumer[StateT, VoteT]) OnFinalizedState(_a0 *models.State[StateT]) {
_m.Called(_a0)
}
// OnInvalidStateDetected provides a mock function with given fields: err
func (_m *Consumer[StateT, VoteT]) OnInvalidStateDetected(err *models.InvalidProposalError[StateT, VoteT]) {
_m.Called(err)
}
// OnLocalTimeout provides a mock function with given fields: currentRank
func (_m *Consumer[StateT, VoteT]) OnLocalTimeout(currentRank uint64) {
_m.Called(currentRank)
}
// OnOwnProposal provides a mock function with given fields: proposal, targetPublicationTime
func (_m *Consumer[StateT, VoteT]) OnOwnProposal(proposal *models.SignedProposal[StateT, VoteT], targetPublicationTime time.Time) {
_m.Called(proposal, targetPublicationTime)
}
// OnOwnTimeout provides a mock function with given fields: timeout
func (_m *Consumer[StateT, VoteT]) OnOwnTimeout(timeout *models.TimeoutState[VoteT]) {
_m.Called(timeout)
}
// OnOwnVote provides a mock function with given fields: vote, recipientID
func (_m *Consumer[StateT, VoteT]) OnOwnVote(vote *VoteT, recipientID models.Identity) {
_m.Called(vote, recipientID)
}
// OnPartialTimeoutCertificate provides a mock function with given fields: currentRank, partialTimeoutCertificate
func (_m *Consumer[StateT, VoteT]) OnPartialTimeoutCertificate(currentRank uint64, partialTimeoutCertificate *consensus.PartialTimeoutCertificateCreated) {
_m.Called(currentRank, partialTimeoutCertificate)
}
// OnQuorumCertificateTriggeredRankChange provides a mock function with given fields: oldRank, newRank, qc
func (_m *Consumer[StateT, VoteT]) OnQuorumCertificateTriggeredRankChange(oldRank uint64, newRank uint64, qc models.QuorumCertificate) {
_m.Called(oldRank, newRank, qc)
}
// OnRankChange provides a mock function with given fields: oldRank, newRank
func (_m *Consumer[StateT, VoteT]) OnRankChange(oldRank uint64, newRank uint64) {
_m.Called(oldRank, newRank)
}
// OnReceiveProposal provides a mock function with given fields: currentRank, proposal
func (_m *Consumer[StateT, VoteT]) OnReceiveProposal(currentRank uint64, proposal *models.SignedProposal[StateT, VoteT]) {
_m.Called(currentRank, proposal)
}
// OnReceiveQuorumCertificate provides a mock function with given fields: currentRank, qc
func (_m *Consumer[StateT, VoteT]) OnReceiveQuorumCertificate(currentRank uint64, qc models.QuorumCertificate) {
_m.Called(currentRank, qc)
}
// OnReceiveTimeoutCertificate provides a mock function with given fields: currentRank, tc
func (_m *Consumer[StateT, VoteT]) OnReceiveTimeoutCertificate(currentRank uint64, tc models.TimeoutCertificate) {
_m.Called(currentRank, tc)
}
// OnStart provides a mock function with given fields: currentRank
func (_m *Consumer[StateT, VoteT]) OnStart(currentRank uint64) {
_m.Called(currentRank)
}
// OnStartingTimeout provides a mock function with given fields: startTime, endTime
func (_m *Consumer[StateT, VoteT]) OnStartingTimeout(startTime time.Time, endTime time.Time) {
_m.Called(startTime, endTime)
}
// OnStateIncorporated provides a mock function with given fields: _a0
func (_m *Consumer[StateT, VoteT]) OnStateIncorporated(_a0 *models.State[StateT]) {
_m.Called(_a0)
}
// OnTimeoutCertificateTriggeredRankChange provides a mock function with given fields: oldRank, newRank, tc
func (_m *Consumer[StateT, VoteT]) OnTimeoutCertificateTriggeredRankChange(oldRank uint64, newRank uint64, tc models.TimeoutCertificate) {
_m.Called(oldRank, newRank, tc)
}
// NewConsumer creates a new instance of Consumer. 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 NewConsumer[StateT models.Unique, VoteT models.Unique](t interface {
mock.TestingT
Cleanup(func())
}) *Consumer[StateT, VoteT] {
mock := &Consumer[StateT, VoteT]{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}