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

EN-6373 : add test for ComputeEndOfEpochEconomics #1538

Merged
merged 9 commits into from
May 14, 2020

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented May 8, 2020

  • Add a test that verify if end of epoch economics data) is calculated as expected.

@miiu96 miiu96 requested a review from sasurobert May 8, 2020 13:40
@miiu96 miiu96 self-assigned this May 8, 2020
}

rewardsPerBlock, _ := big.NewInt(0).SetString("84559445290038908043", 10) // *based on 0.1 inflation
for _, input := range testInpus {
Copy link
Contributor

Choose a reason for hiding this comment

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

make a separate function which gets one input and does verifications.

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.

TimeDurationCalled: func() time.Duration {
return time.Duration(roundDur) * time.Second
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

may create a function of setup.

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.

@multiversx multiversx deleted a comment May 9, 2020
@multiversx multiversx deleted a comment May 9, 2020
@multiversx multiversx deleted a comment May 9, 2020
@multiversx multiversx deleted a comment May 9, 2020
@multiversx multiversx deleted a comment May 9, 2020
devFeesInEpoch *big.Int
}

testInpus := []testInput{
Copy link
Contributor

Choose a reason for hiding this comment

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

testInputs

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.

totalSupply, _ := big.NewInt(0).SetString("20000000000000000000000000000", 10) // 20 Billions ERD
nodePrice, _ := big.NewInt(0).SetString("1000000000000000000000", 10) // 1000 ERD

roundDur := 4
Copy link
Contributor

Choose a reason for hiding this comment

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

roundDuration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed.

roundsPerEpoch := uint64(epochDuration / roundDur)
type testInput struct {
blockPerEpochOneShard uint64
acFeesInEpoch *big.Int
Copy link
Contributor

Choose a reason for hiding this comment

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

What is ac ? actual? rename it to be better understood

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed.

economicsBlock, err := ec.ComputeEndOfEpochEconomics(meta)
assert.Nil(t, err)

blocksPerEpochTotal := int64(input.blockPerEpochOneShard * 3)
Copy link
Contributor

Choose a reason for hiding this comment

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

totalBlocksPerEpoch

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.

@LucianMincu LucianMincu merged commit dfbc43f into development May 14, 2020
@LucianMincu LucianMincu deleted the EN-6373-test-economics branch May 14, 2020 10:48
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

5 participants