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

Request: Display Limited Resources via Test Budget Object #1226

Closed
mootz12 opened this issue Feb 9, 2024 · 3 comments
Closed

Request: Display Limited Resources via Test Budget Object #1226

mootz12 opened this issue Feb 9, 2024 · 3 comments

Comments

@mootz12
Copy link
Contributor

mootz12 commented Feb 9, 2024

What problem does your feature solve?

Soroban includes a handful of resources that are limited but cannot be checked via the test environment's Budget object.

These missing fields are:

  • Ledger Entry read/writes
  • Read/write bytes

Currently, the budget object only contains the CPU and Memory limits plus their breakdown:

=======================================================
Cpu limit: 100000000; used: 32025734
Mem limit: 41943040; used: 13713432
=======================================================
CostType                 cpu_insns      mem_bytes      
WasmInsnExec             144748         0              
MemAlloc                 1745559        12976302       
MemCpy                   2914660        0              
MemCmp                   21318406       0              
DispatchHostFunction     20150          0              
VisitObject              11163          0              
ValSer                   4632           5464           
ValDeser                 0              0              
ComputeSha256Hash        18870          0              
ComputeEd25519PubKey     0              0              
VerifyEd25519Sig         0              0              
VmInstantiation          5845598        731652         
VmCachedInstantiation    0              0              
InvokeVmFunction         1948           14             
ComputeKeccak256Hash     0              0              
ComputeEcdsaSecp256k1Sig 0              0              
RecoverEcdsaSecp256k1Key 0              0              
Int256AddSub             0              0              
Int256Mul                0              0              
Int256Div                0              0              
Int256Pow                0              0              
Int256Shift              0              0              
ChaCha20DrawBytes        0              0              
=======================================================

What would you like to see?

The ability to check Ledger entry read/write count, and read/write bytes after a contract call in a unit / integration test.

What alternatives are there?

Test against a standalone container, which can be significantly more complicated.

@leighmcculloch
Copy link
Member

leighmcculloch commented Feb 27, 2024

The budget that is printed out is the budget from the Soroban Env, but if those stats are available / exported by the Host, we should be able to include them.

@graydon @dmkozh @sisuresh Are the stats above available on an object of the Host that we could use in the SDK? I had a look through the env repo but couldn't find where those stats are recorded.

@jayz22
Copy link
Contributor

jayz22 commented Feb 27, 2024

I don't think the host tracks stats before and after contract invocation. Others can comment.
There is a related issue of adding resources for contract tests: #1113

@mootz12
Copy link
Contributor Author

mootz12 commented Feb 27, 2024

Thanks @jayz22 - looks like this is a duplicate of #1113.

Closing this issue in favor of the previous one.

@mootz12 mootz12 closed this as completed Feb 27, 2024
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

4 participants
@leighmcculloch @jayz22 @mootz12 and others