Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract rejection_reason.proto from daml_kvutils.proto [KVL-1090] #11235

Merged
merged 1 commit into from
Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//
// Protocol buffer messages used by the participant state key-value utilities
// for implementing a Daml ledger backed by a key-value store.
//
// These messages should only be produced and consumed by the methods in
// `KeyValueCommitting`, `KeyValueConsumption` and `KeyValueSubmission` objects.
//

syntax = "proto3";

package com.daml.ledger.participant.state.kvutils.envelope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ option java_multiple_files = true;
option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Store.Events";

import "com/daml/ledger/configuration/ledger_configuration.proto";
import "com/daml/ledger/participant/state/kvutils/daml_kvutils.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/rejection_reason.proto";

// This message is in it's own file because it would introduce a circular dependency if kept in `configuration.proto`

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//
// Protocol buffer messages used by the participant state key-value utilities
// for implementing a Daml ledger backed by a key-value store.
//
// These messages should only be produced and consumed by the methods in
// `KeyValueCommitting`, `KeyValueConsumption` and `KeyValueSubmission` objects.
//

syntax = "proto3";

package com.daml.ledger.participant.state.kvutils.store.events;
Expand All @@ -17,7 +8,7 @@ option java_package = "com.daml.ledger.participant.state.kvutils.store.events";
option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Store.Events";

import "com/daml/daml_lf_dev/daml_lf.proto";
import "com/daml/ledger/participant/state/kvutils/daml_kvutils.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/rejection_reason.proto";

// A public package upload.
// Daml-LF packages will be deduplicated based on their hashes. Only unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ option java_package = "com.daml.ledger.participant.state.kvutils.store.events";
option java_multiple_files = true;
option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Store.Events";

import "com/daml/ledger/participant/state/kvutils/daml_kvutils.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/rejection_reason.proto";

// An allocation of party name and assignment of a party to a given
// participant.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//
// Protocol buffer messages used by the participant state key-value utilities
// for implementing a Daml ledger backed by a key-value store.
//
// These messages should only be produced and consumed by the methods in
// `KeyValueCommitting`, `KeyValueConsumption` and `KeyValueSubmission` objects.
//

syntax = "proto3";

package com.daml.ledger.participant.state.kvutils;
package com.daml.ledger.participant.state.kvutils.store.events;

option java_package = "com.daml.ledger.participant.state.kvutils";
option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils";
option java_package = "com.daml.ledger.participant.state.kvutils.store.events";
option java_multiple_files = true;
option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Store.Events";

import "google/protobuf/timestamp.proto";
import "com/daml/ledger/configuration/ledger_configuration.proto";
import "com/daml/ledger/participant/state/kvutils/store/state.proto";

// Errors

//
// Used by participant.state.v1 API.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Store.Event
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "com/daml/lf/transaction.proto";
import "com/daml/ledger/participant/state/kvutils/daml_kvutils.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/rejection_reason.proto";

message DamlSubmitterInfo {
repeated string submitters = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Store";

import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "com/daml/ledger/participant/state/kvutils/daml_kvutils.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/configuration.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/configuration_rejection.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/package_upload.proto";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import java.time.{Duration, Instant}
import com.daml.ledger.api.DeduplicationPeriod
import com.daml.ledger.grpc.GrpcStatuses
import com.daml.ledger.offset.Offset
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.transaction.Rejection
import com.daml.ledger.participant.state.kvutils.committer.transaction.Rejection.{
ExternallyInconsistentTransaction,
Expand All @@ -21,9 +20,21 @@ import com.daml.ledger.participant.state.kvutils.store.events.DamlTransactionBli
DivulgenceEntry,
}
import com.daml.ledger.participant.state.kvutils.store.events.{
CausalMonotonicityViolated,
DamlSubmitterInfo,
DamlTransactionBlindingInfo,
DamlTransactionRejectionEntry,
DuplicateKeys,
InconsistentContracts,
InconsistentKeys,
InvalidLedgerTime,
InvalidParticipantState,
MissingInputState,
PartiesNotKnownOnLedger,
RecordTimeOutOfRange,
SubmitterCannotActViaParticipant,
SubmittingPartyNotKnownOnLedger,
ValidationFailure,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlCommandDedupKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ import com.daml.ledger.participant.state.kvutils.Conversions.{
configDedupKey,
configurationStateKey,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.Committer._
import com.daml.ledger.participant.state.kvutils.store.events.{
DamlConfigurationEntry,
DamlConfigurationRejectionEntry,
Duplicate,
GenerationMismatch,
Invalid,
ParticipantNotAuthorized,
TimedOut,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlLogEntry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import java.util.concurrent.Executors

import com.daml.daml_lf_dev.DamlLf
import com.daml.ledger.participant.state.kvutils.Conversions.packageUploadDedupKey
import com.daml.ledger.participant.state.kvutils.DamlKvutils
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.Committer.buildLogEntryWithOptionalRecordTime
import com.daml.ledger.participant.state.kvutils.store.events.PackageUpload.{
DamlPackageUploadEntry,
DamlPackageUploadRejectionEntry,
}
import com.daml.ledger.participant.state.kvutils.store.events.{
Duplicate,
Invalid,
ParticipantNotAuthorized,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlLogEntry,
DamlStateKey,
Expand Down Expand Up @@ -188,7 +191,7 @@ final private[kvutils] class PackageCommitter(
ctx.recordTime,
uploadEntry.getSubmissionId,
uploadEntry.getParticipantId,
_.setInvalidPackage(DamlKvutils.Invalid.newBuilder.setDetails(message)),
_.setInvalidPackage(Invalid.newBuilder.setDetails(message)),
)
} else {
StepContinue(partialResult)
Expand Down Expand Up @@ -253,7 +256,7 @@ final private[kvutils] class PackageCommitter(
ctx.recordTime,
uploadEntry.getSubmissionId,
uploadEntry.getParticipantId,
_.setInvalidPackage(DamlKvutils.Invalid.newBuilder.setDetails(message)),
_.setInvalidPackage(Invalid.newBuilder.setDetails(message)),
)
}
}
Expand Down Expand Up @@ -331,7 +334,7 @@ final private[kvutils] class PackageCommitter(
ctx.recordTime,
uploadEntry.getSubmissionId,
uploadEntry.getParticipantId,
_.setInvalidPackage(DamlKvutils.Invalid.newBuilder.setDetails(message)),
_.setInvalidPackage(Invalid.newBuilder.setDetails(message)),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
package com.daml.ledger.participant.state.kvutils.committer

import com.daml.ledger.participant.state.kvutils.Conversions.partyAllocationDedupKey
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.Committer.buildLogEntryWithOptionalRecordTime
import com.daml.ledger.participant.state.kvutils.store.events.{
AlreadyExists,
DamlPartyAllocationEntry,
DamlPartyAllocationRejectionEntry,
Duplicate,
Invalid,
ParticipantNotAuthorized,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlLogEntry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ import java.time.Instant

import com.daml.ledger.configuration.Configuration
import com.daml.ledger.participant.state.kvutils.Conversions._
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.Committer._
import com.daml.ledger.participant.state.kvutils.committer._
import com.daml.ledger.participant.state.kvutils.committer.transaction.validation.{
LedgerTimeValidator,
ModelConformanceValidator,
TransactionConsistencyValidator,
}
import com.daml.ledger.participant.state.kvutils.store.events.DamlTransactionRejectionEntry
import com.daml.ledger.participant.state.kvutils.store.events.{
DamlTransactionRejectionEntry,
Duplicate,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlCommandDedupValue,
DamlContractKeyState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import java.time.{Duration, Instant}
import com.daml.ledger.api.DeduplicationPeriod
import com.daml.ledger.configuration.LedgerTimeModel
import com.daml.ledger.participant.state.kvutils.Conversions._
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.transaction.Rejection
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.ledger.participant.state.kvutils.store.events.DamlTransactionBlindingInfo.{
Expand All @@ -19,6 +18,13 @@ import com.daml.ledger.participant.state.kvutils.store.events.{
DamlSubmitterInfo,
DamlTransactionBlindingInfo,
DamlTransactionRejectionEntry,
Disputed,
Duplicate,
Inconsistent,
InvalidLedgerTime,
PartyNotKnownOnLedger,
ResourcesExhausted,
SubmitterCannotActViaParticipant,
}
import com.daml.ledger.participant.state.v2.Update.CommandRejected
import com.daml.lf.crypto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import java.time.{Instant, ZoneOffset, ZonedDateTime}

import com.codahale.metrics.MetricRegistry
import com.daml.daml_lf_dev.DamlLf
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.TestHelpers.{createCommitContext, lfTuple}
import com.daml.ledger.participant.state.kvutils.committer.transaction.{
DamlTransactionEntrySummary,
Rejections,
}
import com.daml.ledger.participant.state.kvutils.committer.{StepContinue, StepStop}
import com.daml.ledger.participant.state.kvutils.store.events.{
CausalMonotonicityViolated,
DamlSubmitterInfo,
DamlTransactionEntry,
DamlTransactionRejectionEntry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
package com.daml.ledger.validator.preexecution

import com.daml.ledger.participant.state.kvutils.KeyValueCommitting.PreExecutionResult
import com.daml.ledger.participant.state.kvutils.store.events.DamlPartyAllocationRejectionEntry
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.store.events.{
DamlPartyAllocationRejectionEntry,
Duplicate,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlContractState,
DamlLogEntry,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.{DamlKvutils, Raw}
import com.daml.ledger.validator.StateKeySerializationStrategy
import com.daml.ledger.validator.TestHelper.{
aLogEntry,
Expand Down Expand Up @@ -114,7 +117,7 @@ object RawPreExecutingCommitStrategySpec {
private val aRejectionLogEntry = DamlLogEntry.newBuilder
.setPartyAllocationRejectionEntry(
DamlPartyAllocationRejectionEntry.newBuilder
.setDuplicateSubmission(DamlKvutils.Duplicate.getDefaultInstance)
.setDuplicateSubmission(Duplicate.getDefaultInstance)
.setParticipantId("a participant ID")
.setSubmissionId("a submission")
)
Expand Down