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

Proposal: Implementing Versioning Across Application Serialization Structures #1838

Open
ajnavarro opened this issue Mar 25, 2024 · 2 comments
Assignees
Labels
breaking change Functionality that contains breaking changes in focus Core team is prioritizing this work 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@ajnavarro
Copy link
Contributor

Summary

We propose implementing versioning across various serialization structures within our application to enhance compatibility, maintainability, and future scalability. This entails versioning in three key areas:

Versioning RPC API:

Implementing versioning in RPC API endpoints by prefixing paths with version numbers (e.g., /api/v1, /api/v2) ensures backward compatibility while allowing for iterative updates and enhancements. This practice enables seamless transitions for clients using different versions of the API and facilitates the graceful evolution of the API over time.

Versioning Data Storage Format:

Introducing versioning to the storage format of our application's data enables smooth migrations when format changes occur. By incorporating version numbers into the data storage mechanism, we ensure that data remains accessible and usable across different versions of the application. This practice is essential for maintaining data integrity and ensuring uninterrupted operation during updates or migrations.

Versioning Data Structures for Inter-Node Communication:

Versioning complex data structures transmitted between nodes enhances interoperability and compatibility across distributed systems. By versioning these data structures, we can accommodate changes and updates without causing disruptions to the communication protocol.

Additional considerations

  • Documentation and Communication: Alongside implementation, comprehensive documentation should be provided to guide users and developers on handling versioned structures effectively.
  • Testing and Validation: Testing processes should be implemented to validate backward and forward compatibility across different versions of serialization structures. Automated testing suites can help ensure that versioning mechanisms function as intended and do not introduce regressions or compatibility issues.
  • Version Compatibility: It's imperative to emphasize that versioning structures do not imply a carte blanche to break compatibility with each version increment. Each version should be carefully specified, with thorough consideration given to backward and forward compatibility.
@ajnavarro ajnavarro added this to the 🏗4️⃣ test4.gno.land milestone Mar 25, 2024
@ajnavarro ajnavarro added breaking change Functionality that contains breaking changes 🌱 feature New update to Gno 📦 🤖 gnovm Issues or PRs gnovm related 📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related 🌟 improvement performance improvements, refactors ... labels Mar 25, 2024
@ajnavarro
Copy link
Contributor Author

Future Versioning Strategy Proposal

Description

After attempting to add a VERSION field to various public interfaces, I realized this approach was making the code less readable and generally worse without any real benefit. I propose we consider versioning only after V1, leaving V1 as it is at the final release.

Proposal

To handle versioning in future major versions, we need to consider the following aspects:

RPC APIs: Version Through Path, Not by version Method

Using the path for versioning allows clients time to update to the latest version while the previous versions remain available in subsequent releases. Versioning via a method (as we are doing right now) will break clients until they update to be compatible with new changes.

Data Storage Formats: Version in Header

Add a VERSION value in the header after a magic word identifying the file format or follow guidelines for the specific storage format used. For example, follow Protobuf/(Amino?) best practices:

Specifically, do not use the same schema for wire and storage.

Avoid Versioning Twice

Avoid having multiple versions for the same data. For instance, if an RPC endpoint is already versioned, adding an extra version for the returned object is unnecessary and discouraged.

Data Storage Migrations

Applications control their data storage systems. When a binary is updated, we can detect and initiate a migration process. This is a solved problem for various storage systems:

  • SQL:
  • Key/Value Storages: It's even simpler. Create a new DB file with a VERSION prefix containing all the data in the new format. If successful, the old database file can be removed by the node management team to prevent data loss if issues arise.

Other aspects to take care about

  • Documentation and Communication: Maintain detailed documentation for each API version, including migration guides and changelogs. Documentation is highly tied to code and must be versioned as the code is.
  • Versioning Policy: Adopt a clear versioning policy such as semantic versioning.
  • Monitoring and Analytics: Implement usage tracking for different API versions.
  • Security Considerations: Apply security patches to all supported versions and regularly review security practices.
  • Backward Compatibility Period: Define and communicate a standard period during which older versions will be supported post-release of a new version. This point is really important because if we decide to support too many versions, might be an important load when keeping up with bug fixes and security patches.

@linear linear bot removed 📦 🌐 tendermint v2 Issues or PRs tm2 related breaking change Functionality that contains breaking changes 📦 ⛰️ gno.land Issues or PRs gno.land package related 🌟 improvement performance improvements, refactors ... 🌱 feature New update to Gno 📦 🤖 gnovm Issues or PRs gnovm related labels Sep 11, 2024
@Kouteki Kouteki added breaking change Functionality that contains breaking changes 📦 🤖 gnovm Issues or PRs gnovm related 📦 ⛰️ gno.land Issues or PRs gno.land package related in focus Core team is prioritizing this work labels Oct 18, 2024
@zivkovicmilos zivkovicmilos added this to the 🚀 Mainnet launch milestone Oct 28, 2024
@ajnavarro
Copy link
Contributor Author

Summarizing the final decision for versioning: YOLO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Functionality that contains breaking changes in focus Core team is prioritizing this work 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: In Review
Development

No branches or pull requests

3 participants