-
Notifications
You must be signed in to change notification settings - Fork 103
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
Expose libwasmvm version number at runtime #314
Conversation
b2f5430
to
6a45a00
Compare
6a45a00
to
0c9a20a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
api/version_test.go
Outdated
func TestLibwasmvmVersion(t *testing.T) { | ||
version, err := LibwasmvmVersion() | ||
require.NoError(t, err) | ||
require.Equal(t, "1.0.0", version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this have to be updated with every version change? Better to use a VERSION
tag or ref from somewhere. Perhaps some dirty code to parse the Cargo.toml
from Go? That, or do some structural checks here only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this is a leftover from development state. Ideally we use a simple regex here to ensure we get something sane.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 7235e1b
use std::ffi::CStr; | ||
|
||
#[test] | ||
fn version_works() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one to help debug infrastructure
/// | ||
/// The string is owned by libwasmvm and must not be mutated or destroyed by the caller. | ||
#[no_mangle] | ||
pub extern "C" fn version_str() -> *const c_char { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice
0c9a20a
to
326e010
Compare
Thank you for the reviews! |
Sometimes it's tricky for validators to get the correct .so file used with their binary. This happens when the binary is built on one system and is then deployed to multiple nodes. Go installs the .so to a very custom path in the Go installation system.
Now what we want to do is provide information of the Rust side (libwasmvm) at runtime. This way you can veryify that your wasmvm 1.2.3 dependency loaded the 1.2.3 shared library and not something old that was installed from last time such as 1.2.1.
Ideally we find a way to get this listed in the chain's long version output, e.g. in here
With this PR the release process needs a bit more steps since the libwasmvm project version needs to be updated before the release tag is set.