WIP: cip 0105 externally implemented governance locks - #6427
Conversation
| -- vesting to be in a separate dar from amulet only needed for SVs and | ||
| -- interested observers. | ||
|
|
||
| template AggregateLock |
There was a problem hiding this comment.
unclear to me why this is a separate template, ideally this would be done through the withdraw choice. If that is not an option, it seems like this could just be a choice on ExternalPartyAmuletRules
There was a problem hiding this comment.
comment still applies
There was a problem hiding this comment.
Current in-progress plan is to remove at least the choices (moving to allocation withdraw), and probably the whole template. The remaining pieces that need to land somewhere else are early unlock support (which may be it's own tiny "allow early unlock" template provided as context to withdraw) and producing an appropriate key to group lock allocations with.
| lockedCid : ContractId Allocation | ||
| withdrawToCid : ContractId Allocation |
There was a problem hiding this comment.
Can you add some comments on how you expect the two allocations to be used? it's not clear to me. Or even better add the test script.
There was a problem hiding this comment.
comment still applies, add some comments on what the allocations are supposed to represent
There was a problem hiding this comment.
lockedCid was the active lock and withdrawTo was a fresh allocation to hold the withdrawn-to-vesting funds. Removed with the move to integrate into allocation withdraw, where the contract operates explicitly with the holder's authority as well as whatever is in the flexible controller lists.
|
|
||
| type ControllerSets = [[Party]] | ||
|
|
||
| partiesFromText : Text -> Optional [Party] |
There was a problem hiding this comment.
there are a bunch of utilities already e.g. parseCommaSeparated, let's reuse those instead of reimplementing half of them.
There was a problem hiding this comment.
comment still applies
There was a problem hiding this comment.
Should be fixed below. Do we want to do the same with controllerSetFromMeta and make a helper utility function for semi-colons?
…ed-governance-locks' into jg/cip-0105-externally-implemented-governance-locks
…evelopment cycles by allowing the LSP to work cross-package when working on code.
Fix some issues related to PR comments for VestingLock
| partiesToMeta, | ||
| dropMeta, | ||
| validateNoMeta, | ||
| -- TODO: Is exporting the below cool? |
| -- Lock some funds for the aggregate | ||
| AllocationInstructionResult { output = AllocationInstructionResult_Completed locked } <- lockForAggregate env 1000.0 bob aggLock | ||
|
|
||
| -- Check total for the aggregate; needs to be implemented. |
There was a problem hiding this comment.
let's actually add that
There was a problem hiding this comment.
Total check in the test is on the way.
|
|
||
| type ControllerSets = [[Party]] | ||
|
|
||
| partiesFromText : Text -> Optional [Party] |
There was a problem hiding this comment.
comment still applies
| -- vesting to be in a separate dar from amulet only needed for SVs and | ||
| -- interested observers. | ||
|
|
||
| template AggregateLock |
There was a problem hiding this comment.
comment still applies
| -- "the settlement" for the allocations locked to it, and use iterated | ||
| -- settlement to execute updates on the committed allocations as needed. | ||
| -- This approach would permit most of the specific governance locking and | ||
| -- vesting to be in a separate dar from amulet only needed for SVs and |
There was a problem hiding this comment.
separate dar comment doesn't make much sense imho
There was a problem hiding this comment.
Discussed and agreed given the additional context, removal of most or all is in progress.
|
|
||
| -- We should have one result from settleBatch | ||
| require "VestingUnlock_Withdraw should result in one allocation result. " $ | ||
| L.length batchResults.allocationSettleResults == 1 |
There was a problem hiding this comment.
similar as above with the isNone + fromSome, don't first do an assertion and then a partial match but instead just pattern match directly
There was a problem hiding this comment.
|
|
||
| assert $ length allocations == 2 | ||
|
|
||
| -- Need to check other than via inspection that the two allocations actually exist with correct values. |
|
|
||
| now <- getTime | ||
| let initialAmountToUnlock = 365.25 | ||
| AllocationInstructionResult { output = AllocationInstructionResult_Completed vestingInput } <- lockForVesting initialAmountToUnlock (addRelTime now $ minutes 5) env bob aggLock |
There was a problem hiding this comment.
There was a condition in validateVestingSchedule which said now < start which would not be satisfied unless there was a strict time difference there. Unless there's a good reason, that maybe ought to be now <= start, and I don't see any reason in our design doc, but perhaps @jonored knows better?
There was a problem hiding this comment.
5 mins is removed, and we now check <=: https://github.com/canton-network/splice/pull/6427/changes#diff-42bf48da99a7b4ebce12dcb026f648b6e7214a957e5380695103d9c2a839015cR69
| authorizers = [ bob ] | ||
| vestingLockCid = toInterfaceContractId vestingLockAllocationCid | ||
| extraArgs = enriched.arg.extraArgs | ||
| debug vestingAllocResult |
There was a problem hiding this comment.
let's remove all these random debugs
| let [(_, (Some unlockedHolding))] = filter (\(hcid, (Some h)) -> isNone h.lock && hcid `elem` holdingCids) holdings | ||
| debug unlockedHolding | ||
|
|
||
| let tolerance = 0.01 |
There was a problem hiding this comment.
what's the tolerance for? I don't see why you can't do an exact computation in your test
There was a problem hiding this comment.
This tolerance is because the actual number is extremely close to, but not exactly 10. However, it might be best just to copy the computed number into the test, given that Decimal is fixed point, an exact equality comparison is not as bad as it might otherwise be for floating point. To get a nice round number of tokens here, we'd need to very precisely compute the time interval we waited for (there is presumably some number of microseconds at which the value is exactly 10).
There was a problem hiding this comment.
Tolerance has been removed and we now have an exact Decimal instead: https://github.com/canton-network/splice/pull/6427/changes#diff-c33c401bd06c2f019c9f1901af1c6d7225d6f1a3193e4b7d6d06da3262069646R141
| @@ -0,0 +1,29 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
change is merged, please rebase and remove from this pr
There was a problem hiding this comment.
Yeah, that was an accident because I'd previously cherry-picked it onto the branch. Sorry!
Address some CIP-0105 PR comments
…ing up development cycles by allowing the LSP to work cross-package when working on code." This reverts commit 15dfa70.
…y-implemented-governance-locks
WIP code for possible direction for CIP-0105 locking implementation using the existing AmuletAllocationV2 unmodified, for reference only. Do not merge.
Pull Request Checklist
Cluster Testing
/cluster_teston this PR to request it, and ping someone with access to the DA-internal system to approve it./upgrade_teston this PR to request it, and ping someone with access to the DA-internal system to approve it./hdm_teston this PR to request it, and ping someone with access to the DA-internal system to approve it./lsu_teston this PR to request it, and ping someone with access to the DA-internal system to approve it.PR Guidelines
Fixes #n, and mention issues worked on using#nMerge Guidelines