2023-07-05 15:21:14 +00:00
|
|
|
from typing import Dict
|
2023-06-26 10:01:56 +00:00
|
|
|
from .base import BaseSpecBuilder
|
|
|
|
from ..constants import WHISK
|
|
|
|
|
|
|
|
|
|
|
|
class WhiskSpecBuilder(BaseSpecBuilder):
|
|
|
|
fork: str = WHISK
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def imports(cls, preset_name: str):
|
|
|
|
return f'''
|
|
|
|
from eth2spec.capella import {preset_name} as capella
|
2023-07-05 15:21:14 +00:00
|
|
|
import curdleproofs
|
2023-09-12 08:23:31 +00:00
|
|
|
import json
|
2023-06-26 10:01:56 +00:00
|
|
|
'''
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def hardcoded_custom_type_dep_constants(cls, spec_object) -> str:
|
|
|
|
# Necessary for custom types `WhiskShuffleProof` and `WhiskTrackerProof`
|
|
|
|
return {
|
|
|
|
'WHISK_MAX_SHUFFLE_PROOF_SIZE': spec_object.preset_vars['WHISK_MAX_SHUFFLE_PROOF_SIZE'].value,
|
|
|
|
'WHISK_MAX_OPENING_PROOF_SIZE': spec_object.preset_vars['WHISK_MAX_OPENING_PROOF_SIZE'].value,
|
2023-07-05 15:21:14 +00:00
|
|
|
'WHISK_VALIDATORS_PER_SHUFFLE': spec_object.preset_vars['WHISK_VALIDATORS_PER_SHUFFLE'].value,
|
|
|
|
'CURDLEPROOFS_N_BLINDERS': spec_object.preset_vars['CURDLEPROOFS_N_BLINDERS'].value,
|
2023-06-26 10:01:56 +00:00
|
|
|
}
|
2023-07-05 15:21:14 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]:
|
|
|
|
constants = {
|
|
|
|
'EXECUTION_PAYLOAD_INDEX': 'GeneralizedIndex(41)',
|
|
|
|
}
|
|
|
|
return {**super().hardcoded_ssz_dep_constants(), **constants}
|