From 67bdef6ff7ea88ed0e5d5ecb868a9f0ff8eb1b56 Mon Sep 17 00:00:00 2001 From: Evan Batsell Date: Sun, 28 Jul 2024 18:51:34 -0400 Subject: [PATCH] Support 0.30 IDL --- .github/workflows/build.yaml | 16 +- .github/workflows/release.yaml | 14 +- Anchor.toml | 4 +- Cargo.lock | 909 +++++++---- Cargo.toml | 13 +- programs/merkle-distributor/Cargo.toml | 1 + .../idl/merkle_distributor.json | 1325 +++++++++++------ .../src/instructions/new_distributor.rs | 2 +- 8 files changed, 1519 insertions(+), 765 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 37f4e34..86aae1f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,7 +7,7 @@ on: branches: - master env: - SOLANA_CLI_VERSION: 1.16.17 + SOLANA_CLI_VERSION: 1.18.11 jobs: build-and-test: name: Build and test programs @@ -30,7 +30,7 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ key: cargo-${{ runner.os }}-anchor-${{ hashFiles('**/Cargo.lock') }} - - run: cargo install --git https://github.com/coral-xyz/anchor --tag v0.29.0 anchor-cli --locked --force + - run: cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli --locked --force working-directory: / - name: Install latest nightly uses: actions-rs/toolchain@v1 @@ -41,24 +41,24 @@ jobs: # --force is hack around cargo caching, figure out later - name: Setup Rust tools run: | - cargo +nightly-2023-10-05 install cargo-sort --force - cargo +nightly-2023-10-05 install cargo-udeps --force + cargo +nightly-2024-02-04 install cargo-sort --force + cargo +nightly-2024-02-04 install cargo-udeps --force shell: bash - name: cargo sort - run: cargo +nightly-2023-10-05 sort --workspace --check + run: cargo +nightly-2024-02-04 sort --workspace --check shell: bash - name: cargo fmt - run: cargo +nightly-2023-10-05 fmt --all --check + run: cargo +nightly-2024-02-04 fmt --all --check shell: bash - name: clippy - run: cargo +nightly-2023-10-05 clippy --all-features --all-targets --tests -- -D warnings + run: cargo +nightly-2024-02-04 clippy --all-features --all-targets --tests -- -D warnings shell: bash - name: cargo udeps - run: cargo +nightly-2023-10-05 udeps --all-features --all-targets --tests + run: cargo +nightly-2024-02-04 udeps --all-features --all-targets --tests shell: bash # Build IDLs diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7c66a0b..3b47976 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,10 +2,10 @@ name: Release on: push: tags: - - 'v*' + - "v*" env: - SOLANA_CLI_VERSION: 1.16.17 + SOLANA_CLI_VERSION: 1.18.11 jobs: release: name: Create the jito programs release @@ -28,7 +28,7 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ key: cargo-${{ runner.os }}-anchor-${{ hashFiles('**/Cargo.lock') }} - - run: cargo install --git https://github.com/coral-xyz/anchor --tag v0.29.0 anchor-cli --locked --force + - run: cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli --locked --force # Build IDLs + programs - name: Build program @@ -50,10 +50,10 @@ jobs: run: git diff --exit-code # Push to anchor repository -# - name: Anchor Login -# run: anchor login ${{ secrets.ANCHOR_PUBLISH_TOKEN }} -# - name: Publish merkle_distributor source code -# run: yes 'yes' | anchor publish merkle_distributor --skip-build --provider.cluster mainnet + # - name: Anchor Login + # run: anchor login ${{ secrets.ANCHOR_PUBLISH_TOKEN }} + # - name: Publish merkle_distributor source code + # run: yes 'yes' | anchor publish merkle_distributor --skip-build --provider.cluster mainnet # Upload artifacts - name: Upload Artifact diff --git a/Anchor.toml b/Anchor.toml index e465e02..9936fcf 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -1,6 +1,6 @@ [toolchain] -anchor_version = "0.29.0" -solana_version = "1.16.9" # Solana version to use +anchor_version = "0.30.1" +solana_version = "1.18.11" # Solana version to use [features] seeds = true diff --git a/Cargo.lock b/Cargo.lock index df30608..705cbd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,7 +81,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", - "getrandom 0.2.11", "once_cell", "version_check", "zerocopy", @@ -113,64 +112,58 @@ dependencies = [ [[package]] name = "anchor-attribute-access-control" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa5be5b72abea167f87c868379ba3c2be356bfca9e6f474fd055fa0f7eeb4f2" +checksum = "47fe28365b33e8334dd70ae2f34a43892363012fe239cf37d2ee91693575b1f8" dependencies = [ "anchor-syn", - "anyhow", "proc-macro2", "quote", - "regex", "syn 1.0.109", ] [[package]] name = "anchor-attribute-account" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f468970344c7c9f9d03b4da854fd7c54f21305059f53789d0045c1dd803f0018" +checksum = "3c288d496168268d198d9b53ee9f4f9d260a55ba4df9877ea1d4486ad6109e0f" dependencies = [ "anchor-syn", - "anyhow", "bs58 0.5.0", "proc-macro2", "quote", - "rustversion", "syn 1.0.109", ] [[package]] name = "anchor-attribute-constant" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59948e7f9ef8144c2aefb3f32a40c5fce2798baeec765ba038389e82301017ef" +checksum = "49b77b6948d0eeaaa129ce79eea5bbbb9937375a9241d909ca8fb9e006bb6e90" dependencies = [ "anchor-syn", - "proc-macro2", + "quote", "syn 1.0.109", ] [[package]] name = "anchor-attribute-error" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc753c9d1c7981cb8948cf7e162fb0f64558999c0413058e2d43df1df5448086" +checksum = "4d20bb569c5a557c86101b944721d865e1fd0a4c67c381d31a44a84f07f84828" dependencies = [ "anchor-syn", - "proc-macro2", "quote", "syn 1.0.109", ] [[package]] name = "anchor-attribute-event" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38b4e172ba1b52078f53fdc9f11e3dc0668ad27997838a0aad2d148afac8c97" +checksum = "4cebd8d0671a3a9dc3160c48598d652c34c77de6be4d44345b8b514323284d57" dependencies = [ "anchor-syn", - "anyhow", "proc-macro2", "quote", "syn 1.0.109", @@ -178,25 +171,40 @@ dependencies = [ [[package]] name = "anchor-attribute-program" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eebd21543606ab61e2d83d9da37d24d3886a49f390f9c43a1964735e8c0f0d5" +checksum = "efb2a5eb0860e661ab31aff7bb5e0288357b176380e985bade4ccb395981b42d" dependencies = [ + "anchor-lang-idl", "anchor-syn", "anyhow", + "bs58 0.5.0", + "heck 0.3.3", "proc-macro2", "quote", + "serde_json", "syn 1.0.109", ] [[package]] name = "anchor-derive-accounts" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4720d899b3686396cced9508f23dab420f1308344456ec78ef76f98fda42af" +checksum = "04368b5abef4266250ca8d1d12f4dff860242681e4ec22b885dcfe354fd35aa1" dependencies = [ "anchor-syn", - "anyhow", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-serde" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0bb0e0911ad4a70cab880cdd6287fe1e880a1a9d8e4e6defa8e9044b9796a6c" +dependencies = [ + "anchor-syn", + "borsh-derive-internal 0.10.3", "proc-macro2", "quote", "syn 1.0.109", @@ -204,9 +212,9 @@ dependencies = [ [[package]] name = "anchor-derive-space" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f495e85480bd96ddeb77b71d499247c7d4e8b501e75ecb234e9ef7ae7bd6552a" +checksum = "5ef415ff156dc82e9ecb943189b0cb241b3a6bfc26a180234dc21bd3ef3ce0cb" dependencies = [ "proc-macro2", "quote", @@ -215,9 +223,9 @@ dependencies = [ [[package]] name = "anchor-lang" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d2d4b20100f1310a774aba3471ef268e5c4ba4d5c28c0bbe663c2658acbc414" +checksum = "6620c9486d9d36a4389cab5e37dc34a42ed0bfaa62e6a75a2999ce98f8f2e373" dependencies = [ "anchor-attribute-access-control", "anchor-attribute-account", @@ -226,9 +234,11 @@ dependencies = [ "anchor-attribute-event", "anchor-attribute-program", "anchor-derive-accounts", + "anchor-derive-serde", "anchor-derive-space", + "anchor-lang-idl", "arrayref", - "base64 0.13.1", + "base64 0.21.7", "bincode", "borsh 0.10.3", "bytemuck", @@ -237,27 +247,55 @@ dependencies = [ "thiserror", ] +[[package]] +name = "anchor-lang-idl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31cf97b4e6f7d6144a05e435660fcf757dbc3446d38d0e2b851d11ed13625bba" +dependencies = [ + "anchor-lang-idl-spec", + "anyhow", + "heck 0.3.3", + "regex", + "serde", + "serde_json", + "sha2 0.10.8", +] + +[[package]] +name = "anchor-lang-idl-spec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bdf143115440fe621bdac3a29a1f7472e09f6cd82b2aa569429a0c13f103838" +dependencies = [ + "anyhow", + "serde", +] + [[package]] name = "anchor-spl" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f860599da1c2354e7234c768783049eb42e2f54509ecfc942d2e0076a2da7b" +checksum = "04bd077c34449319a1e4e0bc21cea572960c9ae0d0fefda0dd7c52fcc3c647a3" dependencies = [ "anchor-lang", - "solana-program", - "spl-associated-token-account 1.1.3", - "spl-token 3.5.0", - "spl-token-2022 0.6.1", + "spl-associated-token-account 3.0.2", + "spl-pod 0.2.2", + "spl-token", + "spl-token-2022 3.0.2", + "spl-token-group-interface 0.2.3", + "spl-token-metadata-interface 0.3.3", ] [[package]] name = "anchor-syn" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a125e4b0cc046cfec58f5aa25038e34cf440151d58f0db3afc55308251fe936d" +checksum = "f99daacb53b55cfd37ce14d6c9905929721137fd4c67bbab44a19802aecb622f" dependencies = [ "anyhow", "bs58 0.5.0", + "cargo_toml", "heck 0.3.3", "proc-macro2", "quote", @@ -406,12 +444,6 @@ dependencies = [ "rand 0.8.5", ] -[[package]] -name = "array-bytes" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ad284aeb45c13f2fb4f084de4a420ebf447423bdf9386c0540ce33cb3ef4b8c" - [[package]] name = "arrayref" version = "0.3.7" @@ -452,13 +484,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -550,15 +582,9 @@ checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bincode" @@ -577,9 +603,12 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] [[package]] name = "bitmaps" @@ -649,6 +678,16 @@ dependencies = [ "hashbrown 0.13.2", ] +[[package]] +name = "borsh" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +dependencies = [ + "borsh-derive 1.5.1", + "cfg_aliases", +] + [[package]] name = "borsh-derive" version = "0.9.3" @@ -675,6 +714,20 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "borsh-derive" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +dependencies = [ + "once_cell", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.68", + "syn_derive", +] + [[package]] name = "borsh-derive-internal" version = "0.9.3" @@ -773,9 +826,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" dependencies = [ "bytemuck_derive", ] @@ -788,7 +841,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -803,6 +856,16 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +[[package]] +name = "cargo_toml" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be" +dependencies = [ + "serde", + "toml 0.8.12", +] + [[package]] name = "cc" version = "1.0.83" @@ -819,6 +882,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" version = "0.4.31" @@ -970,11 +1039,10 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ - "cfg-if", "crossbeam-utils", ] @@ -1004,12 +1072,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crunchy" @@ -1102,7 +1167,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -1113,7 +1178,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -1217,22 +1282,22 @@ dependencies = [ [[package]] name = "enum-iterator" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7add3873b5dd076766ee79c8e406ad1a472c385476b9e38849f8eec24f1be689" +checksum = "9fd242f399be1da0a5354aa462d57b4ab2b4ee0683cc552f7c007d2d12d36e94" dependencies = [ "enum-iterator-derive", ] [[package]] name = "enum-iterator-derive" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" +checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -1350,7 +1415,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -1795,7 +1860,7 @@ dependencies = [ "solana-program", "solana-rpc-client", "solana-rpc-client-api", - "spl-associated-token-account 2.2.0", + "spl-associated-token-account 2.3.0", "thiserror", "tokio", "tower", @@ -1841,7 +1906,7 @@ dependencies = [ "solana-program", "solana-rpc-client", "solana-sdk", - "spl-associated-token-account 2.2.0", + "spl-associated-token-account 2.3.0", ] [[package]] @@ -1855,9 +1920,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1894,9 +1959,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libsecp256k1" @@ -1946,6 +2011,18 @@ dependencies = [ "libsecp256k1-core", ] +[[package]] +name = "light-poseidon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" +dependencies = [ + "ark-bn254", + "ark-ff", + "num-bigint 0.4.4", + "thiserror", +] + [[package]] name = "lock_api" version = "0.4.11" @@ -2126,7 +2203,7 @@ checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -2181,15 +2258,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive 0.5.11", -] - [[package]] name = "num_enum" version = "0.6.1" @@ -2201,23 +2269,11 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" -dependencies = [ - "num_enum_derive 0.7.1", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", + "num_enum_derive 0.7.2", ] [[package]] @@ -2229,19 +2285,19 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] name = "num_enum_derive" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -2362,7 +2418,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -2419,7 +2475,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" dependencies = [ - "toml", + "toml 0.5.11", ] [[package]] @@ -2441,6 +2497,15 @@ dependencies = [ "toml_edit 0.20.7", ] +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -2467,9 +2532,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -2483,11 +2548,22 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "qualifier_attr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -2647,12 +2723,12 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "async-compression", - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -2674,6 +2750,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tokio-rustls", @@ -2740,7 +2817,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -2788,7 +2865,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -2803,44 +2880,44 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.12" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" dependencies = [ "itoa", "ryu", @@ -2857,6 +2934,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2888,7 +2974,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -2961,6 +3047,12 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "sized-chunks" version = "0.6.5" @@ -3008,12 +3100,12 @@ dependencies = [ [[package]] name = "solana-account-decoder" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52aec62a85932e26d1085864b0f7b99b31934aec8dd132429bfef6d7fb1d3a6" +checksum = "4973213a11c2e1b924b36e0c6688682b5aa4623f8d4eeaa1204c32cee524e6d6" dependencies = [ "Inflector", - "base64 0.21.5", + "base64 0.21.7", "bincode", "bs58 0.4.0", "bv", @@ -3021,42 +3113,21 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "solana-address-lookup-table-program", "solana-config-program", "solana-sdk", - "spl-token 4.0.0", - "spl-token-2022 0.9.0", - "spl-token-metadata-interface", + "spl-token", + "spl-token-2022 1.0.0", + "spl-token-group-interface 0.1.0", + "spl-token-metadata-interface 0.2.0", "thiserror", "zstd", ] -[[package]] -name = "solana-address-lookup-table-program" -version = "1.16.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee0bd25f4ba0a15fc16c57b41b1e1b14f5271b83214fda158fdedb58758d394e" -dependencies = [ - "bincode", - "bytemuck", - "log", - "num-derive 0.3.3", - "num-traits", - "rustc_version", - "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-program", - "solana-program-runtime", - "solana-sdk", - "thiserror", -] - [[package]] name = "solana-config-program" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fd0fc1efb91a1661aeb1ff6a691156c3b1bffdaed0aa096589499dd83f9e50b" +checksum = "e38b040d3a42e8f7d80c4a86bb0d49d7aed663b56b0fe0ae135d2d145fb7ae3a" dependencies = [ "bincode", "chrono", @@ -3068,31 +3139,23 @@ dependencies = [ [[package]] name = "solana-frozen-abi" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02eb4f0ed3eade20f4abdcc0031167344237cd6e16808bd0f33945f9db7861fe" +checksum = "4867f66e9527fa44451c861c1dc6d9b2a7c7a668d7c6a297cdefbe39f4395b33" dependencies = [ - "ahash 0.8.6", - "blake3", "block-buffer 0.10.4", "bs58 0.4.0", "bv", - "byteorder", - "cc", "either", "generic-array", - "getrandom 0.1.16", "im", "lazy_static", "log", "memmap2", - "once_cell", - "rand_core 0.6.4", "rustc_version", "serde", "serde_bytes", "serde_derive", - "serde_json", "sha2 0.10.8", "solana-frozen-abi-macro", "subtle", @@ -3101,21 +3164,21 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28514761a285944cbad5b3d7930546369b80a713ba37d84bcf6ed2753611765" +checksum = "168f24d97347b85f05192df58d6be3e3047a4aadc4001bc1b9e711a5ec878eea" dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] name = "solana-logger" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c310c6749435ce1ea25a9ae3edfb2fd2c2aed2aa4d4f7e0487a8077a0b1ee30" +checksum = "a0511082fc62f2d086520fff5aa1917c389d8c840930c08ad255ae05952c08a2" dependencies = [ "env_logger", "lazy_static", @@ -3124,9 +3187,9 @@ dependencies = [ [[package]] name = "solana-measure" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d171357580e62aa4ca19c780e25f4e74de064e2780cb8b9f6b6901d986fcd23" +checksum = "be55a3df105431d25f86f2a7da0cbbde5f54c1f0782ca59367ea4a8037bc6797" dependencies = [ "log", "solana-sdk", @@ -3134,9 +3197,9 @@ dependencies = [ [[package]] name = "solana-metrics" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "013cbb3c82588278d2be18d3317ece5286cb54a3a06d5d38fc31e2a76a6d5e2d" +checksum = "ddec097ed7572804389195128dbd57958b427829153c6cd8ec3343c86fe3cd22" dependencies = [ "crossbeam-channel", "gethostname", @@ -3144,25 +3207,26 @@ dependencies = [ "log", "reqwest", "solana-sdk", + "thiserror", ] [[package]] name = "solana-program" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff2aa5434a77413e9d43e971ceb47bdb003f2e8bbc0365a25b684aca2605c25" +checksum = "2bc5a636dc75e5c25651e34f7a36afc9ae60d38166687c5b0375abb580ac81a2" dependencies = [ "ark-bn254", "ark-ec", "ark-ff", "ark-serialize", - "array-bytes", - "base64 0.21.5", + "base64 0.21.7", "bincode", - "bitflags 1.3.2", + "bitflags 2.6.0", "blake3", "borsh 0.10.3", "borsh 0.9.3", + "borsh 1.5.1", "bs58 0.4.0", "bv", "bytemuck", @@ -3176,14 +3240,14 @@ dependencies = [ "lazy_static", "libc", "libsecp256k1", + "light-poseidon", "log", "memoffset", "num-bigint 0.4.4", - "num-derive 0.3.3", + "num-derive 0.4.1", "num-traits", "parking_lot", - "rand 0.7.3", - "rand_chacha 0.2.2", + "rand 0.8.5", "rustc_version", "rustversion", "serde", @@ -3203,21 +3267,21 @@ dependencies = [ [[package]] name = "solana-program-runtime" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1832fefc2187142dac169812518ec20da68b09abad86e4a78f8ae1787e4f56" +checksum = "bf373c3da0387f47fee4c5ed2465a9628b9db026a62211a692a9285aa9251544" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bincode", "eager", "enum-iterator", "itertools", "libc", "log", - "num-derive 0.3.3", + "num-derive 0.4.1", "num-traits", "percentage", - "rand 0.7.3", + "rand 0.8.5", "rustc_version", "serde", "solana-frozen-abi", @@ -3231,12 +3295,12 @@ dependencies = [ [[package]] name = "solana-rpc-client" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c512944689d747a87f76936c89bb59f5be6c9a3189631857f49746cfa47d5bd1" +checksum = "6cb55a08018776a62ecff52139fbcdab1a7baa4e8f077202be58156e8dde4d5f" dependencies = [ "async-trait", - "base64 0.21.5", + "base64 0.21.7", "bincode", "bs58 0.4.0", "indicatif", @@ -3257,11 +3321,11 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918b75f8ac4c358a6b512bf8b7dafc8166ddcb52ded5164c6235e0693ccb09" +checksum = "72a8403038f4d6ab65bc7e7afb3afe8d9824c592232553c5cef55cf3de36025d" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bs58 0.4.0", "jsonrpc-core", "reqwest", @@ -3273,21 +3337,21 @@ dependencies = [ "solana-sdk", "solana-transaction-status", "solana-version", - "spl-token-2022 0.9.0", + "spl-token-2022 1.0.0", "thiserror", ] [[package]] name = "solana-sdk" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1002048941cedbd7dd6a96fdaa3dc5238b998aaa70b81946b1e3ec108cc2be" +checksum = "df43d3a1e1637397ab43cbc216a5a8f977ec8a3cc3f3ae8c3851c83a3255dbcf" dependencies = [ "assert_matches", - "base64 0.21.5", + "base64 0.21.7", "bincode", - "bitflags 1.3.2", - "borsh 0.10.3", + "bitflags 2.6.0", + "borsh 1.5.1", "bs58 0.4.0", "bytemuck", "byteorder", @@ -3304,13 +3368,14 @@ dependencies = [ "libsecp256k1", "log", "memmap2", - "num-derive 0.3.3", + "num-derive 0.4.1", "num-traits", - "num_enum 0.6.1", + "num_enum 0.7.2", "pbkdf2 0.11.0", "qstring", + "qualifier_attr", "rand 0.7.3", - "rand_chacha 0.2.2", + "rand 0.8.5", "rustc_version", "rustversion", "serde", @@ -3320,6 +3385,7 @@ dependencies = [ "serde_with", "sha2 0.10.8", "sha3 0.10.8", + "siphasher", "solana-frozen-abi", "solana-frozen-abi-macro", "solana-logger", @@ -3332,15 +3398,15 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b41b63b2da4a37ce323aba108db21f4c7bfa638dd1bf58fdc870f83bdce48ba" +checksum = "86c76414183a325038ff020b22c07d1e9d2da0703ddc0244acfed37ee2921d96" dependencies = [ "bs58 0.4.0", "proc-macro2", "quote", "rustversion", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -3351,12 +3417,12 @@ checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" [[package]] name = "solana-transaction-status" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0b811793e78a908119cc02edca3ff8b54d5660104ebd06cc0e2e7e2f66900b" +checksum = "4a0cdfdf63192fb60de094fae8e81159e4e3e9aac9659fe3f9ef0e707023fb32" dependencies = [ "Inflector", - "base64 0.21.5", + "base64 0.21.7", "bincode", "borsh 0.10.3", "bs58 0.4.0", @@ -3366,20 +3432,19 @@ dependencies = [ "serde_derive", "serde_json", "solana-account-decoder", - "solana-address-lookup-table-program", "solana-sdk", - "spl-associated-token-account 2.2.0", - "spl-memo 4.0.0", - "spl-token 4.0.0", - "spl-token-2022 0.9.0", + "spl-associated-token-account 2.3.0", + "spl-memo", + "spl-token", + "spl-token-2022 1.0.0", "thiserror", ] [[package]] name = "solana-version" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9513754d3b2203a0e1045a211c5d68e72e4ed135e477344c21d096897fd2bf70" +checksum = "6f4c2f531c22ce806b211118be8928a791425f97de4592371fb57b246ed33e34" dependencies = [ "log", "rustc_version", @@ -3393,13 +3458,13 @@ dependencies = [ [[package]] name = "solana-vote-program" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b6bfc5302ce0383eb129aa3a916705a20d22c4ad448144ef684b7b028d4053f" +checksum = "6d8a6486017e71a3714a8e1a635e17209135cc20535ba9808ccf106d80ff6e8b" dependencies = [ "bincode", "log", - "num-derive 0.3.3", + "num-derive 0.4.1", "num-traits", "rustc_version", "serde", @@ -3415,12 +3480,12 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" -version = "1.16.16" +version = "1.18.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d1fe77918563768a65fd5d6cd2fa06cf0aeb11e529a1ef8c230b0fe018600e3" +checksum = "513407f88394e437b4ff5aad892bc5bf51a655ae2401e6e63549734d3695c46f" dependencies = [ "aes-gcm-siv", - "base64 0.21.5", + "base64 0.21.7", "bincode", "bytemuck", "byteorder", @@ -3429,7 +3494,7 @@ dependencies = [ "itertools", "lazy_static", "merlin", - "num-derive 0.3.3", + "num-derive 0.4.1", "num-traits", "rand 0.7.3", "serde", @@ -3444,9 +3509,9 @@ dependencies = [ [[package]] name = "solana_rbpf" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17d4ba1e58947346e360fabde0697029d36ba83c42f669199b16a8931313cf29" +checksum = "3d457cc2ba742c120492a64b7fa60e22c575e891f6b55039f4d736568fb112a3" dependencies = [ "byteorder", "combine", @@ -3469,33 +3534,33 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spl-associated-token-account" -version = "1.1.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978dba3bcbe88d0c2c58366c254d9ea41c5f73357e72fc0bdee4d6b5fc99c8f4" +checksum = "992d9c64c2564cc8f63a4b508bf3ebcdf2254b0429b13cd1d31adb6162432a5f" dependencies = [ "assert_matches", - "borsh 0.9.3", - "num-derive 0.3.3", + "borsh 0.10.3", + "num-derive 0.4.1", "num-traits", "solana-program", - "spl-token 3.5.0", - "spl-token-2022 0.6.1", + "spl-token", + "spl-token-2022 1.0.0", "thiserror", ] [[package]] name = "spl-associated-token-account" -version = "2.2.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385e31c29981488f2820b2022d8e731aae3b02e6e18e2fd854e4c9a94dc44fc3" +checksum = "a2e688554bac5838217ffd1fab7845c573ff106b6336bf7d290db7c98d5a8efd" dependencies = [ "assert_matches", - "borsh 0.10.3", + "borsh 1.5.1", "num-derive 0.4.1", "num-traits", "solana-program", - "spl-token 4.0.0", - "spl-token-2022 0.9.0", + "spl-token", + "spl-token-2022 3.0.2", "thiserror", ] @@ -3507,7 +3572,18 @@ checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator-derive", + "spl-discriminator-derive 0.1.1", +] + +[[package]] +name = "spl-discriminator" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34d1814406e98b08c5cd02c1126f83fd407ad084adce0b05fda5730677822eac" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator-derive 0.2.0", ] [[package]] @@ -3517,8 +3593,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fadbefec4f3c678215ca72bd71862697bb06b41fd77c0088902dd3203354387b" dependencies = [ "quote", - "spl-discriminator-syn", - "syn 2.0.39", + "spl-discriminator-syn 0.1.1", + "syn 2.0.68", +] + +[[package]] +name = "spl-discriminator-derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9e8418ea6269dcfb01c712f0444d2c75542c04448b480e87de59d2865edc750" +dependencies = [ + "quote", + "spl-discriminator-syn 0.2.0", + "syn 2.0.68", ] [[package]] @@ -3530,17 +3617,21 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.39", + "syn 2.0.68", "thiserror", ] [[package]] -name = "spl-memo" -version = "3.0.1" +name = "spl-discriminator-syn" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" +checksum = "8c1f05593b7ca9eac7caca309720f2eafb96355e037e6d373b909a80fe7b69b9" dependencies = [ - "solana-program", + "proc-macro2", + "quote", + "sha2 0.10.8", + "syn 2.0.68", + "thiserror", ] [[package]] @@ -3562,7 +3653,20 @@ dependencies = [ "bytemuck", "solana-program", "solana-zk-token-sdk", - "spl-program-error", + "spl-program-error 0.3.0", +] + +[[package]] +name = "spl-pod" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046ce669f48cf2eca1ec518916d8725596bfb655beb1c74374cf71dc6cb773c9" +dependencies = [ + "borsh 1.5.1", + "bytemuck", + "solana-program", + "solana-zk-token-sdk", + "spl-program-error 0.4.1", ] [[package]] @@ -3574,7 +3678,20 @@ dependencies = [ "num-derive 0.4.1", "num-traits", "solana-program", - "spl-program-error-derive", + "spl-program-error-derive 0.3.1", + "thiserror", +] + +[[package]] +name = "spl-program-error" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49065093ea91f57b9b2bd81493ff705e2ad4e64507a07dbc02b085778e02770e" +dependencies = [ + "num-derive 0.4.1", + "num-traits", + "solana-program", + "spl-program-error-derive 0.4.1", "thiserror", ] @@ -3587,36 +3704,47 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.39", + "syn 2.0.68", +] + +[[package]] +name = "spl-program-error-derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d375dd76c517836353e093c2dbb490938ff72821ab568b545fd30ab3256b3e" +dependencies = [ + "proc-macro2", + "quote", + "sha2 0.10.8", + "syn 2.0.68", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.4.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062e148d3eab7b165582757453632ffeef490c02c86a48bfdb4988f63eefb3b9" +checksum = "56f335787add7fa711819f9e7c573f8145a5358a709446fe2d24bf2a88117c90" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator", - "spl-pod", - "spl-program-error", - "spl-type-length-value", + "spl-discriminator 0.1.0", + "spl-pod 0.1.0", + "spl-program-error 0.3.0", + "spl-type-length-value 0.3.0", ] [[package]] -name = "spl-token" -version = "3.5.0" +name = "spl-tlv-account-resolution" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e85e168a785e82564160dcb87b2a8e04cee9bfd1f4d488c729d53d6a4bd300d" +checksum = "cace91ba08984a41556efe49cbf2edca4db2f577b649da7827d3621161784bf8" dependencies = [ - "arrayref", "bytemuck", - "num-derive 0.3.3", - "num-traits", - "num_enum 0.5.11", "solana-program", - "thiserror", + "spl-discriminator 0.2.2", + "spl-pod 0.2.2", + "spl-program-error 0.4.1", + "spl-type-length-value 0.4.3", ] [[package]] @@ -3636,44 +3764,78 @@ dependencies = [ [[package]] name = "spl-token-2022" -version = "0.6.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0043b590232c400bad5ee9eb983ced003d15163c4c5d56b090ac6d9a57457b47" +checksum = "d697fac19fd74ff472dfcc13f0b442dd71403178ce1de7b5d16f83a33561c059" dependencies = [ "arrayref", "bytemuck", - "num-derive 0.3.3", + "num-derive 0.4.1", "num-traits", - "num_enum 0.5.11", + "num_enum 0.7.2", "solana-program", + "solana-security-txt", "solana-zk-token-sdk", - "spl-memo 3.0.1", - "spl-token 3.5.0", + "spl-memo", + "spl-pod 0.1.0", + "spl-token", + "spl-token-group-interface 0.1.0", + "spl-token-metadata-interface 0.2.0", + "spl-transfer-hook-interface 0.4.1", + "spl-type-length-value 0.3.0", "thiserror", ] [[package]] name = "spl-token-2022" -version = "0.9.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4abf34a65ba420584a0c35f3903f8d727d1f13ababbdc3f714c6b065a686e86" +checksum = "e5412f99ae7ee6e0afde00defaa354e6228e47e30c0e3adf553e2e01e6abb584" dependencies = [ "arrayref", "bytemuck", "num-derive 0.4.1", "num-traits", - "num_enum 0.7.1", + "num_enum 0.7.2", "solana-program", + "solana-security-txt", "solana-zk-token-sdk", - "spl-memo 4.0.0", - "spl-pod", - "spl-token 4.0.0", - "spl-token-metadata-interface", - "spl-transfer-hook-interface", - "spl-type-length-value", + "spl-memo", + "spl-pod 0.2.2", + "spl-token", + "spl-token-group-interface 0.2.3", + "spl-token-metadata-interface 0.3.3", + "spl-transfer-hook-interface 0.6.3", + "spl-type-length-value 0.4.3", "thiserror", ] +[[package]] +name = "spl-token-group-interface" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b889509d49fa74a4a033ca5dae6c2307e9e918122d97e58562f5c4ffa795c75d" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator 0.1.0", + "spl-pod 0.1.0", + "spl-program-error 0.3.0", +] + +[[package]] +name = "spl-token-group-interface" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d419b5cfa3ee8e0f2386fd7e02a33b3ec8a7db4a9c7064a2ea24849dc4a273b6" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator 0.2.2", + "spl-pod 0.2.2", + "spl-program-error 0.4.1", +] + [[package]] name = "spl-token-metadata-interface" version = "0.2.0" @@ -3682,26 +3844,56 @@ checksum = "4c16ce3ba6979645fb7627aa1e435576172dd63088dc7848cb09aa331fa1fe4f" dependencies = [ "borsh 0.10.3", "solana-program", - "spl-discriminator", - "spl-pod", - "spl-program-error", - "spl-type-length-value", + "spl-discriminator 0.1.0", + "spl-pod 0.1.0", + "spl-program-error 0.3.0", + "spl-type-length-value 0.3.0", +] + +[[package]] +name = "spl-token-metadata-interface" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30179c47e93625680dabb620c6e7931bd12d62af390f447bc7beb4a3a9b5feee" +dependencies = [ + "borsh 1.5.1", + "solana-program", + "spl-discriminator 0.2.2", + "spl-pod 0.2.2", + "spl-program-error 0.4.1", + "spl-type-length-value 0.4.3", ] [[package]] name = "spl-transfer-hook-interface" -version = "0.3.0" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aabdb7c471566f6ddcee724beb8618449ea24b399e58d464d6b5bc7db550259" +dependencies = [ + "arrayref", + "bytemuck", + "solana-program", + "spl-discriminator 0.1.0", + "spl-pod 0.1.0", + "spl-program-error 0.3.0", + "spl-tlv-account-resolution 0.5.2", + "spl-type-length-value 0.3.0", +] + +[[package]] +name = "spl-transfer-hook-interface" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051d31803f873cabe71aec3c1b849f35248beae5d19a347d93a5c9cccc5d5a9b" +checksum = "66a98359769cd988f7b35c02558daa56d496a7e3bd8626e61f90a7c757eedb9b" dependencies = [ "arrayref", "bytemuck", "solana-program", - "spl-discriminator", - "spl-pod", - "spl-program-error", - "spl-tlv-account-resolution", - "spl-type-length-value", + "spl-discriminator 0.2.2", + "spl-pod 0.2.2", + "spl-program-error 0.4.1", + "spl-tlv-account-resolution 0.6.3", + "spl-type-length-value 0.4.3", ] [[package]] @@ -3712,9 +3904,22 @@ checksum = "a468e6f6371f9c69aae760186ea9f1a01c2908351b06a5e0026d21cfc4d7ecac" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator", - "spl-pod", - "spl-program-error", + "spl-discriminator 0.1.0", + "spl-pod 0.1.0", + "spl-program-error 0.3.0", +] + +[[package]] +name = "spl-type-length-value" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "422ce13429dbd41d2cee8a73931c05fda0b0c8ca156a8b0c19445642550bb61a" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator 0.2.2", + "spl-pod 0.2.2", + "spl-program-error 0.4.1", ] [[package]] @@ -3742,15 +3947,27 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "sync_wrapper" version = "0.1.2" @@ -3795,22 +4012,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -3884,7 +4101,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -3920,11 +4137,26 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.12", +] + [[package]] name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -3934,7 +4166,7 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.1.0", "toml_datetime", - "winnow", + "winnow 0.5.19", ] [[package]] @@ -3945,7 +4177,31 @@ checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ "indexmap 2.1.0", "toml_datetime", - "winnow", + "winnow 0.5.19", +] + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow 0.5.19", +] + +[[package]] +name = "toml_edit" +version = "0.22.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +dependencies = [ + "indexmap 2.1.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.15", ] [[package]] @@ -3971,7 +4227,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "bytes", "futures-core", "futures-util", @@ -4016,7 +4272,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -4190,9 +4446,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4200,16 +4456,16 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", "wasm-bindgen-shared", ] @@ -4227,9 +4483,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4237,22 +4493,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" @@ -4451,6 +4707,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "557404e450152cd6795bb558bca69e43c585055f4606e3bcae5894fc6dac9ba0" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" @@ -4478,7 +4743,7 @@ checksum = "e1012d89e3acb79fad7a799ce96866cfb8098b74638465ea1b1533d35900ca90" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] @@ -4498,7 +4763,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.68", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2c7be6c..010ab6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ resolver = "2" [profile.release] lto = "fat" codegen-units = 1 +overflow-checks = true [profile.release.build-override] opt-level = 3 @@ -27,8 +28,8 @@ edition = "2021" publish = false [workspace.dependencies] -anchor-lang = "0.28.0" -anchor-spl = "0.28.0" +anchor-lang = "0.30.1" +anchor-spl = "0.30.1" axum = "0.6.2" bytemuck = "1.14.0" clap = { version = "3.2.25", features = ["derive", "env"] } @@ -42,11 +43,11 @@ serde = "1.0.137" serde_derive = "1.0.171" serde_json = "1.0.102" serde_yaml = "0.9.25" -solana-program = { version = "=1.16.16" } -solana-rpc-client = { version = "=1.16.16" } -solana-rpc-client-api = { version = "=1.16.16" } +solana-program = { version = "1.18" } +solana-rpc-client = { version = "1.18" } +solana-rpc-client-api = { version = "1.18" } solana-security-txt = { version = "1.1.1" } -solana-sdk = { version = "=1.16.16" } +solana-sdk = { version = "1.18" } indexmap = "2.1.0" spl-associated-token-account = "2.2.0" static_assertions = "1.1" diff --git a/programs/merkle-distributor/Cargo.toml b/programs/merkle-distributor/Cargo.toml index a73a341..dd351c1 100644 --- a/programs/merkle-distributor/Cargo.toml +++ b/programs/merkle-distributor/Cargo.toml @@ -17,6 +17,7 @@ no-entrypoint = [] no-idl = [] cpi = ["no-entrypoint"] default = [] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] [dependencies] anchor-lang = { workspace = true } diff --git a/programs/merkle-distributor/idl/merkle_distributor.json b/programs/merkle-distributor/idl/merkle_distributor.json index a0dfe05..49c2d08 100644 --- a/programs/merkle-distributor/idl/merkle_distributor.json +++ b/programs/merkle-distributor/idl/merkle_distributor.json @@ -1,186 +1,384 @@ { - "version": "0.0.1", - "name": "merkle_distributor", + "address": "mERKcfxMC5SqJn4Ld4BUris3WKZZ1ojjWJ3A3J5CKxv", + "metadata": { + "name": "merkle_distributor", + "version": "0.0.1", + "spec": "0.1.0", + "description": "A Solana program for distributing tokens according to a Merkle root.", + "repository": "https://github.com/jito-foundation/governance" + }, "instructions": [ { - "name": "newDistributor", - "docs": [ - "READ THE FOLLOWING:", - "", - "This instruction is susceptible to frontrunning that could result in loss of funds if not handled properly.", - "", - "An attack could look like:", - "- A legitimate user opens a new distributor.", - "- Someone observes the call to this instruction.", - "- They replace the clawback_receiver, admin, or time parameters with their own.", - "", - "One situation that could happen here is the attacker replaces the admin and clawback_receiver with their own", - "and sets the clawback_start_ts with the minimal time allowed. After clawback_start_ts has elapsed,", - "the attacker can steal all funds from the distributor to their own clawback_receiver account.", - "", - "HOW TO AVOID:", - "- When you call into this instruction, ensure your transaction succeeds.", - "- To be extra safe, after your transaction succeeds, read back the state of the created MerkleDistributor account and", - "assert the parameters are what you expect, most importantly the clawback_receiver and admin.", - "- If your transaction fails, double check the value on-chain matches what you expect." + "name": "claim_locked", + "discriminator": [ + 34, + 206, + 181, + 23, + 11, + 207, + 147, + 90 ], "accounts": [ { "name": "distributor", - "isMut": true, - "isSigner": false, "docs": [ - "[MerkleDistributor]." + "The [MerkleDistributor]." + ], + "writable": true + }, + { + "name": "claim_status", + "docs": [ + "Claim Status PDA" ], + "writable": true, "pda": { "seeds": [ { "kind": "const", - "type": "string", - "value": "MerkleDistributor" + "value": [ + 67, + 108, + 97, + 105, + 109, + 83, + 116, + 97, + 116, + 117, + 115 + ] }, { "kind": "account", - "type": "publicKey", - "account": "Mint", - "path": "mint" + "path": "claimant" }, { - "kind": "arg", - "type": "u64", - "path": "version" + "kind": "account", + "path": "distributor" } ] } }, { - "name": "clawbackReceiver", - "isMut": true, - "isSigner": false, - "docs": [ - "Clawback receiver token account" - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "The mint to distribute." - ] - }, - { - "name": "tokenVault", - "isMut": true, - "isSigner": false, - "docs": [ - "Token vault" - ] - }, - { - "name": "admin", - "isMut": true, - "isSigner": true, + "name": "from", "docs": [ - "Admin wallet, responsible for creating the distributor and paying for the transaction.", - "Also has the authority to set the clawback receiver and change itself." - ] + "Distributor ATA containing the tokens to distribute." + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "distributor" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "distributor.mint", + "account": "MerkleDistributor" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false, + "name": "to", "docs": [ - "The [System] program." - ] + "Account to send the claimed tokens to.", + "Claimant must sign the transaction and can only claim on behalf of themself" + ], + "writable": true }, { - "name": "associatedTokenProgram", - "isMut": false, - "isSigner": false, + "name": "claimant", "docs": [ - "The [Associated Token] program." - ] + "Who is claiming the tokens." + ], + "writable": true, + "signer": true }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false, + "name": "token_program", "docs": [ - "The [Token] program." - ] + "SPL [Token] program." + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } ], - "args": [ + "args": [] + }, + { + "name": "clawback", + "discriminator": [ + 111, + 92, + 142, + 79, + 33, + 234, + 82, + 27 + ], + "accounts": [ { - "name": "version", - "type": "u64" + "name": "distributor", + "docs": [ + "The [MerkleDistributor]." + ], + "writable": true }, { - "name": "root", - "type": { - "array": [ - "u8", - 32 - ] + "name": "from", + "docs": [ + "Distributor ATA containing the tokens to distribute." + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "distributor" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "distributor.mint", + "account": "MerkleDistributor" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } } }, { - "name": "maxTotalClaim", - "type": "u64" - }, - { - "name": "maxNumNodes", - "type": "u64" + "name": "to", + "docs": [ + "The Clawback token account." + ], + "writable": true }, { - "name": "startVestingTs", - "type": "i64" + "name": "claimant", + "docs": [ + "Claimant account", + "Anyone can claw back the funds" + ], + "signer": true }, { - "name": "endVestingTs", - "type": "i64" + "name": "system_program", + "docs": [ + "The [System] program." + ], + "address": "11111111111111111111111111111111" }, { - "name": "clawbackStartTs", - "type": "i64" + "name": "token_program", + "docs": [ + "SPL [Token] program." + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } - ] + ], + "args": [] }, { - "name": "newClaim", + "name": "new_claim", + "discriminator": [ + 78, + 177, + 98, + 123, + 210, + 21, + 187, + 83 + ], "accounts": [ { "name": "distributor", - "isMut": true, - "isSigner": false, "docs": [ "The [MerkleDistributor]." - ] + ], + "writable": true }, { - "name": "claimStatus", - "isMut": true, - "isSigner": false, + "name": "claim_status", "docs": [ "Claim status PDA" ], + "writable": true, "pda": { "seeds": [ { "kind": "const", - "type": "string", - "value": "ClaimStatus" + "value": [ + 67, + 108, + 97, + 105, + 109, + 83, + 116, + 97, + 116, + 117, + 115 + ] }, { "kind": "account", - "type": "publicKey", "path": "claimant" }, { "kind": "account", - "type": "publicKey", - "account": "MerkleDistributor", "path": "distributor" } ] @@ -188,52 +386,135 @@ }, { "name": "from", - "isMut": true, - "isSigner": false, "docs": [ "Distributor ATA containing the tokens to distribute." - ] + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "distributor" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "distributor.mint", + "account": "MerkleDistributor" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { "name": "to", - "isMut": true, - "isSigner": false, "docs": [ "Account to send the claimed tokens to." - ] + ], + "writable": true }, { "name": "claimant", - "isMut": true, - "isSigner": true, "docs": [ "Who is claiming the tokens." - ] + ], + "writable": true, + "signer": true }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false, + "name": "token_program", "docs": [ "SPL [Token] program." - ] + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false, + "name": "system_program", "docs": [ "The [System] program." - ] + ], + "address": "11111111111111111111111111111111" } ], "args": [ { - "name": "amountUnlocked", + "name": "amount_unlocked", "type": "u64" }, { - "name": "amountLocked", + "name": "amount_locked", "type": "u64" }, { @@ -250,197 +531,477 @@ ] }, { - "name": "claimLocked", + "name": "new_distributor", + "docs": [ + "READ THE FOLLOWING:", + "", + "This instruction is susceptible to frontrunning that could result in loss of funds if not handled properly.", + "", + "An attack could look like:", + "- A legitimate user opens a new distributor.", + "- Someone observes the call to this instruction.", + "- They replace the clawback_receiver, admin, or time parameters with their own.", + "", + "One situation that could happen here is the attacker replaces the admin and clawback_receiver with their own", + "and sets the clawback_start_ts with the minimal time allowed. After clawback_start_ts has elapsed,", + "the attacker can steal all funds from the distributor to their own clawback_receiver account.", + "", + "HOW TO AVOID:", + "- When you call into this instruction, ensure your transaction succeeds.", + "- To be extra safe, after your transaction succeeds, read back the state of the created MerkleDistributor account and", + "assert the parameters are what you expect, most importantly the clawback_receiver and admin.", + "- If your transaction fails, double check the value on-chain matches what you expect." + ], + "discriminator": [ + 32, + 139, + 112, + 171, + 0, + 2, + 225, + 155 + ], "accounts": [ { "name": "distributor", - "isMut": true, - "isSigner": false, "docs": [ - "The [MerkleDistributor]." + "[MerkleDistributor]." + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 77, + 101, + 114, + 107, + 108, + 101, + 68, + 105, + 115, + 116, + 114, + 105, + 98, + 117, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "arg", + "path": "version" + } + ] + } + }, + { + "name": "clawback_receiver", + "docs": [ + "Clawback receiver token account" + ], + "writable": true + }, + { + "name": "mint", + "docs": [ + "The mint to distribute." ] }, { - "name": "claimStatus", - "isMut": true, - "isSigner": false, + "name": "token_vault", "docs": [ - "Claim Status PDA" + "Token vault" ], + "writable": true, "pda": { "seeds": [ { - "kind": "const", - "type": "string", - "value": "ClaimStatus" + "kind": "account", + "path": "distributor" }, { - "kind": "account", - "type": "publicKey", - "path": "claimant" + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] }, { "kind": "account", - "type": "publicKey", - "account": "MerkleDistributor", - "path": "distributor" + "path": "mint" } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "admin", + "docs": [ + "Admin wallet, responsible for creating the distributor and paying for the transaction.", + "Also has the authority to set the clawback receiver and change itself." + ], + "writable": true, + "signer": true + }, + { + "name": "system_program", + "docs": [ + "The [System] program." + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "The [Associated Token] program." + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "token_program", + "docs": [ + "The [Token] program." + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [ + { + "name": "version", + "type": "u64" + }, + { + "name": "root", + "type": { + "array": [ + "u8", + 32 ] } }, { - "name": "from", - "isMut": true, - "isSigner": false, + "name": "max_total_claim", + "type": "u64" + }, + { + "name": "max_num_nodes", + "type": "u64" + }, + { + "name": "start_vesting_ts", + "type": "i64" + }, + { + "name": "end_vesting_ts", + "type": "i64" + }, + { + "name": "clawback_start_ts", + "type": "i64" + } + ] + }, + { + "name": "set_admin", + "discriminator": [ + 251, + 163, + 0, + 52, + 91, + 194, + 187, + 92 + ], + "accounts": [ + { + "name": "distributor", "docs": [ - "Distributor ATA containing the tokens to distribute." - ] + "The [MerkleDistributor]." + ], + "writable": true }, { - "name": "to", - "isMut": true, - "isSigner": false, + "name": "admin", "docs": [ - "Account to send the claimed tokens to.", - "Claimant must sign the transaction and can only claim on behalf of themself" - ] + "Admin signer" + ], + "writable": true, + "signer": true }, { - "name": "claimant", - "isMut": true, - "isSigner": true, + "name": "new_admin", "docs": [ - "Who is claiming the tokens." - ] + "New admin account" + ], + "writable": true + } + ], + "args": [] + }, + { + "name": "set_clawback_receiver", + "discriminator": [ + 153, + 217, + 34, + 20, + 19, + 29, + 229, + 75 + ], + "accounts": [ + { + "name": "distributor", + "docs": [ + "The [MerkleDistributor]." + ], + "writable": true }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false, + "name": "new_clawback_account", "docs": [ - "SPL [Token] program." + "New clawback account" ] + }, + { + "name": "admin", + "docs": [ + "Admin signer" + ], + "writable": true, + "signer": true } ], "args": [] + } + ], + "accounts": [ + { + "name": "ClaimStatus", + "discriminator": [ + 22, + 183, + 249, + 157, + 247, + 95, + 150, + 96 + ] + }, + { + "name": "MerkleDistributor", + "discriminator": [ + 77, + 119, + 139, + 70, + 84, + 247, + 12, + 26 + ] + } + ], + "events": [ + { + "name": "ClaimedEvent", + "discriminator": [ + 144, + 172, + 209, + 86, + 144, + 87, + 84, + 115 + ] + }, + { + "name": "NewClaimEvent", + "discriminator": [ + 244, + 3, + 231, + 151, + 60, + 101, + 55, + 55 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "InsufficientUnlockedTokens", + "msg": "Insufficient unlocked tokens" + }, + { + "code": 6001, + "name": "StartTooFarInFuture", + "msg": "Deposit Start too far in future" + }, + { + "code": 6002, + "name": "InvalidProof", + "msg": "Invalid Merkle proof." + }, + { + "code": 6003, + "name": "ExceededMaxClaim", + "msg": "Exceeded maximum claim amount" + }, + { + "code": 6004, + "name": "MaxNodesExceeded", + "msg": "Exceeded maximum node count" + }, + { + "code": 6005, + "name": "Unauthorized", + "msg": "Account is not authorized to execute this instruction" + }, + { + "code": 6006, + "name": "OwnerMismatch", + "msg": "Token account owner did not match intended owner" + }, + { + "code": 6007, + "name": "ClawbackDuringVesting", + "msg": "Clawback cannot be before vesting ends" + }, + { + "code": 6008, + "name": "ClawbackBeforeStart", + "msg": "Attempted clawback before start" + }, + { + "code": 6009, + "name": "ClawbackAlreadyClaimed", + "msg": "Clawback already claimed" + }, + { + "code": 6010, + "name": "InsufficientClawbackDelay", + "msg": "Clawback start must be at least one day after vesting end" + }, + { + "code": 6011, + "name": "SameClawbackReceiver", + "msg": "New and old Clawback receivers are identical" }, { - "name": "clawback", - "accounts": [ - { - "name": "distributor", - "isMut": true, - "isSigner": false, - "docs": [ - "The [MerkleDistributor]." - ] - }, - { - "name": "from", - "isMut": true, - "isSigner": false, - "docs": [ - "Distributor ATA containing the tokens to distribute." - ] - }, - { - "name": "to", - "isMut": true, - "isSigner": false, - "docs": [ - "The Clawback token account." - ] - }, - { - "name": "claimant", - "isMut": false, - "isSigner": true, - "docs": [ - "Claimant account", - "Anyone can claw back the funds" - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "The [System] program." - ] - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "SPL [Token] program." - ] - } - ], - "args": [] + "code": 6012, + "name": "SameAdmin", + "msg": "New and old admin are identical" }, { - "name": "setClawbackReceiver", - "accounts": [ - { - "name": "distributor", - "isMut": true, - "isSigner": false, - "docs": [ - "The [MerkleDistributor]." - ] - }, - { - "name": "newClawbackAccount", - "isMut": false, - "isSigner": false, - "docs": [ - "New clawback account" - ] - }, - { - "name": "admin", - "isMut": true, - "isSigner": true, - "docs": [ - "Admin signer" - ] - } - ], - "args": [] + "code": 6013, + "name": "ClaimExpired", + "msg": "Claim window expired" }, { - "name": "setAdmin", - "accounts": [ - { - "name": "distributor", - "isMut": true, - "isSigner": false, - "docs": [ - "The [MerkleDistributor]." - ] - }, - { - "name": "admin", - "isMut": true, - "isSigner": true, - "docs": [ - "Admin signer" - ] - }, - { - "name": "newAdmin", - "isMut": true, - "isSigner": false, - "docs": [ - "New admin account" - ] - } - ], - "args": [] + "code": 6014, + "name": "ArithmeticError", + "msg": "Arithmetic Error (overflow/underflow)" + }, + { + "code": 6015, + "name": "StartTimestampAfterEnd", + "msg": "Start Timestamp cannot be after end Timestamp" + }, + { + "code": 6016, + "name": "TimestampsNotInFuture", + "msg": "Timestamps cannot be in the past" + }, + { + "code": 6017, + "name": "InvalidVersion", + "msg": "Airdrop Version Mismatch" } ], - "accounts": [ + "types": [ { "name": "ClaimStatus", "docs": [ @@ -454,24 +1015,24 @@ "docs": [ "Authority that claimed the tokens." ], - "type": "publicKey" + "type": "pubkey" }, { - "name": "lockedAmount", + "name": "locked_amount", "docs": [ "Locked amount" ], "type": "u64" }, { - "name": "lockedAmountWithdrawn", + "name": "locked_amount_withdrawn", "docs": [ "Locked amount withdrawn" ], "type": "u64" }, { - "name": "unlockedAmount", + "name": "unlocked_amount", "docs": [ "Unlocked amount" ], @@ -480,6 +1041,31 @@ ] } }, + { + "name": "ClaimedEvent", + "docs": [ + "Emitted when tokens are claimed." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "claimant", + "docs": [ + "User that claimed." + ], + "type": "pubkey" + }, + { + "name": "amount", + "docs": [ + "Amount of tokens to distribute." + ], + "type": "u64" + } + ] + } + }, { "name": "MerkleDistributor", "docs": [ @@ -519,80 +1105,80 @@ "docs": [ "[Mint] of the token to be distributed." ], - "type": "publicKey" + "type": "pubkey" }, { - "name": "tokenVault", + "name": "token_vault", "docs": [ "Token Address of the vault" ], - "type": "publicKey" + "type": "pubkey" }, { - "name": "maxTotalClaim", + "name": "max_total_claim", "docs": [ "Maximum number of tokens that can ever be claimed from this [MerkleDistributor]." ], "type": "u64" }, { - "name": "maxNumNodes", + "name": "max_num_nodes", "docs": [ "Maximum number of nodes in [MerkleDistributor]." ], "type": "u64" }, { - "name": "totalAmountClaimed", + "name": "total_amount_claimed", "docs": [ "Total amount of tokens that have been claimed." ], "type": "u64" }, { - "name": "numNodesClaimed", + "name": "num_nodes_claimed", "docs": [ "Number of nodes that have been claimed." ], "type": "u64" }, { - "name": "startTs", + "name": "start_ts", "docs": [ "Lockup time start (Unix Timestamp)" ], "type": "i64" }, { - "name": "endTs", + "name": "end_ts", "docs": [ "Lockup time end (Unix Timestamp)" ], "type": "i64" }, { - "name": "clawbackStartTs", + "name": "clawback_start_ts", "docs": [ "Clawback start (Unix Timestamp)" ], "type": "i64" }, { - "name": "clawbackReceiver", + "name": "clawback_receiver", "docs": [ "Clawback receiver" ], - "type": "publicKey" + "type": "pubkey" }, { "name": "admin", "docs": [ "Admin wallet" ], - "type": "publicKey" + "type": "pubkey" }, { - "name": "clawedBack", + "name": "clawed_back", "docs": [ "Whether or not the distributor has been clawed back" ], @@ -600,130 +1186,31 @@ } ] } - } - ], - "events": [ - { - "name": "NewClaimEvent", - "fields": [ - { - "name": "claimant", - "type": "publicKey", - "index": false - }, - { - "name": "timestamp", - "type": "i64", - "index": false - } - ] - }, - { - "name": "ClaimedEvent", - "fields": [ - { - "name": "claimant", - "type": "publicKey", - "index": false - }, - { - "name": "amount", - "type": "u64", - "index": false - } - ] - } - ], - "errors": [ - { - "code": 6000, - "name": "InsufficientUnlockedTokens", - "msg": "Insufficient unlocked tokens" - }, - { - "code": 6001, - "name": "StartTooFarInFuture", - "msg": "Deposit Start too far in future" - }, - { - "code": 6002, - "name": "InvalidProof", - "msg": "Invalid Merkle proof." - }, - { - "code": 6003, - "name": "ExceededMaxClaim", - "msg": "Exceeded maximum claim amount" - }, - { - "code": 6004, - "name": "MaxNodesExceeded", - "msg": "Exceeded maximum node count" - }, - { - "code": 6005, - "name": "Unauthorized", - "msg": "Account is not authorized to execute this instruction" - }, - { - "code": 6006, - "name": "OwnerMismatch", - "msg": "Token account owner did not match intended owner" - }, - { - "code": 6007, - "name": "ClawbackDuringVesting", - "msg": "Clawback cannot be before vesting ends" - }, - { - "code": 6008, - "name": "ClawbackBeforeStart", - "msg": "Attempted clawback before start" - }, - { - "code": 6009, - "name": "ClawbackAlreadyClaimed", - "msg": "Clawback already claimed" - }, - { - "code": 6010, - "name": "InsufficientClawbackDelay", - "msg": "Clawback start must be at least one day after vesting end" - }, - { - "code": 6011, - "name": "SameClawbackReceiver", - "msg": "New and old Clawback receivers are identical" - }, - { - "code": 6012, - "name": "SameAdmin", - "msg": "New and old admin are identical" - }, - { - "code": 6013, - "name": "ClaimExpired", - "msg": "Claim window expired" - }, - { - "code": 6014, - "name": "ArithmeticError", - "msg": "Arithmetic Error (overflow/underflow)" - }, - { - "code": 6015, - "name": "StartTimestampAfterEnd", - "msg": "Start Timestamp cannot be after end Timestamp" - }, - { - "code": 6016, - "name": "TimestampsNotInFuture", - "msg": "Timestamps cannot be in the past" }, { - "code": 6017, - "name": "InvalidVersion", - "msg": "Airdrop Version Mismatch" + "name": "NewClaimEvent", + "docs": [ + "Emitted when a new claim is created." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "claimant", + "docs": [ + "User that claimed." + ], + "type": "pubkey" + }, + { + "name": "timestamp", + "docs": [ + "Timestamp." + ], + "type": "i64" + } + ] + } } ] -} \ No newline at end of file +} diff --git a/programs/merkle-distributor/src/instructions/new_distributor.rs b/programs/merkle-distributor/src/instructions/new_distributor.rs index d6cbb39..d583a9c 100644 --- a/programs/merkle-distributor/src/instructions/new_distributor.rs +++ b/programs/merkle-distributor/src/instructions/new_distributor.rs @@ -107,7 +107,7 @@ pub fn handle_new_distributor( let distributor = &mut ctx.accounts.distributor; - distributor.bump = *ctx.bumps.get("distributor").unwrap(); + distributor.bump = ctx.bumps.distributor; distributor.version = version; distributor.root = root; distributor.mint = ctx.accounts.mint.key();