all: restructure into more comprehensive archtechture#9
Merged
andrepatta merged 33 commits intomainfrom Apr 14, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restructure the Parallax client from go-ethereum's flat package layout into a layered architecture with strict dependency ordering. Rename the main binary from
prlxtoparallax. Remove the non-functional light client. Bump version to 2.0.0. Move technical documentation in-repo underdocs/.Why
The codebase inherited go-ethereum's flat package layout — 35 top-level directories with no enforced layering. Any package could import any other, making it
difficult to reason about dependencies, extract components, or maintain clear boundaries between consensus, networking, and application logic.
This restructure models the architecture after Bitcoin Core's
libbitcoin_kernel/libbitcoin_node/libbitcoin_walletseparation:kernel/can be imported independently without pulling in RPC, networking, or wallet code. This enables external tools tovalidate blocks without the full node stack.
validation/,script/,wallet/,primitives/), making the codebase navigable fordevelopers familiar with either ecosystem.
StateAccessor,ChainConfigurator,kernel.Engine) replace concrete types at layer boundaries, so internal changes don'tcascade across the codebase.
What changed
Layered architecture introduced:
kernel/— RPC-free consensus layer: Engine interface, StateAccessor interface, consensus engines (xhash, clique), chain parameters, fork/gas verification.Cannot import validation, rpc, p2p, node, or wallet.
validation/— blockchain, state, tx pool (formerlycore/,trie/)script/— PVM execution engine, ABI codec and contract bindings (formerlycore/vm/,accounts/abi/)primitives/— fundamental types and serialization (rlp/,types/). Zero imports from kernel or above — fully Layer 0.policy/— fee estimation oraclenode/— node lifecycle, full node (fullnode/), mining (miner/), shared config (nodeconfig/), filters, stats, consolep2p/— P2P networking, wire protocol definitions (protocols/), network parameters (netparams/)wallet/— account management, keystore, hardware wallets, signer (formerlyaccounts/,signer/)rpc/— JSON-RPC server, GraphQL transport, typed RPC clientsupport/— event system, metricsKernel layer fully isolated:
kernel/definesStateAccessorinterface instead of depending on*state.StateDB— consensus engines use the interface, callers pass the concrete stateEngine.FinalizeAndAssemble()takes atypes.TrieHasherparameter instead of importingvalidation/trieinternallykernel/root package has zero imports from validation, p2p, node, rpc, or walletPrimitives layer decoupled from kernel:
primitives/types/defines aChainConfiguratorinterface for signer selection, replacing the direct dependency on*chainparams.ChainConfigMakeSigner,LatestSigner, andReceipts.DeriveFieldsaccept the interface —*ChainConfigsatisfies it via 4 new getter methodsprimitives/types/now has zero imports fromkernel/— fully Layer 0Consensus wrapper eliminated:
consensus/package entirely — it was a thin wrapper that addedAPIs()to kernel enginesnode/fullnode/backend.go)kernel/consensus/andkernel/misc/merged intokernel/root packageCross-dependencies resolved:
node/fullnode/protocols/→p2p/protocols/(wire protocol definitions belong with p2p)node/fullnode/filters/→node/filters/(shared event filtering)node/fullnode/gasprice/→ deleted (was forwarding shim, callers usepolicy/fees/directly)node/fullnode/prlconfig/→node/nodeconfig/(shared node config)Light client removed:
node/light/(109 Go files — LES client, server, downloaders, flow control, vflux)validation/light/(10 files — light chain, ODR, light tx pool). Movednodeset.go(trie proof helper used by snap sync) tovalidation/trie/tests/fuzzers/les/andtests/fuzzers/vflux/(LES fuzzers)--light.serve,--light.maxpeers,--ultralight.*, etc.)LightSyncsync mode option andLightClientGPOconfig defaultsDead packages and files removed:
swarm/(empty, just a README)prlx/(unused mobile bindings)contracts/(checkpointoracle was only used by LES)cmd/checkpoint-admin/(unused)tests/testdata/,tests/evm-benchmarks/(Ethereum test submodules — incompatible with Parallax block format)appveyor.yml,circle.yml(Parallax uses GitHub Actions)Binary renamed:
cmd/prlx/→cmd/parallax/— main binary is nowparallaxinstead ofprlxVersion bumped to 2.0.0:
Other changes:
bootnodes.goandnetwork_params.gomoved fromkernel/chainparams/top2p/netparams/version.gomoved fromkernel/chainparams/to the rootparallaxpackageprlclient/prlxclient/merged intorpc/client/asextended.goparallax-docsrepository intodocs/CODE_OF_CONDUCT.md,SECURITY.md,.github/PULL_REQUEST_TEMPLATE.mdPackage names updated to match directories using
gofmt -rfor AST-aware rewriting (e.g.,package common→package util, allcommon.Hash→util.Hash).Complete directory rename map:
common/util/log/logging/prldb/dbstore/rlp/primitives/rlp/core/types/primitives/types/core/validation/core/vm/script/accounts/abi/script/abi/params/kernel/chainparams/event/support/event/metrics/support/metrics/accounts/wallet/signer/wallet/signer/p2p/p2p/miner/node/miner/prl/node/fullnode/prl/prlconfig/node/nodeconfig/prl/filters/node/filters/prl/protocols/p2p/protocols/prlstats/node/stats/console/node/console/graphql/rpc/graphql/prlclient/rpc/client/internal/prlapi/internal/api/trie/validation/trie/consensus/kernel/)les/light/swarm/contracts/cmd/prlx/cmd/parallax/Final directory structure
Test plan
go build ./...passesgo vet ./...passesgolangci-lint run ./...passes (0 issues)make allpassesmake lintpassesgo test ./kernel/...— all kernel tests passgo test ./validation/...— all validation tests passgo test ./primitives/...— all primitives tests passgo test ./policy/...— fee oracle tests passgo test ./script/...— PVM tests passkernel/root has zero imports from validation, p2p, node, rpc, or walletprimitives/types/has zero imports fromkernel/eth_gasPriceandeth_estimateSmartFeeRPCs work