Skip to content

[DF-22956] fix casing issue blocksize capital EA#4780

Open
guandali wants to merge 5 commits intomainfrom
lli/blocksize-casing-fix
Open

[DF-22956] fix casing issue blocksize capital EA#4780
guandali wants to merge 5 commits intomainfrom
lli/blocksize-casing-fix

Conversation

@guandali
Copy link
Copy Markdown
Member

@guandali guandali commented Mar 27, 2026

Closes #DF-22956

Description

DF-22956

This change makes both Blocksize adapters handle symbol casing consistently by normalizing incoming base and quote params before subscription logic runs.

It does two things:

blocksize-capital-state now uses the same request transform pattern already used by blocksize-capital, so mixed-case inputs like CbBtC/uSd are normalized before building subscription state.
Test coverage was expanded across both adapters to verify casing behavior at both the unit and integration level.

Changes

  • Added a request transform to blocksize-capital-state that lowercases base and quote.
  • Hooked that transform into the state endpoint.
  • Added mixed-case integration coverage for:
  • blocksize-capital price
  • blocksize-capital crypto-lwba
  • blocksize-capital vwap
  • blocksize-capital-state state
  • Added unit tests for the request transform helper in both adapters.

Steps to Test

Focused tests passed for both adapters:

blocksize-capital: 9/9 tests passed
blocksize-capital-state: 32/32 tests passed
If you want, I can also turn this into a polished GitHub PR title and body.

Quality Assurance

  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant infra-k8s configuration file.
  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant adapter-secrets configuration file.
  • If a new adapter was made, or a new endpoint was added, update the test-payload.json file with relevant requests.
  • The branch naming follows git flow (feature/x, chore/x, release/x, hotfix/x, fix/x) or is created from Jira.
  • This is related to a maximum of one Jira story or GitHub issue.
  • Types are safe (avoid TypeScript/TSLint features like any and disable, instead use more specific types).
  • All code changes have 100% unit and integration test coverage. If testing is not applicable or too difficult to justify doing, the reasoning should be documented explicitly in the PR.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 27, 2026

🦋 Changeset detected

Latest commit: 07bab75

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@chainlink/blocksize-capital-state-adapter Patch
@chainlink/blocksize-capital-adapter Patch
@chainlink/token-allocation-adapter Patch
@chainlink/bsol-price-adapter Patch
@chainlink/crypto-volatility-index-adapter Patch
@chainlink/savax-price-adapter Patch
@chainlink/set-token-index-adapter Patch
@chainlink/xsushi-price-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

aliases: ['crypto', 'state'],
transport: stateTransport,
inputParameters,
requestTransforms: [blocksizeStateSubscriptionRequestTransform],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be blocksizeStateSubscriptionRequestTransform()? We should align on one pattern and stick with it

Comment on lines +3 to +10
export function blocksizeStateSubscriptionRequestTransform() {
return (req: AdapterRequest<{ base: string; quote?: string }>) => {
req.requestContext.data.base = req.requestContext.data.base.toLowerCase()
if (req.requestContext.data.quote) {
req.requestContext.data.quote = req.requestContext.data.quote.toLowerCase()
}
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this uses the same pattern as tiingo, which we know is not working. How are these tests passing?

Comment on lines +94 to +105
it('should normalize mixed-case base and quote params', async () => {
const response = await testAdapter.request({
base: 'CbBtC',
quote: 'uSd',
endpoint: 'state',
})
const body = response.json()

expect(response.statusCode).toBe(200)
expect(body.result).toBe(1234.56)
expect(body.data.result).toBe(1234.56)
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this work if the transform is not properly set up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants