Skip to content
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

Resolve Web UI Beta Testing Bugs #7471

Merged
merged 38 commits into from
Oct 10, 2020
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
cdcb002
more descriptive password validation error
rauljordan Oct 7, 2020
ba6876f
include change wallet password fixes
rauljordan Oct 7, 2020
2961d46
balance and jwt improvements
rauljordan Oct 8, 2020
f7a21ea
allow for different wallet dirs specified on startup
rauljordan Oct 8, 2020
4e9c30c
ensure wallet password is always validated
rauljordan Oct 8, 2020
a0fea9a
fix up prysm tests
rauljordan Oct 8, 2020
a734d6a
gaz
rauljordan Oct 8, 2020
1eae2eb
Merge branch 'master' into ui-compliance
rauljordan Oct 8, 2020
d4c2f4a
test pass
rauljordan Oct 8, 2020
9a09f5c
Merge branch 'ui-compliance' of github.com:prysmaticlabs/prysm into u…
rauljordan Oct 8, 2020
979a660
Merge branch 'master' into ui-compliance
rauljordan Oct 9, 2020
e973ae0
pass balances tests
rauljordan Oct 9, 2020
cb9f2be
Merge branch 'ui-compliance' of github.com:prysmaticlabs/prysm into u…
rauljordan Oct 9, 2020
989f56a
wrap up fixes
rauljordan Oct 9, 2020
18c915c
radek feedback
rauljordan Oct 9, 2020
d42b3c5
Merge branch 'master' into ui-compliance
rauljordan Oct 9, 2020
e41b9b0
fix up tests
rauljordan Oct 9, 2020
1d963e9
Merge branch 'master' into ui-compliance
rauljordan Oct 9, 2020
7bb0ed1
Merge branch 'master' into ui-compliance
rauljordan Oct 9, 2020
5309abb
cors fix
rauljordan Oct 9, 2020
7490db8
Merge branch 'ui-compliance' of github.com:prysmaticlabs/prysm into u…
rauljordan Oct 9, 2020
29f42e1
add tests for validator status
rauljordan Oct 9, 2020
f86aa9a
pass tests
rauljordan Oct 9, 2020
0792358
fix n
rauljordan Oct 9, 2020
03f023b
skip content type test
rauljordan Oct 9, 2020
58eeb0b
Merge branch 'master' into ui-compliance
rauljordan Oct 9, 2020
d30d943
package level cache and send over feed
rauljordan Oct 9, 2020
0a8847d
Merge branch 'ui-compliance' of github.com:prysmaticlabs/prysm into u…
rauljordan Oct 9, 2020
cfc475d
package level cache for derived
rauljordan Oct 9, 2020
275c0a7
all tests passing
rauljordan Oct 9, 2020
f14c6b2
Merge branch 'master' into ui-compliance
rauljordan Oct 9, 2020
87171fb
Merge branch 'master' into ui-compliance
rauljordan Oct 9, 2020
b8b2a98
Merge branch 'master' into ui-compliance
prestonvanloon Oct 9, 2020
5b91e5b
Merge refs/heads/master into ui-compliance
prylabs-bulldozer[bot] Oct 9, 2020
7ebf772
Merge refs/heads/master into ui-compliance
prylabs-bulldozer[bot] Oct 10, 2020
c672c99
Merge branch 'master' into ui-compliance
prestonvanloon Oct 10, 2020
3843fcb
gofmt
prestonvanloon Oct 10, 2020
77335bb
Merge refs/heads/master into ui-compliance
prylabs-bulldozer[bot] Oct 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beacon-chain/flags/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var (
Name: "grpc-gateway-corsdomain",
Usage: "Comma separated list of domains from which to accept cross origin requests " +
"(browser enforced). This flag has no effect if not used with --grpc-gateway-port.",
Value: "http://localhost:4242,http://127.0.0.1:4242",
Value: "http://localhost:4242,http://127.0.0.1:4242,http://localhost:4200",
}
// MinSyncPeers specifies the required number of successful peer handshakes in order
// to start syncing with external peers.
Expand Down
33 changes: 32 additions & 1 deletion beacon-chain/rpc/beacon/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,20 @@ func (bs *Server) ListValidatorBalances(
})
continue
}

filtered[index] = true

if index >= uint64(len(balances)) {
return nil, status.Errorf(codes.OutOfRange, "Validator index %d >= balance list %d",
index, len(balances))
}

val := validators[index]
st := validatorStatus(val, requestedEpoch)
res = append(res, &ethpb.ValidatorBalances_Balance{
PublicKey: pubKey,
Index: index,
Balance: balances[index],
Status: st.String(),
})
balancesCount = len(res)
}
Expand All @@ -103,10 +105,13 @@ func (bs *Server) ListValidatorBalances(
}

if !filtered[index] {
val := validators[index]
st := validatorStatus(val, requestedEpoch)
res = append(res, &ethpb.ValidatorBalances_Balance{
PublicKey: validators[index].PublicKey,
Index: index,
Balance: balances[index],
Status: st.String(),
})
}
balancesCount = len(res)
Expand Down Expand Up @@ -140,10 +145,13 @@ func (bs *Server) ListValidatorBalances(
// Return everything.
for i := start; i < end; i++ {
pubkey := requestedState.PubkeyAtIndex(uint64(i))
val := validators[i]
st := validatorStatus(val, requestedEpoch)
res = append(res, &ethpb.ValidatorBalances_Balance{
PublicKey: pubkey[:],
Index: uint64(i),
Balance: balances[i],
Status: st.String(),
})
}
return &ethpb.ValidatorBalances{
Expand Down Expand Up @@ -838,3 +846,26 @@ func validatorHasExited(validator *ethpb.Validator, currentEpoch uint64) bool {
}
return true
}

func validatorStatus(validator *ethpb.Validator, epoch uint64) ethpb.ValidatorStatus {
rauljordan marked this conversation as resolved.
Show resolved Hide resolved
farFutureEpoch := params.BeaconConfig().FarFutureEpoch
if validator == nil {
return ethpb.ValidatorStatus_UNKNOWN_STATUS
}
if epoch < validator.ActivationEligibilityEpoch {
return ethpb.ValidatorStatus_DEPOSITED
}
if epoch < validator.ActivationEpoch {
return ethpb.ValidatorStatus_PENDING
}
if validator.ExitEpoch == farFutureEpoch {
return ethpb.ValidatorStatus_ACTIVE
}
if epoch < validator.ExitEpoch {
if validator.Slashed {
return ethpb.ValidatorStatus_SLASHING
}
return ethpb.ValidatorStatus_EXITING
}
return ethpb.ValidatorStatus_EXITED
}
51 changes: 26 additions & 25 deletions beacon-chain/rpc/beacon/validators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func TestServer_ListValidatorBalances_DefaultResponse_NoArchive(t *testing.T) {
PublicKey: pubKey(uint64(i)),
Index: uint64(i),
Balance: params.BeaconConfig().MaxEffectiveBalance,
Status: "EXITED",
}
}
st := testutil.NewBeaconState()
Expand Down Expand Up @@ -246,7 +247,7 @@ func TestServer_ListValidatorBalances_Pagination_Default(t *testing.T) {
{req: &ethpb.ListValidatorBalancesRequest{PublicKeys: [][]byte{pubKey(99)}, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}},
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{Index: 99, PublicKey: pubKey(99), Balance: 99},
{Index: 99, PublicKey: pubKey(99), Balance: 99, Status: "EXITED"},
},
NextPageToken: "",
TotalSize: 1,
Expand All @@ -255,9 +256,9 @@ func TestServer_ListValidatorBalances_Pagination_Default(t *testing.T) {
{req: &ethpb.ListValidatorBalancesRequest{Indices: []uint64{1, 2, 3}, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}},
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{Index: 1, PublicKey: pubKey(1), Balance: 1},
{Index: 2, PublicKey: pubKey(2), Balance: 2},
{Index: 3, PublicKey: pubKey(3), Balance: 3},
{Index: 1, PublicKey: pubKey(1), Balance: 1, Status: "EXITED"},
{Index: 2, PublicKey: pubKey(2), Balance: 2, Status: "EXITED"},
{Index: 3, PublicKey: pubKey(3), Balance: 3, Status: "EXITED"},
},
NextPageToken: "",
TotalSize: 3,
Expand All @@ -266,28 +267,28 @@ func TestServer_ListValidatorBalances_Pagination_Default(t *testing.T) {
{req: &ethpb.ListValidatorBalancesRequest{PublicKeys: [][]byte{pubKey(10), pubKey(11), pubKey(12)}, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}},
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{Index: 10, PublicKey: pubKey(10), Balance: 10},
{Index: 11, PublicKey: pubKey(11), Balance: 11},
{Index: 12, PublicKey: pubKey(12), Balance: 12},
{Index: 10, PublicKey: pubKey(10), Balance: 10, Status: "EXITED"},
{Index: 11, PublicKey: pubKey(11), Balance: 11, Status: "EXITED"},
{Index: 12, PublicKey: pubKey(12), Balance: 12, Status: "EXITED"},
},
NextPageToken: "",
TotalSize: 3,
}},
{req: &ethpb.ListValidatorBalancesRequest{PublicKeys: [][]byte{pubKey(2), pubKey(3)}, Indices: []uint64{3, 4}, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}}, // Duplication
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{Index: 2, PublicKey: pubKey(2), Balance: 2},
{Index: 3, PublicKey: pubKey(3), Balance: 3},
{Index: 4, PublicKey: pubKey(4), Balance: 4},
{Index: 2, PublicKey: pubKey(2), Balance: 2, Status: "EXITED"},
{Index: 3, PublicKey: pubKey(3), Balance: 3, Status: "EXITED"},
{Index: 4, PublicKey: pubKey(4), Balance: 4, Status: "EXITED"},
},
NextPageToken: "",
TotalSize: 3,
}},
{req: &ethpb.ListValidatorBalancesRequest{PublicKeys: [][]byte{{}}, Indices: []uint64{3, 4}, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}}, // Public key has a blank value
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{Index: 3, PublicKey: pubKey(3), Balance: 3},
{Index: 4, PublicKey: pubKey(4), Balance: 4},
{Index: 3, PublicKey: pubKey(3), Balance: 3, Status: "EXITED"},
{Index: 4, PublicKey: pubKey(4), Balance: 4, Status: "EXITED"},
},
NextPageToken: "",
TotalSize: 2,
Expand Down Expand Up @@ -331,35 +332,35 @@ func TestServer_ListValidatorBalances_Pagination_CustomPageSizes(t *testing.T) {
{req: &ethpb.ListValidatorBalancesRequest{PageToken: strconv.Itoa(1), PageSize: 3, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}},
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{PublicKey: pubKey(3), Index: 3, Balance: uint64(3)},
{PublicKey: pubKey(4), Index: 4, Balance: uint64(4)},
{PublicKey: pubKey(5), Index: 5, Balance: uint64(5)}},
{PublicKey: pubKey(3), Index: 3, Balance: uint64(3), Status: "EXITED"},
{PublicKey: pubKey(4), Index: 4, Balance: uint64(4), Status: "EXITED"},
{PublicKey: pubKey(5), Index: 5, Balance: uint64(5), Status: "EXITED"}},
NextPageToken: strconv.Itoa(2),
TotalSize: int32(count)}},
{req: &ethpb.ListValidatorBalancesRequest{PageToken: strconv.Itoa(10), PageSize: 5, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}},
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{PublicKey: pubKey(50), Index: 50, Balance: uint64(50)},
{PublicKey: pubKey(51), Index: 51, Balance: uint64(51)},
{PublicKey: pubKey(52), Index: 52, Balance: uint64(52)},
{PublicKey: pubKey(53), Index: 53, Balance: uint64(53)},
{PublicKey: pubKey(54), Index: 54, Balance: uint64(54)}},
{PublicKey: pubKey(50), Index: 50, Balance: uint64(50), Status: "EXITED"},
{PublicKey: pubKey(51), Index: 51, Balance: uint64(51), Status: "EXITED"},
{PublicKey: pubKey(52), Index: 52, Balance: uint64(52), Status: "EXITED"},
{PublicKey: pubKey(53), Index: 53, Balance: uint64(53), Status: "EXITED"},
{PublicKey: pubKey(54), Index: 54, Balance: uint64(54), Status: "EXITED"}},
NextPageToken: strconv.Itoa(11),
TotalSize: int32(count)}},
{req: &ethpb.ListValidatorBalancesRequest{PageToken: strconv.Itoa(33), PageSize: 3, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}},
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{PublicKey: pubKey(99), Index: 99, Balance: uint64(99)},
{PublicKey: pubKey(100), Index: 100, Balance: uint64(100)},
{PublicKey: pubKey(101), Index: 101, Balance: uint64(101)},
{PublicKey: pubKey(99), Index: 99, Balance: uint64(99), Status: "EXITED"},
{PublicKey: pubKey(100), Index: 100, Balance: uint64(100), Status: "EXITED"},
{PublicKey: pubKey(101), Index: 101, Balance: uint64(101), Status: "EXITED"},
},
NextPageToken: "34",
TotalSize: int32(count)}},
{req: &ethpb.ListValidatorBalancesRequest{PageSize: 2, QueryFilter: &ethpb.ListValidatorBalancesRequest_Epoch{Epoch: 0}},
res: &ethpb.ValidatorBalances{
Balances: []*ethpb.ValidatorBalances_Balance{
{PublicKey: pubKey(0), Index: 0, Balance: uint64(0)},
{PublicKey: pubKey(1), Index: 1, Balance: uint64(1)}},
{PublicKey: pubKey(0), Index: 0, Balance: uint64(0), Status: "EXITED"},
{PublicKey: pubKey(1), Index: 1, Balance: uint64(1), Status: "EXITED"}},
NextPageToken: strconv.Itoa(1),
TotalSize: int32(count)}},
}
Expand Down
Loading