Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change commitment message recent to processed #1128

Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,7 @@ incremented for features.
* cli: Add version number from programs `Cargo.toml` into extracted IDL ([#1061](https://github.com/project-serum/anchor/pull/1061)).
* lang: Add `deprecated` attribute to `Loader`([#1078](https://github.com/project-serum/anchor/pull/1078)).
* lang: the `init_if_needed` attribute now checks that given attributes (e.g. space, owner, token::authority etc.) are validated even when init is not needed ([#1096](https://github.com/project-serum/anchor/pull/1096)).
* lang: Change commitment message recent to processed ([#1128](https://github.com/project-serum/anchor/pull/1128))
Necmttn marked this conversation as resolved.
Show resolved Hide resolved

### Features

Expand Down
2 changes: 1 addition & 1 deletion tests/cfo/scripts/fees.js
Expand Up @@ -19,7 +19,7 @@ async function main() {
let marketClient = await Market.load(
provider.connection,
market,
{ commitment: "recent" },
{ commitment: "processed" },
DEX_PID
);
console.log("Fees: ", marketClient._decoded.quoteFeesAccrued.toString());
Expand Down
4 changes: 2 additions & 2 deletions tests/cfo/tests/cfo.js
Expand Up @@ -102,13 +102,13 @@ describe("cfo", () => {
marketAClient = await Market.load(
program.provider.connection,
ORDERBOOK_ENV.marketA.address,
{ commitment: "recent" },
{ commitment: "processed" },
DEX_PID
);
marketBClient = await Market.load(
program.provider.connection,
ORDERBOOK_ENV.marketB.address,
{ commitment: "recent" },
{ commitment: "processed" },
DEX_PID
);
assert.ok(marketAClient._decoded.quoteFeesAccrued.toString() === FEES);
Expand Down
8 changes: 4 additions & 4 deletions tests/cfo/tests/utils/index.js
Expand Up @@ -201,7 +201,7 @@ async function setupMarket({
const MARKET_A_USDC = await Market.load(
provider.connection,
marketAPublicKey,
{ commitment: "recent" },
{ commitment: "processed" },
DEX_PID
);
for (let k = 0; k < asks.length; k += 1) {
Expand Down Expand Up @@ -386,7 +386,7 @@ async function signTransactions({
wallet,
connection,
}) {
const blockhash = (await connection.getRecentBlockhash("max")).blockhash;
const blockhash = (await connection.getRecentBlockhash("processed")).blockhash;
transactionsAndSigners.forEach(({ transaction, signers = [] }) => {
transaction.recentBlockhash = blockhash;
transaction.setSigners(
Expand All @@ -405,7 +405,7 @@ async function signTransactions({
async function sendAndConfirmRawTransaction(
connection,
raw,
commitment = "recent"
commitment = "processed"
) {
let tx = await connection.sendRawTransaction(raw, {
skipPreflight: true,
Expand Down Expand Up @@ -433,7 +433,7 @@ async function runTradeBot(market, provider, iterations = undefined) {
let marketClient = await Market.load(
provider.connection,
market,
{ commitment: "recent" },
{ commitment: "processed" },
DEX_PID
);
const baseTokenUser1 = (
Expand Down
6 changes: 3 additions & 3 deletions tests/swap/tests/utils/index.js
Expand Up @@ -272,7 +272,7 @@ async function setupMarket({
const MARKET_A_USDC = await Market.load(
provider.connection,
marketAPublicKey,
{ commitment: "recent" },
{ commitment: "processed" },
DEX_PID
);
for (let k = 0; k < asks.length; k += 1) {
Expand Down Expand Up @@ -457,7 +457,7 @@ async function signTransactions({
wallet,
connection,
}) {
const blockhash = (await connection.getRecentBlockhash("max")).blockhash;
const blockhash = (await connection.getRecentBlockhash("processed")).blockhash;
Necmttn marked this conversation as resolved.
Show resolved Hide resolved
transactionsAndSigners.forEach(({ transaction, signers = [] }) => {
transaction.recentBlockhash = blockhash;
transaction.setSigners(
Expand All @@ -476,7 +476,7 @@ async function signTransactions({
async function sendAndConfirmRawTransaction(
connection,
raw,
commitment = "recent"
commitment = "processed"
) {
let tx = await connection.sendRawTransaction(raw, {
skipPreflight: true,
Expand Down
6 changes: 3 additions & 3 deletions ts/src/provider.ts
Expand Up @@ -30,8 +30,8 @@ export default class Provider {

static defaultOptions(): ConfirmOptions {
return {
preflightCommitment: "recent",
commitment: "recent",
preflightCommitment: "processed",
commitment: "processed",
};
}

Expand Down Expand Up @@ -207,7 +207,7 @@ export default class Provider {
return await simulateTransaction(
this.connection,
tx,
opts.commitment ?? this.opts.commitment ?? "recent"
opts.commitment ?? this.opts.commitment ?? "processed"
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ts/src/utils/rpc.ts
Expand Up @@ -65,7 +65,7 @@ async function getMultipleAccountsCore(
): Promise<
Array<null | { publicKey: PublicKey; account: AccountInfo<Buffer> }>
> {
const args = [publicKeys.map((k) => k.toBase58()), { commitment: "recent" }];
const args = [publicKeys.map((k) => k.toBase58()), { commitment: "processed" }];
// @ts-ignore
const res = await connection._rpcRequest("getMultipleAccounts", args);
if (res.error) {
Expand Down