Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BEEFY consensus message scale classes #786

Merged
merged 4 commits into from
Feb 21, 2025

Conversation

hMitov
Copy link
Collaborator

@hMitov hMitov commented Feb 20, 2025

Description

  • Added BeefyConsensusMessage and BeefyConsensusMessageFormat(enum class) classes
  • Implemented scale reading.
  • Introduced beefy consensus message processing in addBlockToTree() method (without implementation of the handler)

Fixes #771

…plemented scale reading. Introduced beefy consensus message processing in addBlockToTree() method (without implementation of the handler).
@hMitov hMitov changed the title feat: Added BeefyConsensusMessage and BeefyConsensusMessageFormat, im… 771 BEEFY consensus message scale classes Feb 20, 2025
@hMitov hMitov changed the title 771 BEEFY consensus message scale classes BEEFY consensus message scale classes Feb 20, 2025
switch (format) {
case BEEFY_CHANGED_AUTHORITIES -> {
List<byte[]> authorityPublicKeys = new ListReader<>(
rdr -> rdr.readByteArray(33)).read(reader);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create a constant for that 33, it feels like a magic number right now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each digest is added separately in the header. This means we can have more than one digest per type. With the current implementation we use findFirst() and that would not work. I suggest we rework the getBabeConsensusMessage, getGrandpaConsensusMessage, getBeefyConsensusMessage so that they return a list of scale decoded messages instead of a single option.

@hMitov hMitov requested a review from Zurcusa February 21, 2025 10:23
@hMitov hMitov merged commit b49067b into dev Feb 21, 2025
3 checks passed
@hMitov hMitov deleted the 771-beefy-consensus-message-scale-classes branch February 21, 2025 12:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scale classes
5 participants