Explorar o código

Start depending on the upstream out-of-tree Wormhole (#258)

* Add out-of-tree dependency on wormhole v2.8.9

This lets us outsource all wormhole/solitaire code to the upstream
certusone repo

* Docker.client: Use cargo-install to install binaries from github

* p2w: fix solana-program wasm-bindgen

* pyth2wormhole: Fix code-level errors against newer solitaire

* p2w: Use upstream wormhole rust code, bump guardian to 2.8.9

* guardian: ensure solana is on, spy: bump image to 2.8.9

Co-authored-by: Reisen <reisen@morphism.org>
Stanisław Drozd %!s(int64=3) %!d(string=hai) anos
pai
achega
a2a0f6e15b
Modificáronse 93 ficheiros con 608 adicións e 13842 borrados
  1. 12 15
      Dockerfile.client
  2. 21 15
      Dockerfile.solana
  3. 2 0
      Dockerfile.wasm
  4. 40 523
      cosmwasm/Cargo.lock
  5. 0 1
      cosmwasm/contracts/pyth-bridge/Cargo.toml
  6. 25 4
      devnet/node.yaml
  7. 1 1
      devnet/spy.yaml
  8. 0 4271
      solana/bridge/Cargo.lock
  9. 0 5
      solana/bridge/Cargo.toml
  10. 0 22
      solana/bridge/client/Cargo.toml
  11. 0 506
      solana/bridge/client/src/main.rs
  12. 0 34
      solana/bridge/cpi_poster/Cargo.toml
  13. 0 2
      solana/bridge/cpi_poster/Xargo.toml
  14. 0 3
      solana/bridge/cpi_poster/src/api.rs
  15. 0 66
      solana/bridge/cpi_poster/src/api/post_message.rs
  16. 0 33
      solana/bridge/cpi_poster/src/instructions.rs
  17. 0 21
      solana/bridge/cpi_poster/src/lib.rs
  18. 0 36
      solana/bridge/program/Cargo.toml
  19. 0 2
      solana/bridge/program/Xargo.toml
  20. 0 17
      solana/bridge/program/src/accounts.rs
  21. 0 59
      solana/bridge/program/src/accounts/bridge.rs
  22. 0 47
      solana/bridge/program/src/accounts/claim.rs
  23. 0 8
      solana/bridge/program/src/accounts/fee_collector.rs
  24. 0 65
      solana/bridge/program/src/accounts/guardian_set.rs
  25. 0 119
      solana/bridge/program/src/accounts/posted_message.rs
  26. 0 91
      solana/bridge/program/src/accounts/posted_vaa.rs
  27. 0 38
      solana/bridge/program/src/accounts/sequence.rs
  28. 0 32
      solana/bridge/program/src/accounts/signature_set.rs
  29. 0 11
      solana/bridge/program/src/api.rs
  30. 0 299
      solana/bridge/program/src/api/governance.rs
  31. 0 98
      solana/bridge/program/src/api/initialize.rs
  32. 0 146
      solana/bridge/program/src/api/post_message.rs
  33. 0 220
      solana/bridge/program/src/api/post_vaa.rs
  34. 0 219
      solana/bridge/program/src/api/verify_signature.rs
  35. 0 35
      solana/bridge/program/src/error.rs
  36. 0 405
      solana/bridge/program/src/instructions.rs
  37. 0 96
      solana/bridge/program/src/lib.rs
  38. 0 235
      solana/bridge/program/src/types.rs
  39. 0 293
      solana/bridge/program/src/vaa.rs
  40. 0 372
      solana/bridge/program/src/wasm.rs
  41. 0 478
      solana/bridge/program/tests/common.rs
  42. 0 1080
      solana/bridge/program/tests/integration.rs
  43. 0 34
      solana/bridge/program_stub/Cargo.toml
  44. 0 2
      solana/bridge/program_stub/Xargo.toml
  45. 0 7
      solana/bridge/program_stub/src/api.rs
  46. 0 88
      solana/bridge/program_stub/src/api/post_vaa.rs
  47. 0 29
      solana/bridge/program_stub/src/lib.rs
  48. 1 1
      solana/devnet_setup.sh
  49. 0 0
      solana/memmap2-rs/Cargo.toml
  50. 0 0
      solana/memmap2-rs/LICENSE-APACHE
  51. 0 0
      solana/memmap2-rs/LICENSE-MIT
  52. 0 0
      solana/memmap2-rs/README.md
  53. 0 0
      solana/memmap2-rs/src/lib.rs
  54. 0 0
      solana/memmap2-rs/src/stub.rs
  55. 352 87
      solana/pyth2wormhole/Cargo.lock
  56. 1 1
      solana/pyth2wormhole/Cargo.toml
  57. 9 9
      solana/pyth2wormhole/client/Cargo.toml
  58. 60 39
      solana/pyth2wormhole/client/src/lib.rs
  59. 1 1
      solana/pyth2wormhole/client/src/main.rs
  60. 2 0
      solana/pyth2wormhole/client/tests/test_migrate.rs
  61. 5 7
      solana/pyth2wormhole/program/Cargo.toml
  62. 4 11
      solana/pyth2wormhole/program/src/attest.rs
  63. 2 9
      solana/pyth2wormhole/program/src/initialize.rs
  64. 4 4
      solana/pyth2wormhole/program/src/lib.rs
  65. 16 9
      solana/pyth2wormhole/program/src/migrate.rs
  66. 1 9
      solana/pyth2wormhole/program/src/set_config.rs
  67. 6 0
      solana/rust-toolchain
  68. 0 1526
      solana/solitaire/Cargo.lock
  69. 0 2
      solana/solitaire/Cargo.toml
  70. 0 12
      solana/solitaire/client/Cargo.toml
  71. 0 227
      solana/solitaire/client/src/lib.rs
  72. 0 24
      solana/solitaire/program/Cargo.toml
  73. 0 2
      solana/solitaire/program/Xargo.toml
  74. 0 74
      solana/solitaire/program/src/error.rs
  75. 0 127
      solana/solitaire/program/src/lib.rs
  76. 0 165
      solana/solitaire/program/src/macros.rs
  77. 0 4
      solana/solitaire/program/src/processors.rs
  78. 0 76
      solana/solitaire/program/src/processors/keyed.rs
  79. 0 288
      solana/solitaire/program/src/processors/peel.rs
  80. 0 5
      solana/solitaire/program/src/processors/persist.rs
  81. 0 169
      solana/solitaire/program/src/processors/seeded.rs
  82. 0 7
      solana/solitaire/program/src/types.rs
  83. 0 128
      solana/solitaire/program/src/types/accounts.rs
  84. 0 54
      solana/solitaire/program/src/types/context.rs
  85. 0 107
      solana/solitaire/program/src/types/layers.rs
  86. 0 21
      solana/solitaire/rocksalt/Cargo.toml
  87. 0 2
      solana/solitaire/rocksalt/Xargo.toml
  88. 0 286
      solana/solitaire/rocksalt/src/lib.rs
  89. 0 118
      solana/solitaire/rocksalt/src/to_instruction.rs
  90. 0 11
      solana/solitaire/rustfmt.toml
  91. 15 14
      third_party/pyth/p2w-sdk/rust/Cargo.lock
  92. 11 6
      third_party/pyth/p2w-sdk/rust/Cargo.toml
  93. 17 17
      third_party/pyth/p2w-sdk/rust/src/lib.rs

+ 12 - 15
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
-
-ENV SOLANA_BIN_PATH="/root/.local/share/solana/install/active_release/bin"
-ENV PATH="$SOLANA_BIN_PATH:$PATH"
+    cargo install --version =2.0.12 --locked spl-token-cli
 
-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

+ 21 - 15
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
 

+ 2 - 0
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
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 40 - 523
cosmwasm/Cargo.lock


+ 0 - 1
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]

+ 25 - 4
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:

+ 1 - 1
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

+ 0 - 4271
solana/bridge/Cargo.lock

@@ -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"

+ 0 - 5
solana/bridge/Cargo.toml

@@ -1,5 +0,0 @@
-[workspace]
-members = ["program", "client", "program_stub", "cpi_poster"]
-
-[patch.crates-io]
-memmap2 = { path = "memmap2-rs" }

+ 0 - 22
solana/bridge/client/Cargo.toml

@@ -1,22 +0,0 @@
-[package]
-name = "client"
-version = "0.1.0"
-authors = ["Stan Drozd <stan@nexantic.com>"]
-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"] }

+ 0 - 506
solana/bridge/client/src/main.rs

@@ -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<dyn std::error::Error>;
-type CommmandResult = Result<Option<Transaction>, 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::<BridgeData>())?;
-
-    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<u8>,
-    commitment: bridge::types::ConsistencyLevel,
-    proxy: Option<Pubkey>,
-) -> 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 <FINALIZED|CONFIRMED>"),
-                )
-                .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 = <Derive<Info<'_>, "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<T>(amount: T) -> Result<(), String>
-where
-    T: AsRef<str> + Display,
-{
-    if amount.as_ref().parse::<u8>().is_ok() {
-        Ok(())
-    } else {
-        Err(format!(
-            "Unable to parse input amount as integer, provided: {}",
-            amount
-        ))
-    }
-}
-
-pub fn is_u32<T>(amount: T) -> Result<(), String>
-where
-    T: AsRef<str> + Display,
-{
-    if amount.as_ref().parse::<u32>().is_ok() {
-        Ok(())
-    } else {
-        Err(format!(
-            "Unable to parse input amount as integer, provided: {}",
-            amount
-        ))
-    }
-}
-
-pub fn is_u64<T>(amount: T) -> Result<(), String>
-where
-    T: AsRef<str> + Display,
-{
-    if amount.as_ref().parse::<u64>().is_ok() {
-        Ok(())
-    } else {
-        Err(format!(
-            "Unable to parse input amount as integer, provided: {}",
-            amount
-        ))
-    }
-}
-
-pub fn is_hex<T>(value: T) -> Result<(), String>
-where
-    T: AsRef<str> + 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(())
-    }
-}

+ 0 - 34
solana/bridge/cpi_poster/Cargo.toml

@@ -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"

+ 0 - 2
solana/bridge/cpi_poster/Xargo.toml

@@ -1,2 +0,0 @@
-[target.bpfel-unknown-unknown.dependencies.std]
-features = []

+ 0 - 3
solana/bridge/cpi_poster/src/api.rs

@@ -1,3 +0,0 @@
-pub mod post_message;
-
-pub use post_message::*;

+ 0 - 66
solana/bridge/cpi_poster/src/api/post_message.rs

@@ -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<Info<'b>>,
-
-    /// Account to store the posted message
-    pub message: Signer<Mut<Info<'b>>>,
-
-    /// Emitter of the VAA
-    pub emitter: MaybeMut<Info<'b>>,
-
-    /// Tracker for the emitter sequence
-    pub sequence: Mut<Info<'b>>,
-
-    /// Payer for account creation
-    pub payer: Mut<Info<'b>>,
-
-    /// Account to collect tx fee
-    pub fee_collector: Mut<Info<'b>>,
-
-    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<u8>,
-
-    /// 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(())
-}

+ 0 - 33
solana/bridge/cpi_poster/src/instructions.rs

@@ -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<u8>,
-    commitment: ConsistencyLevel,
-) -> solitaire::Result<Instruction> {
-    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,
-    })
-}

+ 0 - 21
solana/bridge/cpi_poster/src/lib.rs

@@ -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,
-}

+ 0 - 36
solana/bridge/program/Cargo.toml

@@ -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"

+ 0 - 2
solana/bridge/program/Xargo.toml

@@ -1,2 +0,0 @@
-[target.bpfel-unknown-unknown.dependencies.std]
-features = []

+ 0 - 17
solana/bridge/program/src/accounts.rs

@@ -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::*;

+ 0 - 59
solana/bridge/program/src/accounts/bridge.rs

@@ -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<Data<'a, BridgeData, { State }>, "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,
-}

+ 0 - 47
solana/bridge/program/src/accounts/claim.rs

@@ -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<Vec<u8>> {
-        return vec![
-            data.emitter_address.to_vec(),
-            data.emitter_chain.to_be_bytes().to_vec(),
-            data.sequence.to_be_bytes().to_vec(),
-        ];
-    }
-}

+ 0 - 8
solana/bridge/program/src/accounts/fee_collector.rs

@@ -1,8 +0,0 @@
-//! The FeeCollector is a simple account that collects SOL fees.
-
-use solitaire::{
-    Derive,
-    Info,
-};
-
-pub type FeeCollector<'a> = Derive<Info<'a>, "fee_collector">;

+ 0 - 65
solana/bridge/program/src/accounts/guardian_set.rs

@@ -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<GuardianPublicKey>,
-
-    /// 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<u8>> {
-        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
-    }
-}

+ 0 - 119
solana/bridge/program/src/accounts/posted_message.rs

@@ -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<u8>,
-}
-
-impl BorshSerialize for PostedMessageData {
-    fn serialize<W: Write>(&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<Self> {
-        *buf = &buf[3..];
-        Ok(PostedMessageData(
-            <MessageData as BorshDeserialize>::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())
-    }
-}

+ 0 - 91
solana/bridge/program/src/accounts/posted_vaa.rs

@@ -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<u8>,
-}
-
-impl<'a, const State: AccountState> Seeded<&PostedVAADerivationData> for PostedVAA<'a, { State }> {
-    fn seeds(data: &PostedVAADerivationData) -> Vec<Vec<u8>> {
-        vec!["PostedVAA".as_bytes().to_vec(), data.payload_hash.to_vec()]
-    }
-}
-
-#[repr(transparent)]
-pub struct PostedVAAData(pub MessageData);
-
-impl BorshSerialize for PostedVAAData {
-    fn serialize<W: Write>(&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<Self> {
-        *buf = &buf[3..];
-        Ok(PostedVAAData(
-            <MessageData as BorshDeserialize>::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())
-    }
-}

+ 0 - 38
solana/bridge/program/src/accounts/sequence.rs

@@ -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<u8>> {
-        vec![
-            "Sequence".as_bytes().to_vec(),
-            data.emitter_key.to_bytes().to_vec(),
-        ]
-    }
-}
-
-impl Owned for SequenceTracker {
-    fn owner(&self) -> AccountOwner {
-        AccountOwner::This
-    }
-}

+ 0 - 32
solana/bridge/program/src/accounts/signature_set.rs

@@ -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<bool>,
-
-    /// 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
-    }
-}

+ 0 - 11
solana/bridge/program/src/api.rs

@@ -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::*;

+ 0 - 299
solana/bridge/program/src/api/governance.rs

@@ -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<Signer<Info<'b>>>,
-
-    /// Bridge config
-    pub bridge: Mut<Bridge<'b, { AccountState::Initialized }>>,
-
-    /// GuardianSet change VAA
-    pub vaa: ClaimableVAA<'b, GovernancePayloadUpgrade>,
-
-    /// PDA authority for the loader
-    pub upgrade_authority: Derive<Info<'b>, "upgrade">,
-
-    /// Spill address for the upgrade excess lamports
-    pub spill: Mut<Info<'b>>,
-
-    /// New contract address.
-    pub buffer: Mut<Info<'b>>,
-
-    /// Required by the upgradeable uploader.
-    pub program_data: Mut<Info<'b>>,
-
-    /// Our own address, required by the upgradeable loader.
-    pub own_address: Mut<Info<'b>>,
-
-    // 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<Signer<Info<'b>>>,
-
-    /// Bridge config
-    pub bridge: Mut<Bridge<'b, { AccountState::Initialized }>>,
-
-    /// GuardianSet change VAA
-    pub vaa: ClaimableVAA<'b, GovernancePayloadGuardianSetChange>,
-
-    /// Old guardian set
-    pub guardian_set_old: Mut<GuardianSet<'b, { AccountState::Initialized }>>,
-
-    /// New guardian set
-    pub guardian_set_new: Mut<GuardianSet<'b, { AccountState::Uninitialized }>>,
-}
-
-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<Signer<Info<'b>>>,
-
-    /// Bridge config
-    pub bridge: Mut<Bridge<'b, { AccountState::Initialized }>>,
-
-    /// 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<Signer<Info<'b>>>,
-
-    /// Bridge config
-    pub bridge: Bridge<'b, { AccountState::Initialized }>,
-
-    /// Governance VAA
-    pub vaa: ClaimableVAA<'b, GovernancePayloadTransferFees>,
-
-    /// Account collecting tx fees
-    pub fee_collector: Mut<Derive<Info<'b>, "fee_collector">>,
-
-    /// Fee recipient
-    pub recipient: Mut<Info<'b>>,
-
-    /// 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(())
-}

+ 0 - 98
solana/bridge/program/src/api/initialize.rs

@@ -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<Info<'a>>;
-
-#[derive(FromAccounts)]
-pub struct Initialize<'b> {
-    /// Bridge config.
-    pub bridge: Mut<Bridge<'b, { AccountState::Uninitialized }>>,
-
-    /// Location the new guardian set will be allocated at.
-    pub guardian_set: Mut<GuardianSet<'b, { AccountState::Uninitialized }>>,
-
-    /// Location of the fee collector that users will need to pay.
-    pub fee_collector: Mut<FeeCollector<'b>>,
-
-    /// Payer for account creation.
-    pub payer: Mut<Payer<'b>>,
-
-    /// 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(())
-}

+ 0 - 146
solana/bridge/program/src/api/post_message.rs

@@ -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<Bridge<'b, { AccountState::Initialized }>>,
-
-    /// Account to store the posted message
-    pub message: Signer<Mut<UninitializedMessage<'b>>>,
-
-    /// Emitter of the VAA
-    pub emitter: Signer<MaybeMut<Info<'b>>>,
-
-    /// Tracker for the emitter sequence
-    pub sequence: Mut<Sequence<'b>>,
-
-    /// Payer for account creation
-    pub payer: Mut<Signer<Info<'b>>>,
-
-    /// Account to collect tx fee
-    pub fee_collector: Mut<FeeCollector<'b>>,
-
-    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<u8>,
-
-    /// 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(())
-}

+ 0 - 220
solana/bridge/program/src/api/post_vaa.rs

@@ -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<PostedVAA<'b, { AccountState::MaybeInitialized }>>,
-
-    /// Account used to pay for auxillary instructions.
-    pub payer: Mut<Signer<Info<'b>>>,
-
-    /// 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<u8>,
-}
-
-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::<BigEndian>(vaa.timestamp)?;
-        v.write_u32::<BigEndian>(vaa.nonce)?;
-        v.write_u16::<BigEndian>(vaa.emitter_chain)?;
-        v.write(&vaa.emitter_address)?;
-        v.write_u64::<BigEndian>(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(())
-}

+ 0 - 219
solana/bridge/program/src/api/verify_signature.rs

@@ -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<Signer<Info<'b>>>,
-
-    /// Guardian set of the signatures
-    pub guardian_set: GuardianSet<'b, { AccountState::Initialized }>,
-
-    /// Signature Account
-    pub signature_set: Mut<Signer<SignatureSet<'b, { AccountState::MaybeInitialized }>>>,
-
-    /// 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<SigInfo> = 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<SecpInstructionPart> = 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(())
-}

+ 0 - 35
solana/bridge/program/src/error.rs

@@ -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<Error> for SolitaireError {
-    fn from(e: Error) -> SolitaireError {
-        trace!("ProgramError: {:?}", e);
-        SolitaireError::Custom(e as u64)
-    }
-}

+ 0 - 405
solana/bridge/program/src/instructions.rs

@@ -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<Instruction> {
-    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<u8>,
-    commitment: ConsistencyLevel,
-) -> solitaire::Result<Instruction> {
-    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<Instruction> {
-    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<u8> {
-    let mut v = Cursor::new(Vec::new());
-    v.write_u32::<BigEndian>(vaa.timestamp).unwrap();
-    v.write_u32::<BigEndian>(vaa.nonce).unwrap();
-    v.write_u16::<BigEndian>(vaa.emitter_chain).unwrap();
-    v.write(&vaa.emitter_address).unwrap();
-    v.write_u64::<BigEndian>(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()
-}

+ 0 - 96
solana/bridge/program/src/lib.rs

@@ -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,
-}

+ 0 - 235
solana/bridge/program/src/types.rs

@@ -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<W: Write>(&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<Self, SolitaireError> {
-        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<W: Write>(&self, v: &mut W) -> std::result::Result<(), SolitaireError> {
-        use byteorder::WriteBytesExt;
-        v.write_u32::<BigEndian>(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<Self, SolitaireError> {
-        let mut c = Cursor::new(buf);
-        Self::check_governance_header(&mut c)?;
-
-        let new_index = c.read_u32::<BigEndian>()?;
-
-        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<W: Write>(&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<Self, SolitaireError> {
-        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<W: Write>(&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<Self, SolitaireError> {
-        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 {
-}

+ 0 - 293
solana/bridge/program/src/vaa.rs

@@ -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<W: Write>(&self, writer: &mut W) -> std::result::Result<(), SolitaireError>;
-
-    fn try_to_vec(&self) -> std::result::Result<Vec<u8>, 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<Self, SolitaireError>;
-}
-
-pub trait SerializeGovernancePayload: SerializePayload {
-    const MODULE: &'static str;
-    const ACTION: u8;
-
-    fn try_to_vec(&self) -> std::result::Result<Vec<u8>, SolitaireError> {
-        let mut result = Vec::with_capacity(256);
-        self.write_governance_header(&mut result)?;
-        self.serialize(&mut result)?;
-        Ok(result)
-    }
-
-    fn write_governance_header<W: Write>(
-        &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::<BigEndian>(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::<BigEndian>()?;
-        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<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self>
-    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<Pubkey> {
-        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<Claim<'b, { AccountState::Uninitialized }>>,
-}
-
-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<u8>,
-    pub key: [u8; 20],
-    pub index: u8,
-}
-
-#[derive(Serialize, Deserialize, Default, Clone)]
-pub struct VAASignature {
-    pub signature: Vec<u8>,
-    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<VAASignature>,
-    // 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<u8>,
-}
-
-impl VAA {
-    pub const HEADER_LEN: usize = 6;
-    pub const SIGNATURE_LEN: usize = 66;
-
-    pub fn deserialize(data: &[u8]) -> std::result::Result<VAA, std::io::Error> {
-        let mut rdr = Cursor::new(data);
-        let mut v = VAA::default();
-
-        v.version = rdr.read_u8()?;
-        v.guardian_set_index = rdr.read_u32::<BigEndian>()?;
-
-        let len_sig = rdr.read_u8()?;
-        let mut sigs: Vec<VAASignature> = 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::<BigEndian>()?;
-        v.nonce = rdr.read_u32::<BigEndian>()?;
-        v.emitter_chain = rdr.read_u16::<BigEndian>()?;
-
-        let mut emitter_address = [0u8; 32];
-        rdr.read_exact(&mut emitter_address)?;
-        v.emitter_address = emitter_address;
-
-        v.sequence = rdr.read_u64::<BigEndian>()?;
-        v.consistency_level = rdr.read_u8()?;
-
-        rdr.read_to_end(&mut v.payload)?;
-
-        Ok(v)
-    }
-}
-
-impl From<VAA> 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,
-        }
-    }
-}

+ 0 - 372
solana/bridge/program/src/wasm.rs

@@ -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<u8>,
-    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<u8>,
-) -> 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<u8>) -> 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<u8>) -> 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<u8>) -> 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<u8>,
-) -> 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<u8>,
-) -> 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<SignatureItem> = 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<Instruction>> = 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::<LittleEndian>((data_offset + 85 * i) as u16)
-                .unwrap();
-            secp_payload.write_u8(0).unwrap();
-            secp_payload
-                .write_u16::<LittleEndian>((data_offset + 85 * i + 65) as u16)
-                .unwrap();
-            secp_payload.write_u8(0).unwrap();
-            secp_payload
-                .write_u16::<LittleEndian>(message_offset as u16)
-                .unwrap();
-            secp_payload
-                .write_u16::<LittleEndian>(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<u8> {
-    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<u8>) -> JsValue {
-    JsValue::from_serde(&GuardianSetData::try_from_slice(data.as_slice()).unwrap()).unwrap()
-}
-
-#[wasm_bindgen]
-pub fn state_address(bridge: String) -> Vec<u8> {
-    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<u8>) -> JsValue {
-    JsValue::from_serde(&BridgeData::try_from_slice(data.as_slice()).unwrap()).unwrap()
-}
-
-#[wasm_bindgen]
-pub fn fee_collector_address(bridge: String) -> Vec<u8> {
-    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<u8>) -> Vec<u8> {
-    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<u8>) -> JsValue {
-    JsValue::from_serde(&PostedVAAData::try_from_slice(data.as_slice()).unwrap().0).unwrap()
-}
-
-#[wasm_bindgen]
-pub fn parse_vaa(data: Vec<u8>) -> JsValue {
-    JsValue::from_serde(&VAA::deserialize(data.as_slice()).unwrap()).unwrap()
-}

+ 0 - 478
solana/bridge/program/tests/common.rs

@@ -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<Signature, ClientError> {
-    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::<Pubkey>()
-            .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<T: BorshDeserialize>(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<SecretKey>) {
-        use rand::Rng;
-        use sha3::Digest;
-
-        let mut rng = rand::thread_rng();
-
-        // Generate Guardian Keys
-        let secret_keys: Vec<SecretKey> = 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<u8>,
-        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::<BigEndian>(vaa.timestamp).unwrap();
-            v.write_u32::<BigEndian>(vaa.nonce).unwrap();
-            v.write_u16::<BigEndian>(vaa.emitter_chain).unwrap();
-            v.write(&vaa.emitter_address).unwrap();
-            v.write_u64::<BigEndian>(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<Signature, ClientError> {
-        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<Signature, ClientError> {
-        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<u8>,
-        fee: u64,
-    ) -> Result<Pubkey, ClientError> {
-        // 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<Pubkey, ClientError> {
-        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<Signature, ClientError> {
-        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<Signature, ClientError> {
-        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<Signature, ClientError> {
-        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<Signature, ClientError> {
-        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<Signature, ClientError> {
-        execute(
-            client,
-            payer,
-            &[payer],
-            &[instructions::transfer_fees(
-                *program,
-                payer.pubkey(),
-                message,
-                emitter,
-                sequence,
-                recipient,
-            )],
-            CommitmentConfig::processed(),
-        )
-    }
-}

+ 0 - 1080
solana/bridge/program/tests/integration.rs

@@ -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<SecretKey>,
-    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);
-}

+ 0 - 34
solana/bridge/program_stub/Cargo.toml

@@ -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"

+ 0 - 2
solana/bridge/program_stub/Xargo.toml

@@ -1,2 +0,0 @@
-[target.bpfel-unknown-unknown.dependencies.std]
-features = []

+ 0 - 7
solana/bridge/program_stub/src/api.rs

@@ -1,7 +0,0 @@
-pub mod post_vaa;
-
-pub use bridge::{
-    initialize::*,
-    post_message::*,
-};
-pub use post_vaa::*;

+ 0 - 88
solana/bridge/program_stub/src/api/post_vaa.rs

@@ -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<PostedVAA<'b, { AccountState::MaybeInitialized }>>,
-
-    /// Account used to pay for auxillary instructions.
-    pub payer: Mut<Signer<Info<'b>>>,
-
-    /// 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(())
-}

+ 0 - 29
solana/bridge/program_stub/src/lib.rs

@@ -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,
-}

+ 1 - 1
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

+ 0 - 0
solana/bridge/memmap2-rs/Cargo.toml → solana/memmap2-rs/Cargo.toml


+ 0 - 0
solana/bridge/memmap2-rs/LICENSE-APACHE → solana/memmap2-rs/LICENSE-APACHE


+ 0 - 0
solana/bridge/memmap2-rs/LICENSE-MIT → solana/memmap2-rs/LICENSE-MIT


+ 0 - 0
solana/bridge/memmap2-rs/README.md → solana/memmap2-rs/README.md


+ 0 - 0
solana/bridge/memmap2-rs/src/lib.rs → solana/memmap2-rs/src/lib.rs


+ 0 - 0
solana/bridge/memmap2-rs/src/stub.rs → solana/memmap2-rs/src/stub.rs


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 352 - 87
solana/pyth2wormhole/Cargo.lock


+ 1 - 1
solana/pyth2wormhole/Cargo.toml

@@ -1,4 +1,4 @@
 [workspace]
 members = ["client", "program"]
 [patch.crates-io]
-memmap2 = { path = "../bridge/memmap2-rs" }
+memmap2 = { path = "../memmap2-rs" }

+ 9 - 9
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"

+ 60 - 39
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<Transaction, ErrBox> {
-    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::<Vec<&Keypair>>(
         &[ix],
         Some(&payer_pubkey),
-        signers.iter().collect::<Vec<_>>().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<Transaction, ErrBox> {
-    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::<Vec<&Keypair>>(
         &[ix],
         Some(&payer_pubkey),
-        signers.iter().collect::<Vec<_>>().as_ref(),
+        &signers,
         latest_blockhash,
     );
     Ok(tx_signed)
@@ -137,28 +146,41 @@ pub fn gen_migrate_tx(
     owner: Keypair,
     latest_blockhash: Hash,
 ) -> Result<Transaction, ErrBox> {
-    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::<Vec<&Keypair>>(
         &[ix],
         Some(&payer_pubkey),
-        signers.iter().collect::<Vec<_>>().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,
     );

+ 1 - 1
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,

+ 2 - 0
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;
 

+ 5 - 7
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}
-

+ 4 - 11
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<Signer<Info<'b>>>,
@@ -133,12 +132,6 @@ pub struct AttestData {
     pub consistency_level: ConsistencyLevel,
 }
 
-impl<'b> InstructionContext<'b> for Attest<'b> {
-    fn deps(&self) -> Vec<Pubkey> {
-        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

+ 2 - 9
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<P2WConfigAccount<'b, { AccountState::Uninitialized }>>,
     pub payer: Mut<Signer<Info<'b>>>,
-}
-
-impl<'b> InstructionContext<'b> for Initialize<'b> {
-    fn deps(&self) -> Vec<Pubkey> {
-        vec![]
-    }
+    pub system_program: Info<'b>,
 }
 
 /// Must be called right after deployment

+ 4 - 4
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,
 }

+ 16 - 9
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<P2WConfigAccount<'b, { AccountState::Uninitialized }>>,
@@ -43,12 +42,8 @@ pub struct Migrate<'b> {
     pub current_owner: Mut<Signer<Info<'b>>>,
     /// Payer account for updating the account data
     pub payer: Mut<Signer<Info<'b>>>,
-}
-
-impl<'b> InstructionContext<'b> for Migrate<'b> {
-    fn deps(&self) -> Vec<Pubkey> {
-        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)?;

+ 1 - 9
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<P2WConfigAccount<'b, { AccountState::Initialized }>>,
@@ -30,12 +28,6 @@ pub struct SetConfig<'b> {
     pub payer: Mut<Signer<Info<'b>>>,
 }
 
-impl<'b> InstructionContext<'b> for SetConfig<'b> {
-    fn deps(&self) -> Vec<Pubkey> {
-        vec![]
-    }
-}
-
 /// Alters the current settings of pyth2wormhole
 pub fn set_config(
     _ctx: &ExecutionContext,

+ 6 - 0
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"

+ 0 - 1526
solana/solitaire/Cargo.lock

@@ -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",
-]

+ 0 - 2
solana/solitaire/Cargo.toml

@@ -1,2 +0,0 @@
-[workspace]
-members = ["rocksalt", "program", "client"]

+ 0 - 12
solana/solitaire/client/Cargo.toml

@@ -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"

+ 0 - 227
solana/solitaire/client/src/lib.rs

@@ -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<T, E> = std::result::Result<T, E>;
-
-pub type ErrBox = Box<dyn std::error::Error>;
-
-/// 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<Vec<AccountMeta>, ErrBox>;
-
-    /// If the implementor wants to sign using other AccEntry
-    /// variants, they should override this.
-    fn keypair(a: AccEntry) -> Option<Keypair> {
-        use AccEntry::*;
-        match a {
-            Signer(pair) => Some(pair),
-            SignerRO(pair) => Some(pair),
-            _other => None,
-        }
-    }
-}
-
-impl<T: Wrap> Wrap for Option<T> {
-    fn wrap(a: &AccEntry) -> StdResult<Vec<AccountMeta>, 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<T>
-where
-    T: Keyed<'a, 'b>,
-{
-    fn wrap(a: &AccEntry) -> StdResult<Vec<AccountMeta>, 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::<Self>()
-            )
-            .into()),
-        }
-    }
-}
-
-impl<'a, 'b: 'a, T, const Seed: &'static str> Wrap for Derive<T, Seed> {
-    fn wrap(a: &AccEntry) -> StdResult<Vec<AccountMeta>, 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::<Self>()
-            )
-            .into()),
-        }
-    }
-}
-
-impl<'a, T, const IsInitialized: AccountState> Wrap for Data<'a, T, IsInitialized>
-where
-    T: BorshSerialize + Owned + Default,
-{
-    fn wrap(a: &AccEntry) -> StdResult<Vec<AccountMeta>, 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::<Self>(), 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::<Self>(), 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::<Self>(), a).into())
-            }
-        }
-    }
-}
-
-impl<'b, Var> Wrap for Sysvar<'b, Var>
-where
-    Var: SolSysvar,
-{
-    fn wrap(a: &AccEntry) -> StdResult<Vec<AccountMeta>, 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::<Var>()
-                )
-                .into())
-            }
-        } else {
-            Err(format!("{} must be passed as Sysvar", std::any::type_name::<Self>()).into())
-        }
-    }
-}
-
-impl<'b> Wrap for Info<'b> {
-    fn wrap(a: &AccEntry) -> StdResult<Vec<AccountMeta>, 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::<Self>()
-            )
-            .into()),
-        }
-    }
-}
-
-impl<T: Wrap> Wrap for Mut<T> {
-    fn wrap(a: &AccEntry) -> StdResult<Vec<AccountMeta>, 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::<Self>()
-            )
-            .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<Keypair>), ErrBox>;
-}

+ 0 - 24
solana/solitaire/program/Cargo.toml

@@ -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"

+ 0 - 2
solana/solitaire/program/Xargo.toml

@@ -1,2 +0,0 @@
-[target.bpfel-unknown-unknown.dependencies.std]
-features = []

+ 0 - 74
solana/solitaire/program/src/error.rs

@@ -1,74 +0,0 @@
-use solana_program::{
-    program_error::ProgramError,
-    pubkey::Pubkey,
-};
-
-/// Quality of life Result type for the Solitaire stack.
-pub type Result<T> = std::result::Result<T, SolitaireError>;
-
-/// Quality of life type alias for wrapping up boxed errors.
-pub type ErrBox = Box<dyn std::error::Error>;
-
-/// 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<ProgramError> for SolitaireError {
-    fn from(e: ProgramError) -> Self {
-        SolitaireError::ProgramError(e)
-    }
-}
-
-impl From<std::io::Error> for SolitaireError {
-    fn from(e: std::io::Error) -> Self {
-        SolitaireError::IoError(e)
-    }
-}
-
-impl Into<ProgramError> for SolitaireError {
-    fn into(self) -> ProgramError {
-        match self {
-            SolitaireError::ProgramError(e) => return e,
-            _ => ProgramError::Custom(0),
-        }
-    }
-}

+ 0 - 127
solana/solitaire/program/src/lib.rs

@@ -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<Pubkey> {
-        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<T>(_: &'a Pubkey, _: &'c mut Iter<'a, AccountInfo<'b>>, _: &'a T) -> Result<Self>
-    where
-        Self: Sized;
-}

+ 0 - 165
solana/solitaire/program/src/macros.rs

@@ -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<Self> {
-                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<W: std::io::Write>(&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())
-            }
-        }
-    };
-}

+ 0 - 4
solana/solitaire/program/src/processors.rs

@@ -1,4 +0,0 @@
-pub mod keyed;
-pub mod peel;
-pub mod persist;
-pub mod seeded;

+ 0 - 76
solana/solitaire/program/src/processors/keyed.rs

@@ -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<T>
-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<T>
-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<T, Seed>
-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<T>
-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
-    }
-}

+ 0 - 288
solana/solitaire/program/src/processors/peel.rs

@@ -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<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self>
-    where
-        Self: Sized;
-
-    fn deps() -> Vec<Pubkey>;
-
-    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<T> {
-    fn peel<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-	// Check for 0-account
-	if ctx.info().key == &Pubkey::new_from_array([0u8; 32]) {
-	    trace!(&format!("Peeled {} is None, returning", std::any::type_name::<Option<T>>()));
-	    Ok(None)
-	} else {
-	    Ok(Some(T::peel(ctx)?))
-	}
-    }
-
-    fn deps() -> Vec<Pubkey> {
-	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::<Option<T>>()));
-	    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<T, Seed>
-{
-    fn peel<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-        // 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<Pubkey> {
-        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<T> {
-    fn peel<I>(mut ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-        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<Pubkey> {
-        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<T> {
-    fn peel<I>(mut ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-        ctx.immutable = !ctx.info().is_writable;
-        T::peel(ctx).map(|v| MaybeMut(v))
-    }
-
-    fn deps() -> Vec<Pubkey> {
-        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<T> {
-    fn peel<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-        match ctx.info().is_signer {
-            true => T::peel(ctx).map(|v| Signer(v)),
-            _ => Err(SolitaireError::InvalidSigner(*ctx.info().key).into()),
-        }
-    }
-
-    fn deps() -> Vec<Pubkey> {
-        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<T> {
-    fn peel<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-        match true {
-            true => T::peel(ctx).map(|v| System(v)),
-            _ => panic!(),
-        }
-    }
-
-    fn deps() -> Vec<Pubkey> {
-        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<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-        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<Pubkey> {
-        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<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-        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<Pubkey> {
-        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<I>(ctx: &'c mut Context<'a, 'b, 'c, I>) -> Result<Self> {
-        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<Pubkey> {
-        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(())
-    }
-}

+ 0 - 5
solana/solitaire/program/src/processors/persist.rs

@@ -1,5 +0,0 @@
-use solana_program::pubkey::Pubkey;
-
-pub trait Persist {
-    fn persist(&self, program_id: &Pubkey) -> crate::Result<()>;
-}

+ 0 - 169
solana/solitaire/program/src/processors/seeded.rs

@@ -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<Pubkey> {
-        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<I> {
-    fn seeds(accs: I) -> Vec<Vec<u8>>;
-
-    fn self_seeds(&self, accs: I) -> Vec<Vec<u8>> {
-        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<Vec<u8>> {
-        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<Vec<u8>> {
-        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<T: BorshSerialize + Owned + Default, const IsInitialized: AccountState> AccountSize
-    for Data<'_, T, IsInitialized>
-{
-    fn size(&self) -> usize {
-        self.1.try_to_vec().unwrap().len()
-    }
-}
-
-impl<'a, 'b: 'a, K, T: AccountSize + Seeded<K> + 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<Option<()>> for Derive<T, Seed> {
-    fn seeds(accs: Option<()>) -> Vec<Vec<u8>> {
-        vec![Seed.as_bytes().to_vec()]
-    }
-}
-
-pub fn invoke_seeded<I, T: Seeded<I>>(
-    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])
-}

+ 0 - 7
solana/solitaire/program/src/types.rs

@@ -1,7 +0,0 @@
-mod accounts;
-mod context;
-mod layers;
-
-pub use accounts::*;
-pub use context::*;
-pub use layers::*;

+ 0 - 128
solana/solitaire/program/src/types/accounts.rs

@@ -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<Info<'r>>,
-    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<const Seed: &'static str> Derive<AccountInfo<'_>, 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<const Seed: &'static str, T: BorshSerialize + Owned + Default>
-    Derive<Data<'_, T, { AccountState::Uninitialized }>, 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())
-    }
-}

+ 0 - 54
solana/solitaire/program/src/types/context.rs

@@ -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,
-        }
-    }
-}

+ 0 - 107
solana/solitaire/program/src/types/layers.rs

@@ -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<Next>(pub Next);
-
-#[repr(transparent)]
-pub struct MaybeMut<Next>(pub Next);
-
-#[repr(transparent)]
-pub struct Signer<Next>(pub Next);
-
-#[repr(transparent)]
-pub struct System<Next>(pub Next);
-
-#[repr(transparent)]
-pub struct Derive<Next, const Seed: &'static str>(pub Next);
-
-// Several traits are required for types defined here, they cannot be defined in another file due
-// to orphan instance limitations.
-
-impl<T> Deref for Signer<T> {
-    type Target = T;
-    fn deref(&self) -> &Self::Target {
-        unsafe { std::mem::transmute(&self.0) }
-    }
-}
-
-impl<T> DerefMut for Signer<T> {
-    fn deref_mut(&mut self) -> &mut Self::Target {
-        unsafe { std::mem::transmute(&mut self.0) }
-    }
-}
-
-impl<T> Deref for Mut<T> {
-    type Target = T;
-    fn deref(&self) -> &Self::Target {
-        unsafe { std::mem::transmute(&self.0) }
-    }
-}
-
-impl<T> DerefMut for Mut<T> {
-    fn deref_mut(&mut self) -> &mut Self::Target {
-        unsafe { std::mem::transmute(&mut self.0) }
-    }
-}
-
-impl<T> Deref for MaybeMut<T> {
-    type Target = T;
-    fn deref(&self) -> &Self::Target {
-        unsafe { std::mem::transmute(&self.0) }
-    }
-}
-
-impl<T> DerefMut for MaybeMut<T> {
-    fn deref_mut(&mut self) -> &mut Self::Target {
-        unsafe { std::mem::transmute(&mut self.0) }
-    }
-}
-
-impl<T> Deref for System<T> {
-    type Target = T;
-    fn deref(&self) -> &Self::Target {
-        unsafe { std::mem::transmute(&self.0) }
-    }
-}
-
-impl<T> DerefMut for System<T> {
-    fn deref_mut(&mut self) -> &mut Self::Target {
-        unsafe { std::mem::transmute(&mut self.0) }
-    }
-}
-
-impl<T, const Seed: &'static str> Deref for Derive<T, Seed> {
-    type Target = T;
-    fn deref(&self) -> &Self::Target {
-        unsafe { std::mem::transmute(&self.0) }
-    }
-}
-
-impl<T, const Seed: &'static str> DerefMut for Derive<T, Seed> {
-    fn deref_mut(&mut self) -> &mut Self::Target {
-        unsafe { std::mem::transmute(&mut self.0) }
-    }
-}

+ 0 - 21
solana/solitaire/rocksalt/Cargo.toml

@@ -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"

+ 0 - 2
solana/solitaire/rocksalt/Xargo.toml

@@ -1,2 +0,0 @@
-[target.bpfel-unknown-unknown.dependencies.std]
-features = []

+ 0 - 286
solana/solitaire/rocksalt/src/lib.rs

@@ -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<GenericParam> = 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<GenericParam> = 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<DataType>(pid: &'a solana_program::pubkey::Pubkey, iter: &'c mut std::slice::Iter<'a, solana_program::account_info::AccountInfo<'b>>, data: &'a DataType) -> solitaire::Result<Self> {
-                #from_method
-            }
-        }
-
-        impl #combined_impl_g solitaire::Peel<'a, 'b, 'c> for #name #type_g {
-            fn peel<I>(ctx: &'c mut solitaire::Context<'a, 'b, 'c, I>) -> solitaire::Result<Self> where Self: Sized {
-                let v: #name #type_g = FromAccounts::from(ctx.this, ctx.iter, ctx.data)?;
-                Ok(v)
-            }
-
-            fn deps() -> Vec<solana_program::pubkey::Pubkey> {
-                #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!(),
-    }
-}

+ 0 - 118
solana/solitaire/rocksalt/src/to_instruction.rs

@@ -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_client::Keypair>),
-                            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!(),
-    }
-}

+ 0 - 11
solana/solitaire/rustfmt.toml

@@ -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"

+ 15 - 14
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",

+ 11 - 6
third_party/pyth/p2w-sdk/rust/Cargo.toml

@@ -5,18 +5,23 @@ authors = ["Wormhole Contributors <contact@certus.one>"]
 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"

+ 17 - 17
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<S>(val: &Pubkey, s: S) -> Result<S::Ok, S::Error>
+pub fn pubkey_to_hex<S>(val: &Identifier, s: S) -> Result<S::Ok, S::Error>
 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<Self, ErrBox> {
         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<Self, ErrBox> {
         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::<i64>()];
         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,

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio