-
Notifications
You must be signed in to change notification settings - Fork 238
feat: Validator blacklisting dispersers #1588
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
Merged
Merged
Changes from 23 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
34e73cb
initial implementation of the blacklist addition
1c0d36b
adding the blacklist struct and funcs
a06a450
checking if the blacklist was hit or not
17bbddb
changing to use disperser id
3f96d9c
removing api
09626e6
add explicit flags
f56bf17
fixing naming
eb77485
small changes
86d9126
adding basic unit tests
anupsv 8f9d527
interfaces and comments
anupsv e08f06a
small changes, logs
anupsv e3cec98
fixing mock calls
anupsv c602f80
linter fix
anupsv 0c9a7be
adding more test
anupsv 375b817
naming fix
anupsv 118c972
testing validator e2e
anupsv 4bcdc62
Merge branch 'master' into validator-blacklisting
anupsv 1ddc7b7
adding latest block
anupsv 8646055
unmerged
anupsv 90499ff
getting test working
anupsv 42d9288
final all parts tested
anupsv 9e41318
Merge branch 'master' into validator-blacklisting
anupsv e74c5d5
Merge branch 'master' into validator-blacklisting
anupsv ac0a119
Update golangci-lint.yml
anupsv b57ff74
Update kms_fuzz_test.go
anupsv 5a42ace
Update config.go
anupsv 8e16b11
Merge branch 'master' into validator-blacklisting
anupsv ad2b514
adding cleanup
anupsv 0cc5f16
merge conflict fixes
anupsv cc55cd1
clean up, comments and old tests
anupsv 0119cde
adding deletions after 2 weeks
anupsv f39b482
fixing share state problem in tests
anupsv 6a470dd
fixing test
anupsv c029044
cleanup of test
anupsv fd444a2
Merge branch 'master' into validator-blacklisting
anupsv fe118ce
Merge branch 'master' into validator-blacklisting
anupsv 500311b
Merge branch 'master' into validator-blacklisting
anupsv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,50 @@ | ||
// This file contains the structs which are converted to JSON and stored in the blacklist store | ||
|
||
package node | ||
|
||
import ( | ||
"encoding/json" | ||
"time" | ||
) | ||
|
||
// Blacklist contains entries of blacklisted dispersers | ||
type Blacklist struct { | ||
Entries []BlacklistEntry `json:"entries"` | ||
LastUpdated uint64 `json:"last_updated"` | ||
} | ||
|
||
// BlacklistEntry represents a single blacklist record | ||
type BlacklistEntry struct { | ||
DisperserID uint32 `json:"disperser_id"` | ||
Metadata BlacklistMetadata `json:"metadata"` | ||
Timestamp uint64 `json:"timestamp"` | ||
} | ||
|
||
// BlacklistMetadata contains additional information about the blacklisting | ||
type BlacklistMetadata struct { | ||
ContextId string `json:"context_id"` | ||
Reason string `json:"reason"` | ||
} | ||
|
||
// ToBytes serializes the Blacklist to JSON bytes | ||
func (b *Blacklist) ToBytes() ([]byte, error) { | ||
return json.Marshal(b) | ||
} | ||
|
||
// FromBytes deserializes JSON bytes into the current Blacklist | ||
func (b *Blacklist) FromBytes(data []byte) error { | ||
anupsv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return json.Unmarshal(data, b) | ||
} | ||
|
||
// AddEntry adds a new blacklist entry | ||
func (b *Blacklist) AddEntry(disperserId uint32, contextId, reason string) { | ||
b.LastUpdated = uint64(time.Now().Unix()) | ||
b.Entries = append(b.Entries, BlacklistEntry{ | ||
DisperserID: disperserId, | ||
Metadata: BlacklistMetadata{ | ||
ContextId: contextId, | ||
Reason: reason, | ||
}, | ||
Timestamp: b.LastUpdated, | ||
}) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.