mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Small encoding fixes on logs and http error code change (#13345)
* fixing some bad encodings * changing http error to align with other clients * fixing unit test
This commit is contained in:
parent
c6801df05a
commit
856907d760
@ -340,7 +340,7 @@ func decodeIds(w http.ResponseWriter, st state.BeaconState, rawIds []string, ign
|
||||
if ignoreUnknown {
|
||||
continue
|
||||
}
|
||||
httputil.HandleError(w, fmt.Sprintf("Unknown pubkey %s", pubkey), http.StatusBadRequest)
|
||||
httputil.HandleError(w, fmt.Sprintf("Unknown validator: %s", hexutil.Encode(pubkey)), http.StatusNotFound)
|
||||
return nil, false
|
||||
}
|
||||
ids = append(ids, valIndex)
|
||||
|
@ -772,11 +772,11 @@ func TestGetValidator(t *testing.T) {
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetValidator(writer, request)
|
||||
assert.Equal(t, http.StatusBadRequest, writer.Code)
|
||||
assert.Equal(t, http.StatusNotFound, writer.Code)
|
||||
e := &httputil.DefaultJsonError{}
|
||||
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), e))
|
||||
assert.Equal(t, http.StatusBadRequest, e.Code)
|
||||
assert.StringContains(t, "Unknown pubkey", e.Message)
|
||||
assert.Equal(t, http.StatusNotFound, e.Code)
|
||||
assert.StringContains(t, "Unknown validator", e.Message)
|
||||
})
|
||||
t.Run("execution optimistic", func(t *testing.T) {
|
||||
chainService := &chainMock.ChainService{Optimistic: true}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
emptypb "github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/altair"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/signing"
|
||||
@ -147,7 +148,7 @@ func (v *validator) SubmitSignedContributionAndProof(ctx context.Context, slot p
|
||||
if contribution.AggregationBits.Count() == 0 {
|
||||
log.WithFields(logrus.Fields{
|
||||
"slot": slot,
|
||||
"pubkey": pubKey,
|
||||
"pubkey": hexutil.Encode(pubKey[:]),
|
||||
"subnet": subnet,
|
||||
}).Warn("Sync contribution for validator has no bits set.")
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user