Skip to content

test: simplify maverick implementation for easier maintenance #5575

@cmwaters

Description

@cmwaters

Summary

Currently we take a copy of the entire consensus package and modify that in order to obtain the desired functionality of the maverick node. In the long run this is going to be annoying when any update to the consensus package means a second update to the maverick package.

Problem Definition

The maverick package is difficult to maintain and should be reduced in size. The reason why I copied the entire package was a) it was fast and easy and b) it meant not touching the consensus package at all

Proposal

In the state struct we have these fields:

// some functions can be overwritten for testing
	decideProposal func(height int64, round int32)
	doPrevote      func(height int64, round int32)
	setProposal    func(proposal *types.Proposal) error

It might be possible then to create just an alternate constructor method like NewMaverickState() which uses the same state struct but instead implements different functions for each of the above fields such that we can mimic the behavior.

A bonus might also be to create another field: doPrecommit which mimics doPrevote and allows for greater options for the maverick twin.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Metadata

Metadata

Assignees

Labels

T:jankType Jank! Non-urgent but still high-impact fixes.T:testType: Tests that need love

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions