From b02d782f1c2b7489bd05d7633739dd7d1e0bb566 Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 31 Jul 2021 11:20:24 +0200 Subject: [PATCH] solana/bridge: remove agent Change-Id: I8fdf4e53172a422ee5d9d4dee13faf32ced1be08 --- solana/bridge/Cargo.toml | 4 +- solana/bridge/agent/.dockerignore | 1 - solana/bridge/agent/Cargo.lock | 1038 ----------------------------- solana/bridge/agent/Cargo.toml | 37 - solana/bridge/agent/build.rs | 3 - solana/bridge/agent/src/main.rs | 418 ------------ solana/bridge/agent/src/socket.rs | 50 -- 7 files changed, 2 insertions(+), 1549 deletions(-) delete mode 100644 solana/bridge/agent/.dockerignore delete mode 100644 solana/bridge/agent/Cargo.lock delete mode 100644 solana/bridge/agent/Cargo.toml delete mode 100644 solana/bridge/agent/build.rs delete mode 100644 solana/bridge/agent/src/main.rs delete mode 100644 solana/bridge/agent/src/socket.rs diff --git a/solana/bridge/Cargo.toml b/solana/bridge/Cargo.toml index c7026e1d..0a4c4003 100644 --- a/solana/bridge/Cargo.toml +++ b/solana/bridge/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["agent", "program", "client", "program_stub", "cpi_poster"] +members = ["program", "client", "program_stub", "cpi_poster"] [patch.crates-io] -memmap2 = { path = "memmap2-rs" } \ No newline at end of file +memmap2 = { path = "memmap2-rs" } diff --git a/solana/bridge/agent/.dockerignore b/solana/bridge/agent/.dockerignore deleted file mode 100644 index eb5a316c..00000000 --- a/solana/bridge/agent/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -target diff --git a/solana/bridge/agent/Cargo.lock b/solana/bridge/agent/Cargo.lock deleted file mode 100644 index cb126f05..00000000 --- a/solana/bridge/agent/Cargo.lock +++ /dev/null @@ -1,1038 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "agent" -version = "0.1.0" -dependencies = [ - "prost", - "prost-types", - "tokio", - "tonic", - "tonic-build", -] - -[[package]] -name = "anyhow" -version = "1.0.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" - -[[package]] -name = "async-stream" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5" -dependencies = [ - "async-stream-impl", - "futures-core", -] - -[[package]] -name = "async-stream-impl" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "async-trait" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "autocfg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" - -[[package]] -name = "fixedbitset" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "futures-channel" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" - -[[package]] -name = "futures-sink" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" - -[[package]] -name = "futures-task" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" - -[[package]] -name = "futures-util" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" -dependencies = [ - "futures-core", - "futures-task", - "pin-project", - "pin-utils", -] - -[[package]] -name = "getrandom" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "h2" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" -dependencies = [ - "autocfg", -] - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" -dependencies = [ - "libc", -] - -[[package]] -name = "http" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "httparse" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" - -[[package]] -name = "hyper" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e68a8dd9716185d9e64ea473ea6ef63529252e3e27623295a0378a19665d5eb" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "pin-project", - "socket2", - "time", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "indexmap" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b45e59b16c76b11bf9738fd5d38879d3bd28ad292d7b313608becb17ae2df9" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "itertools" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[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.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10" - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "mio" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" -dependencies = [ - "cfg-if", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "multimap" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" - -[[package]] -name = "net2" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" -dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "petgraph" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" -dependencies = [ - "fixedbitset", - "indexmap", -] - -[[package]] -name = "pin-project" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "ppv-lite86" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" - -[[package]] -name = "proc-macro2" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "prost" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" -dependencies = [ - "bytes", - "heck", - "itertools", - "log", - "multimap", - "petgraph", - "prost", - "prost-types", - "tempfile", - "which", -] - -[[package]] -name = "prost-derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-types" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" -dependencies = [ - "bytes", - "prost", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", - "rand_pcg", -] - -[[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", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" - -[[package]] -name = "socket2" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "winapi 0.3.9", -] - -[[package]] -name = "syn" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e69abc24912995b3038597a7a593be5053eb0fb44f3cc5beec0deb421790c1f4" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "tempfile" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -dependencies = [ - "cfg-if", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi 0.3.9", -] - -[[package]] -name = "time" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "tokio" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio", - "mio-uds", - "num_cpus", - "pin-project-lite", - "slab", - "tokio-macros", -] - -[[package]] -name = "tokio-macros" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tonic" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b102a19758191af97cff34c6785dffd6610f68de5ab1c4bb8378638e4ef90" -dependencies = [ - "async-stream", - "async-trait", - "base64", - "bytes", - "futures-core", - "futures-util", - "http", - "http-body", - "hyper", - "percent-encoding", - "pin-project", - "prost", - "prost-derive", - "tokio", - "tokio-util", - "tower", - "tower-balance", - "tower-load", - "tower-make", - "tower-service", - "tracing", - "tracing-futures", -] - -[[package]] -name = "tonic-build" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daec8b14e55497072204b53d5c0b1eb0a6ad1cd8301d6d4c079d4aeec35b21e9" -dependencies = [ - "proc-macro2", - "prost-build", - "quote", - "syn", -] - -[[package]] -name = "tower" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3169017c090b7a28fce80abaad0ab4f5566423677c9331bb320af7e49cfe62" -dependencies = [ - "futures-core", - "tower-buffer", - "tower-discover", - "tower-layer", - "tower-limit", - "tower-load-shed", - "tower-retry", - "tower-service", - "tower-timeout", - "tower-util", -] - -[[package]] -name = "tower-balance" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a792277613b7052448851efcf98a2c433e6f1d01460832dc60bef676bc275d4c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "pin-project", - "rand", - "slab", - "tokio", - "tower-discover", - "tower-layer", - "tower-load", - "tower-make", - "tower-ready-cache", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-buffer" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4887dc2a65d464c8b9b66e0e4d51c2fd6cf5b3373afc72805b0a60bce00446a" -dependencies = [ - "futures-core", - "pin-project", - "tokio", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-discover" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6b5000c3c54d269cc695dff28136bb33d08cbf1df2c48129e143ab65bf3c2a" -dependencies = [ - "futures-core", - "pin-project", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35d656f2638b288b33495d1053ea74c40dc05ec0b92084dd71ca5566c4ed1dc" - -[[package]] -name = "tower-limit" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c3040c5dbed68abffaa0d4517ac1a454cd741044f33ab0eefab6b8d1361404" -dependencies = [ - "futures-core", - "pin-project", - "tokio", - "tower-layer", - "tower-load", - "tower-service", -] - -[[package]] -name = "tower-load" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc79fc3afd07492b7966d7efa7c6c50f8ed58d768a6075dd7ae6591c5d2017b" -dependencies = [ - "futures-core", - "log", - "pin-project", - "tokio", - "tower-discover", - "tower-service", -] - -[[package]] -name = "tower-load-shed" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f021e23900173dc315feb4b6922510dae3e79c689b74c089112066c11f0ae4e" -dependencies = [ - "futures-core", - "pin-project", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-make" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce50370d644a0364bf4877ffd4f76404156a248d104e2cc234cd391ea5cdc965" -dependencies = [ - "tokio", - "tower-service", -] - -[[package]] -name = "tower-ready-cache" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eabb6620e5481267e2ec832c780b31cad0c15dcb14ed825df5076b26b591e1f" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "log", - "tokio", - "tower-service", -] - -[[package]] -name = "tower-retry" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6727956aaa2f8957d4d9232b308fe8e4e65d99db30f42b225646e86c9b6a952" -dependencies = [ - "futures-core", - "pin-project", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-service" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" - -[[package]] -name = "tower-timeout" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "127b8924b357be938823eaaec0608c482d40add25609481027b96198b2e4b31e" -dependencies = [ - "pin-project", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1093c19826d33807c72511e68f73b4a0469a3f22c2bd5f7d5212178b4b89674" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "tower-service", -] - -[[package]] -name = "tracing" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0aae59226cf195d8e74d4b34beae1859257efb4e5fed3f147d2dc2c7d372178" -dependencies = [ - "cfg-if", - "log", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d593f98af59ebc017c0648f0117525db358745a8894a8d684e185ba3f45954f9" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "tracing-futures" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" -dependencies = [ - "pin-project", - "tracing", -] - -[[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - -[[package]] -name = "unicode-segmentation" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[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 = "which" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" -dependencies = [ - "libc", -] - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[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-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] diff --git a/solana/bridge/agent/Cargo.toml b/solana/bridge/agent/Cargo.toml deleted file mode 100644 index 747bbe9a..00000000 --- a/solana/bridge/agent/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "agent" -version = "0.1.0" -authors = ["Hendrik Hofstadt "] -edition = "2018" - -[dependencies] -tonic = "0.3.0" -tokio = { version = "0.2", features = ["rt-threaded", "time", "stream", "fs", "macros", "uds"] } -prost = "0.6" -prost-types = "0.6" -solana-client = "=1.7.0" -solana-program = "=1.7.0" -solana-sdk = "=1.7.0" -solitaire = { path = "../../solitaire/program" } -solitaire-client = {path = "../../solitaire/client" } -bridge = { path = "../program", features = ["no-entrypoint", "client"] } -primitive-types = { version = "0.7.2" } -hex = "0.4.2" -thiserror = "1.0.20" -tungstenite = "0.11.1" -serde = "1.0.103" -url = "2.1.1" -serde_bytes = "0.11.5" -log = "0.4.11" -serde_derive = "1.0.103" -serde_json = "1.0.57" -bs58 = "0.3.1" -byteorder = "1.4.3" -futures = "0.3.8" -libc = "0.2.80" -clap = "2.33.3" -borsh = "0.8.1" -sha3 = "0.9.1" - -[build-dependencies] -tonic-build = { version = "0.3.0", features = ["prost"] } diff --git a/solana/bridge/agent/build.rs b/solana/bridge/agent/build.rs deleted file mode 100644 index cf2b7745..00000000 --- a/solana/bridge/agent/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - tonic_build::compile_protos("../../../proto/agent/v1/service.proto").unwrap(); -} diff --git a/solana/bridge/agent/src/main.rs b/solana/bridge/agent/src/main.rs deleted file mode 100644 index a439cea6..00000000 --- a/solana/bridge/agent/src/main.rs +++ /dev/null @@ -1,418 +0,0 @@ -use libc; -use std::{ - fs, - io::Write, - path::Path, - str::FromStr, -}; - -use clap::{ - App, - Arg, -}; - -use byteorder::{ - LittleEndian, - WriteBytesExt, -}; -use futures::stream::TryStreamExt; -use solana_client::{ - client_error::ClientError, - rpc_client::RpcClient, - rpc_config::RpcSendTransactionConfig, -}; -use solana_sdk::{ - commitment_config::{ - CommitmentConfig, - CommitmentLevel, - }, - instruction::Instruction, - pubkey::Pubkey, - signature::{ - read_keypair_file, - Keypair, - Signature, - Signer, - }, - transaction::Transaction, -}; -use tokio::net::UnixListener; - -use tonic::{ - transport::Server, - Code, - Request, - Response, - Status, -}; - -use borsh::BorshDeserialize; -use bridge::{ - accounts::{ - GuardianSet, - GuardianSetDerivationData, - }, - instructions::{ - hash_vaa, - post_vaa, - serialize_vaa, - verify_signatures, - }, - types::GuardianSetData, - PostVAAData, - VerifySignaturesData, -}; -use service::{ - agent_server::{ - Agent, - AgentServer, - }, - GetBalanceRequest, - GetBalanceResponse, - SubmitVaaRequest, - SubmitVaaResponse, -}; -use sha3::Digest; -use solitaire::{ - processors::seeded::Seeded, - AccountState, -}; - -mod socket; - -pub mod service { - include!(concat!(env!("OUT_DIR"), concat!("/", "agent.v1", ".rs"))); -} - -pub struct AgentImpl { - bridge: Pubkey, - - rpc_url: String, - key: Keypair, -} - -pub struct SignatureItem { - signature: Vec, - key: [u8; 20], - index: u8, -} - -#[tonic::async_trait] -impl Agent for AgentImpl { - async fn submit_vaa( - &self, - request: Request, - ) -> Result, Status> { - // Hack to clone keypair - let b = self.key.to_bytes(); - let key = Keypair::from_bytes(&b).unwrap(); - let bridge = self.bridge.clone(); - - let rpc_url = self.rpc_url.clone(); - - // we need to spawn an extra thread because tokio does not allow nested runtimes - std::thread::spawn(move || { - let rpc = RpcClient::new(rpc_url); - - let vaa = &request.get_ref().vaa.as_ref().unwrap(); - - let mut emitter_address = [0u8; 32]; - emitter_address.copy_from_slice(vaa.emitter_address.as_slice()); - let post_data = PostVAAData { - version: vaa.version as u8, - guardian_set_index: vaa.guardian_set_index, - timestamp: vaa.timestamp.as_ref().unwrap().seconds as u32, - nonce: vaa.nonce, - emitter_chain: vaa.emitter_chain as u16, - emitter_address: emitter_address, - sequence: vaa.sequence, - consistency_level: vaa.consistency_level as u8, - payload: vaa.payload.clone(), - }; - - let (verify_txs, signature_set) = - pack_sig_verification_txs(&rpc, &bridge, &post_data, &vaa.signatures, &key)?; - - // Strip signatures - let ix = post_vaa(bridge, key.pubkey(), signature_set, post_data); - - for mut tx in verify_txs { - match sign_and_send(&rpc, &mut tx, vec![&key], request.get_ref().skip_preflight) { - Ok(_) => (), - Err(e) => { - return Err(Status::new( - Code::Internal, - format!("tx sending failed: {:?}", e), - )); - } - }; - } - - let mut transaction2 = Transaction::new_with_payer(&[ix], Some(&key.pubkey())); - match sign_and_send( - &rpc, - &mut transaction2, - vec![&key], - request.into_inner().skip_preflight, - ) { - Ok(s) => Ok(Response::new(SubmitVaaResponse { - signature: s.to_string(), - })), - Err(e) => Err(Status::new( - Code::Internal, - format!("tx sending failed: {:?}", e), - )), - } - }) - .join() - .unwrap() - } - - async fn get_balance( - &self, - _request: Request, - ) -> Result, Status> { - // Hack to clone keypair - let b = self.key.pubkey(); - - let rpc_url = self.rpc_url.clone(); - - // we need to spawn an extra thread because tokio does not allow nested runtimes - std::thread::spawn(move || { - let rpc = RpcClient::new(rpc_url); - - let balance = match rpc.get_balance(&b) { - Ok(v) => v, - Err(e) => { - return Err(Status::new( - Code::Internal, - format!("failed to fetch balance: {:?}", e), - )); - } - }; - - Ok(Response::new(GetBalanceResponse { balance })) - }) - .join() - .unwrap() - } -} - -fn pack_sig_verification_txs<'a>( - rpc: &RpcClient, - bridge: &Pubkey, - vaa: &PostVAAData, - signatures: &Vec, - sender_keypair: &'a Keypair, -) -> Result<(Vec, Pubkey), Status> { - let signature_set = Keypair::new(); - // Load guardian set - let guardian_key = GuardianSet::<'_, { AccountState::Initialized }>::key( - &GuardianSetDerivationData { - index: vaa.guardian_set_index, - }, - bridge, - ); - let guardian_account = rpc - .get_account_with_commitment( - &guardian_key, - CommitmentConfig { - commitment: CommitmentLevel::Processed, - }, - ) - .unwrap() - .value - .unwrap_or_default(); - let data = guardian_account.data; - let guardian_set: GuardianSetData = GuardianSetData::try_from_slice(data.as_slice()).unwrap(); - - // Map signatures to guardian set - let mut signature_items: Vec = Vec::new(); - for s in 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 = serialize_vaa(vaa); - let body_hash: [u8; 32] = { - let mut h = sha3::Keccak256::default(); - h.write(vaa_body.as_slice())?; - h.finalize().into() - }; - - let mut verify_txs: Vec = Vec::new(); - for (_tx_index, chunk) in signature_items.chunks(6).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)?; - - // Secp signature info description (11 bytes * n) - for (i, s) in chunk.iter().enumerate() { - secp_payload.write_u16::((data_offset + 85 * i) as u16)?; - secp_payload.write_u8(0)?; - secp_payload.write_u16::((data_offset + 85 * i + 65) as u16)?; - secp_payload.write_u8(0)?; - secp_payload.write_u16::(message_offset as u16)?; - secp_payload.write_u16::(body_hash.len() as u16)?; - secp_payload.write_u8(0)?; - signature_status[s.index as usize] = i as i8; - } - - // Write signatures and addresses - for s in chunk.iter() { - secp_payload.write(&s.signature)?; - secp_payload.write(&s.key)?; - } - - // Write body - secp_payload.write(&body_hash)?; - - let secp_ix = Instruction { - program_id: solana_sdk::secp256k1_program::id(), - data: secp_payload, - accounts: vec![], - }; - - let body_hash: [u8; 32] = hash_vaa(vaa); - - let payload = VerifySignaturesData { - signers: signature_status, - }; - - let verify_ix = match verify_signatures( - *bridge, - sender_keypair.pubkey(), - vaa.guardian_set_index, - signature_set.pubkey(), - payload, - ) { - Ok(v) => v, - Err(e) => { - return Err(Status::new( - Code::InvalidArgument, - format!("could not create verify instruction: {:?}", e), - )); - } - }; - - verify_txs.push(Transaction::new_with_payer( - &[secp_ix, verify_ix], - Some(&sender_keypair.pubkey()), - )) - } - - Ok((verify_txs, signature_set.pubkey())) -} - -fn sign_and_send( - rpc: &RpcClient, - tx: &mut Transaction, - keys: Vec<&Keypair>, - skip_preflight: bool, -) -> Result { - let (recent_blockhash, _fee_calculator) = rpc.get_recent_blockhash()?; - - tx.sign(&keys, recent_blockhash); - - rpc.send_and_confirm_transaction_with_spinner_and_config( - &tx, - CommitmentConfig { - commitment: CommitmentLevel::Processed, - }, - RpcSendTransactionConfig { - skip_preflight, - preflight_commitment: Some(CommitmentLevel::Processed), - encoding: None, - }, - ) -} - -#[tokio::main] -async fn main() -> Result<(), Box> { - let matches = App::new("Wormhole Solana agent") - .arg( - Arg::with_name("bridge") - .long("bridge") - .value_name("ADDRESS") - .help("Bridge address") - .required(true) - .takes_value(true), - ) - .arg( - Arg::with_name("ws") - .long("ws") - .value_name("URI") - .help("PubSub Websocket URI (ws[s]://)") - .required(true) - .takes_value(true), - ) - .arg( - Arg::with_name("rpc") - .long("rpc") - .value_name("URI") - .help("RPC URI (http[s]://)") - .required(true) - .takes_value(true), - ) - .arg( - Arg::with_name("socket") - .long("socket") - .value_name("FILE") - .help("Path to agent socket") - .required(true) - .takes_value(true), - ) - .arg( - Arg::with_name("keypair") - .long("keypair") - .value_name("FILE") - .help("Fee payer account key ") - .required(true) - .takes_value(true), - ) - .get_matches(); - - let bridge = matches.value_of("bridge").unwrap(); - let rpc_url = matches.value_of("rpc").unwrap(); - let socket_path = matches.value_of("socket").unwrap(); - let keypair = read_keypair_file(matches.value_of("keypair").unwrap()).unwrap(); - - println!("Agent using account: {}", keypair.pubkey()); - - let agent = AgentImpl { - rpc_url: rpc_url.to_string(), - bridge: Pubkey::from_str(bridge).unwrap(), - key: keypair, - }; - - // Setting a umask appears to be the only way of safely creating a UNIX socket using - // UnixListener::bind without introducing a TOCTOU race condition. - unsafe { libc::umask(0o0077) }; - - // Delete existing socket file and recreate it with restrictive permissions. - let path = Path::new(socket_path); - if path.exists() { - fs::remove_file(path)?; - } - - let mut listener = UnixListener::bind(socket_path)?; - println!("Agent listening on {}", socket_path); - - Server::builder() - .add_service(AgentServer::new(agent)) - .serve_with_incoming(listener.incoming().map_ok(socket::UnixStream)) - .await?; - - Ok(()) -} diff --git a/solana/bridge/agent/src/socket.rs b/solana/bridge/agent/src/socket.rs deleted file mode 100644 index 4ac007c8..00000000 --- a/solana/bridge/agent/src/socket.rs +++ /dev/null @@ -1,50 +0,0 @@ -// https://github.com/hyperium/tonic/blob/2e964c78c666ecd6e6cfc37689d30300cad81f4c/examples/src/uds/server.rs#L55 -// (MIT License) - -use std::{ - pin::Pin, - task::{ - Context, - Poll, - }, -}; - -use tokio::io::{ - AsyncRead, - AsyncWrite, -}; -use tonic::transport::server::Connected; - -#[derive(Debug)] -pub struct UnixStream(pub tokio::net::UnixStream); - -impl Connected for UnixStream { -} - -impl AsyncRead for UnixStream { - fn poll_read( - mut self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut [u8], - ) -> Poll> { - Pin::new(&mut self.0).poll_read(cx, buf) - } -} - -impl AsyncWrite for UnixStream { - fn poll_write( - mut self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &[u8], - ) -> Poll> { - Pin::new(&mut self.0).poll_write(cx, buf) - } - - fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.0).poll_flush(cx) - } - - fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.0).poll_shutdown(cx) - } -}