Skip to content

Commit

Permalink
Remove temporary fix for Agave issue 479
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva committed Sep 10, 2024
1 parent 1d87b3c commit 39284be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 43 deletions.
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)],
});
};
}

0 comments on commit 39284be

Please sign in to comment.