Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Abw 2153 update ret to fd0cde0 rcv3 #696

Merged
merged 3 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
"location" : "https://github.com/radixdlt/swift-engine-toolkit",
"state" : {
"branch" : "release/rcnet-v3",
"revision" : "2f6fa524e0191acb3c25cc35966cd4d23039886a"
"revision" : "69e906bd55e5d5f667aa4ee49b31e9ce021f11d7"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upgrades SET to RET 0.12.0-rcnetv3.1-fd0cde0

}
},
{
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@
],
"header" : {
"contentHint" : {
"numberOfAccountsOnAllNetworksInTotal" : 6,
"numberOfNetworks" : 2,
"numberOfPersonasOnAllNetworksInTotal" : 3
"numberOfAccountsOnAllNetworksInTotal" : 3,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we were using incorrect values

"numberOfNetworks" : 1,
"numberOfPersonasOnAllNetworksInTotal" : 2
},
"creatingDevice" : {
"date" : "1970-01-01T00:00:00Z",
Expand Down
3 changes: 1 addition & 2 deletions Sources/EngineKit/Address.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ extension EntityType: CaseIterable {
.globalVirtualEd25519Identity,
.globalVirtualSecp256k1Account,
.globalVirtualSecp256k1Identity,
.internalAccount,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.internalFungibleVault,
.internalGenericComponent,
.internalKeyValueStore,
Expand Down Expand Up @@ -82,7 +81,7 @@ public enum EntityEntityType: SpecificEntityType {

// MARK: - AccountEntityType
public enum AccountEntityType: SpecificEntityType {
public static let addressSpace: Set<EntityType> = [.globalAccount, .internalAccount, .globalVirtualEd25519Account, .globalVirtualSecp256k1Account]
public static let addressSpace: Set<EntityType> = [.globalAccount, .globalVirtualEd25519Account, .globalVirtualSecp256k1Account]
}

// MARK: - IdentityEntityType
Expand Down
49 changes: 33 additions & 16 deletions Tests/ProfileTests/ProfileTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
)
Expand Down Expand Up @@ -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
Expand All @@ -481,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
)
Expand Down Expand Up @@ -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()
)
Expand All @@ -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? {
Expand Down