mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
5fdb916b4f
* Update eth1data params to double * Update spec tests tags and state field for fssz gen * Update more spec test sha tags * Update slashing params * Update slashing precompute to use config instead of hardcoded 3 * Update slashing test values due to config changes * Update configs for slashedless test * Go mod tidy * Add toledo config (#7743) * Update genesis delay to one week (#7782) * Add Pyrmont config (#7797) * Add Pyrmont config * Fix config * Update genesis time to the correct value * Remove TestExecuteStateTransition_FullBlock * Add back missing comments * Update spectests to v1.0.0 Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
62 lines
1.9 KiB
Python
62 lines
1.9 KiB
Python
"""
|
|
SSZ proto templating rules.
|
|
|
|
These rules allow for variable substitution for hardcoded tag values like ssz-size and ssz-max.
|
|
|
|
"""
|
|
|
|
####### Configuration #######
|
|
|
|
mainnet = {
|
|
"block_roots.size": "8192,32", # SLOTS_PER_HISTORICAL_ROOT, [32]byte
|
|
"state_roots.size": "8192,32", # SLOTS_PER_HISTORICAL_ROOT, [32]byte
|
|
"eth1_data_votes.size": "2048", # SLOTS_PER_ETH1_VOTING_PERIOD
|
|
"randao_mixes.size": "65536,32", # EPOCHS_PER_HISTORICAL_VECTOR, [32]byte
|
|
"previous_epoch_attestations.max": "4096", # MAX_ATTESTATIONS * SLOTS_PER_EPOCH
|
|
"current_epoch_attestations.max": "4096", # MAX_ATTESTATIONS * SLOTS_PER_EPOCH
|
|
"slashings.size": "8192", # EPOCHS_PER_SLASHINGS_VECTOR
|
|
}
|
|
|
|
minimal = {
|
|
"block_roots.size": "64,32",
|
|
"state_roots.size": "64,32",
|
|
"eth1_data_votes.size": "32",
|
|
"randao_mixes.size": "64,32",
|
|
"previous_epoch_attestations.max": "1024",
|
|
"current_epoch_attestations.max": "1024",
|
|
"slashings.size": "64",
|
|
}
|
|
|
|
###### Rules definitions #######
|
|
|
|
def _ssz_proto_files_impl(ctx):
|
|
"""
|
|
ssz_proto_files implementation performs expand_template based on the value of "config".
|
|
"""
|
|
outputs = []
|
|
if (ctx.attr.config.lower() == "mainnet"):
|
|
subs = mainnet
|
|
elif (ctx.attr.config.lower() == "minimal"):
|
|
subs = minimal
|
|
else:
|
|
fail("%s is an unknown configuration" % ctx.attr.config)
|
|
|
|
for src in ctx.attr.srcs:
|
|
output = ctx.actions.declare_file(src.files.to_list()[0].basename)
|
|
outputs.append(output)
|
|
ctx.actions.expand_template(
|
|
template = src.files.to_list()[0],
|
|
output = output,
|
|
substitutions = subs,
|
|
)
|
|
|
|
return [DefaultInfo(files = depset(outputs))]
|
|
|
|
ssz_proto_files = rule(
|
|
implementation = _ssz_proto_files_impl,
|
|
attrs = {
|
|
"srcs": attr.label_list(mandatory = True, allow_files = [".proto"]),
|
|
"config": attr.string(mandatory = True),
|
|
},
|
|
)
|