Skip to content

make consensus app generic over ExecutionLayer #224

@rnbguy

Description

@rnbguy

the main refactoring PR. replace every engine: &Engine parameter in app/src/ with el: &E where E: ExecutionLayer. move app logic into crates/consensus/malachite/.

what moves + changes

source destination change
app/src/app.rs consensus/malachite/src/app.rs engine: &Engine -> el: &E in all handlers
app/src/state.rs consensus/malachite/src/state.rs remove eth_chain_config, get_fork(), ValidatedPayloadCache
app/src/bootstrap.rs consensus/malachite/src/bootstrap.rs use trait methods
app/src/sync_handler.rs consensus/malachite/src/sync_handler.rs el.get_block_by_height() + el.encode_block()
app/src/store.rs consensus/malachite/src/store.rs unchanged
app/src/streaming.rs consensus/malachite/src/streaming.rs unchanged
app/src/node.rs consensus/malachite/src/node.rs App<E>, Engine construction moves to CLI
app/src/metrics.rs consensus/malachite/src/metrics.rs unchanged

handler-level changes

handler before after
on_consensus_ready engine.check_capabilities(), engine.eth.get_block_by_number("earliest") el.genesis_block()
on_get_value engine.is_syncing(), engine.generate_block(...) el.is_syncing(), el.build_block(parent, ts)
on_decided engine.set_latest_forkchoice_state(hash, retry), read_validators_from_contract(url, hash) el.finalize_block(&block) -> BlockId, el.validator_set()
on_process_synced_value validate_execution_payload(cache, data, h, r, engine, retry) el.validate_block(&block)
on_get_decided_value get_decided_value_for_sync(store, engine, h, earliest) get_decided_value_for_sync(store, el, h, earliest)
on_started_round state.process_complete_proposal_parts(parts, engine, &config.retry_config) state.process_complete_proposal_parts(parts, el)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions