-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update event validation logic to account for the evm.*
events
#5262
Update event validation logic to account for the evm.*
events
#5262
Conversation
cc @sideninja The previous PR (#5203) was accidentally closed I guess. |
model/events/parse.go
Outdated
@@ -31,7 +31,7 @@ func ParseEvent(eventType flow.EventType) (*ParsedEvent, error) { | |||
parts := strings.Split(string(eventType), ".") | |||
|
|||
switch parts[0] { | |||
case "flow": | |||
case "flow", "evm": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to reference the https://github.com/onflow/flow-go/blob/master/fvm/evm/types/events.go#L20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sideninja That's a good point, but it is not an exported constant. Should I export it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah go ahead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in a61609a
a780063
to
5ae9e19
Compare
model/events/parse.go
Outdated
"github.com/onflow/flow-go/fvm/evm/types" | ||
"github.com/onflow/flow-go/model/flow" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, this looks like a dependency that shouldn't happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly added so that we re-use the "evm"
constant, but I can remove it. "flow"
is also matched against a string literal.
hmm, I remember there was a discussion in discord to expose the address as if its emitted as part of a contract? |
Not sure if this is the relevant PR, the PR to introduce this event ID was already merged #5091 On the topic I remember some feedback around that but I believe the conclusion was to keep it same way as we do for service events on flow: |
Just like @sideninja mentioned, Janez and Bastian suggested to go with the |
I think I remember that we briefly mentioned that we could have a format like |
I'm not sure these events would be emitted by different accounts in the future, even if we shard the storage. That would only mean the access under the hood is done on multiple accounts but the events would still come from the main "service" EVM account unless I'm mistaken. |
If we shard storage, doesnt that mean that a common use case would be that you are only interested in your shard? |
I'm not sure that would be the case. The sharding should be hidden from the developer. And thus developer could compose apps from other shards and would be interested in the whole network. I feel that listening to the events such as block created is something you want to in any case do for the whole network not just your storage shard. |
model/events/parse.go
Outdated
@@ -4,6 +4,7 @@ import ( | |||
"fmt" | |||
"strings" | |||
|
|||
"github.com/onflow/flow-go/fvm/evm/types" | |||
"github.com/onflow/flow-go/model/flow" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think EVM location prefix should go into model/flow/event.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in dfa6eed
model/events/parse.go
Outdated
@@ -31,7 +32,7 @@ func ParseEvent(eventType flow.EventType) (*ParsedEvent, error) { | |||
parts := strings.Split(string(eventType), ".") | |||
|
|||
switch parts[0] { | |||
case "flow": | |||
case "flow", types.EVMLocationPrefix: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment should also be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point 👍 I missed that.
Updated in dfa6eed
dfa6eed
to
33ffc3f
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #5262 +/- ##
==========================================
+ Coverage 55.59% 56.68% +1.09%
==========================================
Files 1002 815 -187
Lines 96600 79668 -16932
==========================================
- Hits 53700 45156 -8544
+ Misses 38839 31055 -7784
+ Partials 4061 3457 -604
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
33ffc3f
to
1dd87b5
Compare
It turns out that
flow
service/protocol events, are allowed to have only 2 parts, e.g.flow.AccountCreated
.The two newly-introduced EVM related events:
flow.evm.BlockExecuted
flow.evm.TransactionExecuted
do not comply with this format, hence, they are considered as invalid event types:
rpc error: code = InvalidArgument desc = invalid event filter: invalid event type flow.evm.BlockExecuted: invalid event type: flow.evm.BlockExecuted