Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: chainReader shares and operatorSets functions #437

Merged
merged 31 commits into from
Jan 20, 2025

Conversation

damiramirez
Copy link
Contributor

@damiramirez damiramirez commented Jan 14, 2025

What Changed?

This PR aims to increase the test coverage of reader.go.

Tested functions:

  • GetOperatorsForOperatorSet
  • GetNumOperatorsForOperatorSet
  • GetOperatorSetsForOperator
  • GetNumOperatorSetsForOperator
  • GetStrategiesForOperatorSet
  • GetSlashableShares
  • GetSlashableSharesForOperatorSets
  • GetSlashableSharesForOperatorSetsBefore
  • GetRegisteredSets

Increased the test timeout from 4 minutes to 5 minutes.

Reviewer Checklist

  • Code is well-documented
  • Code adheres to Go naming conventions
  • Code deprecates any old functionality before removing it

@damiramirez damiramirez marked this pull request as ready for review January 17, 2025 19:17
Copy link
Contributor

@maximopalopoli maximopalopoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just leave you some comments:


const allocationDelay = 1
const allocationMagnitude = 100
const allocationConfigurationDelay = 1200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constants should be outside the test or else they can be variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 9d32443

true,
)
require.NoError(t, err)
require.Equal(t, uint64(1), receipt.Status)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This literal can be replaced for gethtypes.ReceiptStatusSuccessful

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 4fbf686

opSets, err := chainReader.GetOperatorSetsForOperator(context.Background(), operatorAddr)
require.NoError(t, err)
require.NotEmpty(t, opSets)
require.Len(t, opSets, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If opSets has len 1 then it is not empty, so one require is redundant in my opinion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 1e9bf2d

operators, err := chainReader.GetOperatorsForOperatorSet(context.Background(), operatorSet)
require.NoError(t, err)
require.NotEmpty(t, operators)
require.Len(t, operators, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 1e9bf2d

@pablodeymo pablodeymo added this pull request to the merge queue Jan 20, 2025
Merged via the queue into Layr-Labs:dev with commit 42729c2 Jan 20, 2025
4 checks passed
@pablodeymo pablodeymo deleted the test/slashable-shares-read branch January 20, 2025 21:30
maximopalopoli pushed a commit to lambdaclass/eigensdk-go that referenced this pull request Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants