Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Update validators module to detach engine and application #7567

Closed
shuse2 opened this issue Sep 23, 2022 · 0 comments · Fixed by #7677
Closed

Update validators module to detach engine and application #7567

shuse2 opened this issue Sep 23, 2022 · 0 comments · Fixed by #7677

Comments

@shuse2
Copy link
Collaborator

shuse2 commented Sep 23, 2022

Description

  • Update validators module to store generator list with schema with ValidatorsParamsStore where key is EMPTY_BYTES
    Schema
export const validatorSchema = {
	type: 'object',
	required: ['address', 'bftWeight', 'generatorKey', 'blsKey'],
	properties: {
		address: {
			fieldNumber: 1,
			dataType: 'bytes',
			format: 'lisk32',
		},
		bftWeight: {
			fieldNumber: 2,
			dataType: 'uint64',
		},
		generatorKey: {
			fieldNumber: 3,
			dataType: 'bytes',
		},
		blsKey: {
			fieldNumber: 4,
			dataType: 'bytes',
		},
	},
};

export const validatorsParamsSchema = {
	type: 'object',
	required: ['validators', 'preCommitThreshold', 'certificateThreshold'],
	properties: {
		validators: {
			fieldNumber: 1,
			type: 'array',
			items: {
				...validatorSchema,
			},
		},
		preCommitThreshold: {
			fieldNumber: 2,
			dataType: 'boolean',
		},
		certificateThreshold: {
			fieldNumber: 4,
			dataType: 'uint64',
		},
	},
};
  • Add setValidatorsParams method to validators module, and this method should insert the updated next validators to the context
interface NextValidatorsSetter {
setNextValidators: (
		preCommitThreshold: bigint,
		certificateThreshold: bigint,
		validators: Validator[],
	) => void;
}
setValidatorsParams(
        methodContext: MethodContext,
        nextValidatorsSetter: NextValidatorsSetter,
	preCommitThreshold: bigint,
	certificateThreshold: bigint,
	validators: Validator[],
) => void
  • Update block header to include impliesMaxPrevotes as fieldNumber 12 and increment other properties later
  • Update DPoS module to call setValidatorsParams from validators module instead of calling context.setNextValidators
  • Remove Consensus type and schema from ABI
  • Update to use b.header. aggregateCommit.height instead of maxHeightCertified in the application
  • impliesMaxPrevotes usage from the context should be replaced by b.header.impliesMaxPrevotes

Acceptance Criteria

  • All tests including functional test should pass

Additional Information

  • Block fixtures needs to be updated to include impliesMaxPrevotes
  • Genesis block for dpos-mainchain example needs to be regenerated
@shuse2 shuse2 added this to the Sprint 80 milestone Oct 10, 2022
@shuse2 shuse2 self-assigned this Oct 14, 2022
@shuse2 shuse2 modified the milestones: Sprint 80, Sprint 81 Oct 24, 2022
shuse2 added a commit that referenced this issue Nov 3, 2022
### What was the problem?

This PR resolves #7567 

### How was it solved?
Update engine and application based on
LiskArchive/lips#177

- Update validators module to store consensus information before passing
to ABI
- Move `getSlotTime`, `getSlotNumber` and `getGeneratorAtTimestamp` to
BFT method, and update its usages
- Update DPoS module to use validators module instead of replying
directly through context
- Update block header to add impliesMaxPrevote
- Update consensus to verify impliesMaxPrevote
- Update generator to add impliesMaxPrevote
- Add genesis block validation for impliesMaxPrevote
- Update dpos module unlock to use aggregateCommit.height for checking
certified

### How was it tested?

- Add more test case impliesMaxPrevote method
- Update the usage and test for the consensus params

### Additional Information
Currently genesis timestamp is not stored in BFT module
LiskArchive/lips#177 (comment)
ishantiw pushed a commit that referenced this issue Nov 15, 2022
This PR resolves #7567

Update engine and application based on
LiskArchive/lips#177

- Update validators module to store consensus information before passing
to ABI
- Move `getSlotTime`, `getSlotNumber` and `getGeneratorAtTimestamp` to
BFT method, and update its usages
- Update DPoS module to use validators module instead of replying
directly through context
- Update block header to add impliesMaxPrevote
- Update consensus to verify impliesMaxPrevote
- Update generator to add impliesMaxPrevote
- Add genesis block validation for impliesMaxPrevote
- Update dpos module unlock to use aggregateCommit.height for checking
certified

- Add more test case impliesMaxPrevote method
- Update the usage and test for the consensus params

Currently genesis timestamp is not stored in BFT module
LiskArchive/lips#177 (comment)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant