-
Notifications
You must be signed in to change notification settings - Fork 8
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
Q: data tables #13
Comments
This is basically issue #7. I have some ideas for syntax to that end. I'm curious what you want to use it for. Is it just for strings, do you want to include external files? |
I primarily need this to build larger calldata, where some words are static. e.g. balanceOf(constant address). Some additional nice properties would be to be in control of the placement of the raw bytecode. |
A possible design I thought about would be a function ;; just raw data:
.raw(0x12345678)
;; or labeled raw data:
.my_data: .raw(0x12345678) And than the raw bytes could be accessed using: push @my_data ;; size
push .size(@my_data) ;; offset size
push 0 ;; destOffset offset size
codecopy The |
Hmm. That doesn't really work because the design of expression macros has a few constraints.
I think we should go ahead and implement my proposal from #7, with a directive to include raw bytes and the literal syntax:
This syntax can also be used for jump tables:
|
Using string literals in ''#bytecode" would be nice. Although it might be a bit complicated to get the logic right. e.g. should they be abi encoded? Maybe another way would be to put this functionality in a builtin-function like What is a usecase for macors in jumptables are gas inefficient. I wouldn't bother. |
Built-in ABI encoding is not a goal for me personally. The bytes syntax should just be for writing out raw bytes. We can add a special macro to encode basic types maybe. But I don't want to create an encoder for arbitrary data types. And there are no arrays/lists/structs in the geas typing model anyway, so you wouldn't be able to express complex objects. |
Is there an equivalent to huff's data tables in geas?
You have this
CODECOPY
example https://github.com/fjl/geas?tab=readme-ov-file#assemble, but is there any way to put a raw byte sequence between labels? Something like:The text was updated successfully, but these errors were encountered: