-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4269 from ElrondNetwork/pseudo-slashing-for-inval…
…id-signers Pseudo slashing for invalid signers
- Loading branch information
Showing
36 changed files
with
1,082 additions
and
73 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,48 @@ | ||
package mock | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/ElrondNetwork/elrond-go/p2p" | ||
"github.com/ElrondNetwork/elrond-go/p2p/message" | ||
) | ||
|
||
// MessageSignerMock implements P2PSigningHandler interface but it does nothing as it is disabled | ||
type MessageSignerMock struct { | ||
} | ||
|
||
// Verify does nothing | ||
func (ms *MessageSignerMock) Verify(message p2p.MessageP2P) error { | ||
return nil | ||
} | ||
|
||
// Serialize will serialize the list of p2p messages | ||
func (ms *MessageSignerMock) Serialize(messages []p2p.MessageP2P) ([]byte, error) { | ||
messagesBytes, err := json.Marshal(messages) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return messagesBytes, nil | ||
} | ||
|
||
// Deserialize will unmarshal into a list of p2p messages | ||
func (ms *MessageSignerMock) Deserialize(messagesBytes []byte) ([]p2p.MessageP2P, error) { | ||
var messages []*message.Message | ||
err := json.Unmarshal(messagesBytes, &messages) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
messages2 := make([]p2p.MessageP2P, 0) | ||
for _, msg := range messages { | ||
messages2 = append(messages2, msg) | ||
} | ||
|
||
return messages2, nil | ||
} | ||
|
||
// IsInterfaceNil returns true if there is no value under the interface | ||
func (ms *MessageSignerMock) IsInterfaceNil() bool { | ||
return ms == nil | ||
} |
Oops, something went wrong.