forked from ChainSafe/gossamer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dot/telemetry): Added more telemetry messages in grandpa client (C…
…hainSafe#2043) * Added more telemetry messages in grandpa client Added telemetry messges of types `afg.finalized_blocks_up_to` and `afg.authority_set` Closes ChainSafe#1841 Closes ChainSafe#1842 * fixed lint * Added tests * Send afg.authority_set once every grandpa round * Addressed some reviews * fix linting * addressed reviews * change ordering * addressed reviews
- Loading branch information
1 parent
8ea3d9f
commit 7c870a4
Showing
6 changed files
with
115 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2021 ChainSafe Systems (ON) | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
package telemetry | ||
|
||
// afgAuthoritySetTM is a telemetry message of type `afg.authority_set` which is | ||
// meant to be sent when authority set changes (generally when a round is initiated) | ||
type afgAuthoritySetTM struct { | ||
AuthorityID string `json:"authority_id"` | ||
AuthoritySetID string `json:"authority_set_id"` | ||
// Substrate creates an array of string of authority IDs. It JSON-serialises | ||
// that array and send that as a string. | ||
Authorities string `json:"authorities"` | ||
} | ||
|
||
// NewAfgAuthoritySetTM creates a new afgAuthoritySetTM struct. | ||
func NewAfgAuthoritySetTM(authorityID, authoritySetID, authorities string) Message { | ||
return &afgAuthoritySetTM{ | ||
AuthorityID: authorityID, | ||
AuthoritySetID: authoritySetID, | ||
Authorities: authorities, | ||
} | ||
} | ||
|
||
func (afgAuthoritySetTM) messageType() string { | ||
return afgAuthoritySetMsg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2021 ChainSafe Systems (ON) | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
package telemetry | ||
|
||
import ( | ||
"github.com/ChainSafe/gossamer/lib/common" | ||
) | ||
|
||
// afgFinalizedBlocksUpToTM holds telemetry message of type `afg.finalized_blocks_up_to`, | ||
// which is supposed to be sent when GRANDPA client finalises new blocks. | ||
type afgFinalizedBlocksUpToTM struct { | ||
Hash common.Hash `json:"hash"` | ||
Number string `json:"number"` | ||
} | ||
|
||
// NewAfgFinalizedBlocksUpToTM creates a new afgFinalizedBlocksUpToTM struct. | ||
func NewAfgFinalizedBlocksUpToTM(hash common.Hash, number string) Message { | ||
return &afgFinalizedBlocksUpToTM{ | ||
Hash: hash, | ||
Number: number, | ||
} | ||
} | ||
|
||
func (afgFinalizedBlocksUpToTM) messageType() string { | ||
return afgFinalizedBlocksUpToMsg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters