cosmos-sdk fork
Dchain replaces upstream github.com/cosmos/cosmos-sdk with the d-foundation fork via the go.mod replace directive:
github.com/cosmos/cosmos-sdk => github.com/d-foundation/cosmos-sdk v0.54.3-dchain-v1
Source: github.com/d-foundation/cosmos-sdk. The branch is pinned to the
tag v0.54.3-dchain-v1, a rebase of the dchain customisations onto upstream v0.54.3 (which ships cometbft v0.39.3 —
the earlier fork-side cometbft pin to v0.38.21 is gone with it).
The canonical, file-level list of customisations is the fork's own
CHANGELOG_DCHAIN.md. This page
summarises what is carried and why; the changelog is authoritative on exactly which files changed.
Customisations carried on v0.54.3
1. Verifiable Presentation (VP) flag on the tx factory
Every CLI-built transaction can carry a base64-encoded Verifiable Presentation as a transaction extension option:
client/flags/flags.goadds the--verifiable-presentationflag (registered asBytesBase64inAddTxFlagsToCmd).client/tx/factory.go'sNewFactoryCLIreads the flag; when non-empty it wraps the bytes into a*codectypes.Anywith thevcvextension-option TypeUrl and stores it inFactory.extOptions.
The factory does not enforce the VP's presence — when the flag is absent the transaction is built without the
extension option, and enforcement happens on-chain via Protocol's vcv ante handler. This feature introduces a runtime
dependency on github.com/d-foundation/protocol (for the vcv package and VerifiablePresentation proto type).
2. Bank hooks (BlockBeforeSend / TrackBeforeSend)
Lets other modules veto or observe coin movements before they happen — the compliance-gating primitive dchain modules build on:
- New
BankHooksinterface andMultiBankHooksaggregator (x/bank/types/hooks.go), with keeper-side dispatch (x/bank/keeper/hooks.go):BlockBeforeSendreturns the first non-nil error;TrackBeforeSendis fire-and-forget. BaseSendKeepergains aSetHookssetter (panics on double-set).SendCoinscallsBlockBeforeSendbefore the move andTrackBeforeSendafter;SendCoinsWithoutBlockHookexposes a bypass path;InputOutputCoinsinvokes both hooks per output.- Pointer
BaseKeepernarrowing.bankkeeper.NewMsgServerImpl, the bank migrator, and the depinject output all take/emit*BaseKeeperinstead of theKeeperinterface or a value keeper.SetHooksmutates the keeper; with a value copy the mutation would only affect that copy, so the pointer guarantees every consumer (msg server, migrator, depinject consumers) sees the same hook set. - Depinject wiring in
x/bank/module.goso external modules can supply hooks.
Dropped in the v0.54.3 rebase
Two customisations carried through earlier rebases (up to v0.53.4-dchain-v5) were deliberately dropped:
AbstractContinuousVesting+NilPubKey(x/auth/vesting,proto/cosmos/vesting/dchainv1/). It existed solely to letContinuousVestingAccountact as a wasm-controlled abstract account for the cosmwasmabstractaccountante handler. CosmWasm has been fully removed from dchain and Protocol has zero references to these types.x/auth/vestingis now identical to upstream.- Epochs pointer-keeper plumbing (
x/epochsdepinject/keeper changes). Upstreamv0.54ships the equivalent wiring (InvokeSetHooks, pointer keeper handling,EpochHooksWrapper), making the fork patch redundant.x/epochsis now identical to upstream.
Downstream consequence: cosmos/evm precompile
github.com/cosmos/evm's ERC-20 precompile is written against the upstream signature
(NewMsgServerImpl(keeper Keeper)) and type-switches over both a value bankkeeper.BaseKeeper arm and a pointer
*bankkeeper.BaseKeeper arm. Go type-checks every arm of a type switch, so against the narrowed fork signature the
value arm fails to compile. This is patched downstream in the d-foundation evm fork — see the
cosmos/evm fork page.
Rebase strategy
When rebasing onto a new upstream cosmos-sdk release:
- Pull the new upstream tag and rebase the dchain commits onto it.
- Use the fork's
CHANGELOG_DCHAIN.mdfile-level diff summary as the checklist of what must survive the rebase (VP flag/factory, bank hooks + pointer keeper); check whether upstream has absorbed anything (as happened with the epochs plumbing inv0.54), and drop what is no longer needed. - Update
CHANGELOG_DCHAIN.mdto reflect the new base and any dropped/added patches. - Re-tag as
vX.Y.Z-dchain-vN. - Bump the replace directive in
protocol/go.modand re-verify the d-foundation/evm ERC-20 precompile patch still compiles against the fork; if upstream cosmos/evm has reshaped the type switch, that patch needs re-deriving.