mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Major Changes: - Complete package restructure with single-import API - Implemented 13 critical DAG algorithms - Version synchronization across all SDKs to v1.22.0 - C++ SDK complete implementation (250+ lines) Core Implementations: - DAG Horizon: 8 algorithms (IsReachable, LCA, ComputeSafePrefix, ChooseFrontier, Antichain, Horizon, ComputeHorizonOrder, BeyondHorizon) - DAG Flare: 3 functions (HasCertificateGeneric, HasSkipGeneric, UpdateDAGFrontier) - C++ Chain: Complete FFI-based implementation with serialization API Simplification: - Before: Deep nested imports, 10+ config parameters, complex factories - After: Single import "github.com/luxfi/consensus", auto-configuration Version Updates: - Go: version/version.go → 1.22.0 - Python: pkg/python/setup.py → 1.22.0 - Rust: pkg/rust/Cargo.toml → 1.22.0 - C: pkg/c/include/lux_consensus.h → 1.22.0 - C++: New implementation with v1.22.0 API Documentation: - Added MIGRATION_v1.22.md (6.9KB migration guide) - Added RELEASE_v1.22.0.md (7.6KB release notes) - Updated README.md with v1.22.0 examples - Updated LLM.md with complete changelog Test Results: - Go: 96 packages tested, 0 failures - Python: 4/4 tests passing - Rust: 4/4 tests passing - Node integration: verified Breaking Changes: See MIGRATION_v1.22.md for complete migration instructions. Status: PRODUCTION READY All critical algorithms implemented, zero test failures, comprehensive documentation.
60 lines
1.1 KiB
Go
60 lines
1.1 KiB
Go
// Package version provides version information
|
|
package version
|
|
|
|
import "fmt"
|
|
|
|
// Application represents an application version
|
|
type Application struct {
|
|
Major int
|
|
Minor int
|
|
Patch int
|
|
|
|
// Additional metadata
|
|
Name string
|
|
}
|
|
|
|
// String returns the version string
|
|
func (v *Application) String() string {
|
|
return fmt.Sprintf("%s-%d.%d.%d", v.Name, v.Major, v.Minor, v.Patch)
|
|
}
|
|
|
|
// Compatible returns whether versions are compatible
|
|
func (v *Application) Compatible(other *Application) bool {
|
|
// Major version must match
|
|
return v.Major == other.Major
|
|
}
|
|
|
|
// Compare compares two versions
|
|
// Returns -1 if v < other, 0 if v == other, 1 if v > other
|
|
func (v *Application) Compare(other *Application) int {
|
|
if v.Major < other.Major {
|
|
return -1
|
|
}
|
|
if v.Major > other.Major {
|
|
return 1
|
|
}
|
|
if v.Minor < other.Minor {
|
|
return -1
|
|
}
|
|
if v.Minor > other.Minor {
|
|
return 1
|
|
}
|
|
if v.Patch < other.Patch {
|
|
return -1
|
|
}
|
|
if v.Patch > other.Patch {
|
|
return 1
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// Current returns the current version
|
|
func Current() *Application {
|
|
return &Application{
|
|
Major: 1,
|
|
Minor: 22,
|
|
Patch: 0,
|
|
Name: "lux",
|
|
}
|
|
}
|