feat(app-data): remove AppDataSdk.legacy methods - #946
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughChangesApp-data API simplification
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
📦 GitHub Packages PublishedLast updated: Jul 27, 2026, 03:14:06 PM UTC The following packages have been published to GitHub Packages with pre-release version
InstallationThese packages require authentication to install from GitHub Packages. First, create a # Create .npmrc file in your project root
echo "@cowprotocol:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrcTo get your GitHub token:
Then install any of the packages above, either by exact version (i.e. # Yarn
yarn add npm:@cowprotocol/cow-sdk@pr-946
# pnpm
pnpm install npm:@cowprotocol/cow-sdk@pr-946
# NPM
npm install npm:@cowprotocol/cow-sdk@pr-946Update to the latest version (only if you used the tag)Every commit will publish a new package. To upgrade to the latest version, run: # Yarn
yarn upgrade @cowprotocol/cow-sdk
# pnpm
pnpm update @cowprotocol/cow-sdk
# NPM
npm update @cowprotocol/cow-sdkView PackagesYou can view the published packages at: https://github.com/cowprotocol/cow-sdk/packages |
What
Takes IPFS out of app-data. Removes the deprecated
AppDataSdk.legacysurface (old sha2-256 / dag-pb CID derivation, Pinata upload) and the IPFS read path. The package now makes zero network calls: derivation, validation and schema only.Why
sdk.legacy.appDataToCid()has thrown on every call since 5.1.0.#869 (
d6b30cf, 2026-04-28) swappedipfs-only-hashforipfs-unixfs-importer@16, which dropped theonlyHashoption. You can see it commented out inutils/ipfs.ts. Without it the importer tries to persist blocks, callsblock.put(), and the stub above it throws. That's been in every release since.Nothing caught it because
getAppDataInfo.spec.ts:36mockedipfsOnlyHashto returnCID_LEGACY. So there's a passing happy-path test for a function that fails 100% of the time.Only
appDataToCidthrows. The other legacy methods are just unused.Reads go too. appData was originally stored on IPFS, but the backend indexes it internally now and backfilled every previously uploaded doc, so nothing is left that only exists on a gateway. The live path is
stringifyDeterministicthenkeccak256thenorderBookApi.uploadAppData()thenPUT /api/v1/app_data/{hash}, withGET /api/v1/app_data/{hash}to read back.The read path was broken in its own right anyway:
DEFAULT_IPFS_READ_URIpointed atcloudflare-ipfs.com, which no longer resolves, sofetchDocFromAppDataHex()without an explicitipfsUrifailed on DNS.fetchDocFromCid.spec.tsusedfetchMock, which is why that went unnoticed too.Changes
Removed from
@cowprotocol/sdk-app-dataand@cowprotocol/cow-sdkalike:sdk.legacy.appDataToCidsdk.legacy.appDataHexToCidsdk.legacy.fetchDocFromAppDataHexsdk.legacy.fetchDocFromCidsdk.legacy.uploadMetadataDocToIpfssdk.fetchDocFromAppDataHexIpfstypecross-fetchdependencyAppDataSdkkeepsgetAppDataSchema,generateAppDataDoc,validateAppDataDoc,getAppDataInfo,appDataHexToCidandcidToAppDataHex. Uploads go throughOrderBookApi.uploadAppData, reads throughGET /api/v1/app_data/{hash}.New test:
cidDerivation.integration.spec.tsThe existing specs mock the thing under test.
appDataHexToCid.spec.ts:6stubsbase16.encodeto returnCIDfor any input, soexpect(result).toEqual(CID)compares a constant with itself. Same pattern that hid the breakage above.The new suite mocks nothing and asserts exact bytes across all three adapters. Flipping
multicodec: 0x55to0x56corrupts every CID the SDK produces, and this is the only suite that fails on it.appDataHexis the bytes32 in the on-chain order struct and the backend derives it independently, so drift here means rejected orders.There's also a small smoke test on
api/index.ts, which was at 0% coverage despiteAppDataSdkbeing the package's only public export. It asserts the exact public method set, so the removals can't silently come back.