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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -11,8 +11,9 @@ incremented for features.

## [Unreleased]

### Fixes

### Fixes
* 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
* ts: fix `translateAddress` which currently leads to failing browser code. Now uses `PublicKey` constructor instead of prototype chain constructor name checking which doesn't work in the presence of code minifying/mangling([1138](https://github.com/project-serum/anchor/pull/1138))

### 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 @@ -382,7 +382,7 @@ async function signTransactions({
wallet,
connection,
}) {
const blockhash = (await connection.getRecentBlockhash("max")).blockhash;
const blockhash = (await connection.getRecentBlockhash("finalized")).blockhash;
transactionsAndSigners.forEach(({ transaction, signers = [] }) => {
transaction.recentBlockhash = blockhash;
transaction.setSigners(
Expand All @@ -401,7 +401,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 @@ -429,7 +429,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 @@ -453,7 +453,7 @@ async function signTransactions({
wallet,
connection,
}) {
const blockhash = (await connection.getRecentBlockhash("max")).blockhash;
const blockhash = (await connection.getRecentBlockhash("finalized")).blockhash;
transactionsAndSigners.forEach(({ transaction, signers = [] }) => {
transaction.recentBlockhash = blockhash;
transaction.setSigners(
Expand All @@ -472,7 +472,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
1 change: 1 addition & 0 deletions ts/src/utils/rpc.ts
Expand Up @@ -72,6 +72,7 @@ async function getMultipleAccountsCore(
): Promise<
Array<null | { publicKey: PublicKey; account: AccountInfo<Buffer> }>
> {

Necmttn marked this conversation as resolved.
Show resolved Hide resolved
const commitment = commitmentOverride ?? connection.commitment;
const args: (
| string[]
Expand Down