diff --git a/Dockerfile.client b/Dockerfile.client index ab9f1bd8..b2faacb8 100644 --- a/Dockerfile.client +++ b/Dockerfile.client @@ -1,22 +1,19 @@ #syntax=docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2230a333fdbcc -FROM docker.io/library/rust:1.49@sha256:a50165ea96983c21832578afb1c8c028674c965bc1ed43b607871b1f362e06a5 +FROM ghcr.io/certusone/solana:1.10.31@sha256:d31e8db926a1d3fbaa9d9211d9979023692614b7b64912651aba0383e8c01bad AS solana -RUN apt-get update && apt-get install -yq libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang ncat +ARG WORMHOLE_TAG=v2.8.9 + +# libudev is needed by spl-token-cli, and ncat is needed by the devnet setup +# script to be able to signal a health status for tilt +RUN apt-get update && apt-get install -yq libudev-dev ncat RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs -RUN curl -sSfL https://release.solana.com/v1.10.13/install | sh -RUN rustup default nightly-2022-02-01 -RUN rustup component add rustfmt +COPY solana /usr/src/solana +WORKDIR /usr/src/solana RUN --mount=type=cache,target=/root/.cache \ - cargo install --version =2.0.12 spl-token-cli + cargo install --version =2.0.12 --locked spl-token-cli -ENV SOLANA_BIN_PATH="/root/.local/share/solana/install/active_release/bin" -ENV PATH="$SOLANA_BIN_PATH:$PATH" - -ADD solana /usr/src/solana - -WORKDIR /usr/src/solana RUN solana config set --keypair "/usr/src/solana/keys/solana-devnet.json" RUN solana config set --url "http://solana-devnet:8899" @@ -25,7 +22,7 @@ ENV EMITTER_ADDRESS="11111111111111111111111111111115" ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o" RUN --mount=type=cache,target=/root/.cache \ - --mount=type=cache,target=bridge/target \ + --mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \ set -xe && \ - cargo build --manifest-path ./bridge/Cargo.toml --package client --release --locked && \ - cp bridge/target/release/client /usr/local/bin + cargo install bridge_client --git https://github.com/certusone/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local && \ + cargo install token_bridge_client --git https://github.com/certusone/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local diff --git a/Dockerfile.solana b/Dockerfile.solana index 76c7453f..6b73909b 100644 --- a/Dockerfile.solana +++ b/Dockerfile.solana @@ -13,21 +13,28 @@ RUN apt-get update && \ zlib1g-dev \ && \ rm -rf /var/lib/apt/lists/* && \ - rustup component add rustfmt && \ - rustup default nightly-2022-01-31 + rustup component add rustfmt -RUN sh -c "$(curl -sSfL https://release.solana.com/v1.10.13/install)" +RUN sh -c "$(curl -sSfL https://release.solana.com/v1.10.31/install)" ENV PATH="/root/.local/share/solana/install/active_release/bin:$PATH" + +ADD solana/rust-toolchain /rust-toolchain # Solana does a questionable download at the beginning of a *first* build-bpf call. Trigger and layer-cache it explicitly. RUN cargo init --lib /tmp/decoy-crate && \ cd /tmp/decoy-crate && cargo build-bpf && \ rm -rf /tmp/decoy-crate -# Add bridge contract sources WORKDIR /usr/src/bridge +ARG WORMHOLE_REV=2.8.9 +ADD https://github.com/certusone/wormhole/archive/refs/tags/v${WORMHOLE_REV}.tar.gz . +RUN tar -xvf v${WORMHOLE_REV}.tar.gz +RUN mv wormhole-${WORMHOLE_REV} wormhole +# RUN mkdir -p /usr/src/bridge/wormhole/solana/target + + ADD solana solana ADD third_party/pyth/p2w-sdk/rust third_party/pyth/p2w-sdk/rust RUN mkdir -p /opt/solana/deps @@ -35,18 +42,17 @@ RUN mkdir -p /opt/solana/deps ENV EMITTER_ADDRESS="11111111111111111111111111111115" ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o" +WORKDIR /usr/src/bridge/solana + # Build Wormhole Solana programs -RUN --mount=type=cache,target=solana/bridge/target \ - --mount=type=cache,target=solana/modules/token_bridge/target \ - --mount=type=cache,target=solana/modules/nft_bridge/target \ - --mount=type=cache,target=solana/pyth2wormhole/target \ - --mount=type=cache,target=solana/migration/target \ - cargo build-bpf --manifest-path "solana/bridge/program/Cargo.toml" -- --locked && \ - cargo build-bpf --manifest-path "solana/bridge/cpi_poster/Cargo.toml" -- --locked && \ - cargo build-bpf --manifest-path "solana/pyth2wormhole/program/Cargo.toml" -- --locked && \ - cp solana/bridge/target/deploy/bridge.so /opt/solana/deps/bridge.so && \ - cp solana/bridge/target/deploy/cpi_poster.so /opt/solana/deps/cpi_poster.so && \ - cp solana/pyth2wormhole/target/deploy/pyth2wormhole.so /opt/solana/deps/pyth2wormhole.so +RUN --mount=type=cache,target=../wormhole/solana/target \ + --mount=type=cache,target=pyth2wormhole/target \ + cargo build-bpf --manifest-path "../wormhole/solana/bridge/program/Cargo.toml" -- --locked && \ + cargo build-bpf --manifest-path "../wormhole/solana/bridge/cpi_poster/Cargo.toml" -- --locked && \ + cargo build-bpf --manifest-path "pyth2wormhole/program/Cargo.toml" -- --locked && \ + cp ../wormhole/solana/target/deploy/bridge.so /opt/solana/deps/bridge.so && \ + cp ../wormhole/solana/target/deploy/cpi_poster.so /opt/solana/deps/cpi_poster.so && \ + cp pyth2wormhole/target/deploy/pyth2wormhole.so /opt/solana/deps/pyth2wormhole.so COPY --from=pyth-oracle-copy /home/pyth/pyth-client/target/oracle.so /opt/solana/deps/pyth_oracle.so diff --git a/Dockerfile.wasm b/Dockerfile.wasm index 1aae188e..3f68b844 100644 --- a/Dockerfile.wasm +++ b/Dockerfile.wasm @@ -5,6 +5,8 @@ RUN apt-get update && \ apt-get install -y libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang && \ apt-get clean && rm -rf /var/lib/apt/lists/* +# We default an older nightly since current rust-toolchain makes the +# wasm-pack build unhappy, we introduce it later for our code RUN rustup component add rustfmt && \ rustup default nightly-2022-01-02 diff --git a/cosmwasm/Cargo.lock b/cosmwasm/Cargo.lock index 4ddbc442..feb2eee2 100644 --- a/cosmwasm/Cargo.lock +++ b/cosmwasm/Cargo.lock @@ -28,38 +28,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -74,7 +42,7 @@ checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object 0.29.0", @@ -87,12 +55,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" -[[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" @@ -115,36 +77,12 @@ dependencies = [ "crunchy 0.1.6", ] -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "blake3" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac 0.8.0", - "digest 0.9.0", -] - [[package]] name = "block-buffer" version = "0.9.0" @@ -152,7 +90,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding", - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -206,28 +144,12 @@ dependencies = [ "syn", ] -[[package]] -name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - [[package]] name = "bumpalo" version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - [[package]] name = "bytecheck" version = "0.6.8" @@ -249,26 +171,6 @@ dependencies = [ "syn", ] -[[package]] -name = "bytemuck" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd2f4180c5721da6335cc9e9061cce522b87a35e51cc57636d28d22a9863c80" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "byteorder" version = "1.4.3" @@ -287,12 +189,6 @@ version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -311,19 +207,13 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - [[package]] name = "cosmwasm-crypto" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5eb0afef2325df81aadbf9be1233f522ed8f6e91df870c764bc44cca2b1415bd" dependencies = [ - "digest 0.9.0", + "digest", "ed25519-zebra", "k256 0.10.4", "rand_core 0.6.3", @@ -345,7 +235,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "875994993c2082a6fcd406937bf0fca21c349e4a624f3810253a14fa83a3a195" dependencies = [ - "base64 0.13.0", + "base64", "cosmwasm-crypto", "cosmwasm-derive", "forward_ref", @@ -462,7 +352,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -471,7 +361,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -481,7 +371,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -493,7 +383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "memoffset", "once_cell", @@ -506,7 +396,7 @@ version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -528,7 +418,7 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f83bd3bb4314701c568e340cd8cf78c975aa0ca79e03d3f6d1677d5b0c9c0c03" dependencies = [ - "generic-array 0.14.5", + "generic-array", "rand_core 0.6.3", "subtle", "zeroize", @@ -540,53 +430,30 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" dependencies = [ - "generic-array 0.14.5", + "generic-array", "rand_core 0.6.3", "subtle", "zeroize", ] -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array 0.14.5", - "subtle", -] - [[package]] name = "crypto-mac" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "generic-array 0.14.5", + "generic-array", "subtle", ] [[package]] name = "curve25519-dalek" -version = "2.1.3" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" dependencies = [ "byteorder", - "digest 0.8.1", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", + "digest", "rand_core 0.5.1", "subtle", "zeroize", @@ -665,22 +532,13 @@ dependencies = [ "const-oid", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -712,7 +570,7 @@ checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9" dependencies = [ "byteorder", "dynasm", - "memmap2 0.5.5", + "memmap2", ] [[package]] @@ -723,7 +581,7 @@ checksum = "43ee23aa5b4f68c7a092b5c3beb25f50c406adc75e2363634f242f28ab255372" dependencies = [ "der 0.4.5", "elliptic-curve 0.10.6", - "hmac 0.11.0", + "hmac", "signature", ] @@ -745,7 +603,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "403ef3e961ab98f0ba902771d29f842058578bb1ce7e3c59dad5a6a93e784c69" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek", "hex", "rand_core 0.6.3", "serde", @@ -768,7 +626,7 @@ checksum = "beca177dcb8eb540133e7680baff45e7cc4d93bf22002676cec549f82343721b" dependencies = [ "crypto-bigint 0.2.11", "ff 0.10.1", - "generic-array 0.14.5", + "generic-array", "group 0.10.0", "rand_core 0.6.3", "subtle", @@ -785,7 +643,7 @@ dependencies = [ "crypto-bigint 0.3.2", "der 0.5.1", "ff 0.11.1", - "generic-array 0.14.5", + "generic-array", "group 0.11.0", "rand_core 0.6.3", "sec1", @@ -834,19 +692,6 @@ dependencies = [ "syn", ] -[[package]] -name = "env_logger" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "fallible-iterator" version = "0.2.0" @@ -862,12 +707,6 @@ dependencies = [ "instant", ] -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - [[package]] name = "ff" version = "0.10.1" @@ -900,22 +739,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ - "serde", "typenum", "version_check", ] @@ -926,7 +755,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] @@ -937,7 +766,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -1017,43 +846,16 @@ dependencies = [ "serde", ] -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - [[package]] name = "hmac" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", + "crypto-mac", + "digest", ] -[[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.5", - "hmac 0.8.1", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "ident_case" version = "1.0.1" @@ -1077,16 +879,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", + "cfg-if", ] [[package]] @@ -1110,7 +903,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "903ae2481bcdfdb7b68e0a9baa4b7c9aff600b9ae2e8e5bb5833b8c91ab851ea" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa 0.12.4", "elliptic-curve 0.10.6", ] @@ -1121,7 +914,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa 0.13.4", "elliptic-curve 0.11.12", "sec1", @@ -1158,65 +951,17 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] -[[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 0.2.2", - "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.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1255,14 +1000,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memmap2" -version = "0.1.0" -source = "git+https://github.com/certusone/wormhole#7a1b1344a19db22935d8532135ac249da128b4e7" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.5.5" @@ -1296,26 +1033,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - [[package]] name = "num_cpus" version = "1.13.1" @@ -1364,9 +1081,8 @@ name = "p2w-sdk" version = "0.1.1" dependencies = [ "hex", - "pyth-sdk-solana", + "pyth-sdk", "serde", - "solana-program", ] [[package]] @@ -1392,12 +1108,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - [[package]] name = "proc-macro-crate" version = "0.1.5" @@ -1477,7 +1187,7 @@ dependencies = [ "cosmwasm-std", "cosmwasm-storage", "cosmwasm-vm", - "generic-array 0.14.5", + "generic-array", "hex", "k256 0.9.6", "lazy_static", @@ -1488,7 +1198,6 @@ dependencies = [ "serde_derive", "serde_json", "sha3", - "solana-program", "terraswap", "thiserror", "wormhole-bridge-terra", @@ -1507,23 +1216,6 @@ dependencies = [ "serde", ] -[[package]] -name = "pyth-sdk-solana" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aed1a0b714f91cb104cc025eb806782e30aa63c23259724e79efd609294a2c9" -dependencies = [ - "borsh", - "borsh-derive", - "bytemuck", - "num-derive", - "num-traits", - "pyth-sdk", - "serde", - "solana-program", - "thiserror", -] - [[package]] name = "quote" version = "1.0.20" @@ -1533,29 +1225,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - [[package]] name = "rand_core" version = "0.5.1" @@ -1574,15 +1243,6 @@ dependencies = [ "getrandom 0.2.7", ] -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - [[package]] name = "rayon" version = "1.5.3" @@ -1627,23 +1287,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "regex" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - [[package]] name = "region" version = "3.0.0" @@ -1681,7 +1324,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" dependencies = [ "crypto-bigint 0.3.2", - "hmac 0.11.0", + "hmac", "zeroize", ] @@ -1722,15 +1365,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - [[package]] name = "rustversion" version = "1.0.8" @@ -1786,27 +1420,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" dependencies = [ "der 0.5.1", - "generic-array 0.14.5", + "generic-array", "pkcs8", "subtle", "zeroize", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.139" @@ -1874,9 +1493,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", - "digest 0.9.0", + "digest", "opaque-debug", ] @@ -1887,7 +1506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" dependencies = [ "block-buffer", - "digest 0.9.0", + "digest", "keccak", "opaque-debug", ] @@ -1898,7 +1517,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2807892cfa58e081aa1f1111391c7a0649d4fa127a4ffbe34bcbfb35a1171a4" dependencies = [ - "digest 0.9.0", + "digest", "rand_core 0.6.3", ] @@ -1908,99 +1527,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" -[[package]] -name = "solana-frozen-abi" -version = "1.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "425be155319bda665dc3483f0c0267ac0fc89017812d0c5d9816b1c7a26c1532" -dependencies = [ - "bs58", - "bv", - "generic-array 0.14.5", - "log", - "memmap2 0.1.0", - "rustc_version", - "serde", - "serde_derive", - "sha2", - "solana-frozen-abi-macro", - "solana-logger", - "thiserror", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d97737c34380c42c9b3e060cf68d1929ad81fea5a3c00887bb82314b788ba13" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "solana-logger" -version = "1.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "659d836ac49f5a53481ead26f4ea78b688a91dedcbe6c51454169491e1648ceb" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - -[[package]] -name = "solana-program" -version = "1.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b2b6d99b5c662975ead69a60ead75b820f2eaa42eb4512c79a919e91807d43" -dependencies = [ - "base64 0.13.0", - "bincode", - "blake3", - "borsh", - "borsh-derive", - "bs58", - "bv", - "bytemuck", - "curve25519-dalek 2.1.3", - "hex", - "itertools", - "lazy_static", - "libsecp256k1", - "log", - "num-derive", - "num-traits", - "rand", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2", - "sha3", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-sdk-macro", - "thiserror", -] - -[[package]] -name = "solana-sdk-macro" -version = "1.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a122a01e936f3b69064f0800e0488617833fc6a4dd86294cf7cc75f34511d6b5" -dependencies = [ - "bs58", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - [[package]] name = "spki" version = "0.5.4" @@ -2052,7 +1578,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", @@ -2060,15 +1586,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - [[package]] name = "terraswap" version = "2.7.0" @@ -2118,7 +1635,7 @@ version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -2193,7 +1710,7 @@ version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -2247,7 +1764,7 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f727a39e7161f7438ddb8eafe571b67c576a8c2fb459f666d9053b5bba4afdea" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "indexmap", "js-sys", "loupe", @@ -2348,7 +1865,7 @@ dependencies = [ "enumset", "lazy_static", "loupe", - "memmap2 0.5.5", + "memmap2", "more-asserts", "rustc-demangle", "serde", @@ -2366,7 +1883,7 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccd7fdc60e252a795c849b3f78a81a134783051407e7e279c10b7019139ef8dc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "enum-iterator", "enumset", "leb128", @@ -2391,7 +1908,7 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcff0cd2c01a8de6009fd863b14ea883132a468a24f2d2ee59dc34453d3a31b5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "enum-iterator", "enumset", "leb128", @@ -2450,7 +1967,7 @@ checksum = "afdc46158517c2769f9938bc222a7d41b3bb330824196279d8aa2d667cd40641" dependencies = [ "backtrace", "cc", - "cfg-if 1.0.0", + "cfg-if", "enum-iterator", "indexmap", "libc", @@ -2498,15 +2015,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2520,7 +2028,7 @@ dependencies = [ "cosmwasm-std", "cosmwasm-storage", "cosmwasm-vm", - "generic-array 0.14.5", + "generic-array", "getrandom 0.2.7", "hex", "k256 0.9.6", @@ -2534,6 +2042,11 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.4.3" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" + +[[patch.unused]] +name = "memmap2" +version = "0.1.0" +source = "git+https://github.com/certusone/wormhole#7a1b1344a19db22935d8532135ac249da128b4e7" diff --git a/cosmwasm/contracts/pyth-bridge/Cargo.toml b/cosmwasm/contracts/pyth-bridge/Cargo.toml index 2f11b2cd..afc82132 100644 --- a/cosmwasm/contracts/pyth-bridge/Cargo.toml +++ b/cosmwasm/contracts/pyth-bridge/Cargo.toml @@ -29,7 +29,6 @@ hex = "0.4.2" lazy_static = "1.4.0" bigint = "4" p2w-sdk = { path = "../../../third_party/pyth/p2w-sdk/rust" } -solana-program = "=1.8.16" pyth-sdk = "0.4.2" [dev-dependencies] diff --git a/devnet/node.yaml b/devnet/node.yaml index 3b47f22c..1cf588a7 100644 --- a/devnet/node.yaml +++ b/devnet/node.yaml @@ -53,7 +53,7 @@ spec: path: bigtable-key.json containers: - name: guardiand - image: ghcr.io/certusone/guardiand:v2.8.8.1 + image: ghcr.io/certusone/guardiand:v2.8.9 volumeMounts: - mountPath: /run/node name: node-rundir @@ -77,8 +77,6 @@ spec: - ws://eth-devnet:8545 - --auroraRPC - ws://eth-devnet:8545 - - --celoRPC - - ws://eth-devnet:8545 - --fantomRPC - ws://eth-devnet:8545 - --oasisRPC @@ -89,12 +87,34 @@ spec: - ws://eth-devnet:8545 - --klaytnRPC - ws://eth-devnet:8545 + - --celoRPC + - ws://eth-devnet:8545 + - --moonbeamRPC + - ws://eth-devnet:8545 + - --neonRPC + - ws://eth-devnet:8545 - --terraWS - ws://terra-terrad:26657/websocket - --terraLCD - http://terra-terrad:1317 - --terraContract - terra14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9ssrc8au + # - --terra2WS + # - ws://terra2-terrad:26657/websocket + # - --terra2LCD + # - http://terra2-terrad:1317 + # - --terra2Contract + # - terra14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9ssrc8au + # - --algorandAppID + # - "4" + # - --algorandIndexerRPC + # - http://algorand:8980 + # - --algorandIndexerToken + # - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + # - --algorandAlgodRPC + # - http://algorand:4001 + # - --algorandAlgodToken + # - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - --solanaContract - Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o - --solanaWS @@ -112,7 +132,8 @@ spec: - /tmp/admin.sock - --dataDir - /tmp/data -# - --logLevel=debug + # - --chainGovernorEnabled=true + # - --logLevel=debug securityContext: capabilities: add: diff --git a/devnet/spy.yaml b/devnet/spy.yaml index f0b486f0..a91c3af8 100644 --- a/devnet/spy.yaml +++ b/devnet/spy.yaml @@ -35,7 +35,7 @@ spec: terminationGracePeriodSeconds: 0 containers: - name: spy - image: ghcr.io/certusone/guardiand:v2.8.8.1 + image: ghcr.io/certusone/guardiand:v2.8.9 command: - /guardiand - spy diff --git a/solana/bridge/Cargo.lock b/solana/bridge/Cargo.lock deleted file mode 100644 index 8a2d1e75..00000000 --- a/solana/bridge/Cargo.lock +++ /dev/null @@ -1,4271 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher 0.3.0", - "cpufeatures", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aes-gcm-siv" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc" -dependencies = [ - "aead", - "aes", - "cipher 0.3.0", - "ctr", - "polyval", - "subtle 2.4.1", - "zeroize", -] - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.6", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "aliasable" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "assert_matches" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" - -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-trait" -version = "0.1.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "base64ct" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea908e7347a8c64e378c17e30ef880ad73e3b4498346b055c2c00ea342f3179" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitmaps" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -dependencies = [ - "typenum", -] - -[[package]] -name = "blake3" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "digest 0.10.3", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding 0.1.5", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding 0.2.1", - "generic-array 0.14.5", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive", - "hashbrown", -] - -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate 0.1.5", - "proc-macro2 1.0.38", - "syn 1.0.94", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "bridge_stub" -version = "0.1.0" -dependencies = [ - "borsh", - "byteorder", - "hex", - "hex-literal", - "libsecp256k1 0.3.5", - "primitive-types", - "rand 0.7.3", - "sha3 0.9.1", - "solana-client", - "solana-program", - "solana-sdk", - "solitaire", - "solitaire-client", - "wormhole-bridge-solana", -] - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" - -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "bytemuck" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" - -[[package]] -name = "bzip2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "caps" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61bf7211aad104ce2769ec05efcdfabf85ee84ac92461d142f22cf8badd0e54c" -dependencies = [ - "errno", - "libc", - "thiserror", -] - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "serde", - "time 0.1.43", - "winapi", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "cipher" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" -dependencies = [ - "crypto-common", - "inout", -] - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "client" -version = "0.1.0" -dependencies = [ - "anyhow", - "borsh", - "clap", - "cpi-poster", - "hex", - "rand 0.7.3", - "shellexpand", - "solana-clap-utils", - "solana-cli-config", - "solana-client", - "solana-program", - "solana-sdk", - "solitaire", - "solitaire-client", - "wormhole-bridge-solana", -] - -[[package]] -name = "console" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "regex", - "terminal_size", - "unicode-width", - "winapi", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "cpi-poster" -version = "0.1.0" -dependencies = [ - "borsh", - "byteorder", - "hex", - "hex-literal", - "libsecp256k1 0.3.5", - "primitive-types", - "rand 0.7.3", - "sha3 0.9.1", - "solana-client", - "solana-program", - "solana-sdk", - "solitaire", - "solitaire-client", - "wormhole-bridge-solana", -] - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" -dependencies = [ - "cfg-if", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" -dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" -dependencies = [ - "cfg-if", - "lazy_static", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" -dependencies = [ - "generic-array 0.14.5", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -dependencies = [ - "generic-array 0.12.4", - "subtle 1.0.0", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array 0.14.5", - "subtle 2.4.1", -] - -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher 0.3.0", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "serde", - "subtle 2.4.1", - "zeroize", -] - -[[package]] -name = "dashmap" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" -dependencies = [ - "cfg-if", - "num_cpus", - "rayon", -] - -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - -[[package]] -name = "derivation-path" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" - -[[package]] -name = "dialoguer" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c8ae48e400addc32a8710c8d62d55cb84249a7d58ac4cd959daecfbaddc545" -dependencies = [ - "console", - "tempfile", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle 2.4.1", -] - -[[package]] -name = "dir-diff" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2860407d7d7e2e004bb2128510ad9e8d669e76fa005ccf567977b5d71b8b4a0b" -dependencies = [ - "walkdir", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dlopen" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e80ad39f814a9abe68583cd50a2d45c8a67561c3361ab8da240587dda80937" -dependencies = [ - "dlopen_derive", - "lazy_static", - "libc", - "winapi", -] - -[[package]] -name = "dlopen_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f236d9e1b1fbd81cea0f9cbdc8dcc7e8ebcd80e6659cd7cb2ad5f6c05946c581" -dependencies = [ - "libc", - "quote 0.6.13", - "syn 0.15.44", -] - -[[package]] -name = "ed25519" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cb2103c580a9f8732121f755eccb51312f7db26314664314c119298107064b" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek", - "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "ed25519-dalek-bip32" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2be62a4061b872c8c0873ee4fc6f101ce7b889d039f019c5fa2af471a59908" -dependencies = [ - "derivation-path", - "ed25519-dalek", - "hmac 0.12.1", - "sha2 0.10.2", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "encoding_rs" -version = "0.8.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enum-iterator" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "event-listener" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fastrand" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" -dependencies = [ - "instant", -] - -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - -[[package]] -name = "filetime" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "winapi", -] - -[[package]] -name = "fixed-hash" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" -dependencies = [ - "static_assertions", -] - -[[package]] -name = "flate2" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" -dependencies = [ - "cfg-if", - "crc32fast", - "libc", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" -dependencies = [ - "matches", - "percent-encoding", -] - -[[package]] -name = "futures" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" - -[[package]] -name = "futures-executor" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" - -[[package]] -name = "futures-macro" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "futures-sink" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" - -[[package]] -name = "futures-task" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" - -[[package]] -name = "futures-util" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "serde", - "typenum", - "version_check", -] - -[[package]] -name = "gethostname" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.10.2+wasi-snapshot-preview1", -] - -[[package]] -name = "h2" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hex-literal" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" - -[[package]] -name = "histogram" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cb882ccb290b8646e554b157ab0b71e64e8d5bef775cd66b6531e52d302669" - -[[package]] -name = "hmac" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" -dependencies = [ - "crypto-mac 0.7.0", - "digest 0.8.1", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.3", -] - -[[package]] -name = "hmac-drbg" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" -dependencies = [ - "digest 0.8.1", - "generic-array 0.12.4", - "hmac 0.7.1", -] - -[[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.5", - "hmac 0.8.1", -] - -[[package]] -name = "http" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "hyper" -version = "0.14.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" -dependencies = [ - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "im" -version = "15.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" -dependencies = [ - "bitmaps", - "rand_core 0.6.3", - "rand_xoshiro", - "rayon", - "serde", - "sized-chunks", - "typenum", - "version_check", -] - -[[package]] -name = "index_list" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9d968042a4902e08810946fc7cd5851eb75e80301342305af755ca06cb82ce" - -[[package]] -name = "indexmap" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "indicatif" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" -dependencies = [ - "console", - "lazy_static", - "number_prefix", - "regex", -] - -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "ipnet" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "jobserver" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "jsonrpc-core" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" -dependencies = [ - "futures", - "futures-executor", - "futures-util", - "log", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "keccak" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.125" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" - -[[package]] -name = "libloading" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "libsecp256k1" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" -dependencies = [ - "arrayref", - "crunchy", - "digest 0.8.1", - "hmac-drbg 0.2.0", - "rand 0.7.3", - "sha2 0.8.2", - "subtle 2.4.1", - "typenum", -] - -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg 0.3.0", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "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 2.4.1", -] - -[[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 = "linked-hash-map" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" - -[[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "lru" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32613e41de4c47ab04970c348ca7ae7382cf116625755af070b008a15516a889" -dependencies = [ - "hashbrown", -] - -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "merlin" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.6.3", - "zeroize", -] - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "miniz_oxide" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - -[[package]] -name = "modular-bitfield" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" -dependencies = [ - "modular-bitfield-impl", - "static_assertions", -] - -[[package]] -name = "modular-bitfield-impl" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "nix" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" -dependencies = [ - "bitflags", - "cc", - "cfg-if", - "libc", - "memoffset", -] - -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "once_cell" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "ouroboros" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71643f290d126e18ac2598876d01e1d57aed164afc78fdb6e2a0c6589a1f6662" -dependencies = [ - "aliasable", - "ouroboros_macro", - "stable_deref_trait", -] - -[[package]] -name = "ouroboros_macro" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9a247206016d424fe8497bc611e510887af5c261fbbf977877c4bb55ca4d82" -dependencies = [ - "Inflector", - "proc-macro-error", - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.5", -] - -[[package]] -name = "parking_lot" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" -dependencies = [ - "lock_api", - "parking_lot_core 0.9.3", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - -[[package]] -name = "pbkdf2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac 0.8.0", -] - -[[package]] -name = "pbkdf2" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7" -dependencies = [ - "digest 0.10.3", -] - -[[package]] -name = "pem" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9a3b09a20e374558580a4914d3b7d89bd61b954a5a5e1dcbea98753addb1947" -dependencies = [ - "base64 0.13.0", -] - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkcs8" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" -dependencies = [ - "der", - "spki", - "zeroize", -] - -[[package]] -name = "pkg-config" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" - -[[package]] -name = "polyval" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug 0.3.0", - "universal-hash", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "primitive-types" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06345ee39fbccfb06ab45f3a1a5798d9dafa04cb8921a76d227040003a234b0e" -dependencies = [ - "fixed-hash", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro-crate" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" -dependencies = [ - "thiserror", - "toml", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -dependencies = [ - "unicode-xid 0.1.0", -] - -[[package]] -name = "proc-macro2" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" -dependencies = [ - "unicode-xid 0.2.3", -] - -[[package]] -name = "qstring" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "quinn" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d147472bc9a09f13b06c044787b6683cdffa02e2865b7f0fb53d67c49ed2988e" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "fxhash", - "quinn-proto", - "quinn-udp", - "rustls", - "thiserror", - "tokio", - "tracing", - "webpki", -] - -[[package]] -name = "quinn-proto" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "359c5eb33845f3ee05c229e65f87cdbc503eea394964b8f1330833d460b4ff3e" -dependencies = [ - "bytes", - "fxhash", - "rand 0.8.5", - "ring", - "rustls", - "rustls-native-certs", - "rustls-pemfile 0.2.1", - "slab", - "thiserror", - "tinyvec", - "tracing", - "webpki", -] - -[[package]] -name = "quinn-udp" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df185e5e5f7611fa6e628ed8f9633df10114b03bbaecab186ec55822c44ac727" -dependencies = [ - "futures-util", - "libc", - "mio", - "quinn-proto", - "socket2", - "tokio", - "tracing", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", -] - -[[package]] -name = "quote" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" -dependencies = [ - "proc-macro2 1.0.38", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom 0.2.6", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_xoshiro" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" -dependencies = [ - "rand_core 0.6.3", -] - -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - -[[package]] -name = "rcgen" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7fa2d386df8533b02184941c76ae2e0d0c1d053f5d43339169d80f21275fc5e" -dependencies = [ - "pem", - "ring", - "time 0.3.9", - "yasna", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.6", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "reqwest" -version = "0.11.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" -dependencies = [ - "base64 0.13.0", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile 0.3.0", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-rustls", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rocksalt" -version = "0.1.0" -dependencies = [ - "byteorder", - "proc-macro2 1.0.38", - "quote 1.0.18", - "sha3 0.9.1", - "solana-program", - "syn 1.0.94", -] - -[[package]] -name = "rpassword" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf099a1888612545b683d2661a1940089f6c2e5a8e38979b2159da876bfd956" -dependencies = [ - "libc", - "serde", - "serde_json", - "winapi", -] - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustls" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a024a432ae760ab3bff924ad91ce1cfa52cb57ed16e1ef32d0d249cfee1a6c13" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls-native-certs" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" -dependencies = [ - "openssl-probe", - "rustls-pemfile 1.0.0", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-pemfile" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" -dependencies = [ - "base64 0.13.0", -] - -[[package]] -name = "rustls-pemfile" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" -dependencies = [ - "base64 0.13.0", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" -dependencies = [ - "base64 0.13.0", -] - -[[package]] -name = "rustversion" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schannel" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" -dependencies = [ - "lazy_static", - "winapi", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "security-framework" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" - -[[package]] -name = "serde" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "serde_json" -version = "1.0.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.8.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" -dependencies = [ - "indexmap", - "ryu", - "serde", - "yaml-rust", -] - -[[package]] -name = "sha-1" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.3", -] - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha2" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.3", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha3" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881bf8156c87b6301fc5ca6b27f11eeb2761224c7081e69b409d5a1951a70c86" -dependencies = [ - "digest 0.10.3", - "keccak", -] - -[[package]] -name = "shellexpand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bdb7831b2d85ddf4a7b148aa19d0587eddbe8671a436b7bd1182eaad0f2829" -dependencies = [ - "dirs-next", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] -name = "signature" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" - -[[package]] -name = "sized-chunks" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" -dependencies = [ - "bitmaps", - "typenum", -] - -[[package]] -name = "slab" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" - -[[package]] -name = "smallvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" - -[[package]] -name = "socket2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "solana-account-decoder" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3ac7a5e07505d44702a4b8703cb07d49cab91ce14c7690428c5d37a56c00f3" -dependencies = [ - "Inflector", - "base64 0.13.0", - "bincode", - "bs58", - "bv", - "lazy_static", - "serde", - "serde_derive", - "serde_json", - "solana-config-program", - "solana-sdk", - "solana-vote-program", - "spl-token", - "spl-token-2022", - "thiserror", - "zstd", -] - -[[package]] -name = "solana-address-lookup-table-program" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e8552f128cfa8c384c15bd1481d8d2b2deeec3ea97f8668263a72c98e90ba2" -dependencies = [ - "bincode", - "bytemuck", - "log", - "num-derive", - "num-traits", - "rustc_version", - "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-program", - "solana-program-runtime", - "solana-sdk", - "thiserror", -] - -[[package]] -name = "solana-bucket-map" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3706e0ef1e02836288a10b8b67bcbee512133336621b0330250b8a02fccba0" -dependencies = [ - "log", - "memmap2", - "modular-bitfield", - "rand 0.7.3", - "solana-measure", - "solana-sdk", - "tempfile", -] - -[[package]] -name = "solana-clap-utils" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f013e36c59855763ad9d700f42521a2b5e4e7f414dbc358215b0eb30e001c682" -dependencies = [ - "chrono", - "clap", - "rpassword", - "solana-perf", - "solana-remote-wallet", - "solana-sdk", - "thiserror", - "tiny-bip39", - "uriparse", - "url", -] - -[[package]] -name = "solana-cli-config" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "699548d391f4416b38df8a574de43cd68903058c6e6913a016465cdb3cd4ecbe" -dependencies = [ - "dirs-next", - "lazy_static", - "serde", - "serde_derive", - "serde_yaml", - "solana-clap-utils", - "solana-sdk", - "url", -] - -[[package]] -name = "solana-client" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8f63b9c6c6b61b0ffdf5592ec6f77a2138c41650cb419e2307f48f10847552a" -dependencies = [ - "async-mutex", - "async-trait", - "base64 0.13.0", - "bincode", - "bs58", - "bytes", - "clap", - "crossbeam-channel", - "futures", - "futures-util", - "indexmap", - "indicatif", - "itertools", - "jsonrpc-core", - "lazy_static", - "log", - "lru", - "quinn", - "quinn-proto", - "rand 0.7.3", - "rand_chacha 0.2.2", - "rayon", - "reqwest", - "rustls", - "semver", - "serde", - "serde_derive", - "serde_json", - "solana-account-decoder", - "solana-clap-utils", - "solana-faucet", - "solana-measure", - "solana-metrics", - "solana-net-utils", - "solana-sdk", - "solana-streamer", - "solana-transaction-status", - "solana-version", - "solana-vote-program", - "thiserror", - "tokio", - "tokio-stream", - "tokio-tungstenite", - "tungstenite", - "url", -] - -[[package]] -name = "solana-compute-budget-program" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36a0261900b2a85fadbadde799b5859079daf6482f11456a0c8e42e03525c8c" -dependencies = [ - "solana-program-runtime", - "solana-sdk", -] - -[[package]] -name = "solana-config-program" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f46d626492e7b4408910b5bc07c2e20ad89d52661c07ab7a569d937d8676d0" -dependencies = [ - "bincode", - "chrono", - "serde", - "serde_derive", - "solana-program-runtime", - "solana-sdk", -] - -[[package]] -name = "solana-faucet" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccc828c593a752c9ec7fbf1964474cdbe3a4dce01c00142dceefb73d712f967" -dependencies = [ - "bincode", - "byteorder", - "clap", - "crossbeam-channel", - "log", - "serde", - "serde_derive", - "solana-clap-utils", - "solana-cli-config", - "solana-logger", - "solana-metrics", - "solana-sdk", - "solana-version", - "spl-memo", - "thiserror", - "tokio", -] - -[[package]] -name = "solana-frozen-abi" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7dd1cefedcc43251a0618c902b8a5ce7ae6c2a5103264633a65b1b40b6ba259" -dependencies = [ - "bs58", - "bv", - "generic-array 0.14.5", - "im", - "lazy_static", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.2", - "solana-frozen-abi-macro", - "thiserror", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c61a1bb5dd9ac1b8f6b4fd276ea4833822668e791f74ae8c45dd792167f4" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "rustc_version", - "syn 1.0.94", -] - -[[package]] -name = "solana-logger" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb5aee1180cc4baa90a25ac4e62897571675f59b3df2948bf4e17f904636fc9" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - -[[package]] -name = "solana-measure" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbfac2bb362d81e62abfd27f4309f9201825757ff720ef46ddb4b6b71e23d4eb" -dependencies = [ - "log", - "solana-sdk", -] - -[[package]] -name = "solana-metrics" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42b895d969c2954f8ba3f77391da3df5ac7bdc58deeca3ee5ad8e28a9ba2b527" -dependencies = [ - "crossbeam-channel", - "gethostname", - "lazy_static", - "log", - "reqwest", - "solana-sdk", -] - -[[package]] -name = "solana-net-utils" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83edc9b096cac5e9fe1a168ab6afa35abd43f6fd5f7b850342afb8b419457996" -dependencies = [ - "bincode", - "clap", - "crossbeam-channel", - "log", - "nix", - "rand 0.7.3", - "serde", - "serde_derive", - "socket2", - "solana-logger", - "solana-sdk", - "solana-version", - "tokio", - "url", -] - -[[package]] -name = "solana-perf" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b59409ba8cf2aa01f4503d1710d8e3e46696479c684296733bce5f8b69f0f58f" -dependencies = [ - "ahash", - "bincode", - "bv", - "caps", - "curve25519-dalek", - "dlopen", - "dlopen_derive", - "fnv", - "lazy_static", - "libc", - "log", - "nix", - "rand 0.7.3", - "rayon", - "serde", - "solana-metrics", - "solana-rayon-threadlimit", - "solana-sdk", - "solana-vote-program", -] - -[[package]] -name = "solana-program" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9452f34caedc50eeb0752c5f9ea7992ec8f618c2041acbbd455e70186f362d51" -dependencies = [ - "base64 0.13.0", - "bincode", - "bitflags", - "blake3", - "borsh", - "borsh-derive", - "bs58", - "bv", - "bytemuck", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1 0.6.0", - "log", - "num-derive", - "num-traits", - "parking_lot 0.12.0", - "rand 0.7.3", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.2", - "sha3 0.10.1", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-sdk-macro", - "thiserror", - "wasm-bindgen", -] - -[[package]] -name = "solana-program-runtime" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20a7f03d9d4a017ca231de86daf38bd788e336e45940abcaa02e3a5b2c71c34f" -dependencies = [ - "base64 0.13.0", - "bincode", - "enum-iterator", - "itertools", - "libc", - "libloading", - "log", - "num-derive", - "num-traits", - "rustc_version", - "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-measure", - "solana-sdk", - "thiserror", -] - -[[package]] -name = "solana-rayon-threadlimit" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "493a6fd0744dad62182c81e6d3cfd3be5b73030a1225ef7b833c45da209a0822" -dependencies = [ - "lazy_static", - "num_cpus", -] - -[[package]] -name = "solana-remote-wallet" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b229e2b28d72dfb431a9cd444e51b9a3d204979dc6ec2ad21d0ce3f963d6789" -dependencies = [ - "console", - "dialoguer", - "log", - "num-derive", - "num-traits", - "parking_lot 0.12.0", - "qstring", - "semver", - "solana-sdk", - "thiserror", - "uriparse", -] - -[[package]] -name = "solana-runtime" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74e6fa8c36b26388e162274df5978a33243062d8a8d6944613653dcc98e1f33" -dependencies = [ - "arrayref", - "bincode", - "blake3", - "bv", - "bytemuck", - "byteorder", - "bzip2", - "crossbeam-channel", - "dashmap", - "dir-diff", - "flate2", - "fnv", - "im", - "index_list", - "itertools", - "lazy_static", - "log", - "memmap2", - "num-derive", - "num-traits", - "num_cpus", - "ouroboros", - "rand 0.7.3", - "rayon", - "regex", - "rustc_version", - "serde", - "serde_derive", - "solana-address-lookup-table-program", - "solana-bucket-map", - "solana-compute-budget-program", - "solana-config-program", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-measure", - "solana-metrics", - "solana-program-runtime", - "solana-rayon-threadlimit", - "solana-sdk", - "solana-stake-program", - "solana-vote-program", - "solana-zk-token-proof-program", - "solana-zk-token-sdk 1.10.13", - "symlink", - "tar", - "tempfile", - "thiserror", - "zstd", -] - -[[package]] -name = "solana-sdk" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd83ce2d96b259233e698623c83431c5c9a1dccbc12b7dfcdbc500a0946ea516" -dependencies = [ - "assert_matches", - "base64 0.13.0", - "bincode", - "bitflags", - "borsh", - "bs58", - "bytemuck", - "byteorder", - "chrono", - "derivation-path", - "digest 0.10.3", - "ed25519-dalek", - "ed25519-dalek-bip32", - "generic-array 0.14.5", - "hmac 0.12.1", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1 0.6.0", - "log", - "memmap2", - "num-derive", - "num-traits", - "pbkdf2 0.10.1", - "qstring", - "rand 0.7.3", - "rand_chacha 0.2.2", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "serde_json", - "sha2 0.10.2", - "sha3 0.10.1", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-program", - "solana-sdk-macro", - "thiserror", - "uriparse", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk-macro" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee7e7c63938c587870f33bd6b81a9c2913773009802ba3eed57116e9f24694a" -dependencies = [ - "bs58", - "proc-macro2 1.0.38", - "quote 1.0.18", - "rustversion", - "syn 1.0.94", -] - -[[package]] -name = "solana-stake-program" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5a8be3c78552209d0a9fafa29eafe2d85704661ad4dc86a68376b0c87dfdc6" -dependencies = [ - "bincode", - "log", - "num-derive", - "num-traits", - "rustc_version", - "serde", - "serde_derive", - "solana-config-program", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-metrics", - "solana-program-runtime", - "solana-sdk", - "solana-vote-program", - "thiserror", -] - -[[package]] -name = "solana-streamer" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebdee4a546dfd0d0e0732eee181003208f237da9ac60d5483063c8957e14edd3" -dependencies = [ - "crossbeam-channel", - "futures-util", - "histogram", - "itertools", - "libc", - "log", - "nix", - "pem", - "pkcs8", - "quinn", - "rand 0.7.3", - "rcgen", - "rustls", - "solana-metrics", - "solana-perf", - "solana-sdk", - "thiserror", - "tokio", -] - -[[package]] -name = "solana-transaction-status" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3ed82c7e7ee3502f9c6e2fe00ee1274a265452d7150211125534541db70ef4" -dependencies = [ - "Inflector", - "base64 0.13.0", - "bincode", - "borsh", - "bs58", - "lazy_static", - "log", - "serde", - "serde_derive", - "serde_json", - "solana-account-decoder", - "solana-measure", - "solana-metrics", - "solana-runtime", - "solana-sdk", - "solana-vote-program", - "spl-associated-token-account", - "spl-memo", - "spl-token", - "spl-token-2022", - "thiserror", -] - -[[package]] -name = "solana-version" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126250d1e5e54960600cc48103762cc0c119a869acd252d76da23ea96bebdc6c" -dependencies = [ - "log", - "rustc_version", - "serde", - "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-sdk", -] - -[[package]] -name = "solana-vote-program" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1c43844b0160eded67745e4a6e6c6384852f1595b9b4c085c4da590b2026aa" -dependencies = [ - "bincode", - "log", - "num-derive", - "num-traits", - "rustc_version", - "serde", - "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-metrics", - "solana-program-runtime", - "solana-sdk", - "thiserror", -] - -[[package]] -name = "solana-zk-token-proof-program" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "269131bff8d2ed0561aded5ace56c8bf9f6ad204ba70afd3ea164b790c4df537" -dependencies = [ - "bytemuck", - "getrandom 0.1.16", - "num-derive", - "num-traits", - "solana-program-runtime", - "solana-sdk", - "solana-zk-token-sdk 1.10.13", -] - -[[package]] -name = "solana-zk-token-sdk" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74b149253f9ed1afb68b3161b53b62b637d0dd7a3b328dffdc8bb5878d48358e" -dependencies = [ - "aes-gcm-siv", - "arrayref", - "base64 0.13.0", - "bincode", - "bytemuck", - "byteorder", - "cipher 0.3.0", - "curve25519-dalek", - "getrandom 0.1.16", - "lazy_static", - "merlin", - "num-derive", - "num-traits", - "rand 0.7.3", - "serde", - "serde_json", - "sha3 0.9.1", - "solana-program", - "solana-sdk", - "subtle 2.4.1", - "thiserror", - "zeroize", -] - -[[package]] -name = "solana-zk-token-sdk" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5500f3c96fafba02151420658dfb80b83113ddbaad8c43a4056367847bb2ddd" -dependencies = [ - "aes-gcm-siv", - "arrayref", - "base64 0.13.0", - "bincode", - "bytemuck", - "byteorder", - "cipher 0.4.3", - "curve25519-dalek", - "getrandom 0.1.16", - "lazy_static", - "merlin", - "num-derive", - "num-traits", - "rand 0.7.3", - "serde", - "serde_json", - "sha3 0.9.1", - "solana-program", - "solana-sdk", - "subtle 2.4.1", - "thiserror", - "zeroize", -] - -[[package]] -name = "solitaire" -version = "0.1.0" -dependencies = [ - "borsh", - "byteorder", - "rocksalt", - "sha3 0.9.1", - "solana-program", -] - -[[package]] -name = "solitaire-client" -version = "0.1.0" -dependencies = [ - "borsh", - "solana-program", - "solana-sdk", - "solitaire", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spki" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "spl-associated-token-account" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b013067447a1396303ddfc294f36e3d260a32f8a16c501c295bcdc7de39b490" -dependencies = [ - "borsh", - "solana-program", - "spl-token", -] - -[[package]] -name = "spl-memo" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" -dependencies = [ - "solana-program", -] - -[[package]] -name = "spl-token" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc67166ef99d10c18cb5e9c208901e6d8255c6513bb1f877977eba48e6cc4fb" -dependencies = [ - "arrayref", - "num-derive", - "num-traits", - "num_enum", - "solana-program", - "thiserror", -] - -[[package]] -name = "spl-token-2022" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce48c69350134e8678de5c0956a531b7de586b28eebdddc03211ceec0660983" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "num_enum", - "solana-program", - "solana-zk-token-sdk 0.8.1", - "spl-memo", - "spl-token", - "thiserror", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "subtle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "symlink" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" - -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] - -[[package]] -name = "syn" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "unicode-xid 0.2.3", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", - "unicode-xid 0.2.3", -] - -[[package]] -name = "tar" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" -dependencies = [ - "filetime", - "libc", - "xattr", -] - -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "time" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" -dependencies = [ - "libc", - "num_threads", -] - -[[package]] -name = "tiny-bip39" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" -dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "tokio" -version = "1.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d0183f6f6001549ab68f8c7585093bb732beefbcf6d23a10b9b95c73a1dd49" -dependencies = [ - "autocfg", - "bytes", - "libc", - "memchr", - "mio", - "num_cpus", - "once_cell", - "parking_lot 0.11.2", - "pin-project-lite", - "signal-hook-registry", - "tokio-macros", - "winapi", -] - -[[package]] -name = "tokio-macros" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls", - "tokio", - "webpki", -] - -[[package]] -name = "tokio-stream" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06cda1232a49558c46f8a504d5b93101d42c0bf7f911f12a105ba48168f821ae" -dependencies = [ - "futures-util", - "log", - "rustls", - "tokio", - "tokio-rustls", - "tungstenite", - "webpki", - "webpki-roots", -] - -[[package]] -name = "tokio-util" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "tower-service" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" - -[[package]] -name = "tracing" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", -] - -[[package]] -name = "tracing-core" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - -[[package]] -name = "tungstenite" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96a2dea40e7570482f28eb57afbe42d97551905da6a9400acc5c328d24004f5" -dependencies = [ - "base64 0.13.0", - "byteorder", - "bytes", - "http", - "httparse", - "log", - "rand 0.8.5", - "rustls", - "sha-1", - "thiserror", - "url", - "utf-8", - "webpki", - "webpki-roots", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "uint" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" - -[[package]] -name = "unicode-normalization" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - -[[package]] -name = "unicode-xid" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" - -[[package]] -name = "universal-hash" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" -dependencies = [ - "generic-array 0.14.5", - "subtle 2.4.1", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "uriparse" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200d0fc04d809396c2ad43f3c95da3582a2556eba8d453c1087f4120ee352ff" -dependencies = [ - "fnv", - "lazy_static", -] - -[[package]] -name = "url" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" -dependencies = [ - "form_urlencoded", - "idna", - "matches", - "percent-encoding", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "wasm-bindgen" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" -dependencies = [ - "cfg-if", - "serde", - "serde_json", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" -dependencies = [ - "quote 1.0.18", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" - -[[package]] -name = "web-sys" -version = "0.3.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" -dependencies = [ - "webpki", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "wormhole-bridge-solana" -version = "0.1.0" -dependencies = [ - "borsh", - "byteorder", - "hex", - "hex-literal", - "libsecp256k1 0.3.5", - "primitive-types", - "rand 0.7.3", - "serde", - "sha3 0.9.1", - "solana-client", - "solana-program", - "solana-sdk", - "solitaire", - "solitaire-client", - "wasm-bindgen", -] - -[[package]] -name = "xattr" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" -dependencies = [ - "libc", -] - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "yasna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346d34a236c9d3e5f3b9b74563f238f955bbd05fa0b8b4efa53c130c43982f4c" -dependencies = [ - "time 0.3.9", -] - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", - "synstructure", -] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" -dependencies = [ - "cc", - "libc", -] - -[[patch.unused]] -name = "memmap2" -version = "0.1.0" diff --git a/solana/bridge/Cargo.toml b/solana/bridge/Cargo.toml deleted file mode 100644 index 0a4c4003..00000000 --- a/solana/bridge/Cargo.toml +++ /dev/null @@ -1,5 +0,0 @@ -[workspace] -members = ["program", "client", "program_stub", "cpi_poster"] - -[patch.crates-io] -memmap2 = { path = "memmap2-rs" } diff --git a/solana/bridge/client/Cargo.toml b/solana/bridge/client/Cargo.toml deleted file mode 100644 index 2a4ae421..00000000 --- a/solana/bridge/client/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "client" -version = "0.1.0" -authors = ["Stan Drozd "] -edition = "2018" - -[dependencies] -anyhow = "1.0.40" -borsh = "=0.9.3" -clap = "2.33.0" -cpi-poster = { path = "../cpi_poster", features = ["no-entrypoint"] } -hex = "0.4.3" -rand = "0.7.3" -shellexpand = "2.1.0" -solana-client = "=1.10.13" -solana-program = "=1.10.13" -solana-sdk = "=1.10.13" -solana-cli-config = "=1.10.13" -solana-clap-utils = "=1.10.13" -solitaire = { path = "../../solitaire/program" } -solitaire-client = { path = "../../solitaire/client" } -wormhole-bridge-solana = { path = "../program", features = ["client"] } \ No newline at end of file diff --git a/solana/bridge/client/src/main.rs b/solana/bridge/client/src/main.rs deleted file mode 100644 index 752be6a5..00000000 --- a/solana/bridge/client/src/main.rs +++ /dev/null @@ -1,506 +0,0 @@ - -#![feature(adt_const_params)] -#![allow(warnings)] - -use std::{ - fmt::Display, - mem::size_of, - process::exit, -}; - -use borsh::BorshDeserialize; -use bridge::{ - accounts::{ - Bridge, - BridgeData, - FeeCollector, - }, -}; -use clap::{ - crate_description, - crate_name, - crate_version, - value_t, - App, - AppSettings, - Arg, - SubCommand, -}; -use hex; -use solana_clap_utils::{ - input_parsers::{ - keypair_of, - pubkey_of, - value_of, - }, - input_validators::{ - is_keypair, - is_pubkey_or_keypair, - is_url, - }, -}; -use solana_client::{ - rpc_client::RpcClient, - rpc_config::RpcSendTransactionConfig, -}; -use solana_sdk::{ - commitment_config::{ - CommitmentConfig, - CommitmentLevel, - }, - native_token::*, - program_error::ProgramError::AccountAlreadyInitialized, - pubkey::Pubkey, - signature::{ - read_keypair_file, - Keypair, - Signer, - }, - system_instruction::transfer, - transaction::Transaction, -}; -use solitaire::{ - processors::seeded::Seeded, - AccountState, - Info, -}; -use solitaire_client::Derive; - -struct Config { - rpc_client: RpcClient, - owner: Keypair, - fee_payer: Keypair, - commitment_config: CommitmentConfig, -} - -type Error = Box; -type CommmandResult = Result, Error>; - -fn command_deploy_bridge( - config: &Config, - bridge: &Pubkey, - initial_guardians: Vec<[u8; 20]>, - guardian_expiration: u32, - message_fee: u64, -) -> CommmandResult { - println!("Initializing Wormhole bridge {}", bridge); - - let minimum_balance_for_rent_exemption = config - .rpc_client - .get_minimum_balance_for_rent_exemption(size_of::())?; - - let ix = bridge::instructions::initialize( - *bridge, - config.owner.pubkey(), - message_fee, - guardian_expiration, - initial_guardians.as_slice(), - ) - .unwrap(); - println!("config account: {}, ", ix.accounts[0].pubkey.to_string()); - let mut transaction = Transaction::new_with_payer(&[ix], Some(&config.fee_payer.pubkey())); - - let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?; - check_fee_payer_balance( - config, - minimum_balance_for_rent_exemption + fee_calculator.calculate_fee(&transaction.message()), - )?; - transaction.sign(&[&config.fee_payer, &config.owner], recent_blockhash); - Ok(Some(transaction)) -} - -fn command_post_message( - config: &Config, - bridge: &Pubkey, - nonce: u32, - payload: Vec, - commitment: bridge::types::ConsistencyLevel, - proxy: Option, -) -> CommmandResult { - println!("Posting a message to the wormhole"); - - // Fetch the message fee - let bridge_config_account = config - .rpc_client - .get_account(&Bridge::<'_, { AccountState::Initialized }>::key( - None, bridge, - ))?; - let bridge_config = BridgeData::try_from_slice(bridge_config_account.data.as_slice())?; - let fee = bridge_config.config.fee; - println!("Message fee: {} lamports", fee); - - let transfer_ix = transfer( - &config.owner.pubkey(), - &FeeCollector::key(None, bridge), - fee, - ); - - let message = Keypair::new(); - let ix = match proxy { - Some(p) => cpi_poster::instructions::post_message( - p, - *bridge, - config.owner.pubkey(), - config.owner.pubkey(), - message.pubkey(), - nonce, - payload, - commitment, - ) - .unwrap(), - None => bridge::instructions::post_message( - *bridge, - config.owner.pubkey(), - config.owner.pubkey(), - message.pubkey(), - nonce, - payload, - commitment, - ) - .unwrap(), - }; - let mut transaction = - Transaction::new_with_payer(&[transfer_ix, ix], Some(&config.fee_payer.pubkey())); - - let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?; - check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?; - transaction.sign( - &[&config.fee_payer, &config.owner, &message], - recent_blockhash, - ); - Ok(Some(transaction)) -} - -fn main() { - let matches = App::new(crate_name!()) - .about(crate_description!()) - .version(crate_version!()) - .setting(AppSettings::SubcommandRequiredElseHelp) - .arg({ - let arg = Arg::with_name("config_file") - .short("C") - .long("config") - .value_name("PATH") - .takes_value(true) - .global(true) - .help("Configuration file to use"); - if let Some(ref config_file) = *solana_cli_config::CONFIG_FILE { - arg.default_value(&config_file) - } else { - arg - } - }) - .arg( - Arg::with_name("json_rpc_url") - .long("url") - .value_name("URL") - .takes_value(true) - .validator(is_url) - .help("JSON RPC URL for the cluster. Default from the configuration file."), - ) - .arg( - Arg::with_name("owner") - .long("owner") - .value_name("KEYPAIR") - .validator(is_keypair) - .takes_value(true) - .help( - "Specify the contract payer account. \ - This may be a keypair file, the ASK keyword. \ - Defaults to the client keypair.", - ), - ) - .arg( - Arg::with_name("fee_payer") - .long("fee-payer") - .value_name("KEYPAIR") - .validator(is_keypair) - .takes_value(true) - .help( - "Specify the fee-payer account. \ - This may be a keypair file, the ASK keyword. \ - Defaults to the client keypair.", - ), - ) - .subcommand( - SubCommand::with_name("upgrade-authority") - .about("Get the derived signer used for contract upgrades") - .arg( - Arg::with_name("bridge") - .long("bridge") - .value_name("BRIDGE_KEY") - .validator(is_pubkey_or_keypair) - .takes_value(true) - .index(1) - .required(true) - .help("Specify the bridge program address"), - ) - ) - .subcommand( - SubCommand::with_name("create-bridge") - .about("Create a new bridge") - .arg( - Arg::with_name("bridge") - .long("bridge") - .value_name("BRIDGE_KEY") - .validator(is_pubkey_or_keypair) - .takes_value(true) - .index(1) - .required(true) - .help("Specify the bridge program address"), - ) - .arg( - Arg::with_name("guardian") - .validator(is_hex) - .value_name("GUARDIAN_ADDRESS") - .takes_value(true) - .index(2) - .required(true) - .help("Address of the initial guardian"), - ) - .arg( - Arg::with_name("guardian_set_expiration") - .validator(is_u32) - .value_name("GUARDIAN_SET_EXPIRATION") - .takes_value(true) - .index(3) - .required(true) - .help("Time in seconds after which a guardian set expires after an update"), - ) - .arg( - Arg::with_name("message_fee") - .validator(is_u64) - .value_name("MESSAGE_FEE") - .takes_value(true) - .index(4) - .required(true) - .help("Initial message posting fee"), - ), - ) - .subcommand( - SubCommand::with_name("post-message") - .about("Post a message via Wormhole") - .arg( - Arg::with_name("bridge") - .long("bridge") - .value_name("BRIDGE_KEY") - .validator(is_pubkey_or_keypair) - .takes_value(true) - .index(1) - .required(true) - .help("Specify the bridge program address"), - ) - .arg( - Arg::with_name("nonce") - .validator(is_u32) - .value_name("NONCE") - .takes_value(true) - .index(2) - .required(true) - .help("Nonce of the message"), - ) - .arg( - Arg::with_name("consistency_level") - .value_name("CONSISTENCY_LEVEL") - .takes_value(true) - .index(3) - .required(true) - .help("Consistency (Commitment) level at which the VAA should be produced "), - ) - .arg( - Arg::with_name("data") - .validator(is_hex) - .value_name("DATA") - .takes_value(true) - .index(4) - .required(true) - .help("Payload of the message"), - ) - .arg( - Arg::with_name("proxy") - .long("proxy") - .validator(is_pubkey_or_keypair) - .value_name("PROXY") - .takes_value(true) - .help("CPI Proxy to use"), - ), - ) - .get_matches(); - - let config = { - let cli_config = if let Some(config_file) = matches.value_of("config_file") { - solana_cli_config::Config::load(config_file).unwrap_or_default() - } else { - solana_cli_config::Config::default() - }; - let json_rpc_url = value_t!(matches, "json_rpc_url", String) - .unwrap_or_else(|_| cli_config.json_rpc_url.clone()); - - let client_keypair = || { - read_keypair_file(&cli_config.keypair_path).unwrap_or_else(|err| { - eprintln!("Unable to read {}: {}", cli_config.keypair_path, err); - exit(1) - }) - }; - - let owner = keypair_of(&matches, "owner").unwrap_or_else(client_keypair); - let fee_payer = keypair_of(&matches, "fee_payer").unwrap_or_else(client_keypair); - - Config { - rpc_client: RpcClient::new(json_rpc_url), - owner, - fee_payer, - commitment_config: CommitmentConfig::processed(), - } - }; - - let _ = match matches.subcommand() { - ("create-bridge", Some(arg_matches)) => { - let bridge = pubkey_of(arg_matches, "bridge").unwrap(); - let initial_guardian: String = value_of(arg_matches, "guardian").unwrap(); - let initial_data = hex::decode(initial_guardian).unwrap(); - let guardian_expiration: u32 = - value_of(arg_matches, "guardian_set_expiration").unwrap(); - let msg_fee: u64 = value_of(arg_matches, "message_fee").unwrap(); - - let mut guardian = [0u8; 20]; - guardian.copy_from_slice(&initial_data); - command_deploy_bridge( - &config, - &bridge, - vec![guardian], - guardian_expiration, - msg_fee, - ) - } - ("upgrade-authority", Some(arg_matches)) => { - let bridge = pubkey_of(arg_matches, "bridge").unwrap(); - let upgrade_auth = , "upgrade">>::key(None, &bridge); - println!("Upgrade Key: {}", upgrade_auth); - - Ok(None) - } - ("post-message", Some(arg_matches)) => { - let bridge = pubkey_of(arg_matches, "bridge").unwrap(); - let data_str: String = value_of(arg_matches, "data").unwrap(); - let data = hex::decode(data_str).unwrap(); - let nonce: u32 = value_of(arg_matches, "nonce").unwrap(); - let consistency_level: String = value_of(arg_matches, "consistency_level").unwrap(); - let proxy = pubkey_of(arg_matches, "proxy"); - - command_post_message( - &config, - &bridge, - nonce, - data, - match consistency_level.to_lowercase().as_str() { - "finalized" => bridge::types::ConsistencyLevel::Finalized, - "confirmed" => bridge::types::ConsistencyLevel::Confirmed, - _ => { - eprintln!("Invalid commitment level"); - exit(1); - } - }, - proxy, - ) - } - - _ => unreachable!(), - } - .and_then(|transaction| { - if let Some(transaction) = transaction { - let signature = config - .rpc_client - .send_and_confirm_transaction_with_spinner_and_config( - &transaction, - config.commitment_config, - RpcSendTransactionConfig { - skip_preflight: true, - preflight_commitment: None, - encoding: None, - max_retries: None, - }, - )?; - println!("Signature: {}", signature); - } - Ok(()) - }) - .map_err(|err| { - eprintln!("{}", err); - exit(1); - }); -} - -pub fn is_u8(amount: T) -> Result<(), String> -where - T: AsRef + Display, -{ - if amount.as_ref().parse::().is_ok() { - Ok(()) - } else { - Err(format!( - "Unable to parse input amount as integer, provided: {}", - amount - )) - } -} - -pub fn is_u32(amount: T) -> Result<(), String> -where - T: AsRef + Display, -{ - if amount.as_ref().parse::().is_ok() { - Ok(()) - } else { - Err(format!( - "Unable to parse input amount as integer, provided: {}", - amount - )) - } -} - -pub fn is_u64(amount: T) -> Result<(), String> -where - T: AsRef + Display, -{ - if amount.as_ref().parse::().is_ok() { - Ok(()) - } else { - Err(format!( - "Unable to parse input amount as integer, provided: {}", - amount - )) - } -} - -pub fn is_hex(value: T) -> Result<(), String> -where - T: AsRef + Display, -{ - hex::decode(value.to_string()) - .map(|_| ()) - .map_err(|e| format!("{}", e)) -} - -fn check_fee_payer_balance(config: &Config, required_balance: u64) -> Result<(), Error> { - let balance = config - .rpc_client - .get_balance_with_commitment( - &config.fee_payer.pubkey(), - CommitmentConfig { - commitment: CommitmentLevel::Processed, - }, - )? - .value; - if balance < required_balance { - Err(format!( - "Fee payer, {}, has insufficient balance: {} required, {} available", - config.fee_payer.pubkey(), - lamports_to_sol(required_balance), - lamports_to_sol(balance) - ) - .into()) - } else { - Ok(()) - } -} diff --git a/solana/bridge/cpi_poster/Cargo.toml b/solana/bridge/cpi_poster/Cargo.toml deleted file mode 100644 index fdf71def..00000000 --- a/solana/bridge/cpi_poster/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "cpi-poster" -version = "0.1.0" -description = "Wormhole bridge core contract" -edition = "2018" - -[lib] -crate-type = ["cdylib", "lib"] -name = "cpi_poster" - -[features] -client = ["solitaire/client", "solitaire-client", "no-entrypoint"] -cpi = ["no-entrypoint"] -default = [] -no-entrypoint = ["solitaire/no-entrypoint"] -trace = ["solitaire/trace"] - -[dependencies] -borsh = "=0.9.3" -byteorder = "1.4.3" -primitive-types = { version = "0.9.0", default-features = false } -sha3 = "0.9.1" -solana-program = "=1.10.13" -wormhole-bridge-solana = { path = "../program", features = ["no-entrypoint"] } -solitaire-client = { path = "../../solitaire/client", optional = true } -solitaire = { path = "../../solitaire/program" } - -[dev-dependencies] -hex = "*" -rand = "0.7.3" -hex-literal = "0.3.1" -libsecp256k1 = { version = "0.3.5", features = [] } -solana-client = "=1.10.13" -solana-sdk = "=1.10.13" diff --git a/solana/bridge/cpi_poster/Xargo.toml b/solana/bridge/cpi_poster/Xargo.toml deleted file mode 100644 index 1744f098..00000000 --- a/solana/bridge/cpi_poster/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] \ No newline at end of file diff --git a/solana/bridge/cpi_poster/src/api.rs b/solana/bridge/cpi_poster/src/api.rs deleted file mode 100644 index a7cdab41..00000000 --- a/solana/bridge/cpi_poster/src/api.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod post_message; - -pub use post_message::*; diff --git a/solana/bridge/cpi_poster/src/api/post_message.rs b/solana/bridge/cpi_poster/src/api/post_message.rs deleted file mode 100644 index a616ffd0..00000000 --- a/solana/bridge/cpi_poster/src/api/post_message.rs +++ /dev/null @@ -1,66 +0,0 @@ -use bridge::types::ConsistencyLevel; -use solana_program::program::invoke; -use solitaire::{ - trace, - *, -}; - -#[derive(FromAccounts)] -pub struct PostMessage<'b> { - /// Bridge config needed for fee calculation. - pub bridge: Mut>, - - /// Account to store the posted message - pub message: Signer>>, - - /// Emitter of the VAA - pub emitter: MaybeMut>, - - /// Tracker for the emitter sequence - pub sequence: Mut>, - - /// Payer for account creation - pub payer: Mut>, - - /// Account to collect tx fee - pub fee_collector: Mut>, - - pub clock: Info<'b>, - - pub bridge_program: Info<'b>, -} - -impl<'b> InstructionContext<'b> for PostMessage<'b> { -} - -#[derive(BorshDeserialize, BorshSerialize)] -pub struct PostMessageData { - /// Unique nonce for this message - pub nonce: u32, - - /// Message payload - pub payload: Vec, - - /// Commitment Level required for an attestation to be produced - pub consistency_level: ConsistencyLevel, -} - -pub fn post_message( - ctx: &ExecutionContext, - accs: &mut PostMessage, - data: PostMessageData, -) -> Result<()> { - let ix = bridge::instructions::post_message( - *accs.bridge_program.key, - *accs.payer.key, - *accs.emitter.key, - *accs.message.key, - data.nonce, - data.payload, - data.consistency_level, - ) - .unwrap(); - invoke(&ix, ctx.accounts)?; - - Ok(()) -} diff --git a/solana/bridge/cpi_poster/src/instructions.rs b/solana/bridge/cpi_poster/src/instructions.rs deleted file mode 100644 index 4feae2a2..00000000 --- a/solana/bridge/cpi_poster/src/instructions.rs +++ /dev/null @@ -1,33 +0,0 @@ -use bridge::types::ConsistencyLevel; -use solana_program::{ - instruction::{ - AccountMeta, - Instruction, - }, - pubkey::Pubkey, -}; - -pub fn post_message( - program_id: Pubkey, - bridge_id: Pubkey, - payer: Pubkey, - emitter: Pubkey, - message: Pubkey, - nonce: u32, - payload: Vec, - commitment: ConsistencyLevel, -) -> solitaire::Result { - let ix = bridge::instructions::post_message( - bridge_id, payer, emitter, message, nonce, payload, commitment, - )?; - let mut accounts = ix.accounts; - accounts.insert(7, AccountMeta::new_readonly(bridge_id, false)); - let mut data = ix.data; - data[0] = 0; - - Ok(Instruction { - program_id, - accounts, - data, - }) -} diff --git a/solana/bridge/cpi_poster/src/lib.rs b/solana/bridge/cpi_poster/src/lib.rs deleted file mode 100644 index fd811b5d..00000000 --- a/solana/bridge/cpi_poster/src/lib.rs +++ /dev/null @@ -1,21 +0,0 @@ - -#![feature(adt_const_params)] -#![allow(non_upper_case_globals)] -#![allow(incomplete_features)] - -pub mod api; - -use solitaire::*; - -#[cfg(feature = "no-entrypoint")] -pub mod instructions; - -pub use api::{ - post_message, - PostMessage, - PostMessageData, -}; - -solitaire! { - PostMessage(PostMessageData) => post_message, -} diff --git a/solana/bridge/program/Cargo.toml b/solana/bridge/program/Cargo.toml deleted file mode 100644 index 377cb70c..00000000 --- a/solana/bridge/program/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -name = "wormhole-bridge-solana" -version = "0.1.0" -description = "Wormhole bridge core contract" -edition = "2018" - -[lib] -crate-type = ["cdylib", "lib"] -name = "bridge" - -[features] -client = ["solitaire/client", "solitaire-client", "no-entrypoint"] -cpi = ["no-entrypoint"] -default = [] -wasm = ["no-entrypoint", "wasm-bindgen"] -no-entrypoint = ["solitaire/no-entrypoint"] -trace = ["solitaire/trace"] - -[dependencies] -borsh = "=0.9.3" -byteorder = "1.4.3" -primitive-types = { version = "0.9.0", default-features = false } -serde = { version = "1.0", features = ["derive"] } -sha3 = "0.9.1" -solana-program = "=1.10.13" -solitaire-client = { path = "../../solitaire/client", optional = true } -solitaire = { path = "../../solitaire/program" } -wasm-bindgen = { version = "0.2.74", features = ["serde-serialize"], optional = true } - -[dev-dependencies] -hex = "*" -rand = "0.7.3" -hex-literal = "0.3.1" -libsecp256k1 = { version = "0.3.5", features = [] } -solana-client = "=1.10.13" -solana-sdk = "=1.10.13" diff --git a/solana/bridge/program/Xargo.toml b/solana/bridge/program/Xargo.toml deleted file mode 100644 index 1744f098..00000000 --- a/solana/bridge/program/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] \ No newline at end of file diff --git a/solana/bridge/program/src/accounts.rs b/solana/bridge/program/src/accounts.rs deleted file mode 100644 index ceca0b90..00000000 --- a/solana/bridge/program/src/accounts.rs +++ /dev/null @@ -1,17 +0,0 @@ -pub mod bridge; -pub mod claim; -pub mod fee_collector; -pub mod guardian_set; -pub mod posted_message; -pub mod posted_vaa; -pub mod sequence; -pub mod signature_set; - -pub use bridge::*; -pub use claim::*; -pub use fee_collector::*; -pub use guardian_set::*; -pub use posted_message::*; -pub use posted_vaa::*; -pub use sequence::*; -pub use signature_set::*; diff --git a/solana/bridge/program/src/accounts/bridge.rs b/solana/bridge/program/src/accounts/bridge.rs deleted file mode 100644 index b074463f..00000000 --- a/solana/bridge/program/src/accounts/bridge.rs +++ /dev/null @@ -1,59 +0,0 @@ -//! The Bridge account contains the main state for the wormhole bridge, as well as tracking -//! configuration options for how the bridge should behave. - -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use serde::{ - Deserialize, - Serialize, -}; -use solitaire::{ - AccountOwner, - AccountState, - Data, - Derive, - Owned, -}; - -pub type Bridge<'a, const State: AccountState> = Derive, "Bridge">; - -#[derive(Clone, Default, BorshSerialize, BorshDeserialize, Serialize, Deserialize)] -pub struct BridgeData { - /// The current guardian set index, used to decide which signature sets to accept. - pub guardian_set_index: u32, - - /// Lamports in the collection account - pub last_lamports: u64, - - /// Bridge configuration, which is set once upon initialization. - pub config: BridgeConfig, -} - -#[cfg(not(feature = "cpi"))] -impl Owned for BridgeData { - fn owner(&self) -> AccountOwner { - AccountOwner::This - } -} - -#[cfg(feature = "cpi")] -impl Owned for BridgeData { - fn owner(&self) -> AccountOwner { - use std::str::FromStr; - use solana_program::pubkey::Pubkey; - AccountOwner::Other(Pubkey::from_str(env!("BRIDGE_ADDRESS")).unwrap()) - } -} - -#[derive(Clone, Default, BorshSerialize, BorshDeserialize, Serialize, Deserialize)] -pub struct BridgeConfig { - /// Period for how long a guardian set is valid after it has been replaced by a new one. This - /// guarantees that VAAs issued by that set can still be submitted for a certain period. In - /// this period we still trust the old guardian set. - pub guardian_set_expiration_time: u32, - - /// Amount of lamports that needs to be paid to the protocol to post a message - pub fee: u64, -} diff --git a/solana/bridge/program/src/accounts/claim.rs b/solana/bridge/program/src/accounts/claim.rs deleted file mode 100644 index 9048b24c..00000000 --- a/solana/bridge/program/src/accounts/claim.rs +++ /dev/null @@ -1,47 +0,0 @@ -//! ClaimData accounts are one off markers that can be combined with other accounts to represent -//! data that can only be used once. - -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use serde::{ - Deserialize, - Serialize, -}; -use solitaire::{ - processors::seeded::Seeded, - AccountOwner, - AccountState, - Data, - Owned, -}; - -pub type Claim<'a, const State: AccountState> = Data<'a, ClaimData, { State }>; - -#[derive(Default, Clone, Copy, BorshDeserialize, BorshSerialize, Serialize, Deserialize)] -pub struct ClaimData { - pub claimed: bool, -} - -impl Owned for ClaimData { - fn owner(&self) -> AccountOwner { - AccountOwner::This - } -} - -pub struct ClaimDerivationData { - pub emitter_address: [u8; 32], - pub emitter_chain: u16, - pub sequence: u64, -} - -impl<'b, const State: AccountState> Seeded<&ClaimDerivationData> for Claim<'b, { State }> { - fn seeds(data: &ClaimDerivationData) -> Vec> { - return vec![ - data.emitter_address.to_vec(), - data.emitter_chain.to_be_bytes().to_vec(), - data.sequence.to_be_bytes().to_vec(), - ]; - } -} diff --git a/solana/bridge/program/src/accounts/fee_collector.rs b/solana/bridge/program/src/accounts/fee_collector.rs deleted file mode 100644 index a7256860..00000000 --- a/solana/bridge/program/src/accounts/fee_collector.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! The FeeCollector is a simple account that collects SOL fees. - -use solitaire::{ - Derive, - Info, -}; - -pub type FeeCollector<'a> = Derive, "fee_collector">; diff --git a/solana/bridge/program/src/accounts/guardian_set.rs b/solana/bridge/program/src/accounts/guardian_set.rs deleted file mode 100644 index fd945948..00000000 --- a/solana/bridge/program/src/accounts/guardian_set.rs +++ /dev/null @@ -1,65 +0,0 @@ -//! GuardianSet represents an account containing information about the current active guardians -//! responsible for signing wormhole VAAs. - -use crate::types::GuardianPublicKey; -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use serde::{ - Deserialize, - Serialize, -}; -use solitaire::{ - processors::seeded::Seeded, - AccountOwner, - AccountState, - Data, - Owned, -}; - -pub type GuardianSet<'b, const State: AccountState> = Data<'b, GuardianSetData, { State }>; - -#[derive(Default, BorshSerialize, BorshDeserialize, Serialize, Deserialize)] -pub struct GuardianSetData { - /// Index representing an incrementing version number for this guardian set. - pub index: u32, - - /// ETH style public keys - pub keys: Vec, - - /// Timestamp representing the time this guardian became active. - pub creation_time: u32, - - /// Expiration time when VAAs issued by this set are no longer valid. - pub expiration_time: u32, -} - -/// GuardianSet account PDAs are indexed by their version number. -pub struct GuardianSetDerivationData { - pub index: u32, -} - -impl<'a, const State: AccountState> Seeded<&GuardianSetDerivationData> - for GuardianSet<'a, { State }> -{ - fn seeds(data: &GuardianSetDerivationData) -> Vec> { - vec![ - "GuardianSet".as_bytes().to_vec(), - data.index.to_be_bytes().to_vec(), - ] - } -} - -impl GuardianSetData { - /// Number of guardians in the set - pub fn num_guardians(&self) -> u8 { - self.keys.iter().filter(|v| **v != [0u8; 20]).count() as u8 - } -} - -impl Owned for GuardianSetData { - fn owner(&self) -> AccountOwner { - AccountOwner::This - } -} diff --git a/solana/bridge/program/src/accounts/posted_message.rs b/solana/bridge/program/src/accounts/posted_message.rs deleted file mode 100644 index a40a96bf..00000000 --- a/solana/bridge/program/src/accounts/posted_message.rs +++ /dev/null @@ -1,119 +0,0 @@ -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use serde::{ - Deserialize, - Serialize, -}; -use solana_program::pubkey::Pubkey; -use solitaire::{ - AccountOwner, - AccountState, - Data, - Owned, -}; -use std::{ - io::Write, - ops::{ - Deref, - DerefMut, - }, -}; - -pub type PostedMessage<'a, const State: AccountState> = Data<'a, PostedMessageData, { State }>; - -// This is using the same payload as the PostedVAA for backwards compatibility. -// This will be deprecated in a future release. -#[repr(transparent)] -pub struct PostedMessageData(pub MessageData); - -#[derive(Debug, Default, BorshSerialize, BorshDeserialize, Clone, Serialize, Deserialize)] -pub struct MessageData { - /// Header of the posted VAA - pub vaa_version: u8, - - /// Level of consistency requested by the emitter - pub consistency_level: u8, - - /// Time the vaa was submitted - pub vaa_time: u32, - - /// Account where signatures are stored - pub vaa_signature_account: Pubkey, - - /// Time the posted message was created - pub submission_time: u32, - - /// Unique nonce for this message - pub nonce: u32, - - /// Sequence number of this message - pub sequence: u64, - - /// Emitter of the message - pub emitter_chain: u16, - - /// Emitter of the message - pub emitter_address: [u8; 32], - - /// Message payload - pub payload: Vec, -} - -impl BorshSerialize for PostedMessageData { - fn serialize(&self, writer: &mut W) -> std::io::Result<()> { - writer.write(b"msg")?; - BorshSerialize::serialize(&self.0, writer) - } -} - -impl BorshDeserialize for PostedMessageData { - fn deserialize(buf: &mut &[u8]) -> std::io::Result { - *buf = &buf[3..]; - Ok(PostedMessageData( - ::deserialize(buf)?, - )) - } -} - -impl Deref for PostedMessageData { - type Target = MessageData; - - fn deref(&self) -> &Self::Target { - unsafe { std::mem::transmute(&self.0) } - } -} - -impl DerefMut for PostedMessageData { - fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { std::mem::transmute(&mut self.0) } - } -} - -impl Default for PostedMessageData { - fn default() -> Self { - PostedMessageData(MessageData::default()) - } -} - -impl Clone for PostedMessageData { - fn clone(&self) -> Self { - PostedMessageData(self.0.clone()) - } -} - -#[cfg(not(feature = "cpi"))] -impl Owned for PostedMessageData { - fn owner(&self) -> AccountOwner { - AccountOwner::This - } -} - -#[cfg(feature = "cpi")] -impl Owned for PostedMessageData { - fn owner(&self) -> AccountOwner { - use std::str::FromStr; - AccountOwner::Other(Pubkey::from_str(env!("BRIDGE_ADDRESS")).unwrap()) - } -} diff --git a/solana/bridge/program/src/accounts/posted_vaa.rs b/solana/bridge/program/src/accounts/posted_vaa.rs deleted file mode 100644 index c0ae23cf..00000000 --- a/solana/bridge/program/src/accounts/posted_vaa.rs +++ /dev/null @@ -1,91 +0,0 @@ -use crate::MessageData; -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use solitaire::{ - processors::seeded::Seeded, - AccountOwner, - AccountState, - Data, - Owned, -}; -use std::{ - io::Write, - ops::{ - Deref, - DerefMut, - }, -}; - -pub type PostedVAA<'b, const State: AccountState> = Data<'b, PostedVAAData, { State }>; - -pub struct PostedVAADerivationData { - pub payload_hash: Vec, -} - -impl<'a, const State: AccountState> Seeded<&PostedVAADerivationData> for PostedVAA<'a, { State }> { - fn seeds(data: &PostedVAADerivationData) -> Vec> { - vec!["PostedVAA".as_bytes().to_vec(), data.payload_hash.to_vec()] - } -} - -#[repr(transparent)] -pub struct PostedVAAData(pub MessageData); - -impl BorshSerialize for PostedVAAData { - fn serialize(&self, writer: &mut W) -> std::io::Result<()> { - writer.write(b"vaa")?; - BorshSerialize::serialize(&self.0, writer) - } -} - -impl BorshDeserialize for PostedVAAData { - fn deserialize(buf: &mut &[u8]) -> std::io::Result { - *buf = &buf[3..]; - Ok(PostedVAAData( - ::deserialize(buf)?, - )) - } -} - -impl Deref for PostedVAAData { - type Target = MessageData; - - fn deref(&self) -> &Self::Target { - unsafe { std::mem::transmute(&self.0) } - } -} - -impl DerefMut for PostedVAAData { - fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { std::mem::transmute(&mut self.0) } - } -} - -impl Default for PostedVAAData { - fn default() -> Self { - PostedVAAData(MessageData::default()) - } -} - -impl Clone for PostedVAAData { - fn clone(&self) -> Self { - PostedVAAData(self.0.clone()) - } -} -#[cfg(not(feature = "cpi"))] -impl Owned for PostedVAAData { - fn owner(&self) -> AccountOwner { - AccountOwner::This - } -} - -#[cfg(feature = "cpi")] -impl Owned for PostedVAAData { - fn owner(&self) -> AccountOwner { - use std::str::FromStr; - use solana_program::pubkey::Pubkey; - AccountOwner::Other(Pubkey::from_str(env!("BRIDGE_ADDRESS")).unwrap()) - } -} diff --git a/solana/bridge/program/src/accounts/sequence.rs b/solana/bridge/program/src/accounts/sequence.rs deleted file mode 100644 index 4da59253..00000000 --- a/solana/bridge/program/src/accounts/sequence.rs +++ /dev/null @@ -1,38 +0,0 @@ -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use solana_program::pubkey::Pubkey; -use solitaire::{ - processors::seeded::Seeded, - AccountState, - AccountOwner, - Data, - Owned, -}; - -pub type Sequence<'b> = Data<'b, SequenceTracker, { AccountState::MaybeInitialized }>; - -#[derive(Default, Clone, Copy, BorshDeserialize, BorshSerialize)] -pub struct SequenceTracker { - pub sequence: u64, -} - -pub struct SequenceDerivationData<'a> { - pub emitter_key: &'a Pubkey, -} - -impl<'b> Seeded<&SequenceDerivationData<'b>> for Sequence<'b> { - fn seeds(data: &SequenceDerivationData) -> Vec> { - vec![ - "Sequence".as_bytes().to_vec(), - data.emitter_key.to_bytes().to_vec(), - ] - } -} - -impl Owned for SequenceTracker { - fn owner(&self) -> AccountOwner { - AccountOwner::This - } -} diff --git a/solana/bridge/program/src/accounts/signature_set.rs b/solana/bridge/program/src/accounts/signature_set.rs deleted file mode 100644 index a45129e6..00000000 --- a/solana/bridge/program/src/accounts/signature_set.rs +++ /dev/null @@ -1,32 +0,0 @@ -//! PostedMessage - -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use solitaire::{ - AccountOwner, - AccountState, - Data, - Owned, -}; - -pub type SignatureSet<'b, const State: AccountState> = Data<'b, SignatureSetData, { State }>; - -#[derive(Default, BorshSerialize, BorshDeserialize)] -pub struct SignatureSetData { - /// Signatures of validators - pub signatures: Vec, - - /// Hash of the data - pub hash: [u8; 32], - - /// Index of the guardian set - pub guardian_set_index: u32, -} - -impl Owned for SignatureSetData { - fn owner(&self) -> AccountOwner { - AccountOwner::This - } -} diff --git a/solana/bridge/program/src/api.rs b/solana/bridge/program/src/api.rs deleted file mode 100644 index a6fc7cf1..00000000 --- a/solana/bridge/program/src/api.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod governance; -pub mod initialize; -pub mod post_message; -pub mod post_vaa; -pub mod verify_signature; - -pub use governance::*; -pub use initialize::*; -pub use post_message::*; -pub use post_vaa::*; -pub use verify_signature::*; diff --git a/solana/bridge/program/src/api/governance.rs b/solana/bridge/program/src/api/governance.rs deleted file mode 100644 index a24b146f..00000000 --- a/solana/bridge/program/src/api/governance.rs +++ /dev/null @@ -1,299 +0,0 @@ -use solitaire::*; - -use solana_program::{ - log::sol_log, - program::invoke_signed, - program_error::ProgramError, - pubkey::Pubkey, - sysvar::{ - clock::Clock, - rent::Rent, - }, -}; -use solitaire::{ - processors::seeded::Seeded, - CreationLamports::Exempt, -}; - -use crate::{ - accounts::{ - Bridge, - GuardianSet, - GuardianSetDerivationData, - }, - error::Error::{ - InvalidFeeRecipient, - InvalidGovernanceKey, - InvalidGovernanceWithdrawal, - InvalidGuardianSetUpgrade, - }, - types::{ - GovernancePayloadGuardianSetChange, - GovernancePayloadSetMessageFee, - GovernancePayloadTransferFees, - GovernancePayloadUpgrade, - }, - vaa::ClaimableVAA, - DeserializePayload, - CHAIN_ID_SOLANA, -}; - -fn verify_governance<'a, T>(vaa: &ClaimableVAA<'a, T>) -> Result<()> -where - T: DeserializePayload, -{ - let expected_emitter = std::option_env!("EMITTER_ADDRESS").ok_or_else(|| { - sol_log("EMITTER_ADDRESS not set at compile-time"); - ProgramError::UninitializedAccount - })?; - let current_emitter = format!( - "{}", - Pubkey::new_from_array(vaa.message.meta().emitter_address) - ); - // Fail if the emitter is not the known governance key, or the emitting chain is not Solana. - if expected_emitter != current_emitter || vaa.message.meta().emitter_chain != CHAIN_ID_SOLANA { - Err(InvalidGovernanceKey.into()) - } else { - Ok(()) - } -} - -#[derive(FromAccounts)] -pub struct UpgradeContract<'b> { - /// Payer for account creation (vaa-claim) - pub payer: Mut>>, - - /// Bridge config - pub bridge: Mut>, - - /// GuardianSet change VAA - pub vaa: ClaimableVAA<'b, GovernancePayloadUpgrade>, - - /// PDA authority for the loader - pub upgrade_authority: Derive, "upgrade">, - - /// Spill address for the upgrade excess lamports - pub spill: Mut>, - - /// New contract address. - pub buffer: Mut>, - - /// Required by the upgradeable uploader. - pub program_data: Mut>, - - /// Our own address, required by the upgradeable loader. - pub own_address: Mut>, - - // Various sysvar/program accounts needed for the upgradeable loader. - pub rent: Sysvar<'b, Rent>, - pub clock: Sysvar<'b, Clock>, - pub bpf_loader: Info<'b>, - pub system: Info<'b>, -} - -impl<'b> InstructionContext<'b> for UpgradeContract<'b> { -} - -#[derive(BorshDeserialize, BorshSerialize, Default)] -pub struct UpgradeContractData {} - -pub fn upgrade_contract( - ctx: &ExecutionContext, - accs: &mut UpgradeContract, - _data: UpgradeContractData, -) -> Result<()> { - verify_governance(&accs.vaa)?; - accs.vaa.verify(ctx.program_id)?; - accs.vaa.claim(ctx, accs.payer.key)?; - - let upgrade_ix = solana_program::bpf_loader_upgradeable::upgrade( - ctx.program_id, - &accs.vaa.message.new_contract, - accs.upgrade_authority.key, - accs.spill.key, - ); - - let seeds = accs - .upgrade_authority - .self_bumped_seeds(None, ctx.program_id); - let seeds: Vec<&[u8]> = seeds.iter().map(|item| item.as_slice()).collect(); - let seeds = seeds.as_slice(); - invoke_signed(&upgrade_ix, ctx.accounts, &[seeds])?; - - Ok(()) -} - -#[derive(FromAccounts)] -pub struct UpgradeGuardianSet<'b> { - /// Payer for account creation (vaa-claim) - pub payer: Mut>>, - - /// Bridge config - pub bridge: Mut>, - - /// GuardianSet change VAA - pub vaa: ClaimableVAA<'b, GovernancePayloadGuardianSetChange>, - - /// Old guardian set - pub guardian_set_old: Mut>, - - /// New guardian set - pub guardian_set_new: Mut>, -} - -impl<'b> InstructionContext<'b> for UpgradeGuardianSet<'b> { -} - -#[derive(BorshDeserialize, BorshSerialize, Default)] -pub struct UpgradeGuardianSetData {} - -pub fn upgrade_guardian_set( - ctx: &ExecutionContext, - accs: &mut UpgradeGuardianSet, - _data: UpgradeGuardianSetData, -) -> Result<()> { - // Enforce single increments when upgrading. - if accs.guardian_set_old.index != accs.vaa.new_guardian_set_index - 1 { - return Err(InvalidGuardianSetUpgrade.into()); - } - - // Confirm that the version the bridge has active is the previous version. - if accs.bridge.guardian_set_index != accs.vaa.new_guardian_set_index - 1 { - return Err(InvalidGuardianSetUpgrade.into()); - } - - verify_governance(&accs.vaa)?; - accs.vaa.verify(ctx.program_id)?; - accs.guardian_set_old.verify_derivation( - ctx.program_id, - &GuardianSetDerivationData { - index: accs.vaa.new_guardian_set_index - 1, - }, - )?; - accs.guardian_set_new.verify_derivation( - ctx.program_id, - &GuardianSetDerivationData { - index: accs.vaa.new_guardian_set_index, - }, - )?; - - accs.vaa.claim(ctx, accs.payer.key)?; - - // Set expiration time for the old set - accs.guardian_set_old.expiration_time = - accs.vaa.meta().vaa_time + accs.bridge.config.guardian_set_expiration_time; - - // Initialize new guardian Set - accs.guardian_set_new.index = accs.vaa.new_guardian_set_index; - accs.guardian_set_new.creation_time = accs.vaa.meta().vaa_time; - accs.guardian_set_new.keys = accs.vaa.new_guardian_set.clone(); - - // Create new guardian set - // This is done after populating it to properly allocate space according to key vec length. - accs.guardian_set_new.create( - &GuardianSetDerivationData { - index: accs.guardian_set_new.index, - }, - ctx, - accs.payer.key, - Exempt, - )?; - - // Set guardian set index - accs.bridge.guardian_set_index = accs.vaa.new_guardian_set_index; - - Ok(()) -} - -#[derive(FromAccounts)] -pub struct SetFees<'b> { - /// Payer for account creation (vaa-claim) - pub payer: Mut>>, - - /// Bridge config - pub bridge: Mut>, - - /// Governance VAA - pub vaa: ClaimableVAA<'b, GovernancePayloadSetMessageFee>, -} - -impl<'b> InstructionContext<'b> for SetFees<'b> { -} - -#[derive(BorshDeserialize, BorshSerialize, Default)] -pub struct SetFeesData {} - -pub fn set_fees(ctx: &ExecutionContext, accs: &mut SetFees, _data: SetFeesData) -> Result<()> { - verify_governance(&accs.vaa)?; - accs.vaa.verify(ctx.program_id)?; - accs.vaa.claim(ctx, accs.payer.key)?; - accs.bridge.config.fee = accs.vaa.fee.as_u64(); - - Ok(()) -} - -#[derive(FromAccounts)] -pub struct TransferFees<'b> { - /// Payer for account creation (vaa-claim) - pub payer: Mut>>, - - /// Bridge config - pub bridge: Bridge<'b, { AccountState::Initialized }>, - - /// Governance VAA - pub vaa: ClaimableVAA<'b, GovernancePayloadTransferFees>, - - /// Account collecting tx fees - pub fee_collector: Mut, "fee_collector">>, - - /// Fee recipient - pub recipient: Mut>, - - /// Rent calculator to check transfer sizes. - pub rent: Sysvar<'b, Rent>, -} - -impl<'b> InstructionContext<'b> for TransferFees<'b> { -} - -#[derive(BorshDeserialize, BorshSerialize, Default)] -pub struct TransferFeesData {} - -pub fn transfer_fees( - ctx: &ExecutionContext, - accs: &mut TransferFees, - _data: TransferFeesData, -) -> Result<()> { - // Make sure the account loaded to receive funds is equal to the one the VAA requested. - if accs.vaa.to != accs.recipient.key.to_bytes() { - return Err(InvalidFeeRecipient.into()); - } - - verify_governance(&accs.vaa)?; - accs.vaa.verify(ctx.program_id)?; - - if accs - .fee_collector - .lamports() - .saturating_sub(accs.vaa.amount.as_u64()) - < accs.rent.minimum_balance(accs.fee_collector.data_len()) - { - return Err(InvalidGovernanceWithdrawal.into()); - } - - accs.vaa.claim(ctx, accs.payer.key)?; - - // Transfer fees - let transfer_ix = solana_program::system_instruction::transfer( - accs.fee_collector.key, - accs.recipient.key, - accs.vaa.amount.as_u64(), - ); - - let seeds = accs.fee_collector.self_bumped_seeds(None, ctx.program_id); - let seeds: Vec<&[u8]> = seeds.iter().map(|item| item.as_slice()).collect(); - let seeds = seeds.as_slice(); - invoke_signed(&transfer_ix, ctx.accounts, &[seeds])?; - - Ok(()) -} diff --git a/solana/bridge/program/src/api/initialize.rs b/solana/bridge/program/src/api/initialize.rs deleted file mode 100644 index 31155ba7..00000000 --- a/solana/bridge/program/src/api/initialize.rs +++ /dev/null @@ -1,98 +0,0 @@ -use crate::{ - accounts::{ - Bridge, - BridgeConfig, - FeeCollector, - GuardianSet, - GuardianSetDerivationData, - }, - error::Error::TooManyGuardians, - MAX_LEN_GUARDIAN_KEYS, -}; -use solana_program::sysvar::clock::Clock; -use solitaire::{ - CreationLamports::Exempt, - *, -}; - -type Payer<'a> = Signer>; - -#[derive(FromAccounts)] -pub struct Initialize<'b> { - /// Bridge config. - pub bridge: Mut>, - - /// Location the new guardian set will be allocated at. - pub guardian_set: Mut>, - - /// Location of the fee collector that users will need to pay. - pub fee_collector: Mut>, - - /// Payer for account creation. - pub payer: Mut>, - - /// Clock used for recording the initialization time. - pub clock: Sysvar<'b, Clock>, -} - -impl<'b> InstructionContext<'b> for Initialize<'b> { -} - -#[derive(BorshDeserialize, BorshSerialize, Default)] -pub struct InitializeData { - /// Period for how long a guardian set is valid after it has been replaced by a new one. This - /// guarantees that VAAs issued by that set can still be submitted for a certain period. In - /// this period we still trust the old guardian set. - pub guardian_set_expiration_time: u32, - - /// Amount of lamports that needs to be paid to the protocol to post a message - pub fee: u64, - - /// Initial Guardian Set - pub initial_guardians: Vec<[u8; 20]>, -} - -pub fn initialize( - ctx: &ExecutionContext, - accs: &mut Initialize, - data: InitializeData, -) -> Result<()> { - let index = 0; - - if data.initial_guardians.len() > MAX_LEN_GUARDIAN_KEYS { - return Err(TooManyGuardians.into()); - } - - // Allocate initial guardian set with the provided keys. - accs.guardian_set.index = index; - accs.guardian_set.creation_time = accs.clock.unix_timestamp as u32; - accs.guardian_set.keys.extend(&data.initial_guardians); - - // Initialize Guardian Set - accs.guardian_set.create( - &GuardianSetDerivationData { index }, - ctx, - accs.payer.key, - Exempt, - )?; - - // Initialize the Bridge state for the first time. - accs.bridge.create(ctx, accs.payer.key, Exempt)?; - accs.bridge.guardian_set_index = index; - accs.bridge.config = BridgeConfig { - guardian_set_expiration_time: data.guardian_set_expiration_time, - fee: data.fee, - }; - - // Initialize the fee collector account so it's rent exempt and will keep funds - accs.fee_collector.create( - ctx, - accs.payer.key, - Exempt, - 0, - &solana_program::system_program::id(), - )?; - accs.bridge.last_lamports = accs.fee_collector.lamports(); - - Ok(()) -} diff --git a/solana/bridge/program/src/api/post_message.rs b/solana/bridge/program/src/api/post_message.rs deleted file mode 100644 index 87a4e358..00000000 --- a/solana/bridge/program/src/api/post_message.rs +++ /dev/null @@ -1,146 +0,0 @@ -use crate::{ - accounts::{ - Bridge, - FeeCollector, - PostedMessage, - Sequence, - SequenceDerivationData, - }, - error::Error::{ - InsufficientFees, - MathOverflow, - }, - types::ConsistencyLevel, - CHAIN_ID_SOLANA, -}; -use solana_program::{ - msg, - sysvar::clock::Clock, -}; -use solitaire::{ - processors::seeded::Seeded, - trace, - CreationLamports::Exempt, - *, -}; - -pub type UninitializedMessage<'b> = PostedMessage<'b, { AccountState::Uninitialized }>; - -impl<'a> From<&PostMessage<'a>> for SequenceDerivationData<'a> { - fn from(accs: &PostMessage<'a>) -> Self { - SequenceDerivationData { - emitter_key: accs.emitter.key, - } - } -} - -#[derive(FromAccounts)] -pub struct PostMessage<'b> { - /// Bridge config needed for fee calculation. - pub bridge: Mut>, - - /// Account to store the posted message - pub message: Signer>>, - - /// Emitter of the VAA - pub emitter: Signer>>, - - /// Tracker for the emitter sequence - pub sequence: Mut>, - - /// Payer for account creation - pub payer: Mut>>, - - /// Account to collect tx fee - pub fee_collector: Mut>, - - pub clock: Sysvar<'b, Clock>, -} - -impl<'b> InstructionContext<'b> for PostMessage<'b> { -} - -#[derive(BorshDeserialize, BorshSerialize)] -pub struct PostMessageData { - /// Unique nonce for this message - pub nonce: u32, - - /// Message payload - pub payload: Vec, - - /// Commitment Level required for an attestation to be produced - pub consistency_level: ConsistencyLevel, -} - -pub fn post_message( - ctx: &ExecutionContext, - accs: &mut PostMessage, - data: PostMessageData, -) -> Result<()> { - trace!("Message Address: {}", accs.message.info().key); - trace!("Emitter Address: {}", accs.emitter.info().key); - trace!("Nonce: {}", data.nonce); - - accs.sequence - .verify_derivation(ctx.program_id, &(&*accs).into())?; - - let fee = accs.bridge.config.fee; - // Fee handling, checking previously known balance allows us to not care who is the payer of - // this submission. - if accs - .fee_collector - .lamports() - .checked_sub(accs.bridge.last_lamports) - .ok_or(MathOverflow)? - < fee - { - trace!( - "Expected fee not found: fee, last_lamports, collector: {} {} {}", - fee, - accs.bridge.last_lamports, - accs.fee_collector.lamports(), - ); - return Err(InsufficientFees.into()); - } - accs.bridge.last_lamports = accs.fee_collector.lamports(); - - // Init sequence tracker if it does not exist yet. - if !accs.sequence.is_initialized() { - trace!("Initializing Sequence account to 0."); - accs.sequence - .create(&(&*accs).into(), ctx, accs.payer.key, Exempt)?; - } - - // DO NOT REMOVE - CRITICAL OUTPUT - msg!("Sequence: {}", accs.sequence.sequence); - - // Initialize transfer - trace!("Setting Message Details"); - accs.message.submission_time = accs.clock.unix_timestamp as u32; - accs.message.emitter_chain = CHAIN_ID_SOLANA; - accs.message.emitter_address = accs.emitter.key.to_bytes(); - accs.message.nonce = data.nonce; - accs.message.payload = data.payload; - accs.message.sequence = accs.sequence.sequence; - accs.message.consistency_level = match data.consistency_level { - ConsistencyLevel::Confirmed => 1, - ConsistencyLevel::Finalized => 32, - }; - - // Create message account - let size = accs.message.size(); - let ix = solana_program::system_instruction::create_account( - accs.payer.key, - accs.message.info().key, - Exempt.amount(size), - size as u64, - ctx.program_id, - ); - solana_program::program::invoke(&ix, ctx.accounts)?; - - // Bump sequence number - trace!("New Sequence: {}", accs.sequence.sequence + 1); - accs.sequence.sequence += 1; - - Ok(()) -} diff --git a/solana/bridge/program/src/api/post_vaa.rs b/solana/bridge/program/src/api/post_vaa.rs deleted file mode 100644 index af43c580..00000000 --- a/solana/bridge/program/src/api/post_vaa.rs +++ /dev/null @@ -1,220 +0,0 @@ -use solitaire::*; - -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use solana_program::{ - self, - sysvar::clock::Clock, -}; - -use crate::{ - accounts::{ - Bridge, - GuardianSet, - GuardianSetDerivationData, - PostedVAA, - PostedVAADerivationData, - SignatureSet, - }, - error::Error::{ - GuardianSetMismatch, - PostVAAConsensusFailed, - PostVAAGuardianSetExpired, - }, -}; -use byteorder::{ - BigEndian, - WriteBytesExt, -}; -use serde::{ - Deserialize, - Serialize, -}; -use sha3::Digest; -use solana_program::program_error::ProgramError; -use solitaire::{ - processors::seeded::Seeded, - CreationLamports::Exempt, -}; -use std::io::{ - Cursor, - Write, -}; - -impl From<&PostVAAData> for GuardianSetDerivationData { - fn from(data: &PostVAAData) -> Self { - GuardianSetDerivationData { - index: data.guardian_set_index, - } - } -} - -#[derive(FromAccounts)] -pub struct PostVAA<'b> { - /// Information about the current guardian set. - pub guardian_set: GuardianSet<'b, { AccountState::Initialized }>, - - /// Bridge Info - pub bridge_info: Bridge<'b, { AccountState::Initialized }>, - - /// Signature Info - pub signature_set: SignatureSet<'b, { AccountState::Initialized }>, - - /// Message the VAA is associated with. - pub message: Mut>, - - /// Account used to pay for auxillary instructions. - pub payer: Mut>>, - - /// Clock used for timestamping. - pub clock: Sysvar<'b, Clock>, -} - -impl<'b> InstructionContext<'b> for PostVAA<'b> { -} - -#[derive(Default, BorshSerialize, BorshDeserialize)] -pub struct Signature { - pub index: u8, - pub r: [u8; 32], - pub s: [u8; 32], - pub v: u8, -} - -pub type ForeignAddress = [u8; 32]; - -#[derive(Default, BorshSerialize, BorshDeserialize, Clone, Serialize, Deserialize)] -pub struct PostVAAData { - // Header part - pub version: u8, - pub guardian_set_index: u32, - - // Body part - pub timestamp: u32, - pub nonce: u32, - pub emitter_chain: u16, - pub emitter_address: ForeignAddress, - pub sequence: u64, - pub consistency_level: u8, - pub payload: Vec, -} - -pub fn post_vaa(ctx: &ExecutionContext, accs: &mut PostVAA, vaa: PostVAAData) -> Result<()> { - let msg_derivation = PostedVAADerivationData { - payload_hash: accs.signature_set.hash.to_vec(), - }; - - accs.message - .verify_derivation(ctx.program_id, &msg_derivation)?; - accs.guardian_set - .verify_derivation(ctx.program_id, &(&vaa).into())?; - - if accs.message.is_initialized() { - return Ok(()); - } - - // Verify any required invariants before we process the instruction. - check_active(&accs.guardian_set, &accs.clock)?; - check_valid_sigs(&accs.guardian_set, &accs.signature_set)?; - check_integrity(&vaa, &accs.signature_set)?; - - // Count the number of signatures currently present. - let signature_count: usize = accs.signature_set.signatures.iter().filter(|v| **v).count(); - - // Calculate how many signatures are required to reach consensus. This calculation is in - // expanded form to ease auditing. - let required_consensus_count = { - let len = accs.guardian_set.keys.len(); - // Fixed point number transformation with one decimal to deal with rounding. - let len = (len * 10) / 3; - // Multiplication by two to get a 2/3 quorum. - let len = len * 2; - // Division to bring number back into range. - len / 10 + 1 - }; - - if signature_count < required_consensus_count { - return Err(PostVAAConsensusFailed.into()); - } - - // Persist VAA data - accs.message.nonce = vaa.nonce; - accs.message.emitter_chain = vaa.emitter_chain; - accs.message.emitter_address = vaa.emitter_address; - accs.message.sequence = vaa.sequence; - accs.message.payload = vaa.payload; - accs.message.consistency_level = vaa.consistency_level; - accs.message.vaa_version = vaa.version; - accs.message.vaa_time = vaa.timestamp; - accs.message.vaa_signature_account = *accs.signature_set.info().key; - accs.message - .create(&msg_derivation, ctx, accs.payer.key, Exempt)?; - - Ok(()) -} - -/// A guardian set must not have expired. -#[inline(always)] -fn check_active<'r>( - guardian_set: &GuardianSet<'r, { AccountState::Initialized }>, - clock: &Sysvar<'r, Clock>, -) -> Result<()> { - // IMPORTANT - this is a fix for mainnet wormhole - // The initial guardian set was never expired so we block it here. - if guardian_set.index == 0 && guardian_set.creation_time == 1628099186 { - return Err(PostVAAGuardianSetExpired.into()); - } - if guardian_set.expiration_time != 0 - && (guardian_set.expiration_time as i64) < clock.unix_timestamp - { - return Err(PostVAAGuardianSetExpired.into()); - } - Ok(()) -} - -/// The signatures in this instruction must be from the right guardian set. -#[inline(always)] -fn check_valid_sigs<'r>( - guardian_set: &GuardianSet<'r, { AccountState::Initialized }>, - signatures: &SignatureSet<'r, { AccountState::Initialized }>, -) -> Result<()> { - if signatures.guardian_set_index != guardian_set.index { - return Err(GuardianSetMismatch.into()); - } - Ok(()) -} - -#[inline(always)] -fn check_integrity<'r>( - vaa: &PostVAAData, - signatures: &SignatureSet<'r, { AccountState::Initialized }>, -) -> Result<()> { - // Serialize the VAA body into an array of bytes. - let body = { - let mut v = Cursor::new(Vec::new()); - v.write_u32::(vaa.timestamp)?; - v.write_u32::(vaa.nonce)?; - v.write_u16::(vaa.emitter_chain)?; - v.write(&vaa.emitter_address)?; - v.write_u64::(vaa.sequence)?; - v.write_u8(vaa.consistency_level)?; - v.write(&vaa.payload)?; - v.into_inner() - }; - - // Hash this body, which is expected to be the same as the hash currently stored in the - // signature account, binding that set of signatures to this VAA. - let body_hash: [u8; 32] = { - let mut h = sha3::Keccak256::default(); - h.write(body.as_slice()) - .map_err(|_| ProgramError::InvalidArgument)?; - h.finalize().into() - }; - - if signatures.hash != body_hash { - return Err(ProgramError::InvalidAccountData.into()); - } - Ok(()) -} diff --git a/solana/bridge/program/src/api/verify_signature.rs b/solana/bridge/program/src/api/verify_signature.rs deleted file mode 100644 index 1c3d862a..00000000 --- a/solana/bridge/program/src/api/verify_signature.rs +++ /dev/null @@ -1,219 +0,0 @@ -use solitaire::*; - -use crate::{ - error::Error::{ - GuardianSetMismatch, - InstructionAtWrongIndex, - InvalidHash, - InvalidSecpInstruction, - }, - GuardianSet, - GuardianSetDerivationData, - SignatureSet, - MAX_LEN_GUARDIAN_KEYS, -}; -use byteorder::ByteOrder; -use solana_program::program_error::ProgramError; -use solitaire::{ - processors::seeded::Seeded, - CreationLamports::Exempt, -}; - -#[derive(FromAccounts)] -pub struct VerifySignatures<'b> { - /// Payer for account creation - pub payer: Mut>>, - - /// Guardian set of the signatures - pub guardian_set: GuardianSet<'b, { AccountState::Initialized }>, - - /// Signature Account - pub signature_set: Mut>>, - - /// Instruction reflection account (special sysvar) - pub instruction_acc: Info<'b>, -} - -impl<'b> InstructionContext<'b> for VerifySignatures<'b> { -} - -impl From<&VerifySignatures<'_>> for GuardianSetDerivationData { - fn from(data: &VerifySignatures<'_>) -> Self { - GuardianSetDerivationData { - index: data.guardian_set.index, - } - } -} - -#[derive(Default, BorshSerialize, BorshDeserialize)] -pub struct VerifySignaturesData { - /// instruction indices of signers (-1 for missing) - pub signers: [i8; MAX_LEN_GUARDIAN_KEYS], -} - -/// SigInfo contains metadata about signers in a VerifySignature ix -struct SigInfo { - /// index of the signer in the guardianset - signer_index: u8, - /// index of the signature in the secp instruction - sig_index: u8, -} - -struct SecpInstructionPart<'a> { - address: &'a [u8], - msg_offset: u16, - msg_size: u16, -} - -pub fn verify_signatures( - ctx: &ExecutionContext, - accs: &mut VerifySignatures, - data: VerifySignaturesData, -) -> Result<()> { - accs.guardian_set - .verify_derivation(ctx.program_id, &(&*accs).into())?; - - let sig_infos: Vec = data - .signers - .iter() - .enumerate() - .filter_map(|(i, p)| { - if *p == -1 { - return None; - } - - return Some(SigInfo { - sig_index: *p as u8, - signer_index: i as u8, - }); - }) - .collect(); - - let current_instruction = solana_program::sysvar::instructions::load_current_index_checked( - &accs.instruction_acc, - )?; - if current_instruction == 0 { - return Err(InstructionAtWrongIndex.into()); - } - - // The previous ix must be a secp verification instruction - let secp_ix_index = (current_instruction - 1) as u8; - let secp_ix = solana_program::sysvar::instructions::load_instruction_at_checked( - secp_ix_index as usize, - &accs.instruction_acc, - ) - .map_err(|_| ProgramError::InvalidAccountData)?; - - // Check that the instruction is actually for the secp program - if secp_ix.program_id != solana_program::secp256k1_program::id() { - return Err(InvalidSecpInstruction.into()); - } - - let secp_data_len = secp_ix.data.len(); - if secp_data_len < 2 { - return Err(InvalidSecpInstruction.into()); - } - - let sig_len = secp_ix.data[0]; - let mut index = 1; - - let mut secp_ixs: Vec = Vec::with_capacity(sig_len as usize); - for i in 0..sig_len { - let _sig_offset = byteorder::LE::read_u16(&secp_ix.data[index..index + 2]) as usize; - index += 2; - let sig_ix = secp_ix.data[index]; - index += 1; - let address_offset = byteorder::LE::read_u16(&secp_ix.data[index..index + 2]) as usize; - index += 2; - let address_ix = secp_ix.data[index]; - index += 1; - let msg_offset = byteorder::LE::read_u16(&secp_ix.data[index..index + 2]); - index += 2; - let msg_size = byteorder::LE::read_u16(&secp_ix.data[index..index + 2]); - index += 2; - let msg_ix = secp_ix.data[index]; - index += 1; - - if address_ix != secp_ix_index || msg_ix != secp_ix_index || sig_ix != secp_ix_index { - return Err(InvalidSecpInstruction.into()); - } - - let address: &[u8] = &secp_ix.data[address_offset..address_offset + 20]; - - // Make sure that all messages are equal - if i > 0 { - if msg_offset != secp_ixs[0].msg_offset || msg_size != secp_ixs[0].msg_size { - return Err(InvalidSecpInstruction.into()); - } - } - secp_ixs.push(SecpInstructionPart { - address, - msg_offset, - msg_size, - }); - } - - if sig_infos.len() != secp_ixs.len() { - return Err(ProgramError::InvalidArgument.into()); - } - - // Data must be a hash - if secp_ixs[0].msg_size != 32 { - return Err(ProgramError::InvalidArgument.into()); - } - - // Extract message which is encoded in Solana Secp256k1 instruction data. - let message = &secp_ix.data - [secp_ixs[0].msg_offset as usize..(secp_ixs[0].msg_offset + secp_ixs[0].msg_size) as usize]; - - // Hash the message part, which contains the serialized VAA body. - let mut msg_hash: [u8; 32] = [0u8; 32]; - msg_hash.copy_from_slice(message); - - if !accs.signature_set.is_initialized() { - accs.signature_set.signatures = vec![false; accs.guardian_set.keys.len()]; - accs.signature_set.guardian_set_index = accs.guardian_set.index; - accs.signature_set.hash = msg_hash; - - let size = accs.signature_set.size(); - let ix = solana_program::system_instruction::create_account( - accs.payer.key, - accs.signature_set.info().key, - Exempt.amount(size), - size as u64, - ctx.program_id, - ); - solana_program::program::invoke(&ix, ctx.accounts)?; - } else { - // If the account already existed, check that the parameters match - if accs.signature_set.guardian_set_index != accs.guardian_set.index { - return Err(GuardianSetMismatch.into()); - } - - if accs.signature_set.hash != msg_hash { - return Err(InvalidHash.into()); - } - } - - // Write sigs of checked addresses into sig_state - for s in sig_infos { - if s.signer_index > accs.guardian_set.num_guardians() { - return Err(ProgramError::InvalidArgument.into()); - } - - if s.sig_index + 1 > sig_len { - return Err(ProgramError::InvalidArgument.into()); - } - - let key = accs.guardian_set.keys[s.signer_index as usize]; - // Check key in ix - if key != secp_ixs[s.sig_index as usize].address { - return Err(ProgramError::InvalidArgument.into()); - } - - // Overwritten content should be zeros except double signs by the signer or harmless replays - accs.signature_set.signatures[s.signer_index as usize] = true; - } - - Ok(()) -} diff --git a/solana/bridge/program/src/error.rs b/solana/bridge/program/src/error.rs deleted file mode 100644 index 7e17bde5..00000000 --- a/solana/bridge/program/src/error.rs +++ /dev/null @@ -1,35 +0,0 @@ -//! Define application level errors that can be returned by the various instruction handlers that -//! make up the wormhole bridge. - -use crate::trace; -use solitaire::SolitaireError; - -#[derive(Debug)] -pub enum Error { - GuardianSetMismatch, - InstructionAtWrongIndex, - InsufficientFees, - InvalidFeeRecipient, - InvalidGovernanceAction, - InvalidGovernanceChain, - InvalidGovernanceKey, - InvalidGovernanceModule, - InvalidGovernanceWithdrawal, - InvalidGuardianSetUpgrade, - InvalidHash, - InvalidSecpInstruction, - MathOverflow, - PostVAAConsensusFailed, - PostVAAGuardianSetExpired, - TooManyGuardians, - VAAAlreadyExecuted, -} - -/// Errors thrown by the program will bubble up to the solitaire wrapper, which needs a way to -/// translate these errors into something Solitaire can log and handle. -impl From for SolitaireError { - fn from(e: Error) -> SolitaireError { - trace!("ProgramError: {:?}", e); - SolitaireError::Custom(e as u64) - } -} diff --git a/solana/bridge/program/src/instructions.rs b/solana/bridge/program/src/instructions.rs deleted file mode 100644 index 69327350..00000000 --- a/solana/bridge/program/src/instructions.rs +++ /dev/null @@ -1,405 +0,0 @@ -use borsh::BorshSerialize; -use solana_program::{ - instruction::{ - AccountMeta, - Instruction, - }, - pubkey::Pubkey, - sysvar, -}; - -use byteorder::{ - BigEndian, - WriteBytesExt, -}; -use sha3::Digest; -use solitaire::{ - processors::seeded::Seeded, - AccountState, -}; -use std::io::{ - Cursor, - Write, -}; - -use crate::{ - accounts::{ - Bridge, - Claim, - ClaimDerivationData, - FeeCollector, - GuardianSet, - GuardianSetDerivationData, - PostedVAA, - PostedVAADerivationData, - Sequence, - SequenceDerivationData, - }, - types::ConsistencyLevel, - InitializeData, - PostMessageData, - PostVAAData, - SetFeesData, - TransferFeesData, - UpgradeContractData, - UpgradeGuardianSetData, - VerifySignaturesData, - CHAIN_ID_SOLANA, -}; - -pub fn initialize( - program_id: Pubkey, - payer: Pubkey, - fee: u64, - guardian_set_expiration_time: u32, - initial_guardians: &[[u8; 20]], -) -> solitaire::Result { - let bridge = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program_id); - let guardian_set = GuardianSet::<'_, { AccountState::Uninitialized }>::key( - &GuardianSetDerivationData { index: 0 }, - &program_id, - ); - let fee_collector = FeeCollector::key(None, &program_id); - - Ok(Instruction { - program_id, - accounts: vec![ - AccountMeta::new(bridge, false), - AccountMeta::new(guardian_set, false), - AccountMeta::new(fee_collector, false), - AccountMeta::new(payer, true), - AccountMeta::new_readonly(sysvar::clock::id(), false), - AccountMeta::new_readonly(sysvar::rent::id(), false), - AccountMeta::new_readonly(solana_program::system_program::id(), false), - ], - data: ( - crate::instruction::Instruction::Initialize, - InitializeData { - initial_guardians: initial_guardians.to_vec(), - fee, - guardian_set_expiration_time, - }, - ) - .try_to_vec()?, - }) -} - -pub fn post_message( - program_id: Pubkey, - payer: Pubkey, - emitter: Pubkey, - message: Pubkey, - nonce: u32, - payload: Vec, - commitment: ConsistencyLevel, -) -> solitaire::Result { - let bridge = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program_id); - let fee_collector = FeeCollector::<'_>::key(None, &program_id); - let sequence = Sequence::<'_>::key( - &SequenceDerivationData { - emitter_key: &emitter, - }, - &program_id, - ); - - Ok(Instruction { - program_id, - - accounts: vec![ - AccountMeta::new(bridge, false), - AccountMeta::new(message, true), - AccountMeta::new_readonly(emitter, true), - AccountMeta::new(sequence, false), - AccountMeta::new(payer, true), - AccountMeta::new(fee_collector, false), - AccountMeta::new_readonly(sysvar::clock::id(), false), - AccountMeta::new_readonly(sysvar::rent::id(), false), - AccountMeta::new_readonly(solana_program::system_program::id(), false), - ], - - data: ( - crate::instruction::Instruction::PostMessage, - PostMessageData { - nonce, - payload: payload.clone(), - consistency_level: commitment, - }, - ) - .try_to_vec()?, - }) -} - -pub fn verify_signatures( - program_id: Pubkey, - payer: Pubkey, - guardian_set_index: u32, - signature_set: Pubkey, - data: VerifySignaturesData, -) -> solitaire::Result { - let guardian_set = GuardianSet::<'_, { AccountState::Uninitialized }>::key( - &GuardianSetDerivationData { - index: guardian_set_index, - }, - &program_id, - ); - - Ok(Instruction { - program_id, - - accounts: vec![ - AccountMeta::new(payer, true), - AccountMeta::new_readonly(guardian_set, false), - AccountMeta::new(signature_set, true), - AccountMeta::new_readonly(sysvar::instructions::id(), false), - AccountMeta::new_readonly(sysvar::rent::id(), false), - AccountMeta::new_readonly(solana_program::system_program::id(), false), - ], - - data: (crate::instruction::Instruction::VerifySignatures, data).try_to_vec()?, - }) -} - -pub fn post_vaa( - program_id: Pubkey, - payer: Pubkey, - signature_set: Pubkey, - vaa: PostVAAData, -) -> Instruction { - let bridge = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program_id); - let guardian_set = GuardianSet::<'_, { AccountState::Uninitialized }>::key( - &GuardianSetDerivationData { - index: vaa.guardian_set_index, - }, - &program_id, - ); - - let msg_derivation_data = &PostedVAADerivationData { - payload_hash: hash_vaa(&vaa).to_vec(), - }; - - let message = - PostedVAA::<'_, { AccountState::MaybeInitialized }>::key(&msg_derivation_data, &program_id); - - Instruction { - program_id, - - accounts: vec![ - AccountMeta::new_readonly(guardian_set, false), - AccountMeta::new_readonly(bridge, false), - AccountMeta::new_readonly(signature_set, false), - AccountMeta::new(message, false), - AccountMeta::new(payer, true), - AccountMeta::new_readonly(sysvar::clock::id(), false), - AccountMeta::new_readonly(sysvar::rent::id(), false), - AccountMeta::new_readonly(solana_program::system_program::id(), false), - ], - - data: (crate::instruction::Instruction::PostVAA, vaa) - .try_to_vec() - .unwrap(), - } -} - -pub fn upgrade_contract( - program_id: Pubkey, - payer: Pubkey, - payload_message: Pubkey, - emitter: Pubkey, - new_contract: Pubkey, - spill: Pubkey, - sequence: u64, -) -> Instruction { - let bridge = Bridge::<'_, { AccountState::Initialized }>::key(None, &program_id); - let claim = Claim::<'_, { AccountState::Uninitialized }>::key( - &ClaimDerivationData { - emitter_address: emitter.to_bytes(), - emitter_chain: CHAIN_ID_SOLANA, - sequence, - }, - &program_id, - ); - - let (upgrade_authority, _) = Pubkey::find_program_address(&["upgrade".as_bytes()], &program_id); - - let (program_data, _) = Pubkey::find_program_address( - &[program_id.as_ref()], - &solana_program::bpf_loader_upgradeable::id(), - ); - - Instruction { - program_id, - - accounts: vec![ - AccountMeta::new(payer, true), - AccountMeta::new(bridge, false), - AccountMeta::new_readonly(payload_message, false), - AccountMeta::new(claim, false), - AccountMeta::new_readonly(upgrade_authority, false), - AccountMeta::new(spill, false), - AccountMeta::new(new_contract, false), - AccountMeta::new(program_data, false), - AccountMeta::new(program_id, false), - AccountMeta::new_readonly(sysvar::rent::id(), false), - AccountMeta::new_readonly(sysvar::clock::id(), false), - AccountMeta::new_readonly(solana_program::bpf_loader_upgradeable::id(), false), - AccountMeta::new_readonly(solana_program::system_program::id(), false), - ], - - data: ( - crate::instruction::Instruction::UpgradeContract, - UpgradeContractData {}, - ) - .try_to_vec() - .unwrap(), - } -} - -pub fn upgrade_guardian_set( - program_id: Pubkey, - payer: Pubkey, - payload_message: Pubkey, - emitter: Pubkey, - old_index: u32, - new_index: u32, - sequence: u64, -) -> Instruction { - let bridge = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program_id); - let claim = Claim::<'_, { AccountState::Uninitialized }>::key( - &ClaimDerivationData { - emitter_address: emitter.to_bytes(), - emitter_chain: CHAIN_ID_SOLANA, - sequence: sequence, - }, - &program_id, - ); - - let guardian_set_old = GuardianSet::<'_, { AccountState::Initialized }>::key( - &GuardianSetDerivationData { index: old_index }, - &program_id, - ); - - let guardian_set_new = GuardianSet::<'_, { AccountState::Uninitialized }>::key( - &GuardianSetDerivationData { index: new_index }, - &program_id, - ); - - Instruction { - program_id, - - accounts: vec![ - AccountMeta::new(payer, true), - AccountMeta::new(bridge, false), - AccountMeta::new_readonly(payload_message, false), - AccountMeta::new(claim, false), - AccountMeta::new(guardian_set_old, false), - AccountMeta::new(guardian_set_new, false), - AccountMeta::new_readonly(solana_program::system_program::id(), false), - ], - - data: ( - crate::instruction::Instruction::UpgradeGuardianSet, - UpgradeGuardianSetData {}, - ) - .try_to_vec() - .unwrap(), - } -} - -pub fn set_fees( - program_id: Pubkey, - payer: Pubkey, - message: Pubkey, - emitter: Pubkey, - sequence: u64, -) -> Instruction { - let bridge = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program_id); - let claim = Claim::<'_, { AccountState::Uninitialized }>::key( - &ClaimDerivationData { - emitter_address: emitter.to_bytes(), - emitter_chain: CHAIN_ID_SOLANA, - sequence, - }, - &program_id, - ); - - Instruction { - program_id, - - accounts: vec![ - AccountMeta::new(payer, true), - AccountMeta::new(bridge, false), - AccountMeta::new_readonly(message, false), - AccountMeta::new(claim, false), - AccountMeta::new_readonly(solana_program::system_program::id(), false), - ], - - data: (crate::instruction::Instruction::SetFees, SetFeesData {}) - .try_to_vec() - .unwrap(), - } -} - -pub fn transfer_fees( - program_id: Pubkey, - payer: Pubkey, - message: Pubkey, - emitter: Pubkey, - sequence: u64, - recipient: Pubkey, -) -> Instruction { - let bridge = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program_id); - let claim = Claim::<'_, { AccountState::Uninitialized }>::key( - &ClaimDerivationData { - emitter_address: emitter.to_bytes(), - emitter_chain: CHAIN_ID_SOLANA, - sequence, - }, - &program_id, - ); - - let fee_collector = FeeCollector::key(None, &program_id); - - Instruction { - program_id, - - accounts: vec![ - AccountMeta::new(payer, true), - AccountMeta::new_readonly(bridge, false), - AccountMeta::new_readonly(message, false), - AccountMeta::new(claim, false), - AccountMeta::new(fee_collector, false), - AccountMeta::new(recipient, false), - AccountMeta::new_readonly(sysvar::rent::id(), false), - AccountMeta::new_readonly(solana_program::system_program::id(), false), - ], - - data: ( - crate::instruction::Instruction::TransferFees, - TransferFeesData {}, - ) - .try_to_vec() - .unwrap(), - } -} - -// Convert a full VAA structure into the serialization of its unique components, this structure is -// what is hashed and verified by Guardians. -pub fn serialize_vaa(vaa: &PostVAAData) -> Vec { - let mut v = Cursor::new(Vec::new()); - v.write_u32::(vaa.timestamp).unwrap(); - v.write_u32::(vaa.nonce).unwrap(); - v.write_u16::(vaa.emitter_chain).unwrap(); - v.write(&vaa.emitter_address).unwrap(); - v.write_u64::(vaa.sequence).unwrap(); - v.write_u8(vaa.consistency_level).unwrap(); - v.write(&vaa.payload).unwrap(); - v.into_inner() -} - -// Hash a VAA, this combines serialization and hashing. -pub fn hash_vaa(vaa: &PostVAAData) -> [u8; 32] { - let body = serialize_vaa(vaa); - let mut h = sha3::Keccak256::default(); - h.write(body.as_slice()).unwrap(); - h.finalize().into() -} diff --git a/solana/bridge/program/src/lib.rs b/solana/bridge/program/src/lib.rs deleted file mode 100644 index b6b5334a..00000000 --- a/solana/bridge/program/src/lib.rs +++ /dev/null @@ -1,96 +0,0 @@ - -#![feature(adt_const_params)] -#![allow(non_upper_case_globals)] -#![allow(incomplete_features)] - -use solitaire::*; - -pub const MAX_LEN_GUARDIAN_KEYS: usize = 19; -pub const CHAIN_ID_SOLANA: u16 = 1; - -#[cfg(feature = "no-entrypoint")] -pub mod instructions; - -#[cfg(feature = "wasm")] -#[cfg(all(target_arch = "wasm32", target_os = "unknown"))] -extern crate wasm_bindgen; - -#[cfg(feature = "wasm")] -#[cfg(all(target_arch = "wasm32", target_os = "unknown"))] -pub mod wasm; - -pub mod accounts; -pub use accounts::{ - BridgeConfig, - BridgeData, - Claim, - ClaimData, - ClaimDerivationData, - FeeCollector, - GuardianSet, - GuardianSetData, - GuardianSetDerivationData, - PostedMessage, - PostedMessageData, - MessageData, - PostedVAA, - PostedVAAData, - Sequence, - SequenceTracker, - SequenceDerivationData, - SignatureSet, - SignatureSetData, -}; - -pub mod api; -pub use api::{ - initialize, - post_message, - post_vaa, - set_fees, - transfer_fees, - upgrade_contract, - upgrade_guardian_set, - verify_signatures, - Initialize, - InitializeData, - PostMessage, - PostMessageData, - PostVAA, - PostVAAData, - SetFees, - SetFeesData, - Signature, - TransferFees, - TransferFeesData, - UninitializedMessage, - UpgradeContract, - UpgradeContractData, - UpgradeGuardianSet, - UpgradeGuardianSetData, - VerifySignatures, - VerifySignaturesData, -}; - -pub mod error; -pub mod types; -pub mod vaa; - -pub use vaa::{ - DeserializeGovernancePayload, - DeserializePayload, - PayloadMessage, - SerializeGovernancePayload, - SerializePayload, -}; - -solitaire! { - Initialize(InitializeData) => initialize, - PostMessage(PostMessageData) => post_message, - PostVAA(PostVAAData) => post_vaa, - SetFees(SetFeesData) => set_fees, - TransferFees(TransferFeesData) => transfer_fees, - UpgradeContract(UpgradeContractData) => upgrade_contract, - UpgradeGuardianSet(UpgradeGuardianSetData) => upgrade_guardian_set, - VerifySignatures(VerifySignaturesData) => verify_signatures, -} diff --git a/solana/bridge/program/src/types.rs b/solana/bridge/program/src/types.rs deleted file mode 100644 index db488fdb..00000000 --- a/solana/bridge/program/src/types.rs +++ /dev/null @@ -1,235 +0,0 @@ -use crate::{ - api::ForeignAddress, - vaa::{ - DeserializeGovernancePayload, - DeserializePayload, - SerializeGovernancePayload, - SerializePayload, - }, -}; -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use byteorder::{ - BigEndian, - ReadBytesExt, -}; -use primitive_types::U256; -use serde::{ - Deserialize, - Serialize, -}; -use solana_program::{ - program_error::ProgramError::InvalidAccountData, - pubkey::Pubkey, -}; -use solitaire::SolitaireError; -use std::{ - self, - io::{ - Cursor, - Read, - Write, - }, -}; - -/// Type representing an Ethereum style public key for Guardians. -pub type GuardianPublicKey = [u8; 20]; - -#[repr(u8)] -#[derive(BorshSerialize, BorshDeserialize, Clone, Serialize, Deserialize)] -pub enum ConsistencyLevel { - Confirmed, - Finalized, -} - -pub struct GovernancePayloadUpgrade { - // Address of the new Implementation - pub new_contract: Pubkey, -} - -impl SerializePayload for GovernancePayloadUpgrade { - fn serialize(&self, v: &mut W) -> std::result::Result<(), SolitaireError> { - v.write(&self.new_contract.to_bytes())?; - Ok(()) - } -} - -impl DeserializePayload for GovernancePayloadUpgrade -where - Self: DeserializeGovernancePayload, -{ - fn deserialize(buf: &mut &[u8]) -> Result { - let mut c = Cursor::new(buf); - Self::check_governance_header(&mut c)?; - - let mut addr = [0u8; 32]; - c.read_exact(&mut addr)?; - - if c.position() != c.into_inner().len() as u64 { - return Err(InvalidAccountData.into()); - } - - Ok(GovernancePayloadUpgrade { - new_contract: Pubkey::new(&addr[..]), - }) - } -} - -impl SerializeGovernancePayload for GovernancePayloadUpgrade { - const MODULE: &'static str = "Core"; - const ACTION: u8 = 1; -} - -impl DeserializeGovernancePayload for GovernancePayloadUpgrade { -} - -pub struct GovernancePayloadGuardianSetChange { - // New GuardianSetIndex - pub new_guardian_set_index: u32, - - // New GuardianSet - pub new_guardian_set: Vec<[u8; 20]>, -} - -impl SerializePayload for GovernancePayloadGuardianSetChange { - fn serialize(&self, v: &mut W) -> std::result::Result<(), SolitaireError> { - use byteorder::WriteBytesExt; - v.write_u32::(self.new_guardian_set_index)?; - v.write_u8(self.new_guardian_set.len() as u8)?; - for key in self.new_guardian_set.iter() { - v.write(key)?; - } - Ok(()) - } -} - -impl DeserializePayload for GovernancePayloadGuardianSetChange -where - Self: DeserializeGovernancePayload, -{ - fn deserialize(buf: &mut &[u8]) -> Result { - let mut c = Cursor::new(buf); - Self::check_governance_header(&mut c)?; - - let new_index = c.read_u32::()?; - - let keys_len = c.read_u8()?; - let mut keys = Vec::with_capacity(keys_len as usize); - for _ in 0..keys_len { - let mut key: [u8; 20] = [0; 20]; - c.read(&mut key)?; - keys.push(key); - } - - if c.position() != c.into_inner().len() as u64 { - return Err(InvalidAccountData.into()); - } - - Ok(GovernancePayloadGuardianSetChange { - new_guardian_set_index: new_index, - new_guardian_set: keys, - }) - } -} - -impl SerializeGovernancePayload for GovernancePayloadGuardianSetChange { - const MODULE: &'static str = "Core"; - const ACTION: u8 = 2; -} - -impl DeserializeGovernancePayload for GovernancePayloadGuardianSetChange { -} - -pub struct GovernancePayloadSetMessageFee { - // New fee in lamports - pub fee: U256, -} - -impl SerializePayload for GovernancePayloadSetMessageFee { - fn serialize(&self, v: &mut W) -> std::result::Result<(), SolitaireError> { - let mut fee_data = [0u8; 32]; - self.fee.to_big_endian(&mut fee_data); - v.write(&fee_data[..])?; - - Ok(()) - } -} - -impl DeserializePayload for GovernancePayloadSetMessageFee -where - Self: DeserializeGovernancePayload, -{ - fn deserialize(buf: &mut &[u8]) -> Result { - let mut c = Cursor::new(buf); - Self::check_governance_header(&mut c)?; - - let mut fee_data: [u8; 32] = [0; 32]; - c.read_exact(&mut fee_data)?; - let fee = U256::from_big_endian(&fee_data); - - if c.position() != c.into_inner().len() as u64 { - return Err(InvalidAccountData.into()); - } - - Ok(GovernancePayloadSetMessageFee { fee }) - } -} - -impl SerializeGovernancePayload for GovernancePayloadSetMessageFee { - const MODULE: &'static str = "Core"; - const ACTION: u8 = 3; -} - -impl DeserializeGovernancePayload for GovernancePayloadSetMessageFee { -} - -pub struct GovernancePayloadTransferFees { - // Amount to be transferred - pub amount: U256, - - // Recipient - pub to: ForeignAddress, -} - -impl SerializePayload for GovernancePayloadTransferFees { - fn serialize(&self, v: &mut W) -> std::result::Result<(), SolitaireError> { - let mut amount_data = [0u8; 32]; - self.amount.to_big_endian(&mut amount_data); - v.write(&amount_data)?; - v.write(&self.to)?; - Ok(()) - } -} - -impl DeserializePayload for GovernancePayloadTransferFees -where - Self: DeserializeGovernancePayload, -{ - fn deserialize(buf: &mut &[u8]) -> Result { - let mut c = Cursor::new(buf); - Self::check_governance_header(&mut c)?; - - let mut amount_data: [u8; 32] = [0; 32]; - c.read_exact(&mut amount_data)?; - let amount = U256::from_big_endian(&amount_data); - - let mut to = ForeignAddress::default(); - c.read_exact(&mut to)?; - - if c.position() != c.into_inner().len() as u64 { - return Err(InvalidAccountData.into()); - } - - Ok(GovernancePayloadTransferFees { amount, to }) - } -} - -impl SerializeGovernancePayload for GovernancePayloadTransferFees { - const MODULE: &'static str = "Core"; - const ACTION: u8 = 4; -} - -impl DeserializeGovernancePayload for GovernancePayloadTransferFees { -} diff --git a/solana/bridge/program/src/vaa.rs b/solana/bridge/program/src/vaa.rs deleted file mode 100644 index 0f323a46..00000000 --- a/solana/bridge/program/src/vaa.rs +++ /dev/null @@ -1,293 +0,0 @@ -use crate::{ - api::{ - post_vaa::PostVAAData, - ForeignAddress, - }, - error::Error::{ - InvalidGovernanceAction, - InvalidGovernanceChain, - InvalidGovernanceModule, - VAAAlreadyExecuted, - }, - Claim, - ClaimDerivationData, - PostedVAAData, - Result, - CHAIN_ID_SOLANA, -}; -use byteorder::{ - BigEndian, - ReadBytesExt, -}; -use serde::{ - Deserialize, - Serialize, -}; -use solana_program::pubkey::Pubkey; -use solitaire::{ - processors::seeded::Seeded, - trace, - Context, - CreationLamports::Exempt, - Data, - ExecutionContext, - Peel, - SolitaireError, - *, -}; -use std::{ - io::{ - Cursor, - Read, - Write, - }, - ops::Deref, -}; - -pub trait SerializePayload: Sized { - fn serialize(&self, writer: &mut W) -> std::result::Result<(), SolitaireError>; - - fn try_to_vec(&self) -> std::result::Result, SolitaireError> { - let mut result = Vec::with_capacity(256); - self.serialize(&mut result)?; - Ok(result) - } -} - -pub trait DeserializePayload: Sized { - fn deserialize(buf: &mut &[u8]) -> std::result::Result; -} - -pub trait SerializeGovernancePayload: SerializePayload { - const MODULE: &'static str; - const ACTION: u8; - - fn try_to_vec(&self) -> std::result::Result, SolitaireError> { - let mut result = Vec::with_capacity(256); - self.write_governance_header(&mut result)?; - self.serialize(&mut result)?; - Ok(result) - } - - fn write_governance_header( - &self, - c: &mut W, - ) -> std::result::Result<(), SolitaireError> { - use byteorder::WriteBytesExt; - let module = format!("{:\0>32}", Self::MODULE); - let module = module.as_bytes(); - c.write(&module)?; - c.write_u8(Self::ACTION)?; - c.write_u16::(CHAIN_ID_SOLANA)?; - Ok(()) - } -} - -pub trait DeserializeGovernancePayload: DeserializePayload + SerializeGovernancePayload { - fn check_governance_header( - c: &mut Cursor<&mut &[u8]>, - ) -> std::result::Result<(), SolitaireError> { - let mut module = [0u8; 32]; - c.read_exact(&mut module)?; - if module != format!("{:\0>32}", Self::MODULE).as_bytes() { - return Err(InvalidGovernanceModule.into()); - } - - let action = c.read_u8()?; - if action != Self::ACTION { - return Err(InvalidGovernanceAction.into()); - } - - let chain = c.read_u16::()?; - if chain != CHAIN_ID_SOLANA && chain != 0 { - return Err(InvalidGovernanceChain.into()); - } - - Ok(()) - } -} - -pub struct PayloadMessage<'b, T: DeserializePayload>( - Data<'b, PostedVAAData, { AccountState::Initialized }>, - T, -); - -impl<'a, 'b: 'a, 'c, T: DeserializePayload> Peel<'a, 'b, 'c> for PayloadMessage<'b, T> { - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result - where - Self: Sized, - { - // Deserialize wrapped payload - let data: Data<'b, PostedVAAData, { AccountState::Initialized }> = Data::peel(ctx)?; - let payload = DeserializePayload::deserialize(&mut &data.payload[..])?; - Ok(PayloadMessage(data, payload)) - } - - fn deps() -> Vec { - Data::<'b, PostedVAAData, { AccountState::Initialized }>::deps() - } - - fn persist(&self, program_id: &Pubkey) -> Result<()> { - Data::persist(&self.0, program_id) - } -} - -impl<'b, T: DeserializePayload> Deref for PayloadMessage<'b, T> { - type Target = T; - fn deref(&self) -> &Self::Target { - &self.1 - } -} - -impl<'b, T: DeserializePayload> PayloadMessage<'b, T> { - pub fn meta(&self) -> &PostedVAAData { - &self.0 - } -} - -#[derive(FromAccounts)] -pub struct ClaimableVAA<'b, T: DeserializePayload> { - // Signed message for the transfer - pub message: PayloadMessage<'b, T>, - - // Claim account to prevent double spending - pub claim: Mut>, -} - -impl<'b, T: DeserializePayload> Deref for ClaimableVAA<'b, T> { - type Target = PayloadMessage<'b, T>; - fn deref(&self) -> &Self::Target { - &self.message - } -} - -impl<'b, T: DeserializePayload> ClaimableVAA<'b, T> { - pub fn verify(&self, program_id: &Pubkey) -> Result<()> { - trace!("Seq: {}", self.message.meta().sequence); - - // Verify that the claim account is derived correctly - self.claim.verify_derivation( - program_id, - &ClaimDerivationData { - emitter_address: self.message.meta().emitter_address, - emitter_chain: self.message.meta().emitter_chain, - sequence: self.message.meta().sequence, - }, - )?; - - Ok(()) - } -} - -impl<'b, T: DeserializePayload> ClaimableVAA<'b, T> { - pub fn is_claimed(&self) -> bool { - self.claim.claimed - } - - pub fn claim(&mut self, ctx: &ExecutionContext, payer: &Pubkey) -> Result<()> { - if self.is_claimed() { - return Err(VAAAlreadyExecuted.into()); - } - - self.claim.create( - &ClaimDerivationData { - emitter_address: self.message.meta().emitter_address, - emitter_chain: self.message.meta().emitter_chain, - sequence: self.message.meta().sequence, - }, - ctx, - payer, - Exempt, - )?; - - self.claim.claimed = true; - - Ok(()) - } -} - -pub struct SignatureItem { - pub signature: Vec, - pub key: [u8; 20], - pub index: u8, -} - -#[derive(Serialize, Deserialize, Default, Clone)] -pub struct VAASignature { - pub signature: Vec, - pub guardian_index: u8, -} - -#[derive(Serialize, Deserialize, Default, Clone)] -pub struct VAA { - // Header part - pub version: u8, - pub guardian_set_index: u32, - pub signatures: Vec, - // Body part - pub timestamp: u32, - pub nonce: u32, - pub emitter_chain: u16, - pub emitter_address: ForeignAddress, - pub sequence: u64, - pub consistency_level: u8, - pub payload: Vec, -} - -impl VAA { - pub const HEADER_LEN: usize = 6; - pub const SIGNATURE_LEN: usize = 66; - - pub fn deserialize(data: &[u8]) -> std::result::Result { - let mut rdr = Cursor::new(data); - let mut v = VAA::default(); - - v.version = rdr.read_u8()?; - v.guardian_set_index = rdr.read_u32::()?; - - let len_sig = rdr.read_u8()?; - let mut sigs: Vec = Vec::with_capacity(len_sig as usize); - for _i in 0..len_sig { - let mut sig = VAASignature::default(); - - sig.guardian_index = rdr.read_u8()?; - let mut signature_data = [0u8; 65]; - rdr.read_exact(&mut signature_data)?; - sig.signature = signature_data.to_vec(); - - sigs.push(sig); - } - v.signatures = sigs; - - v.timestamp = rdr.read_u32::()?; - v.nonce = rdr.read_u32::()?; - v.emitter_chain = rdr.read_u16::()?; - - let mut emitter_address = [0u8; 32]; - rdr.read_exact(&mut emitter_address)?; - v.emitter_address = emitter_address; - - v.sequence = rdr.read_u64::()?; - v.consistency_level = rdr.read_u8()?; - - rdr.read_to_end(&mut v.payload)?; - - Ok(v) - } -} - -impl From for PostVAAData { - fn from(vaa: VAA) -> Self { - PostVAAData { - version: vaa.version, - guardian_set_index: vaa.guardian_set_index, - timestamp: vaa.timestamp, - nonce: vaa.nonce, - emitter_chain: vaa.emitter_chain, - emitter_address: vaa.emitter_address, - sequence: vaa.sequence, - consistency_level: vaa.consistency_level, - payload: vaa.payload, - } - } -} diff --git a/solana/bridge/program/src/wasm.rs b/solana/bridge/program/src/wasm.rs deleted file mode 100644 index 4e49e71a..00000000 --- a/solana/bridge/program/src/wasm.rs +++ /dev/null @@ -1,372 +0,0 @@ -use solana_program::{ - instruction::Instruction, - pubkey::Pubkey, -}; -use std::str::FromStr; - -use crate::vaa::{ - DeserializePayload, - SignatureItem, - VAA, -}; -use borsh::BorshDeserialize; -use byteorder::WriteBytesExt; -use sha3::Digest; -use solitaire::{ - processors::seeded::Seeded, - AccountState, -}; -use std::io::Write; - -use crate::{ - accounts::{ - Bridge, - BridgeData, - FeeCollector, - GuardianSet, - GuardianSetData, - GuardianSetDerivationData, - PostedVAA, - PostedVAAData, - PostedVAADerivationData, - }, - instructions::{ - hash_vaa, - post_message, - post_vaa, - set_fees, - transfer_fees, - upgrade_contract, - upgrade_guardian_set, - verify_signatures, - }, - types::{ - ConsistencyLevel, - GovernancePayloadGuardianSetChange, - GovernancePayloadTransferFees, - GovernancePayloadUpgrade, - }, - Claim, - ClaimDerivationData, - PostVAAData, - VerifySignaturesData, -}; -use byteorder::LittleEndian; -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -pub fn post_message_ix( - program_id: String, - payer: String, - emitter: String, - message: String, - nonce: u32, - msg: Vec, - consistency: String, -) -> JsValue { - let consistency_level = match consistency.as_str() { - "CONFIRMED" => ConsistencyLevel::Confirmed, - "FINALIZED" => ConsistencyLevel::Finalized, - _ => panic!("invalid consistency level"), - }; - let ix = post_message( - Pubkey::from_str(program_id.as_str()).unwrap(), - Pubkey::from_str(payer.as_str()).unwrap(), - Pubkey::from_str(emitter.as_str()).unwrap(), - Pubkey::from_str(message.as_str()).unwrap(), - nonce, - msg, - consistency_level, - ) - .unwrap(); - return JsValue::from_serde(&ix).unwrap(); -} - -#[wasm_bindgen] -pub fn post_vaa_ix( - program_id: String, - payer: String, - signature_set: String, - vaa: Vec, -) -> JsValue { - let vaa = VAA::deserialize(vaa.as_slice()).unwrap(); - let vaa = PostVAAData { - version: vaa.version, - guardian_set_index: vaa.guardian_set_index, - timestamp: vaa.timestamp, - nonce: vaa.nonce, - emitter_chain: vaa.emitter_chain, - emitter_address: vaa.emitter_address, - sequence: vaa.sequence, - consistency_level: vaa.consistency_level, - payload: vaa.payload, - }; - let ix = post_vaa( - Pubkey::from_str(program_id.as_str()).unwrap(), - Pubkey::from_str(payer.as_str()).unwrap(), - Pubkey::from_str(signature_set.as_str()).unwrap(), - vaa, - ); - return JsValue::from_serde(&ix).unwrap(); -} - -#[wasm_bindgen] -pub fn update_guardian_set_ix(program_id: String, payer: String, vaa: Vec) -> JsValue { - let program_id = Pubkey::from_str(program_id.as_str()).unwrap(); - let vaa = VAA::deserialize(vaa.as_slice()).unwrap(); - let payload = - GovernancePayloadGuardianSetChange::deserialize(&mut vaa.payload.as_slice()).unwrap(); - let message_key = PostedVAA::<'_, { AccountState::Uninitialized }>::key( - &PostedVAADerivationData { - payload_hash: hash_vaa(&vaa.clone().into()).to_vec(), - }, - &program_id, - ); - let ix = upgrade_guardian_set( - program_id, - Pubkey::from_str(payer.as_str()).unwrap(), - message_key, - Pubkey::new(&vaa.emitter_address), - payload.new_guardian_set_index - 1, - payload.new_guardian_set_index, - vaa.sequence, - ); - return JsValue::from_serde(&ix).unwrap(); -} - -#[wasm_bindgen] -pub fn set_fees_ix(program_id: String, payer: String, vaa: Vec) -> JsValue { - let program_id = Pubkey::from_str(program_id.as_str()).unwrap(); - let vaa = VAA::deserialize(vaa.as_slice()).unwrap(); - let message_key = PostedVAA::<'_, { AccountState::Uninitialized }>::key( - &PostedVAADerivationData { - payload_hash: hash_vaa(&vaa.clone().into()).to_vec(), - }, - &program_id, - ); - let ix = set_fees( - program_id, - Pubkey::from_str(payer.as_str()).unwrap(), - message_key, - Pubkey::new(&vaa.emitter_address), - vaa.sequence, - ); - return JsValue::from_serde(&ix).unwrap(); -} - -#[wasm_bindgen] -pub fn transfer_fees_ix(program_id: String, payer: String, vaa: Vec) -> JsValue { - let program_id = Pubkey::from_str(program_id.as_str()).unwrap(); - let vaa = VAA::deserialize(vaa.as_slice()).unwrap(); - let payload = GovernancePayloadTransferFees::deserialize(&mut vaa.payload.as_slice()).unwrap(); - let message_key = PostedVAA::<'_, { AccountState::Uninitialized }>::key( - &PostedVAADerivationData { - payload_hash: hash_vaa(&vaa.clone().into()).to_vec(), - }, - &program_id, - ); - let ix = transfer_fees( - program_id, - Pubkey::from_str(payer.as_str()).unwrap(), - message_key, - Pubkey::new(&vaa.emitter_address), - vaa.sequence, - Pubkey::new(&payload.to[..]), - ); - return JsValue::from_serde(&ix).unwrap(); -} - -#[wasm_bindgen] -pub fn upgrade_contract_ix( - program_id: String, - payer: String, - spill: String, - vaa: Vec, -) -> JsValue { - let program_id = Pubkey::from_str(program_id.as_str()).unwrap(); - let spill = Pubkey::from_str(spill.as_str()).unwrap(); - let vaa = VAA::deserialize(vaa.as_slice()).unwrap(); - let payload = GovernancePayloadUpgrade::deserialize(&mut vaa.payload.as_slice()).unwrap(); - let message_key = PostedVAA::<'_, { AccountState::Uninitialized }>::key( - &PostedVAADerivationData { - payload_hash: hash_vaa(&vaa.clone().into()).to_vec(), - }, - &program_id, - ); - let ix = upgrade_contract( - program_id, - Pubkey::from_str(payer.as_str()).unwrap(), - message_key, - Pubkey::new(&vaa.emitter_address), - payload.new_contract, - spill, - vaa.sequence, - ); - return JsValue::from_serde(&ix).unwrap(); -} - -#[wasm_bindgen] -pub fn verify_signatures_ix( - program_id: String, - payer: String, - guardian_set_index: u32, - guardian_set: JsValue, - signature_set: String, - vaa_data: Vec, -) -> JsValue { - let program_id = Pubkey::from_str(program_id.as_str()).unwrap(); - let payer = Pubkey::from_str(payer.as_str()).unwrap(); - let signature_set = Pubkey::from_str(signature_set.as_str()).unwrap(); - - let guardian_set: GuardianSetData = guardian_set.into_serde().unwrap(); - let vaa = VAA::deserialize(vaa_data.as_slice()).unwrap(); - - // Map signatures to guardian set - let mut signature_items: Vec = Vec::new(); - for s in vaa.signatures.iter() { - let mut item = SignatureItem { - signature: s.signature.clone(), - key: [0; 20], - index: s.guardian_index as u8, - }; - item.key = guardian_set.keys[s.guardian_index as usize]; - - signature_items.push(item); - } - - let vaa_body = &vaa_data[VAA::HEADER_LEN + VAA::SIGNATURE_LEN * vaa.signatures.len()..]; - let body_hash: [u8; 32] = { - let mut h = sha3::Keccak256::default(); - h.write(vaa_body).unwrap(); - h.finalize().into() - }; - - let mut verify_txs: Vec> = Vec::new(); - for (_tx_index, chunk) in signature_items.chunks(7).enumerate() { - let mut secp_payload = Vec::new(); - let mut signature_status = [-1i8; 19]; - - let data_offset = 1 + chunk.len() * 11; - let message_offset = data_offset + chunk.len() * 85; - - // 1 number of signatures - secp_payload.write_u8(chunk.len() as u8).unwrap(); - - // Secp signature info description (11 bytes * n) - for (i, s) in chunk.iter().enumerate() { - secp_payload - .write_u16::((data_offset + 85 * i) as u16) - .unwrap(); - secp_payload.write_u8(0).unwrap(); - secp_payload - .write_u16::((data_offset + 85 * i + 65) as u16) - .unwrap(); - secp_payload.write_u8(0).unwrap(); - secp_payload - .write_u16::(message_offset as u16) - .unwrap(); - secp_payload - .write_u16::(body_hash.len() as u16) - .unwrap(); - secp_payload.write_u8(0).unwrap(); - signature_status[s.index as usize] = i as i8; - } - - // Write signatures and addresses - for s in chunk.iter() { - secp_payload.write(&s.signature).unwrap(); - secp_payload.write(&s.key).unwrap(); - } - - // Write body - secp_payload.write(&body_hash).unwrap(); - - let secp_ix = Instruction { - program_id: solana_program::secp256k1_program::id(), - data: secp_payload, - accounts: vec![], - }; - - let payload = VerifySignaturesData { - signers: signature_status, - }; - - let verify_ix = match verify_signatures( - program_id, - payer, - guardian_set_index, - signature_set, - payload, - ) { - Ok(v) => v, - Err(e) => panic!("{:?}", e), - }; - - verify_txs.push(vec![secp_ix, verify_ix]) - } - - JsValue::from_serde(&verify_txs).unwrap() -} - -#[wasm_bindgen] -pub fn guardian_set_address(bridge: String, index: u32) -> Vec { - let program_id = Pubkey::from_str(bridge.as_str()).unwrap(); - let guardian_key = GuardianSet::<'_, { AccountState::Initialized }>::key( - &GuardianSetDerivationData { index: index }, - &program_id, - ); - - guardian_key.to_bytes().to_vec() -} - -#[wasm_bindgen] -pub fn parse_guardian_set(data: Vec) -> JsValue { - JsValue::from_serde(&GuardianSetData::try_from_slice(data.as_slice()).unwrap()).unwrap() -} - -#[wasm_bindgen] -pub fn state_address(bridge: String) -> Vec { - let program_id = Pubkey::from_str(bridge.as_str()).unwrap(); - let bridge_key = Bridge::<'_, { AccountState::Initialized }>::key(None, &program_id); - - bridge_key.to_bytes().to_vec() -} - -#[wasm_bindgen] -pub fn parse_state(data: Vec) -> JsValue { - JsValue::from_serde(&BridgeData::try_from_slice(data.as_slice()).unwrap()).unwrap() -} - -#[wasm_bindgen] -pub fn fee_collector_address(bridge: String) -> Vec { - let program_id = Pubkey::from_str(bridge.as_str()).unwrap(); - let bridge_key = FeeCollector::key(None, &program_id); - - bridge_key.to_bytes().to_vec() -} - -#[wasm_bindgen] -pub fn claim_address(program_id: String, vaa: Vec) -> Vec { - let program_id = Pubkey::from_str(program_id.as_str()).unwrap(); - - let vaa = VAA::deserialize(vaa.as_slice()).unwrap(); - let claim_key = Claim::<'_, { AccountState::Initialized }>::key( - &ClaimDerivationData { - emitter_address: vaa.emitter_address, - emitter_chain: vaa.emitter_chain, - sequence: vaa.sequence, - }, - &program_id, - ); - claim_key.to_bytes().to_vec() -} - -#[wasm_bindgen] -pub fn parse_posted_message(data: Vec) -> JsValue { - JsValue::from_serde(&PostedVAAData::try_from_slice(data.as_slice()).unwrap().0).unwrap() -} - -#[wasm_bindgen] -pub fn parse_vaa(data: Vec) -> JsValue { - JsValue::from_serde(&VAA::deserialize(data.as_slice()).unwrap()).unwrap() -} diff --git a/solana/bridge/program/tests/common.rs b/solana/bridge/program/tests/common.rs deleted file mode 100644 index b5a51792..00000000 --- a/solana/bridge/program/tests/common.rs +++ /dev/null @@ -1,478 +0,0 @@ -#![allow(warnings)] - -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use byteorder::{ - BigEndian, - WriteBytesExt, -}; -use hex_literal::hex; -use secp256k1::{ - Message as Secp256k1Message, - PublicKey, - SecretKey, -}; -use sha3::Digest; -use solana_client::{ - client_error::ClientError, - rpc_client::RpcClient, - rpc_config::RpcSendTransactionConfig, -}; -use solana_program::{ - borsh::try_from_slice_unchecked, - hash, - instruction::{ - AccountMeta, - Instruction, - }, - program_pack::Pack, - pubkey::Pubkey, - system_instruction::{ - self, - create_account, - }, - system_program, - sysvar, -}; -use solana_sdk::{ - commitment_config::CommitmentConfig, - secp256k1_instruction::new_secp256k1_instruction, - signature::{ - read_keypair_file, - Keypair, - Signature, - Signer, - }, - transaction::Transaction, -}; -use std::{ - convert::TryInto, - env, - io::{ - Cursor, - Write, - }, - time::{ - Duration, - SystemTime, - }, -}; - -use bridge::{ - accounts::{ - BridgeConfig, - FeeCollector, - GuardianSet, - GuardianSetDerivationData, - PostedVAAData, - PostedVAADerivationData, - Sequence, - SequenceDerivationData, - SequenceTracker, - SignatureSet, - }, - instruction, - instructions, - types::ConsistencyLevel, - Initialize, - InitializeData, - PostMessageData, - PostVAAData, - UninitializedMessage, - VerifySignaturesData, -}; - -use solitaire::{ - processors::seeded::Seeded, - AccountState, -}; - -pub use helpers::*; - -/// Simple API wrapper for quickly preparing and sending transactions. -pub fn execute( - client: &RpcClient, - payer: &Keypair, - signers: &[&Keypair], - instructions: &[Instruction], - commitment_level: CommitmentConfig, -) -> Result { - let mut transaction = Transaction::new_with_payer(instructions, Some(&payer.pubkey())); - let recent_blockhash = client.get_recent_blockhash().unwrap().0; - transaction.sign(&signers.to_vec(), recent_blockhash); - client.send_and_confirm_transaction_with_spinner_and_config( - &transaction, - commitment_level, - RpcSendTransactionConfig { - skip_preflight: true, - preflight_commitment: None, - encoding: None, - }, - ) -} - -mod helpers { - use super::*; - - /// Initialize the test environment, spins up a solana-test-validator in the background so that - /// each test has a fresh environment to work within. - pub fn setup() -> (Keypair, RpcClient, Pubkey) { - let payer = env::var("BRIDGE_PAYER").unwrap_or("./payer.json".to_string()); - let rpc_address = env::var("BRIDGE_RPC").unwrap_or("http://127.0.0.1:8899".to_string()); - let payer = read_keypair_file(payer).unwrap(); - let rpc = RpcClient::new(rpc_address); - let program = env::var("BRIDGE_PROGRAM") - .unwrap_or("Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o".to_string()) - .parse::() - .unwrap(); - (payer, rpc, program) - } - - /// Wait for a single transaction to fully finalize, guaranteeing chain state has been - /// confirmed. Useful for consistently fetching data during state checks. - pub fn sync(client: &RpcClient, payer: &Keypair) { - execute( - client, - payer, - &[payer], - &[system_instruction::transfer( - &payer.pubkey(), - &payer.pubkey(), - 1, - )], - CommitmentConfig::finalized(), - ) - .unwrap(); - } - - /// Fetch account data, the loop is there to re-attempt until data is available. - pub fn get_account_data(client: &RpcClient, account: &Pubkey) -> T { - let account = client.get_account(account).unwrap(); - T::try_from_slice(&account.data).unwrap() - } - - /// Generate `count` secp256k1 private keys, along with their ethereum-styled public key - /// encoding: 0x0123456789ABCDEF01234 - pub fn generate_keys(count: u8) -> (Vec<[u8; 20]>, Vec) { - use rand::Rng; - use sha3::Digest; - - let mut rng = rand::thread_rng(); - - // Generate Guardian Keys - let secret_keys: Vec = std::iter::repeat_with(|| SecretKey::random(&mut rng)) - .take(count as usize) - .collect(); - - ( - secret_keys - .iter() - .map(|key| { - let public_key = PublicKey::from_secret_key(&key); - let mut h = sha3::Keccak256::default(); - h.write(&public_key.serialize()[1..]).unwrap(); - let key: [u8; 32] = h.finalize().into(); - let mut address = [0u8; 20]; - address.copy_from_slice(&key[12..]); - address - }) - .collect(), - secret_keys, - ) - } - - /// Utility function for generating VAA's from message data. - pub fn generate_vaa( - emitter: &Keypair, - data: Vec, - nonce: u32, - guardian_set_index: u32, - emitter_chain: u16, - ) -> (PostVAAData, [u8; 32], [u8; 32]) { - let mut vaa = PostVAAData { - version: 0, - guardian_set_index, - - // Body part - emitter_chain, - emitter_address: emitter.pubkey().to_bytes(), - sequence: 0, - payload: data, - timestamp: SystemTime::now() - .duration_since(SystemTime::UNIX_EPOCH) - .unwrap() - .as_secs() as u32, - nonce, - consistency_level: ConsistencyLevel::Confirmed as u8, - }; - - // Hash data, the thing we wish to actually sign. - let body = { - let mut v = Cursor::new(Vec::new()); - v.write_u32::(vaa.timestamp).unwrap(); - v.write_u32::(vaa.nonce).unwrap(); - v.write_u16::(vaa.emitter_chain).unwrap(); - v.write(&vaa.emitter_address).unwrap(); - v.write_u64::(vaa.sequence).unwrap(); - v.write_u8(vaa.consistency_level).unwrap(); - v.write(&vaa.payload).unwrap(); - v.into_inner() - }; - - // Hash this body, which is expected to be the same as the hash currently stored in the - // signature account, binding that set of signatures to this VAA. - let body: [u8; 32] = { - let mut h = sha3::Keccak256::default(); - h.write(body.as_slice()).unwrap(); - h.finalize().into() - }; - - let body_hash: [u8; 32] = { - let mut h = sha3::Keccak256::default(); - h.write(&body).unwrap(); - h.finalize().into() - }; - - (vaa, body, body_hash) - } - - pub fn transfer( - client: &RpcClient, - from: &Keypair, - to: &Pubkey, - lamports: u64, - ) -> Result { - execute( - client, - from, - &[from], - &[system_instruction::transfer(&from.pubkey(), to, lamports)], - CommitmentConfig::processed(), - ) - } - - pub fn initialize( - client: &RpcClient, - program: &Pubkey, - payer: &Keypair, - initial_guardians: &[[u8; 20]], - fee: u64, - ) -> Result { - execute( - client, - payer, - &[payer], - &[instructions::initialize( - *program, - payer.pubkey(), - fee, - 2_000_000_000, - initial_guardians, - ) - .unwrap()], - CommitmentConfig::processed(), - ) - } - - pub fn post_message( - client: &RpcClient, - program: &Pubkey, - payer: &Keypair, - emitter: &Keypair, - nonce: u32, - data: Vec, - fee: u64, - ) -> Result { - // Transfer money into the fee collector as it needs a balance/must exist. - let fee_collector = FeeCollector::<'_>::key(None, program); - - let message = Keypair::new(); - - // Capture the resulting message, later functions will need this. - let instruction = instructions::post_message( - *program, - payer.pubkey(), - emitter.pubkey(), - message.pubkey(), - nonce, - data, - ConsistencyLevel::Confirmed, - ) - .unwrap(); - - execute( - client, - payer, - &[payer, emitter, &message], - &[ - system_instruction::transfer(&payer.pubkey(), &fee_collector, fee), - instruction, - ], - CommitmentConfig::processed(), - )?; - - Ok(message.pubkey()) - } - - pub fn verify_signatures( - client: &RpcClient, - program: &Pubkey, - payer: &Keypair, - body: [u8; 32], - secret_keys: &[SecretKey], - guardian_set_version: u32, - ) -> Result { - let signature_set = Keypair::new(); - let tx_signers = &[payer, &signature_set]; - // Push Secp256k1 instructions for each signature we want to verify. - for (i, key) in secret_keys.iter().enumerate() { - // Set this signers signature position as present at 0. - let mut signers = [-1; 19]; - signers[i] = 0; - - execute( - client, - payer, - tx_signers, - &vec![ - new_secp256k1_instruction(&key, &body), - instructions::verify_signatures( - *program, - payer.pubkey(), - guardian_set_version, - signature_set.pubkey(), - VerifySignaturesData { signers }, - ) - .unwrap(), - ], - CommitmentConfig::processed(), - )?; - } - Ok(signature_set.pubkey()) - } - - pub fn post_vaa( - client: &RpcClient, - program: &Pubkey, - payer: &Keypair, - signature_set: Pubkey, - vaa: PostVAAData, - ) -> Result { - execute( - client, - payer, - &[payer], - &[instructions::post_vaa( - *program, - payer.pubkey(), - signature_set, - vaa, - )], - CommitmentConfig::processed(), - ) - } - - pub fn upgrade_guardian_set( - client: &RpcClient, - program: &Pubkey, - payer: &Keypair, - payload_message: Pubkey, - emitter: Pubkey, - old_index: u32, - new_index: u32, - sequence: u64, - ) -> Result { - execute( - client, - payer, - &[payer], - &[instructions::upgrade_guardian_set( - *program, - payer.pubkey(), - payload_message, - emitter, - old_index, - new_index, - sequence, - )], - CommitmentConfig::processed(), - ) - } - - pub fn upgrade_contract( - client: &RpcClient, - program: &Pubkey, - payer: &Keypair, - payload_message: Pubkey, - emitter: Pubkey, - new_contract: Pubkey, - spill: Pubkey, - sequence: u64, - ) -> Result { - execute( - client, - payer, - &[payer], - &[instructions::upgrade_contract( - *program, - payer.pubkey(), - payload_message, - emitter, - new_contract, - spill, - sequence, - )], - CommitmentConfig::processed(), - ) - } - - pub fn set_fees( - client: &RpcClient, - program: &Pubkey, - payer: &Keypair, - message: Pubkey, - emitter: Pubkey, - sequence: u64, - ) -> Result { - execute( - client, - payer, - &[payer], - &[instructions::set_fees( - *program, - payer.pubkey(), - message, - emitter, - sequence, - )], - CommitmentConfig::processed(), - ) - } - - pub fn transfer_fees( - client: &RpcClient, - program: &Pubkey, - payer: &Keypair, - message: Pubkey, - emitter: Pubkey, - recipient: Pubkey, - sequence: u64, - ) -> Result { - execute( - client, - payer, - &[payer], - &[instructions::transfer_fees( - *program, - payer.pubkey(), - message, - emitter, - sequence, - recipient, - )], - CommitmentConfig::processed(), - ) - } -} diff --git a/solana/bridge/program/tests/integration.rs b/solana/bridge/program/tests/integration.rs deleted file mode 100644 index 6ef6d340..00000000 --- a/solana/bridge/program/tests/integration.rs +++ /dev/null @@ -1,1080 +0,0 @@ -#![allow(warnings)] - -use borsh::BorshSerialize; -use byteorder::{ - BigEndian, - WriteBytesExt, -}; -use hex_literal::hex; -use rand::Rng; -use secp256k1::{ - Message as Secp256k1Message, - PublicKey, - SecretKey, -}; -use sha3::Digest; -use solana_client::rpc_client::RpcClient; -use solana_program::{ - borsh::try_from_slice_unchecked, - hash, - instruction::{ - AccountMeta, - Instruction, - }, - program_pack::Pack, - pubkey::Pubkey, - system_instruction::{ - self, - create_account, - }, - system_program, - sysvar, -}; -use solana_sdk::{ - signature::{ - read_keypair_file, - Keypair, - Signer, - }, - transaction::Transaction, -}; -use solitaire::{ - processors::seeded::Seeded, - AccountState, -}; -use std::{ - convert::TryInto, - io::{ - Cursor, - Write, - }, - time::{ - Duration, - SystemTime, - }, -}; - -use bridge::{ - accounts::{ - Bridge, - BridgeConfig, - BridgeData, - FeeCollector, - GuardianSet, - GuardianSetData, - GuardianSetDerivationData, - MessageData, - PostedVAA, - PostedVAAData, - PostedVAADerivationData, - SequenceTracker, - SignatureSet, - SignatureSetData, - }, - instruction, - instructions::hash_vaa, - types::{ - ConsistencyLevel, - GovernancePayloadGuardianSetChange, - GovernancePayloadSetMessageFee, - GovernancePayloadTransferFees, - GovernancePayloadUpgrade, - }, - Initialize, - PostVAA, - PostVAAData, - SerializeGovernancePayload, - Signature, -}; -use primitive_types::U256; -use solana_sdk::hash::hashv; - -mod common; - -const GOVERNANCE_KEY: [u8; 64] = [ - 240, 133, 120, 113, 30, 67, 38, 184, 197, 72, 234, 99, 241, 21, 58, 225, 41, 157, 171, 44, 196, - 163, 134, 236, 92, 148, 110, 68, 127, 114, 177, 0, 173, 253, 199, 9, 242, 142, 201, 174, 108, - 197, 18, 102, 115, 0, 31, 205, 127, 188, 191, 56, 171, 228, 20, 247, 149, 170, 141, 231, 147, - 88, 97, 199, -]; - -struct Context { - public: Vec<[u8; 20]>, - secret: Vec, - seq: Sequencer, -} - -/// Small helper to track and provide sequences during tests. This is in particular needed for -/// guardian operations that require them for derivations. -struct Sequencer { - sequences: std::collections::HashMap<[u8; 32], u64>, -} - -impl Sequencer { - fn next(&mut self, emitter: [u8; 32]) -> u64 { - let entry = self.sequences.entry(emitter).or_insert(0); - *entry += 1; - *entry - 1 - } - - fn peek(&mut self, emitter: [u8; 32]) -> u64 { - *self.sequences.entry(emitter).or_insert(0) - } -} - -#[test] -fn run_integration_tests() { - let (public_keys, secret_keys) = common::generate_keys(6); - let mut context = Context { - public: public_keys, - secret: secret_keys, - seq: Sequencer { - sequences: std::collections::HashMap::new(), - }, - }; - - // Initialize the bridge and verify the bridges state. - test_initialize(&mut context); - - // Tests are currently unhygienic as It's difficult to wrap `solana-test-validator` within the - // integration tests so for now we work around it by simply chain-calling our tests. - test_bridge_messages(&mut context); - test_foreign_bridge_messages(&mut context); - test_invalid_emitter(&mut context); - test_duplicate_messages_fail(&mut context); - test_guardian_set_change(&mut context); - test_guardian_set_change_fails(&mut context); - test_set_fees(&mut context); - test_set_fees_fails(&mut context); - test_free_fees(&mut context); - test_transfer_fees(&mut context); - test_transfer_fees_fails(&mut context); - test_transfer_too_much(&mut context); - test_transfer_total_fails(&mut context); -} - -fn test_initialize(context: &mut Context) { - let (ref payer, ref client, ref program) = common::setup(); - - // Use a timestamp from a few seconds earlier for testing to simulate thread::sleep(); - let now = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_secs() - - 10; - - common::initialize(client, program, payer, &*context.public.clone(), 500); - common::sync(client, payer); - - // Verify the initial bridge state is as expected. - let bridge_key = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program); - let guardian_set_key = GuardianSet::<'_, { AccountState::Uninitialized }>::key( - &GuardianSetDerivationData { index: 0 }, - &program, - ); - - // Fetch account states. - let bridge: BridgeData = common::get_account_data(client, &bridge_key); - let guardian_set: GuardianSetData = common::get_account_data(client, &guardian_set_key); - - // Bridge Config should be as expected. - assert_eq!(bridge.guardian_set_index, 0); - assert_eq!(bridge.config.guardian_set_expiration_time, 2_000_000_000); - assert_eq!(bridge.config.fee, 500); - - // Guardian set account must also be as expected. - assert_eq!(guardian_set.index, 0); - assert_eq!(guardian_set.keys, context.public); - assert!(guardian_set.creation_time as u64 > now); -} - -fn test_bridge_messages(context: &mut Context) { - let (ref payer, ref client, ref program) = common::setup(); - - // Data/Nonce used for emitting a message we want to prove exists. Run this twice to make sure - // that duplicate data does not clash. - let message = [0u8; 32].to_vec(); - let emitter = Keypair::new(); - - for _ in 0..2 { - let nonce = rand::thread_rng().gen(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - // Post the message, publishing the data for guardian consumption. - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - // Emulate Guardian behaviour, verifying the data and publishing signatures/VAA. - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 0, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 0).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::sync(client, payer); - - // Fetch chain accounts to verify state. - let posted_message: PostedVAAData = common::get_account_data(client, &message_key); - let signatures: SignatureSetData = common::get_account_data(client, &signature_set); - - // Verify on chain Message - assert_eq!(posted_message.0.vaa_version, 0); - assert_eq!(posted_message.0.vaa_signature_account, signature_set); - assert_eq!(posted_message.0.nonce, nonce); - assert_eq!(posted_message.0.sequence, sequence); - assert_eq!(posted_message.0.emitter_chain, 1); - assert_eq!(posted_message.0.payload, message); - assert_eq!( - posted_message.0.emitter_address, - emitter.pubkey().to_bytes() - ); - - // Verify on chain Signatures - assert_eq!(signatures.hash, body); - assert_eq!(signatures.guardian_set_index, 0); - - for (signature, secret_key) in signatures.signatures.iter().zip(context.secret.iter()) { - assert_eq!(*signature, true); - } - } - - // Prepare another message with no data in its message to confirm it succeeds. - let nonce = rand::thread_rng().gen(); - let message = b"".to_vec(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - // Post the message, publishing the data for guardian consumption. - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - // Emulate Guardian behaviour, verifying the data and publishing signatures/VAA. - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 0, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 0).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::sync(client, payer); - - // Fetch chain accounts to verify state. - let posted_message: PostedVAAData = common::get_account_data(client, &message_key); - let signatures: SignatureSetData = common::get_account_data(client, &signature_set); - - // Verify on chain Message - assert_eq!(posted_message.0.vaa_version, 0); - assert_eq!(posted_message.0.vaa_signature_account, signature_set); - assert_eq!(posted_message.0.nonce, nonce); - assert_eq!(posted_message.0.sequence, sequence); - assert_eq!(posted_message.0.emitter_chain, 1); - assert_eq!(posted_message.0.payload, message); - assert_eq!( - posted_message.0.emitter_address, - emitter.pubkey().to_bytes() - ); - - // Verify on chain Signatures - assert_eq!(signatures.hash, body); - assert_eq!(signatures.guardian_set_index, 0); - - for (signature, secret_key) in signatures.signatures.iter().zip(context.secret.iter()) { - assert_eq!(*signature, true); - } -} - -fn test_invalid_emitter(context: &mut Context) { - let (ref payer, ref client, ref program) = common::setup(); - - // Generate a message we want to persist. - let message = [0u8; 32].to_vec(); - let emitter = Keypair::new(); - let nonce = rand::thread_rng().gen(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - let fee_collector = FeeCollector::key(None, &program); - - let msg_account = Keypair::new(); - // Manually send a message that isn't signed by the emitter, which should be rejected to - // prevent fraudulant transactions sent on behalf of an emitter. - let mut instruction = bridge::instructions::post_message( - *program, - payer.pubkey(), - emitter.pubkey(), - msg_account.pubkey(), - nonce, - message, - ConsistencyLevel::Confirmed, - ) - .unwrap(); - - // Modify account list to not require the emitter signs. - instruction.accounts[2].is_signer = false; - - // Executing this should fail. - assert!(common::execute( - client, - payer, - &[payer], - &[ - system_instruction::transfer(&payer.pubkey(), &fee_collector, 10_000), - instruction, - ], - solana_sdk::commitment_config::CommitmentConfig::processed(), - ) - .is_err()); -} - -fn test_duplicate_messages_fail(context: &mut Context) { - let (ref payer, ref client, ref program) = common::setup(); - - // We'll use the following nonce/message/emitter/sequence twice. - let nonce = rand::thread_rng().gen(); - let message = [0u8; 32].to_vec(); - let emitter = Keypair::new(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - // Post the message, publishing the data for guardian consumption. - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - // Second should fail due to duplicate derivations. - assert!(common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .is_err()); -} - -fn test_guardian_set_change(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - - // Use a timestamp from a few seconds earlier for testing to simulate thread::sleep(); - let now = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_secs() - - 10; - - // Upgrade the guardian set with a new set of guardians. - let (new_public_keys, new_secret_keys) = common::generate_keys(1); - - let nonce = rand::thread_rng().gen(); - let emitter = Keypair::from_bytes(&GOVERNANCE_KEY).unwrap(); - println!("{}", emitter.pubkey().to_string()); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - let message = GovernancePayloadGuardianSetChange { - new_guardian_set_index: 1, - new_guardian_set: new_public_keys.clone(), - } - .try_to_vec() - .unwrap(); - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 0, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 0).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::upgrade_guardian_set( - client, - program, - payer, - message_key, - emitter.pubkey(), - 0, - 1, - sequence, - ) - .unwrap(); - common::sync(client, payer); - - // Derive keys for accounts we want to check. - let bridge_key = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program); - let guardian_set_key = GuardianSet::<'_, { AccountState::Uninitialized }>::key( - &GuardianSetDerivationData { index: 1 }, - &program, - ); - - // Fetch account states. - let bridge: BridgeData = common::get_account_data(client, &bridge_key); - let guardian_set: GuardianSetData = common::get_account_data(client, &guardian_set_key); - - // Confirm the bridge now has a new guardian set, and no other fields have shifted. - assert_eq!(bridge.guardian_set_index, 1); - assert_eq!(bridge.config.guardian_set_expiration_time, 2_000_000_000); - assert_eq!(bridge.config.fee, 500); - - // Verify Created Guardian Set - assert_eq!(guardian_set.index, 1); - assert_eq!(guardian_set.keys, new_public_keys); - assert!(guardian_set.creation_time as u64 > now); - - // Submit the message a second time with a new nonce. - let nonce = rand::thread_rng().gen(); - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - context.public = new_public_keys; - context.secret = new_secret_keys; - - // Emulate Guardian behaviour, verifying the data and publishing signatures/VAA. - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::sync(client, payer); - - // Fetch chain accounts to verify state. - let posted_message: PostedVAAData = common::get_account_data(client, &message_key); - let signatures: SignatureSetData = common::get_account_data(client, &signature_set); - - // Verify on chain Message - assert_eq!(posted_message.0.vaa_version, 0); - assert_eq!(posted_message.0.vaa_signature_account, signature_set); - assert_eq!(posted_message.0.nonce, nonce); - assert_eq!(posted_message.0.sequence, sequence); - assert_eq!(posted_message.0.emitter_chain, 1); - assert_eq!(posted_message.0.payload, message); - assert_eq!( - posted_message.0.emitter_address, - emitter.pubkey().to_bytes() - ); - - // Verify on chain Signatures - assert_eq!(signatures.hash, body); - assert_eq!(signatures.guardian_set_index, 1); - - for (signature, secret_key) in signatures.signatures.iter().zip(context.secret.iter()) { - assert_eq!(*signature, true); - } -} - -fn test_guardian_set_change_fails(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - - // Use a random emitter key to confirm the bridge rejects transactions from non-governance key. - let emitter = Keypair::new(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - // Upgrade the guardian set with a new set of guardians. - let (new_public_keys, new_secret_keys) = common::generate_keys(6); - let nonce = rand::thread_rng().gen(); - let message = GovernancePayloadGuardianSetChange { - new_guardian_set_index: 2, - new_guardian_set: new_public_keys.clone(), - } - .try_to_vec() - .unwrap(); - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - - assert!(common::upgrade_guardian_set( - client, - program, - payer, - message_key, - emitter.pubkey(), - 1, - 2, - sequence, - ) - .is_err()); -} - -fn test_set_fees(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - let emitter = Keypair::from_bytes(&GOVERNANCE_KEY).unwrap(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - let nonce = rand::thread_rng().gen(); - let message = GovernancePayloadSetMessageFee { - fee: U256::from(100), - } - .try_to_vec() - .unwrap(); - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::set_fees( - client, - program, - payer, - message_key, - emitter.pubkey(), - sequence, - ) - .unwrap(); - common::sync(client, payer); - - // Fetch Bridge to check on-state value. - let bridge_key = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program); - let fee_collector = FeeCollector::key(None, &program); - let bridge: BridgeData = common::get_account_data(client, &bridge_key); - assert_eq!(bridge.config.fee, 100); - - // Check that posting a new message fails with too small a fee. - let account_balance = client.get_account(&fee_collector).unwrap().lamports; - let emitter = Keypair::new(); - let nonce = rand::thread_rng().gen(); - let message = [0u8; 32].to_vec(); - assert!( - common::post_message(client, program, payer, &emitter, nonce, message.clone(), 50).is_err() - ); - common::sync(client, payer); - - assert_eq!( - client.get_account(&fee_collector).unwrap().lamports, - account_balance, - ); - - // And succeeds with the new. - let emitter = Keypair::new(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - let nonce = rand::thread_rng().gen(); - let message = [0u8; 32].to_vec(); - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 100, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::sync(client, payer); - - // Verify that the fee collector was paid. - assert_eq!( - client.get_account(&fee_collector).unwrap().lamports, - account_balance + 100, - ); - - // And that the new message is on chain. - let posted_message: PostedVAAData = common::get_account_data(client, &message_key); - let signatures: SignatureSetData = common::get_account_data(client, &signature_set); - - // Verify on chain Message - assert_eq!(posted_message.0.vaa_version, 0); - assert_eq!(posted_message.0.vaa_signature_account, signature_set); - assert_eq!(posted_message.0.nonce, nonce); - assert_eq!(posted_message.0.sequence, sequence); - assert_eq!(posted_message.0.emitter_chain, 1); - assert_eq!(posted_message.0.payload, message); - assert_eq!( - posted_message.0.emitter_address, - emitter.pubkey().to_bytes() - ); - - // Verify on chain Signatures - assert_eq!(signatures.hash, body); - assert_eq!(signatures.guardian_set_index, 1); - - for (signature, secret_key) in signatures.signatures.iter().zip(context.secret.iter()) { - assert_eq!(*signature, true); - } -} - -fn test_set_fees_fails(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - - // Use a random key to confirm only the governance key is respected. - let emitter = Keypair::new(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - let nonce = rand::thread_rng().gen(); - let message = GovernancePayloadSetMessageFee { - fee: U256::from(100), - } - .try_to_vec() - .unwrap(); - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - assert!(common::set_fees( - client, - program, - payer, - message_key, - emitter.pubkey(), - sequence, - ) - .is_err()); - common::sync(client, payer); -} - -fn test_free_fees(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - let emitter = Keypair::from_bytes(&GOVERNANCE_KEY).unwrap(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - // Set Fees to 0. - let nonce = rand::thread_rng().gen(); - let message = GovernancePayloadSetMessageFee { fee: U256::from(0) } - .try_to_vec() - .unwrap(); - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::set_fees( - client, - program, - payer, - message_key, - emitter.pubkey(), - sequence, - ) - .unwrap(); - common::sync(client, payer); - - // Fetch Bridge to check on-state value. - let bridge_key = Bridge::<'_, { AccountState::Uninitialized }>::key(None, &program); - let fee_collector = FeeCollector::key(None, &program); - let bridge: BridgeData = common::get_account_data(client, &bridge_key); - assert_eq!(bridge.config.fee, 0); - - // Check that posting a new message is free. - let account_balance = client.get_account(&fee_collector).unwrap().lamports; - let emitter = Keypair::new(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - let nonce = rand::thread_rng().gen(); - let message = [0u8; 32].to_vec(); - let message_key = - common::post_message(client, program, payer, &emitter, nonce, message.clone(), 0).unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::sync(client, payer); - - // Verify that the fee collector was paid. - assert_eq!( - client.get_account(&fee_collector).unwrap().lamports, - account_balance, - ); - - // And that the new message is on chain. - let posted_message: PostedVAAData = common::get_account_data(client, &message_key); - let signatures: SignatureSetData = common::get_account_data(client, &signature_set); - - // Verify on chain Message - assert_eq!(posted_message.0.vaa_version, 0); - assert_eq!(posted_message.0.vaa_signature_account, signature_set); - assert_eq!(posted_message.0.nonce, nonce); - assert_eq!(posted_message.0.sequence, sequence); - assert_eq!(posted_message.0.emitter_chain, 1); - assert_eq!(posted_message.0.payload, message); - assert_eq!( - posted_message.0.emitter_address, - emitter.pubkey().to_bytes() - ); - - // Verify on chain Signatures - assert_eq!(signatures.hash, body); - assert_eq!(signatures.guardian_set_index, 1); - - for (signature, secret_key) in signatures.signatures.iter().zip(context.secret.iter()) { - assert_eq!(*signature, true); - } -} - -fn test_transfer_fees(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - let emitter = Keypair::from_bytes(&GOVERNANCE_KEY).unwrap(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - let recipient = Keypair::new(); - let nonce = rand::thread_rng().gen(); - let message = GovernancePayloadTransferFees { - amount: 100.into(), - to: payer.pubkey().to_bytes(), - } - .try_to_vec() - .unwrap(); - - // Fetch accounts for chain state checking. - let fee_collector = FeeCollector::key(None, &program); - let account_balance = client.get_account(&fee_collector).unwrap().lamports; - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::transfer_fees( - client, - program, - payer, - message_key, - emitter.pubkey(), - payer.pubkey(), - sequence, - ) - .unwrap(); - common::sync(client, payer); -} - -fn test_transfer_fees_fails(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - - // Use an invalid emitter. - let emitter = Keypair::new(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - let recipient = Keypair::new(); - let nonce = rand::thread_rng().gen(); - let message = GovernancePayloadTransferFees { - amount: 100.into(), - to: payer.pubkey().to_bytes(), - } - .try_to_vec() - .unwrap(); - - // Fetch accounts for chain state checking. - let fee_collector = FeeCollector::key(None, &program); - let account_balance = client.get_account(&fee_collector).unwrap().lamports; - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - - assert!(common::transfer_fees( - client, - program, - payer, - message_key, - emitter.pubkey(), - payer.pubkey(), - sequence, - ) - .is_err()); -} - -fn test_transfer_too_much(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - let emitter = Keypair::from_bytes(&GOVERNANCE_KEY).unwrap(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - let recipient = Keypair::new(); - let nonce = rand::thread_rng().gen(); - let message = GovernancePayloadTransferFees { - amount: 100_000_000_000u64.into(), - to: payer.pubkey().to_bytes(), - } - .try_to_vec() - .unwrap(); - - // Fetch accounts for chain state checking. - let fee_collector = FeeCollector::key(None, &program); - let account_balance = client.get_account(&fee_collector).unwrap().lamports; - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - - // Should fail to transfer. - assert!(common::transfer_fees( - client, - program, - payer, - message_key, - emitter.pubkey(), - payer.pubkey(), - sequence, - ) - .is_err()); -} - -fn test_foreign_bridge_messages(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - let nonce = rand::thread_rng().gen(); - let message = [0u8; 32].to_vec(); - let emitter = Keypair::new(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - // Verify the VAA generated on a foreign chain. - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 0, 2); - - // Derive where we expect created accounts to be. - let message_key = PostedVAA::<'_, { AccountState::MaybeInitialized }>::key( - &PostedVAADerivationData { - payload_hash: hash_vaa(&vaa).to_vec(), - }, - &program, - ); - - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 0).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::sync(client, payer); - - // Fetch chain accounts to verify state. - let posted_message: PostedVAAData = common::get_account_data(client, &message_key); - let signatures: SignatureSetData = common::get_account_data(client, &signature_set); - - assert_eq!(posted_message.0.vaa_version, 0); - assert_eq!(posted_message.0.vaa_signature_account, signature_set); - assert_eq!(posted_message.0.nonce, nonce); - assert_eq!(posted_message.0.sequence, sequence); - assert_eq!(posted_message.0.emitter_chain, 2); - assert_eq!(posted_message.0.payload, message); - assert_eq!( - posted_message.0.emitter_address, - emitter.pubkey().to_bytes() - ); - - // Verify on chain Signatures - assert_eq!(signatures.hash, body); - assert_eq!(signatures.guardian_set_index, 0); - - for (signature, secret_key) in signatures.signatures.iter().zip(context.secret.iter()) { - assert_eq!(*signature, true); - } -} - -fn test_transfer_total_fails(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - let emitter = Keypair::from_bytes(&GOVERNANCE_KEY).unwrap(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - - // Be sure any previous tests have fully committed. - common::sync(client, payer); - - let fee_collector = FeeCollector::key(None, &program); - let account_balance = client.get_account(&fee_collector).unwrap().lamports; - - // Prepare to remove total balance, adding 10_000 to include the fee we're about to pay. - let recipient = Keypair::new(); - let nonce = rand::thread_rng().gen(); - let message = GovernancePayloadTransferFees { - amount: (account_balance + 10_000).into(), - to: payer.pubkey().to_bytes(), - } - .try_to_vec() - .unwrap(); - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 1, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 1).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - - // Transferring total fees should fail, to prevent the account being de-allocated. - assert!(common::transfer_fees( - client, - program, - payer, - message_key, - emitter.pubkey(), - payer.pubkey(), - sequence, - ) - .is_err()); - common::sync(client, payer); - - // The fee should have been paid, but other than that the balance should be exactly the same, - // I.E non-zero. - assert_eq!( - client.get_account(&fee_collector).unwrap().lamports, - account_balance + 10_000 - ); -} - -fn test_upgrade_contract(context: &mut Context) { - // Initialize a wormhole bridge on Solana to test with. - let (ref payer, ref client, ref program) = common::setup(); - - // Upgrade the guardian set with a new set of guardians. - let (new_public_keys, new_secret_keys) = common::generate_keys(1); - - // New Contract Address - let new_contract = Pubkey::new_unique(); - - let nonce = rand::thread_rng().gen(); - let emitter = Keypair::from_bytes(&GOVERNANCE_KEY).unwrap(); - let sequence = context.seq.next(emitter.pubkey().to_bytes()); - let message = GovernancePayloadUpgrade { - new_contract: new_contract.clone(), - } - .try_to_vec() - .unwrap(); - - let message_key = common::post_message( - client, - program, - payer, - &emitter, - nonce, - message.clone(), - 10_000, - ) - .unwrap(); - - let (vaa, body, body_hash) = common::generate_vaa(&emitter, message.clone(), nonce, 0, 1); - let signature_set = - common::verify_signatures(client, program, payer, body, &context.secret, 0).unwrap(); - common::post_vaa(client, program, payer, signature_set, vaa).unwrap(); - common::upgrade_contract( - client, - program, - payer, - message_key, - emitter.pubkey(), - new_contract, - Pubkey::new_unique(), - sequence, - ) - .unwrap(); - common::sync(client, payer); -} diff --git a/solana/bridge/program_stub/Cargo.toml b/solana/bridge/program_stub/Cargo.toml deleted file mode 100644 index b4bf3236..00000000 --- a/solana/bridge/program_stub/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "bridge_stub" -version = "0.1.0" -description = "Wormhole bridge core contract" -edition = "2018" - -[lib] -crate-type = ["cdylib", "lib"] -name = "bridge_stub" - -[features] -client = ["solitaire/client", "solitaire-client", "no-entrypoint"] -cpi = ["no-entrypoint"] -default = [] -no-entrypoint = ["solitaire/no-entrypoint"] -trace = ["solitaire/trace"] - -[dependencies] -borsh = "=0.9.3" -byteorder = "1.4.3" -primitive-types = { version = "0.9.0", default-features = false } -sha3 = "0.9.1" -solana-program = "=1.10.13" -solitaire-client = { path = "../../solitaire/client", optional = true } -solitaire = { path = "../../solitaire/program" } -wormhole-bridge-solana = { path = "../program", features = ["no-entrypoint"] } - -[dev-dependencies] -hex = "*" -rand = "0.7.3" -hex-literal = "0.3.1" -libsecp256k1 = { version = "0.3.5", features = [] } -solana-client = "=1.10.13" -solana-sdk = "=1.10.13" diff --git a/solana/bridge/program_stub/Xargo.toml b/solana/bridge/program_stub/Xargo.toml deleted file mode 100644 index 1744f098..00000000 --- a/solana/bridge/program_stub/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] \ No newline at end of file diff --git a/solana/bridge/program_stub/src/api.rs b/solana/bridge/program_stub/src/api.rs deleted file mode 100644 index 3457f6a2..00000000 --- a/solana/bridge/program_stub/src/api.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod post_vaa; - -pub use bridge::{ - initialize::*, - post_message::*, -}; -pub use post_vaa::*; diff --git a/solana/bridge/program_stub/src/api/post_vaa.rs b/solana/bridge/program_stub/src/api/post_vaa.rs deleted file mode 100644 index 6e00e8e9..00000000 --- a/solana/bridge/program_stub/src/api/post_vaa.rs +++ /dev/null @@ -1,88 +0,0 @@ -use solitaire::*; - -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; -use solana_program::{ - self, - sysvar::clock::Clock, -}; - -use bridge::{ - accounts::{ - Bridge, - GuardianSetDerivationData, - PostedVAA, - PostedVAADerivationData, - }, - instructions::hash_vaa, - PostVAAData, - CHAIN_ID_SOLANA, -}; -use solitaire::{ - processors::seeded::Seeded, - CreationLamports::Exempt, -}; - -#[derive(FromAccounts)] -pub struct PostVAA<'b> { - /// Information about the current guardian set. - pub guardian_set: Info<'b>, - - /// Bridge Info - pub bridge_info: Bridge<'b, { AccountState::Initialized }>, - - /// Signature Info - pub signature_set: Info<'b>, - - /// Message the VAA is associated with. - pub message: Mut>, - - /// Account used to pay for auxillary instructions. - pub payer: Mut>>, - - /// Clock used for timestamping. - pub clock: Sysvar<'b, Clock>, -} - -impl<'b> InstructionContext<'b> for PostVAA<'b> { -} - -#[derive(Default, BorshSerialize, BorshDeserialize)] -pub struct Signature { - pub index: u8, - pub r: [u8; 32], - pub s: [u8; 32], - pub v: u8, -} - -pub type ForeignAddress = [u8; 32]; - -pub fn post_vaa(ctx: &ExecutionContext, accs: &mut PostVAA, vaa: PostVAAData) -> Result<()> { - let mut msg_derivation = PostedVAADerivationData { - payload_hash: hash_vaa(&vaa).to_vec(), - }; - - accs.message - .verify_derivation(ctx.program_id, &msg_derivation)?; - - // If the VAA originates from another chain we need to create the account and populate all fields - if !accs.message.is_initialized() { - accs.message.nonce = vaa.nonce; - accs.message.emitter_chain = vaa.emitter_chain; - accs.message.emitter_address = vaa.emitter_address; - accs.message.sequence = vaa.sequence; - accs.message.payload = vaa.payload; - accs.message.consistency_level = vaa.consistency_level; - accs.message - .create(&msg_derivation, ctx, accs.payer.key, Exempt)?; - } - - // Store VAA data in associated message. - accs.message.vaa_version = vaa.version; - accs.message.vaa_time = vaa.timestamp; - accs.message.vaa_signature_account = *accs.signature_set.info().key; - - Ok(()) -} diff --git a/solana/bridge/program_stub/src/lib.rs b/solana/bridge/program_stub/src/lib.rs deleted file mode 100644 index 3333173a..00000000 --- a/solana/bridge/program_stub/src/lib.rs +++ /dev/null @@ -1,29 +0,0 @@ - -#![feature(adt_const_params)] -#![allow(non_upper_case_globals)] -#![allow(incomplete_features)] - -pub mod api; - -use solitaire::*; - -pub use api::{ - initialize, - post_message, - post_vaa, - Initialize, - InitializeData, - PostMessage, - PostMessageData, - PostVAA, - Signature, - UninitializedMessage, -}; - -use bridge::PostVAAData; - -solitaire! { - Initialize(InitializeData) => initialize, - PostMessage(PostMessageData) => post_message, - PostVAA(PostVAAData) => post_vaa, -} diff --git a/solana/devnet_setup.sh b/solana/devnet_setup.sh index 1c39f8dc..d109b76a 100755 --- a/solana/devnet_setup.sh +++ b/solana/devnet_setup.sh @@ -25,7 +25,7 @@ retry solana airdrop 1000 # Create the bridge contract at a known address # OK to fail on subsequent attempts (already created). -retry client create-bridge "$bridge_address" "$initial_guardian" 86400 100 +retry bridge_client create-bridge "$bridge_address" "$initial_guardian" 86400 100 # Let k8s startup probe succeed nc -k -l -p 2000 diff --git a/solana/bridge/memmap2-rs/Cargo.toml b/solana/memmap2-rs/Cargo.toml similarity index 100% rename from solana/bridge/memmap2-rs/Cargo.toml rename to solana/memmap2-rs/Cargo.toml diff --git a/solana/bridge/memmap2-rs/LICENSE-APACHE b/solana/memmap2-rs/LICENSE-APACHE similarity index 100% rename from solana/bridge/memmap2-rs/LICENSE-APACHE rename to solana/memmap2-rs/LICENSE-APACHE diff --git a/solana/bridge/memmap2-rs/LICENSE-MIT b/solana/memmap2-rs/LICENSE-MIT similarity index 100% rename from solana/bridge/memmap2-rs/LICENSE-MIT rename to solana/memmap2-rs/LICENSE-MIT diff --git a/solana/bridge/memmap2-rs/README.md b/solana/memmap2-rs/README.md similarity index 100% rename from solana/bridge/memmap2-rs/README.md rename to solana/memmap2-rs/README.md diff --git a/solana/bridge/memmap2-rs/src/lib.rs b/solana/memmap2-rs/src/lib.rs similarity index 100% rename from solana/bridge/memmap2-rs/src/lib.rs rename to solana/memmap2-rs/src/lib.rs diff --git a/solana/bridge/memmap2-rs/src/stub.rs b/solana/memmap2-rs/src/stub.rs similarity index 100% rename from solana/bridge/memmap2-rs/src/stub.rs rename to solana/memmap2-rs/src/stub.rs diff --git a/solana/pyth2wormhole/Cargo.lock b/solana/pyth2wormhole/Cargo.lock index 8127e232..baf51322 100644 --- a/solana/pyth2wormhole/Cargo.lock +++ b/solana/pyth2wormhole/Cargo.lock @@ -80,6 +80,21 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" +[[package]] +name = "alloc-no-stdlib" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ef4730490ad1c4eae5c4325b2a95f521d023e5c885853ff7aca0a6a1631db3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "ansi_term" version = "0.12.1" @@ -113,12 +128,65 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" +[[package]] +name = "asn1-rs" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time 0.3.9", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2 1.0.38", + "quote 1.0.18", + "syn 1.0.94", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2 1.0.38", + "quote 1.0.18", + "syn 1.0.94", +] + [[package]] name = "assert_matches" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "async-compression" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345fd392ab01f746c717b1357165b76f0b67a60192007b234058c9045fdcf695" +dependencies = [ + "brotli", + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + [[package]] name = "async-mutex" version = "1.4.0" @@ -282,6 +350,27 @@ dependencies = [ "syn 1.0.94", ] +[[package]] +name = "brotli" +version = "3.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + [[package]] name = "bs58" version = "0.4.0" @@ -596,11 +685,10 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ - "autocfg", "cfg-if", "crossbeam-utils", "lazy_static", @@ -678,6 +766,12 @@ dependencies = [ "rayon", ] +[[package]] +name = "data-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" + [[package]] name = "der" version = "0.5.1" @@ -687,6 +781,20 @@ dependencies = [ "const-oid", ] +[[package]] +name = "der-parser" +version = "8.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint 0.4.3", + "num-traits", + "rusticata-macros", +] + [[package]] name = "derivation-path" version = "0.2.0" @@ -754,6 +862,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "displaydoc" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" +dependencies = [ + "proc-macro2 1.0.38", + "quote 1.0.18", + "syn 1.0.94", +] + [[package]] name = "dlopen" version = "0.1.8" @@ -877,7 +996,7 @@ version = "3.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2170fc0efee383079a8bdd05d6ea2a184d2a0f07a1c1dcabdb2fd5e9f24bc36c" dependencies = [ - "num-bigint", + "num-bigint 0.4.3", "num-traits", "proc-macro2 1.0.38", "quote 1.0.18", @@ -885,6 +1004,18 @@ dependencies = [ "syn 1.0.94", ] +[[package]] +name = "enum_dispatch" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eb359f1476bf611266ac1f5355bc14aeca37b299d0ebccc038ee7058891c9cb" +dependencies = [ + "once_cell", + "proc-macro2 1.0.38", + "quote 1.0.18", + "syn 1.0.94", +] + [[package]] name = "env_logger" version = "0.8.4" @@ -1541,11 +1672,10 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" dependencies = [ - "autocfg", "scopeguard", ] @@ -1567,6 +1697,26 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "lz4" +version = "1.23.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4edcb94251b1c375c459e5abe9fb0168c1c826c3370172684844f8f3f8d1a885" +dependencies = [ + "libc", + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7be8908e2ed6f31c02db8a9fa962f03e36c53fbfde437363eae3306b85d7e17" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "matches" version = "0.1.9" @@ -1615,6 +1765,12 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.5.1" @@ -1680,6 +1836,16 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nom" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "ntapi" version = "0.3.7" @@ -1689,6 +1855,31 @@ dependencies = [ "winapi", ] +[[package]] +name = "num" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" +dependencies = [ + "num-bigint 0.2.6", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -1700,6 +1891,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-complex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -1721,6 +1922,29 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +dependencies = [ + "autocfg", + "num-bigint 0.2.6", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -1776,6 +2000,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +[[package]] +name = "oid-registry" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d4bda43fd1b844cbc6e6e54b5444e2b1bc7838bce59ad205902cccbb26d6761" +dependencies = [ + "asn1-rs", +] + [[package]] name = "once_cell" version = "1.10.0" @@ -1796,7 +2029,7 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "opentelemetry" -version = "1.0.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf9b1c4e9a6c4de793c632496fa490bdc0e1eea73f0c91394f7b6990935d22" dependencies = [ @@ -1846,6 +2079,7 @@ name = "p2w-sdk" version = "0.1.1" dependencies = [ "hex", + "pyth-sdk", "pyth-sdk-solana", "serde", "solana-program", @@ -1933,6 +2167,15 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "percentage" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd23b938276f14057220b707937bcb42fa76dda7560e57a2da30cb52d557937" +dependencies = [ + "num", +] + [[package]] name = "pin-project" version = "1.0.10" @@ -2142,7 +2385,6 @@ dependencies = [ "serde_json", "solana-program", "solitaire", - "solitaire-client", "wormhole-bridge-solana", ] @@ -2168,7 +2410,6 @@ dependencies = [ "solana-sdk", "solana-transaction-status", "solitaire", - "solitaire-client", "tokio", "wormhole-bridge-solana", ] @@ -2184,9 +2425,9 @@ dependencies = [ [[package]] name = "quinn" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d147472bc9a09f13b06c044787b6683cdffa02e2865b7f0fb53d67c49ed2988e" +checksum = "21afdc492bf2a8688cb386be6605d1163b6ace89afa5e3b529037d2b4334b860" dependencies = [ "bytes", "futures-channel", @@ -2203,9 +2444,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "359c5eb33845f3ee05c229e65f87cdbc503eea394964b8f1330833d460b4ff3e" +checksum = "3fce546b9688f767a57530652488420d419a8b1f44a478b451c3d1ab6d992a55" dependencies = [ "bytes", "fxhash", @@ -2432,6 +2673,7 @@ version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" dependencies = [ + "async-compression", "base64 0.13.0", "bytes", "encoding_rs", @@ -2456,6 +2698,7 @@ dependencies = [ "serde_urlencoded", "tokio", "tokio-rustls", + "tokio-util 0.6.10", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -2482,6 +2725,7 @@ dependencies = [ [[package]] name = "rocksalt" version = "0.1.0" +source = "git+https://github.com/certusone/wormhole?tag=v2.8.9#e47f9e481ef84d4dea7a94c9eafbf3b180892466" dependencies = [ "byteorder", "proc-macro2 1.0.38", @@ -2524,6 +2768,15 @@ dependencies = [ "semver", ] +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + [[package]] name = "rustls" version = "0.20.5" @@ -2894,9 +3147,9 @@ dependencies = [ [[package]] name = "solana-account-decoder" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3ac7a5e07505d44702a4b8703cb07d49cab91ce14c7690428c5d37a56c00f3" +checksum = "8d08d1662c7c136edfe9cf2280ca50d03c26fbeb1afd671cafe96ae3482d67f5" dependencies = [ "Inflector", "base64 0.13.0", @@ -2918,9 +3171,9 @@ dependencies = [ [[package]] name = "solana-address-lookup-table-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e8552f128cfa8c384c15bd1481d8d2b2deeec3ea97f8668263a72c98e90ba2" +checksum = "d480f83338321c6f668b897a6ab885f9f824b3b1e0ed97f1402b9ace47538ccd" dependencies = [ "bincode", "bytemuck", @@ -2939,9 +3192,9 @@ dependencies = [ [[package]] name = "solana-banks-client" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3620713d1c7a7b39a7183d6b3514290d9561d96296981141299eade0c71532da" +checksum = "ccf643cbbcceae5c19a9be70f5f90de55d0152eab8d72e149f1bcbf273a2c06f" dependencies = [ "borsh", "futures", @@ -2956,9 +3209,9 @@ dependencies = [ [[package]] name = "solana-banks-interface" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5accfbbc0a0de1f4fb87a81f3accd8c4e1b9e3004f4b2e210f6699363182dd3d" +checksum = "fe328ffa6bc6c7a7486fcc0c4392601ddefa480eadc783f185f854c82c1d222e" dependencies = [ "serde", "solana-sdk", @@ -2967,14 +3220,15 @@ dependencies = [ [[package]] name = "solana-banks-server" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de1d17605a3b6e0917bb942d4f871dba6153be59ae04252d3909e544651a7dd5" +checksum = "022f6ecc185cfb66adfcdd48ce1e1f4a0412683b5e50f7c2e27392fb3619f549" dependencies = [ "bincode", "crossbeam-channel", "futures", "solana-banks-interface", + "solana-client", "solana-runtime", "solana-sdk", "solana-send-transaction-service", @@ -2986,9 +3240,9 @@ dependencies = [ [[package]] name = "solana-bpf-loader-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b3a4236ec3537e1f56f4ca088d4c1c51e4c0f692c665fa078a0a4ee6434e00" +checksum = "ae58c79e140c9ba215690f85a1b674f0b7b19a4f27e9ba7f68123ad3c48688f1" dependencies = [ "bincode", "byteorder", @@ -2998,16 +3252,16 @@ dependencies = [ "solana-metrics", "solana-program-runtime", "solana-sdk", - "solana-zk-token-sdk 1.10.13", + "solana-zk-token-sdk 1.10.31", "solana_rbpf", "thiserror", ] [[package]] name = "solana-bucket-map" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3706e0ef1e02836288a10b8b67bcbee512133336621b0330250b8a02fccba0" +checksum = "5ce30aa5774dcceca50f34d9a711d2db77ffc2e1bbb5dd6a624ec4cf2d69012b" dependencies = [ "log", "memmap2", @@ -3020,9 +3274,9 @@ dependencies = [ [[package]] name = "solana-clap-utils" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f013e36c59855763ad9d700f42521a2b5e4e7f414dbc358215b0eb30e001c682" +checksum = "31c3b376c469a550be2f45890c81246362aed55bf06b5b4195002f1e84492f1c" dependencies = [ "chrono", "clap 2.34.0", @@ -3038,9 +3292,9 @@ dependencies = [ [[package]] name = "solana-cli-config" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "699548d391f4416b38df8a574de43cd68903058c6e6913a016465cdb3cd4ecbe" +checksum = "785f2a03d0a6ff9faea80da2b4c293c3f62c3981cb60afd8921a2d6ffaa049db" dependencies = [ "dirs-next", "lazy_static", @@ -3054,9 +3308,9 @@ dependencies = [ [[package]] name = "solana-client" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8f63b9c6c6b61b0ffdf5592ec6f77a2138c41650cb419e2307f48f10847552a" +checksum = "e41177bc4766dab40ee608ab22d4d2c25a9b83ba82af76569ff55aa89a196127" dependencies = [ "async-mutex", "async-trait", @@ -3066,6 +3320,7 @@ dependencies = [ "bytes", "clap 2.34.0", "crossbeam-channel", + "enum_dispatch", "futures", "futures-util", "indexmap", @@ -3075,11 +3330,13 @@ dependencies = [ "lazy_static", "log", "lru", + "pkcs8", "quinn", "quinn-proto", "rand 0.7.3", "rand_chacha 0.2.2", "rayon", + "rcgen", "reqwest", "rustls", "semver", @@ -3097,6 +3354,7 @@ dependencies = [ "solana-transaction-status", "solana-version", "solana-vote-program", + "spl-token-2022", "thiserror", "tokio", "tokio-stream", @@ -3107,9 +3365,9 @@ dependencies = [ [[package]] name = "solana-compute-budget-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36a0261900b2a85fadbadde799b5859079daf6482f11456a0c8e42e03525c8c" +checksum = "504ef0bc9a7437dcb12bc73bbd950653dc57eb9f009ce5235c9a1e5d118082fb" dependencies = [ "solana-program-runtime", "solana-sdk", @@ -3117,9 +3375,9 @@ dependencies = [ [[package]] name = "solana-config-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f46d626492e7b4408910b5bc07c2e20ad89d52661c07ab7a569d937d8676d0" +checksum = "ed3a2ae68a6a79ba4a695ede777e7b9573bedc57565a9be1685662ce741f7bc6" dependencies = [ "bincode", "chrono", @@ -3131,9 +3389,9 @@ dependencies = [ [[package]] name = "solana-faucet" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccc828c593a752c9ec7fbf1964474cdbe3a4dce01c00142dceefb73d712f967" +checksum = "e99dd10530cbd7f7c056a381e2df892dafec8a45abbf95b8e30d7871ff44809a" dependencies = [ "bincode", "byteorder", @@ -3155,9 +3413,9 @@ dependencies = [ [[package]] name = "solana-frozen-abi" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7dd1cefedcc43251a0618c902b8a5ce7ae6c2a5103264633a65b1b40b6ba259" +checksum = "68f2b153f8eb8c4d22f2b739d3d31bac4122ca17376869cb717bf3a45200ea63" dependencies = [ "bs58", "bv", @@ -3177,9 +3435,9 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c61a1bb5dd9ac1b8f6b4fd276ea4833822668e791f74ae8c45dd792167f4" +checksum = "0cd23aad847403a28dd1452611490b5e8f040470ed251882cca0492c5e566280" dependencies = [ "proc-macro2 1.0.38", "quote 1.0.18", @@ -3189,9 +3447,9 @@ dependencies = [ [[package]] name = "solana-logger" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb5aee1180cc4baa90a25ac4e62897571675f59b3df2948bf4e17f904636fc9" +checksum = "c33c4e4133e5b72f237bc8d39ab5a02255919e314674171fc08c57e48d33e2d0" dependencies = [ "env_logger 0.9.0", "lazy_static", @@ -3200,9 +3458,9 @@ dependencies = [ [[package]] name = "solana-measure" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbfac2bb362d81e62abfd27f4309f9201825757ff720ef46ddb4b6b71e23d4eb" +checksum = "67d54a127c1a06b4b346d9d8ed92dd5f6a051d10f0ffe4b8734e28d34500957b" dependencies = [ "log", "solana-sdk", @@ -3210,9 +3468,9 @@ dependencies = [ [[package]] name = "solana-metrics" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42b895d969c2954f8ba3f77391da3df5ac7bdc58deeca3ee5ad8e28a9ba2b527" +checksum = "e2a5ab5217bbc8dce972a521f817f5635606f88aac45f850254c07c18de46190" dependencies = [ "crossbeam-channel", "gethostname", @@ -3224,9 +3482,9 @@ dependencies = [ [[package]] name = "solana-net-utils" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83edc9b096cac5e9fe1a168ab6afa35abd43f6fd5f7b850342afb8b419457996" +checksum = "e0a3c31c9f64d268110f59f162023dee05fb41f8d033d69fb980d6e80566f6b1" dependencies = [ "bincode", "clap 2.34.0", @@ -3246,9 +3504,9 @@ dependencies = [ [[package]] name = "solana-perf" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b59409ba8cf2aa01f4503d1710d8e3e46696479c684296733bce5f8b69f0f58f" +checksum = "e3051f0009af3307bfa4ec5fbc748ebe116578228331f23bf51cc998878d26e2" dependencies = [ "ahash", "bincode", @@ -3273,9 +3531,9 @@ dependencies = [ [[package]] name = "solana-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9452f34caedc50eeb0752c5f9ea7992ec8f618c2041acbbd455e70186f362d51" +checksum = "37be82a1fe85b24aa036153650053fd9628489c07c834b6b2dc027c4052bdbe5" dependencies = [ "base64 0.13.0", "bincode", @@ -3315,9 +3573,9 @@ dependencies = [ [[package]] name = "solana-program-runtime" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20a7f03d9d4a017ca231de86daf38bd788e336e45940abcaa02e3a5b2c71c34f" +checksum = "59ea2c8a1f394a598a67b1b12202ed96f4033b765d50fe24a4546b4fff70b684" dependencies = [ "base64 0.13.0", "bincode", @@ -3339,9 +3597,9 @@ dependencies = [ [[package]] name = "solana-program-test" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a9497069ba03021ed5b92401347afe0bb429b5fc299bafc8d135db5876a777" +checksum = "cead3a2861b6d973d3347a33cd7f6b4b0a77da294f308c72c254e13e3711b19e" dependencies = [ "async-trait", "base64 0.13.0", @@ -3363,9 +3621,9 @@ dependencies = [ [[package]] name = "solana-rayon-threadlimit" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "493a6fd0744dad62182c81e6d3cfd3be5b73030a1225ef7b833c45da209a0822" +checksum = "a90fb70dc9a52d152b8a9e8bd3037fa1d93746a9827501a3e892c015c5696bb7" dependencies = [ "lazy_static", "num_cpus", @@ -3373,9 +3631,9 @@ dependencies = [ [[package]] name = "solana-remote-wallet" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b229e2b28d72dfb431a9cd444e51b9a3d204979dc6ec2ad21d0ce3f963d6789" +checksum = "a01597dd382b25087a01c6fa0e7b3d9165a98caedb9cc8fca3385f05ec799abf" dependencies = [ "console", "dialoguer", @@ -3392,9 +3650,9 @@ dependencies = [ [[package]] name = "solana-runtime" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74e6fa8c36b26388e162274df5978a33243062d8a8d6944613653dcc98e1f33" +checksum = "b08d01a6fb011f11e635823aa1eba8c427bb6af6ef14055d2c3ed7550072b625" dependencies = [ "arrayref", "bincode", @@ -3413,6 +3671,7 @@ dependencies = [ "itertools", "lazy_static", "log", + "lz4", "memmap2", "num-derive", "num-traits", @@ -3438,7 +3697,9 @@ dependencies = [ "solana-stake-program", "solana-vote-program", "solana-zk-token-proof-program", - "solana-zk-token-sdk 1.10.13", + "solana-zk-token-sdk 1.10.31", + "strum", + "strum_macros", "symlink", "tar", "tempfile", @@ -3448,9 +3709,9 @@ dependencies = [ [[package]] name = "solana-sdk" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd83ce2d96b259233e698623c83431c5c9a1dccbc12b7dfcdbc500a0946ea516" +checksum = "52f5045b84f57ba203d1080fa595b463b4fd72c11af96f7735de0e2ffd698e1a" dependencies = [ "assert_matches", "base64 0.13.0", @@ -3499,9 +3760,9 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee7e7c63938c587870f33bd6b81a9c2913773009802ba3eed57116e9f24694a" +checksum = "275c52edaaaa86ce649a226c03f75579d570c01880a43ee1de77a973994754ce" dependencies = [ "bs58", "proc-macro2 1.0.38", @@ -3512,9 +3773,9 @@ dependencies = [ [[package]] name = "solana-send-transaction-service" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "800bc1fe4350f7ecd78ef90736810ea9921adcc8fdb69b36947643b897947990" +checksum = "766f45bf998cb4090361e3c76f76ed121b78119f398ee0f682c0b467c8851001" dependencies = [ "crossbeam-channel", "log", @@ -3527,9 +3788,9 @@ dependencies = [ [[package]] name = "solana-stake-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5a8be3c78552209d0a9fafa29eafe2d85704661ad4dc86a68376b0c87dfdc6" +checksum = "6d1700796a9b7854fe4de8f35f0867c946d4b2acb0f182620585e49424931800" dependencies = [ "bincode", "log", @@ -3550,18 +3811,20 @@ dependencies = [ [[package]] name = "solana-streamer" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebdee4a546dfd0d0e0732eee181003208f237da9ac60d5483063c8957e14edd3" +checksum = "4251d86721ae9959a2153007d8fd87e193c26ccb77b3b38bd436916ff27a41a8" dependencies = [ "crossbeam-channel", "futures-util", "histogram", + "indexmap", "itertools", "libc", "log", "nix", "pem", + "percentage", "pkcs8", "quinn", "rand 0.7.3", @@ -3572,13 +3835,14 @@ dependencies = [ "solana-sdk", "thiserror", "tokio", + "x509-parser", ] [[package]] name = "solana-transaction-status" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3ed82c7e7ee3502f9c6e2fe00ee1274a265452d7150211125534541db70ef4" +checksum = "45e087a2cbb6fb1ad37f3fe7a27fad00f73b853f35b3e7e3768c8b68d49b7872" dependencies = [ "Inflector", "base64 0.13.0", @@ -3605,12 +3869,13 @@ dependencies = [ [[package]] name = "solana-version" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126250d1e5e54960600cc48103762cc0c119a869acd252d76da23ea96bebdc6c" +checksum = "5570dcbadcb7975719843846cb10ead644fb8d55897384ced38df87e47bd6b07" dependencies = [ "log", "rustc_version", + "semver", "serde", "serde_derive", "solana-frozen-abi", @@ -3620,9 +3885,9 @@ dependencies = [ [[package]] name = "solana-vote-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1c43844b0160eded67745e4a6e6c6384852f1595b9b4c085c4da590b2026aa" +checksum = "5eeeda80a9e0d7e6224bb0765168e51561a93e3e1d03859da6e358e36c2cf9a1" dependencies = [ "bincode", "log", @@ -3641,9 +3906,9 @@ dependencies = [ [[package]] name = "solana-zk-token-proof-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "269131bff8d2ed0561aded5ace56c8bf9f6ad204ba70afd3ea164b790c4df537" +checksum = "3f8b91f5859a4831943d8999521debc0cdf127e820a2839853f3bf56d18d8580" dependencies = [ "bytemuck", "getrandom 0.1.16", @@ -3651,7 +3916,7 @@ dependencies = [ "num-traits", "solana-program-runtime", "solana-sdk", - "solana-zk-token-sdk 1.10.13", + "solana-zk-token-sdk 1.10.31", ] [[package]] @@ -3686,9 +3951,9 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5500f3c96fafba02151420658dfb80b83113ddbaad8c43a4056367847bb2ddd" +checksum = "39b3e4da3a0b886fd8c90677bb39d0b82dedcb5a4a12cc410a084dda1df4a742" dependencies = [ "aes-gcm-siv", "arrayref", @@ -3736,6 +4001,7 @@ dependencies = [ [[package]] name = "solitaire" version = "0.1.0" +source = "git+https://github.com/certusone/wormhole?tag=v2.8.9#e47f9e481ef84d4dea7a94c9eafbf3b180892466" dependencies = [ "borsh", "byteorder", @@ -3744,16 +4010,6 @@ dependencies = [ "solana-program", ] -[[package]] -name = "solitaire-client" -version = "0.1.0" -dependencies = [ - "borsh", - "solana-program", - "solana-sdk", - "solitaire", -] - [[package]] name = "spin" version = "0.5.2" @@ -3846,6 +4102,28 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2 1.0.38", + "quote 1.0.18", + "rustversion", + "syn 1.0.94", +] + [[package]] name = "subtle" version = "2.4.1" @@ -4031,10 +4309,18 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" dependencies = [ + "itoa", "libc", "num_threads", + "time-macros", ] +[[package]] +name = "time-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" + [[package]] name = "tiny-bip39" version = "0.8.2" @@ -4625,6 +4911,7 @@ dependencies = [ [[package]] name = "wormhole-bridge-solana" version = "0.1.0" +source = "git+https://github.com/certusone/wormhole?tag=v2.8.9#e47f9e481ef84d4dea7a94c9eafbf3b180892466" dependencies = [ "borsh", "byteorder", @@ -4633,7 +4920,24 @@ dependencies = [ "sha3 0.9.1", "solana-program", "solitaire", - "solitaire-client", +] + +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs", + "base64 0.13.0", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time 0.3.9", ] [[package]] diff --git a/solana/pyth2wormhole/Cargo.toml b/solana/pyth2wormhole/Cargo.toml index 2a2d4927..e11ab972 100644 --- a/solana/pyth2wormhole/Cargo.toml +++ b/solana/pyth2wormhole/Cargo.toml @@ -1,4 +1,4 @@ [workspace] members = ["client", "program"] [patch.crates-io] -memmap2 = { path = "../bridge/memmap2-rs" } \ No newline at end of file +memmap2 = { path = "../memmap2-rs" } \ No newline at end of file diff --git a/solana/pyth2wormhole/client/Cargo.toml b/solana/pyth2wormhole/client/Cargo.toml index 47217474..79f88dbc 100644 --- a/solana/pyth2wormhole/client/Cargo.toml +++ b/solana/pyth2wormhole/client/Cargo.toml @@ -16,23 +16,23 @@ borsh = "=0.9.3" clap = {version = "3.1.18", features = ["derive"]} env_logger = "0.8.4" log = "0.4.14" -wormhole-bridge-solana = {path = "../../bridge/program"} +wormhole-bridge-solana = {git = "https://github.com/certusone/wormhole", tag = "v2.8.9"} pyth2wormhole = {path = "../program"} p2w-sdk = { path = "../../../third_party/pyth/p2w-sdk/rust", features=["solana"] } pyth-sdk-solana = "0.4.0" serde = "1" serde_yaml = "0.8" shellexpand = "2.1.0" -solana-client = "=1.10.13" -solana-program = "=1.10.13" -solana-sdk = "=1.10.13" -solana-transaction-status = "=1.10.13" -solitaire-client = {path = "../../solitaire/client"} -solitaire = {path = "../../solitaire/program"} +solana-client = "=1.10.31" +solana-program = "=1.10.31" +solana-sdk = "=1.10.31" +solana-transaction-status = "=1.10.31" +# solitaire-client = {path = "../../solitaire/client"} +solitaire = {git = "https://github.com/certusone/wormhole", tag = "v2.8.9"} tokio = {version = "1", features = ["sync", "rt", "time"]} futures = "0.3.21" [dev-dependencies] pyth-client = "0.5.0" -solana-program-test = "=1.10.13" -solana-sdk = "=1.10.13" +solana-program-test = "=1.10.31" +solana-sdk = "=1.10.31" diff --git a/solana/pyth2wormhole/client/src/lib.rs b/solana/pyth2wormhole/client/src/lib.rs index 91555c15..d0d7efdd 100644 --- a/solana/pyth2wormhole/client/src/lib.rs +++ b/solana/pyth2wormhole/client/src/lib.rs @@ -20,18 +20,12 @@ use solana_program::{ rent, }, }; -use solana_sdk::transaction::Transaction; +use solana_sdk::{transaction::Transaction, signer::{Signer, keypair::Keypair}}; use solitaire::{ processors::seeded::Seeded, AccountState, ErrBox, }; -use solitaire_client::{ - AccEntry, - Keypair, - SolSigner, - ToInstruction, -}; use bridge::{ accounts::{ @@ -47,10 +41,7 @@ use p2w_sdk::P2WEmitter; use pyth2wormhole::{ attest::P2W_MAX_BATCH_SIZE, - config::P2WConfigAccount, - initialize::InitializeAccounts, - migrate::MigrateAccounts, - set_config::SetConfigAccounts, + config::{OldP2WConfigAccount, P2WConfigAccount}, AttestData, }; @@ -76,23 +67,33 @@ pub fn gen_init_tx( config: Pyth2WormholeConfig, latest_blockhash: Hash, ) -> Result { - use AccEntry::*; let payer_pubkey = payer.pubkey(); - - let accs = InitializeAccounts { - payer: Signer(payer), - new_config: Derived(p2w_addr), - }; + let acc_metas = vec![ + // new_config + AccountMeta::new(P2WConfigAccount::<{AccountState::Uninitialized}>::key(None, &p2w_addr), false), + // payer + AccountMeta::new(payer.pubkey(), true), + // system_program + AccountMeta::new(system_program::id(), false), + ]; let ix_data = (pyth2wormhole::instruction::Instruction::Initialize, config); - let (ix, signers) = accs.to_ix(p2w_addr, ix_data.try_to_vec()?.as_slice())?; + let ix = Instruction::new_with_bytes( + p2w_addr, + ix_data + .try_to_vec()? + .as_slice(), + acc_metas, + ); + + let signers = vec![&payer]; let tx_signed = Transaction::new_signed_with_payer::>( &[ix], Some(&payer_pubkey), - signers.iter().collect::>().as_ref(), + &signers, latest_blockhash, ); Ok(tx_signed) @@ -105,27 +106,35 @@ pub fn gen_set_config_tx( new_config: Pyth2WormholeConfig, latest_blockhash: Hash, ) -> Result { - use AccEntry::*; - let payer_pubkey = payer.pubkey(); - let accs = SetConfigAccounts { - payer: Signer(payer), - current_owner: Signer(owner), - config: Derived(p2w_addr), - }; + let acc_metas = vec![ + // config + AccountMeta::new(P2WConfigAccount::<{AccountState::Initialized}>::key(None, &p2w_addr), false), + // current_owner + AccountMeta::new(owner.pubkey(), true), + // payer + AccountMeta::new(payer.pubkey(), true), + ]; let ix_data = ( pyth2wormhole::instruction::Instruction::SetConfig, new_config, ); - let (ix, signers) = accs.to_ix(p2w_addr, ix_data.try_to_vec()?.as_slice())?; + let ix = Instruction::new_with_bytes( + p2w_addr, + ix_data + .try_to_vec()? + .as_slice(), + acc_metas, + ); + let signers = vec![&owner, &payer]; let tx_signed = Transaction::new_signed_with_payer::>( &[ix], Some(&payer_pubkey), - signers.iter().collect::>().as_ref(), + &signers, latest_blockhash, ); Ok(tx_signed) @@ -137,28 +146,41 @@ pub fn gen_migrate_tx( owner: Keypair, latest_blockhash: Hash, ) -> Result { - use AccEntry::*; let payer_pubkey = payer.pubkey(); - let accs = MigrateAccounts { - new_config: Derived(p2w_addr), - old_config: Derived(p2w_addr), - current_owner: Signer(owner), - payer: Signer(payer), - }; + let acc_metas = vec![ + // new_config + AccountMeta::new(P2WConfigAccount::<{AccountState::Uninitialized}>::key(None, &p2w_addr), false), + // old_config + AccountMeta::new(OldP2WConfigAccount::key(None, &p2w_addr), false), + // owner + AccountMeta::new(owner.pubkey(), true), + // payer + AccountMeta::new(payer.pubkey(), true), + // system_program + AccountMeta::new(system_program::id(), false), + ]; let ix_data = ( pyth2wormhole::instruction::Instruction::Migrate, (), ); - let (ix, signers) = accs.to_ix(p2w_addr, ix_data.try_to_vec()?.as_slice())?; + let ix = Instruction::new_with_bytes( + p2w_addr, + ix_data + .try_to_vec()? + .as_slice(), + acc_metas, + ); + + let signers = vec![&owner, &payer]; let tx_signed = Transaction::new_signed_with_payer::>( &[ix], Some(&payer_pubkey), - signers.iter().collect::>().as_ref(), + &signers, latest_blockhash, ); Ok(tx_signed) @@ -279,8 +301,7 @@ pub fn gen_attest_tx( let ix = Instruction::new_with_bytes( p2w_addr, ix_data - .try_to_vec() - .map_err(|e| -> ErrBoxSend { Box::new(e) })? + .try_to_vec()? .as_slice(), acc_metas, ); diff --git a/solana/pyth2wormhole/client/src/main.rs b/solana/pyth2wormhole/client/src/main.rs index 26d0be19..6e065019 100644 --- a/solana/pyth2wormhole/client/src/main.rs +++ b/solana/pyth2wormhole/client/src/main.rs @@ -37,13 +37,13 @@ use solana_sdk::{ read_keypair_file, Signature, }, + signer::keypair::Keypair, }; use solana_transaction_status::UiTransactionEncoding; use solitaire::{ processors::seeded::Seeded, ErrBox, }; -use solitaire_client::Keypair; use tokio::{ sync::Semaphore, task::JoinHandle, diff --git a/solana/pyth2wormhole/client/tests/test_migrate.rs b/solana/pyth2wormhole/client/tests/test_migrate.rs index 9fe2ca2e..95bd4205 100644 --- a/solana/pyth2wormhole/client/tests/test_migrate.rs +++ b/solana/pyth2wormhole/client/tests/test_migrate.rs @@ -89,6 +89,8 @@ async fn test_migrate_works() -> Result<(), solitaire::ErrBox> { // Add system program because the contract creates an account for new configuration account passthrough::add_passthrough(&mut p2w_test, "system", system_program::id()); + info!("System program under {}", system_program::id()); + info!("Before start_with_context"); let mut ctx = p2w_test.start_with_context().await; diff --git a/solana/pyth2wormhole/program/Cargo.toml b/solana/pyth2wormhole/program/Cargo.toml index a36f0c2a..a53a97d4 100644 --- a/solana/pyth2wormhole/program/Cargo.toml +++ b/solana/pyth2wormhole/program/Cargo.toml @@ -10,20 +10,18 @@ name = "pyth2wormhole" [features] default = ["wormhole-bridge-solana/no-entrypoint"] -client = ["solitaire/client", "solitaire-client", "no-entrypoint"] +client = ["solitaire/client", "no-entrypoint"] trace = ["solitaire/trace", "wormhole-bridge-solana/trace"] no-entrypoint = [] [dependencies] -wormhole-bridge-solana = {path = "../../bridge/program"} -solitaire = { path = "../../solitaire/program" } -solitaire-client = { path = "../../solitaire/client", optional = true } -rocksalt = { path = "../../solitaire/rocksalt" } -solana-program = "=1.10.13" +wormhole-bridge-solana = { git = "https://github.com/certusone/wormhole", tag = "v2.8.9" } +solitaire = { git = "https://github.com/certusone/wormhole", tag = "v2.8.9"} +rocksalt = { git = "https://github.com/certusone/wormhole", tag = "v2.8.9"} +solana-program = "=1.10.31" borsh = "=0.9.3" pyth-client = "0.2.2" p2w-sdk = { path = "../../../third_party/pyth/p2w-sdk/rust", features = ["solana"] } serde = { version = "1", optional = true} serde_derive = { version = "1", optional = true} serde_json = { version = "1", optional = true} - diff --git a/solana/pyth2wormhole/program/src/attest.rs b/solana/pyth2wormhole/program/src/attest.rs index b65b73b8..a213a535 100644 --- a/solana/pyth2wormhole/program/src/attest.rs +++ b/solana/pyth2wormhole/program/src/attest.rs @@ -22,6 +22,7 @@ use p2w_sdk::{ BatchPriceAttestation, P2WEmitter, PriceAttestation, + Identifier, }; use bridge::{ @@ -38,7 +39,6 @@ use solitaire::{ ExecutionContext, FromAccounts, Info, - InstructionContext, Keyed, Mut, Peel, @@ -47,7 +47,6 @@ use solitaire::{ Signer, SolitaireError, Sysvar, - ToInstruction, }; /// Important: must be manually maintained until native Solitaire @@ -59,7 +58,7 @@ use solitaire::{ /// correct value dynamically. pub const P2W_MAX_BATCH_SIZE: u16 = 5; -#[derive(FromAccounts, ToInstruction)] +#[derive(FromAccounts)] pub struct Attest<'b> { // Payer also used for wormhole pub payer: Mut>>, @@ -133,12 +132,6 @@ pub struct AttestData { pub consistency_level: ConsistencyLevel, } -impl<'b> InstructionContext<'b> for Attest<'b> { - fn deps(&self) -> Vec { - vec![solana_program::system_program::id()] - } -} - pub fn attest(ctx: &ExecutionContext, accs: &mut Attest, data: AttestData) -> SoliResult<()> { if !accs.config.is_active { // msg instead of trace makes sure we're not silent about this in prod @@ -211,7 +204,7 @@ pub fn attest(ctx: &ExecutionContext, accs: &mut Attest, data: AttestData) -> So } let attestation = PriceAttestation::from_pyth_price_bytes( - price.key.clone(), + Identifier::new(product.key.to_bytes()), accs.clock.unix_timestamp, &*price.try_borrow_data()?, ) @@ -228,7 +221,7 @@ pub fn attest(ctx: &ExecutionContext, accs: &mut Attest, data: AttestData) -> So // Failing to verify the product/price relationship could lead // to mismatched product/price metadata, which would result in // a false attestation. - if &attestation.product_id != product.key { + if attestation.product_id.to_bytes() != product.key.to_bytes() { trace!(&format!( "Price's product_id does not match the pased account (points at {:?} instead)", attestation.product_id diff --git a/solana/pyth2wormhole/program/src/initialize.rs b/solana/pyth2wormhole/program/src/initialize.rs index 7bf9ad30..2c9b3812 100644 --- a/solana/pyth2wormhole/program/src/initialize.rs +++ b/solana/pyth2wormhole/program/src/initialize.rs @@ -6,13 +6,11 @@ use solitaire::{ ExecutionContext, FromAccounts, Info, - InstructionContext, Keyed, Mut, Peel, Result as SoliResult, Signer, - ToInstruction, }; use crate::config::{ @@ -20,16 +18,11 @@ use crate::config::{ Pyth2WormholeConfig, }; -#[derive(FromAccounts, ToInstruction)] +#[derive(FromAccounts)] pub struct Initialize<'b> { pub new_config: Mut>, pub payer: Mut>>, -} - -impl<'b> InstructionContext<'b> for Initialize<'b> { - fn deps(&self) -> Vec { - vec![] - } + pub system_program: Info<'b>, } /// Must be called right after deployment diff --git a/solana/pyth2wormhole/program/src/lib.rs b/solana/pyth2wormhole/program/src/lib.rs index 36231d7b..5093994d 100644 --- a/solana/pyth2wormhole/program/src/lib.rs +++ b/solana/pyth2wormhole/program/src/lib.rs @@ -29,8 +29,8 @@ pub use set_config::{ pub use pyth_client; solitaire! { - Attest(AttestData) => attest, - Initialize(Pyth2WormholeConfig) => initialize, - SetConfig(Pyth2WormholeConfig) => set_config, - Migrate(()) => migrate, + Attest => attest, + Initialize => initialize, + SetConfig => set_config, + Migrate => migrate, } diff --git a/solana/pyth2wormhole/program/src/migrate.rs b/solana/pyth2wormhole/program/src/migrate.rs index 1c80a340..594252ca 100644 --- a/solana/pyth2wormhole/program/src/migrate.rs +++ b/solana/pyth2wormhole/program/src/migrate.rs @@ -3,6 +3,7 @@ use solana_program::{ program_error::ProgramError, pubkey::Pubkey, + system_program, }; use solitaire::{ @@ -12,14 +13,12 @@ use solitaire::{ ExecutionContext, FromAccounts, Info, - InstructionContext, Keyed, Mut, Peel, Result as SoliResult, Signer, SolitaireError, - ToInstruction, }; use crate::config::{ @@ -33,7 +32,7 @@ use crate::config::{ /// /// NOTE: This account struct assumes Solitaire is able to validate the /// Uninitialized requirement on the new_config account -#[derive(FromAccounts, ToInstruction)] +#[derive(FromAccounts)] pub struct Migrate<'b> { /// New config account to be populated. Must be unused. pub new_config: Mut>, @@ -43,12 +42,8 @@ pub struct Migrate<'b> { pub current_owner: Mut>>, /// Payer account for updating the account data pub payer: Mut>>, -} - -impl<'b> InstructionContext<'b> for Migrate<'b> { - fn deps(&self) -> Vec { - vec![] - } + /// For creating the new config account + pub system_program: Info<'b>, } pub fn migrate(ctx: &ExecutionContext, accs: &mut Migrate, data: ()) -> SoliResult<()> { @@ -64,6 +59,18 @@ pub fn migrate(ctx: &ExecutionContext, accs: &mut Migrate, data: ()) -> SoliResu )); } + if *accs.system_program.key != system_program::id() { + trace!( + "Invalid system program, expected {:?}), found {}", + system_program::id(), + accs.system_program.key + ); + return Err(SolitaireError::InvalidSigner( + accs.system_program.key.clone(), + )); + } + + // Populate new config accs.new_config .create(ctx, accs.payer.info().key, CreationLamports::Exempt)?; diff --git a/solana/pyth2wormhole/program/src/set_config.rs b/solana/pyth2wormhole/program/src/set_config.rs index cec1eb4e..87bf8247 100644 --- a/solana/pyth2wormhole/program/src/set_config.rs +++ b/solana/pyth2wormhole/program/src/set_config.rs @@ -5,14 +5,12 @@ use solitaire::{ ExecutionContext, FromAccounts, Info, - InstructionContext, Keyed, Mut, Peel, Result as SoliResult, Signer, SolitaireError, - ToInstruction, }; use crate::config::{ @@ -20,7 +18,7 @@ use crate::config::{ Pyth2WormholeConfig, }; -#[derive(FromAccounts, ToInstruction)] +#[derive(FromAccounts)] pub struct SetConfig<'b> { /// Current config used by the program pub config: Mut>, @@ -30,12 +28,6 @@ pub struct SetConfig<'b> { pub payer: Mut>>, } -impl<'b> InstructionContext<'b> for SetConfig<'b> { - fn deps(&self) -> Vec { - vec![] - } -} - /// Alters the current settings of pyth2wormhole pub fn set_config( _ctx: &ExecutionContext, diff --git a/solana/rust-toolchain b/solana/rust-toolchain new file mode 100644 index 00000000..48511633 --- /dev/null +++ b/solana/rust-toolchain @@ -0,0 +1,6 @@ +# This version should be kept up to date with the value in +# ci/rust-version.sh in the branch of the solana repo that corresponds +# with the version we're using. +[toolchain] +channel = "nightly-2022-02-24" +profile = "minimal" \ No newline at end of file diff --git a/solana/solitaire/Cargo.lock b/solana/solitaire/Cargo.lock deleted file mode 100644 index f0fc7dca..00000000 --- a/solana/solitaire/Cargo.lock +++ /dev/null @@ -1,1526 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.6", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "assert_matches" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitmaps" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -dependencies = [ - "typenum", -] - -[[package]] -name = "blake3" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "digest 0.10.3", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding", - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive", - "hashbrown", -] - -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate", - "proc-macro2", - "syn", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" - -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - -[[package]] -name = "bytemuck" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" -dependencies = [ - "cfg-if", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" -dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" -dependencies = [ - "cfg-if", - "lazy_static", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "derivation-path" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle", -] - -[[package]] -name = "ed25519" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cb2103c580a9f8732121f755eccb51312f7db26314664314c119298107064b" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek", - "ed25519", - "rand", - "serde", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "ed25519-dalek-bip32" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2be62a4061b872c8c0873ee4fc6f101ce7b889d039f019c5fa2af471a59908" -dependencies = [ - "derivation-path", - "ed25519-dalek", - "hmac 0.12.1", - "sha2 0.10.2", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "serde", - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.10.2+wasi-snapshot-preview1", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[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" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.3", -] - -[[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", - "hmac 0.8.1", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "im" -version = "15.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" -dependencies = [ - "bitmaps", - "rand_core 0.6.3", - "rand_xoshiro", - "rayon", - "serde", - "sized-chunks", - "typenum", - "version_check", -] - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "js-sys" -version = "0.3.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.125" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" - -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand", - "serde", - "sha2 0.9.9", - "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 = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "once_cell" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - -[[package]] -name = "pbkdf2" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7" -dependencies = [ - "digest 0.10.3", -] - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "qstring" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "quote" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_xoshiro" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" -dependencies = [ - "rand_core 0.6.3", -] - -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - -[[package]] -name = "rocksalt" -version = "0.1.0" -dependencies = [ - "byteorder", - "proc-macro2", - "quote", - "sha3 0.9.1", - "solana-program", - "syn", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustversion" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" - -[[package]] -name = "serde" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.3", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - -[[package]] -name = "sha3" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881bf8156c87b6301fc5ca6b27f11eeb2761224c7081e69b409d5a1951a70c86" -dependencies = [ - "digest 0.10.3", - "keccak", -] - -[[package]] -name = "signature" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" - -[[package]] -name = "sized-chunks" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" -dependencies = [ - "bitmaps", - "typenum", -] - -[[package]] -name = "smallvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" - -[[package]] -name = "solana-frozen-abi" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7dd1cefedcc43251a0618c902b8a5ce7ae6c2a5103264633a65b1b40b6ba259" -dependencies = [ - "bs58", - "bv", - "generic-array", - "im", - "lazy_static", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.2", - "solana-frozen-abi-macro", - "thiserror", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c61a1bb5dd9ac1b8f6b4fd276ea4833822668e791f74ae8c45dd792167f4" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "solana-logger" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb5aee1180cc4baa90a25ac4e62897571675f59b3df2948bf4e17f904636fc9" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - -[[package]] -name = "solana-program" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9452f34caedc50eeb0752c5f9ea7992ec8f618c2041acbbd455e70186f362d51" -dependencies = [ - "base64 0.13.0", - "bincode", - "bitflags", - "blake3", - "borsh", - "borsh-derive", - "bs58", - "bv", - "bytemuck", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "num-derive", - "num-traits", - "parking_lot", - "rand", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.2", - "sha3 0.10.1", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-sdk-macro", - "thiserror", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd83ce2d96b259233e698623c83431c5c9a1dccbc12b7dfcdbc500a0946ea516" -dependencies = [ - "assert_matches", - "base64 0.13.0", - "bincode", - "bitflags", - "borsh", - "bs58", - "bytemuck", - "byteorder", - "chrono", - "derivation-path", - "digest 0.10.3", - "ed25519-dalek", - "ed25519-dalek-bip32", - "generic-array", - "hmac 0.12.1", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "memmap2", - "num-derive", - "num-traits", - "pbkdf2", - "qstring", - "rand", - "rand_chacha", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "serde_json", - "sha2 0.10.2", - "sha3 0.10.1", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-program", - "solana-sdk-macro", - "thiserror", - "uriparse", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk-macro" -version = "1.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee7e7c63938c587870f33bd6b81a9c2913773009802ba3eed57116e9f24694a" -dependencies = [ - "bs58", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "solitaire" -version = "0.1.0" -dependencies = [ - "borsh", - "byteorder", - "rocksalt", - "sha3 0.9.1", - "solana-program", -] - -[[package]] -name = "solitaire-client" -version = "0.1.0" -dependencies = [ - "borsh", - "solana-program", - "solana-sdk", - "solitaire", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "unicode-xid" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" - -[[package]] -name = "uriparse" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200d0fc04d809396c2ad43f3c95da3582a2556eba8d453c1087f4120ee352ff" -dependencies = [ - "fnv", - "lazy_static", -] - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "wasm-bindgen" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" - -[[package]] -name = "web-sys" -version = "0.3.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] diff --git a/solana/solitaire/Cargo.toml b/solana/solitaire/Cargo.toml deleted file mode 100644 index 5d641a5d..00000000 --- a/solana/solitaire/Cargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[workspace] -members = ["rocksalt", "program", "client"] \ No newline at end of file diff --git a/solana/solitaire/client/Cargo.toml b/solana/solitaire/client/Cargo.toml deleted file mode 100644 index 5a09612d..00000000 --- a/solana/solitaire/client/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "solitaire-client" -version = "0.1.0" -edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -solana-sdk = "=1.10.13" -solana-program = "=1.10.13" -solitaire = {path = "../program", features = ["no-entrypoint"]} -borsh = "=0.9.3" diff --git a/solana/solitaire/client/src/lib.rs b/solana/solitaire/client/src/lib.rs deleted file mode 100644 index a7c9c014..00000000 --- a/solana/solitaire/client/src/lib.rs +++ /dev/null @@ -1,227 +0,0 @@ - -#![feature(adt_const_params)] -#![feature(const_generics_defaults)] -#![allow(warnings)] - -//! Client-specific code - -pub use solana_program::pubkey::Pubkey; -use solana_program::sysvar::Sysvar as SolSysvar; -pub use solana_sdk; - -pub use solana_sdk::{ - instruction::{ - AccountMeta, - Instruction, - }, - signature::{ - Keypair, - Signer as SolSigner, - }, -}; - -use borsh::BorshSerialize; - -pub use solitaire::{ - processors::seeded::Seeded, - Data, - Derive, - Keyed, - Owned, - Signer, -}; -use solitaire::{ - AccountState, - Info, - Mut, - Sysvar, -}; - -type StdResult = std::result::Result; - -pub type ErrBox = Box; - -/// The sum type for clearly specifying the accounts required on client side. -#[derive(Debug)] -pub enum AccEntry { - /// Least privileged account. - Unprivileged(Pubkey), - /// Least privileged account, read-only. - UnprivilegedRO(Pubkey), - - /// Accounts that need to sign a Solana call - Signer(Keypair), - /// Accounts that need to sign a Solana call, read-only. - SignerRO(Keypair), - - /// Program addresses for unprivileged cross calls - CPIProgram(Pubkey), - /// Program addresses for privileged cross calls - CPIProgramSigner(Keypair), - - /// Key decided from SPL constants - Sysvar(Pubkey), - - /// Key derived from constants and/or program address - Derived(Pubkey), - /// Key derived from constants and/or program address, read-only. - DerivedRO(Pubkey), - - /// Empty value for nullables - Empty, -} - -/// Types implementing Wrap are those that can be turned into a -/// partial account vector for a program call. -pub trait Wrap { - fn wrap(_: &AccEntry) -> StdResult, ErrBox>; - - /// If the implementor wants to sign using other AccEntry - /// variants, they should override this. - fn keypair(a: AccEntry) -> Option { - use AccEntry::*; - match a { - Signer(pair) => Some(pair), - SignerRO(pair) => Some(pair), - _other => None, - } - } -} - -impl Wrap for Option { - fn wrap(a: &AccEntry) -> StdResult, ErrBox> { - match a { - AccEntry::Empty => Ok(vec![AccountMeta::new_readonly(Pubkey::new_from_array([0u8; 32]), false)]), - other => T::wrap(other) - } - } -} - -impl<'a, 'b: 'a, T> Wrap for Signer -where - T: Keyed<'a, 'b>, -{ - fn wrap(a: &AccEntry) -> StdResult, ErrBox> { - use AccEntry::*; - match a { - Signer(pair) => Ok(vec![AccountMeta::new(pair.pubkey(), true)]), - SignerRO(pair) => Ok(vec![AccountMeta::new_readonly(pair.pubkey(), true)]), - other => Err(format!( - "{} must be passed as Signer or SignerRO", - std::any::type_name::() - ) - .into()), - } - } -} - -impl<'a, 'b: 'a, T, const Seed: &'static str> Wrap for Derive { - fn wrap(a: &AccEntry) -> StdResult, ErrBox> { - match a { - AccEntry::Derived(program_id) => { - let k = Self::key(None, program_id); - - Ok(vec![AccountMeta::new(k, false)]) - } - AccEntry::DerivedRO(program_id) => { - let k = Self::key(None, program_id); - - Ok(vec![AccountMeta::new_readonly(k, false)]) - } - other => Err(format!( - "{} must be passed as Derived or DerivedRO", - std::any::type_name::() - ) - .into()), - } - } -} - -impl<'a, T, const IsInitialized: AccountState> Wrap for Data<'a, T, IsInitialized> -where - T: BorshSerialize + Owned + Default, -{ - fn wrap(a: &AccEntry) -> StdResult, ErrBox> { - use AccEntry::*; - use AccountState::*; - match IsInitialized { - Initialized => match a { - Unprivileged(k) => Ok(vec![AccountMeta::new(*k, false)]), - UnprivilegedRO(k) => Ok(vec![AccountMeta::new_readonly(*k, false)]), - Signer(pair) => Ok(vec![AccountMeta::new(pair.pubkey(), true)]), - SignerRO(pair) => Ok(vec![AccountMeta::new_readonly(pair.pubkey(), true)]), - _other => Err(format!("{} with IsInitialized = {:?} must be passed as Unprivileged, Signer or the respective read-only variant", std::any::type_name::(), a).into()) - }, - Uninitialized => match a { - Unprivileged(k) => Ok(vec![AccountMeta::new(*k, false)]), - Signer(pair) => Ok(vec![AccountMeta::new(pair.pubkey(), true)]), - _other => Err(format!("{} with IsInitialized = {:?} must be passed as Unprivileged or Signer (write access required for initialization)", std::any::type_name::(), a).into()) - } - MaybeInitialized => match a { - Unprivileged(k) => Ok(vec![AccountMeta::new(*k, false)]), - Signer(pair) => Ok(vec![AccountMeta::new(pair.pubkey(), true)]), - _other => Err(format!("{} with IsInitialized = {:?} must be passed as Unprivileged or Signer (write access required in case of initialization)", std::any::type_name::(), a).into()) - } - } - } -} - -impl<'b, Var> Wrap for Sysvar<'b, Var> -where - Var: SolSysvar, -{ - fn wrap(a: &AccEntry) -> StdResult, ErrBox> { - if let AccEntry::Sysvar(k) = a { - if Var::check_id(k) { - Ok(vec![AccountMeta::new_readonly(k.clone(), false)]) - } else { - Err(format!( - "{} does not point at sysvar {}", - k, - std::any::type_name::() - ) - .into()) - } - } else { - Err(format!("{} must be passed as Sysvar", std::any::type_name::()).into()) - } - } -} - -impl<'b> Wrap for Info<'b> { - fn wrap(a: &AccEntry) -> StdResult, ErrBox> { - match a { - AccEntry::UnprivilegedRO(k) => Ok(vec![AccountMeta::new_readonly(k.clone(), false)]), - AccEntry::Unprivileged(k) => Ok(vec![AccountMeta::new(k.clone(), false)]), - _other => Err(format!( - "{} must be passed as Unprivileged or UnprivilegedRO", - std::any::type_name::() - ) - .into()), - } - } -} - -impl Wrap for Mut { - fn wrap(a: &AccEntry) -> StdResult, ErrBox> { - match a { - AccEntry::Unprivileged(_) | AccEntry::Signer(_) | AccEntry::Derived(_) => { - Ok(T::wrap(a)?) - } - _other => Err(format!( - "{} must be passed as Unprivileged, Signer or Derived (Must be mutable on-chain)", - std::any::type_name::() - ) - .into()), - } - } -} - -/// Trait used on client side to easily validate a program accounts + ix_data for a bare Solana call -pub trait ToInstruction { - fn to_ix( - self, - program_id: Pubkey, - ix_data: &[u8], - ) -> StdResult<(Instruction, Vec), ErrBox>; -} diff --git a/solana/solitaire/program/Cargo.toml b/solana/solitaire/program/Cargo.toml deleted file mode 100644 index 55f10db3..00000000 --- a/solana/solitaire/program/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "solitaire" -version = "0.1.0" -description = "Solana program framework" -edition = "2018" - -[lib] -crate-type = ["cdylib", "lib"] -name = "solitaire" - -[features] -client = ["no-entrypoint"] -cpi = ["no-entrypoint"] -default = [] -no-entrypoint = [] -trace = [] - -[dependencies] -borsh = "=0.9.3" -byteorder = "1.4.3" -rocksalt = { path = "../../solitaire/rocksalt" } - -sha3 = "0.9.1" -solana-program = "=1.10.13" diff --git a/solana/solitaire/program/Xargo.toml b/solana/solitaire/program/Xargo.toml deleted file mode 100644 index 1744f098..00000000 --- a/solana/solitaire/program/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] \ No newline at end of file diff --git a/solana/solitaire/program/src/error.rs b/solana/solitaire/program/src/error.rs deleted file mode 100644 index 6341c1d7..00000000 --- a/solana/solitaire/program/src/error.rs +++ /dev/null @@ -1,74 +0,0 @@ -use solana_program::{ - program_error::ProgramError, - pubkey::Pubkey, -}; - -/// Quality of life Result type for the Solitaire stack. -pub type Result = std::result::Result; - -/// Quality of life type alias for wrapping up boxed errors. -pub type ErrBox = Box; - -/// There are several places in Solitaire that might fail, we want descriptive errors. -#[derive(Debug)] -pub enum SolitaireError { - /// The AccountInfo parser expected a mutable key where a readonly - /// was found, or vice versa. Second item is the found value. - InvalidMutability(Pubkey, bool), - - /// The AccountInfo parser expected a Signer, but the account did not sign. - InvalidSigner(Pubkey), - - /// The AccountInfo parser expected a Sysvar, but the key was invalid. - InvalidSysvar(Pubkey), - - /// The AccountInfo parser tried to derive the provided key, but it did not match. - InvalidDerive(Pubkey, Pubkey), - - /// The AccountInfo has an invalid owner. - InvalidOwner(Pubkey), - - /// The AccountInfo is non-writeable where a writeable key was expected. - NonWriteableAccount(Pubkey), - - /// The instruction payload itself could not be deserialized. - InstructionDeserializeFailed(std::io::Error), - - /// An IO error was captured, wrap it up and forward it along. - IoError(std::io::Error), - - /// An solana program error - ProgramError(ProgramError), - - /// Owner of the account is ambiguous - AmbiguousOwner, - - /// Account has already been initialized - AlreadyInitialized(Pubkey), - - /// An instruction that wasn't recognised was sent. - UnknownInstruction(u8), - - Custom(u64), -} - -impl From for SolitaireError { - fn from(e: ProgramError) -> Self { - SolitaireError::ProgramError(e) - } -} - -impl From for SolitaireError { - fn from(e: std::io::Error) -> Self { - SolitaireError::IoError(e) - } -} - -impl Into for SolitaireError { - fn into(self) -> ProgramError { - match self { - SolitaireError::ProgramError(e) => return e, - _ => ProgramError::Custom(0), - } - } -} diff --git a/solana/solitaire/program/src/lib.rs b/solana/solitaire/program/src/lib.rs deleted file mode 100644 index 63854fde..00000000 --- a/solana/solitaire/program/src/lib.rs +++ /dev/null @@ -1,127 +0,0 @@ - -#![feature(adt_const_params)] -#![allow(warnings)] - -pub use rocksalt::*; - -// Lacking: -// -// - Error is a lacking as its just a basic enum, maybe use errorcode. -// - Client generation incomplete. - -// We need a few Solana things in scope in order to properly abstract Solana. -use solana_program::{ - account_info::{ - next_account_info, - AccountInfo, - }, - entrypoint, - entrypoint::ProgramResult, - instruction::{ - AccountMeta, - Instruction, - }, - program::invoke_signed, - program_error::ProgramError, - program_pack::Pack, - pubkey::Pubkey, - rent::Rent, - system_instruction, - system_program, - sysvar::{ - self, - SysvarId, - }, -}; - -use std::{ - io::{ - ErrorKind, - Write, - }, - marker::PhantomData, - ops::{ - Deref, - DerefMut, - }, - slice::Iter, - string::FromUtf8Error, -}; - -pub use borsh::{ - BorshDeserialize, - BorshSerialize, -}; - -// Expose all submodules for consumption. -pub mod error; -pub mod macros; -pub mod processors; -pub mod types; - -// We can also re-export a set of types at module scope, this defines the intended API we expect -// people to be able to use from top-level. -pub use crate::{ - error::{ - ErrBox, - Result, - SolitaireError, - }, - macros::*, - processors::{ - keyed::Keyed, - peel::Peel, - persist::Persist, - seeded::{ - invoke_seeded, - AccountOwner, - AccountSize, - Creatable, - Owned, - Seeded, - }, - }, - types::*, -}; - -/// Library name and version to print in entrypoint. Must be evaluated in this crate in order to do the right thing -pub const PKG_NAME_VERSION: &'static str = - concat!(env!("CARGO_PKG_NAME"), " ", env!("CARGO_PKG_VERSION")); - -pub struct ExecutionContext<'a, 'b: 'a> { - /// A reference to the program_id of the current program. - pub program_id: &'a Pubkey, - - /// All accounts passed into the program - pub accounts: &'a [AccountInfo<'b>], -} - -/// Lamports to pay to an account being created -pub enum CreationLamports { - Exempt, - Amount(u64), -} - -impl CreationLamports { - /// Amount of lamports to be paid in account creation - pub fn amount(self, size: usize) -> u64 { - match self { - CreationLamports::Exempt => Rent::default().minimum_balance(size), - CreationLamports::Amount(v) => v, - } - } -} - -pub trait InstructionContext<'a> { - fn deps(&self) -> Vec { - vec![] - } -} - -/// Trait definition that describes types that can be constructed from a list of solana account -/// references. A list of dependent accounts is produced as a side effect of the parsing stage. -pub trait FromAccounts<'a, 'b: 'a, 'c> { - fn from(_: &'a Pubkey, _: &'c mut Iter<'a, AccountInfo<'b>>, _: &'a T) -> Result - where - Self: Sized; -} diff --git a/solana/solitaire/program/src/macros.rs b/solana/solitaire/program/src/macros.rs deleted file mode 100644 index cc6df8b0..00000000 --- a/solana/solitaire/program/src/macros.rs +++ /dev/null @@ -1,165 +0,0 @@ -use std::ops::{ - Deref, - DerefMut, -}; - -/// A wrapper around Solana's `msg!` macro that is a no-op by default, allows for adding traces -/// through the application that can be toggled during tests. -#[macro_export] -macro_rules! trace { - ( $($arg:tt)* ) => { $crate::trace_impl!( $($arg)* ) }; -} - -#[cfg(feature = "trace")] -#[macro_export] -macro_rules! trace_impl { - ( $($arg:tt)* ) => { solana_program::msg!( $($arg)* ) }; -} - -#[cfg(not(feature = "trace"))] -#[macro_export] -macro_rules! trace_impl { - ( $($arg:tt)* ) => {}; -} - -/// This is our main codegen macro. It takes as input a list of enum-like variants mapping field -/// types to function calls. The generated code produces: -/// -/// - An `Instruction` enum with the enum variants passed in. -/// - A set of functions which take as arguments the enum fields. -/// - A Dispatcher that deserializes bytes into the enum and dispatches the function call. -/// - A set of client calls scoped to the module `api` that can generate instructions. -#[macro_export] -macro_rules! solitaire { - { $($row:ident($kind:ty) => $fn:ident),+ $(,)* } => { - pub mod instruction { - use super::*; - use borsh::{ - BorshDeserialize, - BorshSerialize, - }; - use solana_program::{ - account_info::AccountInfo, - entrypoint::ProgramResult, - program_error::ProgramError, - pubkey::Pubkey, - }; - use solitaire::{ - trace, - ExecutionContext, - FromAccounts, - Persist, - Result, - SolitaireError, - }; - - $( - // Generated module wrapping instruction handler. - // - // These are needed to force the compiler to generate a new function that has not - // been inlined, this provides a new stack frame. Without this, the stack frame for - // deserialization and the handler is the same as that used by solitaire, leading - // to bust stacks. - #[allow(non_snake_case)] - pub mod $row { - use super::*; - - #[inline(never)] - pub fn execute<'a, 'b: 'a, 'c>(p: &Pubkey, a: &'c [AccountInfo<'b>], d: &[u8]) -> Result<()> { - let ix_data: $kind = BorshDeserialize::try_from_slice(d).map_err(|e| SolitaireError::InstructionDeserializeFailed(e))?; - let mut accounts = FromAccounts::from(p, &mut a.iter(), &())?; - $fn(&ExecutionContext{program_id: p, accounts: a}, &mut accounts, ix_data)?; - Persist::persist(&accounts, p)?; - Ok(()) - } - } - )* - - /// Generated: - /// This Instruction contains a 1-1 mapping for each enum variant to function call. The - /// function calls can be found below in the `api` module. - #[repr(u8)] - #[derive(BorshSerialize, BorshDeserialize)] - pub enum Instruction { - $($row,)* - } - - /// This entrypoint is generated from the enum above, it deserializes incoming bytes - /// and automatically dispatches to the correct method. - pub fn dispatch<'a, 'b: 'a, 'c>(p: &Pubkey, a: &'c [AccountInfo<'b>], d: &[u8]) -> Result<()> { - match d[0] { - $( - n if n == Instruction::$row as u8 => $row::execute(p, a, &d[1..]), - )* - - other => { - Err(SolitaireError::UnknownInstruction(other)) - } - } - } - - pub fn solitaire(p: &Pubkey, a: &[AccountInfo], d: &[u8]) -> ProgramResult { - trace!("{} {} built with {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"), solitaire::PKG_NAME_VERSION); - if let Err(err) = dispatch(p, a, d) { - solana_program::msg!("Error: {:?}", err); - return Err(err.into()); - } - Ok(()) - } - } - - pub use instruction::solitaire; - #[cfg(not(feature = "no-entrypoint"))] - solana_program::entrypoint!(solitaire); - } -} - -#[macro_export] -macro_rules! pack_type { - ($name:ident, $embed:ty, $owner:expr) => { - #[repr(transparent)] - pub struct $name(pub $embed); - - impl BorshDeserialize for $name { - fn deserialize(buf: &mut &[u8]) -> std::io::Result { - let acc = $name( - solana_program::program_pack::Pack::unpack(buf) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?, - ); - // We need to clear the buf to show to Borsh that we've read all data - *buf = &buf[..0]; - - Ok(acc) - } - } - - impl BorshSerialize for $name { - fn serialize(&self, writer: &mut W) -> std::io::Result<()> { - let mut data = [0u8; <$embed as solana_program::program_pack::Pack>::LEN]; - solana_program::program_pack::Pack::pack_into_slice(&self.0, &mut data); - writer.write(&data)?; - - Ok(()) - } - } - - impl solitaire::processors::seeded::Owned for $name { - fn owner(&self) -> solitaire::processors::seeded::AccountOwner { - return $owner; - } - } - - impl std::ops::Deref for $name { - type Target = $embed; - fn deref(&self) -> &Self::Target { - unsafe { std::mem::transmute(&self.0) } - } - } - - impl std::default::Default for $name { - fn default() -> Self { - $name(<$embed>::default()) - } - } - }; -} diff --git a/solana/solitaire/program/src/processors.rs b/solana/solitaire/program/src/processors.rs deleted file mode 100644 index fb5b2477..00000000 --- a/solana/solitaire/program/src/processors.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod keyed; -pub mod peel; -pub mod persist; -pub mod seeded; diff --git a/solana/solitaire/program/src/processors/keyed.rs b/solana/solitaire/program/src/processors/keyed.rs deleted file mode 100644 index 6ff66026..00000000 --- a/solana/solitaire/program/src/processors/keyed.rs +++ /dev/null @@ -1,76 +0,0 @@ -use solana_program::{ - pubkey::Pubkey, - sysvar::Sysvar as SolanaSysvar, -}; - -use crate::{ - processors::seeded::Owned, - AccountState, - Data, - Derive, - Info, - Mut, - Signer, - System, - Sysvar, -}; - -pub trait Keyed<'a, 'b: 'a> { - fn info(&'a self) -> &Info<'b>; -} - -impl<'a, 'b: 'a, T: Owned + Default, const IsInitialized: AccountState> Keyed<'a, 'b> - for Data<'b, T, IsInitialized> -{ - fn info(&'a self) -> &'a Info<'b> { - &self.0 - } -} - -impl<'a, 'b: 'a, T> Keyed<'a, 'b> for Signer -where - T: Keyed<'a, 'b>, -{ - fn info(&'a self) -> &'a Info<'b> { - self.0.info() - } -} - -impl<'a, 'b: 'a, Var: SolanaSysvar> Keyed<'a, 'b> for Sysvar<'b, Var> { - fn info(&'a self) -> &'a Info<'b> { - &self.0 - } -} - -impl<'a, 'b: 'a, T> Keyed<'a, 'b> for System -where - T: Keyed<'a, 'b>, -{ - fn info(&'a self) -> &'a Info<'b> { - self.0.info() - } -} - -impl<'a, 'b: 'a, T, const Seed: &'static str> Keyed<'a, 'b> for Derive -where - T: Keyed<'a, 'b>, -{ - fn info(&'a self) -> &'a Info<'b> { - self.0.info() - } -} - -impl<'a, 'b: 'a, T> Keyed<'a, 'b> for Mut -where - T: Keyed<'a, 'b>, -{ - fn info(&'a self) -> &'a Info<'b> { - self.0.info() - } -} - -impl<'a, 'b: 'a> Keyed<'a, 'b> for Info<'b> { - fn info(&'a self) -> &'a Info<'b> { - self - } -} diff --git a/solana/solitaire/program/src/processors/peel.rs b/solana/solitaire/program/src/processors/peel.rs deleted file mode 100644 index 263700ed..00000000 --- a/solana/solitaire/program/src/processors/peel.rs +++ /dev/null @@ -1,288 +0,0 @@ -//! Peeling. -//! -//! The accounts in Solitaire programs are defined via layers of types, when each layer is peeled -//! off it performs checks, parsing, and any other desired side-effect. The mechanism for this is -//! the peel trait, which defines a set of types that recursively construct the desired type. - -use borsh::BorshDeserialize; -use solana_program::{ - pubkey::Pubkey, - system_program, - sysvar::{ - self, - Sysvar as SolanaSysvar, - SysvarId, - }, -}; -use std::marker::PhantomData; - -use crate::{ - trace, - processors::seeded::{ - AccountOwner, - Owned, - }, - types::*, - AccountState::MaybeInitialized, - Context, - Result, - SolitaireError, -}; -use borsh::BorshSerialize; - -/// Generic Peel trait. This provides a way to describe what each "peeled" -/// layer of our constraints should check. -pub trait Peel<'a, 'b: 'a, 'c> { - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result - where - Self: Sized; - - fn deps() -> Vec; - - fn persist(&self, program_id: &Pubkey) -> Result<()>; -} - -/// Peel a nullable value (0-account means None) -impl<'a, 'b: 'a, 'c, T: Peel<'a, 'b, 'c>> Peel<'a, 'b, 'c> for Option { - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - // Check for 0-account - if ctx.info().key == &Pubkey::new_from_array([0u8; 32]) { - trace!(&format!("Peeled {} is None, returning", std::any::type_name::>())); - Ok(None) - } else { - Ok(Some(T::peel(ctx)?)) - } - } - - fn deps() -> Vec { - T::deps() - } - - fn persist(&self, program_id: &Pubkey) -> Result<()> { - if let Some(s) = self.as_ref() { - T::persist(s, program_id) - } else { - trace!(&format!("Peeled {} is None, not persisting", std::any::type_name::>())); - Ok(()) - } - } -} - -/// Peel a Derived Key -impl<'a, 'b: 'a, 'c, T: Peel<'a, 'b, 'c>, const Seed: &'static str> Peel<'a, 'b, 'c> - for Derive -{ - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - // Attempt to Derive Seed - let (derived, bump) = Pubkey::find_program_address(&[Seed.as_ref()], ctx.this); - match derived == *ctx.info().key { - true => T::peel(ctx).map(|v| Derive(v)), - _ => Err(SolitaireError::InvalidDerive(*ctx.info().key, derived).into()), - } - } - - fn deps() -> Vec { - T::deps() - } - - fn persist(&self, program_id: &Pubkey) -> Result<()> { - T::persist(self, program_id) - } -} - -/// Peel a Mutable key. -impl<'a, 'b: 'a, 'c, T: Peel<'a, 'b, 'c>> Peel<'a, 'b, 'c> for Mut { - fn peel(mut ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - ctx.immutable = false; - match ctx.info().is_writable { - true => T::peel(ctx).map(|v| Mut(v)), - _ => Err( - SolitaireError::InvalidMutability(*ctx.info().key, ctx.info().is_writable).into(), - ), - } - } - - fn deps() -> Vec { - T::deps() - } - - fn persist(&self, program_id: &Pubkey) -> Result<()> { - T::persist(self, program_id) - } -} - -impl<'a, 'b: 'a, 'c, T: Peel<'a, 'b, 'c>> Peel<'a, 'b, 'c> for MaybeMut { - fn peel(mut ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - ctx.immutable = !ctx.info().is_writable; - T::peel(ctx).map(|v| MaybeMut(v)) - } - - fn deps() -> Vec { - T::deps() - } - - fn persist(&self, program_id: &Pubkey) -> Result<()> { - T::persist(self, program_id) - } -} - -/// Peel a Signer. -impl<'a, 'b: 'a, 'c, T: Peel<'a, 'b, 'c>> Peel<'a, 'b, 'c> for Signer { - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - match ctx.info().is_signer { - true => T::peel(ctx).map(|v| Signer(v)), - _ => Err(SolitaireError::InvalidSigner(*ctx.info().key).into()), - } - } - - fn deps() -> Vec { - T::deps() - } - - fn persist(&self, program_id: &Pubkey) -> Result<()> { - T::persist(self, program_id) - } -} - -/// Expicitly depend upon the System account. -impl<'a, 'b: 'a, 'c, T: Peel<'a, 'b, 'c>> Peel<'a, 'b, 'c> for System { - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - match true { - true => T::peel(ctx).map(|v| System(v)), - _ => panic!(), - } - } - - fn deps() -> Vec { - T::deps() - } - - fn persist(&self, program_id: &Pubkey) -> Result<()> { - T::persist(self, program_id) - } -} - -/// Peel a Sysvar -impl<'a, 'b: 'a, 'c, Var> Peel<'a, 'b, 'c> for Sysvar<'b, Var> -where - Var: SolanaSysvar, -{ - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - match Var::check_id(ctx.info().key) { - true => Ok(Sysvar( - ctx.info().clone(), - Var::from_account_info(ctx.info())?, - )), - _ => Err(SolitaireError::InvalidSysvar(*ctx.info().key).into()), - } - } - - fn deps() -> Vec { - vec![] - } - - fn persist(&self, _program_id: &Pubkey) -> Result<()> { - Ok(()) - } -} - -/// This is our structural recursion base case, the trait system will stop generating new nested -/// calls here. -impl<'a, 'b: 'a, 'c> Peel<'a, 'b, 'c> for Info<'b> { - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - if ctx.immutable && ctx.info().is_writable { - return Err( - SolitaireError::InvalidMutability(*ctx.info().key, ctx.info().is_writable).into(), - ); - } - - Ok(ctx.info().clone()) - } - fn deps() -> Vec { - vec![] - } - fn persist(&self, _program_id: &Pubkey) -> Result<()> { - Ok(()) - } -} - -/// This is our structural recursion base case, the trait system will stop generating new nested -/// calls here. -impl< - 'a, - 'b: 'a, - 'c, - T: BorshDeserialize + BorshSerialize + Owned + Default, - const IsInitialized: AccountState, - > Peel<'a, 'b, 'c> for Data<'b, T, IsInitialized> -{ - fn peel(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result { - if ctx.immutable && ctx.info().is_writable { - return Err( - SolitaireError::InvalidMutability(*ctx.info().key, ctx.info().is_writable).into(), - ); - } - - // If we're initializing the type, we should emit system/rent as deps. - let (initialized, data): (bool, T) = match IsInitialized { - AccountState::Uninitialized => { - if **ctx.info().lamports.borrow() != 0 { - return Err(SolitaireError::AlreadyInitialized(*ctx.info().key)); - } - (false, T::default()) - } - AccountState::Initialized => { - (true, T::try_from_slice(&mut *ctx.info().data.borrow_mut())?) - } - AccountState::MaybeInitialized => { - if **ctx.info().lamports.borrow() == 0 { - (false, T::default()) - } else { - (true, T::try_from_slice(&mut *ctx.info().data.borrow_mut())?) - } - } - }; - - if initialized { - match data.owner() { - AccountOwner::This => { - if ctx.info().owner != ctx.this { - return Err(SolitaireError::InvalidOwner(*ctx.info().owner)); - } - } - AccountOwner::Other(v) => { - if *ctx.info().owner != v { - return Err(SolitaireError::InvalidOwner(*ctx.info().owner)); - } - } - AccountOwner::Any => {} - }; - } - - Ok(Data(Box::new(ctx.info().clone()), data)) - } - - fn deps() -> Vec { - if IsInitialized == AccountState::Initialized { - return vec![]; - } - - vec![sysvar::rent::ID, system_program::ID] - } - - fn persist(&self, program_id: &Pubkey) -> Result<()> { - // TODO: Introduce Mut<> to solve the check we really want to make here. - if self.0.owner != program_id { - return Ok(()); - } - - // It is also a malformed program to attempt to write to a non-writeable account. - if !self.0.is_writable { - return Ok(()); - } - - self.1.serialize(&mut *self.0.data.borrow_mut())?; - - Ok(()) - } -} diff --git a/solana/solitaire/program/src/processors/persist.rs b/solana/solitaire/program/src/processors/persist.rs deleted file mode 100644 index 47e674f8..00000000 --- a/solana/solitaire/program/src/processors/persist.rs +++ /dev/null @@ -1,5 +0,0 @@ -use solana_program::pubkey::Pubkey; - -pub trait Persist { - fn persist(&self, program_id: &Pubkey) -> crate::Result<()>; -} diff --git a/solana/solitaire/program/src/processors/seeded.rs b/solana/solitaire/program/src/processors/seeded.rs deleted file mode 100644 index a10bb879..00000000 --- a/solana/solitaire/program/src/processors/seeded.rs +++ /dev/null @@ -1,169 +0,0 @@ -use super::keyed::Keyed; -use crate::{ - system_instruction, - AccountInfo, - AccountState, - CreationLamports, - Data, - Deref, - Derive, - ExecutionContext, - FromAccounts, - Info, - Peel, - Result, - Signer, - SolitaireError, - System, - Sysvar, -}; -use borsh::{ - BorshSchema, - BorshSerialize, -}; -use solana_program::{ - entrypoint::ProgramResult, - instruction::Instruction, - msg, - program::invoke_signed, - pubkey::Pubkey, -}; - -pub trait AccountSize { - fn size(&self) -> usize; -} - -pub enum AccountOwner { - This, - Other(Pubkey), - Any, -} - -pub trait Owned { - fn owner(&self) -> AccountOwner; - - fn owner_pubkey(&self, program_id: &Pubkey) -> Result { - match self.owner() { - AccountOwner::This => Ok(*program_id), - AccountOwner::Other(v) => Ok(v), - AccountOwner::Any => Err(SolitaireError::AmbiguousOwner), - } - } -} - -impl<'a, T: Owned + Default, const IsInitialized: AccountState> Owned - for Data<'a, T, IsInitialized> -{ - fn owner(&self) -> AccountOwner { - self.1.owner() - } -} - -pub trait Seeded { - fn seeds(accs: I) -> Vec>; - - fn self_seeds(&self, accs: I) -> Vec> { - Self::seeds(accs) - } - - fn key(accs: I, program_id: &Pubkey) -> Pubkey { - let mut seeds = Self::seeds(accs); - let mut s: Vec<&[u8]> = seeds.iter().map(|item| item.as_slice()).collect(); - let mut seed_slice = s.as_slice(); - let (addr, _) = Pubkey::find_program_address(seed_slice, program_id); - - addr - } - - fn bumped_seeds(accs: I, program_id: &Pubkey) -> Vec> { - let mut seeds = Self::seeds(accs); - let mut s: Vec<&[u8]> = seeds.iter().map(|item| item.as_slice()).collect(); - let mut seed_slice = s.as_slice(); - let (_, bump_seed) = Pubkey::find_program_address(seed_slice, program_id); - seeds.push(vec![bump_seed]); - - seeds - } - - fn self_bumped_seeds(&self, accs: I, program_id: &Pubkey) -> Vec> { - Self::bumped_seeds(accs, program_id) - } - - fn verify_derivation<'a, 'b: 'a>(&'a self, program_id: &'a Pubkey, accs: I) -> Result<()> - where - Self: Keyed<'a, 'b>, - { - let seeds = Self::seeds(accs); - let s: Vec<&[u8]> = seeds.iter().map(|item| item.as_slice()).collect(); - let seed_slice = s.as_slice(); - - let (derived, bump) = Pubkey::find_program_address(seed_slice, program_id); - if &derived == self.info().key { - Ok(()) - } else { - Err(SolitaireError::InvalidDerive(*self.info().key, derived)) - } - } -} - -pub trait Creatable<'a, I> { - fn create( - &'a self, - accs: I, - ctx: &'a ExecutionContext, - payer: &'a Pubkey, - lamports: CreationLamports, - ) -> Result<()>; -} - -impl AccountSize - for Data<'_, T, IsInitialized> -{ - fn size(&self) -> usize { - self.1.try_to_vec().unwrap().len() - } -} - -impl<'a, 'b: 'a, K, T: AccountSize + Seeded + Keyed<'a, 'b> + Owned> Creatable<'a, K> for T { - fn create( - &'a self, - accs: K, - ctx: &'a ExecutionContext<'_, '_>, - payer: &'a Pubkey, - lamports: CreationLamports, - ) -> Result<()> { - let seeds = T::bumped_seeds(accs, ctx.program_id); - let size = self.size(); - - let mut s: Vec<&[u8]> = seeds.iter().map(|item| item.as_slice()).collect(); - let mut seed_slice = s.as_slice(); - - let ix = system_instruction::create_account( - payer, - self.info().key, - lamports.amount(size), - size as u64, - &self.owner_pubkey(ctx.program_id)?, - ); - - Ok(invoke_signed(&ix, ctx.accounts, &[seed_slice])?) - } -} - -impl<'a, const Seed: &'static str, T> Seeded> for Derive { - fn seeds(accs: Option<()>) -> Vec> { - vec![Seed.as_bytes().to_vec()] - } -} - -pub fn invoke_seeded>( - instruction: &Instruction, - context: &ExecutionContext, - seeded_acc: &T, - accs: I, -) -> ProgramResult { - let seeds = seeded_acc.self_bumped_seeds(accs, context.program_id); - let s: Vec<&[u8]> = seeds.iter().map(|item| item.as_slice()).collect(); - let seed_slice = s.as_slice(); - invoke_signed(instruction, context.accounts, &[seed_slice]) -} diff --git a/solana/solitaire/program/src/types.rs b/solana/solitaire/program/src/types.rs deleted file mode 100644 index 98f59726..00000000 --- a/solana/solitaire/program/src/types.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod accounts; -mod context; -mod layers; - -pub use accounts::*; -pub use context::*; -pub use layers::*; diff --git a/solana/solitaire/program/src/types/accounts.rs b/solana/solitaire/program/src/types/accounts.rs deleted file mode 100644 index 0370616f..00000000 --- a/solana/solitaire/program/src/types/accounts.rs +++ /dev/null @@ -1,128 +0,0 @@ -//! Accounts. -//! -//! Solana provides a single primitive `AccountInfo` that represents an account on Solana. It -//! provides no information about what the account means however. This file provides a set of -//! types that describe different kinds of accounts to target. - -use borsh::BorshSerialize; -use solana_program::{ - account_info::AccountInfo, - program::invoke_signed, - pubkey::Pubkey, - system_instruction, - sysvar::Sysvar as SolanaSysvar, -}; -use std::ops::{ - Deref, - DerefMut, -}; - -use crate::{ - processors::seeded::Owned, - CreationLamports, - Derive, - ExecutionContext, - Result, -}; - -/// A short alias for AccountInfo. -pub type Info<'r> = AccountInfo<'r>; - -#[derive(Debug, Eq, PartialEq)] -pub enum AccountState { - Initialized, - Uninitialized, - MaybeInitialized, -} - -/// An account that is known to contain serialized data. -/// -/// Note on const generics: -/// -/// Solana's Rust version is JUST old enough that it cannot use constant variables in its default -/// parameter assignments. But these DO work in the consumption side so a user can still happily -/// use this type by writing for example: -/// -/// Data<(), { AccountState::Uninitialized }> -#[rustfmt::skip] -pub struct Data<'r, T: Owned + Default, const IsInitialized: AccountState> ( - pub Box>, - pub T, -); - -impl<'r, T: Owned + Default, const IsInitialized: AccountState> Deref - for Data<'r, T, IsInitialized> -{ - type Target = T; - fn deref(&self) -> &Self::Target { - &self.1 - } -} - -impl<'r, T: Owned + Default, const IsInitialized: AccountState> DerefMut - for Data<'r, T, IsInitialized> -{ - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.1 - } -} - -impl<'r, T: Owned + Default, const IsInitialized: AccountState> Data<'r, T, IsInitialized> { - /// Is the account already initialized / created - pub fn is_initialized(&self) -> bool { - **self.0.lamports.borrow() != 0 - } -} - -pub struct Sysvar<'b, Var: SolanaSysvar>(pub AccountInfo<'b>, pub Var); - -impl<'b, Var: SolanaSysvar> Deref for Sysvar<'b, Var> { - type Target = Var; - fn deref(&self) -> &Self::Target { - &self.1 - } -} - -impl Derive, Seed> { - pub fn create( - &self, - ctx: &ExecutionContext, - payer: &Pubkey, - lamports: CreationLamports, - space: usize, - owner: &Pubkey, - ) -> Result<()> { - let ix = system_instruction::create_account( - payer, - self.0.key, - lamports.amount(space), - space as u64, - owner, - ); - let (_, bump_seed) = Pubkey::find_program_address(&[Seed.as_bytes()][..], ctx.program_id); - invoke_signed(&ix, ctx.accounts, &[&[Seed.as_bytes(), &[bump_seed]]]).map_err(|e| e.into()) - } -} - -impl - Derive, Seed> -{ - pub fn create( - &self, - ctx: &ExecutionContext, - payer: &Pubkey, - lamports: CreationLamports, - ) -> Result<()> { - // Get serialized struct size - let size = self.0.try_to_vec().unwrap().len(); - let ix = system_instruction::create_account( - payer, - self.0 .0.key, - lamports.amount(size), - size as u64, - ctx.program_id, - ); - let (_, bump_seed) = Pubkey::find_program_address(&[Seed.as_bytes()][..], ctx.program_id); - invoke_signed(&ix, ctx.accounts, &[&[Seed.as_bytes(), &[bump_seed]]]).map_err(|e| e.into()) - } -} diff --git a/solana/solitaire/program/src/types/context.rs b/solana/solitaire/program/src/types/context.rs deleted file mode 100644 index 4908e974..00000000 --- a/solana/solitaire/program/src/types/context.rs +++ /dev/null @@ -1,54 +0,0 @@ -use crate::trace; -use solana_program::{ - account_info::{ - next_account_info, - AccountInfo, - }, - pubkey::Pubkey, -}; -use std::slice::Iter; - -/// The context is threaded through each check. Include anything within this structure that you -/// would like to have access to as each layer of dependency is peeled off. -pub struct Context<'a, 'b: 'a, 'c, T> { - /// A reference to the program_id of the current program. - pub this: &'a Pubkey, - - /// A reference to the instructions account list, one or more keys may be extracted during - /// the peeling process. - pub iter: &'c mut Iter<'a, AccountInfo<'b>>, - - /// Reference to the data passed to the current instruction. - pub data: &'a T, - - /// An optional account info for this Peelable item, some fields may be other structures that - /// do not themselves have an account info associated with the field. - pub info: Option<&'a AccountInfo<'b>>, - - /// Whether to enforce immutability. - pub immutable: bool, -} - -impl<'a, 'b: 'a, 'c, T> Context<'a, 'b, 'c, T> { - pub fn new(program: &'a Pubkey, iter: &'c mut Iter<'a, AccountInfo<'b>>, data: &'a T) -> Self { - Context { - this: program, - info: None, - immutable: true, - iter, - data, - } - } - - pub fn info<'d>(&'d mut self) -> &'a AccountInfo<'b> { - match self.info { - None => { - let info = next_account_info(self.iter).unwrap(); - trace!("{}", info.key); - self.info = Some(info); - info - } - Some(v) => v, - } - } -} diff --git a/solana/solitaire/program/src/types/layers.rs b/solana/solitaire/program/src/types/layers.rs deleted file mode 100644 index 0f9204bb..00000000 --- a/solana/solitaire/program/src/types/layers.rs +++ /dev/null @@ -1,107 +0,0 @@ -//! This file contains several single-field wrapper structs. Each one represents a layer that must -//! be checked in order to parse a Solana account. -//! -//! These structs are always single field (or single + PhantomData) and so can be represented with -//! the transparent repr layout. When each layer is removed the data can be transmuted safely to -//! the layer below, allowing for optimized recursion. - -use std::{ - io::{ - ErrorKind, - Write, - }, - marker::PhantomData, - ops::{ - Deref, - DerefMut, - }, -}; - -use crate::Info; -use borsh::{ - BorshDeserialize, - BorshSerialize, -}; - -#[repr(transparent)] -pub struct Mut(pub Next); - -#[repr(transparent)] -pub struct MaybeMut(pub Next); - -#[repr(transparent)] -pub struct Signer(pub Next); - -#[repr(transparent)] -pub struct System(pub Next); - -#[repr(transparent)] -pub struct Derive(pub Next); - -// Several traits are required for types defined here, they cannot be defined in another file due -// to orphan instance limitations. - -impl Deref for Signer { - type Target = T; - fn deref(&self) -> &Self::Target { - unsafe { std::mem::transmute(&self.0) } - } -} - -impl DerefMut for Signer { - fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { std::mem::transmute(&mut self.0) } - } -} - -impl Deref for Mut { - type Target = T; - fn deref(&self) -> &Self::Target { - unsafe { std::mem::transmute(&self.0) } - } -} - -impl DerefMut for Mut { - fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { std::mem::transmute(&mut self.0) } - } -} - -impl Deref for MaybeMut { - type Target = T; - fn deref(&self) -> &Self::Target { - unsafe { std::mem::transmute(&self.0) } - } -} - -impl DerefMut for MaybeMut { - fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { std::mem::transmute(&mut self.0) } - } -} - -impl Deref for System { - type Target = T; - fn deref(&self) -> &Self::Target { - unsafe { std::mem::transmute(&self.0) } - } -} - -impl DerefMut for System { - fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { std::mem::transmute(&mut self.0) } - } -} - -impl Deref for Derive { - type Target = T; - fn deref(&self) -> &Self::Target { - unsafe { std::mem::transmute(&self.0) } - } -} - -impl DerefMut for Derive { - fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { std::mem::transmute(&mut self.0) } - } -} diff --git a/solana/solitaire/rocksalt/Cargo.toml b/solana/solitaire/rocksalt/Cargo.toml deleted file mode 100644 index 65e75fc5..00000000 --- a/solana/solitaire/rocksalt/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "rocksalt" -version = "0.1.0" -description = "Created with Rocksalt" -edition = "2018" - -[lib] -proc-macro = true -name = "rocksalt" - -[features] -no-entrypoint = [] -default = [] - -[dependencies] -byteorder = "1.4.3" -proc-macro2 = "1.0" -quote = "1.0" -sha3 = "0.9.1" -solana-program = "=1.10.13" -syn = "1.0" diff --git a/solana/solitaire/rocksalt/Xargo.toml b/solana/solitaire/rocksalt/Xargo.toml deleted file mode 100644 index 1744f098..00000000 --- a/solana/solitaire/rocksalt/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] \ No newline at end of file diff --git a/solana/solitaire/rocksalt/src/lib.rs b/solana/solitaire/rocksalt/src/lib.rs deleted file mode 100644 index 9b0f60c4..00000000 --- a/solana/solitaire/rocksalt/src/lib.rs +++ /dev/null @@ -1,286 +0,0 @@ -#![allow(warnings)] - -mod to_instruction; - -use to_instruction::*; - -use solana_program::{ - account_info::AccountInfo, - entrypoint, - entrypoint::ProgramResult, - pubkey::Pubkey, -}; - -use proc_macro::TokenStream; -use proc_macro2::{ - Span, - TokenStream as TokenStream2, -}; -use quote::{ - quote, - quote_spanned, - ToTokens, -}; -use std::borrow::BorrowMut; -use syn::{ - parse_macro_input, - parse_quote, - spanned::Spanned, - Data, - DeriveInput, - Fields, - GenericParam, - Generics, - Index, -}; - -#[proc_macro_derive(ToInstruction)] -pub fn derive_to_instruction(input: TokenStream) -> TokenStream { - let input = parse_macro_input!(input as DeriveInput); - let name = input.ident; - - // Type params of the instruction context account - let type_params: Vec = input - .generics - .type_params() - .map(|v| GenericParam::Type(v.clone())) - .collect(); - - // Generics lifetimes of the peel type - let mut peel_g = input.generics.clone(); - peel_g.params = parse_quote!('a, 'b: 'a, 'c); - let (_, peel_type_g, _) = peel_g.split_for_impl(); - - // Params of the instruction context - let mut type_generics = input.generics.clone(); - type_generics.params = parse_quote!('b); - for x in &type_params { - type_generics.params.push(x.clone()); - } - let (type_impl_g, type_g, _) = type_generics.split_for_impl(); - - // Combined lifetimes of peel and the instruction context - let mut combined_generics = Generics::default(); - combined_generics.params = peel_g.params.clone(); - for x in &type_params { - combined_generics.params.push(x.clone()); - } - let (combined_impl_g, _, _) = combined_generics.split_for_impl(); - - let expanded = generate_to_instruction(&name, &combined_impl_g, &input.data); - TokenStream::from(expanded) -} - -/// Generate a FromAccounts implementation for a product of accounts. Each field is constructed by -/// a call to the Verify::verify instance of its type. -#[proc_macro_derive(FromAccounts)] -pub fn derive_from_accounts(input: TokenStream) -> TokenStream { - let mut input = parse_macro_input!(input as DeriveInput); - let name = input.ident; - - // Type params of the instruction context account - let type_params: Vec = input - .generics - .type_params() - .map(|v| GenericParam::Type(v.clone())) - .collect(); - - // Generics lifetimes of the peel type - let mut peel_g = input.generics.clone(); - peel_g.params = parse_quote!('a, 'b: 'a, 'c); - let (_, peel_type_g, _) = peel_g.split_for_impl(); - - // Params of the instruction context - let mut type_generics = input.generics.clone(); - type_generics.params = parse_quote!('b); - for x in &type_params { - type_generics.params.push(x.clone()); - } - let (type_impl_g, type_g, _) = type_generics.split_for_impl(); - - // Combined lifetimes of peel and the instruction context - let mut combined_generics = Generics::default(); - combined_generics.params = peel_g.params.clone(); - for x in &type_params { - combined_generics.params.push(x.clone()); - } - let (combined_impl_g, _, _) = combined_generics.split_for_impl(); - - let from_method = generate_fields(&name, &input.data); - let persist_method = generate_persist(&name, &input.data); - let deps_method = generate_deps_fields(&name, &input.data); - let expanded = quote! { - /// Macro generated implementation of FromAccounts by Solitaire. - impl #combined_impl_g solitaire::FromAccounts #peel_type_g for #name #type_g { - fn from(pid: &'a solana_program::pubkey::Pubkey, iter: &'c mut std::slice::Iter<'a, solana_program::account_info::AccountInfo<'b>>, data: &'a DataType) -> solitaire::Result { - #from_method - } - } - - impl #combined_impl_g solitaire::Peel<'a, 'b, 'c> for #name #type_g { - fn peel(ctx: &'c mut solitaire::Context<'a, 'b, 'c, I>) -> solitaire::Result where Self: Sized { - let v: #name #type_g = FromAccounts::from(ctx.this, ctx.iter, ctx.data)?; - Ok(v) - } - - fn deps() -> Vec { - #deps_method - } - - fn persist(&self, program_id: &solana_program::pubkey::Pubkey) -> solitaire::Result<()> { - solitaire::Persist::persist(self, program_id) - } - } - - /// Macro generated implementation of Persist by Solitaire. - impl #type_impl_g solitaire::Persist for #name #type_g { - fn persist(&self, program_id: &solana_program::pubkey::Pubkey) -> solitaire::Result<()> { - #persist_method - } - } - }; - - // Hand the output tokens back to the compiler - TokenStream::from(expanded) -} - -/// This function does the heavy lifting of generating the field parsers. -fn generate_fields(name: &syn::Ident, data: &Data) -> TokenStream2 { - match *data { - // We only care about structures. - Data::Struct(ref data) => { - // We want to inspect its fields. - match data.fields { - // For now, we only care about struct { a: T } forms, not struct(T); - Fields::Named(ref fields) => { - // For each field, generate an expression that parses an account info field - // from the Solana accounts list. This relies on Verify::verify to do most of - // the work. - let recurse = fields.named.iter().map(|f| { - // Field name, to assign to. - let name = &f.ident; - let ty = &f.ty; - - quote! { - trace!(stringify!(#name)); - let #name: #ty = solitaire::Peel::peel(&mut solitaire::Context::new( - pid, - iter, - data, - ))?; - } - }); - - let names = fields.named.iter().map(|f| { - let name = &f.ident; - quote!(#name) - }); - - // Write out our iterator and return the filled structure. - quote! { - use solana_program::account_info::next_account_info; - use solitaire::trace; - trace!("Peeling:"); - #(#recurse;)* - Ok(#name { #(#names,)* }) - } - } - - Fields::Unnamed(_) => { - unimplemented!() - } - - Fields::Unit => { - unimplemented!() - } - } - } - - Data::Enum(_) | Data::Union(_) => unimplemented!(), - } -} - -/// This function does the heavy lifting of generating the field parsers. -fn generate_deps_fields(name: &syn::Ident, data: &Data) -> TokenStream2 { - match *data { - // We only care about structures. - Data::Struct(ref data) => { - // We want to inspect its fields. - match data.fields { - // For now, we only care about struct { a: T } forms, not struct(T); - Fields::Named(ref fields) => { - // For each field, generate an expression appends it deps - let recurse = fields.named.iter().map(|f| { - let ty = &f.ty; - quote! { - deps.append(&mut <#ty as Peel>::deps()); - } - }); - - // Write out our iterator and return the filled structure. - quote! { - let mut deps = Vec::new(); - #(#recurse;)* - deps - } - } - - Fields::Unnamed(_) => { - unimplemented!() - } - - Fields::Unit => { - unimplemented!() - } - } - } - - Data::Enum(_) | Data::Union(_) => unimplemented!(), - } -} - -/// This function does the heavy lifting of generating the field parsers. -fn generate_persist(name: &syn::Ident, data: &Data) -> TokenStream2 { - match *data { - // We only care about structures. - Data::Struct(ref data) => { - // We want to inspect its fields. - match data.fields { - // For now, we only care about struct { a: T } forms, not struct(T); - Fields::Named(ref fields) => { - // For each field, generate an expression that parses an account info field - // from the Solana accounts list. This relies on Verify::verify to do most of - // the work. - let recurse = fields.named.iter().map(|f| { - // Field name, to assign to. - let name = &f.ident; - let ty = &f.ty; - - quote! { - trace!(stringify!(#name)); - Peel::persist(&self.#name, program_id)?; - } - }); - - // Write out our iterator and return the filled structure. - quote! { - use solitaire::trace; - trace!("Persisting:"); - #(#recurse;)* - Ok(()) - } - } - - Fields::Unnamed(_) => { - unimplemented!() - } - - Fields::Unit => { - unimplemented!() - } - } - } - - Data::Enum(_) | Data::Union(_) => unimplemented!(), - } -} diff --git a/solana/solitaire/rocksalt/src/to_instruction.rs b/solana/solitaire/rocksalt/src/to_instruction.rs deleted file mode 100644 index a332bcdd..00000000 --- a/solana/solitaire/rocksalt/src/to_instruction.rs +++ /dev/null @@ -1,118 +0,0 @@ -//! Derive macro logic for ToInstruction - -use proc_macro::TokenStream; -use proc_macro2::{ - Span, - TokenStream as TokenStream2, -}; -use quote::{ - quote, - quote_spanned, -}; -use syn::{ - parse_macro_input, - parse_quote, - spanned::Spanned, - Data, - DataStruct, - DeriveInput, - Fields, - GenericParam, - Generics, - Index, -}; - -pub fn generate_to_instruction( - name: &syn::Ident, - impl_generics: &syn::ImplGenerics, - data: &Data, -) -> TokenStream2 { - match *data { - Data::Struct(DataStruct { - fields: Fields::Named(ref fields), - .. - }) => { - let expanded_appends = fields.named.iter().map(|field| { - let name = &field.ident; - let ty = &field.ty; - - quote! { - deps.append(&mut <#ty as solitaire::Peel>::deps()); - account_metas.append(&mut <#ty as solitaire_client::Wrap>::wrap(&self.#name)?); - if let Some(pair) = <#ty as solitaire_client::Wrap>::keypair(self.#name) { - signers.push(pair); - } - } - }); - let client_struct_name = - syn::Ident::new(&format!("{}Accounts", name.to_string()), Span::call_site()); - - let client_struct_decl = generate_clientside_struct(&name, &client_struct_name, &data); - - quote! { - /// Solitaire-generated client-side #name representation - #[cfg(feature = "client")] - #client_struct_decl - - /// Solitaire-generatied ToInstruction implementation - #[cfg(feature = "client")] - impl #impl_generics solitaire_client::ToInstruction for #client_struct_name { - fn to_ix( - self, - program_id: solana_program::pubkey::Pubkey, - ix_data: &[u8]) -> std::result::Result< - (solitaire_client::Instruction, Vec), - solitaire::ErrBox - > { - use solana_program::{pubkey::Pubkey, instruction::Instruction}; - let mut account_metas = Vec::new(); - let mut signers = Vec::new(); - let mut deps = Vec::new(); - - #(#expanded_appends;)* - - // Add dependencies - deps.dedup(); - let mut dep_ams = deps.iter().map(|v| solana_program::instruction::AccountMeta::new_readonly(*v, false)).collect(); - account_metas.append(&mut dep_ams); - - Ok((solana_program::instruction::Instruction::new_with_bytes(program_id, - ix_data, - account_metas), signers)) - - } - - } - } - } - _ => unimplemented!(), - } -} - -pub fn generate_clientside_struct( - name: &syn::Ident, - client_struct_name: &syn::Ident, - data: &Data, -) -> TokenStream2 { - match *data { - Data::Struct(DataStruct { - fields: Fields::Named(ref fields), - .. - }) => { - let expanded_fields = fields.named.iter().map(|field| { - let field_name = &field.ident; - - quote! { - #field_name: solitaire_client::AccEntry - } - }); - - quote! { - pub struct #client_struct_name { - #(pub #expanded_fields,)* - } - } - } - _ => unimplemented!(), - } -} diff --git a/solana/solitaire/rustfmt.toml b/solana/solitaire/rustfmt.toml deleted file mode 100644 index 3b9ff103..00000000 --- a/solana/solitaire/rustfmt.toml +++ /dev/null @@ -1,11 +0,0 @@ -# Merge similar crates together to avoid multiple use statements. -imports_granularity = "Crate" - -# Consistency in formatting makes tool based searching/editing better. -empty_item_single_line = false - -# Easier editing when arbitrary mixed use statements do not collapse. -imports_layout = "Vertical" - -# Default rustfmt formatting of match arms with branches is awful. -match_arm_leading_pipes = "Preserve" diff --git a/third_party/pyth/p2w-sdk/rust/Cargo.lock b/third_party/pyth/p2w-sdk/rust/Cargo.lock index 69052ee8..707dfc2b 100644 --- a/third_party/pyth/p2w-sdk/rust/Cargo.lock +++ b/third_party/pyth/p2w-sdk/rust/Cargo.lock @@ -269,11 +269,10 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ - "autocfg", "cfg-if", "crossbeam-utils", "lazy_static", @@ -559,11 +558,10 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" dependencies = [ - "autocfg", "scopeguard", ] @@ -641,6 +639,7 @@ name = "p2w-sdk" version = "0.1.1" dependencies = [ "hex", + "pyth-sdk", "pyth-sdk-solana", "serde", "solana-program", @@ -826,6 +825,7 @@ dependencies = [ [[package]] name = "rocksalt" version = "0.1.0" +source = "git+https://github.com/certusone/wormhole?tag=v2.8.9#e47f9e481ef84d4dea7a94c9eafbf3b180892466" dependencies = [ "byteorder", "proc-macro2", @@ -1007,9 +1007,9 @@ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "solana-frozen-abi" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7dd1cefedcc43251a0618c902b8a5ce7ae6c2a5103264633a65b1b40b6ba259" +checksum = "68f2b153f8eb8c4d22f2b739d3d31bac4122ca17376869cb717bf3a45200ea63" dependencies = [ "bs58", "bv", @@ -1029,9 +1029,9 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c61a1bb5dd9ac1b8f6b4fd276ea4833822668e791f74ae8c45dd792167f4" +checksum = "0cd23aad847403a28dd1452611490b5e8f040470ed251882cca0492c5e566280" dependencies = [ "proc-macro2", "quote", @@ -1041,9 +1041,9 @@ dependencies = [ [[package]] name = "solana-program" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9452f34caedc50eeb0752c5f9ea7992ec8f618c2041acbbd455e70186f362d51" +checksum = "37be82a1fe85b24aa036153650053fd9628489c07c834b6b2dc027c4052bdbe5" dependencies = [ "base64 0.13.0", "bincode", @@ -1083,9 +1083,9 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "1.10.13" +version = "1.10.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee7e7c63938c587870f33bd6b81a9c2913773009802ba3eed57116e9f24694a" +checksum = "275c52edaaaa86ce649a226c03f75579d570c01880a43ee1de77a973994754ce" dependencies = [ "bs58", "proc-macro2", @@ -1097,6 +1097,7 @@ dependencies = [ [[package]] name = "solitaire" version = "0.1.0" +source = "git+https://github.com/certusone/wormhole?tag=v2.8.9#e47f9e481ef84d4dea7a94c9eafbf3b180892466" dependencies = [ "borsh", "byteorder", diff --git a/third_party/pyth/p2w-sdk/rust/Cargo.toml b/third_party/pyth/p2w-sdk/rust/Cargo.toml index 867eeb96..124ec821 100644 --- a/third_party/pyth/p2w-sdk/rust/Cargo.toml +++ b/third_party/pyth/p2w-sdk/rust/Cargo.toml @@ -5,18 +5,23 @@ authors = ["Wormhole Contributors "] edition = "2018" description = "Pyth to Wormhole SDK" - [lib] crate-type = ["cdylib", "rlib"] [features] -solana = ["solitaire"] -wasm = ["wasm-bindgen", "solana"] +default = [] +solana = ["solitaire", "solana-program", "pyth-sdk-solana"] +wasm = ["wasm-bindgen", "solana"] [dependencies] hex = "0.4.3" serde = { version = "1.0.103", default-features = false, features = ["derive"] } -pyth-sdk-solana = "0.4.0" +pyth-sdk = "*" +pyth-sdk-solana = { version = "0.4.0", optional = true } wasm-bindgen = { version = "0.2.74", features = ["serde-serialize"], optional = true} -solitaire = { path = "../../../../solana/solitaire/program", optional = true } -solana-program = "1.8.16" +solitaire = { git = "https://github.com/certusone/wormhole", tag = "v2.8.9", optional = true} +solana-program = { version = "=1.10.31", optional = true } + +[dev-dependencies] +solana-program = "=1.10.31" +pyth-sdk-solana = "0.4.0" diff --git a/third_party/pyth/p2w-sdk/rust/src/lib.rs b/third_party/pyth/p2w-sdk/rust/src/lib.rs index 954420b5..78e320fb 100644 --- a/third_party/pyth/p2w-sdk/rust/src/lib.rs +++ b/third_party/pyth/p2w-sdk/rust/src/lib.rs @@ -18,7 +18,11 @@ use std::io::Read; use std::iter::Iterator; use std::mem; -use pyth_sdk_solana::state::PriceStatus; +pub use pyth_sdk::{ + Identifier, + PriceStatus, + UnixTimestamp, +}; #[cfg(feature = "solana")] use solitaire::{ @@ -26,9 +30,6 @@ use solitaire::{ Info, }; -use solana_program::clock::UnixTimestamp; -use solana_program::pubkey::Pubkey; - #[cfg(feature = "wasm")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] pub mod wasm; @@ -66,8 +67,6 @@ pub enum PayloadId { PriceBatchAttestation = 2, } -// On-chain data types - /// The main attestation data type. /// /// Important: For maximum security, *both* product_id and price_id @@ -80,9 +79,9 @@ pub enum PayloadId { #[serde(rename_all = "camelCase")] pub struct PriceAttestation { #[serde(serialize_with = "pubkey_to_hex")] - pub product_id: Pubkey, + pub product_id: Identifier, #[serde(serialize_with = "pubkey_to_hex")] - pub price_id: Pubkey, + pub price_id: Identifier, #[serde(serialize_with = "use_to_string")] pub price: i64, #[serde(serialize_with = "use_to_string")] @@ -113,7 +112,7 @@ where s.serialize_str(&val.to_string()) } -pub fn pubkey_to_hex(val: &Pubkey, s: S) -> Result +pub fn pubkey_to_hex(val: &Identifier, s: S) -> Result where S: Serializer, { @@ -137,7 +136,7 @@ impl BatchPriceAttestation { // major_version buf.extend_from_slice(&P2W_FORMAT_VER_MAJOR.to_be_bytes()[..]); - // minor_version + // minor_version buf.extend_from_slice(&P2W_FORMAT_VER_MINOR.to_be_bytes()[..]); // hdr_size @@ -279,22 +278,23 @@ impl BatchPriceAttestation { // On-chain data types impl PriceAttestation { + #[cfg(feature = "solana")] pub fn from_pyth_price_bytes( - price_id: Pubkey, + price_id: Identifier, attestation_time: UnixTimestamp, value: &[u8], ) -> Result { let price = pyth_sdk_solana::state::load_price_account(value)?; Ok(PriceAttestation { - product_id: Pubkey::new(&price.prod.val[..]), + product_id: Identifier::new(price.prod.val), price_id, price: price.agg.price, conf: price.agg.conf, expo: price.expo, ema_price: price.ema_price.val, ema_conf: price.ema_conf.val as u64, - status: price.agg.status.into(), + status: price.agg.status, num_publishers: price.num_qt, max_num_publishers: price.num, attestation_time, @@ -379,11 +379,11 @@ impl PriceAttestation { pub fn deserialize(mut bytes: impl Read) -> Result { let mut product_id_vec = vec![0u8; PUBKEY_LEN]; bytes.read_exact(product_id_vec.as_mut_slice())?; - let product_id = Pubkey::new(product_id_vec.as_slice()); + let product_id = Identifier::new(product_id_vec.as_slice().try_into()?); let mut price_id_vec = vec![0u8; PUBKEY_LEN]; bytes.read_exact(price_id_vec.as_mut_slice())?; - let price_id = Pubkey::new(price_id_vec.as_slice()); + let price_id = Identifier::new(price_id_vec.as_slice().try_into()?); let mut price_vec = vec![0u8; mem::size_of::()]; bytes.read_exact(price_vec.as_mut_slice())?; @@ -479,8 +479,8 @@ mod tests { let product_id_bytes = prod.unwrap_or([21u8; 32]); let price_id_bytes = price.unwrap_or([222u8; 32]); PriceAttestation { - product_id: Pubkey::new_from_array(product_id_bytes), - price_id: Pubkey::new_from_array(price_id_bytes), + product_id: Identifier::new(product_id_bytes), + price_id: Identifier::new(price_id_bytes), price: 0x2bad2feed7, conf: 101, ema_price: -42,