github dydxprotocol/v4-chain protocol/v4.0.0
Protocol v4.0.0

latest releases: protocol/v4.1.0, v5.0.0-dev0, indexer/v4.0.3...
14 days ago

Protocol v4.0.0 Release Notes


This release includes changes in three major areas:

  • Order Book Features
    • Reduce-Only Orders
    • Conditional Order Improvements
  • Risk and Safety Improvements
    • IBC Withdrawal Rate Limiting
    • Subaccount Withdrawal Gating
    • Community Enabled Slashing
  • Cosmos-related Improvements
    • Added x/authz module
    • Cosmos SDK v0.50 Upgrade

See below for a detailed breakdown of the changes.

What's New?

Reduce-Only Orders

This feature adds support for Fill-Or-Kill and Immediate-Or-Cancel + Reduce-Only orders. Reduce-Only orders may not be enabled on any other order types. FOK or IOC orders can be either short term or conditional. Reduce-only orders can be submitted to the protocol by marking the timeInForce boolean field on the Order object to be true . Support for non-FOK or IOC Reduce Only orders will be added in a future update.

  • Indexer account for reduce only resize errors (#963)
  • E2E Tests for Replacement RO Orders, allow all types of RO order replacements (#949)
  • Reduce Only FOK e2e tests (#939)
  • Allow FOK/IOC Reduce Only Orders (#919)

Conditional Order Improvements

Improved the telemetric and triggering for conditional orders.

  • Add latency and gauge metrics for conditional orders (#1014)
  • Add some telemetry for conditional order triggering (#958)
  • Trigger conditional orders using traded price within the block (#945)
  • Update state R/W methods (#938)
  • State R/W methods for last trade price (#910)

IBC Withdrawal Rate Limiting

This safety feature adds rate-limiting for asset withdrawal from the dYdX chain, analogous to the IBC rate limit modules on Stride and Osmosis. It uses a Continuous Token Bucket algorithm as the underlying rate-limit mechanism, where withdrawal capacity recovers towards a baseline during each block. Default parameters only include rate limit for USDC.

The default software rate limits net-withdrawal of Noble USDC, at below levels:

max(1% of TVL, $1mm) per hour
max(10% of TVL, $10mm) per day

These rate limit parameters can be updated by governance via MsgSetLimitParams.

  • Update default rate limit params for USDC (backport #1056) (#1057)
  • Add licensing info in x/ratelimit and attributions to Stride (backport #1031) (#1036)
  • Fix x/ratelimit ProcessWithdrawal logic; improve info logs (backport #1044) (#1050)
  • Add upgrade handler for ratelimit keeper (#1019)
  • Implement queries for x/ratelimit; get limiter and capacity together in keeper (#1013)
  • Wire x/ratelimit methods to IBC transfer logic (#962)
  • Implement messages, genesis in x/ratelimit (#968)
  • x/ratelimit: Implement UpdateCapacityEndBlocker (#941)
  • Implement GetBaseline (#897)

Subaccount Withdrawal Gating

Subaccount withdrawal gating will block all subaccount transfers and withdrawals for 50 blocks. Withdrawal gating will be triggered if 5 minute chain outage occurs or a negative equity subaccount cannot be liquidated / deleveraged.

  • Add RPC query endpoint for withdrawal gating block heights (#964)
  • Halt withdrawals if chain outage seen within the last 5 minutes (#955)
  • Fix withdrawal gating double usage of metrics name for two different types of counters. (#972)
  • Gate withdrawals if negative TNC subaccount encountered after liquidation and deleveraging steps (#936)
  • Write block number to state when encountering zero-fill deleveraging op (#904)
  • Block withdrawals if a negative equity subaccount was recently seen in state (#878)

Community Enabled Slashing

Exposed a MsgSlashValidator message that can be included in a governance proposal. This can be used by the community to slash validators that have misbehaved.

  • Implement x/govplus MsgSlashValidator (#1016)
  • Scaffolding x/govplus module (#1011)

Added x/authz Module

By popular request, the x/authz module was added from cosmos-sdk.

  • Enable authz module to allow granting privileges (#960)

Cosmos SDK v0.50 Upgrade

The Cosmos SDK has been upgraded to v0.50.3 allowing features such as optimistic execution and vote extensions to be enabled in future protocol releases. See the Cosmos SDK 0.50.0 release announcement and release notes for additional details.

  • Disable fast nodes and update iavl to address bugs (backport #1173) (#1174)
  • Upgrade client/v2 to fix autocli signing issues (backport #1090) (#1092)
  • Upgrade forks: cosmos v0.50.4 and cometbft v0.38.5 (backport #1084) (#1085)
  • Fix query: add amino.oneof option to clob oneof metadata (#1077) (#1079)
  • Upgrade iavl to v1.0.1 to prune orphan nodes async (#1081) (#1082)
  • Fix unnecessary home directory creation issues (backport #1073) (#1075)
  • Make app runnable without creating default home dir (backport #1062) (#1063)
  • Fix --home flag being ignored in cosmos v0.50 (backport #1053) (#1055)
  • Bump Cosmos-SDK version for updated default gov parameters (#1017)
  • Disable MsgCancelProposal (#1015)
  • Re-add Rosetta cmd (#1002)
  • Upgrade Cosmos to 0.50.3 to be able to re-add rosetta cmd. (#1000)
  • Remove genesis check that isn't needed since the issue was with how testapp was simulating block processing. (#993)
  • Reduce usage of basic_manager.ModuleBasics in favor of using module.NewBasicManagerFrom... (#984)
  • Fix CLI tests to correctly generate module address (#981)
  • Update usage of mocks and re-enable test. (#975)
  • Fix bogus account numbers being generated in tests and re-enable tests. (#976)
  • Ensure that we use the client context with AutoCLI (#966)
  • Have testing match expected gov parameters for 0.50 (#935)
  • Add 4.0.0 upgrade handler for Cosmos 0.47 -> 0.50 upgrade handler. (#918)
  • Integrate AutoCLI as part of Cosmos 0.47 -> 0.50 upgrade and re-add a few standalone commands that changed packages (#932)
  • Remove DB shutdown, Cosmos 0.50 SDK does this now in BaseApp (#920)
  • Address nit and fix Cosmos 0.50 post merge conflict (#922)
  • Upgrade to Cosmos 0.50.1 and CometBFT 0.38 (#867)

Bug Fixes

  • Fix settled funding event emission (backport #1051) (#1054)
  • Make funding payment event ordering deterministic (#921)


  • Migrate more callsites to the new logging library + new unwrapSdkContext (#1047)
  • Migrate more logs to new logging lib, add lib.UnwrapSDKContext (#1003)
  • Remove delaymsg from module_accounts list (#978)
  • Final settlement e2e tests (#926)
  • Logging Library with Contextual Tags (#872)

Don't miss a new v4-chain release

NewReleases is sending notifications on new releases.