4

For a given transaction, the Solana runtime consumes CUs for many “operations”. Examples of operations could be read/write locking accounts, syscalls, signature verification, etc. as seen in the cost model or compute budget. Imo it’s pretty clear how those factors contribute to CU consumption.

What is not clear is how the execution of BPF code (a.k.a the on-chain program itself) affects CU consumption. In the cost model the field I'm interested in is programs_execution_cost. How is this cost calculated?

As far as I can tell, the EbpfVm executes an instruction while holding a reference to the invoke context and the VM simply consumes 1 CU per BPF instruction?. If I look at the BPF Loader, also 1 VM instruction seems to equal 1 CU?

Is it really that simple?

1 Answer 1

3

You've done your research really well! You're correct on everything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.