nearcore icon indicating copy to clipboard operation
nearcore copied to clipboard

Make `compute_usage` a first-class citizen in `ExecutionOutcome`

Open aborg-dev opened this issue 1 year ago • 0 comments

In https://github.com/near/nearcore/pull/8805, we introduce compute_usage field in ExecutionOutcome. Ideally, it would be treated similarly to gas_burnt field for consistency, but that requires more work due to two reasons:

  • ExecutionOutcome is stored in the RocksDB in Borsh-serialized format that would become incompatible if we introduce a new field
  • gas_burnt is used in the Merkle proofs constructed from some of the fields of ExecutionOutcome which are also stored in the database and would break if include new field into the proof

See https://github.com/near/nearcore/pull/8805#discussion_r1149278986 for the full discussion of the challenges.

To resolve this inconsistency, we need to answer the following questions:

  • [ ] Should compute_usage be a part of the Merkle proofs? And in general, what are the criteria for including fields in the proof?
  • [ ] Do we expect any other types of resource usage data to be introduced in the future into ExecutionOutcome? In this case, we should make it more future-proof by introducing a versioned struct

aborg-dev avatar Mar 31 '23 13:03 aborg-dev