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

Liquid staking unit and integration tests #3385

Merged
merged 15 commits into from Aug 31, 2021

Conversation

sasurobert
Copy link
Contributor

@sasurobert sasurobert commented Aug 26, 2021

Liquid staking unit tests
Liquid staking integration tests

@iulianpascalau iulianpascalau self-requested a review August 28, 2021 19:04
@sasurobert sasurobert changed the title Liquid staking unit tests Liquid staking unit and integration tests Aug 29, 2021
integrationTests/testProcessorNode.go Show resolved Hide resolved
@@ -2275,7 +2343,7 @@ func (tpn *TestProcessorNode) LoadTxSignSkBytes(skBytes []byte) {
// ProposeBlock proposes a new block
func (tpn *TestProcessorNode) ProposeBlock(round uint64, nonce uint64) (data.BodyHandler, data.HeaderHandler, [][]byte) {
startTime := time.Now()
maxTime := time.Second * 2
maxTime := time.Second * 200000
Copy link
Contributor

Choose a reason for hiding this comment

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

please revert this

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

idxProposers[numOfShards] = numOfShards * nodesPerShard

var tokenID []byte
for _, node := range nodes {
Copy link
Contributor

Choose a reason for hiding this comment

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

this can be extracted in a function for reusability purposes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would leave as it is.

testscommon/txDataBuilder/builder.go Show resolved Hide resolved
output := d.Execute(vmInput)
assert.Equal(t, vmcommon.UserError, output)
assert.True(t, strings.Contains(eei.returnMessage, "error getting minimum delegation amount"))
assert.True(t, strings.Contains(eei.returnMessage, "invalid value to undelegate - need to undelegate all - do not leave dust behind"))
Copy link
Contributor

Choose a reason for hiding this comment

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

is this backwards compatible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. it is. Error getting minimum amount does not happen at all. Only if delegation management was not instantiated.

remainedFund := big.NewInt(0).Sub(activeFund.Value, valueToUnDelegate)
if remainedFund.Cmp(zero) > 0 && remainedFund.Cmp(minDelegationAmount) < 0 {
err = d.checkRemainingFundValue(remainedFund)
if err != nil {
d.eei.AddReturnMessage("invalid value to undelegate - need to undelegate all - do not leave dust behind")
Copy link
Contributor

Choose a reason for hiding this comment

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

d.eei.AddReturnMessage(err.Error()) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, this has to be left as it is for backward compatibility purposes.

@sasurobert sasurobert merged commit 6ab9cd5 into feat/liquid-staking Aug 31, 2021
@sasurobert sasurobert deleted the liquid-staking-unit-tests branch August 31, 2021 07:08
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.

None yet

3 participants