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

PoS Validator Handshake #792

Closed

Conversation

AeonSw4n
Copy link
Contributor

@AeonSw4n AeonSw4n commented Nov 6, 2023

No description provided.

@AeonSw4n AeonSw4n requested a review from a team as a code owner November 6, 2023 11:45
@AeonSw4n
Copy link
Contributor Author

AeonSw4n commented Nov 6, 2023

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@@ -830,6 +832,21 @@ func (msg *MsgDeSoDonePeer) FromBytes(data []byte) error {
return fmt.Errorf("MsgDeSoDonePeer.FromBytes not implemented")
}

type MsgDeSoHandshakePeer struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

What will this be used for?

Copy link
Contributor Author

@AeonSw4n AeonSw4n Nov 7, 2023

Choose a reason for hiding this comment

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

Consensus connection manager needs to know we have peer's public key, and the peer is connected.

}
}

func (msg *MsgDeSoVerack) EncodeVerackV0() ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on the receiver type, it's contextualized that the message type is a Verack

Suggested change
func (msg *MsgDeSoVerack) EncodeVerackV0() ([]byte, error) {
func (msg *MsgDeSoVerack) EncodeV0() ([]byte, error) {

return retBytes, nil
}

func (msg *MsgDeSoVerack) EncodeVerackV1() ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (msg *MsgDeSoVerack) EncodeVerackV1() ([]byte, error) {
func (msg *MsgDeSoVerack) EncodeV1() ([]byte, error) {

Nonce uint64
NonceReceived uint64
NonceSent uint64
TstampMicro uint64
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not nanoseconds? There's a time.UnixNano() function that we use to populate block timestamps, so the pattern of using nanosecond time resolution will already be there for PoS

Copy link
Contributor Author

@AeonSw4n AeonSw4n Nov 7, 2023

Choose a reason for hiding this comment

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

Nanoseconds are bad, they overflow and are inaccurate. I don't like our choice of nanoseconds in other parts of the code, there's never a need for such granularity. In fact the timestamp in nanos is a multiple of 1000, because it's rounded to nearest microsecond.

@AeonSw4n AeonSw4n force-pushed the p/pos-connect-disconnect-validator branch from 5416b01 to 6020d65 Compare November 8, 2023 03:06
@AeonSw4n AeonSw4n force-pushed the p/pos-validator-handshake branch from 8253a2b to 222d970 Compare November 8, 2023 03:06
@AeonSw4n AeonSw4n mentioned this pull request Nov 8, 2023
@AeonSw4n AeonSw4n force-pushed the p/pos-connect-disconnect-validator branch from 6020d65 to e7e414c Compare November 22, 2023 11:10
@AeonSw4n AeonSw4n force-pushed the p/pos-validator-handshake branch from 222d970 to 19a5515 Compare November 22, 2023 11:10
@AeonSw4n AeonSw4n force-pushed the p/pos-connect-disconnect-validator branch from e7e414c to 974b4fd Compare November 27, 2023 16:32
@AeonSw4n AeonSw4n force-pushed the p/pos-validator-handshake branch from 19a5515 to 08faef7 Compare November 27, 2023 16:32
This reverts commit 5416b01.
@AeonSw4n AeonSw4n force-pushed the p/pos-validator-handshake branch from 08faef7 to 8fc6254 Compare December 7, 2023 13:29
@AeonSw4n AeonSw4n closed this Dec 7, 2023
@lazynina lazynina deleted the p/pos-validator-handshake branch April 9, 2024 20:17
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.

2 participants