mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-04 08:44:28 +00:00
sharding: use .Hex() instead of .String() when logging hexdigests
Former-commit-id: 09695f12e61a3f25fa1830a445861119d236078d [formerly e79627c2af202768419df470cdc49e1a3f6cb826] Former-commit-id: bbda4b36cceb25e765c05299d2ce96b7a6e4b275
This commit is contained in:
parent
54875f5389
commit
9b3a32221c
@ -52,7 +52,7 @@ func (s *Shard) HeaderByHash(hash *common.Hash) (*CollationHeader, error) {
|
||||
return nil, fmt.Errorf("get failed: %v", err)
|
||||
}
|
||||
if encoded == nil {
|
||||
return nil, fmt.Errorf("no value set for header hash: %v", hash.String())
|
||||
return nil, fmt.Errorf("no value set for header hash: %vs", hash.Hex())
|
||||
}
|
||||
|
||||
var header CollationHeader
|
||||
@ -158,10 +158,7 @@ func (s *Shard) SetAvailability(chunkRoot *common.Hash, availability bool) error
|
||||
} else {
|
||||
encoded = []byte{0}
|
||||
}
|
||||
if err := s.shardDB.Put(key, encoded); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return s.shardDB.Put(key, encoded)
|
||||
}
|
||||
|
||||
// SaveHeader adds the collation header to shardDB.
|
||||
@ -177,10 +174,7 @@ func (s *Shard) SaveHeader(header *CollationHeader) error {
|
||||
}
|
||||
|
||||
// uses the hash of the header as the key.
|
||||
if err := s.shardDB.Put(header.Hash(), encoded); err != nil {
|
||||
return fmt.Errorf("cannot update shardDB: %v", err)
|
||||
}
|
||||
return nil
|
||||
return s.shardDB.Put(header.Hash(), encoded)
|
||||
}
|
||||
|
||||
// SaveBody adds the collation body to the shardDB and sets availability.
|
||||
@ -245,7 +239,7 @@ func (s *Shard) SetCanonical(header *CollationHeader) error {
|
||||
// dataAvailabilityLookupKey formats a string that will become a lookup
|
||||
// key in the shardDB.
|
||||
func dataAvailabilityLookupKey(chunkRoot *common.Hash) common.Hash {
|
||||
key := fmt.Sprintf("availability-lookup:%s", chunkRoot.String())
|
||||
key := fmt.Sprintf("availability-lookup:%s", chunkRoot.Hex())
|
||||
return common.BytesToHash([]byte(key))
|
||||
}
|
||||
|
||||
|
@ -191,8 +191,8 @@ func TestShard_CanonicalHeaderHash(t *testing.T) {
|
||||
t.Errorf("should throw error if a non-existent period, shardID pair is used")
|
||||
}
|
||||
|
||||
if canonicalHeaderHash.String() != headerHash.String() {
|
||||
t.Errorf("header hashes do not match. want=%s. got=%s", headerHash.String(), canonicalHeaderHash.String())
|
||||
if canonicalHeaderHash.Hex() != headerHash.Hex() {
|
||||
t.Errorf("header hashes do not match. want=%s. got=%s", headerHash.Hex(), canonicalHeaderHash.Hex())
|
||||
}
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ func TestShard_CheckAvailability(t *testing.T) {
|
||||
t.Errorf("could not check availability: %v", err)
|
||||
}
|
||||
if !available {
|
||||
t.Errorf("collation body is not available: chunkRoot=%v, body=%v", header.ChunkRoot(), collation.body)
|
||||
t.Errorf("collation body is not available: chunkRoot=%s, body=%v", header.ChunkRoot().Hex(), collation.body)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user