fix: ShareClassManager and SimplePriceManager - transfer shares underflow#746
fix: ShareClassManager and SimplePriceManager - transfer shares underflow#746
Conversation
wischli
left a comment
There was a problem hiding this comment.
Makes sense to me and seems feasible! Thanks for the fix. Overall, I'd love to see some assertions/tests in e2e in the future, definitely not this PR.
|
|
||
| // When shares are transferred, the issuance in the SCM updates immediately, | ||
| // but in this contract they are tracked separately as transferredIn/Out. | ||
| // Here we get the diff between the old SPM issuance and the new SCM issuance, |
There was a problem hiding this comment.
Nit
| // Here we get the diff between the old SPM issuance and the new SCM issuance, | |
| // Here we get the diff between the old SCM issuance and the new SCM issuance, |
There was a problem hiding this comment.
This is intentional (Single Price Manager = SPM)
There was a problem hiding this comment.
actually clarified that it's the current stale SPM issuance
| assertEq(toIssuance, 200); | ||
| assertEq(fromTransferredOut, 0); | ||
| assertEq(fromTransferredIn, 0); | ||
| assertEq(toTransferredIn, 50); |
There was a problem hiding this comment.
Q: IIUC, this is not 0 because we haven't called onUpdate for network 2 yet right?
src/core/hub/ShareClassManager.sol
Outdated
| mapping(PoolId => mapping(ShareClassId => Price)) public pricePoolPerShare; | ||
| mapping(PoolId => mapping(ShareClassId => ShareClassMetadata)) public metadata; | ||
| mapping(PoolId => mapping(ShareClassId => mapping(uint16 centrifugeId => uint128))) public issuance; | ||
| mapping(PoolId => mapping(ShareClassId => mapping(uint16 centrifugeId => IssuancePerNetwork))) internal |
There was a problem hiding this comment.
Maybe we should make this public. Otherwise there is no way to know the individual sum of issuances and revocations, if it is reverting.
* Benchmarks, add tests * Fix warning
* Add transfer shares test * Cleanup
|
Coverage after merging scm-pending-issuance into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Product requirements
Design notes
TODOs