From 274b27ef38aec5bc389e2c6e8df686e395ee92e4 Mon Sep 17 00:00:00 2001 From: Armani Ferrante Date: Tue, 3 Aug 2021 13:30:57 -0700 Subject: [PATCH] Add limit param to prune (#2) --- Anchor.toml | 3 + Cargo.lock | 130 +++++++++++++++++++---- deps/serum-dex | 2 +- programs/permissioned-markets/Cargo.toml | 2 +- programs/permissioned-markets/src/lib.rs | 2 +- 5 files changed, 113 insertions(+), 26 deletions(-) diff --git a/Anchor.toml b/Anchor.toml index 959ea7b..325e60c 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -5,3 +5,6 @@ wallet = "~/.config/solana/id.json" [[test.genesis]] address = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin" program = "./deps/serum-dex/dex/target/deploy/serum_dex.so" + +[scripts] +test = "mocha -t 1000000 tests/" \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 18a5b99..361642b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ahash" version = "0.4.7" @@ -24,7 +26,7 @@ checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483" [[package]] name = "anchor-attribute-access-control" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-syn", "anyhow", @@ -37,7 +39,7 @@ dependencies = [ [[package]] name = "anchor-attribute-account" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-syn", "anyhow", @@ -49,7 +51,7 @@ dependencies = [ [[package]] name = "anchor-attribute-error" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-syn", "proc-macro2", @@ -60,7 +62,7 @@ dependencies = [ [[package]] name = "anchor-attribute-event" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-syn", "anyhow", @@ -72,7 +74,7 @@ dependencies = [ [[package]] name = "anchor-attribute-interface" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-syn", "anyhow", @@ -85,7 +87,7 @@ dependencies = [ [[package]] name = "anchor-attribute-program" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-syn", "anyhow", @@ -97,7 +99,7 @@ dependencies = [ [[package]] name = "anchor-attribute-state" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-syn", "anyhow", @@ -109,7 +111,7 @@ dependencies = [ [[package]] name = "anchor-derive-accounts" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-syn", "anyhow", @@ -121,7 +123,7 @@ dependencies = [ [[package]] name = "anchor-lang" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-attribute-access-control", "anchor-attribute-account", @@ -131,7 +133,7 @@ dependencies = [ "anchor-attribute-program", "anchor-attribute-state", "anchor-derive-accounts", - "base64", + "base64 0.13.0", "borsh", "bytemuck", "solana-program", @@ -142,7 +144,7 @@ dependencies = [ [[package]] name = "anchor-spl" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anchor-lang", "lazy_static", @@ -154,7 +156,7 @@ dependencies = [ [[package]] name = "anchor-syn" version = "0.11.1" -source = "git+https://github.com/project-serum/anchor#0998422348fa5f8ebdf907006f5334ad14c4e452" +source = "git+https://github.com/project-serum/anchor#1bea1bcbfc078fb39b90df99ff5c73a007c70d29" dependencies = [ "anyhow", "bs58", @@ -204,6 +206,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + [[package]] name = "base64" version = "0.13.0" @@ -356,6 +364,12 @@ dependencies = [ "libc", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-mac" version = "0.8.0" @@ -527,6 +541,27 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array 0.14.4", + "hmac", +] + [[package]] name = "humantime" version = "2.1.0" @@ -566,6 +601,54 @@ version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +[[package]] +name = "libsecp256k1" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd1137239ab33b41aa9637a88a28249e5e70c40a42ccc92db7f12cc356c1fcd7" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + [[package]] name = "log" version = "0.4.14" @@ -881,7 +964,7 @@ dependencies = [ [[package]] name = "serum_dex" version = "0.3.1" -source = "git+https://github.com/project-serum/serum-dex?branch=armani/auth#814c1fd05b00ae99d68d8f9617cc3868b7aceae1" +source = "git+https://github.com/project-serum/serum-dex#1527aa7f9617561bd24f7f79ceff731136c3285c" dependencies = [ "arrayref", "bincode", @@ -928,9 +1011,9 @@ dependencies = [ [[package]] name = "solana-frozen-abi" -version = "1.7.4" +version = "1.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1e0d064e18bacd418a20b1d3c1a699bd6df1920fda7dbf1a0f84b764aaa0fb" +checksum = "45c6760c1dd139c202ef6df28bff467c904aa35b1aa1a59be268c47aec8bc6c0" dependencies = [ "bs58", "bv", @@ -948,9 +1031,9 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "1.7.4" +version = "1.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb85ca95ec91b6683e9a414cbdf74fc3d104eded6cb20439b2bb6eea22d3514" +checksum = "a4dbe296c16dec41e8e6f4e6c2694c6224820d34c0ab11a2d3ff9683f44878ef" dependencies = [ "proc-macro2", "quote", @@ -960,9 +1043,9 @@ dependencies = [ [[package]] name = "solana-logger" -version = "1.7.4" +version = "1.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7afaad15211575f769c1f5389fca78a10fe9bc676c2fcc7b91b85be978eadca3" +checksum = "80af1959b520c0fc99bc6583ba9d82bfa15b1ac007516795bceeb4a951af77c7" dependencies = [ "env_logger", "lazy_static", @@ -971,9 +1054,9 @@ dependencies = [ [[package]] name = "solana-program" -version = "1.7.4" +version = "1.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d494621bfad15d6745a2bde5a5fa112c921011c00fa07987637d34bd544f191" +checksum = "fe5e5dd99d642b5e89eeb20457310c3c23f20dbf44e67c64e473a02fbc50d646" dependencies = [ "bincode", "blake3", @@ -985,6 +1068,7 @@ dependencies = [ "hex", "itertools", "lazy_static", + "libsecp256k1", "log", "num-derive", "num-traits", @@ -1005,9 +1089,9 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "1.7.4" +version = "1.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a7afe714e9abb9a93215bf5710ee1e244046f2189574301b3e38afb4a14c8f6" +checksum = "fee909dcddb5b4d349b3e5e1ae92f6660cd2f783dea392ae2e73210776aadc9b" dependencies = [ "bs58", "proc-macro2", diff --git a/deps/serum-dex b/deps/serum-dex index 814c1fd..1527aa7 160000 --- a/deps/serum-dex +++ b/deps/serum-dex @@ -1 +1 @@ -Subproject commit 814c1fd05b00ae99d68d8f9617cc3868b7aceae1 +Subproject commit 1527aa7f9617561bd24f7f79ceff731136c3285c diff --git a/programs/permissioned-markets/Cargo.toml b/programs/permissioned-markets/Cargo.toml index a70fda9..44110d9 100644 --- a/programs/permissioned-markets/Cargo.toml +++ b/programs/permissioned-markets/Cargo.toml @@ -17,4 +17,4 @@ default = [] [dependencies] anchor-lang = { git = "https://github.com/project-serum/anchor" } anchor-spl = { git = "https://github.com/project-serum/anchor" } -solana-program = "1.7.4" +solana-program = "=1.7.8" diff --git a/programs/permissioned-markets/src/lib.rs b/programs/permissioned-markets/src/lib.rs index ba36db3..7093db8 100644 --- a/programs/permissioned-markets/src/lib.rs +++ b/programs/permissioned-markets/src/lib.rs @@ -129,7 +129,7 @@ impl MarketMiddleware for Identity { /// /// 0. Authorization token (revoked). /// .. - fn prune(&self, ctx: &mut Context) -> ProgramResult { + fn prune(&self, ctx: &mut Context, _limit: u16) -> ProgramResult { verify_revoked_and_strip_auth(ctx)?; // Sign with the prune authority.