iroha
iroha copied to clipboard
Trigger execution model
Current execution model is this:
- isi produce events (including ExecuteTrigger event)
- triggers are matched against events and put into the queue for later execution
- after block commit they are executed in the matched order
Consider this case:
-
register trigger that is activated on Account::MetadataInsert
-
wait for block to be committed
-
insert "key" into "alice" metadata
-
mint "rose" for "alice"
-
insert "key" into "alice" metadata
-
wait for block to be committed
In this case trigger is executed twice at the end of the block instead of when actually triggered. This means that by the time trigger reacts to an event, the event is stale.
IMO this execution model is weird and not really reliable.