Skip to content

# Breaking Change Without Deprecation: signTransaction Return Type Changed #2930

@tomachianura

Description

@tomachianura

Description

Breaking Change Without Deprecation: signTransaction Return Type Changed

Summary

The recent update to @hashgraph/sdk changed the return type of the signTransaction method from Uint8Array to SignatureMap without following proper deprecation protocols. This breaking change has significant negative impacts on applications using this method and requires substantial refactoring efforts.

Issue Description

In a recent version of @hashgraph/sdk, the following method signature was changed:

Before:

signTransaction(transaction: Transaction): Uint8Array;

After:

signTransaction(transaction: Transaction): SignatureMap;

This change was implemented on the same method name without any deprecation notice, migration path, or backward compatibility support. Modern software development practices recommend maintaining backward compatibility through proper deprecation cycles, especially for public-facing APIs.

Impact

This change has caused significant problems for our development team:

  1. Unexpected runtime errors occurred immediately after upgrading the SDK
  2. Our codebase required extensive refactoring to accommodate the new return type
  3. Development time was diverted from feature work to fixing integration issues
  4. Testing efforts had to be redirected to ensure the refactored code works correctly
  5. This compromised our release schedule and increased development costs

Suggested Solution

To maintain backward compatibility while introducing new functionality:

  1. Follow Proper Deprecation Protocol:

    • Mark the current method as deprecated with @deprecated annotations
    • Document the deprecation in release notes and README
    • Keep the original method functioning alongside the new one for at least one major version cycle
  2. Add New Method Instead of Changing Existing Method:

    // Keep original method
    signTransaction(transaction: Transaction): Uint8Array;
    
    // Add new method with clear naming
    signTransactionWithSignatureMap(transaction: Transaction): SignatureMap;
  3. Define a Deprecation Timeline:

    • Clearly communicate when the deprecated method will be removed
    • Provide migration guides for moving to the new method
    • Consider implementing console warnings when deprecated methods are used

Best Practices for SDK Evolution

For future reference, we recommend following these practices:

  1. Semantic Versioning: Follow SemVer strictly for all releases
  2. Change Log: Clearly document breaking changes in CHANGELOG.md
  3. Migration Guides: Provide step-by-step guidance for upgrading
  4. Deprecation Notices: Use proper annotations and runtime warnings
  5. Breaking Changes: Reserve breaking changes for major version updates

Conclusion

Breaking changes without proper deprecation cycles create significant overhead for developers using the SDK. By implementing a proper deprecation strategy, SDK maintainers can provide new functionality while respecting the investment users have made in existing implementations.

We respectfully request that the team considers reverting this change or providing backward compatibility until proper deprecation can be implemented in a future major version release.

Steps to reproduce

  1. install v0.44.0 or older
  2. create an engine/script to sign any transaction using the signTransaction method.
  3. update to version 0.51.0 or higher
  4. verify the back compatibility is broken, and you'll be forced to adapt your code.

Additional context

No response

Hedera network

No response

Version

v0.59.0

Operating system

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions