prysmctl: withdrawal ux improvement (#11909)

* adjusting submit bls to not early exit function in partial success

* Update cmd/prysmctl/validator/withdraw.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
james-prysm
2023-01-27 03:57:36 -06:00
committed by GitHub
parent 9136d30121
commit 07210d7360
2 changed files with 9 additions and 3 deletions

View File

@@ -87,10 +87,15 @@ func callWithdrawalEndpoints(ctx context.Context, host string, request []*apimid
if err != nil {
return err
}
if err := client.SubmitChangeBLStoExecution(ctx, request); err != nil {
err = client.SubmitChangeBLStoExecution(ctx, request)
if err != nil && strings.Contains(err.Error(), "POST error") {
// just log the error, so we can check the pool for partial inclusions.
log.Error(err)
} else if err != nil {
return err
} else {
log.Infof("Successfully published messages to update %d withdrawal addresses.", len(request))
}
log.Infof("Successfully published messages to update %d withdrawal addresses.", len(request))
return checkIfWithdrawsAreInPool(ctx, client, request)
}
@@ -105,6 +110,7 @@ func checkIfWithdrawsAreInPool(ctx context.Context, client *beacon.Client, reque
requestMap[w.Message.ValidatorIndex] = w.Message.ToExecutionAddress
}
totalMessages := len(requestMap)
log.Infof("There are a total of %d messages known to the node's pool.", len(poolResponse.Data))
for _, resp := range poolResponse.Data {
value, found := requestMap[resp.Message.ValidatorIndex]
if found && value == resp.Message.ToExecutionAddress {

View File

@@ -255,7 +255,7 @@ func TestCallWithdrawalEndpoint_Errors(t *testing.T) {
cliCtx := cli.NewContext(&app, set, nil)
err = setWithdrawalAddresses(cliCtx)
assert.ErrorContains(t, "POST error", err)
require.ErrorContains(t, "did not receive 2xx response from API", err)
assert.LogsContain(t, hook, "Could not validate SignedBLSToExecutionChange")
}