-
Notifications
You must be signed in to change notification settings - Fork 13
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
fixed bug updated test #215
Conversation
test-suites/src/setup.rs
Outdated
@@ -159,6 +159,103 @@ pub fn create_fixture_with_data<'a>(wasm: bool) -> TestFixture<'a> { | |||
fixture | |||
} | |||
|
|||
/// Create a test fixture with a pool and a whale depositing and borrowing all assets | |||
pub fn create_fixture_no_rzone_add<'a>(wasm: bool) -> TestFixture<'a> { |
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.
can we just perform this setup manually in the test? Creating a new fixture option for a one-off test case will likely cause more confusion down the line.
See: https://github.com/blend-capital/blend-contracts/blob/main/test-suites/tests/test_pool_inflation_attack.rs as example
test-suites/tests/test_emitter.rs
Outdated
@@ -40,6 +167,7 @@ fn test_emitter() { | |||
let result = fixture.emitter.distribute(); | |||
backstop_blnd_balance += result; | |||
assert_eq!(fixture.env.auths().len(), 0); | |||
println!("timestamp: {}", fixture.env.ledger().timestamp()); |
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.
println
test-suites/tests/test_emitter.rs
Outdated
blnd_token.balance(&fixture.backstop.address); | ||
|
||
// Allow 6 days to pass and call distribute | ||
// @dev: 1h1m have passed since the emitter was deployed during 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.
this is wrong, and supports keeping the create_fixure_no_rzone_add
in test.
7 days pass after creation of the fixture
1hr1m is passed for no particular reason in the create_fixture_no_rzone
fn
test-suites/tests/test_emitter.rs
Outdated
assert_eq!(result, (13 * 24 * 60 * 60 + 61 * 60) * 300_0000 - 300000); //pool claim is only 30% of the total emissions | ||
let result_1 = fixture.backstop.claim( | ||
&fixture.users[0], | ||
&svec![&fixture.env, pool_fixture.pool.address.clone()], | ||
&fixture.users[0], | ||
); | ||
assert_eq!( | ||
result_1 + result, | ||
(13 * 24 * 60 * 60 + 61 * 60) * SCALAR_7 - 400000 | ||
); | ||
assert_eq!(result_1, (13 * 24 * 60 * 60 + 61 * 60) * 700_0000 - 100000); |
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.
not sure i follow the
- 0_0300000
, - 0_0400000
and - 0_0100000
.
Can you explain?
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.
It's from rounding in the emissions math
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.
that is a huge number to result from rounding 😓
test-suites/src/setup.rs
Outdated
// fixture.tokens[TokenIndex::STABLE].approve( | ||
// &frodo, | ||
// &pool_fixture.pool.address, | ||
// &i128::MAX, | ||
// &(fixture.env.ledger().sequence() + 100), | ||
// ); | ||
// fixture.tokens[TokenIndex::WETH].approve( | ||
// &frodo, | ||
// &pool_fixture.pool.address, | ||
// &i128::MAX, | ||
// &(fixture.env.ledger().sequence() + 100), | ||
// ); | ||
// fixture.tokens[TokenIndex::XLM].approve(&frodo, &pool_fixture.pool.address, &i128::MAX, &50000); |
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.
dead code
Make emissions ungulpable pre-rzone