diff --git a/beacon-chain/blockchain/mock_test.go b/beacon-chain/blockchain/mock_test.go index 8a6cf27f76b3..8c0abd2d3450 100644 --- a/beacon-chain/blockchain/mock_test.go +++ b/beacon-chain/blockchain/mock_test.go @@ -21,7 +21,7 @@ func testServiceOptsWithDB(t *testing.T) []Option { } } -// warning: only use these opts when you are certain there are no db calls +// WARNING: only use these opts when you are certain there are no db calls // in your code path. this is a lightweight way to satisfy the stategen/beacondb // initialization requirements w/o the overhead of db init. func testServiceOptsNoDB() []Option { diff --git a/beacon-chain/blockchain/state_balance_cache.go b/beacon-chain/blockchain/state_balance_cache.go index 57e7c3679c60..17ffec2ccd6d 100644 --- a/beacon-chain/blockchain/state_balance_cache.go +++ b/beacon-chain/blockchain/state_balance_cache.go @@ -37,7 +37,7 @@ func newStateBalanceCache(sg *stategen.State) (*stateBalanceCache, error) { // the previously read value. This cache assumes we only want to cache one // set of balances for a single root (the current justified root). // -// warning: this is not thread-safe on its own, relies on get() for locking +// WARNING: this is not thread-safe on its own, relies on get() for locking func (c *stateBalanceCache) update(ctx context.Context, justifiedRoot [32]byte) ([]uint64, error) { stateBalanceCacheMiss.Inc() justifiedState, err := c.stateGen.StateByRoot(ctx, justifiedRoot) diff --git a/beacon-chain/forkchoice/protoarray/optimistic_sync.go b/beacon-chain/forkchoice/protoarray/optimistic_sync.go index 92eec31ab8df..21584380ed32 100644 --- a/beacon-chain/forkchoice/protoarray/optimistic_sync.go +++ b/beacon-chain/forkchoice/protoarray/optimistic_sync.go @@ -24,6 +24,7 @@ func (f *ForkChoice) IsOptimistic(root [32]byte) (bool, error) { // SetOptimisticToValid is called with the root of a block that was returned as // VALID by the EL. +// // WARNING: This method returns an error if the root is not found in forkchoice func (f *ForkChoice) SetOptimisticToValid(ctx context.Context, root [32]byte) error { f.store.nodesLock.Lock() diff --git a/beacon-chain/state/state-native/getters_validator.go b/beacon-chain/state/state-native/getters_validator.go index 9a2706e208c2..8f51d94f6ac7 100644 --- a/beacon-chain/state/state-native/getters_validator.go +++ b/beacon-chain/state/state-native/getters_validator.go @@ -154,7 +154,8 @@ func (b *BeaconState) NumValidators() int { } // ReadFromEveryValidator reads values from every validator and applies it to the provided function. -// Warning: This method is potentially unsafe, as it exposes the actual validator registry. +// +// WARNING: This method is potentially unsafe, as it exposes the actual validator registry. func (b *BeaconState) ReadFromEveryValidator(f func(idx int, val state.ReadOnlyValidator) error) error { if b.validators == nil { return errors.New("nil validators in state") diff --git a/beacon-chain/state/state-native/state_trie.go b/beacon-chain/state/state-native/state_trie.go index bd88d3a947ea..87ac6f84e1cb 100644 --- a/beacon-chain/state/state-native/state_trie.go +++ b/beacon-chain/state/state-native/state_trie.go @@ -541,6 +541,7 @@ func (b *BeaconState) HashTreeRoot(ctx context.Context) ([32]byte, error) { } // Initializes the Merkle layers for the beacon state if they are empty. +// // WARNING: Caller must acquire the mutex before using. func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { if len(b.merkleLayers) > 0 { @@ -565,6 +566,7 @@ func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { } // Recomputes the Merkle layers for the dirty fields in the state. +// // WARNING: Caller must acquire the mutex before using. func (b *BeaconState) recomputeDirtyFields(ctx context.Context) error { for field := range b.dirtyFields { diff --git a/beacon-chain/state/v1/getters_validator.go b/beacon-chain/state/v1/getters_validator.go index 74ef91a8abea..8e5c2d264658 100644 --- a/beacon-chain/state/v1/getters_validator.go +++ b/beacon-chain/state/v1/getters_validator.go @@ -174,7 +174,8 @@ func (b *BeaconState) NumValidators() int { } // ReadFromEveryValidator reads values from every validator and applies it to the provided function. -// Warning: This method is potentially unsafe, as it exposes the actual validator registry. +// +// WARNING: This method is potentially unsafe, as it exposes the actual validator registry. func (b *BeaconState) ReadFromEveryValidator(f func(idx int, val state.ReadOnlyValidator) error) error { if !b.hasInnerState() { return ErrNilInnerState diff --git a/beacon-chain/state/v1/state_trie.go b/beacon-chain/state/v1/state_trie.go index c0060c0a4bc3..7e9039240b88 100644 --- a/beacon-chain/state/v1/state_trie.go +++ b/beacon-chain/state/v1/state_trie.go @@ -213,6 +213,7 @@ func (b *BeaconState) HashTreeRoot(ctx context.Context) ([32]byte, error) { } // Initializes the Merkle layers for the beacon state if they are empty. +// // WARNING: Caller must acquire the mutex before using. func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { if len(b.merkleLayers) > 0 { @@ -229,6 +230,7 @@ func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { } // Recomputes the Merkle layers for the dirty fields in the state. +// // WARNING: Caller must acquire the mutex before using. func (b *BeaconState) recomputeDirtyFields(ctx context.Context) error { for field := range b.dirtyFields { diff --git a/beacon-chain/state/v2/getters_validator.go b/beacon-chain/state/v2/getters_validator.go index d137fa10c412..1edf411f1781 100644 --- a/beacon-chain/state/v2/getters_validator.go +++ b/beacon-chain/state/v2/getters_validator.go @@ -175,7 +175,8 @@ func (b *BeaconState) NumValidators() int { } // ReadFromEveryValidator reads values from every validator and applies it to the provided function. -// Warning: This method is potentially unsafe, as it exposes the actual validator registry. +// +// WARNING: This method is potentially unsafe, as it exposes the actual validator registry. func (b *BeaconState) ReadFromEveryValidator(f func(idx int, val state.ReadOnlyValidator) error) error { if !b.hasInnerState() { return ErrNilInnerState diff --git a/beacon-chain/state/v2/state_trie.go b/beacon-chain/state/v2/state_trie.go index de79d257ea78..2728ea164f4b 100644 --- a/beacon-chain/state/v2/state_trie.go +++ b/beacon-chain/state/v2/state_trie.go @@ -218,6 +218,7 @@ func (b *BeaconState) HashTreeRoot(ctx context.Context) ([32]byte, error) { } // Initializes the Merkle layers for the beacon state if they are empty. +// // WARNING: Caller must acquire the mutex before using. func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { if len(b.merkleLayers) > 0 { @@ -234,6 +235,7 @@ func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { } // Recomputes the Merkle layers for the dirty fields in the state. +// // WARNING: Caller must acquire the mutex before using. func (b *BeaconState) recomputeDirtyFields(ctx context.Context) error { for field := range b.dirtyFields { diff --git a/beacon-chain/state/v3/getters_validator.go b/beacon-chain/state/v3/getters_validator.go index 6810581f7050..a1605ce9e856 100644 --- a/beacon-chain/state/v3/getters_validator.go +++ b/beacon-chain/state/v3/getters_validator.go @@ -175,7 +175,8 @@ func (b *BeaconState) NumValidators() int { } // ReadFromEveryValidator reads values from every validator and applies it to the provided function. -// Warning: This method is potentially unsafe, as it exposes the actual validator registry. +// +// WARNING: This method is potentially unsafe, as it exposes the actual validator registry. func (b *BeaconState) ReadFromEveryValidator(f func(idx int, val state.ReadOnlyValidator) error) error { if !b.hasInnerState() { return ErrNilInnerState diff --git a/beacon-chain/state/v3/state_trie.go b/beacon-chain/state/v3/state_trie.go index 962e56910f51..5a4958eb1380 100644 --- a/beacon-chain/state/v3/state_trie.go +++ b/beacon-chain/state/v3/state_trie.go @@ -218,6 +218,7 @@ func (b *BeaconState) HashTreeRoot(ctx context.Context) ([32]byte, error) { } // Initializes the Merkle layers for the beacon state if they are empty. +// // WARNING: Caller must acquire the mutex before using. func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { if len(b.merkleLayers) > 0 { @@ -234,6 +235,7 @@ func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error { } // Recomputes the Merkle layers for the dirty fields in the state. +// // WARNING: Caller must acquire the mutex before using. func (b *BeaconState) recomputeDirtyFields(_ context.Context) error { for field := range b.dirtyFields { diff --git a/config/params/testnet_e2e_config.go b/config/params/testnet_e2e_config.go index 7d70a2d06c28..9c82e4acf476 100644 --- a/config/params/testnet_e2e_config.go +++ b/config/params/testnet_e2e_config.go @@ -22,7 +22,8 @@ func UseE2EMainnetConfig() { } // E2ETestConfig retrieves the configurations made specifically for E2E testing. -// Warning: This config is only for testing, it is not meant for use outside of E2E. +// +// WARNING: This config is only for testing, it is not meant for use outside of E2E. func E2ETestConfig() *BeaconChainConfig { e2eConfig := MinimalSpecConfig()