aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[vm] Delta writes in sequential execution

Open georgemitenkov opened this issue 2 years ago • 2 comments

Description

Slightly refactored delta operations so that Aggregator 1) can reuse apply_to functionality based on operation 2) can reuse unique serialization/deserialization for delta op values (This way it should also be easier to extract these deltas to ChangeSet, etc.). Added tests.

Implemented delta application for sequential execution. @gelash @zekun000 I am looking for a place to put tests in the form of a) generate writeset with deltas b) apply with fake executor / fake data store c) check result of application and/or VM status. I suppose e2e-tests/src/executor.rs might be the best place for that? Or a separate file?

Test Plan

  • [x] Unit tests
  • [ ] Fake executor tests

This change is Reviewable

georgemitenkov avatar Jul 21 '22 21:07 georgemitenkov

@davidiw Speaking about unreachable: there are 3 places where this is the case:

  1. transaction replay: we match by AccessPath and since we don't use it for aggregator's state key - should never be exposed.
  2. in try_access_path_into_write_set_change and try_table_item_into_write_set_change - again, AccessPath is never used for aggregator.
  3. In InMemoryStateCalculator: this is used for storage and deltas should be converted by then.

I agree that this is not nice but at least it allows to proceed with implementation on executor side (and we not cresting deltas just yet anywhere, so fine for now?). I am working on moving this to ChangeSet or TransactionOutput (separate delta set) in parallel.

georgemitenkov avatar Jul 26 '22 10:07 georgemitenkov

Will be rebasing this on https://github.com/aptos-labs/aptos-core/pull/2222.

TODOs: prologue/epilogue

georgemitenkov avatar Jul 26 '22 17:07 georgemitenkov