Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

executeTransaction abi handler should not make state changes when tx is invalid #7299

Closed
Tracked by #7210
shuse2 opened this issue Jul 14, 2022 · 0 comments · Fixed by #7339
Closed
Tracked by #7210

executeTransaction abi handler should not make state changes when tx is invalid #7299

shuse2 opened this issue Jul 14, 2022 · 0 comments · Fixed by #7339
Assignees
Milestone

Comments

@shuse2
Copy link
Collaborator

shuse2 commented Jul 14, 2022

Description

When executeTransaction is called and the transaction is invalid, it should not make state changes to the context and should not return any event.

Currently, state db and event queue does not support multiple snapshot. Therefore, if transaction becomes invalid by afterCommandExecute, it only rolls back to the state before calling command.execute.

  1. Update event queue to maintain multiple snapshots
  2. Update lisk-db to the version which supports multiple snapshot

Acceptance Criteria

  • Add unit test to check if all state is rollbacked if afterCommandExecute fails
  • Add unit test for event queue to check reverting to the older snapshot

Additional Information

  • Possible implementation of event queue interface
const snapshotID = eventQueue.createSnapshot();
eventQueue.revertSnapshot(snapshotID);

and all snapshot can be removed when using one of the snapshot

Related: LiskArchive/lisk-db#21

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants