Closed pause125 closed 9 months ago
@pause125 is attempting to deploy a commit to the Rooch Team on Vercel.
A member of the Team first needs to authorize it.
It is strange, the native context has added when the session creating. Please rebase the branch with the man branch, I need to do some debug.
@pause125
If the unit test triggers the error, you need to init the native context in the unit test command.
@pause125
If the unit test triggers the error, you need to init the native context in the unit test command.
It should be this case. Thanks very much!
The latest updates on your projects. Learn more about Vercel for Git ↗︎
The PR is ready. For now, I have not found a suitable way to auto test. Now you can test this PR in terminal as follows:
clean db and start a server
rm -r ~/.rooch/roochdb/
rooch server start
Open a new terminal, publish the examples/publish_modules
example. This module provide a entry function to publish a single module.
rooch move publish -p examples/publish_modules/ --named-addresses rooch_examples=default
Note: Remember replacing the address
0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8
with your local active account address.
Get the example/counter
module bytes
module_bytes=$(hex=$(xxd -p -c 99999 examples/counter/build/counter/bytecode_modules/counter.mv);decimal_array=(); for ((i=0; i<${#hex}; i+=2)); do hex_element="${hex:i:2}"; decimal_element=$((16#$hex_element)); decimal_array+=("$decimal_element"); done; echo $(IFS=','; echo "${decimal_array[*]}"))
Call move entry function to publish example/counter
.
rooch move run --function 0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::publish::publish_modules_entry --args "vector<u8>:$module_bytes" --sender-account default
Check the Counter
resource. Replace the addresses with your local active account address.
rooch resource --address 0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8 --resource 0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::counter::Counter
you will see the output:
{
"state": {
"value": "0x0000000000000000",
"value_type": "0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::counter::Counter"
},
"move_value": {
"abilities": 12,
"type": "0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::counter::Counter",
"value": {
"value": "0"
}
}
}
Call entry function of examples/counter
rooch move run --function 0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::counter::increase --sender-account default
check the resource again
{
"state": {
"value": "0x0100000000000000",
"value_type": "0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::counter::Counter"
},
"move_value": {
"abilities": 12,
"type": "0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::counter::Counter",
"value": {
"value": "1"
}
}
}
Note: Remember replacing the address
0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8
with your local active account address.
Get module bytes of examples/entry_function_arguments
entry_bytes=$(hex=$(xxd -p -c 99999 examples/entry_function_arguments/build/entry_function_arguments/bytecode_modules/entry_function.mv);decimal_array=(); for ((i=0; i<${#hex}; i+=2)); do hex_element="${hex:i:2}"; decimal_element=$((16#$hex_element)); decimal_array+=("$decimal_element"); done; echo $(IFS=','; echo "${decimal_array[*]}"))
Call move entry function to publish examples/entry_function_arguments
rooch move run --function 0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::publish::publish_modules_entry --args "vector<u8>:$entry_bytes" --sender-account default
examples/entry_function_arguments
rooch move run --function 0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8::entry_function::emit_u8 --args u8:3 --sender-account 0x5f5c82f7895b07f2cb8751b2001fb7e80f94845f9915bbd56e112af0f68148c8
All the transactions above should be executed.
TODO:
Maybe we can support a new command, rooch move publish_in_move
to test this feature?
I merge this PR first.
This PR is trying to verify modules in native functions. But I got a runtime error:
The error is triggered where getting the
NativeContextExtensions
here and here.I can't figure out why. Help please @jolestar