Files
prysm/consensus-types/types.go
terence 774b9a7159 Migrate Prysm repo to Offchain Labs organization ahead of Pectra V6 (#15140)
* Migrate Prysm repo to Offchain Labs organization ahead of Pectra upgrade v6

* Replace prysmaticlabs with OffchainLabs on general markdowns

* Update mock

* Gazelle and add mock.go to excluded generated mock file
2025-04-10 15:40:39 +00:00

35 lines
1.1 KiB
Go

package consensus_types
import (
"errors"
"fmt"
"sync/atomic"
"github.com/OffchainLabs/prysm/v6/runtime/version"
errors2 "github.com/pkg/errors"
)
var (
// ErrNilObjectWrapped is returned in a constructor when the underlying object is nil.
ErrNilObjectWrapped = errors.New("attempted to wrap nil object")
// ErrUnsupportedField is returned when a getter/setter access is not supported.
ErrUnsupportedField = errors.New("unsupported getter")
// ErrOutOfBounds is returned when a slice or array index does not exist.
ErrOutOfBounds = errors.New("index out of bounds")
)
// ErrNotSupported constructs a message informing about an unsupported field access.
func ErrNotSupported(funcName string, ver int) error {
return errors2.Wrap(ErrUnsupportedField, fmt.Sprintf("%s is not supported for %s", funcName, version.String(ver)))
}
// ThreadSafeEnumerator is a thread-safe counter of all objects created since the node's start.
type ThreadSafeEnumerator struct {
counter uint64
}
// Inc increments the enumerator and returns the new object count.
func (c *ThreadSafeEnumerator) Inc() uint64 {
return atomic.AddUint64(&c.counter, 1)
}