Improve Event Syscall API #775
Stebalien
started this conversation in
Enhancements - Technical
Replies: 1 comment
-
Sounds fine to me. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, events are emitted as CBOR objects. Unfortunately, this makes it hard to accurately charge gas for parsing. We currently handle this by tuning our gas model for EVM events but that's obviously not going to cut it.
Proposal:
Emit three buffers:
entries
: An array of[(flags: u64, codec: u64, key_len: u32, value_len: u32), ...]
(packed). I.e., 24 bytes per event.keys
: A buffer of all keys, concatenated.values
: A buffer of all values, concatenated.The FVM will:
entries.len() / 24
(or return an error if not a multiple of 24).keys
, and the length ofvalues
.Importantly, this means the FVM can accurately charge gas before parsing anything.
Implementation:
This has already been implemented in https://github.com/filecoin-project/ref-fvm/pull/1807/files and merged into a "next" branch in the ref-fvm (it's consensus breaking so we don't want it in master).
Beta Was this translation helpful? Give feedback.
All reactions