-
Notifications
You must be signed in to change notification settings - Fork 3
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
test(medusa): multiple strat #48
Conversation
didn't include the superfluid one, as it's relying on Superfluid |
uint256[] internal ghost_poolIds; | ||
mapping(uint256 _poolId => address _poolAdmin) ghost_poolAdmins; | ||
|
||
// mapping(uint256 _poolId => PoolStrategies _strategy) internal _poolStrategy; |
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.
Should this mapping be deleted?
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.
yes
mapping(PoolStrategies _strategy => address _implementation) | ||
internal _strategyImplementations; | ||
|
||
function _initImplementations(address _allo) internal { |
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.
🔥
} | ||
|
||
function _recordPool(uint256 _poolId, PoolStrategies _strategy) internal { | ||
// _poolStrategy[_poolId] = _strategy; |
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.
should it be deleted?
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.
yes
emit TestFailure("Wrong pool strategy implementation address"); | ||
} | ||
|
||
function _strategyHasImplementation( |
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.
another option is to use an aux mapping(PoolStrategies strategy => address implementation)
to avoid the for loop
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.
as we are not optimising for gas, I think we should avoid as much as possible having state in the test contract, when we can easily(ish) compute it instead - wdyt?
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.
yes it's fine for me
test/invariant/fuzz/Setup.t.sol
Outdated
// Deploy strategies implementations | ||
_initImplementations(address(allo)); | ||
|
||
// strategy_directAllocation = new DirectAllocationStrategy(address(allo)); |
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.
should we remove this?
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.
also yes
DEFAULT_MAX_BID = 1000; | ||
|
||
for (uint256 i = 1; i <= uint256(type(PoolStrategies).max); i++) { | ||
address _deployer = _ghost_actors[i % 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.
why is it % 4
? if we are interested to use a specific address we could mark it explicitly just in case _ghost_actors
is changed in the future
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.
the first 4 actors are anchor owner, no?
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.
makes sense
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.
looks really good, left some minor comments
No description provided.