Skip to content

Commit 0881c14

Browse files
authored
Split applicationpb config to a new file and move Status and TxRef to committerpb (hyperledger#204)
#### Type of change - Improvement (improvement to code, performance, etc) - Breaking change #### Description - Split `applicationpb` config to a new file - Move `Status` to `committerpb` - Move `TxRef` to `committerpb` #### Related issues - address hyperledger#44 Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
1 parent 82c203a commit 0881c14

72 files changed

Lines changed: 2652 additions & 2387 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/applicationpb/block_tx.pb.go

Lines changed: 30 additions & 865 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/applicationpb/block_tx.proto

Lines changed: 21 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ option go_package = "github.com/hyperledger/fabric-x-committer/api/applicationpb
1010

1111
package applicationpb;
1212

13+
// Represents a transaction in the blockchain.
1314
message Tx {
14-
// A list of namespaces that define the transaction's scope.
15-
repeated TxNamespace namespaces = 1;
15+
// A list of namespaces that define the transaction's scope.
16+
repeated TxNamespace namespaces = 1;
1617

17-
// A list of endorsements.
18-
// IMPORTANT: This list MUST be the same size as the namespaces list.
19-
// The Endorsement at index i corresponds to the namespace at index i.
20-
repeated Endorsements endorsements = 2;
18+
// A list of endorsements.
19+
// IMPORTANT: This list MUST be the same size as the namespaces list.
20+
// The Endorsement at index i corresponds to the namespace at index i.
21+
repeated Endorsements endorsements = 2;
2122
}
2223

2324
// Represents a namespace within a transaction.
@@ -51,108 +52,28 @@ message Write {
5152
// Endorsements holds all the signatures that correspond to a single namespace
5253
// in the transaction's namespaces list.
5354
message Endorsements {
54-
// The list of individual signatures for the corresponding namespace.
55-
repeated EndorsementWithIdentity endorsements_with_identity = 1;
55+
// The list of individual signatures for the corresponding namespace.
56+
repeated EndorsementWithIdentity endorsements_with_identity = 1;
5657
}
5758

5859
// EndorsementWithIdentity bundles a single signature with the identity of its creator.
5960
message EndorsementWithIdentity {
60-
// The actual cryptographic signature bytes.
61-
bytes endorsement = 1;
61+
// The actual cryptographic signature bytes.
62+
bytes endorsement = 1;
6263

63-
// The identity of the creator who produced the signature, i.e., the endorsement.
64-
Identity identity = 2;
64+
// The identity of the creator who produced the signature, i.e., the endorsement.
65+
Identity identity = 2;
6566
}
6667

6768
message Identity {
68-
// The identifier of the associated membership service provider
69-
string msp_id = 1;
69+
// The identifier of the associated membership service provider
70+
string msp_id = 1;
7071

71-
oneof creator {
72-
// The full raw bytes of the creator's certificate (e.g., an X.509 certificate).
73-
bytes certificate = 2;
72+
oneof creator {
73+
// The full raw bytes of the creator's certificate (e.g., an X.509 certificate).
74+
bytes certificate = 2;
7475

75-
// An identifier for a certificate that is pre-stored or known by the committer.
76-
string certificate_id = 3;
77-
}
78-
}
79-
80-
// Represents a namespace policy.
81-
message NamespacePolicy {
82-
oneof rule {
83-
ThresholdRule threshold_rule = 1;
84-
bytes msp_rule = 2;
85-
}
86-
}
87-
88-
message ThresholdRule {
89-
string scheme = 1; // The scheme for signature verification.
90-
bytes public_key = 2; // The public key for signature verification.
91-
}
92-
93-
message BlockInfo {
94-
uint64 number = 1;
95-
}
96-
97-
message QueryStatus {
98-
repeated string txIDs = 1;
99-
}
100-
101-
message TransactionsStatus {
102-
map<string, StatusWithHeight> status = 1;
103-
}
104-
105-
message StatusWithHeight {
106-
Status code = 1;
107-
uint64 block_number = 2;
108-
uint32 tx_number = 3;
109-
}
110-
111-
message NamespacePolicies {
112-
repeated PolicyItem policies = 1;
113-
}
114-
115-
message PolicyItem {
116-
string namespace = 1;
117-
bytes policy = 2;
118-
uint64 version = 3;
119-
}
120-
121-
message ConfigTransaction {
122-
bytes envelope = 1;
123-
uint64 version = 2;
124-
}
125-
126-
// Status represents the result of transaction validation.
127-
// Except for NOT_VALIDATED, all statuses are recorded in the ledger.
128-
// Some statuses are also stored in the state database which prevent resubmission of the same transaction ID.
129-
enum Status {
130-
// Should never be persisted or reported.
131-
NOT_VALIDATED = 0; // Default. The transaction has not been validated yet.
132-
133-
// Stored in the state database. Prevents submitting a transaction with the same ID.
134-
COMMITTED = 1; // Successfully committed and state updated.
135-
ABORTED_SIGNATURE_INVALID = 2; // Signature is invalid according to the namespace policy.
136-
ABORTED_MVCC_CONFLICT = 3; // Read-write set conflict.
137-
138-
// Cannot be stored in the state database because the TX ID cannot be extracted,
139-
// or the TX ID entry is already occupied.
140-
REJECTED_DUPLICATE_TX_ID = 100; // Transaction with the same ID has already been processed.
141-
MALFORMED_BAD_ENVELOPE = 101; // Cannot unmarshal envelope.
142-
MALFORMED_MISSING_TX_ID = 102; // Envelope is missing transaction ID.
143-
144-
// Stored in the state database. Prevents submitting a transaction with the same ID.
145-
MALFORMED_UNSUPPORTED_ENVELOPE_PAYLOAD = 103; // Unsupported envelope payload type.
146-
MALFORMED_BAD_ENVELOPE_PAYLOAD = 104; // Cannot unmarshal envelope's payload.
147-
MALFORMED_TX_ID_CONFLICT = 105; // Envelope's TX ID does not match the payload's TX ID.
148-
MALFORMED_EMPTY_NAMESPACES = 106; // No namespaces provided.
149-
MALFORMED_DUPLICATE_NAMESPACE = 107; // Duplicate namespace detected.
150-
MALFORMED_NAMESPACE_ID_INVALID = 108; // Invalid namespace identifier.
151-
MALFORMED_BLIND_WRITES_NOT_ALLOWED = 109; // Blind writes are not allowed in a namespace transaction.
152-
MALFORMED_NO_WRITES = 110; // No write operations in the transaction.
153-
MALFORMED_EMPTY_KEY = 111; // Unset key detected.
154-
MALFORMED_DUPLICATE_KEY_IN_READ_WRITE_SET = 112; // Duplicate key in the read-write set.
155-
MALFORMED_MISSING_SIGNATURE = 113; // Number of signatures does not match the number of namespaces.
156-
MALFORMED_NAMESPACE_POLICY_INVALID = 114; // Invalid namespace policy.
157-
MALFORMED_CONFIG_TX_INVALID = 115; // Invalid configuration transaction.
76+
// An identifier for a certificate that is pre-stored or known by the committer.
77+
string certificate_id = 3;
78+
}
15879
}

0 commit comments

Comments
 (0)