Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Remove temporary fix for Agave issue 479 #3184

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tasty-cups-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@solana/rpc-transformers': patch
---

Remove temporary fix for Agave issue 479

The fix is now deployed on mainnet-beta (See https://github.com/anza-xyz/agave/issues/479 and https://github.com/anza-xyz/agave/pull/483).
Original file line number Diff line number Diff line change
Expand Up @@ -220,28 +220,6 @@ describe('getDefaultRequestTransformerForSolanaRpc', () => {
},
);
});
// FIXME Remove when https://github.com/anza-xyz/agave/pull/483 is deployed.
it.each([undefined, 'processed', 'confirmed', 'finalized'])(
'sets the `preflightCommitment` to `processed` when `skipPreflight` is `true` and `preflightCommitment` is `%s` on calls to `sendTransaction`',
explicitPreflightCommitment => {
const requestTransformer = getDefaultRequestTransformerForSolanaRpc();
expect(
requestTransformer({
methodName: 'sendTransaction',
params: [
null,
{
// eslint-disable-next-line jest/no-conditional-in-test
...(explicitPreflightCommitment
? { preflightCommitment: explicitPreflightCommitment }
: null),
skipPreflight: true,
},
],
}).params,
).toContainEqual(expect.objectContaining({ preflightCommitment: 'processed' }));
},
);
describe('given an integer overflow handler', () => {
let onIntegerOverflow: jest.Mock;
let requestTransformer: RpcRequestTransformer;
Expand Down
21 changes: 0 additions & 21 deletions packages/rpc-transformers/src/request-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,6 @@ export function getDefaultRequestTransformerForSolanaRpc(config?: RequestTransfo
defaultCommitment: config?.defaultCommitment,
optionsObjectPositionByMethod: OPTIONS_OBJECT_POSITION_BY_METHOD,
}),
// FIXME Remove when https://github.com/anza-xyz/agave/pull/483 is deployed.
getFixForIssue479RequestTransformer(),
);
};
}

// See https://github.com/anza-xyz/agave/issues/479
function getFixForIssue479RequestTransformer(): RpcRequestTransformer {
return <TParams>(request: RpcRequest<TParams>): RpcRequest => {
if (request.methodName !== 'sendTransaction') {
return request;
}

const params = request.params as [unknown, { skipPreflight?: boolean } | undefined];
if (params[1]?.skipPreflight !== true) {
return request;
}

return Object.freeze({
...request,
params: [params[0], { ...params[1], preflightCommitment: 'processed' }, ...params.slice(2)],
});
};
}