tlsn
tlsn copied to clipboard
Add version compatability
At the beginning of things, the prover and notary should exchange which versions they are running with each other. We can start using semver and both parties can check whether they support their peers' version.
Prover's Code
prover_version = "1.2.3" # Your software version
Notary's Code
notary_version = "1.2.0" # Notary's software version
Compare versions
def check_compatibility(v1, v2): major1, minor1, patch1 = map(int, v1.split(".")) major2, minor2, patch2 = map(int, v2.split("."))
if major1 != major2:
return False
if minor1 < minor2 or (minor1 == minor2 and patch1 < patch2):
return False
return True
Check compatibility
if check_compatibility(prover_version, notary_version): print("Versions are compatible. Proceed with verification.") else: print("Versions are not compatible. Please update software.")
like this?
For parsing and assertions, I had in mind to use this semver crate.
We would store the cargo package version as a static at build time:
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
Then introduce a new message variant to
https://github.com/tlsnotary/tlsn/blob/832d1baec1800a209433efa3a662c3bc4b8c13e6/tlsn/tlsn-core/src/msg.rs#L8-L17
which is used to exchange configuration information, including VERSION
, at the beginning of the protocol.
Addressed by https://github.com/tlsnotary/tlsn/pull/513.