ssz
ssz copied to clipboard
Dynamic struct tags to support different chain specifications
For some chains like Gnosis, different field specs are defined (example). A notable example is
Withdrawals []*Withdrawal ssz-max:"16"`
which has ssz-max=16
for Ethereum networks and ssz-max=8
for Gnosis (yet there are other differences). This changes serialization and hashing results, which makes derived products not supporting chains other than Ethereum.
Is there a workaround for such the specific chains (Gnosis)? The only viable option as it seems is to build two/three/more copies of objects (structs) having different struct attributes..
Other projects (Lodestar, Teku..) do support this. Here is how the above example is handled by Teku: https://github.com/Consensys/teku/blob/777c9dc7bbaa2f563e870b5fa277e48472e234ae/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/execution/versions/capella/ExecutionPayloadSchemaCapella.java#L104