flow-go
flow-go copied to clipboard
Allow emitEvent in script environment
Problem Definition
Currently script environment does not allow emit event. I understand it is kind of pointless to emit the events but I think it is too harsh to panic.
Context: I am coding a Safe Transaction Guard project ( using getAuthAccount and some cadence rewrite to basically detect changes in account state )
Proposed Solution
It would be nice to allow emit to run as a no-op instead of panic https://github.com/onflow/flow-go/blob/9652b94c903adc3839f0c11c31acd4c302aa5cef/fvm/scriptEnv.go#L534
cc: @janezpodhostnik
Without this you are prevented from calling contract functions which emit events, so I totally agree.
Is there some way we can make sure that the developer knows that events are ignored in scripts? Is documentation around this enough?
Oh this is very hard question to answer to be honest, but in general script environment doesn't mutate any state, but for sure it can be explained in more detail.
Is there any chance to implement this before next spork ?