Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for variables #131

Open
filoozom opened this issue Aug 3, 2023 · 1 comment
Open

Add support for variables #131

filoozom opened this issue Aug 3, 2023 · 1 comment
Labels
wontfix This will not be worked on

Comments

@filoozom
Copy link

filoozom commented Aug 3, 2023

Hi,

Would it be conceivable to make ssz-size / ssz-max accept variable names that would get inserted in the generated code, instead of hardcoded values?

The idea behind this is that the Ethereum spec comes with configurable variables, and it's currently impossible (or at least quite complicated and repetitive) to write code that can be compatible with multiple presets at the same time.

For example, I'd like to be able to write something like this:

type ExecutionPayload struct {
	Withdrawals   []*Withdrawal           `ssz-max-var:"MAX_WITHDRAWALS_PER_PAYLOAD" ssz-var-pkg: config`
}

And it would then generate the file with MAX_WITHDRAWALS_PER_PAYLOAD in place of the hardcoded 16, as well as import the config package (although that might already be doable automatically?).

I'm guessing this could introduce some overhead in cases where calculations are required for buffer indexes etc, but for extremely high performance apps it would still be possible to use the current way.

@ferranbt
Copy link
Owner

ferranbt commented Jan 16, 2024

Hello! Thank you for the proposal.
This is not something I am planning to do in the short term. Unfortunately, the changes in the code generator to support this feature are not trivial to do.

@ferranbt ferranbt added the wontfix This will not be worked on label Jan 16, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants
@filoozom @ferranbt and others