-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more telemetry messages in grandpa client
Added telemetry messges of types `afg.finalized_blocks_up_to` and `afg.authority_set` Closes #1841 Closes #1842
- Loading branch information
1 parent
dde989d
commit ee9ec60
Showing
6 changed files
with
153 additions
and
6 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,44 @@ | ||
// Copyright 2021 ChainSafe Systems (ON) Corp. | ||
// This file is part of gossamer. | ||
// | ||
// The gossamer library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The gossamer library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the gossamer library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
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 { | ||
// finalized hash and finalized number are sent by substrate, but not ready by | ||
// substrate telemetry | ||
// FinalizedHash *common.Hash `json:"hash"` | ||
// FinalizedNumber string `json:"number"` | ||
AuthorityID string `json:"authority_id"` | ||
AuthoritySetID string `json:"authority_set_id"` | ||
// Substrate creates an array of string of authority IDs. It JSON-serializes | ||
// that array and send that as a string. | ||
Authorities string `json:"authorities"` | ||
} | ||
|
||
// NewAfgAuthoritySetTM creates a new afgAuthoritySetTM struct. | ||
func NewAfgAuthoritySetTM(authorityID, authoritySetID string, 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) Corp. | ||
// This file is part of gossamer. | ||
// | ||
// The gossamer library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The gossamer library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the gossamer library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package telemetry | ||
|
||
import ( | ||
"github.com/ChainSafe/gossamer/lib/common" | ||
) | ||
|
||
// TODO: Why is this not being sent by substrate? | ||
type afgFinalizedTM struct { | ||
FinalizedHash *common.Hash `json:"finalized_hash"` | ||
FinalizedNumber string `json:"finalized_number"` | ||
} |
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,40 @@ | ||
// Copyright 2021 ChainSafe Systems (ON) Corp. | ||
// This file is part of gossamer. | ||
// | ||
// The gossamer library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The gossamer library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the gossamer library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
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 send GRANDPA client finalizes 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