Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename "transaction" to "operation" #863

Merged
merged 3 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions specs/core/0_beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- [Time parameters](#time-parameters)
- [State list lengths](#state-list-lengths)
- [Reward and penalty quotients](#reward-and-penalty-quotients)
- [Max transactions per block](#max-transactions-per-block)
- [Max operations per block](#max-operations-per-block)
- [Signature domains](#signature-domains)
- [Data structures](#data-structures)
- [Misc dependencies](#misc-dependencies)
Expand All @@ -34,7 +34,7 @@
- [`Validator`](#validator)
- [`PendingAttestation`](#pendingattestation)
- [`HistoricalBatch`](#historicalbatch)
- [Beacon transactions](#beacon-transactions)
- [Beacon operations](#beacon-operations)
- [`ProposerSlashing`](#proposerslashing)
- [`AttesterSlashing`](#attesterslashing)
- [`Attestation`](#attestation)
Expand Down Expand Up @@ -132,7 +132,7 @@
- [Block header](#block-header)
- [RANDAO](#randao)
- [Eth1 data](#eth1-data-1)
- [Transactions](#transactions)
- [Operations](#operations)
- [Proposer slashings](#proposer-slashings)
- [Attester slashings](#attester-slashings)
- [Attestations](#attestations)
Expand Down Expand Up @@ -261,8 +261,7 @@ Code snippets appearing in `this style` are to be interpreted as Python code.
* The `BASE_REWARD_QUOTIENT` parameter dictates the per-epoch reward. It corresponds to ~2.54% annual interest assuming 10 million participating ETH in every epoch.
* The `INACTIVITY_PENALTY_QUOTIENT` equals `INVERSE_SQRT_E_DROP_TIME**2` where `INVERSE_SQRT_E_DROP_TIME := 2**12 epochs` (~18 days) is the time it takes the inactivity penalty to reduce the balance of non-participating [validators](#dfn-validator) to about `1/sqrt(e) ~= 60.6%`. Indeed, the balance retained by offline [validators](#dfn-validator) after `n` epochs is about `(1 - 1/INACTIVITY_PENALTY_QUOTIENT)**(n**2/2)` so after `INVERSE_SQRT_E_DROP_TIME` epochs it is roughly `(1 - 1/INACTIVITY_PENALTY_QUOTIENT)**(INACTIVITY_PENALTY_QUOTIENT/2) ~= 1/sqrt(e)`.


### Max transactions per block
### Max operations per block

| Name | Value |
| - | - |
Expand Down Expand Up @@ -460,7 +459,7 @@ The types are defined topologically to aid in facilitating an executable version
}
```

### Beacon transactions
### Beacon operations

#### `ProposerSlashing`

Expand Down Expand Up @@ -2234,7 +2233,7 @@ def process_eth1_data(state: BeaconState, block: BeaconBlock) -> None:
state.eth1_data_votes.append(Eth1DataVote(eth1_data=block.body.eth1_data, vote_count=1))
```

#### Transactions
#### Operations

##### Proposer slashings

Expand All @@ -2246,7 +2245,7 @@ For each `proposer_slashing` in `block.body.proposer_slashings`, run the followi
def process_proposer_slashing(state: BeaconState,
proposer_slashing: ProposerSlashing) -> None:
"""
Process ``ProposerSlashing`` transaction.
Process ``ProposerSlashing`` operation.
Note that this function mutates ``state``.
"""
proposer = state.validator_registry[proposer_slashing.proposer_index]
Expand Down Expand Up @@ -2277,7 +2276,7 @@ For each `attester_slashing` in `block.body.attester_slashings`, run the followi
def process_attester_slashing(state: BeaconState,
attester_slashing: AttesterSlashing) -> None:
"""
Process ``AttesterSlashing`` transaction.
Process ``AttesterSlashing`` operation.
Note that this function mutates ``state``.
"""
attestation1 = attester_slashing.attestation_1
Expand Down Expand Up @@ -2312,7 +2311,7 @@ For each `attestation` in `block.body.attestations`, run the following function:
```python
def process_attestation(state: BeaconState, attestation: Attestation) -> None:
"""
Process ``Attestation`` transaction.
Process ``Attestation`` operation.
Note that this function mutates ``state``.
"""
assert max(GENESIS_SLOT, state.slot - SLOTS_PER_EPOCH) <= attestation.data.slot
Expand Down Expand Up @@ -2367,7 +2366,7 @@ For each `exit` in `block.body.voluntary_exits`, run the following function:
```python
def process_voluntary_exit(state: BeaconState, exit: VoluntaryExit) -> None:
"""
Process ``VoluntaryExit`` transaction.
Process ``VoluntaryExit`` operation.
Note that this function mutates ``state``.
"""
validator = state.validator_registry[exit.validator_index]
Expand Down Expand Up @@ -2403,7 +2402,7 @@ For each `transfer` in `block.body.transfers`, run the following function:
```python
def process_transfer(state: BeaconState, transfer: Transfer) -> None:
"""
Process ``Transfer`` transaction.
Process ``Transfer`` operation.
Note that this function mutates ``state``.
"""
# Verify the amount and fee aren't individually too big (for anti-overflow purposes)
Expand Down
10 changes: 5 additions & 5 deletions specs/core/1_custody-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- [Constants](#constants)
- [Misc](#misc)
- [Time parameters](#time-parameters)
- [Max transactions per block](#max-transactions-per-block)
- [Max operations per block](#max-operations-per-block)
- [Signature domains](#signature-domains)
- [Data structures](#data-structures)
- [Custody objects](#custody-objects)
Expand All @@ -33,7 +33,7 @@
- [`epoch_to_custody_period`](#epoch_to_custody_period)
- [`verify_custody_key`](#verify_custody_key)
- [Per-block processing](#per-block-processing)
- [Transactions](#transactions)
- [Operations](#operations)
- [Custody reveals](#custody-reveals)
- [Chunk challenges](#chunk-challenges)
- [Bit challenges](#bit-challenges)
Expand Down Expand Up @@ -79,7 +79,7 @@ This document details the beacon chain additions and changes in Phase 1 of Ether
| `EPOCHS_PER_CUSTODY_PERIOD` | `2**11` (= 2,048) | epochs | ~9 days |
| `CUSTODY_RESPONSE_DEADLINE` | `2**14` (= 16,384) | epochs | ~73 days |

### Max transactions per block
### Max operations per block

| Name | Value |
| - | - |
Expand Down Expand Up @@ -259,9 +259,9 @@ def verify_custody_key(state: BeaconState, reveal: CustodyKeyReveal) -> bool:

## Per-block processing

### Transactions
### Operations

Add the following transactions to the per-block processing, in order the given below and after all other transactions in phase 0.
Add the following operations to the per-block processing, in order the given below and after all other operations in phase 0.

#### Custody reveals

Expand Down
30 changes: 15 additions & 15 deletions utils/phase0/state_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,54 +22,54 @@ def expected_deposit_count(state: BeaconState) -> int:
)


def process_transaction_type(state: BeaconState,
transactions: List[Any],
max_transactions: int,
tx_fn: Callable[[BeaconState, Any], None]) -> None:
assert len(transactions) <= max_transactions
for transaction in transactions:
tx_fn(state, transaction)
def process_operation_type(state: BeaconState,
operations: List[Any],
max_operations: int,
tx_fn: Callable[[BeaconState, Any], None]) -> None:
assert len(operations) <= max_operations
for operation in operations:
tx_fn(state, operation)


def process_transactions(state: BeaconState, block: BeaconBlock) -> None:
process_transaction_type(
def process_operations(state: BeaconState, block: BeaconBlock) -> None:
process_operation_type(
state,
block.body.proposer_slashings,
spec.MAX_PROPOSER_SLASHINGS,
spec.process_proposer_slashing,
)

process_transaction_type(
process_operation_type(
state,
block.body.attester_slashings,
spec.MAX_ATTESTER_SLASHINGS,
spec.process_attester_slashing,
)

process_transaction_type(
process_operation_type(
state,
block.body.attestations,
spec.MAX_ATTESTATIONS,
spec.process_attestation,
)

assert len(block.body.deposits) == expected_deposit_count(state)
process_transaction_type(
process_operation_type(
state,
block.body.deposits,
spec.MAX_DEPOSITS,
spec.process_deposit,
)

process_transaction_type(
process_operation_type(
state,
block.body.voluntary_exits,
spec.MAX_VOLUNTARY_EXITS,
spec.process_voluntary_exit,
)

assert len(block.body.transfers) == len(set(block.body.transfers))
process_transaction_type(
process_operation_type(
state,
block.body.transfers,
spec.MAX_TRANSFERS,
Expand All @@ -84,7 +84,7 @@ def process_block(state: BeaconState,
spec.process_randao(state, block)
spec.process_eth1_data(state, block)

process_transactions(state, block)
process_operations(state, block)
if verify_state_root:
spec.verify_block_state_root(state, block)

Expand Down