Open despiegk opened 1 month ago
When I checkout crystallib repo and try to run some examples I always get errors related to module importation. I don't get why most import are done like this
import freeflowuniverse.crystallib.xxx
Since the root directory of a V project is defined by the presence of the v.mod file, which in our case is crystallib/crystallib
, all imports should be done relatively to this point.
https://docs.vlang.io/modules.html
In V, every file is a module. The module name is the same as the file name, minus the .v extension. To import a module in V, you use the import keyword followed by the module name. The module name is the same as the directory path where the module file is located, relative to the root of your project.
With these considerations crystallib/examples
directory should be crystallib/crystallib/examples
unless I miss something and the dev env should be configured differently (?)
Edit: The dev env need to respect specific configuration defined here (https://github.com/freeflowuniverse/crystallib?tab=readme-ov-file#alternative-with-manual-git-checkout--v-install) to be able to run examples without import error.
mkdir -p ~/code/github/freeflowuniverse
cd ~/code/github/freeflowuniverse
git clone git@github.com:freeflowuniverse/crystallib.git
cd crystallib
About fixing ~/code/github/freeflowuniverse/crystallib/examples/tfgrid/grid/examples/vm_high_level/deploy_vm_high_level.v
After running:
cd crystallib
v -enable-globals run examples/tfgrid/grid/examples/vm_high_level/deploy_vm_high_level.v
There were some errors, I made some changes (branch: https://github.com/freeflowuniverse/crystallib/tree/development_tfgrid_fixes) and was able to deploy VM on node 129 devnet:
I will have a look to other examples...
About griddriver
https://github.com/threefoldtech/web3gw/tree/development_integration/griddriver
It is the go component that enables to make calls to tfchain from tfgrid V client via TFPluginClient
.
An installer is already available here https://github.com/threefoldtech/web3gw/blob/development_integration/griddriver/build.sh
Example of flow is:
deploy_single_vm()
(crystallib):https://github.com/freeflowuniverse/crystallib/blob/2a32f1fb3962e8374c1b5660de3168365cb8010a/crystallib/threefold/griddriver/utils.v#L14griddriver cli
(web3gw): https://github.com/threefoldtech/web3gw/blob/7b291e07919a22fee9793e7e01c3cd2f3f74639c/griddriver/main.go#L409TFPluginClient
(web3gw): https://github.com/threefoldtech/web3gw/blob/7b291e07919a22fee9793e7e01c3cd2f3f74639c/griddriver/network.go#L51TFPluginClient
(tfgrid-sdk-go): https://github.com/threefoldtech/tfgrid-sdk-go/blob/development/grid-client/deployer/tf_plugin_client.godeployers
(tfgrid-sdk-go):
https://github.com/threefoldtech/tfgrid-sdk-go/blob/development/grid-client/deployer/network_deployer.go
https://github.com/threefoldtech/tfgrid-sdk-go/blob/development/grid-client/deployer/deployment_deployer.goFirst version of griddriver
installer was made here:
https://github.com/freeflowuniverse/crystallib/blob/development_tfgrid_fixes/crystallib/installers/tfgrid/griddriver/griddriver.v
Maybe found some V issue by running following .vsh script:
#!/usr/bin/env -S v -w -enable-globals run
import freeflowuniverse.crystallib.installers.tfgrid.griddriver as griddriverinstaller
mut reset:=true
griddriverinstaller.install(reset:reset)!
See issue here:
Solved by running:
sudo chmod 1777 /tmp/execscripts
Fixing examples in ~/code/github/freeflowuniverse/crystallib/examples/tfgrid/grid/
:
On tfgrid V client I have this error could not verify signature
when calling the griddriver
with the rmb
option
https://github.com/freeflowuniverse/crystallib/blob/ee95868e8c183f5415ea5d3be7385bb4d83b8fdb/crystallib/threefold/griddriver/rmb.v#L7
Most above examples are not running because of this.
Seems it goes through web3gw
repo
https://github.com/threefoldtech/web3gw/blob/7b291e07919a22fee9793e7e01c3cd2f3f74639c/griddriver/rmb.go#L47
And finally to rmb-sdk-go
repo and failed here
https://github.com/threefoldtech/tfgrid-sdk-go/blob/61e07567a9306fe6b242bdad2b58066f8c209f1b/rmb-sdk-go/peer/sig.go#L125
Here is an example of a raw command that returns the error:
griddriver rmb --cmd 'zos.system.version' --dst '22' --payload '""' --substrate 'wss://tfchain.dev.grid.tf/ws' --mnemonics 'xxx' --relay 'wss://relay.dev.grid.tf'
Should be specific to rmb client because griddriver deploy-single
option, which uses https://github.com/threefoldtech/tfgrid-sdk-go/tree/development/grid-client, still works.
After discussing with team it seems that griddriver
is outdated and should follow the changes in rmb-sdk-go
repo.
Versions in griddriver
are:
github.com/threefoldtech/tfgrid-sdk-go/grid-client v0.11.2 github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go v0.11.2
Should be changed to last v0.15.10 and update code.
Worked on PR https://github.com/threefoldtech/web3gw/pull/212 to update the griddriver
.
Once merged and griddriver
re-installed the examples should work again.
make sure there is a builder for the driver or at least instrucitons,
Also reviewing and adjusting the grid-proxy
examples
Here is a list of the updated examples in ~/code/github/freeflowuniverse/crystallib
:
griddriver
Znet
Zmount
PublicIP
Zmachine
Zlogs
Zdb
GatewayNameProxy
GatewayFQDNProxy
GatewayNameProxy
VM
Znet
Zmachine
Zdb
Znet
PublicIP
Zmachine
Znet
PublicIP
Zmachine
GatewayNameProxy
gridproxy
config mgmt class
get the examples for deploy to work in V
example in wrong location
checklist