-
Notifications
You must be signed in to change notification settings - Fork 962
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
SubscribeCommitteeSubnet
method (#5299)
* Add client implementation * Update workspace * Update server * Update service * Gaz * Mocks * Fixed validator tests * Add round tirp tests * Fixed subnet test * Comment * Update committee cache * Comment * Update RPC * Fixed test * Nishant's comment * Gaz * Refresh ENR is for epoch * Needs to be append
- Loading branch information
1 parent
a0c62b1
commit 1b8db88
Showing
14 changed files
with
194 additions
and
50 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
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,56 @@ | ||
package cache | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestCommitteeIDCache_RoundTrip(t *testing.T) { | ||
c := newCommitteeIDs() | ||
slot := uint64(100) | ||
committeeIDs := c.GetAggregatorCommitteeIDs(slot) | ||
if len(committeeIDs) != 0 { | ||
t.Errorf("Empty cache returned an object: %v", committeeIDs) | ||
} | ||
|
||
c.AddAggregatorCommiteeID(slot, 1) | ||
res := c.GetAggregatorCommitteeIDs(slot) | ||
if !reflect.DeepEqual(res, []uint64{1}) { | ||
t.Error("Expected equal value to return from cache") | ||
} | ||
|
||
c.AddAggregatorCommiteeID(slot, 2) | ||
res = c.GetAggregatorCommitteeIDs(slot) | ||
if !reflect.DeepEqual(res, []uint64{1, 2}) { | ||
t.Error("Expected equal value to return from cache") | ||
} | ||
|
||
c.AddAggregatorCommiteeID(slot, 3) | ||
res = c.GetAggregatorCommitteeIDs(slot) | ||
if !reflect.DeepEqual(res, []uint64{1, 2, 3}) { | ||
t.Error("Expected equal value to return from cache") | ||
} | ||
|
||
committeeIDs = c.GetAttesterCommitteeIDs(slot) | ||
if len(committeeIDs) != 0 { | ||
t.Errorf("Empty cache returned an object: %v", committeeIDs) | ||
} | ||
|
||
c.AddAttesterCommiteeID(slot, 11) | ||
res = c.GetAttesterCommitteeIDs(slot) | ||
if !reflect.DeepEqual(res, []uint64{11}) { | ||
t.Error("Expected equal value to return from cache") | ||
} | ||
|
||
c.AddAttesterCommiteeID(slot, 22) | ||
res = c.GetAttesterCommitteeIDs(slot) | ||
if !reflect.DeepEqual(res, []uint64{11, 22}) { | ||
t.Error("Expected equal value to return from cache") | ||
} | ||
|
||
c.AddAttesterCommiteeID(slot, 33) | ||
res = c.GetAttesterCommitteeIDs(slot) | ||
if !reflect.DeepEqual(res, []uint64{11, 22, 33}) { | ||
t.Error("Expected equal value to return from cache") | ||
} | ||
} |
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
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
Oops, something went wrong.