Skip to main content

Original source: 0003-renaming-refactor.md

Summary

Refactor our codebase with consistent, correct, and descriptive names.

Motivation

There are a multitude of naming issues which plague our codebase. Some names are not consistent (Statement vs. Work), others are not correct (Ledger is not a ledger; there is no log of transactions). We also have some names that are not very descriptive (Statement, Work, Super_transaction, Ledger_builder, Ledger_builder_controller). Having a standardized and descriptive set of names in our codebase will increase the initial readability, reduce potential areas of confusion, and increase our ability to communicate concept consistently (in person, in code, and in documentation).

Detailed design

Merkle trees

Current NameDescriptionNew Name
LedgerInterface into merkle tree of account statesAccount_db
Ledger_hashRoot hash of a Account_dbAccount_db_root
Merkle_ledgerIn memory implementation of Account_dbVolatile_account_db
Merkle_databaseOn disk implementation of Account_dbPersistent_account_db
Syncable_ledgerWrapper of Account_db to sync over networkSync_account_db
Genesis_ledgerThe initial Account_db for the protocolGenesis_account_db

States

Current NameDescriptionNew Name
Parallel_scan_stateState of a series of parallel scan trees"
Ledger_builderState of Parallel_scan_state + Transaction_workPending_account_db
Ledger_builder_auxAuxillary datastructure of Pending_account_dbWork_queue
Blockchain_stateState of Account_db root and Pending_account_db root at a blockAccount_db_state
Consensus_stateConsensus mechanism specific state at a block"
Protocol_stateThe Account_db_state and Consensus_state at a block"
TipThe Protocol_state and Pending_account_db at a blockFull_state

Transitions

Current NameDescriptionNew Name
Snark_transitionSubset of Full_state_transition that is snarkedProvable_full_state_transition
Internal_transitionState transition on full statesFull_state_transition
External_transitionState transition on lite states; sent to other nodesProtocol_state_transition

Transactions

Current NameDescriptionNew Name
Super_transactionADT for all types of account state transitionsTransaction
TransactionTransaction for payment between accountsPayment
Fee_transferTransaction for distributing work feesFee
CoinbaseTransaction for new currency added each Block_transCoinbase

Snarks

Current NameDescriptionNew Name
StatementA snark proving the application of a single Txn to an Acc_dbTransaction_statement
WorkA collection of one or two Txn_statementsTranscation_work
Transaction_snarkThe snark which proves Txn_statementsTransaction_snark
Blockchain_snarkThe snark which proves Full_state_transs on Full_statesFull_state_transition_snark

Primary components

Current NameDescriptionNew Name
Ledger_builder_controllerMaintains locked Full_state and forks of potential future Full_statesFull_state_frontier
ProposerProposes new blocks"
Snark_workerGenerates Transaction_worksSnarker
ProverProves Full_state_transitions"
VerifierVerifies Full_state_transition_snarks"
Micro_clientA node which only tracks State_summary a limited number of account balances"

Drawbacks

This may cause some initial headache while the development team gets used to the new vocabulary.

Rationale and alternatives

There are many alternative naming patterns that we could choose. The important thing is that we all come to consensus as a team with something we all like (or, if that's impossible, at least something the majority like and the remaining don't hate).