-
Notifications
You must be signed in to change notification settings - Fork 969
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
Add module cache test #4285
Add module cache test #4285
Conversation
…nly done during voting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This checks the refined cost model but not the cache functioning as a cache -- for example that making multiple calls against a single contract costs less than it did before (or doesn't charge multiple parses for the same contract, or whatever).
(We do have tests for that in soroban but it looks like this is an attempt to re-verify some of those properties from the C++ side; if so the stuff in this region of the lifecycle tests covers it)
…ter the module cache is created
Good point Graydon. I updated the test to do a very simple check the the required instruction count fell after the module cache was created. The numbers aren't specific though. What do you think? |
@sisuresh Sadly I still think that's just checking that the new cost model is tighter than the old cost model (its tightness causes a cost reduction even if there's no caching). The trick with the module cache is it's only intra-transaction -- it only lives as long as one host -- so you need a testcase that makes multiple calls from contract A to contract B in a single host invocation of contract A. Sorry for pointing you at those lifecycle tests; they're probably not the most appropriate since you don't have control over host lifetime from here, I forgot that core tests all have to be e2e-style. For e2e-like tests, I added a specific new test wasm to do this: the To test for the existence of the module cache, I think you want to upload the ADD and SUM contracts in v20, run them once there to get a baseline cost, then upgrade the host to v21 (to enable module caching at runtime) but not re-upload the contracts (so you're only observing costs related to module caching, not observing a change in costs related to the refined cost model). Then you should (a) see a decline in the costs and (b) see a zero |
Ah yeah I mixed up the module cache and vm instantiation tightening conceptually. I'll add a test for the module cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
r+ 2b81648 |
Description
Resolves #4284
Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)