You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: Checked every crate directly: 8 of the 10 contracts expose pub fn get_version(env: Env) -> String. analytics has no version function of any kind. upgrade has a differently shapedpub fn version(env: &Env) -> ContractVersion (returns a struct, takes &Env not Env) as part of its UpgradeManager. There is no shared convention.
Where:
analytics/src/lib.rs -- add a version function
upgrade/src/lib.rs -- decide whether UpgradeManager::version should also expose the standard get_version(env: Env) -> String shape, or whether the standard needs to accommodate it
The other 8 crates -- no code change expected, just confirm they match whatever convention is settled on
Reconcile upgrade's version() -- either add a matching get_version wrapper or explicitly document why upgrade is the exception.
Suggested approach:
Before changing anything, get agreement (even informally, in the PR description) on which shape wins: the 8-crate get_version(env: Env) -> String convention, or something closer to upgrade's ContractVersion-returning version(env: &Env). Recommend the former since it's already the majority pattern and simpler for callers.
Add get_version to analytics/src/lib.rs following the exact signature used in the other 8 crates.
For upgrade, either add a get_version wrapper that calls into the existing UpgradeManager::version internally, or document explicitly why upgrade is a deliberate exception (it manages versions for other contracts, which arguably justifies a different shape).
This is exactly the kind of "small" change that's easy to get subtly wrong across 10 files -- write a quick test or script that calls get_version (or whatever you land on) across all 10 crates and asserts they all respond, rather than eyeballing each one.
Context: Checked every crate directly: 8 of the 10 contracts expose
pub fn get_version(env: Env) -> String.analyticshas no version function of any kind.upgradehas a differently shapedpub fn version(env: &Env) -> ContractVersion(returns a struct, takes&EnvnotEnv) as part of itsUpgradeManager. There is no shared convention.Where:
analytics/src/lib.rs-- add a version functionupgrade/src/lib.rs-- decide whetherUpgradeManager::versionshould also expose the standardget_version(env: Env) -> Stringshape, or whether the standard needs to accommodate itWhat to do:
get_version(env: Env) -> Stringsince 8/10 crates already use it) and document it in the workspace rootCargo.tomlcomments or a newCONTRIBUTING.md(see Update workspace Cargo.toml/CONTRIBUTING notes with analytics-pivot event-schema expectations #50).analytics.upgrade'sversion()-- either add a matchingget_versionwrapper or explicitly document whyupgradeis the exception.Suggested approach:
get_version(env: Env) -> Stringconvention, or something closer toupgrade'sContractVersion-returningversion(env: &Env). Recommend the former since it's already the majority pattern and simpler for callers.get_versiontoanalytics/src/lib.rsfollowing the exact signature used in the other 8 crates.upgrade, either add aget_versionwrapper that calls into the existingUpgradeManager::versioninternally, or document explicitly whyupgradeis a deliberate exception (it manages versions for other contracts, which arguably justifies a different shape).CONTRIBUTING.md(Add an event schema versioning policy doc so the backend indexer doesn't break on upgrades #32) so the next new contract in this workspace follows it without a repeat of this inconsistency.Watch out for:
get_version(or whatever you land on) across all 10 crates and asserts they all respond, rather than eyeballing each one.Definition of done:
analyticsno longer lacks a version functionCargo.tomlcomments orCONTRIBUTING.md