3

I see refTime and proofSize used frequently (e.g. in polkadot js apps when submitting contract transactions), but I cannot find any docs on them.

So what exactly are they? Specifically relating to ink!, as this is where I'm seeing them.

1
  • refTime is used by parachain. proofSize is used by relaychain. Both are synonymous to gas used by contract. Commented Mar 13, 2023 at 4:08

1 Answer 1

10

For ink!, the term Gas refers to the resources used by a contract call. It's important for smart contracts that the caller has to pay for any utilized resource. Those resources can be either storage space (for storing something in the contract's storage) or computational time (for executing the contract and its logic). The term Gas encompasses both of these resources: Gas = (refTime, proofSize).

The terms hereby refer to:

refTime: The amount of computational time that can be used for execution, in picoseconds.

proofSize: The amount of storage in bytes that a transaction is allowed to read.

refTime comes from "reference time", referring to Substrate's Weights system, where computation time is benchmarked on reference hardware. You can read more details here.

For ink!, Gas is a synonym to "Weight", we just use this term to make onboarding easier for devs from other smart contract ecosystems. So Gas = Weight = (refTime, proofSize).

Specifically, these terms come from Substrate's Weights V2 system, which was recently introduced.

2
  • I agree on the above that Gas = Weight = (refTime, proofSize) But I have a different definition of proofSize: For me proofSize is the size of the PoV (witness + extrinsics). The witness will incorporate all compressed contracts blob in bytes. It represent the size in bytes to send to relay chain via network for verification. The amount of storage space that will be used is storage rent and storage deposit (where caller balance will be reserved not transferred).
    – P.Ossun
    Commented Mar 14, 2023 at 16:42
  • @P.Ossun The accessed storage is part of the proof as well, so in addition to the contract blob. This is necessary so that the validator can execute the code for the contract call with the storage it touches.
    – cmichi
    Commented Mar 15, 2023 at 15:33

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.