Skip to content

Cip 0105 basic sv locks - #6815

Draft
dbzguy56 wants to merge 4 commits into
canton-network:staging-0.8.0from
obsidiansystems:cip-0105-basic-sv-locks
Draft

Cip 0105 basic sv locks#6815
dbzguy56 wants to merge 4 commits into
canton-network:staging-0.8.0from
obsidiansystems:cip-0105-basic-sv-locks

Conversation

@dbzguy56

Copy link
Copy Markdown

WIP, the plan is to have commits be squashed.

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If an upgrade test is required, comment /upgrade_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a logical synchronizer upgrade test is required (from canton-3.5), comment /lsu_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

@meiersi-da meiersi-da left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Seems a bit too WIP for an in-depth review.

-- in later standards, or on a case-by-case basis between the caller and the
-- implementer of the interface.
deriving (Show, Eq)
deriving (Show, Eq, Serializable)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is off here. This is part of the commits from staging-0.8.0.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see it at
https://github.com/canton-network/splice/blob/staging-0.8.0/token-standard/splice-api-token-metadata-v1/daml/Splice/Api/Token/MetadataV1.daml#L84
at least; according to @dbzguy56 the compiler was complaining if it wasn't added, but whether that should be happening is a different question.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was definitely a mistake, I think there were complaints in other areas. Maybe I mistakenly thought it was there. Reverted

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Explicit serializability is not enabled for that file:https://github.com/canton-network/splice/blob/staging-0.8.0/token-standard/splice-api-token-metadata-v1/daml.yaml, which is fine.

@dbzguy56
dbzguy56 force-pushed the cip-0105-basic-sv-locks branch from 2a751c3 to 8d5135f Compare August 18, 2026 17:55
@dbzguy56
dbzguy56 force-pushed the cip-0105-basic-sv-locks branch from cb1c7f8 to 696ee53 Compare August 18, 2026 21:17

@meiersi-da meiersi-da left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

values : TextMap Text
-- ^ Key-value pairs of metadata entries.
deriving (Eq,Ord, Show)
deriving (Eq, Ord, Show)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change would be good, but we try to avoid interface changes when possible. Let's revert this one.

Comment on lines +52 to +71
typeKey : Text
typeKey = "cip-105/type"
beneficiaryKey : Text
beneficiaryKey = "cip-105/lockBeneficiary"
startDateKey : Text
startDateKey = "cip-105/startDate"
endDateKey : Text
endDateKey = "cip-105/endDate"
initialAmountKey : Text
initialAmountKey = "cip-105/initialAmount"
effectiveAtKey : Text
effectiveAtKey = "cip-105/effectiveAt"


unlockControllerKey : Text
unlockControllerKey = "cip-105/unlockControllers"
withdrawControllerKey : Text
withdrawControllerKey = "cip-105/withdrawControllers"
substituteControllerKey : Text
substituteControllerKey = "cip-105/substituteControllers"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please add newlines between the definitions as done in all other files. Also share the prefix and use kebab-case as done for the other metadata keys.

typeKey : Text
typeKey = "cip-105/type"
beneficiaryKey : Text
beneficiaryKey = "cip-105/lockBeneficiary"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjust to lock-subject

expireLockKey : Text
expireLockKey = "expire-lock"


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove spurious change

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be done


-- TODO: Potentially make return type, it's own data type?
calculateAvailableWithdrawAmount : Time -> VestingLock -> Decimal -> (Decimal, Decimal)
calculateAvailableWithdrawAmount currentDateTime (VestingLock {..}) nextIterationFundAmount = max (0.0, 0.0) availAmount

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the max here? Can we inline it into the computation of availAmount?

&& all (\a -> any (a ==) set) actors


-- This will also need to get a configuration template to set the vesting period and potentially other settings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That needs to be passed in via ExternalPartyConfigState.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a todo right below it

checkControllerSpecification arg.actors $ fromOptional (defaultControllerSpecification ownerParty) lock.controllers.unlock

now <- getFromContextU arg.extraArgs.context effectiveAtKey -- FIXME: read from metadata not context.
isLedgerTimeLE now >>= require "effectiveAt must not be in the past"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use assertWithinDeadline

let endDate = getEndTime now
transferLegId = "unlock"

let alternateAmount = TM.lookup "cip-105/withdraw-amount" arg.extraArgs.meta.values >>= parseDecimal

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest that we define types for the choices that we are effectively implementing and use our normal metadata parsing machinery to parse them.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be doing this as a TODO within latest PR here: #6894

controllers = lock.controllers

-- Not easy to call directly into amulet_allocationFactoryV2_allocateImpl or the like here as that would make a circular dependency.
(withdrawTo : ContractId a, _) <- createUnfundedGovernanceAllocation vestingGovernanceLock $ V2.AllocationFactory_Allocate with

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonored @dbzguy56 : I have the nagging suspicion that we are better off implementing our own templates to represent governance locks, and only using the TSv2 interfaces as a tool to provide a smooth wallet integration. In that case, I'd even go as far as defining internal choices that implement the actual logic, and call them from the interface implementation.

This way we significantly simplify reasoning about the implementation, and avoid polluting the implementation of AmuletAllocationV2 with the concerns of governance locks.

Side note: when I originally proposed to use the "TSv2 allocations" I was thinking about the wallet integration, and less about piggy-backing on AmuletAllocationV2. I was though less clear about it than I am now after having written the high-level implementation spec. Let's dicsuss in our sync.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in sync

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing that at #6894 - broadly intending to move features over to there in the "incremental delivery" order unless otherwise requested. As noted this and implementing the V2 interfaces for maximum compatibility does align well with our original intentions for our POC approach.

-- Governance Lock support
-- =======================

template GovernanceLockProposal with

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this out into the GovernanceLock module?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: do we even need that? The new spec is based on creating locks directly. This should only be used for substitutions.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you are right, removed this template and portion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants