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
|
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
|
# 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) =
|
func increase_balance*(balance: var Gwei, delta: Gwei) =
|
||||||
balance += delta
|
balance += delta
|
||||||
|
|
||||||
func increase_balance(
|
func increase_balance*(
|
||||||
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei,
|
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei) =
|
||||||
info: typeof(instantiationInfo())) =
|
|
||||||
## Increase the validator balance at index ``index`` by ``delta``.
|
## Increase the validator balance at index ``index`` by ``delta``.
|
||||||
if delta != 0: # avoid dirtying the balance cache if not needed
|
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)
|
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
|
# 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) =
|
func decrease_balance*(balance: var Gwei, delta: Gwei) =
|
||||||
balance =
|
balance =
|
||||||
|
@ -50,21 +40,13 @@ func decrease_balance*(balance: var Gwei, delta: Gwei) =
|
||||||
else:
|
else:
|
||||||
balance - delta
|
balance - delta
|
||||||
|
|
||||||
func decrease_balance(
|
func decrease_balance*(
|
||||||
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei,
|
state: var ForkyBeaconState, index: ValidatorIndex, delta: Gwei) =
|
||||||
info: typeof(instantiationInfo())) =
|
|
||||||
## Decrease the validator balance at index ``index`` by ``delta``, with
|
## Decrease the validator balance at index ``index`` by ``delta``, with
|
||||||
## underflow protection.
|
## underflow protection.
|
||||||
if delta != 0: # avoid dirtying the balance cache if not needed
|
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)
|
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.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
|
# 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):
|
func get_validator_from_deposit*(deposit: DepositData):
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
chronicles,
|
chronicles,
|
||||||
../../beacon_chain/spec/beaconstate,
|
|
||||||
../../beacon_chain/spec/forks,
|
../../beacon_chain/spec/forks,
|
||||||
../../beacon_chain/spec/state_transition,
|
../../beacon_chain/spec/state_transition,
|
||||||
../../beacon_chain/validators/rewards,
|
../../beacon_chain/validators/rewards,
|
||||||
|
@ -69,8 +68,6 @@ proc runTest(consensusFork: static ConsensusFork,
|
||||||
state_slot = stateSlot,
|
state_slot = stateSlot,
|
||||||
expected_balance = preStateBalance + blockValue
|
expected_balance = preStateBalance + blockValue
|
||||||
|
|
||||||
debugTrackedValidator = ValidatorIndex.high
|
|
||||||
|
|
||||||
block:
|
block:
|
||||||
let res =
|
let res =
|
||||||
process_slots(defaultRuntimeConfig, fhPreState[],
|
process_slots(defaultRuntimeConfig, fhPreState[],
|
||||||
|
@ -83,7 +80,6 @@ proc runTest(consensusFork: static ConsensusFork,
|
||||||
let advanceBalance =
|
let advanceBalance =
|
||||||
withState(fhPreState[]):
|
withState(fhPreState[]):
|
||||||
forkyState.data.balances.item(proposerIndex)
|
forkyState.data.balances.item(proposerIndex)
|
||||||
debugTrackedValidator = ValidatorIndex(proposerIndex)
|
|
||||||
|
|
||||||
block:
|
block:
|
||||||
let res =
|
let res =
|
||||||
|
|
Loading…
Reference in New Issue