Skip to content

Commit

Permalink
fix transfer invariant, credits to @holiman for finding the edge case (
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda authored and JustinDrake committed Apr 14, 2019
1 parent f88f081 commit be86f96
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions specs/core/0_beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,8 @@ def process_transfer(state: BeaconState, transfer: Transfer) -> None:
get_balance(state, transfer.sender) == transfer.amount + transfer.fee or
get_balance(state, transfer.sender) >= transfer.amount + transfer.fee + MIN_DEPOSIT_AMOUNT
)
# No self-transfers (to enforce >= MIN_DEPOSIT_AMOUNT or zero balance invariant)
assert transfer.sender != transfer.recipient
# A transfer is valid in only one slot
assert state.slot == transfer.slot
# Only withdrawn or not-yet-deposited accounts can transfer
Expand Down

0 comments on commit be86f96

Please sign in to comment.