-
Notifications
You must be signed in to change notification settings - Fork 16
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
[CRE-43] fix slicing of events #992
base: main
Are you sure you want to change the base?
Conversation
pkg/workflows/wasm/host/wasip1.go
Outdated
outOffset := events[i*eventsLen] | ||
|
||
slot := events[outOffset:] | ||
outOffset := i * eventsLen |
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.
Where is eventsLen defined?
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.
this is a const defined here
ff7307e
to
74e909c
Compare
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.
Small nit
pkg/workflows/wasm/host/wasip1.go
Outdated
@@ -228,3 +231,14 @@ func createRandomGet(cfg *ModuleConfig) func(caller *wasmtime.Caller, buf, bufLe | |||
return ErrnoSuccess | |||
} | |||
} | |||
|
|||
func getSlot(events []byte, i int32) ([]byte, error) { | |||
outOffset := i * eventsLen |
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.
Why the prefix out
? Offset is simpler to understand
Description
The original code was using the actual value of the []byte as an index
instead we are now calculating the index of the corresponding event and slicing it (given its a fixed lenght)
more info in the ticket
CRE-43
Requires
Supports