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

Release: v2.5.4 #580

Merged
merged 39 commits into from
Nov 8, 2024
Merged

Release: v2.5.4 #580

merged 39 commits into from
Nov 8, 2024

Conversation

pankcuf
Copy link
Collaborator

@pankcuf pankcuf commented Nov 7, 2024

Issue being fixed or feature implemented

  • Asset unlock tx support
  • Disable upper core protocol boundaries
  • Default currency fix
  • CI fixes
  • Disable dash-shared-core dev features

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced support for asset lock and unlock transactions, enhancing blockchain transaction management.
    • Added new transaction types: Asset Lock and Asset Unlock, improving the framework's capabilities.
    • Enhanced transaction detail display to include specific labels for asset lock and unlock transactions.
  • Improvements

    • Updated workflows for better clarity and streamlined build processes, especially for iOS Simulator.
    • Enhanced currency management and error handling for local currency codes.
    • Updated dependency versions and improved project management in the Podfile.
  • Bug Fixes

    • Improved handling of background tasks in iOS, ensuring better resource management.
  • Documentation

    • Updated pod dependencies and build settings for improved project management.

Copy link
Contributor

coderabbitai bot commented Nov 7, 2024

Warning

Rate limit exceeded

@pankcuf has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 9 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 99cdcc8 and 1828f75.

Walkthrough

The pull request encompasses multiple updates across various workflow files and models within the DashSync project. Key changes include upgrading the actions/checkout action to version 3, renaming several steps for clarity, and modifying the iOS build process to streamline operations related to asset lock and unlock transactions. Additionally, new transaction types have been introduced, and existing transaction handling has been adjusted to accommodate these changes, enhancing the overall functionality and maintainability of the codebase.

Changes

File Change Summary
.github/workflows/build.yml Updated actions/checkout from v2 to v3, renamed steps, modified environment variable scheme, and adjusted xcodebuild command parameters for iOS Simulator builds.
.github/workflows/coverage.yml Updated actions/checkout from v2 to v3.
.github/workflows/e2eTestsTestnet.yml Updated actions/checkout from v2 to v3, renamed build step, modified environment variable scheme, and adjusted xcodebuild commands.
.github/workflows/lint.yml Updated actions/checkout from v2 to v3.
.github/workflows/network.yml Updated actions/checkout from v2 to v3, renamed step, updated actions/upload-artifact from v2 to v4, and added parameters for artifact management.
.github/workflows/syncTestMainnet.yml Updated actions/checkout from v2 to v3.
.github/workflows/syncTestTestnet.yml Updated actions/cache from v2 to v3, renamed build step, modified environment variable scheme, and adjusted xcodebuild commands.
.github/workflows/test.yml Updated actions/checkout from v2 to v3, added steps for Git LFS management, and modified environment variables for consistency.
DashSync.podspec Updated dependency version for DashSharedCore from 0.4.16 to 0.4.19.
DashSync/shared/DashSync.xcdatamodeld/.xccurrentversion Updated current version of Core Data model from DashSync 20.xcdatamodel to DashSync 21.xcdatamodel.
DashSync/shared/DashSync.xcdatamodeld/DashSync 21.xcdatamodel/contents Introduced new Core Data model with multiple entities for managing blockchain data.
DashSync/shared/Models/Chain/DSChainConstants.h Updated protocol version constants from 70232 to 70233.
DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataClass.h Added new class for asset lock transactions with generated accessors.
DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataClass.h Added new class for asset unlock transactions.
DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.h Introduced new class for asset lock transactions with relevant properties.
DashSync/shared/Models/Transactions/Base/DSAssetUnlockTransaction.h Introduced new class for asset unlock transactions with relevant properties.
DashSync/shared/Models/Transactions/DSTransactionFactory.h Updated transaction types to include DSTransactionType_AssetLock and DSTransactionType_AssetUnlock.
Example/Podfile Updated DashSharedCore pod reference and added a new line for local path inclusion.
Example/Tests/DSTransactionTests.m Added a new test method for DSAssetUnlockTransaction.

Poem

In the fields where transactions play,
New locks and unlocks found their way.
With workflows bright and models bold,
DashSync's tale of progress told.
A hop, a skip, through code we weave,
In every change, a chance to believe! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pankcuf pankcuf requested a review from Syn-McJ November 7, 2024 13:32
Syn-McJ
Syn-McJ previously approved these changes Nov 7, 2024
Copy link
Member

@Syn-McJ Syn-McJ left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 23

🧹 Outside diff range and nitpick comments (44)
DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataProperties.m (2)

22-24: Consider using a constant for the entity name.

Using a hardcoded string for the entity name could lead to maintenance issues if the entity name changes. Consider defining a constant for the entity name.

+ static NSString * const kDSAssetLockTransactionEntityName = @"DSAssetLockTransactionEntity";

+ (NSFetchRequest<DSAssetLockTransactionEntity *> *)fetchRequest {
-    return [NSFetchRequest fetchRequestWithEntityName:@"DSAssetLockTransactionEntity"];
+    return [NSFetchRequest fetchRequestWithEntityName:kDSAssetLockTransactionEntityName];
}

26-26: Consider adding documentation for the creditOutputs property.

Adding documentation would help other developers understand the purpose and expected usage of this property.

+/**
+ * The credit outputs associated with this asset lock transaction.
+ * This property is managed by Core Data.
+ */
@dynamic creditOutputs;
DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataProperties.h (1)

18-23: Consider adding CoreData and DSTxOutputEntity imports.

While the code might compile due to transitive imports, it's better to explicitly import the frameworks and classes used directly in this header.

+#import <CoreData/CoreData.h>
 #import "DSAssetLockTransactionEntity+CoreDataClass.h"
+#import "DSTxOutputEntity.h"
DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.h (2)

24-29: Add documentation for the new transaction type.

The class and its properties lack documentation explaining:

  • The purpose of asset lock transactions
  • The valid range and meaning of specialTransactionVersion
  • The expected content and usage of creditOutputs

Add documentation using the following format:

+/**
+ * A transaction that locks assets in the Dash network.
+ * This class handles the creation and management of asset lock transactions,
+ * which are special transactions used for [describe purpose].
+ */
 @interface DSAssetLockTransaction : DSTransaction

+/** Version of the special transaction format. Must be between [range]. */
 @property (nonatomic, assign) uint8_t specialTransactionVersion;
 
+/** Array of transaction outputs representing the locked credits. */
 @property (nonatomic, strong) NSMutableArray<DSTransactionOutput *> *creditOutputs;

24-29: Consider adding validation methods for transaction integrity.

The class should include methods to validate:

  • The special transaction version
  • The credit outputs structure and content

Consider adding the following method declarations:

/**
 * Validates the transaction structure and content.
 * @return YES if the transaction is valid, NO otherwise.
 * @param error Pointer to an error object that will be set if validation fails.
 */
- (BOOL)validateTransactionWithError:(NSError **)error;
DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataProperties.m (1)

22-24: Consider using a constant for the entity name

While the implementation is correct, using a string literal for the entity name could lead to runtime errors if the name changes. Consider defining a constant for the entity name.

+ static NSString *const kDSAssetUnlockTransactionEntityName = @"DSAssetUnlockTransactionEntity";

+ (NSFetchRequest<DSAssetUnlockTransactionEntity *> *)fetchRequest {
-    return [NSFetchRequest fetchRequestWithEntityName:@"DSAssetUnlockTransactionEntity"];
+    return [NSFetchRequest fetchRequestWithEntityName:kDSAssetUnlockTransactionEntityName];
}
DashSync/shared/Models/Transactions/DSTransactionFactory.h (1)

23-24: Document the new asset transaction types

The new asset lock/unlock transaction types should be documented, especially since they're part of the special transactions framework (DIP-0002).

Add documentation comments above the new enum values:

    DSTransactionType_QuorumCommitment = 6,
+   /// Transaction type for locking assets as defined in DIP-XXX
    DSTransactionType_AssetLock = 8,
+   /// Transaction type for unlocking previously locked assets
    DSTransactionType_AssetUnlock = 9,
DashSync/shared/Models/Transactions/Base/DSAssetUnlockTransaction.h (1)

24-32: Add documentation and consider additional safeguards

The interface structure is good, but could benefit from the following improvements:

  1. Add documentation for each property explaining:

    • Their purpose
    • Valid value ranges
    • Any constraints or relationships between properties
  2. Consider adding validation methods and making appropriate properties readonly

Here's a suggested improvement:

 @interface DSAssetUnlockTransaction : DSTransaction
+
+/**
+ * Version of the special transaction format.
+ * Must be compatible with the network protocol version.
+ */
 @property (nonatomic, assign) uint8_t specialTransactionVersion;
+
+/**
+ * Index of the asset unlock transaction.
+ */
 @property (nonatomic, assign, readonly) uint64_t index;
+
+/**
+ * Transaction fee in satoshis.
+ */
 @property (nonatomic, assign) uint32_t fee;
+
+/**
+ * Block height at which the unlock was requested.
+ */
 @property (nonatomic, assign) uint32_t requestedHeight;
+
+/**
+ * Hash of the quorum that processed this unlock.
+ */
 @property (nonatomic, assign, readonly) UInt256 quorumHash;
+
+/**
+ * Cryptographic signature from the quorum.
+ */
 @property (nonatomic, assign, readonly) UInt768 quorumSignature;
+
+/**
+ * Initializes a new asset unlock transaction.
+ * @param index The transaction index
+ * @param fee The transaction fee in satoshis
+ * @param requestedHeight The block height at which the unlock was requested
+ * @return An initialized asset unlock transaction object
+ */
+- (instancetype)initWithIndex:(uint64_t)index
+                         fee:(uint32_t)fee
+            requestedHeight:(uint32_t)requestedHeight;
DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataProperties.h (1)

18-20: Remove extra empty line after import

Consider removing one of the empty lines after the import statement to maintain consistent spacing.

 #import "DSAssetUnlockTransactionEntity+CoreDataClass.h"
-

 NS_ASSUME_NONNULL_BEGIN
Example/Podfile (1)

29-44: Consider optimizing the post-install hook implementation.

The current implementation for removing the GCC_WARN_INHIBIT_ALL_WARNINGS flag is functional but could be more efficient.

Consider this more concise implementation:

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      # fixes warnings about unsupported Deployment Target in Xcode 10
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
      end

      # Ensure the GCC_WARN_INHIBIT_ALL_WARNINGS flag is removed for BoringSSL-GRPC and BoringSSL-GRPC-iOS
-     if ['BoringSSL-GRPC', 'BoringSSL-GRPC-iOS', 'BoringSSL-GRPC-macOS'].include? target.name
+     if target.name.start_with?('BoringSSL-GRPC')
        target.source_build_phase.files.each do |file|
-         if file.settings && file.settings['COMPILER_FLAGS']
-           flags = file.settings['COMPILER_FLAGS'].split
-           flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
-           file.settings['COMPILER_FLAGS'] = flags.join(' ')
+         next unless file.settings&.dig('COMPILER_FLAGS')&.include?('-GCC_WARN_INHIBIT_ALL_WARNINGS')
+         file.settings['COMPILER_FLAGS'] = file.settings['COMPILER_FLAGS'].gsub('-GCC_WARN_INHIBIT_ALL_WARNINGS', '').strip
        end
      end
    end
  end

This refactoring:

  1. Uses start_with? for more flexible target matching
  2. Simplifies the flag removal logic
  3. Uses safe navigation operators
  4. Reduces unnecessary string splitting and joining
DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataClass.h (2)

23-24: LGTM: Clean class declaration following Core Data patterns.

The class is properly declared as a subclass of DSSpecialTransactionEntity. Properties are correctly separated into the CoreDataProperties file, following Core Data best practices.

Consider documenting the purpose of this entity class and its relationship with asset lock transactions in a class-level comment for better maintainability.


26-39: Consider grouping related methods for better readability.

While these are Core Data generated accessors, consider organizing them into logical groups with pragma marks:

  • Single object operations (insert/remove/replace)
  • Bulk operations (insertCreditOutputs/removeCreditOutputs)
  • Convenience methods (add/remove)
 @interface DSAssetLockTransactionEntity (CoreDataGeneratedAccessors)
 
+#pragma mark - Single Object Operations
 - (void)insertObject:(DSTxOutputEntity *)value inCreditOutputsAtIndex:(NSUInteger)idx;
 - (void)removeObjectFromCreditOutputsAtIndex:(NSUInteger)idx;
+- (void)replaceObjectInCreditOutputsAtIndex:(NSUInteger)idx withObject:(DSTxOutputEntity *)value;
+
+#pragma mark - Bulk Operations
 - (void)insertCreditOutputs:(NSArray<DSTxOutputEntity *> *)value atIndexes:(NSIndexSet *)indexes;
 - (void)removeCreditOutputsAtIndexes:(NSIndexSet *)indexes;
- - (void)replaceObjectInCreditOutputsAtIndex:(NSUInteger)idx withObject:(DSTxOutputEntity *)value;
 - (void)replaceCreditOutputsAtIndexes:(NSIndexSet *)indexes withOutputs:(NSArray<DSTxOutputEntity *> *)values;
+
+#pragma mark - Convenience Methods
 - (void)addCreditOutputsObject:(DSTxOutputEntity *)value;
 - (void)removeCreditOutputsObject:(DSTxOutputEntity *)value;
 - (void)addCreditOutputs:(NSOrderedSet<DSTxOutputEntity *> *)values;
 - (void)removeCreditOutputs:(NSOrderedSet<DSTxOutputEntity *> *)values;
.github/workflows/build.yml (2)

55-62: Refactor to eliminate redundancy in scheme name.

The scheme name 'DashSync-Example' is duplicated in both the environment variable and the xcodebuild command. Consider using the environment variable in the command for better maintainability.

  env:
    scheme: ${{ 'DashSync-Example' }}
    platform: ${{ 'iOS Simulator' }}
  run: |
    xcodebuild build \
-     -scheme "DashSync-Example" \
+     -scheme "$scheme" \
      -workspace "DashSync.xcworkspace" \
      -destination "platform=$platform,name=iPhone 13" \
      CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED=NO
🧰 Tools
🪛 yamllint

[error] 62-62: no new line character at the end of file

(new-line-at-end-of-file)


62-62: Add newline at end of file.

Add a newline character at the end of the file to comply with YAML best practices.

      CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED=NO
+
🧰 Tools
🪛 yamllint

[error] 62-62: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/coverage.yml (1)

Line range hint 1-89: Consider workflow stability improvements

While the current workflow is functional, consider these improvements for better stability and maintainability:

  1. Pin the macOS runner version instead of using macOS-latest
  2. Use matrix testing for multiple iOS simulator versions instead of hardcoding iPhone 13
  3. Add timeout limits for the workflow and individual steps

Example improvements:

 jobs:
   build:
     name: Code coverage
-    runs-on: macOS-latest
+    runs-on: macos-13
+    timeout-minutes: 60
+    strategy:
+      matrix:
+        device: ['iPhone 14', 'iPhone 13']
     steps:
       - name: Install automake
+        timeout-minutes: 5
         run: |
           brew install automake

Then update the test commands to use ${{ matrix.device }} instead of hardcoded "iPhone 13".

DashSync/shared/Models/Persistence/Migration/Internal/DSCoreDataMigrationVersion.h (1)

44-44: Document the changes requiring this migration.

Since this is a Core Data model update, it would be helpful to document what schema changes necessitated this version bump.

Consider adding a comment above the enum value describing the key changes introduced in version 21, similar to:

+    // Version 21: Added support for asset unlock transactions
     DSCoreDataMigrationVersionValue_21 = 21,
DashSync.podspec (1)

37-37: Document version upgrade impact

Consider adding release notes or updating the changelog to document the implications of upgrading DashSharedCore, particularly regarding:

  • Disabled development features
  • Any breaking changes
  • New asset unlock transaction support
.github/workflows/e2eTestsTestnet.yml (3)

51-61: LGTM: Build configuration is well-structured.

The changes improve clarity with:

  • Descriptive step name
  • Proper code signing configuration for simulator builds
  • Better command formatting

Consider using the environment variable $scheme in the xcodebuild command for consistency:

-            -scheme "DashSync-Example" \
+            -scheme "$scheme" \

65-72: LGTM: Test configuration is properly structured.

Good improvements in command formatting and explicit test plan specification.

Consider using the environment variable $scheme in the xcodebuild command for consistency:

-            -scheme "DashSync-Example" \
+            -scheme "$scheme" \
🧰 Tools
🪛 yamllint

[error] 72-72: no new line character at the end of file

(new-line-at-end-of-file)


72-72: Add newline at end of file.

YAML files should end with a newline character to comply with POSIX standards and avoid potential issues with some tools.

Add a newline after the last line:

            -testPlan TestnetE2ETests
+
🧰 Tools
🪛 yamllint

[error] 72-72: no new line character at the end of file

(new-line-at-end-of-file)

DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataClass.m (1)

28-64: Consider adding documentation about the asset unlock transaction workflow.

Since this implements a new transaction type, it would be helpful to add:

  1. Class-level documentation explaining the purpose and lifecycle of asset unlock transactions
  2. Property documentation explaining the significance of each field (specialTransactionVersion, index, fee, etc.)
  3. Method documentation describing the expected inputs and potential error conditions

This would help maintainers understand the business logic and constraints of asset unlock transactions.

.github/workflows/network.yml (1)

79-79: Add newline at end of file

Add a newline character at the end of the file to comply with YAML best practices.

   compression-level: 6  # Default, adjust as needed
+
🧰 Tools
🪛 yamllint

[error] 79-79: no new line character at the end of file

(new-line-at-end-of-file)

DashSync/shared/Models/Persistence/Migration/Internal/DSCoreDataMigrationVersion.m (1)

23-23: Consider documenting migration changes

Given that this is a significant Core Data model update supporting new features (asset unlock transactions), it would be helpful to document the changes that necessitated this version bump.

Add a comment block above the version change explaining the major changes in version 21:

+ // Version 21:
+ // - Added support for asset unlock transactions
+ // - [Add other significant changes here]
  return DSCoreDataMigrationVersionValue_21;

Also applies to: 48-48

DashSync/shared/Models/Managers/Chain Managers/DSBackgroundManager.m (1)

89-93: Consider refining the hasValidHeadersTask implementation.

The current implementation has a few potential issues to consider:

  1. The method returns true when the app is not in background state, which might be too permissive and doesn't align with the method name's implication of only checking header tasks.
  2. The non-iOS return value uses 'FALSE' instead of the more conventional 'NO' in Objective-C.

Consider this alternative implementation:

#if TARGET_OS_IOS
-    return self.terminalHeadersSaveTaskId != UIBackgroundTaskInvalid || [UIApplication sharedApplication].applicationState != UIApplicationStateBackground;
+    return self.terminalHeadersSaveTaskId != UIBackgroundTaskInvalid;
#else
-    return FALSE;
+    return NO;
#endif
.github/workflows/test.yml (2)

59-71: Consider parameterizing the iPhone simulator model.

While the build configuration is correct, hardcoding iPhone 13 as the simulator device might cause issues when testing with newer iOS versions. Consider making it a workflow parameter.

name: Tests

on:
  push:
    branches:
      - master
      - develop
      - nightly
  pull_request:
    branches:
      - master
      - develop

+env:
+  DEFAULT_SIMULATOR: 'iPhone 13'

jobs:
  build:
    name: Test on iPhone simulator
    runs-on: macOS-latest
+    inputs:
+      simulator-device:
+        description: 'iPhone simulator device to use'
+        required: false
+        default: ${{ env.DEFAULT_SIMULATOR }}

Then use it in the build step:

-            -destination "platform=$platform,name=iPhone 13" \
+            -destination "platform=$platform,name=${{ inputs.simulator-device }}" \

210-210: Add newline at end of file.

Add a newline character at the end of the file to follow YAML best practices.

🧰 Tools
🪛 yamllint

[error] 210-210: no new line character at the end of file

(new-line-at-end-of-file)

DashSync/shared/Models/Notifications/DSSyncState.m (2)

Line range hint 64-79: Consider sync state tracking for asset unlock transactions

Given that this PR adds support for asset unlock transactions, consider whether the sync progress calculations need to account for these new transaction types. The combinedSyncProgress method currently weights different sync components (chain, terminal, masternode), but might need adjustments to properly track and report progress for asset unlock synchronization.

Also applies to: 156-182


Based on the shell script results, I can now generate the final response:

Property type mismatch detected between declaration and usage

The storedCount property is declared as double in DSSyncState.h, which matches the %f format specifier. However, there are inconsistencies in its usage:

  • In DSMasternodeListStore.m and DSMasternodeManager.m, storedCount is being assigned integer values from count operations
  • In DSSyncState.m, it's being read as uint32_t storedCount = self.masternodeListSyncInfo.storedCount

These integer-to-double conversions may lead to precision issues or unintended behavior. Consider:

  • Using consistent integer type if fractional values aren't needed
  • Adding documentation explaining why double precision is required
  • Updating all usage sites to handle floating-point values appropriately
🔗 Analysis chain

Line range hint 31-35: Verify type consistency for storedCount property

The format specifier change from %u to %f suggests storedCount is now a floating-point value. However, this change might need corresponding updates:

  1. Verify the property declaration matches this new type
  2. Ensure all methods using storedCount handle floating-point values correctly
  3. Consider documenting why fractional values are needed for stored counts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for storedCount property declaration and usage
echo "Searching for storedCount property declaration:"
rg -A 2 "storedCount" --type objc

echo "\nSearching for methods using storedCount:"
ast-grep --pattern 'self.storedCount' 

Length of output: 4585

DashSync/shared/Models/Wallet/DSSpecialTransactionsWalletHolder.m (2)

161-172: Optimize asset transaction registration code.

The transaction registration code can be simplified by removing unnecessary variable declarations.

Consider this more concise implementation:

     } else if ([transaction isMemberOfClass:[DSAssetLockTransaction class]]) {
-        DSAssetLockTransaction *assetLockTransaction = (DSAssetLockTransaction *)transaction;
-        if (![self.assetLockTransactions objectForKey:uint256_data(assetLockTransaction.txHash)]) {
+        if (![self.assetLockTransactions objectForKey:uint256_data(transaction.txHash)]) {
-            [self.assetLockTransactions setObject:transaction forKey:uint256_data(assetLockTransaction.txHash)];
+            [self.assetLockTransactions setObject:transaction forKey:uint256_data(transaction.txHash)];
             added = TRUE;
         }
     } else if ([transaction isMemberOfClass:[DSAssetUnlockTransaction class]]) {
-        DSAssetUnlockTransaction *assetUnlockTransaction = (DSAssetUnlockTransaction *)transaction;
-        if (![self.assetUnlockTransactions objectForKey:uint256_data(assetUnlockTransaction.txHash)]) {
+        if (![self.assetUnlockTransactions objectForKey:uint256_data(transaction.txHash)]) {
-            [self.assetUnlockTransactions setObject:transaction forKey:uint256_data(assetUnlockTransaction.txHash)];
+            [self.assetUnlockTransactions setObject:transaction forKey:uint256_data(transaction.txHash)];
             added = TRUE;
         }

217-222: Optimize asset transaction loading code.

Similar to the registration code, the loading code can be simplified by removing unnecessary variable declarations.

Consider this more concise implementation:

             } else if ([transaction isMemberOfClass:[DSAssetLockTransaction class]]) {
-                DSAssetLockTransaction *assetLockTransaction = (DSAssetLockTransaction *)transaction;
-                [self.assetLockTransactions setObject:transaction forKey:uint256_data(assetLockTransaction.txHash)];
+                [self.assetLockTransactions setObject:transaction forKey:uint256_data(transaction.txHash)];
             } else if ([transaction isMemberOfClass:[DSAssetUnlockTransaction class]]) {
-                DSAssetUnlockTransaction *assetUnlockTransaction = (DSAssetUnlockTransaction *)transaction;
-                [self.assetUnlockTransactions setObject:transaction forKey:uint256_data(assetUnlockTransaction.txHash)];
+                [self.assetUnlockTransactions setObject:transaction forKey:uint256_data(transaction.txHash)];
DashSync/shared/Models/Managers/Service Managers/DSPriceManager.m (2)

210-210: Consider adding debug logging for currency updates.

While the validation logic is solid, adding debug logs when currency codes or prices are invalid would help with troubleshooting issues in production.

 if ([self.pricesByCode objectForKey:code] && [DSAuthenticationManager sharedInstance].secureTime + 3 * DAY_TIME_INTERVAL > [NSDate timeIntervalSince1970]) {
     DSCurrencyPriceObject *priceObject = self.pricesByCode[code];
     self.localCurrencyDashPrice = priceObject.price;
 } else {
+    NSLog(@"[Debug] Setting zero price for currency %@ (valid price object: %d, secure time valid: %d)",
+          code,
+          [self.pricesByCode objectForKey:code] != nil,
+          [DSAuthenticationManager sharedInstance].secureTime + 3 * DAY_TIME_INTERVAL > [NSDate timeIntervalSince1970]);
     self.localCurrencyDashPrice = @(0);
 }

Also applies to: 210-210


210-210: Consider extracting volatility calculation logic.

The price volatility detection logic could be moved to a separate method for better testability and reusability. This would also make the updatePrices method more focused on its primary responsibility.

-            strongSelf.isVolatile = lastRetrievalTime + VOLATILE_RATES_CUTTOFF_PERIOD > now && [self isDifferenceMoreThanFiftyPercentBetween:lastPrice and:newPrice];
+            strongSelf.isVolatile = [self isPriceVolatile:lastPrice
+                                                newPrice:newPrice
+                                      lastRetrievalTime:lastRetrievalTime
+                                            currentTime:now];

+ - (BOOL)isPriceVolatile:(NSNumber *)lastPrice
+                newPrice:(NSNumber *)newPrice
+      lastRetrievalTime:(NSInteger)lastRetrievalTime
+            currentTime:(NSInteger)currentTime {
+    return lastRetrievalTime + VOLATILE_RATES_CUTTOFF_PERIOD > currentTime &&
+           [self isDifferenceMoreThanFiftyPercentBetween:lastPrice and:newPrice];
+ }
DashSync/shared/Models/Transactions/Base/DSTransaction.m (1)

Line range hint 1-1024: Consider adding unit tests for asset unlock transaction signing.

While reviewing the entire file context, I notice that while we've added support for asset unlock transactions, we should ensure proper test coverage for this new transaction type, especially around the signature hashing process.

Would you like me to help generate unit tests for asset unlock transaction signing?

Example/Tests/DSTransactionTests.m (1)

95-99: Test coverage could be improved

The test method is quite basic and could benefit from additional test cases:

  1. Validate specific transaction properties after creation
  2. Test error cases with invalid data
  3. Add assertions for expected asset unlock behavior

Consider expanding the test with:

 - (void)testAssetUnlockTx {
     NSData *transactionData = @"030009000001a02ffa0d000000001976a9146641c13e0ee2ce2cdf70852bb7ae9853c01f29a988ac0000000091014e00000000000000be000000273e11004130304f40d1820b5e239baecd35249263b1206a1c76e66053ec39a04501000093d3851b6bda0518da51ff8932ef3570be20e7978369dd312947326e135004915c10b5fe0e31e572c40f41cdd941bed8115e314573faf472e1065ca370bdff486db8eaa6bbcba3943e6e5ada6a3c30dee70e39811814e59e1ffc54f3c9fca04f".hexToData;
     DSAssetUnlockTransaction *tx = [[DSAssetUnlockTransaction alloc] initWithMessage:transactionData onChain:[DSChain testnet]];
     XCTAssert(tx, @"Bad Asset Unlock Tx");
+    // Validate transaction properties
+    XCTAssertEqual(tx.version, 3, @"Incorrect version");
+    XCTAssertEqual(tx.type, 9, @"Incorrect transaction type");
+    
+    // Test error case
+    NSData *invalidData = [@"invalid" dataUsingEncoding:NSUTF8StringEncoding];
+    DSAssetUnlockTransaction *invalidTx = [[DSAssetUnlockTransaction alloc] initWithMessage:invalidData onChain:[DSChain testnet]];
+    XCTAssertNil(invalidTx, @"Should fail with invalid data");
 }
Example/DashSync.xcodeproj/project.pbxproj (1)

3420-3459: Review the extensive linker configuration for macOS target

The macOS target has been configured with comprehensive linking settings including:

  • All required system frameworks
  • Third-party dependencies
  • The new "-ld_classic" flag for compatibility

Note: The duplicate linker configurations in both Debug and Release configurations could be consolidated into a shared xcconfig file to improve maintainability.

Also applies to: 3487-3526

DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.m (1)

34-34: Remove the unused variable payloadLength

The variable payloadLength is declared with __unused, indicating it is not used within the method. For code clarity, consider removing this variable if it serves no purpose.

- __unused uint64_t payloadLength = [message varIntAtOffset:off length:&payloadLengthSize];
DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataClass.m (1)

46-49: Improve readability by separating index increment

To enhance code readability, increment the index variable idx outside of the method call.

Proposed change:

for (DSTxOutputEntity *e in creditOutputs) {
-     [e setAttributesFromTransaction:tx outputIndex:idx++ forTransactionEntity:self];
+     [e setAttributesFromTransaction:tx outputIndex:idx forTransactionEntity:self];
+     idx++;
}
DashSync/shared/Models/Transactions/Base/DSAssetUnlockTransaction.m (2)

26-64: Refactor length checks to improve maintainability

The repeated length checks with magic numbers (e.g., 1, 4, 8, 32, 96) can be refactored to enhance code readability and maintainability. Consider defining constants for the field sizes or creating a helper method to handle length validation.

Example using constants:

static const NSUInteger SPECIAL_TRANSACTION_VERSION_LENGTH = 1;
static const NSUInteger INDEX_LENGTH = 8;
static const NSUInteger FEE_LENGTH = 4;
static const NSUInteger REQUESTED_HEIGHT_LENGTH = 4;
static const NSUInteger QUORUM_HASH_LENGTH = 32;
static const NSUInteger QUORUM_SIGNATURE_LENGTH = 96;

Applying constants in length checks:

-if (length - off < 1) return nil;
+if (length - off < SPECIAL_TRANSACTION_VERSION_LENGTH) return nil;

...

-if (length - off < 96) return nil;
+if (length - off < QUORUM_SIGNATURE_LENGTH) return nil;

Alternatively, a helper method could be implemented:

- (BOOL)hasSufficientLength:(NSUInteger)requiredLength fromOffset:(NSUInteger)offset inMessage:(NSData *)message {
    return (message.length - offset) >= requiredLength;
}

And used as:

-if (length - off < 1) return nil;
+if (![self hasSufficientLength:SPECIAL_TRANSACTION_VERSION_LENGTH fromOffset:off inMessage:message]) return nil;

83-90: Review the use of @synchronized(self) for potential deadlocks

Using @synchronized(self) can lead to deadlocks if not managed carefully, especially if other parts of the code also synchronize on self. Consider using a dedicated lock object or another synchronization mechanism to minimize the risk.

Example using a dedicated lock object:

@interface DSAssetUnlockTransaction ()
@property (nonatomic, strong) NSObject *lockObject;
@end

@implementation DSAssetUnlockTransaction

- (instancetype)init {
    self = [super init];
    if (self) {
        _lockObject = [NSObject new];
    }
    return self;
}

...

- (NSData *)toDataWithSubscriptIndex:(NSUInteger)subscriptIndex {
    @synchronized(self.lockObject) {
        // existing code
    }
}
DashSync/shared/DashSync.xcdatamodeld/DashSync 21.xcdatamodel/contents (5)

11-32: Ensure consistent use of usesScalarValueType for numeric attributes in DSAddressEntity.

In DSAddressEntity, the numeric attributes identityIndex, index, and internal have usesScalarValueType="NO". To improve performance by avoiding the overhead of boxing/unboxing NSNumber, consider setting usesScalarValueType="YES" for these attributes.

Apply this diff to update usesScalarValueType:

 <attribute name="identityIndex" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
 <attribute name="index" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" indexed="YES" syncable="YES"/>
 <attribute name="internal" optional="YES" attributeType="Boolean" defaultValueString="0" usesScalarValueType="NO" indexed="YES" syncable="YES"/>
+<-- Change usesScalarValueType="NO" to usesScalarValueType="YES" for these attributes -->

281-282: Clarify the default value for height in DSMerkleBlockEntity.

The height attribute has a defaultValueString="2147483647", which is INT_MAX. This might be used as a placeholder for an unset height. Ensure that this default value does not conflict with valid block heights and that the application correctly interprets this value.


495-496: Use consistent representations for unset numeric values.

In DSTransactionHashEntity, blockHeight defaults to -1 to indicate an unset value, while elsewhere height defaults to 2147483647. For consistency and clarity, consider using a uniform method for representing unset numeric values across entities.


507-515: Set usesScalarValueType="YES" for numeric attributes in DSTxInputEntity.

The numeric attributes n and sequence have usesScalarValueType="NO". Setting this to YES can improve performance by reducing overhead.

Apply this diff:

 <attribute name="n" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" indexed="YES" syncable="YES"/>
 <attribute name="sequence" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
+<-- Change usesScalarValueType="NO" to usesScalarValueType="YES" -->

516-528: Review indexing on frequently queried attributes in DSTxOutputEntity.

Attributes like value might benefit from indexing if they are frequently used in queries. Assess whether adding indexed="YES" to value would improve query performance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c0bcaf0 and 881566f.

⛔ Files ignored due to path filters (1)
  • Example/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (39)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/coverage.yml (1 hunks)
  • .github/workflows/e2eTestsTestnet.yml (2 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/network.yml (3 hunks)
  • .github/workflows/syncTestMainnet.yml (1 hunks)
  • .github/workflows/syncTestTestnet.yml (2 hunks)
  • .github/workflows/test.yml (1 hunks)
  • DashSync.podspec (1 hunks)
  • DashSync/shared/DashSync.xcdatamodeld/.xccurrentversion (1 hunks)
  • DashSync/shared/DashSync.xcdatamodeld/DashSync 21.xcdatamodel/contents (1 hunks)
  • DashSync/shared/Models/Chain/DSChainConstants.h (1 hunks)
  • DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataClass.h (1 hunks)
  • DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataClass.m (1 hunks)
  • DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataProperties.h (1 hunks)
  • DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataProperties.m (1 hunks)
  • DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataClass.h (1 hunks)
  • DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataClass.m (1 hunks)
  • DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataProperties.h (1 hunks)
  • DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataProperties.m (1 hunks)
  • DashSync/shared/Models/Managers/Chain Managers/DSBackgroundManager.m (1 hunks)
  • DashSync/shared/Models/Managers/Service Managers/DSPriceManager.m (1 hunks)
  • DashSync/shared/Models/Masternode/DSMasternodeListService.m (3 hunks)
  • DashSync/shared/Models/Network/DSPeer.m (1 hunks)
  • DashSync/shared/Models/Notifications/DSSyncState.m (1 hunks)
  • DashSync/shared/Models/Persistence/Migration/Internal/DSCoreDataMigrationVersion.h (1 hunks)
  • DashSync/shared/Models/Persistence/Migration/Internal/DSCoreDataMigrationVersion.m (2 hunks)
  • DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.h (1 hunks)
  • DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.m (1 hunks)
  • DashSync/shared/Models/Transactions/Base/DSAssetUnlockTransaction.h (1 hunks)
  • DashSync/shared/Models/Transactions/Base/DSAssetUnlockTransaction.m (1 hunks)
  • DashSync/shared/Models/Transactions/Base/DSTransaction.m (2 hunks)
  • DashSync/shared/Models/Transactions/DSTransactionFactory.h (1 hunks)
  • DashSync/shared/Models/Transactions/DSTransactionFactory.m (3 hunks)
  • DashSync/shared/Models/Wallet/DSSpecialTransactionsWalletHolder.m (4 hunks)
  • Example/DashSync.xcodeproj/project.pbxproj (24 hunks)
  • Example/DashSync/DSTransactionDetailViewController.m (2 hunks)
  • Example/Podfile (2 hunks)
  • Example/Tests/DSTransactionTests.m (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • DashSync/shared/DashSync.xcdatamodeld/.xccurrentversion
  • DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataClass.h
🧰 Additional context used
🪛 yamllint
.github/workflows/build.yml

[error] 62-62: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/e2eTestsTestnet.yml

[error] 72-72: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/network.yml

[error] 79-79: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/syncTestTestnet.yml

[error] 73-73: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/test.yml

[error] 210-210: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (65)
DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataProperties.m (3)

1-16: LGTM: License header is complete and up-to-date.


18-20: LGTM: Implementation follows Core Data best practices.

The category implementation follows the standard Core Data pattern for property extensions.


20-27: Verify integration with transaction handling components.

Since this entity is part of the new asset lock/unlock transaction functionality, let's verify its integration with related components.

✅ Verification successful

The previous results show basic entity definition but we need to verify:

  1. The actual transaction factory integration
  2. Core Data model configuration
  3. Special transaction handling integration

This new script should help us gather more context about the integration points.


Integration verified - Asset Lock Transaction properly integrated with transaction handling components

The code shows proper integration:

  • Transaction Factory (DSTransactionFactory.m) correctly handles asset lock transactions by instantiating DSAssetLockTransaction
  • Special transaction handling is implemented with proper version support via specialTransactionVersion
  • Core Data entity properly maps between domain model and persistence:
    • Inherits from DSSpecialTransactionEntity
    • Handles credit outputs via NSOrderedSet relationship
    • Implements required attribute mapping methods
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of DSAssetLockTransactionEntity with related components

# Test 1: Check for proper usage in transaction factory
echo "Checking transaction factory integration..."
rg -A 5 "DSAssetLockTransactionEntity" --type objc

# Test 2: Verify test coverage
echo "Checking test coverage..."
fd -e m "DSTransactionTests" --exec rg -l "DSAssetLockTransactionEntity" {}

Length of output: 5979


Script:

#!/bin/bash
# Let's perform a more comprehensive check

# Check for transaction factory integration and usage
echo "Checking transaction factory and usage..."
rg -A 10 "DSAssetLockTransaction" --type objc

# Check for Core Data model definition
echo "Checking Core Data model definition..."
fd -e xcdatamodeld -x find {} -type f -name "*.xcdatamodel" -exec plutil -p {}/contents {} \; 2>/dev/null

# Check for special transaction handling
echo "Checking special transaction handling..."
rg -A 5 "specialTransactionVersion" --type objc

Length of output: 40684

DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataProperties.h (3)

1-16: LGTM: License header is complete and properly formatted.


29-31: LGTM: Interface and nullability context properly closed.


25-27: 🛠️ Refactor suggestion

Improve property declaration and documentation.

Several improvements can be made to the property declaration:

  1. Use strong instead of retain to follow modern Objective-C conventions
  2. Document the inverse relationship
  3. Add property documentation explaining the purpose of creditOutputs
 + (NSFetchRequest<DSAssetLockTransactionEntity *> *)fetchRequest;

-@property (nonatomic, retain) NSOrderedSet<DSTxOutputEntity *> *creditOutputs;
+/// The ordered set of credit outputs associated with this asset lock transaction.
+/// @note This is a one-to-many relationship with DSTxOutputEntity.
+@property (nonatomic, strong) NSOrderedSet<DSTxOutputEntity *> *creditOutputs;

Also, verify that the inverse relationship is properly set up in the Core Data model.

DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.h (1)

18-20: Consider importing only necessary headers.

The current imports seem appropriate, but verify if DSTransactionOutput.h is needed in the header or could be moved to the implementation file.

✅ Verification successful

Let me check the actual usage of DSTransactionOutput in the header file to make a proper determination.


The DSTransactionOutput.h import is required in the header file

The import of DSTransactionOutput.h is necessary in the header file as it's used in the property declaration @property (nonatomic, assign) NSMutableArray<DSTransactionOutput *> *creditOutputs;. The type information is needed for the interface definition and cannot be forward declared or moved to the implementation file.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if DSTransactionOutput is used in interface definition beyond the array property
rg -l "DSTransactionOutput" --type c --type objc

Length of output: 1064


Script:

#!/bin/bash
# Check the content of DSAssetLockTransaction.h to see how DSTransactionOutput is used
cat DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.h

Length of output: 1058

DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataProperties.m (3)

1-16: LGTM: License header is complete and properly formatted


18-20: LGTM: Category implementation follows Core Data conventions


26-30: LGTM: Core Data properties are properly declared

The dynamic properties align with the asset unlock transaction requirements. Let's verify the property declarations match the Core Data model.

✅ Verification successful

Let's also search for references to this entity in the codebase:

And let's check the header file to see the property declarations:


LGTM: Core Data properties match the model definition

The Core Data model (DashSync 21.xcdatamodel) perfectly matches the declared dynamic properties in both type and name:

  • index (Integer 64)
  • fee (Integer 32)
  • requestedHeight (Integer 32)
  • quorumHash (Binary)
  • quorumSignature (Binary)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Core Data model contains all declared properties
# Search for the entity definition in .xcdatamodeld files
fd -e xcdatamodeld -x find {} -name "*.xcdatamodel" -exec plutil -convert xml1 -o - {} \; | grep -A 10 "entity name=\"DSAssetUnlockTransactionEntity\""

Length of output: 190


Script:

#!/bin/bash
# Let's try a different approach to find the Core Data model files and their contents
# First, find all xcdatamodeld directories
fd -e xcdatamodeld

# Then find all xcdatamodel files
fd -e xcdatamodel

# Finally, let's try to look for any XML or other files that might contain the entity definition
fd -t f -e xml . DashSync | grep -i "datamodel"

Length of output: 1441


Script:

#!/bin/bash
# Search for references to DSAssetUnlockTransactionEntity
rg "DSAssetUnlockTransactionEntity" -A 5 -B 5

Length of output: 9455


Script:

#!/bin/bash
# Find and show the header file content
fd "DSAssetUnlockTransactionEntity\+CoreDataProperties.h" -x cat {}

Length of output: 1226

DashSync/shared/Models/Transactions/DSTransactionFactory.h (1)

23-24: Verify handling of existing subscription transactions

The replacement of subscription transaction types with asset lock/unlock types could impact existing subscription transactions in the system.

Let's verify the usage and migration needs:

DashSync/shared/Models/Transactions/Base/DSAssetUnlockTransaction.h (2)

1-16: LGTM: License header is complete and up-to-date


18-20: LGTM: All required imports are present

DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataProperties.h (3)

1-16: LGTM: License header is complete and properly formatted


23-33: Consider Core Data migration strategy

As this is a new Core Data entity, ensure that:

  1. A migration strategy is in place for existing installations
  2. The model version is properly incremented
  3. The migration path is tested with existing user data
#!/bin/bash
# Check for Core Data model versions and migrations
fd -e xcdatamodeld -x ls -R {} \;

23-32: Add property documentation and consider data validation

The properties lack documentation explaining their purpose and valid value ranges. Consider:

  1. Adding documentation comments for each property
  2. Adding validation logic for the fee and requestedHeight values
  3. Implementing secure handling for sensitive quorum data

Example documentation format:

/**
 * The index of the asset unlock transaction.
 * This represents the position in the blockchain.
 */
@property (nonatomic, assign) uint64_t index;

/**
 * The transaction fee in satoshis.
 * Must be greater than zero and less than the maximum allowed fee.
 */
@property (nonatomic, assign) uint32_t fee;
.github/workflows/lint.yml (1)

23-23: LGTM! Upgrading actions/checkout is a good practice.

The upgrade from v2 to v3 of actions/checkout is a positive change that brings performance improvements and security fixes. This change aligns with similar updates made across other workflow files in this PR.

Let's verify that this is the only instance of actions/checkout in this file and that it's consistent with other workflow files:

✅ Verification successful

Upgrade of actions/checkout@v3 is consistent across all workflow files

The verification confirms that:

  • This is the only instance of actions/checkout in lint.yml
  • All workflow files (.github/workflows/*.yml) consistently use actions/checkout@v3
  • No legacy v2 versions remain in any workflow file
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency of actions/checkout versions across workflow files
# Expected: All workflow files should use v3

# Test 1: Check this file for any other checkout actions
echo "Checking lint.yml for checkout actions:"
rg "uses: actions/checkout@" .github/workflows/lint.yml

# Test 2: Check all workflow files for checkout versions
echo -e "\nChecking all workflow files for checkout versions:"
rg "uses: actions/checkout@" .github/workflows/

Length of output: 876

DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataClass.h (3)

1-17: LGTM: Well-documented file header with proper licensing.

The file header includes appropriate copyright information and a properly formatted MIT license notice.


41-43: LGTM: Proper Core Data file organization.

The file correctly closes the nullability context and follows Core Data patterns by importing the properties header at the end.


1-43: Verify integration with the transaction system.

As this is a new entity for asset lock transactions (mentioned in PR objectives), ensure it's properly integrated with:

  1. Transaction factory for creation
  2. Transaction processing pipeline
  3. Core Data migration if this is a model update
✅ Verification successful

Integration with transaction system is properly implemented

The verification shows comprehensive integration:

  1. Transaction Factory (DSTransactionFactory.m) properly handles asset lock transactions
  2. Special Transaction Wallet Holder (DSSpecialTransactionsWalletHolder.m) manages asset lock transactions in its collection
  3. Core Data implementation is complete with:
    • Base transaction class (DSAssetLockTransaction)
    • Entity class and properties
    • Generated accessors for credit outputs
    • Proper transaction type handling (DSTransactionType_AssetLock)
    • Core Data model versioning is in place (multiple versions present)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper integration of DSAssetLockTransactionEntity

# Test 1: Check if transaction factory handles this new type
echo "Checking transaction factory integration..."
rg -A 5 "DSAssetLockTransaction" --type objc

# Test 2: Check for Core Data model version updates
echo "Checking Core Data model updates..."
fd -e xcdatamodeld -x find {} -name "*.xcdatamodel"

Length of output: 16119

.github/workflows/build.yml (2)

21-21: LGTM: Good practice to upgrade actions/checkout.

The upgrade to actions/checkout@v3 brings security and performance improvements. This change is consistently applied across all workflow files.


49-49: LGTM: Improved step naming clarity.

The step name "Build dependencies" is more descriptive and better reflects the actual operation being performed.

.github/workflows/syncTestMainnet.yml (1)

22-22: LGTM! Beneficial upgrade to actions/checkout@v3.

The upgrade from v2 to v3 brings performance improvements and enhanced security features. This change aligns with best practices.

Let's verify that this upgrade has been consistently applied across all workflow files:

✅ Verification successful

✓ Confirmed: actions/checkout@v3 upgrade is consistently applied

The verification shows that actions/checkout@v3 is now used uniformly across all workflow files:

  • build.yml
  • coverage.yml
  • e2eTestsTestnet.yml
  • lint.yml
  • network.yml
  • syncTestMainnet.yml
  • syncTestTestnet.yml
  • test.yml
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining v2 instances of actions/checkout
# Expect: No occurrences of actions/checkout@v2 in workflow files

echo "Checking for any remaining v2 instances of actions/checkout..."
rg -l "actions/checkout@v2" .github/workflows/

Length of output: 181


Script:

#!/bin/bash
# Let's try a different approach to check all workflow files for actions/checkout versions
echo "Listing all actions/checkout versions in workflow files:"
rg -A1 "uses:\s+actions/checkout@" .github/workflows/

Length of output: 1097

.github/workflows/coverage.yml (1)

21-21: LGTM! Good upgrade to actions/checkout@v3

The upgrade to actions/checkout@v3 is a positive change that brings performance improvements and security enhancements.

DashSync/shared/Models/Persistence/Migration/Internal/DSCoreDataMigrationVersion.h (1)

44-44: LGTM! Verify migration path from version 20.

The enum addition follows the established pattern. However, as this is a Core Data model version change, we should ensure proper migration handling.

Let's verify the migration setup:

✅ Verification successful

Migration path verified - New entities added for Asset Lock functionality

The Core Data model version 21 introduces two new entities with proper relationships:

  • DSAssetLockTransactionEntity for handling asset lock transactions
  • DSAssetUnlockTransactionEntity for managing asset unlock transactions with quorum validation

The changes follow the established patterns and include:

  • Proper parent-child relationship with DSSpecialTransactionEntity
  • Correct relationship setup between entities
  • Appropriate attribute types and optionality

Since these are new entities and don't modify existing ones, lightweight migration will handle this change automatically.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for migration mapping model and xcdatamodel
# Expected: Find corresponding model files for version 21

# Look for mapping model files
echo "Checking for mapping model files..."
fd -e xcmappingmodel . | grep -i "21"

# Look for data model files
echo "Checking for data model files..."
fd -e xcdatamodel . | grep -i "21"

Length of output: 291


Script:

#!/bin/bash
# Let's verify the migration setup more thoroughly

# 1. Check if there's a mapping model from version 20 to 21
echo "=== Checking mapping model content ==="
fd -e xcmappingmodel . -x ls -la {}

# 2. Look at the model changes in version 21
echo -e "\n=== Examining model version 21 contents ==="
find DashSync/shared/DashSync.xcdatamodeld/DashSync\ 21.xcdatamodel/ -type f -name "contents" -exec cat {} \;

# 3. Check migration code in implementation
echo -e "\n=== Checking migration implementation ==="
rg -A 5 "case DSCoreDataMigrationVersionValue_21:" 

Length of output: 65292


Script:

#!/bin/bash
# Let's check for any changes in the model between version 20 and 21

# 1. Check for version 20 model
echo "=== Checking version 20 model ==="
find DashSync/shared/DashSync.xcdatamodeld/DashSync\ 20.xcdatamodel/ -type f -name "contents" -exec cat {} \;

# 2. Check migration manager implementation
echo -e "\n=== Checking migration manager implementation ==="
rg -A 10 "migrationSteps.*DSCoreDataMigrationVersionValue_21" 

Length of output: 62895


Script:

#!/bin/bash
# Let's check for any new entities or changes in version 21

# 1. Look for new entities in version 21
echo "=== Checking for new entities in version 21 ==="
rg -A 5 "DSAssetLockTransactionEntity" DashSync/shared/DashSync.xcdatamodeld/DashSync\ 21.xcdatamodel/contents

# 2. Look for new entities in version 21
echo -e "\n=== Checking for new entities in version 21 ==="
rg -A 5 "DSAssetUnlockTransactionEntity" DashSync/shared/DashSync.xcdatamodeld/DashSync\ 21.xcdatamodel/contents

# 3. Check for migration implementation
echo -e "\n=== Checking migration implementation ==="
rg "DSCoreDataMigrationVersionValue_21" --type objc

Length of output: 3494

DashSync.podspec (1)

37-37: Verify compatibility with DashSharedCore 0.4.19

The dependency version update looks good, but let's ensure compatibility with the new version.

✅ Verification successful

Based on the git history and references found, I can now generate the final response:

DashSharedCore version update appears safe and intentional

The version bump from 0.4.18 to 0.4.19 follows a consistent pattern of incremental updates, with each change properly committed and documented. The git history shows regular version updates with specific purposes (e.g., core protocol changes, optimizations). The update is also consistently reflected in the Podfile.lock, indicating proper dependency resolution.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes or compatibility issues

# Test 1: Look for any migration guides or breaking changes in documentation
echo "Checking for migration documentation..."
fd -g "MIGRATION*.md" -g "CHANGELOG*.md" -g "BREAKING*.md"

# Test 2: Check if the specific version tag exists in DashSharedCore
echo "Verifying version tag in DashSharedCore..."
gh release view 0.4.19 --repo dashpay/dashsync-iOS || echo "Version 0.4.19 release not found"

Length of output: 550


Script:

#!/bin/bash
# Let's try a different approach to verify the dependency version

# Check if DashSharedCore is referenced in other files
echo "Checking DashSharedCore references..."
rg "DashSharedCore" -A 2 -B 2

# Look for any version references
echo "Checking version references..."
rg "0\.4\.(16|17|18|19)" -A 1 -B 1

# Check podspec history
echo "Checking git history for podspec changes..."
git log -p -- DashSync.podspec | grep -A 5 -B 5 "DashSharedCore"

Length of output: 31253

.github/workflows/e2eTestsTestnet.yml (1)

23-23: LGTM: Good practice to upgrade actions/checkout to v3.

The upgrade brings performance improvements and better security features.

.github/workflows/syncTestTestnet.yml (1)

32-32: LGTM: Good upgrade to actions/cache@v3

The upgrade from v2 to v3 follows best practices for GitHub Actions and improves security and performance.

DashSync/shared/Models/Entities/DSAssetUnlockTransactionEntity+CoreDataClass.m (2)

1-27: LGTM: Well-structured header with appropriate licensing and imports.

The file header includes proper copyright notice, MIT license details, and all necessary imports for the implementation.


60-62: LGTM: Clean and straightforward implementation.

The method correctly returns the expected transaction class type.

.github/workflows/network.yml (3)

20-20: LGTM: Good practice to upgrade actions/checkout to v3

The upgrade brings performance improvements and better security features.


47-47: LGTM: Improved step naming clarity

The rename from "Dependencies" to "Build Dependencies" better describes the step's purpose and maintains consistency with other workflow files.


74-79: LGTM: Enhanced artifact upload configuration

Good improvements:

  • Upgraded to actions/upload-artifact@v4
  • Added explicit retention period
  • Specified compression level
🧰 Tools
🪛 yamllint

[error] 79-79: no new line character at the end of file

(new-line-at-end-of-file)

DashSync/shared/Models/Persistence/Migration/Internal/DSCoreDataMigrationVersion.m (2)

48-48: LGTM! Model resource mapping follows convention

The addition of version 21 follows the established naming pattern and maintains consistency with previous versions.

Let's verify no versions are skipped in the sequence:

#!/bin/bash
# Description: Verify Core Data migration version sequence is continuous

# Extract and check version numbers
rg -o 'DSCoreDataMigrationVersionValue_\d+' "$PWD/DashSync/shared/Models/Persistence/Migration/Internal/DSCoreDataMigrationVersion.[hm]" | sort -u | awk -F'_' '{print $2}' | awk '
BEGIN { prev=0 }
{
  if ($1 != prev + 1) {
    print "Gap detected between version " prev " and " $1
    exit 1
  }
  prev=$1
}
'

23-23: Verify Core Data model version 21 exists

The increment of Core Data migration version is a critical change that requires corresponding model files and migration paths to be in place.

Let's verify the existence of required files:

✅ Verification successful

Core Data model version 21 is properly set up

The verification shows that:

  • The Core Data model version 21 exists at DashSync/shared/DashSync.xcdatamodeld/DashSync 21.xcdatamodel/
  • The version enum DSCoreDataMigrationVersionValue_21 is properly defined in the header file
  • The modelResourceForVersion: method correctly handles version 21 by returning "DashSync 21"
  • All versions from 1 to 21 are present in sequential order without gaps

While there's only one mapping model file (MappingFrom6To7Model), this is not a concern as Core Data can perform automatic lightweight migrations when the model changes are compatible.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Core Data model version 21 exists and migration paths are in place

# Check for model version 21
echo "Checking for Core Data model version 21..."
fd -e xcdatamodel "DashSync 21"

# Look for migration mapping files
echo "Checking for migration mapping files..."
fd -e xcmappingmodel . | grep -i "DashSync.*20.*21"

Length of output: 468


Script:

#!/bin/bash
# Let's try a different approach to verify Core Data model files

# First, let's check for any xcdatamodel files
echo "Checking for all Core Data model files..."
fd -e xcdatamodel

# Then check for mapping model files
echo "Checking for all mapping model files..."
fd -e xcmappingmodel

# Let's also check the content of the DSCoreDataMigrationVersion files
echo "Checking version definitions..."
rg -A 5 "DSCoreDataMigrationVersionValue_\d+" --type objc

# Look for model resource method implementation
echo "Checking model resource implementation..."
rg "modelResourceForVersion" --type objc -A 10

Length of output: 15979

DashSync/shared/Models/Managers/Chain Managers/DSBackgroundManager.m (1)

Line range hint 1-93: Consider adding documentation and improving background task handling.

While the implementation is generally solid, consider the following architectural improvements:

  1. Add documentation about the threading model and when these methods should be called
  2. Consider storing the expiration handlers as properties to prevent potential retain cycles or premature releases
  3. Add logging for background task state transitions to aid in debugging

Let's verify the usage of this class across the codebase to ensure proper handling:

DashSync/shared/Models/Chain/DSChainConstants.h (2)

34-34: Protocol version update looks good but needs verification.

The protocol version increment from 70232 to 70233 across all networks (MAINNET, TESTNET, DEVNET) appears to be a coordinated update. The minimum protocol versions remain unchanged at 70228, maintaining backward compatibility.

Let's verify this change aligns with the core protocol:

Also applies to: 37-37, 40-40


34-41: Verify the implications of fixed version boundaries.

The minimum protocol versions (70228) and version boundaries are maintained, which aligns with the PR objective of "Disabling upper core protocol boundaries". However, we should verify if this affects the asset unlock transaction support mentioned in the PR objectives.

Let's check for any version-dependent asset unlock implementations:

✅ Verification successful

Let me gather more information about version-dependent transaction handling to verify if the protocol version changes affect asset unlock transactions.


Let me try a different search strategy to find version-dependent code in the transaction files:


Based on the findings, I can now provide the final response:

Fixed protocol version boundaries are safe for asset unlock transactions

The codebase analysis shows that asset unlock transactions are not dependent on specific protocol version boundaries. The transaction versioning is handled at the message level (version < 3 check in TransactionFactory) which is separate from the network protocol versions being modified. The changes to protocol version boundaries in DSChainConstants.h maintain backward compatibility with the minimum version (70228) while removing upper bounds, which doesn't impact asset unlock transaction functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for asset unlock transaction implementations
# Expected: Should find relevant asset unlock transaction code

# Search for asset unlock related code
rg -i "asset.*unlock.*transaction"

# Search for transaction type definitions that might include asset unlocks
ast-grep --pattern 'typedef enum {
  $$$
  DSTransactionType$_ = $_,
  $$$
}'

Length of output: 5539


Script:

#!/bin/bash
# Search for protocol version checks in transaction handling
rg -i "protocol.*version" -A 3 "DSAssetUnlockTransaction"

# Search for version-dependent transaction validation
rg -i "(version|protocol).*check" -A 3 "DSTransaction"

# Look for transaction type definitions and version requirements
ast-grep --pattern 'if ($version $_) {
  $$$
}'

Length of output: 281


Script:

#!/bin/bash
# Search for protocol version checks in transaction files
rg -i "protocol.*version|version.*check" DashSync/shared/Models/Transactions/

# Search for minimum version requirements in transaction handling
rg -i "min.*protocol.*version|version.*require" DashSync/shared/Models/Transactions/

# Look for version validation in transaction factory
rg -i "version" DashSync/shared/Models/Transactions/DSTransactionFactory.m

Length of output: 974

DashSync/shared/Models/Transactions/DSTransactionFactory.m (4)

8-9: LGTM: Import statements for new transaction types

The new imports are properly placed and follow the project's naming conventions.


78-81: Verify impact of subscription transaction type removal

While the new asset transaction handling is correctly implemented, the removal of subscription transaction types (DSTransactionType_SubscriptionRegistration and DSTransactionType_SubscriptionTopUp) might impact existing functionality.

Let's verify if subscription transactions are still used elsewhere in the codebase:

#!/bin/bash
# Search for subscription transaction type usage
rg "DSTransactionType_SubscriptionRegistration|DSTransactionType_SubscriptionTopUp" -A 3

# Search for subscription-related transaction classes
fd -e h -e m "DSSubscription.*Transaction"

Line range hint 61-81: Ensure test coverage for new transaction types

While the implementation looks good, please ensure there are corresponding test cases for the new asset lock/unlock transaction types, particularly around:

  • Transaction creation from messages
  • Message handling configuration
  • Edge cases and error conditions

Let's check for test coverage:

#!/bin/bash
# Search for related test files
fd "DSTransactionTests|DSAssetLockTransactionTests|DSAssetUnlockTransactionTests" -e m

# Look for test methods related to asset transactions
rg "test.*Asset(Lock|Unlock)" -t objc

61-64: LGTM: Asset transaction type handling

The implementation follows the established pattern and maintains consistency with other transaction types.

Let's verify the existence of the factory methods being called:

✅ Verification successful

Let me search for the transaction classes and their implementations to verify the factory methods.


Let me check the implementation of these specific transaction classes.


Let me check the content of the AssetUnlock transaction class to complete the verification.


Factory methods for asset transactions are properly implemented

Both DSAssetLockTransaction and DSAssetUnlockTransaction classes inherit from DSTransaction and implement the required initWithMessage:onChain: method, which is called by the parent class's transactionWithMessage:onChain: factory method. The implementation follows the established pattern and correctly handles their respective transaction types.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the existence of transactionWithMessage:onChain: in the new transaction classes
ast-grep --pattern 'transactionWithMessage:$_onChain:$_' 

Length of output: 226


Script:

#!/bin/bash
# Search for the asset lock/unlock transaction class files
fd 'DSAssetLock.*Transaction' -t f

# Search for any implementation of transactionWithMessage method in these classes
rg 'transactionWithMessage.*onChain' -A 5

Length of output: 15317


Script:

#!/bin/bash
# Check the content of asset lock/unlock transaction class files
cat DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.h
cat DashSync/shared/Models/Transactions/Base/DSAssetLockTransaction.m

# Search for AssetUnlock transaction files
fd 'DSAssetUnlock.*Transaction' -t f

Length of output: 3954


Script:

#!/bin/bash
# Check the content of asset unlock transaction class files
cat DashSync/shared/Models/Transactions/Base/DSAssetUnlockTransaction.h
cat DashSync/shared/Models/Transactions/Base/DSAssetUnlockTransaction.m

Length of output: 4330

.github/workflows/test.yml (1)

22-58: LGTM! Well-structured CI optimization.

The changes improve CI efficiency through:

  • Git LFS caching mechanism
  • Pod dependencies caching
  • Required Rust targets for iOS development
DashSync/shared/Models/Notifications/DSSyncState.m (1)

Line range hint 64-79: LGTM: Format specifiers now correctly match return types

The changes to use %f format specifiers in the description method properly align with the double return types of the various progress calculation methods, improving type consistency in the logging output.

DashSync/shared/Models/Masternode/DSMasternodeListService.m (4)

264-264: LGTM: Type safety improvement

The explicit cast to uint32_t ensures type consistency with the masternodeListSyncInfo property.


278-278: LGTM: Consistent type casting

The explicit cast maintains type consistency throughout the codebase.


305-306: LGTM: Consistent type handling

The explicit casts complete the type safety improvements across the masternode list synchronization logic.


Line range hint 264-306: Verify masternode list size assumptions

While the type casting changes are safe, let's verify that the masternode list count assumptions are valid by checking historical data.

✅ Verification successful

Based on the gathered information, I can now provide a final response:

Type casting to uint32_t is safe for masternode list counts

The evidence from the codebase shows that masternode list sizes are well within 32-bit limits:

  • Test data shows masternode counts around 302 nodes (DSDeterministicMasternodeListTests.m)
  • The implementation aims to keep only 3 masternode lists in memory at a time (DSMasternodeListStore.m)
  • No hardcoded limits or boundary checks suggest concerns about large counts
  • The masternode cost is set at 100,000 DASH (MASTERNODE_COST = 100000000000), which naturally limits the total possible masternodes
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if masternode list counts in the codebase exceed or approach 32-bit limits

# Search for any hardcoded large masternode list sizes or test cases
rg -i "masternodelist.*count|masternodelist.*size" -A 2

# Look for test files containing masternode list initialization
fd -e m -e h -H "test|spec" | xargs rg "initWithMasternode.*List"

Length of output: 46688


Script:

#!/bin/bash
# Let's search for actual masternode list sizes in test data and implementation
# Look for test cases with specific masternode counts
rg -A 2 "validMasternodeCount.*=.*\d+" 

# Look for any hardcoded limits or array size checks related to masternodes
rg "MAX.*MASTERNODE|maxMasternode|MASTERNODE.*LIMIT"

# Search for any validation or boundary checks on masternode counts
ast-grep --pattern 'if ($_ > $_) {
  $$$
}'

Length of output: 677


Script:

#!/bin/bash
# Let's check the actual implementation of masternode list handling
# Look for the largest masternode list size in tests
rg -A 2 "masternodes.*count.*=.*\d+|masternodeList.*count.*=.*\d+"

# Check for any array size declarations or constants related to masternode lists
rg "#define.*MASTERNODE|static.*const.*masternode"

# Look for masternode list size validation in the implementation
ast-grep --pattern 'retrievalQueueMaxAmount = $_'

Length of output: 7497

DashSync/shared/Models/Wallet/DSSpecialTransactionsWalletHolder.m (1)

8-9: LGTM: Import statements are correctly added.

The new imports for asset lock and unlock transaction types are properly placed.

DashSync/shared/Models/Managers/Service Managers/DSPriceManager.m (1)

210-210: LGTM: Default currency fallback logic is well-placed.

The addition of storing the default currency code in user defaults when the system currency is not supported is a good defensive programming practice.

DashSync/shared/Models/Transactions/Base/DSTransaction.m (2)

31-31: LGTM: Import added for asset unlock transaction support.

The addition of DSAssetUnlockTransaction.h import aligns with the PR objective to support asset unlock transactions.


412-412: LGTM: Extended signature hashing support for asset unlock transactions.

The condition is properly extended to include asset unlock transactions in the signature hashing process, maintaining consistency with how other transaction types are handled.

Example/DashSync/DSTransactionDetailViewController.m (2)

9-10: LGTM: Import statements are properly added.

The new imports for asset lock/unlock transactions are correctly placed and necessary for the added functionality.


291-294: LGTM: Asset transaction type handling is properly implemented.

The new asset lock/unlock transaction type cases are correctly integrated into the switch statement and follow the existing pattern. The status labels are clear and descriptive.

Let's verify the complete implementation of these transaction types:

✅ Verification successful

Based on the search results, I can see that the asset lock/unlock transaction types are thoroughly implemented across the codebase:

  1. Core transaction classes (DSAssetLockTransaction and DSAssetUnlockTransaction) are properly defined with necessary properties and methods
  2. CoreData entities (DSAssetLockTransactionEntity and DSAssetUnlockTransactionEntity) are set up for persistence
  3. Transaction factory handles both transaction types
  4. Special transactions wallet holder manages both transaction types
  5. Transaction detail view controller properly displays both transaction types
  6. Test cases exist for these transaction types

The implementation appears complete and consistent throughout the codebase, with proper handling in all relevant components. The changes in the review are correctly integrated into the existing transaction type handling system.

Asset transaction types are properly implemented and integrated across the codebase

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of asset lock/unlock transactions
# Test: Search for references to ensure proper handling throughout the codebase

echo "Checking for asset lock transaction handling..."
rg -A 5 "DSAssetLockTransaction"

echo "Checking for asset unlock transaction handling..."
rg -A 5 "DSAssetUnlockTransaction"

# Check for any potential TODO comments related to these transactions
echo "Checking for related TODOs..."
rg -i "todo.*asset.*(?:lock|unlock)"

Length of output: 35894

Example/Tests/DSTransactionTests.m (3)

11-11: LGTM: Import statement for new test functionality

The addition of DSAssetUnlockTransaction.h import is appropriate for the new test method.


Line range hint 757-869: LGTM: Well-structured BIP69 test implementation

The test method provides comprehensive coverage of BIP69 transaction sorting with:

  • Clear test data setup
  • Proper validation of input/output sorting
  • Multiple assertions to verify behavior

Line range hint 293-755: Verify status of commented test methods

There are several commented out test methods that may need attention:

  • testInstantSendReceiveTransaction
  • testCreateBlockchainIdentityTransactionInputs
  • testTopupBlockchainIdentityTransactionInputs
  • testResetBlockchainIdentityTransactionInputs

Let's check if these tests are still relevant:

DashSync/shared/Models/Network/DSPeer.m (1)

886-886: Protocol version check modification needs documentation.

The removal of the upper protocol version boundary check aligns with the PR objectives. However, this change could have implications for compatibility with future protocol versions.

  1. Add a comment explaining why the upper bound check was removed:
-    if (self.version < self.chain.minProtocolVersion /*|| self.version > self.chain.protocolVersion*/) {
+    // Upper protocol version check disabled to maintain compatibility with future versions
+    // Lower bound still enforced to ensure basic protocol compatibility
+    if (self.version < self.chain.minProtocolVersion) {
  1. Let's verify the protocol version constants:
✅ Verification successful

Based on the shell script results, I can now provide a final response as the verification is complete. The results show:

  1. The protocol version checks are used consistently throughout the codebase
  2. The upper bound check removal is unique to DSPeer.m
  3. The minimum protocol version check is still enforced across all chains (mainnet, testnet, devnet)
  4. The change aligns with the codebase's protocol version handling architecture

Protocol version check modification is safe and intentional

The removal of the upper protocol version boundary check is a deliberate architectural decision that:

  • Maintains backward compatibility by keeping the minimum version check
  • Allows future protocol version compatibility without client updates
  • Follows the pattern used in other parts of the codebase where only minimum protocol versions are enforced
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check protocol version constants and their usage
# This helps understand the impact of removing the upper bound check

# Find protocol version definitions
echo "Protocol version definitions:"
rg -A 2 "protocolVersion|minProtocolVersion" --type objc

# Find protocol version checks
echo -e "\nProtocol version checks:"
rg "version [<=>]+ .*protocol" --type objc

Length of output: 49391

Example/DashSync.xcodeproj/project.pbxproj (3)

2812-2833: LGTM: Pod resource configuration is properly set up

The [CP] Copy Pods Resources build phase is correctly configured with all necessary resource bundles:

  • DashSync.bundle
  • Protobuf_Privacy.bundle
  • gRPCCertificates.bundle

3413-3413: Verify development team configuration

The development team is set to "VYNC8YJV73" for the NetworkInfo target. Ensure this is the correct team ID for your organization.

#!/bin/bash
# Check all development team configurations
rg "DEVELOPMENT_TEAM" --type=pbxproj

Also applies to: 3480-3480


1396-1398: Verify DashSharedCore.xcframework integration

The addition of DashSharedCore.xcframework and libDashSync-macOS.a suggests a significant dependency update. This aligns with the PR objective of updating dash-shared-core integration.

DashSync/shared/Models/Entities/DSAssetLockTransactionEntity+CoreDataClass.m (1)

3-3: Verify the copyright year

The file header states the year as 2024, which may not be accurate. Please verify and update the year if necessary.

DashSync/shared/DashSync.xcdatamodeld/DashSync 21.xcdatamodel/contents (3)

190-194: Confirm uniqueness constraints are sufficient in DSFriendRequestEntity.

The uniqueness constraint is set on friendshipIdentifier alone. Ensure that this uniquely identifies a friend request in all cases. If additional attributes are necessary to ensure uniqueness (e.g., source and destination contacts), consider updating the constraints.


87-114: 🛠️ Refactor suggestion

Review inconsistent deletion rules in DSChainEntity.

In DSChainEntity, relationships like accounts, blocks, contacts, contracts, and others have the deletion rule set to Cascade, while others like lastChainLock are set to Nullify. Ensure that the deletion rules align with the intended data lifecycle. Cascading deletions might remove more data than intended when a chain is deleted.

Consider if Cascade is appropriate for these relationships or if Nullify would prevent unintended data loss.


33-42: Verify the necessity of optional attributes in DSAssetUnlockTransactionEntity.

Attributes like fee, index, requestedHeight, quorumHash, and quorumSignature are marked as optional="YES". If these attributes are essential for the integrity of an DSAssetUnlockTransactionEntity, consider making them non-optional to enforce data completeness.

Run the following script to check for entities with missing critical attributes:

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
pankcuf and others added 4 commits November 8, 2024 15:51
…oreDataClass.m

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@pankcuf pankcuf requested a review from Syn-McJ November 8, 2024 09:15
Copy link
Member

@Syn-McJ Syn-McJ left a comment

Choose a reason for hiding this comment

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

looks good

@pankcuf pankcuf merged commit 9dba479 into master Nov 8, 2024
6 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants