mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +00:00
Hard: investigate sdk.RelativePow runtime panic (#762)
* interest rate practical test * add clarification comment
This commit is contained in:
parent
a0d70e1c81
commit
f6efc2597b
@ -289,8 +289,6 @@ func (suite *InterestTestSuite) TestCalculateBorrowInterestFactor() {
|
||||
expectedValue: sdk.MustNewDecFromStr("40628388.864535408465693310"),
|
||||
},
|
||||
},
|
||||
// If we raise the per second interest rate too much we'll cause an integer overflow.
|
||||
// For example, perSecondInterestRate: '1.000005555555' will cause a panic.
|
||||
{
|
||||
"1 year: highest interest rate",
|
||||
args{
|
||||
@ -299,6 +297,14 @@ func (suite *InterestTestSuite) TestCalculateBorrowInterestFactor() {
|
||||
expectedValue: sdk.MustNewDecFromStr("2017093013158200407564.613502861572552603"),
|
||||
},
|
||||
},
|
||||
{
|
||||
"largest per second interest rate with practical elapsed time",
|
||||
args{
|
||||
perSecondInterestRate: sdk.MustNewDecFromStr("18.445"), // Begins to panic at ~18.45 (1845%/second interest rate)
|
||||
timeElapsed: sdk.NewInt(30), // Assume a 30 second period, longer than any expected individual block
|
||||
expectedValue: sdk.MustNewDecFromStr("94702138679846565921082258202543002089.215969366091911769"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
Loading…
Reference in New Issue
Block a user