Skip to content
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

SC: Implement the core functionalities of sync calls #1251

Open
wants to merge 9 commits into
base: sync_call
Choose a base branch
from

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Mar 12, 2025

This PR implements the core functionalities of sync calls, in particular the call host function. The Unit tests show basic call flows are working:

  • Sync calls whose receivers are the same as the sender
  • Sync calls whose receivers are different from the sender
  • Nested sync calls
  • Recursive sync calls
  • Sequential sync calls

Notes for reviewing:

  • Please roughly follow the order of libraries/chain/webassembly/sync_call.cpp, libraries/chain/apply_context.cpp and libraries/chain/webassembly/runtimes/eos-vm.cpp to review
  • eosvm-oc not working yet. very minor OC tweaks to allow for nested Executor execution #1043 (sync call unit tests skip eosvm-oc)
  • Please double check if transaction_checktime_timer related changes are correct
  • Tests will be updated using return values and console output after sync call return value and call trace are implemented (next immediate tasks)
  • Reset of apply_context iterator caches is tracked by a separate issue for keeping this PR focused on main call flow SC: Invalidate iterator_cache in apply_context after a sync call #1252

Resolves #1214

@linh2931 linh2931 requested review from spoonincode and heifner March 12, 2025 19:42
@@ -26,17 +26,21 @@ struct platform_timer {
callback still execute if the timer expires and stop() is called nearly simultaneously.
However, set_expiration_callback() is synchronized with the callback.
*/
void set_expiration_callback(void(*func)(void*), void* user) {
void set_expiration_callback(void(*func)(void*), void* user, bool appending = false) {
Copy link
Member Author

@linh2931 linh2931 Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the approach is deemed OK, I will replace this default parameter with regular parameter, and define an enum for the boolean, like {multi_callbacks_allowed, multi_callbacks_disallowed}.


execute(context, bkend, exec_ctx, wasm_alloc, fn);
}

void apply(apply_context& context) override {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refactor apply to reuse the new execute method.

…th sync_call_context to better reflect what they are and make sync_call_context fit into apply_context better
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant