diff --git a/.gitmodules b/.gitmodules index 378f47e..c53e9fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "Vendor/fog"] - path = Vendor/fog - url = https://github.com/mobilecoinfoundation/fog.git +[submodule "Vendor/mobilecoin"] + path = Vendor/mobilecoin + url = https://github.com/mobilecoinfoundation/mobilecoin.git diff --git a/Artifacts/include/transaction.h b/Artifacts/include/transaction.h index b225d78..9064dbc 100644 --- a/Artifacts/include/transaction.h +++ b/Artifacts/include/transaction.h @@ -16,7 +16,6 @@ extern "C" { /* ==== Types ==== */ typedef struct { - const McBuffer* MC_NONNULL commitment; uint64_t masked_value; } McTxOutAmount; @@ -25,6 +24,23 @@ typedef struct _McTransactionBuilder McTransactionBuilder; /* ==== TxOut ==== */ +/// # Preconditions +/// +/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar. +/// +/// # Errors +/// +/// * `LibMcError::InvalidInput` +/// * `LibMcError::TransactionCrypto` +bool mc_tx_out_reconstruct_commitment( + const McTxOutAmount* MC_NONNULL tx_out_amount, + const McBuffer* MC_NONNULL tx_out_public_key, + const McBuffer* MC_NONNULL view_private_key, + McMutableBuffer* MC_NONNULL out_commitment, + McError* MC_NULLABLE * MC_NULLABLE out_error +) +MC_ATTRIBUTE_NONNULL(1, 2, 3, 4); + /// # Preconditions /// /// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar. diff --git a/Artifacts/libmobilecoin.a b/Artifacts/libmobilecoin.a deleted file mode 100644 index c47bacc..0000000 Binary files a/Artifacts/libmobilecoin.a and /dev/null differ diff --git a/Artifacts/target/aarch64-apple-ios-macabi/release/libmobilecoin_stripped.a b/Artifacts/target/aarch64-apple-ios-macabi/release/libmobilecoin_stripped.a new file mode 100644 index 0000000..9bbb08b Binary files /dev/null and b/Artifacts/target/aarch64-apple-ios-macabi/release/libmobilecoin_stripped.a differ diff --git a/Artifacts/target/aarch64-apple-ios-sim/release/libmobilecoin_stripped.a b/Artifacts/target/aarch64-apple-ios-sim/release/libmobilecoin_stripped.a new file mode 100644 index 0000000..e241424 Binary files /dev/null and b/Artifacts/target/aarch64-apple-ios-sim/release/libmobilecoin_stripped.a differ diff --git a/Artifacts/target/aarch64-apple-ios/release/libmobilecoin_stripped.a b/Artifacts/target/aarch64-apple-ios/release/libmobilecoin_stripped.a new file mode 100644 index 0000000..692d24e Binary files /dev/null and b/Artifacts/target/aarch64-apple-ios/release/libmobilecoin_stripped.a differ diff --git a/Artifacts/target/x86_64-apple-ios-macabi/release/libmobilecoin_stripped.a b/Artifacts/target/x86_64-apple-ios-macabi/release/libmobilecoin_stripped.a new file mode 100644 index 0000000..2f4746b Binary files /dev/null and b/Artifacts/target/x86_64-apple-ios-macabi/release/libmobilecoin_stripped.a differ diff --git a/Artifacts/target/x86_64-apple-ios/release/libmobilecoin_stripped.a b/Artifacts/target/x86_64-apple-ios/release/libmobilecoin_stripped.a new file mode 100644 index 0000000..46cb407 Binary files /dev/null and b/Artifacts/target/x86_64-apple-ios/release/libmobilecoin_stripped.a differ diff --git a/Dockerfile b/Dockerfile index a61fe5b..e3c4e4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,23 +29,23 @@ ENV PATH="/root/grpc-swift-plugins/bin:${PATH}" WORKDIR /root/project -COPY Vendor/fog/mobilecoin/api/proto/blockchain.proto \ - Vendor/fog/mobilecoin/api/proto/external.proto \ - Vendor/fog/mobilecoin/api/proto/printable.proto \ - Vendor/fog/mobilecoin/api/proto/watcher.proto \ - Vendor/fog/mobilecoin/api/proto/ -COPY Vendor/fog/mobilecoin/attest/api/proto/attest.proto \ - Vendor/fog/mobilecoin/attest/api/proto/ -COPY Vendor/fog/mobilecoin/consensus/api/proto/consensus_client.proto \ - Vendor/fog/mobilecoin/consensus/api/proto/consensus_common.proto \ - Vendor/fog/mobilecoin/consensus/api/proto/ -COPY Vendor/fog/mobilecoin/fog/api/proto/report.proto \ - Vendor/fog/mobilecoin/fog/api/proto/ -COPY Vendor/fog/fog/api/proto/fog_common.proto \ - Vendor/fog/fog/api/proto/kex_rng.proto \ - Vendor/fog/fog/api/proto/ledger.proto \ - Vendor/fog/fog/api/proto/view.proto \ - Vendor/fog/fog/api/proto/ +COPY Vendor/mobilecoin/api/proto/blockchain.proto \ + Vendor/mobilecoin/api/proto/external.proto \ + Vendor/mobilecoin/api/proto/printable.proto \ + Vendor/mobilecoin/api/proto/watcher.proto \ + Vendor/mobilecoin/api/proto/ +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/ +COPY Vendor/mobilecoin/fog/report/api/proto/report.proto \ + Vendor/mobilecoin/fog/report/api/proto/ +COPY Vendor/mobilecoin/fog/api/proto/fog_common.proto \ + Vendor/mobilecoin/fog/api/proto/kex_rng.proto \ + Vendor/mobilecoin/fog/api/proto/ledger.proto \ + Vendor/mobilecoin/fog/api/proto/view.proto \ + Vendor/mobilecoin/fog/api/proto/ RUN mkdir -p Sources/Generated/Proto RUN protoc \ @@ -53,11 +53,11 @@ RUN protoc \ --swift_opt=Visibility=Public \ --grpc-swift_out=Sources/Generated/Proto \ --grpc-swift_opt=Client=true,Server=false,Visibility=Public \ - -IVendor/fog/mobilecoin/api/proto \ - -IVendor/fog/mobilecoin/attest/api/proto \ - -IVendor/fog/mobilecoin/consensus/api/proto \ - -IVendor/fog/mobilecoin/fog/api/proto \ - -IVendor/fog/fog/api/proto \ + -IVendor/mobilecoin/api/proto \ + -IVendor/mobilecoin/attest/api/proto \ + -IVendor/mobilecoin/consensus/api/proto \ + -IVendor/mobilecoin/fog/api/proto \ + -IVendor/mobilecoin/fog/report/api/proto \ external.proto \ blockchain.proto \ printable.proto \ diff --git a/Gemfile.lock b/Gemfile.lock index cf718b0..84ef428 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,6 @@ +GEM + specs: + GEM remote: https://rubygems.org/ specs: @@ -90,4 +93,4 @@ DEPENDENCIES cocoapods! BUNDLED WITH - 2.1.4 + 2.2.20 diff --git a/LibMobileCoin.podspec b/LibMobileCoin.podspec index 3d01997..d8470f7 100644 --- a/LibMobileCoin.podspec +++ b/LibMobileCoin.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.name = "LibMobileCoin" - s.version = "1.1.0" + s.version = "1.2.0-pre0" s.summary = "A library for communicating with MobileCoin network" s.author = "MobileCoin" @@ -26,8 +26,9 @@ Pod::Spec.new do |s| "Sources/Generated/Proto/*.{grpc,pb}.swift", ] - s.vendored_library = "Artifacts/libmobilecoin.a" - + s.preserve_paths = [ + 'Artifacts/**/libmobilecoin_stripped.a', + ] # ――― Dependencies ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # @@ -55,27 +56,48 @@ Pod::Spec.new do |s| # 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" => "NO", - # HACK: this forces the libmobilecoin.a static archive to be included when the - # linker is linking LibMobileCoin as a shared framework - "OTHER_LDFLAGS" => "-u _mc_string_free", - # Mac Catalyst is not supported since this library includes a vendored binary + # Mac Catalyst is not supported since tjis library includes a vendored binary # that only includes support for iOS archictures. - "SUPPORTS_MACCATALYST" => "NO", + "SUPPORTS_MACCATALYST" => "YES", # The vendored binary doesn't include support for 32-bit architectures or arm64 # for iphonesimulator. This must be manually configured to avoid Xcode's default # setting of building 32-bit and Xcode 12's default setting of including the # arm64 simulator. Note: 32-bit is officially dropped in iOS 11 + + "HEADER_SEARCH_PATHS": "$(PODS_TARGET_SRCROOT)/Artifacts/include", + "SWIFT_INCLUDE_PATHS": "$(HEADER_SEARCH_PATHS)", + + "LIBMOBILECOIN_LIB_IF_NEEDED": "$(PODS_TARGET_SRCROOT)/Artifacts/target/$(CARGO_BUILD_TARGET)/release/libmobilecoin_stripped.a", + "OTHER_LDFLAGS": "-u _mc_string_free $(LIBMOBILECOIN_LIB_IF_NEEDED)", + + "CARGO_BUILD_TARGET[sdk=iphonesimulator*][arch=arm64]": "aarch64-apple-ios-sim", + "CARGO_BUILD_TARGET[sdk=iphonesimulator*][arch=*]": "x86_64-apple-ios", + "CARGO_BUILD_TARGET[sdk=iphoneos*]": "aarch64-apple-ios", + + "CARGO_BUILD_TARGET_MAC_CATALYST_ARM_": "aarch64-apple-darwin", + "CARGO_BUILD_TARGET_MAC_CATALYST_ARM_YES": "aarch64-apple-ios-macabi", + "CARGO_BUILD_TARGET[sdk=macosx*][arch=arm64]": "$(CARGO_BUILD_TARGET_MAC_CATALYST_ARM_$(IS_MACCATALYST))", + "CARGO_BUILD_TARGET_MAC_CATALYST_X86_": "x86_64-apple-darwin", + "CARGO_BUILD_TARGET_MAC_CATALYST_X86_YES": "x86_64-apple-ios-macabi", + "CARGO_BUILD_TARGET[sdk=macosx*][arch=*]": "$(CARGO_BUILD_TARGET_MAC_CATALYST_X86_$(IS_MACCATALYST))", + "VALID_ARCHS[sdk=iphoneos*]" => "arm64", - "VALID_ARCHS[sdk=iphonesimulator*]" => "x86_64", + "VALID_ARCHS[sdk=iphonesimulator*]" => "x86_64 arm64", + "ARCHS[sdk=iphonesimulator*]": "x86_64 arm64", + "ARCHS[sdk=iphoneos*]": "arm64", + "EXCLUDED_ARCHS[sdk=iphoneos*]" => "armv7", + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "i386", } # `user_target_xcconfig` should only be set when the setting needs to propogate to # all targets that depend on this library. s.user_target_xcconfig = { "ENABLE_BITCODE" => "NO", - "SUPPORTS_MACCATALYST" => "NO", + "SUPPORTS_MACCATALYST" => "YES", + "EXCLUDED_ARCHS[sdk=iphoneos*]" => "armv7", + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "i386", "VALID_ARCHS[sdk=iphoneos*]" => "arm64", - "VALID_ARCHS[sdk=iphonesimulator*]" => "x86_64", + "VALID_ARCHS[sdk=iphonesimulator*]" => "x86_64 arm64", } end diff --git a/Makefile b/Makefile index 4c25f66..5bab631 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ -FOG_DIR = Vendor/fog -LIBMOBILECOIN_LIB_DIR = $(FOG_DIR)/libmobilecoin +MOBILECOIN_DIR = Vendor/mobilecoin +LIBMOBILECOIN_LIB_DIR = $(MOBILECOIN_DIR)/libmobilecoin LIBMOBILECOIN_ARTIFACTS_DIR = $(LIBMOBILECOIN_LIB_DIR)/out/ios +LIBMOBILECOIN_ARTIFACTS_HEADERS = $(LIBMOBILECOIN_LIB_DIR)/out/ios/include ARTIFACTS_DIR = Artifacts +IOS_TARGETS = x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim aarch64-apple-ios-macabi x86_64-apple-ios-macabi .PHONY: default default: setup build generate @@ -23,7 +25,12 @@ build: cd "$(LIBMOBILECOIN_LIB_DIR)" && $(MAKE) ios rm -r "$(ARTIFACTS_DIR)" 2>/dev/null || true mkdir -p "$(ARTIFACTS_DIR)" - cp -R "$(LIBMOBILECOIN_ARTIFACTS_DIR)/" "$(ARTIFACTS_DIR)" + + # Create arch specific folders for each lib + $(foreach arch,$(IOS_TARGETS),mkdir -p $(ARTIFACTS_DIR)/target/$(arch)/release;) + $(foreach arch,$(IOS_TARGETS),cp $(LIBMOBILECOIN_ARTIFACTS_DIR)/target/$(arch)/release/libmobilecoin_stripped.a $(ARTIFACTS_DIR)/target/$(arch)/release;) + cp -R "$(LIBMOBILECOIN_ARTIFACTS_HEADERS)" "$(ARTIFACTS_DIR)" + .PHONY: generate generate: diff --git a/Sources/Generated/Proto/consensus_common.pb.swift b/Sources/Generated/Proto/consensus_common.pb.swift index d4fbb36..7a9a06d 100644 --- a/Sources/Generated/Proto/consensus_common.pb.swift +++ b/Sources/Generated/Proto/consensus_common.pb.swift @@ -58,6 +58,7 @@ public enum ConsensusCommon_ProposeTxResult: SwiftProtobuf.Enum { case txFeeError // = 37 case keyError // = 38 case unsortedInputs // = 39 + case missingMemo // = 40 case UNRECOGNIZED(Int) public init() { @@ -97,6 +98,7 @@ public enum ConsensusCommon_ProposeTxResult: SwiftProtobuf.Enum { case 37: self = .txFeeError case 38: self = .keyError case 39: self = .unsortedInputs + case 40: self = .missingMemo default: self = .UNRECOGNIZED(rawValue) } } @@ -134,6 +136,7 @@ public enum ConsensusCommon_ProposeTxResult: SwiftProtobuf.Enum { case .txFeeError: return 37 case .keyError: return 38 case .unsortedInputs: return 39 + case .missingMemo: return 40 case .UNRECOGNIZED(let i): return i } } @@ -176,6 +179,7 @@ extension ConsensusCommon_ProposeTxResult: CaseIterable { .txFeeError, .keyError, .unsortedInputs, + .missingMemo, ] } @@ -282,6 +286,7 @@ extension ConsensusCommon_ProposeTxResult: SwiftProtobuf._ProtoNameProviding { 37: .same(proto: "TxFeeError"), 38: .same(proto: "KeyError"), 39: .same(proto: "UnsortedInputs"), + 40: .same(proto: "MissingMemo"), ] } diff --git a/Sources/Generated/Proto/external.pb.swift b/Sources/Generated/Proto/external.pb.swift index 9e1b189..c40c398 100644 --- a/Sources/Generated/Proto/external.pb.swift +++ b/Sources/Generated/Proto/external.pb.swift @@ -409,6 +409,7 @@ public struct External_Amount { fileprivate var _commitment: External_CompressedRistretto? = nil } +/// The bytes of encrypted fog hint public struct External_EncryptedFogHint { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -421,6 +422,19 @@ public struct External_EncryptedFogHint { public init() {} } +/// The bytes of encrypted memo +public struct External_EncryptedMemo { + // 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. + + public var data: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + /// A Transaction Output. public struct External_TxOut { // SwiftProtobuf.Message conformance is added in an extension below. See the @@ -469,6 +483,16 @@ public struct External_TxOut { /// Clears the value of `eFogHint`. Subsequent reads from it will return its default value. public mutating func clearEFogHint() {self._eFogHint = nil} + /// Encrypted memo + public var eMemo: External_EncryptedMemo { + get {return _eMemo ?? External_EncryptedMemo()} + set {_eMemo = newValue} + } + /// Returns true if `eMemo` has been explicitly set. + public var hasEMemo: Bool {return self._eMemo != nil} + /// Clears the value of `eMemo`. Subsequent reads from it will return its default value. + public mutating func clearEMemo() {self._eMemo = nil} + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} @@ -477,6 +501,7 @@ public struct External_TxOut { fileprivate var _targetKey: External_CompressedRistretto? = nil fileprivate var _publicKey: External_CompressedRistretto? = nil fileprivate var _eFogHint: External_EncryptedFogHint? = nil + fileprivate var _eMemo: External_EncryptedMemo? = nil } public struct External_TxIn { @@ -1394,6 +1419,38 @@ extension External_EncryptedFogHint: SwiftProtobuf.Message, SwiftProtobuf._Messa } } +extension External_EncryptedMemo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".EncryptedMemo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "data"), + ] + + public mutating func decodeMessage(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.decodeSingularBytesField(value: &self.data) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.data.isEmpty { + try visitor.visitSingularBytesField(value: self.data, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: External_EncryptedMemo, rhs: External_EncryptedMemo) -> Bool { + if lhs.data != rhs.data {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + extension External_TxOut: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".TxOut" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ @@ -1401,6 +1458,7 @@ extension External_TxOut: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement 2: .standard(proto: "target_key"), 3: .standard(proto: "public_key"), 4: .standard(proto: "e_fog_hint"), + 5: .standard(proto: "e_memo"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -1413,6 +1471,7 @@ extension External_TxOut: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement case 2: try { try decoder.decodeSingularMessageField(value: &self._targetKey) }() case 3: try { try decoder.decodeSingularMessageField(value: &self._publicKey) }() case 4: try { try decoder.decodeSingularMessageField(value: &self._eFogHint) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._eMemo) }() default: break } } @@ -1431,6 +1490,9 @@ extension External_TxOut: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement if let v = self._eFogHint { try visitor.visitSingularMessageField(value: v, fieldNumber: 4) } + if let v = self._eMemo { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } try unknownFields.traverse(visitor: &visitor) } @@ -1439,6 +1501,7 @@ extension External_TxOut: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement if lhs._targetKey != rhs._targetKey {return false} if lhs._publicKey != rhs._publicKey {return false} if lhs._eFogHint != rhs._eFogHint {return false} + if lhs._eMemo != rhs._eMemo {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/Sources/Generated/Proto/ledger.pb.swift b/Sources/Generated/Proto/ledger.pb.swift index 9d9d980..b4c1695 100644 --- a/Sources/Generated/Proto/ledger.pb.swift +++ b/Sources/Generated/Proto/ledger.pb.swift @@ -359,8 +359,10 @@ public struct FogLedger_KeyImageResult { public var spentAt: UInt64 = 0 //// The timestamp of the block containing this key image. - //// The value is u64::MAX if the timestamp cannot be found. Callers must check the - //// timestamp_result_code to determine why the timestamp could not be found. + //// The value is u64::MAX if the timestamp cannot be found. + //// If the timestamp cannot be found, even when key_image_result_code == Spent, + //// that represents an internal error of the server + //// which should be reported to the developers. //// Note: The timestamps are based on untrusted reporting of time from the consensus validators. //// Represented as seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. public var timestamp: UInt64 = 0 @@ -370,6 +372,9 @@ public struct FogLedger_KeyImageResult { //// This is fixed32 to avoid leaking information about found / not found in the size of the encrypted //// payload. //// The possible values are described in enum TimestampResultCode. + //// This is a legacy result code which was forwarded by ledger server from the Watcher db API if a timestamp is not available. + //// The ledger server now handles all of these errors and the result will always be `TimestampFound`. + //// Clients should ignore this value, and in a future revision we may make it always zero. public var timestampResultCode: UInt32 = 0 //// The result code indicating whether the key image was spent. @@ -402,7 +407,7 @@ public struct FogLedger_BlockResponse { // methods supported on all messages. //// The block data returned by the server - public var blocks: [FogLedger_Block] = [] + public var blocks: [FogLedger_BlockData] = [] //// The total number of blocks in the ledger at the time the request is evaluated public var numBlocks: UInt64 = 0 @@ -415,7 +420,7 @@ public struct FogLedger_BlockResponse { public init() {} } -public struct FogLedger_Block { +public struct FogLedger_BlockData { // 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. @@ -924,8 +929,8 @@ extension FogLedger_BlockResponse: SwiftProtobuf.Message, SwiftProtobuf._Message } } -extension FogLedger_Block: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".Block" +extension FogLedger_BlockData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".BlockData" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "index"), 2: .standard(proto: "global_txo_count"), @@ -969,7 +974,7 @@ extension FogLedger_Block: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen try unknownFields.traverse(visitor: &visitor) } - public static func ==(lhs: FogLedger_Block, rhs: FogLedger_Block) -> Bool { + public static func ==(lhs: FogLedger_BlockData, rhs: FogLedger_BlockData) -> Bool { if lhs.index != rhs.index {return false} if lhs.globalTxoCount != rhs.globalTxoCount {return false} if lhs.outputs != rhs.outputs {return false} diff --git a/Sources/Generated/Proto/view.pb.swift b/Sources/Generated/Proto/view.pb.swift index d39132e..9afe5fa 100644 --- a/Sources/Generated/Proto/view.pb.swift +++ b/Sources/Generated/Proto/view.pb.swift @@ -320,52 +320,6 @@ public struct FogView_TxOutSearchResult { public init() {} } -//// A Redacted Fog Transaction Output. -//// This is the same as a normal TxOut, except that the fog hint is removed after processing, to save storage. -public struct FogView_FogTxOut { - // 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. - - //// Amount. - public var amount: External_Amount { - get {return _amount ?? External_Amount()} - set {_amount = newValue} - } - /// Returns true if `amount` has been explicitly set. - public var hasAmount: Bool {return self._amount != nil} - /// Clears the value of `amount`. Subsequent reads from it will return its default value. - public mutating func clearAmount() {self._amount = nil} - - //// Public key. - public var targetKey: External_CompressedRistretto { - get {return _targetKey ?? External_CompressedRistretto()} - set {_targetKey = newValue} - } - /// Returns true if `targetKey` has been explicitly set. - public var hasTargetKey: Bool {return self._targetKey != nil} - /// Clears the value of `targetKey`. Subsequent reads from it will return its default value. - public mutating func clearTargetKey() {self._targetKey = nil} - - //// Public key. - public var publicKey: External_CompressedRistretto { - get {return _publicKey ?? External_CompressedRistretto()} - set {_publicKey = newValue} - } - /// Returns true if `publicKey` has been explicitly set. - public var hasPublicKey: Bool {return self._publicKey != nil} - /// Clears the value of `publicKey`. Subsequent reads from it will return its default value. - public mutating func clearPublicKey() {self._publicKey = nil} - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _amount: External_Amount? = nil - fileprivate var _targetKey: External_CompressedRistretto? = nil - fileprivate var _publicKey: External_CompressedRistretto? = nil -} - //// The schema for the decrypted TxOutSearchResult ciphertext //// This is the information that the Ingest enclave produces for the user about their TxOut //// @@ -383,6 +337,8 @@ public struct FogView_TxOutRecord { // methods supported on all messages. //// The (compressed ristretto) bytes of commitment associated to amount field in the TxOut that was recovered + //// + //// Note: This field is omitted in recent versions, because it can be reconstructed by the recipient instead. public var txOutAmountCommitmentData: Data = Data() //// The masked value associated to amount field in the TxOut that was recovered @@ -426,6 +382,18 @@ public struct FogView_TxOutRecord { //// Represented as seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. public var timestamp: UInt64 = 0 + //// The crc32 of the commitment data bytes. + //// This is a 4-byte IEEE crc32 of the bytes of the tx_out_amount_commitment_data bytes, which is present if + //// the full tx_out_amount_commitment_data is omitted. + //// The client can recompute the tx_out_amount_commitment from the other data that we include. + //// They can confirm correct recomputation by checking this crc value. + public var txOutAmountCommitmentDataCrc32: UInt32 = 0 + + //// The bytes of the encrypted memo. + //// This exactly 46 bytes when present. + //// This is omitted for TxOut's from before the upgrade that introduced memos. + public var txOutEMemoData: Data = Data() + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} @@ -722,50 +690,6 @@ extension FogView_TxOutSearchResult: SwiftProtobuf.Message, SwiftProtobuf._Messa } } -extension FogView_FogTxOut: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".FogTxOut" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "amount"), - 2: .standard(proto: "target_key"), - 3: .standard(proto: "public_key"), - ] - - public mutating func decodeMessage(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._amount) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._targetKey) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._publicKey) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if let v = self._amount { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if let v = self._targetKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } - if let v = self._publicKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: FogView_FogTxOut, rhs: FogView_FogTxOut) -> Bool { - if lhs._amount != rhs._amount {return false} - if lhs._targetKey != rhs._targetKey {return false} - if lhs._publicKey != rhs._publicKey {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".TxOutRecord" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ @@ -776,6 +700,8 @@ extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl 5: .standard(proto: "tx_out_global_index"), 6: .standard(proto: "block_index"), 7: .same(proto: "timestamp"), + 8: .standard(proto: "tx_out_amount_commitment_data_crc32"), + 9: .standard(proto: "tx_out_e_memo_data"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -791,6 +717,8 @@ extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl case 5: try { try decoder.decodeSingularFixed64Field(value: &self.txOutGlobalIndex) }() case 6: try { try decoder.decodeSingularFixed64Field(value: &self.blockIndex) }() 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) }() default: break } } @@ -818,6 +746,12 @@ extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl if self.timestamp != 0 { try visitor.visitSingularFixed64Field(value: self.timestamp, fieldNumber: 7) } + if self.txOutAmountCommitmentDataCrc32 != 0 { + try visitor.visitSingularFixed32Field(value: self.txOutAmountCommitmentDataCrc32, fieldNumber: 8) + } + if !self.txOutEMemoData.isEmpty { + try visitor.visitSingularBytesField(value: self.txOutEMemoData, fieldNumber: 9) + } try unknownFields.traverse(visitor: &visitor) } @@ -829,6 +763,8 @@ extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl if lhs.txOutGlobalIndex != rhs.txOutGlobalIndex {return false} if lhs.blockIndex != rhs.blockIndex {return false} if lhs.timestamp != rhs.timestamp {return false} + if lhs.txOutAmountCommitmentDataCrc32 != rhs.txOutAmountCommitmentDataCrc32 {return false} + if lhs.txOutEMemoData != rhs.txOutEMemoData {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/Vendor/fog b/Vendor/fog deleted file mode 160000 index 1fba538..0000000 --- a/Vendor/fog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1fba5385d299c3a47485cec3aac85ec395377df3 diff --git a/Vendor/mobilecoin b/Vendor/mobilecoin new file mode 160000 index 0000000..2ffd726 --- /dev/null +++ b/Vendor/mobilecoin @@ -0,0 +1 @@ +Subproject commit 2ffd7260d42382b12938854b9c79b4a579c0daac