Determine Amulet total supply by ACS snapshot when possible - #2334
Conversation
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
[ci] Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
| } | ||
|
|
||
| private def getAmuletInstrument()(implicit ec: ExecutionContext, tc: TraceContext) = | ||
| for { |
There was a problem hiding this comment.
called in the line just below this
there aren't any tests... I'm also not sure there's much value in one since there already are for the endpoints that use the 2 options directly, but lmk
There was a problem hiding this comment.
actually, at least it can be checked in the sanity plugin: #2318 (review)
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
| if args.scan_balance_assertions: | ||
| # this will only work if a snapshot was taken, which is guaranteed by compare_acs_with_snapshot=True | ||
| token_metadata = await scan_client.get_amulet_token_metadata() | ||
| latest_per_party_balances = app_state.state.balance_end_of_round().values() |
There was a problem hiding this comment.
can you remind me what balance_end_of_round does here? I think ideally we would just check the acs state that the script has, no point in aligning anything to rounds.
There was a problem hiding this comment.
def balance_end_of_round(self):
amulets = self.list_contracts(TemplateQualifiedNames.amulet)
locked_amulets = self.list_contracts(TemplateQualifiedNames.locked_amulet)
per_party_balances = {}
for amulet in amulets.values():
owner = amulet.payload.get_amulet_owner()
per_party_balances.setdefault(owner, PerPartyBalance())
per_party_balances[owner].amulets += [amulet]
for locked_amulet in locked_amulets.values():
amulet = locked_amulet.payload.get_locked_amulet_amulet()
owner = amulet.get_amulet_owner()
per_party_balances.setdefault(owner, PerPartyBalance())
per_party_balances[owner].locked_amulets += [locked_amulet]
return per_party_balances
doesn't seem to be related to rounds at all - will rename
| LOG.error(f"Contracts missing in script ACS: {missing}") | ||
| if args.scan_balance_assertions: | ||
| # this will only work if a snapshot was taken, which is guaranteed by compare_acs_with_snapshot=True | ||
| token_metadata = await scan_client.get_amulet_token_metadata() |
There was a problem hiding this comment.
This will only work once amulet-0.1.14 has been voted in correct? Consider gating the check by exposing whether that's the case in https://github.com/hyperledger-labs/splice/blob/c062908d98ab604ec4ab155a5c0c85733a78ec12/apps/scan/src/main/openapi/scan.yaml#L1520
There was a problem hiding this comment.
Hmm... probably better to not do that to avoid accidentally not testing the balance computation as part of the sanity check plugin. If needed we could add a separate parameter to disable this check in case it causes problems.
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
d943a96 to
d426a88
Compare
Fixes #2279
Fixes #2254
compat tests: https://github.com/hyperledger-labs/splice/actions/runs/17920993127