substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Fix leaf block removal in the backend

Open davxy opened this issue 2 years ago • 0 comments

This PR introduces a new remove method for the leaves set maintained by the backend.

The remove, import, and finalization methods return types were named/renamed

  • RemoveOutcome
  • ImportDisplaced -> ImportOutcome
  • FinalizationDisplaced -> FinalizationOutcome

This naming/renaming has been done to better reflect what the operations are actually doing. That is, for example:

  • an import always adds a new leaf, but not always removes its parent from the leaves set (the parent may not be a leaf already)
  • a remove not always removes a leaf and not always adds its parent to the set (it should be the last child to add the parent as a leaf).

The naming also better fits in the undo operations that were improved and better tested.


The new remove method has been immediately used to fix the remove_leaf_block backend method. Before it was using revert and that has not the effect we actually need here.

davxy avatar Aug 10 '22 17:08 davxy