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

Add configurable deposit amounts to testutil #7775

Merged
merged 7 commits into from
Nov 11, 2020
Merged

Conversation

0xKiwi
Copy link
Contributor

@0xKiwi 0xKiwi commented Nov 11, 2020

What type of PR is this?
Test helper additions

What does this PR do? Why is it needed?
This PR adds extra deposit helpers to allow creating deterministic deposits with custom balances. It uses any available cache of secret keys and generates any if it needs.

This is in preparation for testing partial deposits in E2E.

@0xKiwi 0xKiwi added the Ready For Review A pull request ready for code review label Nov 11, 2020
@codecov
Copy link

codecov bot commented Nov 11, 2020

Codecov Report

Merging #7775 (2f33549) into master (25118fb) will increase coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #7775      +/-   ##
==========================================
+ Coverage   62.17%   62.21%   +0.03%     
==========================================
  Files         429      429              
  Lines       30340    30340              
==========================================
+ Hits        18863    18875      +12     
+ Misses       8541     8530      -11     
+ Partials     2936     2935       -1     

"github.com/gogo/protobuf/proto"

"github.com/prysmaticlabs/prysm/shared/params"

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

}
sigRoot, err := (&pb.SigningData{ObjectRoot: root[:], Domain: domain}).HashTreeRoot()
balance := params.BeaconConfig().MaxEffectiveBalance
deposit, err := signedDeposit(secretKeys[i], publicKeys[i].Marshal(), publicKeys[i+1].Marshal(), balance)
Copy link
Contributor

Choose a reason for hiding this comment

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

any check here that i+1 wont exceed the list size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not required, above we generate it with a +1 as well.

if len(balances) == int(numDeposits) {
balance = balances[i]
}
deposit, err := signedDeposit(secretKeys[i], publicKeys[i].Marshal(), publicKeys[i+1].Marshal(), balance)
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@rauljordan rauljordan merged commit a21a2c9 into master Nov 11, 2020
@delete-merged-branch delete-merged-branch bot deleted the deposits-balances branch November 11, 2020 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants