@dataclass(frozen=True)classSpec:""" Parameters from the EIP-7002 specifications as defined at https://eips.ethereum.org/EIPS/eip-7002#configuration If the parameter is not currently used within the tests, it is commented out. """WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS=0x00A3CA265EBCB825B45F985A16CEFB49958CE017SYSTEM_ADDRESS=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT=0WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT=1WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT=(2# Pointer to head of the withdrawal request message queue)WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT=(3# Pointer to the tail of the withdrawal request message queue)WITHDRAWAL_REQUEST_QUEUE_STORAGE_OFFSET=(4# The start memory slot of the in-state withdrawal request message queue)MAX_WITHDRAWAL_REQUESTS_PER_BLOCK=(16# Maximum number of withdrawal requests that can be de-queued into a block)TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK=2MIN_WITHDRAWAL_REQUEST_FEE=1WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION=17EXCESS_RETURN_GAS_STIPEND=2300MAX_AMOUNT=2**64-1@staticmethoddeffake_exponential(factor:int,numerator:int,denominator:int)->int:""" Used to calculate the withdrawal request fee. """i=1output=0numerator_accumulator=factor*denominatorwhilenumerator_accumulator>0:output+=numerator_accumulatornumerator_accumulator=(numerator_accumulator*numerator)//(denominator*i)i+=1returnoutput//denominator@staticmethoddefget_fee(excess_withdrawal_requests:int)->int:""" Calculate the fee for the excess withdrawal requests. """returnSpec.fake_exponential(Spec.MIN_WITHDRAWAL_REQUEST_FEE,excess_withdrawal_requests,Spec.WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION,)@staticmethoddefget_excess_withdrawal_requests(previous_excess:int,count:int)->int:""" Calculate the new excess withdrawal requests. """ifprevious_excess+count>Spec.TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK:returnprevious_excess+count-Spec.TARGET_WITHDRAWAL_REQUESTS_PER_BLOCKreturn0