From 0fca92f45906ae921f7aed910f709315df9e1ad4 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Thu, 31 Aug 2023 10:23:19 +0200 Subject: [PATCH 1/3] Update RET from release/rcnet-v3 - fd0cde0 --- .../xcshareddata/swiftpm/Package.resolved | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/App/BabylonWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/App/BabylonWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index bdc434bfd9..f5e36c6686 100644 --- a/App/BabylonWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/App/BabylonWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -231,7 +231,7 @@ "location" : "https://github.com/radixdlt/swift-engine-toolkit", "state" : { "branch" : "release/rcnet-v3", - "revision" : "2f6fa524e0191acb3c25cc35966cd4d23039886a" + "revision" : "69e906bd55e5d5f667aa4ee49b31e9ce021f11d7" } }, { @@ -291,7 +291,7 @@ { "identity" : "swift-numerics", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-numerics.git", + "location" : "https://github.com/apple/swift-numerics", "state" : { "revision" : "0a5bc04095a675662cf24757cc0640aa2204253b", "version" : "1.0.2" @@ -338,8 +338,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/siteline/SwiftUI-Introspect", "state" : { - "revision" : "ccb973cfff703cba53fb88197413485c060eb26b", - "version" : "0.10.0" + "revision" : "121c146fe591b1320238d054ae35c81ffa45f45a", + "version" : "0.12.0" } }, { From 3f0bd049bfe665e834d83ad5e460918bf9ec3621 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Thu, 31 Aug 2023 10:50:18 +0200 Subject: [PATCH 2/3] Fix incorrect values on profile snapshot test vector where content hint used wrong values. --- .../profile_snapshot.json | 6 +-- Sources/EngineKit/Address.swift | 3 +- Tests/ProfileTests/ProfileTests.swift | 43 +++++++++++++------ 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/Sources/Core/SharedTestingModels/TestVectorsSharedByMultipleTargets/profile_snapshot.json b/Sources/Core/SharedTestingModels/TestVectorsSharedByMultipleTargets/profile_snapshot.json index 2af11d38b0..5442212f25 100644 --- a/Sources/Core/SharedTestingModels/TestVectorsSharedByMultipleTargets/profile_snapshot.json +++ b/Sources/Core/SharedTestingModels/TestVectorsSharedByMultipleTargets/profile_snapshot.json @@ -193,9 +193,9 @@ ], "header" : { "contentHint" : { - "numberOfAccountsOnAllNetworksInTotal" : 6, - "numberOfNetworks" : 2, - "numberOfPersonasOnAllNetworksInTotal" : 3 + "numberOfAccountsOnAllNetworksInTotal" : 3, + "numberOfNetworks" : 1, + "numberOfPersonasOnAllNetworksInTotal" : 2 }, "creatingDevice" : { "date" : "1970-01-01T00:00:00Z", diff --git a/Sources/EngineKit/Address.swift b/Sources/EngineKit/Address.swift index 52bbcb3ccc..dfe57e0012 100644 --- a/Sources/EngineKit/Address.swift +++ b/Sources/EngineKit/Address.swift @@ -36,7 +36,6 @@ extension EntityType: CaseIterable { .globalVirtualEd25519Identity, .globalVirtualSecp256k1Account, .globalVirtualSecp256k1Identity, - .internalAccount, .internalFungibleVault, .internalGenericComponent, .internalKeyValueStore, @@ -82,7 +81,7 @@ public enum EntityEntityType: SpecificEntityType { // MARK: - AccountEntityType public enum AccountEntityType: SpecificEntityType { - public static let addressSpace: Set = [.globalAccount, .internalAccount, .globalVirtualEd25519Account, .globalVirtualSecp256k1Account] + public static let addressSpace: Set = [.globalAccount, .globalVirtualEd25519Account, .globalVirtualSecp256k1Account] } // MARK: - IdentityEntityType diff --git a/Tests/ProfileTests/ProfileTests.swift b/Tests/ProfileTests/ProfileTests.swift index 82c750b393..27c005ab8c 100644 --- a/Tests/ProfileTests/ProfileTests.swift +++ b/Tests/ProfileTests/ProfileTests.swift @@ -114,6 +114,7 @@ final class ProfileTests: TestCase { } } + // FIXME: Rewrite this whole test... which manually populates profile instead of using our production code! func test_generate_profile_snapshot_test_vector() async throws { continueAfterFailure = false @@ -150,7 +151,19 @@ final class ProfileTests: TestCase { ) let profile = Profile( - header: snapshotHeader, + header: .init( + creatingDevice: device, + lastUsedOnDevice: device, + id: stableUUID, + lastModified: stableDate, + // FIXME: we should not hard code these... actually we should rewrite this whole test... which manually populates profile instead of using our production code! + contentHint: .init( + numberOfAccountsOnAllNetworksInTotal: 3, + numberOfPersonasOnAllNetworksInTotal: 2, + numberOfNetworks: 1 + ), + snapshotVersion: .minimum + ), deviceFactorSource: babylonFactorSource, appPreferences: .init(gateways: .init(current: gateway)) ) @@ -458,6 +471,10 @@ final class ProfileTests: TestCase { ) let snapshot = profile.snapshot() + + XCTAssertEqual(snapshot.networks.count, snapshot.header.contentHint.numberOfNetworks) + XCTAssertEqual(snapshot.header.contentHint.numberOfAccountsOnAllNetworksInTotal, profile.network?.accounts.count) + XCTAssertEqual(snapshot.header.contentHint.numberOfPersonasOnAllNetworksInTotal, profile.network?.personas.count) let jsonEncoder = JSONEncoder.iso8601 XCTAssertNoThrow(try jsonEncoder.encode(snapshot)) // Uncomment the lines below to generate a new test vector @@ -719,6 +736,18 @@ final class ProfileTests: TestCase { } func test_version_compatibility_check_ok() throws { + let snapshotHeader = ProfileSnapshot.Header( + creatingDevice: device, + lastUsedOnDevice: device, + id: stableUUID, + lastModified: stableDate, + contentHint: .init( + numberOfAccountsOnAllNetworksInTotal: 6, + numberOfPersonasOnAllNetworksInTotal: 3, + numberOfNetworks: 2 + ), + snapshotVersion: .minimum + ) XCTAssertNoThrow( try snapshotHeader.validateCompatibility() ) @@ -731,18 +760,6 @@ private let creatingDevice: NonEmptyString = "\(deviceFactorModel) \(deviceFacto private let stableDate = Date(timeIntervalSince1970: 0) private let stableUUID = UUID(uuidString: "BABE1442-3C98-41FF-AFB0-D0F5829B020D")! private let device: ProfileSnapshot.Header.UsedDeviceInfo = .init(description: creatingDevice, id: stableUUID, date: stableDate) -private let snapshotHeader = ProfileSnapshot.Header( - creatingDevice: device, - lastUsedOnDevice: device, - id: stableUUID, - lastModified: stableDate, - contentHint: .init( - numberOfAccountsOnAllNetworksInTotal: 6, - numberOfPersonasOnAllNetworksInTotal: 3, - numberOfNetworks: 2 - ), - snapshotVersion: .minimum -) extension EntityProtocol { func publicKey() -> SLIP10.PublicKey? { From 2a7eade0fbf888e213c19865ec0770d54dc1c203 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Thu, 31 Aug 2023 10:57:02 +0200 Subject: [PATCH 3/3] fix failing test --- Tests/ProfileTests/ProfileTests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/ProfileTests/ProfileTests.swift b/Tests/ProfileTests/ProfileTests.swift index 27c005ab8c..abbf272553 100644 --- a/Tests/ProfileTests/ProfileTests.swift +++ b/Tests/ProfileTests/ProfileTests.swift @@ -498,9 +498,9 @@ final class ProfileTests: TestCase { id: .init(uuidString: "BABE1442-3C98-41FF-AFB0-D0F5829B020D")!, lastModified: date, contentHint: .init( - numberOfAccountsOnAllNetworksInTotal: 6, - numberOfPersonasOnAllNetworksInTotal: 3, - numberOfNetworks: 2 + numberOfAccountsOnAllNetworksInTotal: 3, + numberOfPersonasOnAllNetworksInTotal: 2, + numberOfNetworks: 1 ), snapshotVersion: ProfileSnapshot.Header.Version.minimum )