-
Notifications
You must be signed in to change notification settings - Fork 70
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
feat(xcvm): simplify apply_bindings function #4119
Conversation
# run Composable node
nix run "github:ComposableFi/composable/refs/pull/4119/merge" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed # run local Picasso DevNet (for CosmWasm development)
nix run "github:ComposableFi/composable/refs/pull/4119/merge#devnet-picasso" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed # CosmWasm on Substrate CLI tool
nix run "github:ComposableFi/composable/refs/pull/4119/merge#ccw" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed # run cross chain devnet with Dotsama and Cosmos nodes
nix run "github:ComposableFi/composable/refs/pull/4119/merge#devnet-xc-fresh" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed
# or same with docker
nix build "github:ComposableFi/composable/refs/pull/4119/merge#devnet-xc-image" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed \
&& docker load --input result && docker run -it --entrypoint bash devnet-xc:latest -c /bin/devnet-xc-fresh |
Rather than dealing with pre-initialised buffer and having to track indexes when setting data in the output payload, change the apply_bindings function to append data into a vector which does index tracking by itself. This removes offset tracking from the function simplifying it. With that, change the function so it no longer takes output vector as argument but rather allocates vector internally. While changing the apply_bindings function in xc_core also change how it’s used in the interpreter contract refactoring the code slightly. Part of it is a consequence of changing the signature of the apply_binding function but partially it’s just refactoring splitting functions into smaller, more manageable chunks.
Analogous, in semantics, approach work in Solidty EVM? As I recall design of feature (i do not know coding) was deterministic low on resource usage as require by Ethereum. |
I don’t see why this wouldn’t work for other blockchains. Fundamentally this does the same thing as the previous code. There’s just less code for tracking indexes and offsets and the vector resizes dynamically if needed. There could be some option to optimise it by using vectored output (so instead of collecting everything to single buffer have a |
Let me write program which checks binding work(or not work), and test out same program on this one. |
stale-pr |
stale-pr |
@dzmitry-lahoda, friendly ping |
yeah, it is in the queue. need to test on devnet. to avoid breaking it (sure it may not work now, but I saw it working - so need to test before and after). i guess when write doc. |
will test this week |
Rather than dealing with pre-initialised buffer and having to track
indexes when setting data in the output payload, change the
apply_bindings function to append data into a vector which does index
tracking by itself. This removes offset tracking from the function
simplifying it. With that, change the function so it no longer takes
output vector as argument but rather allocates vector internally.
While changing the apply_bindings function in xc_core also change how
it’s used in the interpreter contract refactoring the code
slightly. Part of it is a consequence of changing the signature of the
apply_binding function but partially it’s just refactoring splitting
functions into smaller, more manageable chunks.
Required for merge:
pr-workflow-check / draft-release-check
is ✅ successMakes review faster:
misc
label if it should not be in release notesReviewers
@
) or used other form of notification of one person who I think can handle best review of this PR