Skip to content

Commit 99eece8

Browse files
committed
remove redundant version checks
[ci] Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
1 parent 08ea756 commit 99eece8

File tree

18 files changed

+24
-98
lines changed

18 files changed

+24
-98
lines changed

apps/common/src/main/openapi/common-internal.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,9 @@ components:
369369
370370
FeatureSupportResponse:
371371
type: object
372-
required:
373-
- no_holding_fees_on_transfers
372+
required: []
374373
properties:
375-
no_holding_fees_on_transfers:
374+
# Guardrails seems to be unhappy when there are no properties so we add a dummy property.
375+
# Remove once you add an actual property.
376+
dummy:
376377
type: boolean

apps/common/src/main/scala/org/lfdecentralizedtrust/splice/environment/PackageVersionSupport.scala

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,6 @@ trait PackageVersionSupport extends NamedLogging {
8181
)
8282
}
8383

84-
// TODO(#2257): remove this flag once the holding fees change has been rolled out to MainNet
85-
def noHoldingFeesOnTransfers(dsoParty: PartyId, now: CantonTimestamp)(implicit
86-
tc: TraceContext
87-
): Future[FeatureSupport] = {
88-
isDarSupported(
89-
Seq(dsoParty),
90-
PackageIdResolver.Package.SpliceAmulet,
91-
now,
92-
DarResources.amulet,
93-
// This is when the AmuletRules transfer choice was changed to not charge holding fees
94-
DarResources.amulet_0_1_14,
95-
)
96-
}
97-
9884
def supportsExpectedDsoParty(parties: Seq[PartyId], now: CantonTimestamp)(implicit
9985
tc: TraceContext
10086
): Future[FeatureSupport] = {

apps/common/src/main/scala/org/lfdecentralizedtrust/splice/http/HttpFeatureSupportHandler.scala

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@
33

44
package org.lfdecentralizedtrust.splice.http
55

6-
import com.digitalasset.canton.data.CantonTimestamp
76
import com.digitalasset.canton.logging.NamedLogging
87
import com.digitalasset.canton.topology.PartyId
98
import com.digitalasset.canton.tracing.{Spanning, TraceContext}
109
import io.opentelemetry.api.trace.Tracer
1110
import org.lfdecentralizedtrust.splice.environment.PackageVersionSupport
1211
import org.lfdecentralizedtrust.splice.http.v0.definitions.FeatureSupportResponse
1312

13+
import scala.annotation.nowarn
1414
import scala.concurrent.{ExecutionContext, Future}
1515

16+
// silence unused warnings to avoid refactoring the code once we have a non-empty set of features again.
17+
@nowarn("cat=unused")
1618
trait HttpFeatureSupportHandler extends Spanning with NamedLogging {
1719

1820
protected val packageVersionSupport: PackageVersionSupport
1921
protected val workflowId: String
2022
protected implicit val tracer: Tracer
2123

24+
2225
def readFeatureSupport(
2326
dsoParty: PartyId
2427
)(implicit
@@ -27,15 +30,7 @@ trait HttpFeatureSupportHandler extends Spanning with NamedLogging {
2730
tracer: Tracer,
2831
): Future[FeatureSupportResponse] = {
2932
withSpan(s"$workflowId.featureSupport") { _ => _ =>
30-
for {
31-
noHoldingFeesOnTransfers <- packageVersionSupport
32-
.noHoldingFeesOnTransfers(
33-
dsoParty,
34-
CantonTimestamp.now(),
35-
)
36-
} yield FeatureSupportResponse(
37-
noHoldingFeesOnTransfers = noHoldingFeesOnTransfers.supported
38-
)
33+
Future.successful(FeatureSupportResponse())
3934
}
4035

4136
}

apps/scan/frontend/src/__tests__/mocks/handlers/scan-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const buildScanMock = (baseScanUrl: string): RestHandler[] => {
2828
const scanUrl = `${baseScanUrl}/api/scan`;
2929
return [
3030
rest.get(`${scanUrl}/v0/feature-support`, (_, res, ctx) => {
31-
return res(ctx.json<FeatureSupportResponse>({ no_holding_fees_on_transfers: false }));
31+
return res(ctx.json<FeatureSupportResponse>({ }));
3232
}),
3333

3434
dsoInfoHandler(scanUrl),

apps/scan/frontend/src/hooks/useFeatureSupport.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export const useFeatureSupport = (): UseQueryResult<{
1212
queryFn: async () => {
1313
const result = await scanClient.featureSupport();
1414
return {
15-
noHoldingFeesOnTransfers: result.no_holding_fees_on_transfers,
1615
};
1716
},
1817
});

apps/scan/src/main/scala/org/lfdecentralizedtrust/splice/scan/ScanApp.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ class ScanApp(
323323
store,
324324
acsSnapshotStore,
325325
config.spliceInstanceNames,
326-
packageVersionSupport,
327-
clock,
328326
loggerFactory,
329327
)
330328

apps/scan/src/main/scala/org/lfdecentralizedtrust/splice/scan/admin/http/HttpTokenStandardMetadataHandler.scala

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ package org.lfdecentralizedtrust.splice.scan.admin.http
66
import cats.data.OptionT
77
import com.digitalasset.canton.data.CantonTimestamp
88
import com.digitalasset.canton.logging.{NamedLoggerFactory, NamedLogging}
9-
import com.digitalasset.canton.time.Clock
109
import com.digitalasset.canton.tracing.{Spanning, TraceContext}
1110
import org.lfdecentralizedtrust.splice.config.SpliceInstanceNamesConfig
12-
import org.lfdecentralizedtrust.splice.environment.PackageVersionSupport
1311
import org.lfdecentralizedtrust.splice.scan.admin.http.HttpTokenStandardMetadataHandler.TotalSupply
1412
import org.lfdecentralizedtrust.tokenstandard.metadata.v1
1513
import org.lfdecentralizedtrust.splice.scan.store.{AcsSnapshotStore, ScanStore}
@@ -21,8 +19,6 @@ class HttpTokenStandardMetadataHandler(
2119
store: ScanStore,
2220
acsSnapshotStore: AcsSnapshotStore,
2321
spliceInstanceNames: SpliceInstanceNamesConfig,
24-
packageVersionSupport: PackageVersionSupport,
25-
clock: Clock,
2622
protected val loggerFactory: NamedLoggerFactory,
2723
)(implicit ec: ExecutionContext)
2824
extends v1.Handler[TraceContext]
@@ -67,12 +63,6 @@ class HttpTokenStandardMetadataHandler(
6763
}
6864
}
6965

70-
private def lookupTotalSupplyByLatestRound()(implicit ec: ExecutionContext, tc: TraceContext) =
71-
for {
72-
(latestRoundNr, effectiveAt) <- OptionT(store.lookupRoundOfLatestData())
73-
totalSupply <- OptionT(store.getTotalAmuletBalance(latestRoundNr))
74-
} yield TotalSupply(amount = totalSupply, asOfTimestamp = effectiveAt)
75-
7666
private def lookupTotalSupplyByLatestAcsSnapshot()(implicit tc: TraceContext) = {
7767
for {
7868
latestSnapshot <- OptionT(
@@ -91,17 +81,7 @@ class HttpTokenStandardMetadataHandler(
9181

9282
private def lookupTotalSupply()(implicit tc: TraceContext) = {
9383
for {
94-
noHoldingFeesOnTransfers <- packageVersionSupport.noHoldingFeesOnTransfers(
95-
store.key.dsoParty,
96-
clock.now,
97-
)
98-
deductHoldingFees = !noHoldingFeesOnTransfers.supported
99-
result <-
100-
if (deductHoldingFees) {
101-
lookupTotalSupplyByLatestRound().value
102-
} else {
103-
lookupTotalSupplyByLatestAcsSnapshot().orElse(lookupTotalSupplyByLatestRound()).value
104-
}
84+
result <- lookupTotalSupplyByLatestAcsSnapshot().value
10585
} yield result
10686
}
10787

apps/sv/frontend/src/__tests__/mocks/handlers/sv-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export const buildSvMock = (svUrl: string): RestHandler[] => [
185185
}),
186186

187187
rest.get(`${svUrl}/v0/admin/feature-support`, (_, res, ctx) => {
188-
return res(ctx.json<FeatureSupportResponse>({ no_holding_fees_on_transfers: false }));
188+
return res(ctx.json<FeatureSupportResponse>({ }));
189189
}),
190190

191191
validatorLicensesHandler(svUrl),

apps/sv/frontend/src/contexts/SvContext.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export const useFeatureSupport = (): UseQueryResult<{
3838
queryFn: async () => {
3939
const resp = await featureSupport();
4040
return {
41-
noHoldingFeesOnTransfers: resp.no_holding_fees_on_transfers,
4241
};
4342
},
4443
});

apps/wallet/frontend/src/hooks/useFeatureSupport.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const useFeatureSupport = (): UseQueryResult<WalletFeatureSupport> => {
1818
return {
1919
tokenStandard: result.token_standard,
2020
transferPreapprovalDescription: result.transfer_preapproval_description,
21-
noHoldingFeesOnTransfers: result.no_holding_fees_on_transfers,
2221
};
2322
},
2423
});

0 commit comments

Comments
 (0)