Files
prysm/proto/ssz_proto_library.bzl
james-prysm 8a0545c3d7 Eip6110 queue deposit requests (#14430)
* wip

* updating types and wip on functions

* renaming to MAX_PENDING_DEPOSITS_PER_EPOCH

* fixing linting and conversions

* adding queue deposit changes

* fixing test and cloning

* removing unneeded test based on update

* gaz

* wip apply pending deposit

* fixing replay test and adding apply pending deposit

* fixing setters test

* updating transition test

* changelog

* updating pending deposits

* fixing ProcessPendingDeposit unit tests

* gaz

* fixing cyclic dependencies

* fix visiblity

* missed adding the right signature verification

* adding point to infinity topup test

* adding apply pending deposit test

* making changes based on eip6110 changes

* fixing ineffassign

* gaz

* adding batched verifications sigs

* fixing broken type

* fixing proto

* updated consensus spec tests and fixed consensus bug tests

* testing readability improvement by avoiding ApplyPendingDeposit

* removing the boolean from apply pending deposit

* improve naming

* review comments and fixing a small bug using wrong variable

* fixing tests and skipping a test

* adding some test skips

* fixing bugs terence found

* adding test for batchProcessNewPendingDeposits

* gaz

* adding churn test

* updating spec tests to alpha.8

* adding pr to changelog

* addressing terence's comments

* Update beacon-chain/core/electra/validator.go

Co-authored-by: terence <terence@prysmaticlabs.com>

* adding tests for batch verify and rename some variables

* skipping tests , add them back in later

* skipping one more test

---------

Co-authored-by: terence <terence@prysmaticlabs.com>
2024-10-14 01:21:42 +00:00

105 lines
4.0 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
"sync_committee_bits.size": "512", # SYNC_COMMITTEE_SIZE
"sync_committee_bytes.size": "64",
"sync_committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector512",
"sync_committee_aggregate_bytes.size": "16",
"sync_committee_aggregate_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector128",
"withdrawal.size": "16",
"blob.size": "131072", # BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB
"logs_bloom.size": "256",
"extra_data.size": "32",
"max_blobs_per_block.size": "6",
"max_blob_commitments.size": "4096",
"kzg_commitment_inclusion_proof_depth.size": "17",
"max_withdrawal_requests_per_payload.size":"16",
"max_deposit_requests_per_payload.size": "8192",
"max_attesting_indices.size": "131072",
"max_committees_per_slot.size": "64",
"committee_bits.size": "8",
"committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector64",
"pending_deposits_limit": "134217728",
"pending_partial_withdrawals_limit": "134217728",
"pending_consolidations_limit": "262144",
"max_consolidation_requests_per_payload.size": "1",
}
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",
"sync_committee_bits.size": "32",
"sync_committee_bytes.size": "4",
"sync_committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector32",
"sync_committee_aggregate_bytes.size": "1",
"sync_committee_aggregate_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector8",
"withdrawal.size": "4",
"blob.size": "131072",
"logs_bloom.size": "256",
"extra_data.size": "32",
"max_blobs_per_block.size": "6",
"max_blob_commitments.size": "16",
"kzg_commitment_inclusion_proof_depth.size": "9",
"max_withdrawal_requests_per_payload.size":"2",
"max_deposit_requests_per_payload.size": "4",
"max_attesting_indices.size": "8192",
"max_committees_per_slot.size": "4",
"committee_bits.size": "1",
"committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector4",
"pending_deposits_limit": "134217728",
"pending_partial_withdrawals_limit": "64",
"pending_consolidations_limit": "64",
"max_consolidation_requests_per_payload.size": "1",
}
###### 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),
},
)