Compare commits

...

3 Commits

Author SHA1 Message Date
Potuz
4798c1866a changelog 2024-12-19 10:54:01 -03:00
Potuz
10173af7e7 Merge remote-tracking branch 'origin/develop' into err_on_invalid 2024-12-19 10:52:43 -03:00
Potuz
72eb0fbbfe Return an error when attempting to invalidate the finalized checkpoint 2024-12-19 10:46:57 -03:00
3 changed files with 11 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
- Added an error field to log `Finished building block`.
- Implemented a new `EmptyExecutionPayloadHeader` function.
- `Finished building block`: Display error only if not nil.
- Return an error instead of panic when invalidating the finalized checkpoint.
### Changed

View File

@@ -23,6 +23,9 @@ func (s *Store) setOptimisticToInvalid(ctx context.Context, root, parentRoot, la
if node == nil {
return invalidRoots, errors.Wrap(ErrNilNode, "could not set node to invalid")
}
if node.parent == nil {
return invalidRoots, errors.New("attempting to set the root node to invalid")
}
if node.parent.root != parentRoot {
return invalidRoots, errInvalidParentRoot
}

View File

@@ -385,6 +385,13 @@ func TestSetOptimisticToInvalid_ForkAtMerge_bis(t *testing.T) {
require.DeepEqual(t, roots, [][32]byte{{'b'}, {'c'}, {'d'}, {'e'}})
}
func TestSetOptimisticToInvalid_InvalidRoot(t *testing.T) {
ctx := context.Background()
f := setup(1, 1)
_, err := f.SetOptimisticToInvalid(ctx, [32]byte{}, [32]byte{}, [32]byte{})
require.ErrorContains(t, "attempting to set the root node to invalid", err)
}
func TestSetOptimisticToValid(t *testing.T) {
f := setup(1, 1)
op, err := f.IsOptimistic([32]byte{})