Skip to content

Commit

Permalink
feat: fixed storage unit tests. Added comments about share size
Browse files Browse the repository at this point in the history
  • Loading branch information
AKorpusenko committed Oct 9, 2023
1 parent a4d7418 commit deb4f61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions protocol/v2/types/ssvshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ import (
)

const (
MaxPossibleShareSize = 1245
MaxAllowedShareSize = MaxPossibleShareSize * 8 // Leaving some room for protocol updates and calculation mistakes.
// InitMaxPossibleShareSize - initial protocol max share size
InitMaxPossibleShareSize = 1245

// CurrentMaxPossibleShareSize - Current protocol version max share size;
// can be generated by generateRandomValidatorShare
// Used only for testing purposes
CurrentMaxPossibleShareSize = 1257

// MaxAllowedShareSize - constant protocol value. Should not be changed
// Leaving some room for protocol updates and calculation mistakes.
MaxAllowedShareSize = InitMaxPossibleShareSize * 8
)

// SSVShare is a combination of spectypes.Share and its Metadata.
Expand Down
2 changes: 1 addition & 1 deletion registry/storage/shares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestMaxPossibleShareSize(t *testing.T) {
b, err := s.Encode()
require.NoError(t, err)

require.Equal(t, ssvtypes.MaxPossibleShareSize, len(b))
require.Equal(t, ssvtypes.CurrentMaxPossibleShareSize, len(b))
}

func TestSaveAndGetValidatorStorage(t *testing.T) {
Expand Down

0 comments on commit deb4f61

Please sign in to comment.