-
Notifications
You must be signed in to change notification settings - Fork 199
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
Conversation
miiu96
commented
May 8, 2020
•
edited
Loading
edited
- Add a test that verify if end of epoch economics data) is calculated as expected.
} | ||
|
||
rewardsPerBlock, _ := big.NewInt(0).SetString("84559445290038908043", 10) // *based on 0.1 inflation | ||
for _, input := range testInpus { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 | ||
}, | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
devFeesInEpoch *big.Int | ||
} | ||
|
||
testInpus := []testInput{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testInputs
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roundDuration
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totalBlocksPerEpoch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.