Revert "Increase logging to track sources of balance changes."
This reverts commit 32feb20f2fdb66521401710866cd59ecc9951ef8.
This commit is contained in:
parent
49410d2a31
commit
cab9618f53
|
@ -22,26 +22,16 @@ from ./datatypes/capella import BeaconState, ExecutionPayloadHeader, Withdrawal
|
|||
|
||||
export extras, forks, validator, chronicles
|
||||
|
||||
var debugTrackedValidator* = ValidatorIndex.high
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#increase_balance
|
||||
func increase_balance*(balance: var Gwei, delta: Gwei) =
|
||||
balance += delta
|
||||
|
||||
func increase_balance(
|
||||
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei,
|
||||
info: typeof(instantiationInfo())) =
|
||||
func increase_balance*(
|
||||
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei) =
|
||||
## Increase the validator balance at index ``index`` by ``delta``.
|
||||
if delta != 0: # avoid dirtying the balance cache if not needed
|
||||
{.noSideEffect.}:
|
||||
if index == debugTrackedValidator:
|
||||
debugEcho "+", $delta, " ", $info
|
||||
increase_balance(state.balances.mitem(index), delta)
|
||||
|
||||
template increase_balance*(
|
||||
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei) =
|
||||
increase_balance(state, index, delta, instantiationInfo())
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/phase0/beacon-chain.md#decrease_balance
|
||||
func decrease_balance*(balance: var Gwei, delta: Gwei) =
|
||||
balance =
|
||||
|
@ -50,21 +40,13 @@ func decrease_balance*(balance: var Gwei, delta: Gwei) =
|
|||
else:
|
||||
balance - delta
|
||||
|
||||
func decrease_balance(
|
||||
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei,
|
||||
info: typeof(instantiationInfo())) =
|
||||
func decrease_balance*(
|
||||
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei) =
|
||||
## Decrease the validator balance at index ``index`` by ``delta``, with
|
||||
## underflow protection.
|
||||
if delta != 0: # avoid dirtying the balance cache if not needed
|
||||
{.noSideEffect.}:
|
||||
if index == debugTrackedValidator:
|
||||
debugEcho "-", $delta, " ", $info
|
||||
decrease_balance(state.balances.mitem(index), delta)
|
||||
|
||||
template decrease_balance*(
|
||||
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei) =
|
||||
decrease_balance(state, index, delta, instantiationInfo())
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/beacon-chain.md#deposits
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#modified-apply_deposit
|
||||
func get_validator_from_deposit*(deposit: DepositData):
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
import
|
||||
chronicles,
|
||||
../../beacon_chain/spec/beaconstate,
|
||||
../../beacon_chain/spec/forks,
|
||||
../../beacon_chain/spec/state_transition,
|
||||
../../beacon_chain/validators/rewards,
|
||||
|
@ -69,8 +68,6 @@ proc runTest(consensusFork: static ConsensusFork,
|
|||
state_slot = stateSlot,
|
||||
expected_balance = preStateBalance + blockValue
|
||||
|
||||
debugTrackedValidator = ValidatorIndex.high
|
||||
|
||||
block:
|
||||
let res =
|
||||
process_slots(defaultRuntimeConfig, fhPreState[],
|
||||
|
@ -83,7 +80,6 @@ proc runTest(consensusFork: static ConsensusFork,
|
|||
let advanceBalance =
|
||||
withState(fhPreState[]):
|
||||
forkyState.data.balances.item(proposerIndex)
|
||||
debugTrackedValidator = ValidatorIndex(proposerIndex)
|
||||
|
||||
block:
|
||||
let res =
|
||||
|
|
Loading…
Reference in New Issue