rm unused parameters of get_state_exit_queue_info() (#6167)

This commit is contained in:
tersec 2024-04-03 01:45:57 +00:00 committed by GitHub
parent 5f4fa9ae69
commit 27ec2893ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 25 additions and 42 deletions

View File

@ -91,8 +91,7 @@ func get_validator_activation_churn_limit*(
get_validator_churn_limit(cfg, state, cache))
# https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#initiate_validator_exit
func get_state_exit_queue_info*(
cfg: RuntimeConfig, state: var ForkyBeaconState, cache: var StateCache): ExitQueueInfo =
func get_state_exit_queue_info*(state: ForkyBeaconState): ExitQueueInfo =
var
exit_queue_epoch = compute_activation_exit_epoch(get_current_epoch(state))
exit_queue_churn: uint64

View File

@ -262,7 +262,7 @@ proc process_attester_slashing*(
for index in slashed_attesters:
doAssert strictVerification notin flags or
cur_exit_queue_info == get_state_exit_queue_info(cfg, state, cache)
cur_exit_queue_info == get_state_exit_queue_info(state)
let (new_proposer_reward, new_exit_queue_info) = ? slash_validator(
cfg, state, index, cur_exit_queue_info, cache)
proposer_reward += new_proposer_reward
@ -477,7 +477,7 @@ proc process_operations(cfg: RuntimeConfig,
var exit_queue_info =
if body.proposer_slashings.len + body.attester_slashings.len +
body.voluntary_exits.len > 0:
get_state_exit_queue_info(cfg, state, cache)
get_state_exit_queue_info(state)
else:
default(ExitQueueInfo) # not used

View File

@ -911,8 +911,7 @@ func process_registry_updates*(
# more than one. Therefore, only calculate the information required for
# initiate_validator_exit if there actually is at least one.
let exit_queue_info = maybe_exit_queue_info.valueOr:
let initial_exit_queue_info = get_state_exit_queue_info(
cfg, state, cache)
let initial_exit_queue_info = get_state_exit_queue_info(state)
maybe_exit_queue_info = Opt.some initial_exit_queue_info
initial_exit_queue_info

View File

@ -109,8 +109,8 @@ proc nfuzz_attester_slashing(input: openArray[byte], xoutput: ptr byte,
xoutput_size: ptr uint, disable_bls: bool): bool {.exportc, raises: [FuzzCrashError].} =
decodeAndProcess(AttesterSlashingInput):
process_attester_slashing(getRuntimeConfig(some "mainnet"), data.state,
data.attesterSlashing, flags, get_state_exit_queue_info(
getRuntimeConfig(some "mainnet"), data.state, cache), cache).isOk
data.attesterSlashing, flags,
get_state_exit_queue_info(data.state), cache).isOk
proc nfuzz_block(input: openArray[byte], xoutput: ptr byte,
xoutput_size: ptr uint, disable_bls: bool): bool {.exportc, raises: [FuzzCrashError].} =
@ -155,15 +155,15 @@ proc nfuzz_proposer_slashing(input: openArray[byte], xoutput: ptr byte,
xoutput_size: ptr uint, disable_bls: bool): bool {.exportc, raises: [FuzzCrashError].} =
decodeAndProcess(ProposerSlashingInput):
process_proposer_slashing(getRuntimeConfig(some "mainnet"), data.state,
data.proposerSlashing, flags, get_state_exit_queue_info(
getRuntimeConfig(some "mainnet"), data.state, cache), cache).isOk
data.proposerSlashing, flags,
get_state_exit_queue_info(data.state), cache).isOk
proc nfuzz_voluntary_exit(input: openArray[byte], xoutput: ptr byte,
xoutput_size: ptr uint, disable_bls: bool): bool {.exportc, raises: [FuzzCrashError].} =
decodeAndProcess(VoluntaryExitInput):
process_voluntary_exit(getRuntimeConfig(some "mainnet"), data.state,
data.exit, flags, get_state_exit_queue_info(
getRuntimeConfig(some "mainnet"), data.state, cache), cache).isOk
data.exit, flags,
get_state_exit_queue_info(data.state), cache).isOk
# Note: Could also accept raw input pointer and access list_size + seed here.
# However, list_size needs to be known also outside this proc to allocate xoutput.

View File

@ -96,8 +96,7 @@ suite baseDescription & "Attester Slashing " & preset():
var cache: StateCache
doAssert (? process_attester_slashing(
defaultRuntimeConfig, preState, attesterSlashing, {strictVerification},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpAttSlashingDir):
@ -137,8 +136,7 @@ suite baseDescription & "Proposer Slashing " & preset():
var cache: StateCache
doAssert (? process_proposer_slashing(
defaultRuntimeConfig, preState, proposerSlashing, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpProposerSlashingDir):
@ -168,8 +166,7 @@ suite baseDescription & "Voluntary Exit " & preset():
var cache: StateCache
if process_voluntary_exit(
defaultRuntimeConfig, preState, voluntaryExit, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache).isOk:
get_state_exit_queue_info(preState), cache).isOk:
ok()
else:
err("")

View File

@ -102,8 +102,7 @@ suite baseDescription & "Attester Slashing " & preset():
var cache: StateCache
doAssert (? process_attester_slashing(
defaultRuntimeConfig, preState, attesterSlashing, {strictVerification},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpAttSlashingDir):
@ -162,8 +161,7 @@ suite baseDescription & "Proposer Slashing " & preset():
var cache: StateCache
doAssert (? process_proposer_slashing(
defaultRuntimeConfig, preState, proposerSlashing, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpProposerSlashingDir):
@ -193,8 +191,7 @@ suite baseDescription & "Voluntary Exit " & preset():
var cache: StateCache
if process_voluntary_exit(
defaultRuntimeConfig, preState, voluntaryExit, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache).isOk:
get_state_exit_queue_info(preState), cache).isOk:
ok()
else:
err("")

View File

@ -106,8 +106,7 @@ suite baseDescription & "Attester Slashing " & preset():
var cache: StateCache
doAssert (? process_attester_slashing(
defaultRuntimeConfig, preState, attesterSlashing, {strictVerification},
get_state_exit_queue_info(defaultRuntimeConfig, preState,
cache), cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpAttSlashingDir):
@ -179,8 +178,7 @@ suite baseDescription & "Proposer Slashing " & preset():
var cache: StateCache
doAssert (? process_proposer_slashing(
defaultRuntimeConfig, preState, proposerSlashing, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpProposerSlashingDir):
@ -210,8 +208,7 @@ suite baseDescription & "Voluntary Exit " & preset():
var cache: StateCache
if process_voluntary_exit(
defaultRuntimeConfig, preState, voluntaryExit, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache).isOk:
get_state_exit_queue_info(preState), cache).isOk:
ok()
else:
err("")

View File

@ -106,8 +106,7 @@ suite baseDescription & "Attester Slashing " & preset():
var cache: StateCache
doAssert (? process_attester_slashing(
defaultRuntimeConfig, preState, attesterSlashing, {strictVerification},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpAttSlashingDir):
@ -181,8 +180,7 @@ suite baseDescription & "Proposer Slashing " & preset():
var cache: StateCache
doAssert (? process_proposer_slashing(
defaultRuntimeConfig, preState, proposerSlashing, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpProposerSlashingDir):
@ -212,8 +210,7 @@ suite baseDescription & "Voluntary Exit " & preset():
var cache: StateCache
if process_voluntary_exit(
defaultRuntimeConfig, preState, voluntaryExit, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache).isOk:
get_state_exit_queue_info(preState), cache).isOk:
ok()
else:
err("")

View File

@ -87,8 +87,7 @@ suite baseDescription & "Attester Slashing " & preset():
var cache: StateCache
doAssert (? process_attester_slashing(
defaultRuntimeConfig, preState, attesterSlashing, {strictVerification},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpAttSlashingDir):
@ -129,8 +128,7 @@ suite baseDescription & "Proposer Slashing " & preset():
var cache: StateCache
doAssert (? process_proposer_slashing(
defaultRuntimeConfig, preState, proposerSlashing, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState,
cache), cache))[0] > 0.Gwei
get_state_exit_queue_info(preState), cache))[0] > 0.Gwei
ok()
for path in walkTests(OpProposerSlashingDir):
@ -145,8 +143,7 @@ suite baseDescription & "Voluntary Exit " & preset():
var cache: StateCache
if process_voluntary_exit(
defaultRuntimeConfig, preState, voluntaryExit, {},
get_state_exit_queue_info(defaultRuntimeConfig, preState, cache),
cache).isOk:
get_state_exit_queue_info(preState), cache).isOk:
ok()
else:
err("")