Skip to content

Commit 3e9723d

Browse files
canton-network-daDA Automation
andauthored
Update Splice from CCI (#405)
Signed-off-by: DA Automation <splice-maintainers@digitalasset.com> Co-authored-by: DA Automation <splice-maintainers@digitalasset.com>
1 parent 044079a commit 3e9723d

File tree

22 files changed

+476
-31
lines changed

22 files changed

+476
-31
lines changed

.envrc.vars

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ export EXPECTED_FILES_DIR="${SPLICE_ROOT}/cluster/expected"
1414
export PRIVATE_CONFIGS_PATH=${SPLICE_ROOT}/cluster/configs/configs-private
1515
export PUBLIC_CONFIGS_PATH=${SPLICE_ROOT}/cluster/configs/configs
1616

17-
# TODO(#19438) get rid of configs-internal in Splice
18-
export CONFIGS_DIR=${SPLICE_ROOT}/cluster/configs-internal
19-
2017
# Inrease code heap sizes to avoid issues
2118
# Defaults NonNMethodCodeHeapSize=7M,NonProfiledCodeHeapSize=122M,ProfiledCodeHeapSize=122M
2219
export SBT_OPTS="-Xmx6G -Xms2G -Xss2M -XX:+UseG1GC -XX:NonNMethodCodeHeapSize=32M -XX:NonProfiledCodeHeapSize=256M -XX:ProfiledCodeHeapSize=256M -XX:ReservedCodeCacheSize=544M"

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/ExternalPartySetupProposalIntegrationTest.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,24 @@ class ExternalPartySetupProposalIntegrationTest
439439
},
440440
)
441441

442+
val txs = sv1ScanBackend.listActivity(None, 1000)
443+
forExactly(1, txs) { tx =>
444+
// Test that the tx history for the TransferCommand_Send exercise gets parsed properly.
445+
val transfer = tx.transfer.value
446+
transfer.sender.party shouldBe aliceParty.toProtoPrimitive
447+
transfer.balanceChanges should have size (2)
448+
transfer.transferKind shouldBe Some(definitions.Transfer.TransferKind.members.PreapprovalSend)
449+
transfer.description shouldBe Some("transfer-command-description")
450+
forExactly(1, transfer.balanceChanges) { change =>
451+
change.party shouldBe aliceParty.toProtoPrimitive
452+
BigDecimal(change.changeToInitialAmountAsOfRoundZero) should beAround(BigDecimal(-517))
453+
}
454+
forExactly(1, transfer.balanceChanges) { change =>
455+
change.party shouldBe bobParty.toProtoPrimitive
456+
BigDecimal(change.changeToInitialAmountAsOfRoundZero) should beAround(BigDecimal(500))
457+
}
458+
}
459+
442460
// Check that transfer command gets archived if preapproval does not exist.
443461
val sv1Party = sv1Backend.getDsoInfo().svParty
444462
val now = env.environment.clock.now.toInstant

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/TokenStandardCliTestDataTimeBasedIntegrationTest.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
4646
updateAutomationConfig,
4747
}
4848
import org.lfdecentralizedtrust.splice.console.LedgerApiExtensions.RichPartyId
49+
import org.lfdecentralizedtrust.splice.http.v0.definitions
4950
import org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition
5051
import org.lfdecentralizedtrust.splice.integration.plugins.TokenStandardCliSanityCheckPlugin
5152
import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.{
@@ -202,9 +203,20 @@ class TokenStandardCliTestDataTimeBasedIntegrationTest
202203
alice.partyId,
203204
BigDecimal("200.0"),
204205
transferinstruction.v1.definitions.TransferFactoryWithChoiceContext.TransferKind.Direct,
206+
description = Some("token-standard-transfer-description"),
205207
)
206208
eventually() {
207209
aliceWalletClient.balance().unlockedQty should beAround(BigDecimal("200"))
210+
val scanTxs = sv1ScanBackend.listActivity(None, 1000)
211+
forExactly(1, scanTxs) { tx =>
212+
val transfer = tx.transfer.value
213+
transfer.transferKind shouldBe Some(
214+
definitions.Transfer.TransferKind.members.PreapprovalSend
215+
)
216+
transfer.description shouldBe Some("token-standard-transfer-description")
217+
transfer.sender.party shouldBe aliceValidator.partyId.toProtoPrimitive
218+
transfer.receivers.loneElement.party shouldBe alice.partyId.toProtoPrimitive
219+
}
208220
}
209221
// send some back so there's a TransferOut
210222
executeTransferViaTokenStandard(

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/TokenStandardTest.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import org.lfdecentralizedtrust.splice.codegen.java.splice.api.token.{
1414
import org.lfdecentralizedtrust.splice.console.LedgerApiExtensions.RichPartyId
1515
import org.lfdecentralizedtrust.splice.console.ParticipantClientReference
1616
import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.{SpliceTestConsoleEnvironment}
17-
import org.lfdecentralizedtrust.splice.util.FactoryChoiceWithDisclosures
17+
import org.lfdecentralizedtrust.splice.util.{FactoryChoiceWithDisclosures, TokenStandardMetadata}
1818
import org.lfdecentralizedtrust.tokenstandard.transferinstruction
1919

2020
import java.time.Duration
@@ -35,6 +35,7 @@ trait TokenStandardTest extends ExternallySignedPartyTestUtil {
3535
timeToLife: Duration = Duration.ofMinutes(10),
3636
expectedTimeBounds: Option[(CantonTimestamp, CantonTimestamp)] = None,
3737
advanceTimeBeforeExecute: Option[Duration] = None,
38+
description: Option[String] = None,
3839
)(implicit
3940
env: SpliceTestConsoleEnvironment
4041
) = {
@@ -47,6 +48,7 @@ trait TokenStandardTest extends ExternallySignedPartyTestUtil {
4748
amount,
4849
expectedKind,
4950
timeToLife,
51+
description,
5052
)
5153
participant.ledger_api_extensions.commands
5254
.submitJavaExternalOrLocal(
@@ -81,6 +83,7 @@ trait TokenStandardTest extends ExternallySignedPartyTestUtil {
8183
amount: BigDecimal,
8284
expectedKind: transferinstruction.v1.definitions.TransferFactoryWithChoiceContext.TransferKind,
8385
timeToLife: Duration = Duration.ofMinutes(10),
86+
description: Option[String] = None,
8487
)(implicit
8588
env: SpliceTestConsoleEnvironment
8689
): (
@@ -109,7 +112,9 @@ trait TokenStandardTest extends ExternallySignedPartyTestUtil {
109112
now,
110113
now.plus(timeToLife),
111114
senderHoldingCids.asJava,
112-
new metadatav1.Metadata(java.util.Map.of()),
115+
new metadatav1.Metadata(
116+
description.toList.map(TokenStandardMetadata.reasonMetaKey -> _).toMap.asJava
117+
),
113118
),
114119
emptyExtraArgs,
115120
)

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/TokenStandardTransferIntegrationTest.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
1111
updateAutomationConfig,
1212
}
1313
import org.lfdecentralizedtrust.splice.http.v0.definitions.TransferInstructionResultOutput.members
14+
import org.lfdecentralizedtrust.splice.http.v0.definitions.TransactionHistoryResponseItem.TransactionType as HttpTransactionType
1415
import org.lfdecentralizedtrust.splice.http.v0.definitions.{
1516
AbortTransferInstruction,
1617
ReceiverAmount,
@@ -289,10 +290,11 @@ class TokenStandardTransferIntegrationTest
289290
// 4 transfer instructions + accept + withdraw + reject
290291
activityTxs should have size (7)
291292
clue("TransferInstruction accept") {
293+
activityTxs(0).transactionType shouldBe HttpTransactionType.Transfer
292294
val transfer = activityTxs(0).transfer.value
293295
transfer.sender.party shouldBe aliceUserParty.toProtoPrimitive
294296
transfer.transferInstructionCid shouldBe Some(cids(2).contractId)
295-
transfer.transferInstructionDescription shouldBe None
297+
transfer.description shouldBe None
296298
transfer.transferInstructionReceiver shouldBe None
297299
transfer.transferKind shouldBe Some(Transfer.TransferKind.members.TransferInstructionAccept)
298300
transfer.receivers shouldBe Seq(
@@ -315,12 +317,14 @@ class TokenStandardTransferIntegrationTest
315317
}
316318
}
317319
clue("TransferInstruction withdraw") {
320+
activityTxs(1).transactionType shouldBe HttpTransactionType.AbortTransferInstruction
318321
val abort = activityTxs(1).abortTransferInstruction.value
319322
abort.transferInstructionCid shouldBe cids(1).contractId
320323
abort.abortKind shouldBe AbortTransferInstruction.AbortKind.members.Withdraw
321324
// Scan tracks the sum of locked and unlocked amulets so there is no balance change here.
322325
}
323326
clue("TransferInstruction reject") {
327+
activityTxs(2).transactionType shouldBe HttpTransactionType.AbortTransferInstruction
324328
val abort = activityTxs(2).abortTransferInstruction.value
325329
abort.transferInstructionCid shouldBe cids(0).contractId
326330
abort.abortKind shouldBe AbortTransferInstruction.AbortKind.members.Reject
@@ -329,12 +333,13 @@ class TokenStandardTransferIntegrationTest
329333
forAll(Seq(3, 4, 5, 6)) { i =>
330334
val transferInstructionNumber = 7 - i
331335
clue(s"Transfer #$transferInstructionNumber") {
336+
activityTxs(i).transactionType shouldBe HttpTransactionType.Transfer
332337
val transfer = activityTxs(i).transfer.value
333338
transfer.sender.party shouldBe aliceUserParty.toProtoPrimitive
334339
transfer.transferInstructionCid shouldBe Some(
335340
cids(transferInstructionNumber - 1).contractId
336341
)
337-
transfer.transferInstructionDescription shouldBe Some(
342+
transfer.description shouldBe Some(
338343
s"Transfer #$transferInstructionNumber"
339344
)
340345
transfer.transferInstructionReceiver shouldBe Some(bobUserParty.toProtoPrimitive)

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/reonboard/SvReOnboardPreflightIntegrationTest.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,14 @@ class SvReOnboardPreflightIntegrationTest
150150
"Transfer appears in transactions log",
151151
_ => {
152152
val rows = findAll(className("tx-row")).toSeq
153-
val expectedRow = rows.filter { row =>
153+
val expectedRows = rows.filter { row =>
154154
val transaction = readTransactionFromRow(row)
155155
transaction.partyDescription.exists(_.contains(offboardedSvParty.toProtoPrimitive))
156156
}
157-
inside(expectedRow) { case Seq(tx) =>
157+
// There will be two tx log entries, one for the creation of the offer and one for the acceptance
158+
// when using the token standard flow and one otherwise.
159+
// We support both and just check that the entry for the completed transfer is there.
160+
forExactly(1, expectedRows) { tx =>
158161
val transaction = readTransactionFromRow(tx)
159162
logger.info(s"Found transaction $transaction")
160163
transaction.action should matchText("Received")

apps/common/frontend/utils/src/temporal-fns.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ function prettyPrintInterval(
3030
return durations.join(', ');
3131
}
3232

33+
export const dateTimeFormatISO = 'YYYY-MM-DD HH:mm:ss';
34+
3335
export function durationToInterval(duration: string): string {
3436
const { years, months, days, hours, minutes, seconds } = Temporal.Duration.from(duration);
3537

apps/common/src/main/scala/org/lfdecentralizedtrust/splice/config/GcpConfig.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ object GcpBucketConfig {
5252
def inferForTesting: GcpBucketConfig =
5353
infer(
5454
"GCP_DATA_EXPORT_INTEGRATION_TEST_SERVICE_ACCOUNT_CREDENTIALS",
55-
"da-cn-scratchnet",
56-
"da-cn-scratch-acs-store-dumps",
55+
"da-cn-splice",
56+
"da-splice-identity-dumps",
5757
)
5858

5959
def inferForCluster: GcpBucketConfig =

apps/scan/src/main/openapi/scan.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,7 +2660,7 @@ components:
26602660
type: array
26612661
items:
26622662
$ref: "#/components/schemas/BalanceChange"
2663-
transferInstructionDescription:
2663+
description:
26642664
type: string
26652665
transferInstructionReceiver:
26662666
type: string
@@ -2670,7 +2670,7 @@ components:
26702670
type: string
26712671
transfer_kind:
26722672
type: string
2673-
enum: [create_transfer_instruction, transfer_instruction_accept]
2673+
enum: [create_transfer_instruction, transfer_instruction_accept, preapproval_send]
26742674
AbortTransferInstruction:
26752675
type: object
26762676
required:

apps/scan/src/main/protobuf/scan_tx_log.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ enum TransferKind {
120120
TRANSFER_KIND_OTHER = 0;
121121
TRANSFER_KIND_CREATE_TRANSFER_INSTRUCTION = 1;
122122
TRANSFER_KIND_TRANSFER_INSTRUCTION_ACCEPT = 2;
123+
TRANSFER_KIND_PREAPPROVAL_SEND = 3;
123124
}
124125

125126
message TransferTxLogEntry {
@@ -137,7 +138,8 @@ message TransferTxLogEntry {
137138
int64 round = 9;
138139
string amulet_price = 10 [(scalapb.field).type = "scala.math.BigDecimal"];
139140

140-
string transfer_instruction_description = 11;
141+
string description = 11;
142+
141143
string transfer_instruction_receiver = 12;
142144
string transfer_instruction_amount = 13 [(scalapb.field).type = "Option[scala.math.BigDecimal]"];
143145
string transfer_instruction_cid = 14;

0 commit comments

Comments
 (0)