Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Spec alignment review #1509

Merged

Conversation

MatheusFranco99
Copy link
Contributor

@MatheusFranco99 MatheusFranco99 commented Jul 25, 2024

Overview

This PR adds suggestions from the spec alignment review. More than the minor suggested changes, I posted below some questions on major differences.

Differences

  1. In the runners (AggregatorRunner, CommitteeRunner, ...), an OperatorSigner interface is used which is also defined in ssv. In spec, we changed it to a structure.
  2. In BaseRunner, there is a DomainTypeProvider attribute that doesn't exist in spec. In spec, we get the DomainType from Share.

Note: The VerifySignature method from Config (of QBFT) was dropped since it was unaligned to spec and not being used. Plus, it's a dangerous variable.

@@ -113,6 +113,10 @@ func (i *Instance) Broadcast(logger *zap.Logger, msg *spectypes.SignedSSVMessage
if !i.CanProcessMessages() {
return errors.New("instance stopped processing messages")
}
// TODO: In spec, the below assignment doesn't exist.
// In fact, the msg should already have the correct identifier. Why are we setting it again?
// Also, even though it doesn't change anything, we shouldn't change the message's content
Copy link
Contributor

Choose a reason for hiding this comment

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

we are not changing the message content, just creating the messageID.
infact in broadcast i.config.GetNetwork().Broadcast(msgID, msg) below, msgID is never used, we are using the msgid from the message there.

maybe its time to not use separate msgid in the Broadcast?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh true. I didn't realise it. Yup, at least for the scope of this PR, in spec we also use msgID in Broadcast, but from the msg itself.

Regarding changing the Broadcast function, we would also need to do a change in spec. Maybe it's not the scope of this PR but we can add it later on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@y0sher Can I align this to spec, to use the ID from the msg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, I'm aligning it. Afterwards, if we find it necessary, we can go back to copying the ID from the state.

Copy link
Contributor

Choose a reason for hiding this comment

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

there's no special reason to use the msgid from the state, the message is ok.

@MatheusFranco99
Copy link
Contributor Author

MatheusFranco99 commented Jul 25, 2024

In conversation with @moshe-blox , we saw that Config.VerifySignature is never set to false, so better to remove this dangerous variable.

@moshe-blox
Copy link
Contributor

moshe-blox commented Jul 25, 2024

  1. This difference is intended because the implementation has two different implementations for signing with RSA (one for Linux and one for the rest)
  2. The primary goal was to stop using DomainType from shares, because genesis and Alan runners require different DomainTypes.
  3. It is unused as far as we've just seen, so can be removed.

@nkryuchkov
Copy link
Contributor

  1. This difference is intended because the implementation has two different implementations for signing with RSA (one for Linux and one for the rest)

Also because the implementation has GetOperatorIdF function instead of OperatorID field because it doesn't know operator ID on start, therefore the implementation cannot use the structure from spec

@nkryuchkov
Copy link
Contributor

  1. Config for QBFT has a VerifySignature method that returns a boolean. This doesn't exist in spec. Why does this method exist?

It was used to disable signature checks in message validation IIRC, but if it's always false now, let's remove it

@nkryuchkov nkryuchkov merged commit 2015833 into alan/no-fork-spec-align-0cbc825 Jul 25, 2024
3 of 5 checks passed
@nkryuchkov nkryuchkov deleted the spec-alignment-review-with-differ branch July 25, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants