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

FromInterface is slow on 2.x/3.x, should fix for 3.x #20007

Open
dylant-da opened this issue Sep 25, 2024 · 0 comments
Open

FromInterface is slow on 2.x/3.x, should fix for 3.x #20007

dylant-da opened this issue Sep 25, 2024 · 0 comments

Comments

@dylant-da
Copy link
Contributor

dylant-da commented Sep 25, 2024

FromInterface now performs upgrades automatically, this means that it traverses the entire contract value when called.
(It actually traverses twice, as it reuses importValue to do the transformation, which means we must call toValue first)
This primitive is assumed to simply be a downcast, and as such, does not run in Update.
It is possible users will set up code like so

case myInterface where
  (fromInterface @Template1 -> t) -> ...
  (fromInterface @Template2 -> t) -> ...
  (fromInterface @Template3 -> t) -> ...

which would perform very badly with upgrades.

This ticket is to explore how much of an issue this is, change the primitive if needed, and perhaps optimise it to only traverse once.
Note however, that the engine is the fastest part of the canton transaction pipeline, so this may be a non-issue

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

No branches or pull requests

1 participant