LibMobileCoin v1.2.0 Release Candidate (#24)

* shared_secret FFI getter
* TxOutContext FFI getter
* root_entropy FFI getter
* Disable LTO setting
This commit is contained in:
Adam Mork 2022-05-31 15:17:39 -07:00 committed by GitHub
parent 22ded4a626
commit 499dd3f093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 1675 additions and 185 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
#ifndef ATTEST_H_
#define ATTEST_H_

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
#ifndef COMMON_H_
#define COMMON_H_

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
#ifndef CRYPTO_H_
#define CRYPTO_H_

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
#ifndef ENCODINGS_H_
#define ENCODINGS_H_

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
#ifndef FOG_H_
#define FOG_H_

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
#ifndef KEYS_H_
#define KEYS_H_
@ -54,6 +54,18 @@ bool mc_account_key_get_subaddress_private_keys(
)
MC_ATTRIBUTE_NONNULL(1, 2, 4, 5);
/// # Preconditions
///
/// * `root_entropy` - must be 32 bytes in length.
/// * `out_view_private_key` - length must be >= 32.
/// * `out_spend_private_key` - length must be >= 32.
bool mc_account_private_keys_from_root_entropy(
const McBuffer* MC_NONNULL root_entropy,
McMutableBuffer* MC_NONNULL out_view_private_key,
McMutableBuffer* MC_NONNULL out_spend_private_key
)
MC_ATTRIBUTE_NONNULL(1, 2, 3);
/// # Preconditions
///
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
#ifndef LIBMOBILECOIN_H_
#define LIBMOBILECOIN_H_

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
#ifndef TRANSACTION_H_
#define TRANSACTION_H_
@ -17,6 +17,12 @@ extern "C" {
typedef struct {
uint64_t masked_value;
const McBuffer* MC_NONNULL masked_token_id;
} McTxOutMaskedAmount;
typedef struct {
uint64_t value;
uint64_t token_id;
} McTxOutAmount;
typedef struct _McTransactionBuilderRing McTransactionBuilderRing;
@ -25,6 +31,23 @@ typedef struct _McTxOutMemoBuilder McTxOutMemoBuilder;
/* ==== TxOut ==== */
/// # Preconditions
///
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
/// * `tx_out_public_key` - must be a valid 32-byte Ristretto-format scalar.
///
/// # Errors
///
/// * `LibMcError::InvalidInput`
/// * `LibMcError::TransactionCrypto`
bool mc_tx_out_get_shared_secret(
const McBuffer* MC_NONNULL view_private_key,
const McBuffer* MC_NONNULL tx_out_public_key,
McMutableBuffer* MC_NONNULL out_shared_secret,
McError* MC_NULLABLE * MC_NULLABLE out_error
)
MC_ATTRIBUTE_NONNULL(1, 2, 3);
/// # Preconditions
///
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
@ -34,7 +57,7 @@ typedef struct _McTxOutMemoBuilder McTxOutMemoBuilder;
/// * `LibMcError::InvalidInput`
/// * `LibMcError::TransactionCrypto`
bool mc_tx_out_reconstruct_commitment(
const McTxOutAmount* MC_NONNULL tx_out_amount,
const McTxOutMaskedAmount* MC_NONNULL tx_out_masked_amount,
const McBuffer* MC_NONNULL tx_out_public_key,
const McBuffer* MC_NONNULL view_private_key,
McMutableBuffer* MC_NONNULL out_commitment,
@ -42,17 +65,6 @@ bool mc_tx_out_reconstruct_commitment(
)
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
/// # Preconditions
///
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
bool mc_tx_out_matches_any_subaddress(
const McTxOutAmount* MC_NONNULL tx_out_amount,
const McBuffer* MC_NONNULL tx_out_public_key,
const McBuffer* MC_NONNULL view_private_key,
bool* MC_NONNULL out_matches
)
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
/// # Preconditions
///
/// * `tx_out_commitment` - must be a valid CompressedCommitment
@ -105,11 +117,11 @@ MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
///
/// * `LibMcError::InvalidInput`
/// * `LibMcError::TransactionCrypto`
bool mc_tx_out_get_value(
const McTxOutAmount* MC_NONNULL tx_out_amount,
bool mc_tx_out_get_amount(
const McTxOutMaskedAmount* MC_NONNULL tx_out_masked_amount,
const McBuffer* MC_NONNULL tx_out_public_key,
const McBuffer* MC_NONNULL view_private_key,
uint64_t* MC_NONNULL out_value,
McTxOutAmount* MC_NONNULL out_amount,
McError* MC_NULLABLE * MC_NULLABLE out_error
)
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
@ -169,11 +181,13 @@ MC_ATTRIBUTE_NONNULL(1, 2, 3);
McTransactionBuilder* MC_NULLABLE mc_transaction_builder_create(
uint64_t fee,
uint64_t token_id,
uint64_t tombstone_block,
const McFogResolver* MC_NULLABLE fog_resolver,
McTxOutMemoBuilder* MC_NONNULL memo_builder,
uint32_t block_version
);
)
MC_ATTRIBUTE_NONNULL(5);
void mc_transaction_builder_free(
McTransactionBuilder* MC_NULLABLE transaction_builder
@ -216,9 +230,10 @@ McData* MC_NULLABLE mc_transaction_builder_add_output(
const McPublicAddress* MC_NONNULL recipient_address,
McRngCallback* MC_NULLABLE rng_callback,
McMutableBuffer* MC_NONNULL out_tx_out_confirmation_number,
McMutableBuffer* MC_NONNULL out_tx_out_shared_secret,
McError* MC_NULLABLE * MC_NULLABLE out_error
)
MC_ATTRIBUTE_NONNULL(1, 3, 6);
MC_ATTRIBUTE_NONNULL(1, 3, 5, 6);
/// # Preconditions
///
@ -237,32 +252,11 @@ McData* MC_NULLABLE mc_transaction_builder_add_change_output(
uint64_t amount,
McRngCallback* MC_NULLABLE rng_callback,
McMutableBuffer* MC_NONNULL out_tx_out_confirmation_number,
McMutableBuffer* MC_NONNULL out_tx_out_shared_secret,
McError* MC_NULLABLE * MC_NULLABLE out_error
)
MC_ATTRIBUTE_NONNULL(1, 2, 4, 6);
/// # Preconditions
///
/// * `transaction_builder` - must not have been previously consumed by a call to `build`.
/// * `recipient_address` - must be a valid `PublicAddress`.
/// * `fog_hint_address` - must be a valid `PublicAddress` with `fog_info`.
/// * `out_tx_out_confirmation_number` - length must be >= 32.
///
/// # Errors
///
/// * `LibMcError::AttestationVerification`
/// * `LibMcError::InvalidInput`
McData* MC_NULLABLE mc_transaction_builder_add_output_with_fog_hint_address(
McTransactionBuilder* MC_NONNULL transaction_builder,
uint64_t amount,
const McPublicAddress* MC_NONNULL recipient_address,
const McPublicAddress* MC_NONNULL fog_hint_address,
McRngCallback* MC_NULLABLE rng_callback,
McMutableBuffer* MC_NONNULL out_tx_out_confirmation_number,
McError* MC_NULLABLE * MC_NULLABLE out_error
)
MC_ATTRIBUTE_NONNULL(1, 3, 4, 5, 7);
/// # Preconditions
///
/// * `transaction_builder` - must not have been previously consumed by a call to `build`.
@ -306,9 +300,9 @@ void mc_memo_builder_free(
/// # Preconditions
///
/// * `sender_memo_data` - must be 64 bytes
/// * `sender_memo_data` - must be 64 bytes
/// * `sender_public_address` - must be a valid `PublicAddress`.
/// * `receiving_subaddress_view_private_key` - must be a valid
/// * `receiving_subaddress_view_private_key` - must be a valid
/// 32-byte Ristretto-format scalar.
/// * `tx_out_public_key` - must be a valid 32-byte Ristretto-format scalar.
///
@ -328,7 +322,7 @@ MC_ATTRIBUTE_NONNULL(1, 2, 3, 4, 5);
/// # Preconditions
///
/// * `sender_account_key` - must be a valid account key
/// * `recipient_subaddress_view_public_key` - must be a valid
/// * `recipient_subaddress_view_public_key` - must be a valid
/// 32-byte Ristretto-format scalar.
/// * `tx_out_public_key` - must be a valid 32-byte Ristretto-format scalar.
/// * `out_memo_data` - length must be >= 64.
@ -446,9 +440,9 @@ MC_ATTRIBUTE_NONNULL(1, 2);
/// # Preconditions
///
/// * `sender_with_payment_request_memo_data` - must be 64 bytes
/// * `sender_with_payment_request_memo_data` - must be 64 bytes
/// * `sender_public_address` - must be a valid `PublicAddress`.
/// * `receiving_subaddress_view_private_key` - must be a valid
/// * `receiving_subaddress_view_private_key` - must be a valid
/// 32-byte Ristretto-format scalar.
/// * `tx_out_public_key` - must be a valid 32-byte Ristretto-format scalar.
///
@ -468,7 +462,7 @@ MC_ATTRIBUTE_NONNULL(1, 2, 3, 4, 5);
/// # Preconditions
///
/// * `sender_account_key` - must be a valid account key
/// * `recipient_subaddress_view_public_key` - must be a valid
/// * `recipient_subaddress_view_public_key` - must be a valid
/// 32-byte Ristretto-format scalar.
/// * `tx_out_public_key` - must be a valid 32-byte Ristretto-format scalar.
/// * `out_memo_data` - length must be >= 64.

View File

@ -38,6 +38,7 @@ COPY Vendor/mobilecoin/attest/api/proto/attest.proto \
Vendor/mobilecoin/attest/api/proto/
COPY Vendor/mobilecoin/consensus/api/proto/consensus_client.proto \
Vendor/mobilecoin/consensus/api/proto/consensus_common.proto \
Vendor/mobilecoin/consensus/api/proto/consensus_config.proto \
Vendor/mobilecoin/consensus/api/proto/
COPY Vendor/mobilecoin/fog/report/api/proto/report.proto \
Vendor/mobilecoin/fog/report/api/proto/
@ -65,6 +66,7 @@ RUN protoc \
attest.proto \
consensus_client.proto \
consensus_common.proto \
consensus_config.proto \
report.proto \
fog_common.proto \
kex_rng.proto \

View File

@ -3,7 +3,7 @@ Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.name = "LibMobileCoin"
s.version = "1.2.0-pre12"
s.version = "1.2.0-pre17"
s.summary = "A library for communicating with MobileCoin network"
s.author = "MobileCoin"
@ -69,7 +69,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"GCC_OPTIMIZATION_LEVEL" => "z",
"LLVM_LTO" => "YES",
# "LLVM_LTO" => "YES",
# Rust bitcode is not verified to be compatible with Apple Xcode's LLVM bitcode,
# so this is disabled to be on the safe side.
"ENABLE_BITCODE" => "YES",

View File

@ -70,6 +70,9 @@ lint-locally: lint-locally-podspec
.PHONY: publish
publish: tag-release publish-podspec
.PHONY: publish-hotfix
publish-hotfix: tag-hotfix publish-podspec
.PHONY: push-generated
push-generated:
git add Artifacts/*
@ -89,6 +92,12 @@ tag-release:
git tag "v$$VERSION" && \
git push git@github.com:mobilecoinofficial/libmobilecoin-ios-artifacts.git "refs/tags/v$$VERSION"
.PHONY: tag-hotfix
tag-hotfix:
VERSION="$$(bundle exec pod ipc spec LibMobileCoin.podspec | jq -r '.version')" && \
git tag "v$$VERSION" && \
git push git@github.com:mobilecoinofficial/libmobilecoin-ios-artifacts.git "refs/tags/v$$VERSION"
# LibMobileCoin pod
.PHONY: lint-locally-podspec

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
//// This file defines the API to allow for a client to conduct an authenticated
//// key exchange using a derivative of the noise protocol

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
// Blockchain-related data types.
@ -127,6 +127,12 @@ public struct Blockchain_BlockContents {
/// Outputs created in this block.
public var outputs: [External_TxOut] = []
//// mint-config transactions in this block coupled with data used to validate them.
public var validatedMintConfigTxs: [External_ValidatedMintConfigTx] = []
//// Mint transactions in this block.
public var mintTxs: [External_MintTx] = []
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
@ -424,6 +430,8 @@ extension Blockchain_BlockContents: SwiftProtobuf.Message, SwiftProtobuf._Messag
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "key_images"),
2: .same(proto: "outputs"),
3: .standard(proto: "validated_mint_config_txs"),
4: .standard(proto: "mint_txs"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -434,6 +442,8 @@ extension Blockchain_BlockContents: SwiftProtobuf.Message, SwiftProtobuf._Messag
switch fieldNumber {
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.keyImages) }()
case 2: try { try decoder.decodeRepeatedMessageField(value: &self.outputs) }()
case 3: try { try decoder.decodeRepeatedMessageField(value: &self.validatedMintConfigTxs) }()
case 4: try { try decoder.decodeRepeatedMessageField(value: &self.mintTxs) }()
default: break
}
}
@ -446,12 +456,20 @@ extension Blockchain_BlockContents: SwiftProtobuf.Message, SwiftProtobuf._Messag
if !self.outputs.isEmpty {
try visitor.visitRepeatedMessageField(value: self.outputs, fieldNumber: 2)
}
if !self.validatedMintConfigTxs.isEmpty {
try visitor.visitRepeatedMessageField(value: self.validatedMintConfigTxs, fieldNumber: 3)
}
if !self.mintTxs.isEmpty {
try visitor.visitRepeatedMessageField(value: self.mintTxs, fieldNumber: 4)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Blockchain_BlockContents, rhs: Blockchain_BlockContents) -> Bool {
if lhs.keyImages != rhs.keyImages {return false}
if lhs.outputs != rhs.outputs {return false}
if lhs.validatedMintConfigTxs != rhs.validatedMintConfigTxs {return false}
if lhs.mintTxs != rhs.mintTxs {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}

View File

@ -34,6 +34,21 @@ public protocol ConsensusClient_ConsensusClientAPIClientProtocol: GRPCClient {
_ request: Attest_Message,
callOptions: CallOptions?
) -> UnaryCall<Attest_Message, ConsensusCommon_ProposeTxResponse>
func proposeMintConfigTx(
_ request: External_MintConfigTx,
callOptions: CallOptions?
) -> UnaryCall<External_MintConfigTx, ConsensusClient_ProposeMintConfigTxResponse>
func proposeMintTx(
_ request: External_MintTx,
callOptions: CallOptions?
) -> UnaryCall<External_MintTx, ConsensusClient_ProposeMintTxResponse>
func getNodeConfig(
_ request: SwiftProtobuf.Google_Protobuf_Empty,
callOptions: CallOptions?
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, ConsensusConfig_ConsensusNodeConfig>
}
extension ConsensusClient_ConsensusClientAPIClientProtocol {
@ -59,12 +74,75 @@ extension ConsensusClient_ConsensusClientAPIClientProtocol {
interceptors: self.interceptors?.makeClientTxProposeInterceptors() ?? []
)
}
//// Propose a new MintConfigTx.
///
/// - Parameters:
/// - request: Request to send to ProposeMintConfigTx.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func proposeMintConfigTx(
_ request: External_MintConfigTx,
callOptions: CallOptions? = nil
) -> UnaryCall<External_MintConfigTx, ConsensusClient_ProposeMintConfigTxResponse> {
return self.makeUnaryCall(
path: "/consensus_client.ConsensusClientAPI/ProposeMintConfigTx",
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeProposeMintConfigTxInterceptors() ?? []
)
}
//// Propose a new MintTx.
///
/// - Parameters:
/// - request: Request to send to ProposeMintTx.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func proposeMintTx(
_ request: External_MintTx,
callOptions: CallOptions? = nil
) -> UnaryCall<External_MintTx, ConsensusClient_ProposeMintTxResponse> {
return self.makeUnaryCall(
path: "/consensus_client.ConsensusClientAPI/ProposeMintTx",
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeProposeMintTxInterceptors() ?? []
)
}
//// Get current node configuration.
///
/// - Parameters:
/// - request: Request to send to GetNodeConfig.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func getNodeConfig(
_ request: SwiftProtobuf.Google_Protobuf_Empty,
callOptions: CallOptions? = nil
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, ConsensusConfig_ConsensusNodeConfig> {
return self.makeUnaryCall(
path: "/consensus_client.ConsensusClientAPI/GetNodeConfig",
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetNodeConfigInterceptors() ?? []
)
}
}
public protocol ConsensusClient_ConsensusClientAPIClientInterceptorFactoryProtocol {
/// - Returns: Interceptors to use when invoking 'clientTxPropose'.
func makeClientTxProposeInterceptors() -> [ClientInterceptor<Attest_Message, ConsensusCommon_ProposeTxResponse>]
/// - Returns: Interceptors to use when invoking 'proposeMintConfigTx'.
func makeProposeMintConfigTxInterceptors() -> [ClientInterceptor<External_MintConfigTx, ConsensusClient_ProposeMintConfigTxResponse>]
/// - Returns: Interceptors to use when invoking 'proposeMintTx'.
func makeProposeMintTxInterceptors() -> [ClientInterceptor<External_MintTx, ConsensusClient_ProposeMintTxResponse>]
/// - Returns: Interceptors to use when invoking 'getNodeConfig'.
func makeGetNodeConfigInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, ConsensusConfig_ConsensusNodeConfig>]
}
public final class ConsensusClient_ConsensusClientAPIClient: ConsensusClient_ConsensusClientAPIClientProtocol {

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
// Consensus service client-facing data types and service descriptors.
@ -23,3 +23,342 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
typealias Version = _2
}
public enum ConsensusClient_MintValidationResultCode: SwiftProtobuf.Enum {
public typealias RawValue = Int
case ok // = 0
case invalidBlockVersion // = 1
case invalidTokenID // = 2
case invalidNonceLength // = 3
case invalidSignerSet // = 4
case invalidSignature // = 5
case tombstoneBlockExceeded // = 6
case tombstoneBlockTooFar // = 7
case unknown // = 8
case amountExceedsMintLimit // = 9
case noGovernors // = 10
case nonceAlreadyUsed // = 11
case noMatchingMintConfig // = 12
case UNRECOGNIZED(Int)
public init() {
self = .ok
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .ok
case 1: self = .invalidBlockVersion
case 2: self = .invalidTokenID
case 3: self = .invalidNonceLength
case 4: self = .invalidSignerSet
case 5: self = .invalidSignature
case 6: self = .tombstoneBlockExceeded
case 7: self = .tombstoneBlockTooFar
case 8: self = .unknown
case 9: self = .amountExceedsMintLimit
case 10: self = .noGovernors
case 11: self = .nonceAlreadyUsed
case 12: self = .noMatchingMintConfig
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .ok: return 0
case .invalidBlockVersion: return 1
case .invalidTokenID: return 2
case .invalidNonceLength: return 3
case .invalidSignerSet: return 4
case .invalidSignature: return 5
case .tombstoneBlockExceeded: return 6
case .tombstoneBlockTooFar: return 7
case .unknown: return 8
case .amountExceedsMintLimit: return 9
case .noGovernors: return 10
case .nonceAlreadyUsed: return 11
case .noMatchingMintConfig: return 12
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension ConsensusClient_MintValidationResultCode: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [ConsensusClient_MintValidationResultCode] = [
.ok,
.invalidBlockVersion,
.invalidTokenID,
.invalidNonceLength,
.invalidSignerSet,
.invalidSignature,
.tombstoneBlockExceeded,
.tombstoneBlockTooFar,
.unknown,
.amountExceedsMintLimit,
.noGovernors,
.nonceAlreadyUsed,
.noMatchingMintConfig,
]
}
#endif // swift(>=4.2)
public struct ConsensusClient_MintValidationResult {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
//// The actual result code.
public var code: ConsensusClient_MintValidationResultCode = .ok
//// Block version, if result is InvalidBlockVersion.
public var blockVersion: UInt32 = 0
//// Token ID, if result is InvalidTokenId or NoGovernors.
public var tokenID: UInt64 = 0
//// Nonce length, if result is InvalidNonceLength
public var nonceLength: UInt64 = 0
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
}
//// Response from ProposeMintConfigTx RPC call.
public struct ConsensusClient_ProposeMintConfigTxResponse {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
//// Result.
public var result: ConsensusClient_MintValidationResult {
get {return _result ?? ConsensusClient_MintValidationResult()}
set {_result = newValue}
}
/// Returns true if `result` has been explicitly set.
public var hasResult: Bool {return self._result != nil}
/// Clears the value of `result`. Subsequent reads from it will return its default value.
public mutating func clearResult() {self._result = nil}
//// The number of blocks in the ledger at the time the request was received.
public var blockCount: UInt64 = 0
//// The block version which is in effect right now
public var blockVersion: UInt32 = 0
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
fileprivate var _result: ConsensusClient_MintValidationResult? = nil
}
//// Response from ProposeMintTx RPC call.
public struct ConsensusClient_ProposeMintTxResponse {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
//// Result.
public var result: ConsensusClient_MintValidationResult {
get {return _result ?? ConsensusClient_MintValidationResult()}
set {_result = newValue}
}
/// Returns true if `result` has been explicitly set.
public var hasResult: Bool {return self._result != nil}
/// Clears the value of `result`. Subsequent reads from it will return its default value.
public mutating func clearResult() {self._result = nil}
//// The number of blocks in the ledger at the time the request was received.
public var blockCount: UInt64 = 0
//// The block version which is in effect right now
public var blockVersion: UInt32 = 0
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
fileprivate var _result: ConsensusClient_MintValidationResult? = nil
}
#if swift(>=5.5) && canImport(_Concurrency)
extension ConsensusClient_MintValidationResultCode: @unchecked Sendable {}
extension ConsensusClient_MintValidationResult: @unchecked Sendable {}
extension ConsensusClient_ProposeMintConfigTxResponse: @unchecked Sendable {}
extension ConsensusClient_ProposeMintTxResponse: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "consensus_client"
extension ConsensusClient_MintValidationResultCode: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "Ok"),
1: .same(proto: "InvalidBlockVersion"),
2: .same(proto: "InvalidTokenId"),
3: .same(proto: "InvalidNonceLength"),
4: .same(proto: "InvalidSignerSet"),
5: .same(proto: "InvalidSignature"),
6: .same(proto: "TombstoneBlockExceeded"),
7: .same(proto: "TombstoneBlockTooFar"),
8: .same(proto: "Unknown"),
9: .same(proto: "AmountExceedsMintLimit"),
10: .same(proto: "NoGovernors"),
11: .same(proto: "NonceAlreadyUsed"),
12: .same(proto: "NoMatchingMintConfig"),
]
}
extension ConsensusClient_MintValidationResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".MintValidationResult"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "code"),
2: .standard(proto: "block_version"),
3: .standard(proto: "token_id"),
4: .standard(proto: "nonce_length"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularEnumField(value: &self.code) }()
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.blockVersion) }()
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.tokenID) }()
case 4: try { try decoder.decodeSingularUInt64Field(value: &self.nonceLength) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.code != .ok {
try visitor.visitSingularEnumField(value: self.code, fieldNumber: 1)
}
if self.blockVersion != 0 {
try visitor.visitSingularUInt32Field(value: self.blockVersion, fieldNumber: 2)
}
if self.tokenID != 0 {
try visitor.visitSingularUInt64Field(value: self.tokenID, fieldNumber: 3)
}
if self.nonceLength != 0 {
try visitor.visitSingularUInt64Field(value: self.nonceLength, fieldNumber: 4)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: ConsensusClient_MintValidationResult, rhs: ConsensusClient_MintValidationResult) -> Bool {
if lhs.code != rhs.code {return false}
if lhs.blockVersion != rhs.blockVersion {return false}
if lhs.tokenID != rhs.tokenID {return false}
if lhs.nonceLength != rhs.nonceLength {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension ConsensusClient_ProposeMintConfigTxResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".ProposeMintConfigTxResponse"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "result"),
2: .standard(proto: "block_count"),
3: .standard(proto: "block_version"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularMessageField(value: &self._result) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.blockCount) }()
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.blockVersion) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._result {
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
} }()
if self.blockCount != 0 {
try visitor.visitSingularUInt64Field(value: self.blockCount, fieldNumber: 2)
}
if self.blockVersion != 0 {
try visitor.visitSingularUInt32Field(value: self.blockVersion, fieldNumber: 3)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: ConsensusClient_ProposeMintConfigTxResponse, rhs: ConsensusClient_ProposeMintConfigTxResponse) -> Bool {
if lhs._result != rhs._result {return false}
if lhs.blockCount != rhs.blockCount {return false}
if lhs.blockVersion != rhs.blockVersion {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension ConsensusClient_ProposeMintTxResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".ProposeMintTxResponse"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "result"),
2: .standard(proto: "block_count"),
3: .standard(proto: "block_version"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularMessageField(value: &self._result) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.blockCount) }()
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.blockVersion) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._result {
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
} }()
if self.blockCount != 0 {
try visitor.visitSingularUInt64Field(value: self.blockCount, fieldNumber: 2)
}
if self.blockVersion != 0 {
try visitor.visitSingularUInt32Field(value: self.blockVersion, fieldNumber: 3)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: ConsensusClient_ProposeMintTxResponse, rhs: ConsensusClient_ProposeMintTxResponse) -> Bool {
if lhs._result != rhs._result {return false}
if lhs.blockCount != rhs.blockCount {return false}
if lhs.blockVersion != rhs.blockVersion {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
// Consensus service data types used by both client-facing and peer-facing APIs.
@ -60,6 +60,10 @@ public enum ConsensusCommon_ProposeTxResult: SwiftProtobuf.Enum {
case unsortedInputs // = 39
case missingMemo // = 40
case memosNotAllowed // = 41
case tokenNotYetConfigured // = 42
case missingMaskedTokenID // = 43
case maskedTokenIDNotAllowed // = 44
case unsortedOutputs // = 45
case UNRECOGNIZED(Int)
public init() {
@ -101,6 +105,10 @@ public enum ConsensusCommon_ProposeTxResult: SwiftProtobuf.Enum {
case 39: self = .unsortedInputs
case 40: self = .missingMemo
case 41: self = .memosNotAllowed
case 42: self = .tokenNotYetConfigured
case 43: self = .missingMaskedTokenID
case 44: self = .maskedTokenIDNotAllowed
case 45: self = .unsortedOutputs
default: self = .UNRECOGNIZED(rawValue)
}
}
@ -140,6 +148,10 @@ public enum ConsensusCommon_ProposeTxResult: SwiftProtobuf.Enum {
case .unsortedInputs: return 39
case .missingMemo: return 40
case .memosNotAllowed: return 41
case .tokenNotYetConfigured: return 42
case .missingMaskedTokenID: return 43
case .maskedTokenIDNotAllowed: return 44
case .unsortedOutputs: return 45
case .UNRECOGNIZED(let i): return i
}
}
@ -184,6 +196,10 @@ extension ConsensusCommon_ProposeTxResult: CaseIterable {
.unsortedInputs,
.missingMemo,
.memosNotAllowed,
.tokenNotYetConfigured,
.missingMaskedTokenID,
.maskedTokenIDNotAllowed,
.unsortedOutputs,
]
}
@ -202,7 +218,7 @@ public struct ConsensusCommon_LastBlockInfoResponse {
public var mobMinimumFee: UInt64 = 0
/// A map of token id -> minimum fee
public var minimumFees: Dictionary<UInt32,UInt64> = [:]
public var minimumFees: Dictionary<UInt64,UInt64> = [:]
/// Current network_block version, appropriate for new transactions.
///
@ -314,6 +330,10 @@ extension ConsensusCommon_ProposeTxResult: SwiftProtobuf._ProtoNameProviding {
39: .same(proto: "UnsortedInputs"),
40: .same(proto: "MissingMemo"),
41: .same(proto: "MemosNotAllowed"),
42: .same(proto: "TokenNotYetConfigured"),
43: .same(proto: "MissingMaskedTokenId"),
44: .same(proto: "MaskedTokenIdNotAllowed"),
45: .same(proto: "UnsortedOutputs"),
]
}
@ -334,7 +354,7 @@ extension ConsensusCommon_LastBlockInfoResponse: SwiftProtobuf.Message, SwiftPro
switch fieldNumber {
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.index) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.mobMinimumFee) }()
case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt32,SwiftProtobuf.ProtobufUInt64>.self, value: &self.minimumFees) }()
case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt64,SwiftProtobuf.ProtobufUInt64>.self, value: &self.minimumFees) }()
case 4: try { try decoder.decodeSingularUInt32Field(value: &self.networkBlockVersion) }()
default: break
}
@ -349,7 +369,7 @@ extension ConsensusCommon_LastBlockInfoResponse: SwiftProtobuf.Message, SwiftPro
try visitor.visitSingularUInt64Field(value: self.mobMinimumFee, fieldNumber: 2)
}
if !self.minimumFees.isEmpty {
try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt32,SwiftProtobuf.ProtobufUInt64>.self, value: self.minimumFees, fieldNumber: 3)
try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt64,SwiftProtobuf.ProtobufUInt64>.self, value: self.minimumFees, fieldNumber: 3)
}
if self.networkBlockVersion != 0 {
try visitor.visitSingularUInt32Field(value: self.networkBlockVersion, fieldNumber: 4)

View File

@ -0,0 +1,412 @@
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: consensus_config.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2022 The MobileCoin Foundation
// Consensus service configuration data types.
import Foundation
import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that you are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
typealias Version = _2
}
/// A single active minting configuration.
public struct ConsensusConfig_ActiveMintConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The actual mint configuration.
public var mintConfig: External_MintConfig {
get {return _mintConfig ?? External_MintConfig()}
set {_mintConfig = newValue}
}
/// Returns true if `mintConfig` has been explicitly set.
public var hasMintConfig: Bool {return self._mintConfig != nil}
/// Clears the value of `mintConfig`. Subsequent reads from it will return its default value.
public mutating func clearMintConfig() {self._mintConfig = nil}
/// How many tokens have been minted using this configuration.
public var totalMinted: UInt64 = 0
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
fileprivate var _mintConfig: External_MintConfig? = nil
}
/// Active minting configurations for a single token.
public struct ConsensusConfig_ActiveMintConfigs {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
//// Active configs
public var configs: [ConsensusConfig_ActiveMintConfig] = []
/// The original MintConfigTx that this configuration resulted from.
public var mintConfigTx: External_MintConfigTx {
get {return _mintConfigTx ?? External_MintConfigTx()}
set {_mintConfigTx = newValue}
}
/// Returns true if `mintConfigTx` has been explicitly set.
public var hasMintConfigTx: Bool {return self._mintConfigTx != nil}
/// Clears the value of `mintConfigTx`. Subsequent reads from it will return its default value.
public mutating func clearMintConfigTx() {self._mintConfigTx = nil}
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
fileprivate var _mintConfigTx: External_MintConfigTx? = nil
}
/// Token configuration (per-token configuration).
public struct ConsensusConfig_TokenConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The token id this configuration is for.
public var tokenID: UInt64 = 0
/// The current minimum fee for this token.
public var minimumFee: UInt64 = 0
/// Minting governors (optional, only when minting is configured).
public var governors: External_Ed25519SignerSet {
get {return _governors ?? External_Ed25519SignerSet()}
set {_governors = newValue}
}
/// Returns true if `governors` has been explicitly set.
public var hasGovernors: Bool {return self._governors != nil}
/// Clears the value of `governors`. Subsequent reads from it will return its default value.
public mutating func clearGovernors() {self._governors = nil}
/// Currently active mint configurations for this token (optional, only if a valid MintConfigTx has been previously issued).
public var activeMintConfigs: ConsensusConfig_ActiveMintConfigs {
get {return _activeMintConfigs ?? ConsensusConfig_ActiveMintConfigs()}
set {_activeMintConfigs = newValue}
}
/// Returns true if `activeMintConfigs` has been explicitly set.
public var hasActiveMintConfigs: Bool {return self._activeMintConfigs != nil}
/// Clears the value of `activeMintConfigs`. Subsequent reads from it will return its default value.
public mutating func clearActiveMintConfigs() {self._activeMintConfigs = nil}
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
fileprivate var _governors: External_Ed25519SignerSet? = nil
fileprivate var _activeMintConfigs: ConsensusConfig_ActiveMintConfigs? = nil
}
/// Consensus node configuration.
public struct ConsensusConfig_ConsensusNodeConfig {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// Minting trust root public key.
public var mintingTrustRoot: External_Ed25519Public {
get {return _mintingTrustRoot ?? External_Ed25519Public()}
set {_mintingTrustRoot = newValue}
}
/// Returns true if `mintingTrustRoot` has been explicitly set.
public var hasMintingTrustRoot: Bool {return self._mintingTrustRoot != nil}
/// Clears the value of `mintingTrustRoot`. Subsequent reads from it will return its default value.
public mutating func clearMintingTrustRoot() {self._mintingTrustRoot = nil}
/// token id -> configuration map.
public var tokenConfigMap: Dictionary<UInt64,ConsensusConfig_TokenConfig> = [:]
/// Governors signature.
public var governorsSignature: External_Ed25519Signature {
get {return _governorsSignature ?? External_Ed25519Signature()}
set {_governorsSignature = newValue}
}
/// Returns true if `governorsSignature` has been explicitly set.
public var hasGovernorsSignature: Bool {return self._governorsSignature != nil}
/// Clears the value of `governorsSignature`. Subsequent reads from it will return its default value.
public mutating func clearGovernorsSignature() {self._governorsSignature = nil}
/// Peer responder id.
public var peerResponderID: String = String()
/// Client responser id.
public var clientResponderID: String = String()
/// Block signing key.
public var blockSigningKey: External_Ed25519Public {
get {return _blockSigningKey ?? External_Ed25519Public()}
set {_blockSigningKey = newValue}
}
/// Returns true if `blockSigningKey` has been explicitly set.
public var hasBlockSigningKey: Bool {return self._blockSigningKey != nil}
/// Clears the value of `blockSigningKey`. Subsequent reads from it will return its default value.
public mutating func clearBlockSigningKey() {self._blockSigningKey = nil}
/// Currently configured block version.
public var blockVersion: UInt32 = 0
/// SCP message signing key.
public var scpMessageSigningKey: External_Ed25519Public {
get {return _scpMessageSigningKey ?? External_Ed25519Public()}
set {_scpMessageSigningKey = newValue}
}
/// Returns true if `scpMessageSigningKey` has been explicitly set.
public var hasScpMessageSigningKey: Bool {return self._scpMessageSigningKey != nil}
/// Clears the value of `scpMessageSigningKey`. Subsequent reads from it will return its default value.
public mutating func clearScpMessageSigningKey() {self._scpMessageSigningKey = nil}
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
fileprivate var _mintingTrustRoot: External_Ed25519Public? = nil
fileprivate var _governorsSignature: External_Ed25519Signature? = nil
fileprivate var _blockSigningKey: External_Ed25519Public? = nil
fileprivate var _scpMessageSigningKey: External_Ed25519Public? = nil
}
#if swift(>=5.5) && canImport(_Concurrency)
extension ConsensusConfig_ActiveMintConfig: @unchecked Sendable {}
extension ConsensusConfig_ActiveMintConfigs: @unchecked Sendable {}
extension ConsensusConfig_TokenConfig: @unchecked Sendable {}
extension ConsensusConfig_ConsensusNodeConfig: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "consensus_config"
extension ConsensusConfig_ActiveMintConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".ActiveMintConfig"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "mint_config"),
2: .standard(proto: "total_minted"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularMessageField(value: &self._mintConfig) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.totalMinted) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._mintConfig {
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
} }()
if self.totalMinted != 0 {
try visitor.visitSingularUInt64Field(value: self.totalMinted, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: ConsensusConfig_ActiveMintConfig, rhs: ConsensusConfig_ActiveMintConfig) -> Bool {
if lhs._mintConfig != rhs._mintConfig {return false}
if lhs.totalMinted != rhs.totalMinted {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension ConsensusConfig_ActiveMintConfigs: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".ActiveMintConfigs"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "configs"),
2: .standard(proto: "mint_config_tx"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.configs) }()
case 2: try { try decoder.decodeSingularMessageField(value: &self._mintConfigTx) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
if !self.configs.isEmpty {
try visitor.visitRepeatedMessageField(value: self.configs, fieldNumber: 1)
}
try { if let v = self._mintConfigTx {
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
} }()
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: ConsensusConfig_ActiveMintConfigs, rhs: ConsensusConfig_ActiveMintConfigs) -> Bool {
if lhs.configs != rhs.configs {return false}
if lhs._mintConfigTx != rhs._mintConfigTx {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension ConsensusConfig_TokenConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".TokenConfig"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "token_id"),
2: .standard(proto: "minimum_fee"),
3: .same(proto: "governors"),
4: .standard(proto: "active_mint_configs"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.tokenID) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.minimumFee) }()
case 3: try { try decoder.decodeSingularMessageField(value: &self._governors) }()
case 4: try { try decoder.decodeSingularMessageField(value: &self._activeMintConfigs) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
if self.tokenID != 0 {
try visitor.visitSingularUInt64Field(value: self.tokenID, fieldNumber: 1)
}
if self.minimumFee != 0 {
try visitor.visitSingularUInt64Field(value: self.minimumFee, fieldNumber: 2)
}
try { if let v = self._governors {
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
} }()
try { if let v = self._activeMintConfigs {
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
} }()
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: ConsensusConfig_TokenConfig, rhs: ConsensusConfig_TokenConfig) -> Bool {
if lhs.tokenID != rhs.tokenID {return false}
if lhs.minimumFee != rhs.minimumFee {return false}
if lhs._governors != rhs._governors {return false}
if lhs._activeMintConfigs != rhs._activeMintConfigs {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension ConsensusConfig_ConsensusNodeConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".ConsensusNodeConfig"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "minting_trust_root"),
2: .standard(proto: "token_config_map"),
3: .standard(proto: "governors_signature"),
4: .standard(proto: "peer_responder_id"),
5: .standard(proto: "client_responder_id"),
6: .standard(proto: "block_signing_key"),
7: .standard(proto: "block_version"),
8: .standard(proto: "scp_message_signing_key"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularMessageField(value: &self._mintingTrustRoot) }()
case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufUInt64,ConsensusConfig_TokenConfig>.self, value: &self.tokenConfigMap) }()
case 3: try { try decoder.decodeSingularMessageField(value: &self._governorsSignature) }()
case 4: try { try decoder.decodeSingularStringField(value: &self.peerResponderID) }()
case 5: try { try decoder.decodeSingularStringField(value: &self.clientResponderID) }()
case 6: try { try decoder.decodeSingularMessageField(value: &self._blockSigningKey) }()
case 7: try { try decoder.decodeSingularUInt32Field(value: &self.blockVersion) }()
case 8: try { try decoder.decodeSingularMessageField(value: &self._scpMessageSigningKey) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._mintingTrustRoot {
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
} }()
if !self.tokenConfigMap.isEmpty {
try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufUInt64,ConsensusConfig_TokenConfig>.self, value: self.tokenConfigMap, fieldNumber: 2)
}
try { if let v = self._governorsSignature {
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
} }()
if !self.peerResponderID.isEmpty {
try visitor.visitSingularStringField(value: self.peerResponderID, fieldNumber: 4)
}
if !self.clientResponderID.isEmpty {
try visitor.visitSingularStringField(value: self.clientResponderID, fieldNumber: 5)
}
try { if let v = self._blockSigningKey {
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
} }()
if self.blockVersion != 0 {
try visitor.visitSingularUInt32Field(value: self.blockVersion, fieldNumber: 7)
}
try { if let v = self._scpMessageSigningKey {
try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
} }()
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: ConsensusConfig_ConsensusNodeConfig, rhs: ConsensusConfig_ConsensusNodeConfig) -> Bool {
if lhs._mintingTrustRoot != rhs._mintingTrustRoot {return false}
if lhs.tokenConfigMap != rhs.tokenConfigMap {return false}
if lhs._governorsSignature != rhs._governorsSignature {return false}
if lhs.peerResponderID != rhs.peerResponderID {return false}
if lhs.clientResponderID != rhs.clientResponderID {return false}
if lhs._blockSigningKey != rhs._blockSigningKey {return false}
if lhs.blockVersion != rhs.blockVersion {return false}
if lhs._scpMessageSigningKey != rhs._scpMessageSigningKey {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
import Foundation
import SwiftProtobuf

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
import Foundation
import SwiftProtobuf

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 MobileCoin Inc.
// Copyright (c) 2018-2022 The MobileCoin Foundation
import Foundation
import SwiftProtobuf

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
/// Protos to be used for displaying encoded strings to users
@ -47,6 +47,9 @@ public struct Printable_PaymentRequest {
//// Any additional text explaining the request
public var memo: String = String()
//// Token id to transact in.
public var tokenID: UInt64 = 0
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
@ -176,6 +179,7 @@ extension Printable_PaymentRequest: SwiftProtobuf.Message, SwiftProtobuf._Messag
1: .standard(proto: "public_address"),
2: .same(proto: "value"),
3: .same(proto: "memo"),
4: .standard(proto: "token_id"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -187,6 +191,7 @@ extension Printable_PaymentRequest: SwiftProtobuf.Message, SwiftProtobuf._Messag
case 1: try { try decoder.decodeSingularMessageField(value: &self._publicAddress) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.value) }()
case 3: try { try decoder.decodeSingularStringField(value: &self.memo) }()
case 4: try { try decoder.decodeSingularUInt64Field(value: &self.tokenID) }()
default: break
}
}
@ -206,6 +211,9 @@ extension Printable_PaymentRequest: SwiftProtobuf.Message, SwiftProtobuf._Messag
if !self.memo.isEmpty {
try visitor.visitSingularStringField(value: self.memo, fieldNumber: 3)
}
if self.tokenID != 0 {
try visitor.visitSingularUInt64Field(value: self.tokenID, fieldNumber: 4)
}
try unknownFields.traverse(visitor: &visitor)
}
@ -213,6 +221,7 @@ extension Printable_PaymentRequest: SwiftProtobuf.Message, SwiftProtobuf._Messag
if lhs._publicAddress != rhs._publicAddress {return false}
if lhs.value != rhs.value {return false}
if lhs.memo != rhs.memo {return false}
if lhs.tokenID != rhs.tokenID {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
/// MUST BE KEPT IN SYNC WITH RUST CODE!

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
import Foundation
import SwiftProtobuf
@ -394,6 +394,9 @@ public struct FogView_TxOutRecord {
//// This is omitted for TxOut's from before the upgrade that introduced memos.
public var txOutEMemoData: Data = Data()
//// The masked token id associated to the amount field in the TxOut that was recovered
public var txOutAmountMaskedTokenID: Data = Data()
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
@ -717,6 +720,7 @@ extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
7: .same(proto: "timestamp"),
8: .standard(proto: "tx_out_amount_commitment_data_crc32"),
9: .standard(proto: "tx_out_e_memo_data"),
10: .standard(proto: "tx_out_amount_masked_token_id"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -734,6 +738,7 @@ extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
case 7: try { try decoder.decodeSingularFixed64Field(value: &self.timestamp) }()
case 8: try { try decoder.decodeSingularFixed32Field(value: &self.txOutAmountCommitmentDataCrc32) }()
case 9: try { try decoder.decodeSingularBytesField(value: &self.txOutEMemoData) }()
case 10: try { try decoder.decodeSingularBytesField(value: &self.txOutAmountMaskedTokenID) }()
default: break
}
}
@ -767,6 +772,9 @@ extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
if !self.txOutEMemoData.isEmpty {
try visitor.visitSingularBytesField(value: self.txOutEMemoData, fieldNumber: 9)
}
if !self.txOutAmountMaskedTokenID.isEmpty {
try visitor.visitSingularBytesField(value: self.txOutAmountMaskedTokenID, fieldNumber: 10)
}
try unknownFields.traverse(visitor: &visitor)
}
@ -780,6 +788,7 @@ extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
if lhs.timestamp != rhs.timestamp {return false}
if lhs.txOutAmountCommitmentDataCrc32 != rhs.txOutAmountCommitmentDataCrc32 {return false}
if lhs.txOutEMemoData != rhs.txOutEMemoData {return false}
if lhs.txOutAmountMaskedTokenID != rhs.txOutAmountMaskedTokenID {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}

View File

@ -7,7 +7,7 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright (c) 2018-2021 The MobileCoin Foundation
// Copyright (c) 2018-2022 The MobileCoin Foundation
// MUST BE KEPT IN SYNC WITH RUST CODE!

2
Vendor/mobilecoin vendored

@ -1 +1 @@
Subproject commit 3fe363a9384af89d6f12be004518b1367fe70670
Subproject commit cbcac5a6906ce69ed179fb80f7cb8df07f802e8c