Updated test to use permissioned cranks

This commit is contained in:
jarry-xiao 2021-09-15 15:21:31 -05:00
parent 4349947eb6
commit 415ed85424
6 changed files with 918 additions and 918 deletions

2
deps/serum-dex vendored

@ -1 +1 @@
Subproject commit 1527aa7f9617561bd24f7f79ceff731136c3285c
Subproject commit e5a58080dcca9c0b3a245dbf4a93b5cd7cb13839

View File

@ -23,8 +23,8 @@
},
"homepage": "https://github.com/project-serum/permissioned-markets-quickstart#readme",
"devDependencies": {
"@project-serum/anchor": "^0.13.2",
"@project-serum/anchor-cli": "^0.13.2",
"@project-serum/anchor": "^0.14.0",
"@project-serum/anchor-cli": "^0.14.0",
"@project-serum/common": "^0.0.1-beta.3",
"@project-serum/serum": "^0.13.55",
"@solana/spl-token": "^0.1.6",

View File

@ -191,7 +191,7 @@ describe("permissioned-markets", () => {
// Need to crank the cancel so that we can close later.
it("Cranks the cancel transaction", async () => {
await crankEventQueue(provider, marketProxy);
await crankEventQueuePermissioned(provider, marketProxy);
});
it("Closes an open orders account", async () => {
@ -304,7 +304,7 @@ describe("permissioned-markets", () => {
});
it("Cranks the prune transaction", async () => {
await crankEventQueue(provider, marketProxy);
await crankEventQueuePermissioned(provider, marketProxy);
});
it("Closes an open orders account", async () => {
@ -349,3 +349,17 @@ async function crankEventQueue(provider, marketProxy) {
eq = await marketProxy.market.loadEventQueue(provider.connection);
}
}
async function crankEventQueuePermissioned(provider, marketProxy) {
// TODO: can do this in a single transaction if we covert the pubkey bytes
// into a [u64; 4] array and sort. I'm lazy though.
let eq = await marketProxy.market.loadEventQueue(provider.connection);
while (eq.length > 0) {
const tx = new Transaction();
tx.add(
marketProxy.market.makeConsumeEventsPermissionedInstruction([eq[0].openOrders], provider.wallet.publicKey, 1)
);
await provider.send(tx);
eq = await marketProxy.market.loadEventQueue(provider.connection);
}
}

View File

@ -136,6 +136,7 @@ async function list({
DEX_PID,
proxyProgramId
),
consumeEventsAuthority: wallet.publicKey,
})
);

View File

@ -80,7 +80,13 @@ async function initOpenOrders(provider, marketProxy, marketMakerAccounts) {
)
);
let signers = [marketMakerAccounts.account];
await provider.send(tx, signers);
try {
await provider.send(tx, signers);
}
catch (e) {
console.log("failed to generate OOA");
throw e;
}
}
async function postOrders(provider, marketProxy, marketMakerAccounts) {

1803
yarn.lock

File diff suppressed because it is too large Load Diff