From d3788f04573e84de6a0a065ca5a72eb09ce39a8d Mon Sep 17 00:00:00 2001 From: James Prestwich <10149425+prestwich@users.noreply.github.com> Date: Fri, 9 Apr 2021 11:41:57 -0700 Subject: [PATCH] refactor: move Ethereum settings to optics-ethereum (#266) --- rust/Cargo.lock | 433 ++++++++++++++---- rust/optics-base/src/settings/mod.rs | 5 +- rust/optics-ethereum/Cargo.toml | 1 + rust/optics-ethereum/src/lib.rs | 5 +- .../src/settings.rs} | 7 +- rust/updater/Cargo.toml | 1 + rust/updater/src/settings.rs | 3 +- rust/watcher/Cargo.toml | 1 + rust/watcher/src/settings.rs | 3 +- 9 files changed, 366 insertions(+), 93 deletions(-) rename rust/{optics-base/src/settings/ethereum.rs => optics-ethereum/src/settings.rs} (96%) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index bb6e716b7..9e8fedb9a 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -43,7 +43,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" dependencies = [ "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -53,7 +53,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" dependencies = [ "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -86,6 +86,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "arrayvec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7" + [[package]] name = "async-stream" version = "0.3.0" @@ -150,6 +156,28 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base58" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" + +[[package]] +name = "base58check" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee2fe4c9a0c84515f136aaae2466744a721af6d63339c18689d9e995d74d99b" +dependencies = [ + "base58", + "sha2 0.8.2", +] + +[[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" @@ -162,6 +190,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0d27fb6b6f1e43147af148af49d49329413ba781aa0d5e10979831c210173b5" +[[package]] +name = "bech32" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" + [[package]] name = "bindgen" version = "0.57.0" @@ -187,6 +221,16 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +[[package]] +name = "bitvec" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" +dependencies = [ + "either", + "radium 0.3.0", +] + [[package]] name = "bitvec" version = "0.18.5" @@ -210,14 +254,46 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake2" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[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", - "generic-array", + "block-padding 0.2.1", + "generic-array 0.14.4", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", ] [[package]] @@ -226,6 +302,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + [[package]] name = "bumpalo" version = "3.6.1" @@ -238,11 +320,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c1bf4a04a88c54f589125563643d773f3254b5c38571395e2b591c693bbc81" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" @@ -295,20 +383,73 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "generic-array", + "generic-array 0.14.4", ] [[package]] name = "clang-sys" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54d78e30b388d4815220c8dd03fea5656b6c6d32adb59e89061552a102f8da1" +checksum = "853eda514c284c2287f4bf20ae614f8781f40a81d32ecda6e91449304dfe077c" dependencies = [ "glob", "libc", "libloading", ] +[[package]] +name = "coins-bip32" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7293fc13f56d24998ad405f2402145b27c28940e2bf0f739a1bd08f4c90af861" +dependencies = [ + "bs58", + "coins-core", + "hmac 0.7.1", + "k256", + "lazy_static", + "serde 1.0.125", + "sha2 0.8.2", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0db08d2935d0f5471ca3031101bcd72a8d31f4c238971266b0bf0b234bcf08e6" +dependencies = [ + "bitvec 0.17.4", + "coins-bip32", + "hex", + "hmac 0.10.1", + "pbkdf2", + "rand 0.7.3", + "sha2 0.9.3", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d257d975731955ee86fa7f348000c3fea09c262e84c70c11e994a85aa4f467a7" +dependencies = [ + "base58check", + "base64 0.12.3", + "bech32", + "blake2", + "digest 0.9.0", + "generic-array 0.14.4", + "hex", + "ripemd160", + "serde 1.0.125", + "serde_derive", + "sha2 0.9.3", + "sha3", + "thiserror", +] + [[package]] name = "color-eyre" version = "0.5.10" @@ -368,6 +509,12 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "const-oid" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f6b64db6932c7e49332728e3a6bd82c6b7e16016607d20923b537c3bc4c0d5f" + [[package]] name = "core-foundation" version = "0.9.1" @@ -396,14 +543,34 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[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.4", + "subtle 2.4.0", +] + [[package]] name = "crypto-mac" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" dependencies = [ - "generic-array", - "subtle", + "generic-array 0.14.4", + "subtle 2.4.0", ] [[package]] @@ -445,19 +612,37 @@ dependencies = [ "winapi", ] +[[package]] +name = "der" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f59c66c30bb7445c8320a5f9233e437e3572368099f25532a59054328899b4" +dependencies = [ + "const-oid", +] + [[package]] name = "difference" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" +[[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", + "generic-array 0.14.4", ] [[package]] @@ -473,10 +658,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fbdb4ff710acb4db8ca29f93b897529ea6d6a45626d5183b47e012aa6ae7e4" dependencies = [ "elliptic-curve 0.8.5", - "hmac", + "hmac 0.10.1", "signature", ] +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + [[package]] name = "elliptic-curve" version = "0.8.5" @@ -484,13 +675,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2db227e61a43a34915680bdda462ec0e212095518020a88a1f91acd16092c39" dependencies = [ "bitvec 0.18.5", - "digest", + "digest 0.9.0", "ff", "funty", - "generic-array", + "generic-array 0.14.4", "group", + "pkcs8", "rand_core 0.5.1", - "subtle", + "subtle 2.4.0", "zeroize", ] @@ -501,9 +693,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78fff5a5d53c2e45c2772aa2666904eaf5af581b9fc356b9da42b52bda088e6d" dependencies = [ "funty", - "generic-array", + "generic-array 0.14.4", "rand_core 0.6.2", - "subtle", + "subtle 2.4.0", ] [[package]] @@ -523,25 +715,25 @@ checksum = "1f1d4168fd77e9d9564bbdcb937efdad0df721dd159d2cb3f39d51efdbdf06f2" dependencies = [ "aes", "ctr", - "digest", + "digest 0.9.0", "hex", - "hmac", + "hmac 0.10.1", "pbkdf2", "rand 0.7.3", "scrypt", "serde 1.0.125", "serde_json", - "sha2", + "sha2 0.9.3", "sha3", "thiserror", "uuid", ] [[package]] -name = "ethabi-next" -version = "13.3.0" +name = "ethabi" +version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317f1828c48834fbe40ed37b9267742d37392f6c1f7bedb9dec7f0c62d17601c" +checksum = "c52991643379afc90bfe2df3c64d53983e59c35a82ba6e75c997cfc2880d8524" dependencies = [ "anyhow", "ethereum-types", @@ -583,7 +775,7 @@ dependencies = [ [[package]] name = "ethers" version = "0.2.2" -source = "git+https://github.com/gakonst/ethers-rs#971a8dd7a8832c3515fda3644abbabe24008ec6b" +source = "git+https://github.com/gakonst/ethers-rs#66a503d294b21bb5cbdde5f74229157764a337e3" dependencies = [ "ethers-contract", "ethers-core", @@ -595,7 +787,7 @@ dependencies = [ [[package]] name = "ethers-contract" version = "0.2.2" -source = "git+https://github.com/gakonst/ethers-rs#971a8dd7a8832c3515fda3644abbabe24008ec6b" +source = "git+https://github.com/gakonst/ethers-rs#66a503d294b21bb5cbdde5f74229157764a337e3" dependencies = [ "ethers-contract-abigen", "ethers-contract-derive", @@ -613,7 +805,7 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" version = "0.2.2" -source = "git+https://github.com/gakonst/ethers-rs#971a8dd7a8832c3515fda3644abbabe24008ec6b" +source = "git+https://github.com/gakonst/ethers-rs#66a503d294b21bb5cbdde5f74229157764a337e3" dependencies = [ "Inflector", "anyhow", @@ -630,7 +822,7 @@ dependencies = [ [[package]] name = "ethers-contract-derive" version = "0.2.2" -source = "git+https://github.com/gakonst/ethers-rs#971a8dd7a8832c3515fda3644abbabe24008ec6b" +source = "git+https://github.com/gakonst/ethers-rs#66a503d294b21bb5cbdde5f74229157764a337e3" dependencies = [ "ethers-contract-abigen", "ethers-core", @@ -644,17 +836,16 @@ dependencies = [ [[package]] name = "ethers-core" version = "0.2.2" -source = "git+https://github.com/gakonst/ethers-rs#971a8dd7a8832c3515fda3644abbabe24008ec6b" +source = "git+https://github.com/gakonst/ethers-rs#66a503d294b21bb5cbdde5f74229157764a337e3" dependencies = [ - "arrayvec", + "arrayvec 0.5.2", "bytes", "ecdsa", "elliptic-curve 0.9.6", - "ethabi-next", - "ethereum-types", + "ethabi", "funty", "futures-util", - "generic-array", + "generic-array 0.14.4", "glob", "hex", "k256", @@ -670,7 +861,7 @@ dependencies = [ [[package]] name = "ethers-middleware" version = "0.2.2" -source = "git+https://github.com/gakonst/ethers-rs#971a8dd7a8832c3515fda3644abbabe24008ec6b" +source = "git+https://github.com/gakonst/ethers-rs#66a503d294b21bb5cbdde5f74229157764a337e3" dependencies = [ "async-trait", "ethers-contract", @@ -692,10 +883,11 @@ dependencies = [ [[package]] name = "ethers-providers" version = "0.2.2" -source = "git+https://github.com/gakonst/ethers-rs#971a8dd7a8832c3515fda3644abbabe24008ec6b" +source = "git+https://github.com/gakonst/ethers-rs#66a503d294b21bb5cbdde5f74229157764a337e3" dependencies = [ "async-trait", "auto_impl", + "bytes", "ethers-core", "futures-channel", "futures-core", @@ -709,6 +901,7 @@ dependencies = [ "thiserror", "tokio", "tokio-tungstenite", + "tokio-util", "tracing", "tracing-futures", "url", @@ -717,9 +910,11 @@ dependencies = [ [[package]] name = "ethers-signers" version = "0.2.2" -source = "git+https://github.com/gakonst/ethers-rs#971a8dd7a8832c3515fda3644abbabe24008ec6b" +source = "git+https://github.com/gakonst/ethers-rs#66a503d294b21bb5cbdde5f74229157764a337e3" dependencies = [ "async-trait", + "coins-bip32", + "coins-bip39", "elliptic-curve 0.9.6", "eth-keystore", "ethers-core", @@ -727,7 +922,7 @@ dependencies = [ "futures-util", "hex", "rand 0.7.3", - "sha2", + "sha2 0.9.3", "thiserror", ] @@ -741,6 +936,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + [[package]] name = "ff" version = "0.8.0" @@ -749,7 +950,7 @@ checksum = "01646e077d4ebda82b73f1bca002ea1e91561a77df2431a9e79729bcc31950ef" dependencies = [ "bitvec 0.18.5", "rand_core 0.5.1", - "subtle", + "subtle 2.4.0", ] [[package]] @@ -889,6 +1090,15 @@ dependencies = [ "slab", ] +[[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.4" @@ -941,7 +1151,7 @@ checksum = "cc11f9f5fbf1943b48ae7c2bf6846e7d827a512d1be4f23af708f5ca5d01dde1" dependencies = [ "ff", "rand_core 0.5.1", - "subtle", + "subtle 2.4.0", ] [[package]] @@ -975,21 +1185,31 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[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.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ - "crypto-mac", - "digest", + "crypto-mac 0.10.0", + "digest 0.9.0", ] [[package]] name = "http" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" dependencies = [ "bytes", "fnv", @@ -1009,9 +1229,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.5" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" +checksum = "bc35c995b9d93ec174cf9a27d425c7892722101e14993cd227fdb51d70cf9589" [[package]] name = "httpdate" @@ -1209,7 +1429,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21f866863575d0e1d654fbeeabdc927292fdf862873dc3c96c6f753357e13374" dependencies = [ - "arrayvec", + "arrayvec 0.5.2", "bitflags", "cfg-if", "ryu", @@ -1218,9 +1438,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.91" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" +checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" [[package]] name = "libloading" @@ -1235,7 +1455,7 @@ dependencies = [ [[package]] name = "librocksdb-sys" version = "6.17.3" -source = "git+https://github.com/rust-rocksdb/rust-rocksdb#bc59596da15867510133d60822e615ef6e3a1ca4" +source = "git+https://github.com/rust-rocksdb/rust-rocksdb#0b700fe70da8ee30483fde79f44df549f8fe11ec" dependencies = [ "bindgen", "cc", @@ -1450,6 +1670,12 @@ version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" +[[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" @@ -1533,6 +1759,7 @@ name = "optics-ethereum" version = "0.1.0" dependencies = [ "async-trait", + "color-eyre", "ethers", "optics-core", "serde 1.0.125", @@ -1568,11 +1795,11 @@ checksum = "2386b4ebe91c2f7f51082d4cefa145d030e33a1842a96b12e4885cc3c01f7a55" [[package]] name = "parity-scale-codec" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cd3dab59b5cf4bc81069ade0fc470341a1ef3ad5fa73e5a8943bed2ec12b2e8" +checksum = "731f4d179ed52b1c7eeb29baf29c604ea9301b889b23ce93660220a5465d5c6f" dependencies = [ - "arrayvec", + "arrayvec 0.7.0", "bitvec 0.20.2", "byte-slice-cast", "serde 1.0.125", @@ -1595,10 +1822,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf916dd32dd26297907890d99dc2740e33f6bd9073965af4ccff2967962f5508" dependencies = [ "base64ct", - "crypto-mac", - "hmac", + "crypto-mac 0.10.0", + "hmac 0.10.1", "password-hash", - "sha2", + "sha2 0.9.3", ] [[package]] @@ -1645,6 +1872,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4839a901843f3942576e65857f0ebf2e190ef7024d3c62a94099ba3f819ad1d" +dependencies = [ + "der", +] + [[package]] name = "pkg-config" version = "0.3.19" @@ -1737,9 +1973,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid", ] @@ -1943,7 +2179,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" dependencies = [ - "base64", + "base64 0.13.0", "bytes", "encoding_rs", "futures-core", @@ -1988,6 +2224,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "ripemd160" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + [[package]] name = "rlp" version = "0.5.0" @@ -2001,7 +2248,7 @@ dependencies = [ [[package]] name = "rocksdb" version = "0.15.0" -source = "git+https://github.com/rust-rocksdb/rust-rocksdb#bc59596da15867510133d60822e615ef6e3a1ca4" +source = "git+https://github.com/rust-rocksdb/rust-rocksdb#0b700fe70da8ee30483fde79f44df549f8fe11ec" dependencies = [ "libc", "librocksdb-sys", @@ -2037,7 +2284,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" dependencies = [ - "base64", + "base64 0.13.0", "log", "ring", "sct", @@ -2076,11 +2323,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19230d10daad7f163d8c1fc8edf84fbe52ac71c2ebe5adf3f763aa1557b843e3" dependencies = [ "base64ct", - "hmac", + "hmac 0.10.1", "password-hash", "pbkdf2", "salsa20", - "sha2", + "sha2 0.9.3", ] [[package]] @@ -2133,9 +2380,9 @@ dependencies = [ [[package]] name = "serde-aux" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162d500b846a7b331e583abaaa9c5c63c5777aa515dda3567c410ba243ce8be" +checksum = "77eb8c83f6ebaedf5e8f970a8a44506b180b8e6268de03885c8547031ccaee00" dependencies = [ "serde 1.0.125", "serde_json", @@ -2203,11 +2450,23 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if", "cpuid-bool", - "digest", - "opaque-debug", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[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]] @@ -2216,11 +2475,11 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if", "cpuid-bool", - "digest", - "opaque-debug", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -2229,10 +2488,10 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.9.0", + "digest 0.9.0", "keccak", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -2256,7 +2515,7 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" dependencies = [ - "digest", + "digest 0.9.0", "rand_core 0.5.1", ] @@ -2305,6 +2564,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[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.0" @@ -2313,9 +2578,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" +checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb" dependencies = [ "proc-macro2", "quote", @@ -2382,9 +2647,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" dependencies = [ "tinyvec_macros", ] @@ -2623,7 +2888,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" dependencies = [ - "base64", + "base64 0.13.0", "byteorder", "bytes", "http", @@ -2657,9 +2922,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" dependencies = [ "matches", ] @@ -2698,6 +2963,7 @@ dependencies = [ "mockall", "optics-base", "optics-core", + "optics-ethereum", "optics-test", "rocksdb", "serde 1.0.125", @@ -2851,6 +3117,7 @@ dependencies = [ "log", "optics-base", "optics-core", + "optics-ethereum", "optics-test", "rocksdb", "serde 1.0.125", @@ -2885,9 +3152,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" dependencies = [ "webpki", ] diff --git a/rust/optics-base/src/settings/mod.rs b/rust/optics-base/src/settings/mod.rs index 2734bf408..0a53eb380 100644 --- a/rust/optics-base/src/settings/mod.rs +++ b/rust/optics-base/src/settings/mod.rs @@ -5,14 +5,11 @@ use std::{collections::HashMap, env, sync::Arc}; use crate::{db, home::Homes, replica::Replicas}; -/// Ethereum configuration -pub mod ethereum; - /// Tracing configuration pub mod log; -use ethereum::EthereumConf; use log::TracingConfig; +use optics_ethereum::settings::EthereumConf; use crate::agent::AgentCore; diff --git a/rust/optics-ethereum/Cargo.toml b/rust/optics-ethereum/Cargo.toml index ed83dcf32..8ab149da1 100644 --- a/rust/optics-ethereum/Cargo.toml +++ b/rust/optics-ethereum/Cargo.toml @@ -13,5 +13,6 @@ serde_json = { version = "1.0.61", default-features = false } ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["abigen"] } async-trait = { version = "0.1.42", default-features = false } tracing = "0.1.22" +color-eyre = "0.5.0" optics-core = { path = "../optics-core" } diff --git a/rust/optics-ethereum/src/lib.rs b/rust/optics-ethereum/src/lib.rs index 116dee244..ea70e2577 100644 --- a/rust/optics-ethereum/src/lib.rs +++ b/rust/optics-ethereum/src/lib.rs @@ -15,5 +15,8 @@ mod replica; /// Base trait for an agent mod utils; +/// Configuration structs +pub mod settings; + #[cfg(not(doctest))] -pub use crate::{home::EthereumHome, replica::EthereumReplica}; +pub use crate::{home::EthereumHome, replica::EthereumReplica, settings::EthereumSigner}; diff --git a/rust/optics-base/src/settings/ethereum.rs b/rust/optics-ethereum/src/settings.rs similarity index 96% rename from rust/optics-base/src/settings/ethereum.rs rename to rust/optics-ethereum/src/settings.rs index f50af3b19..7b9386176 100644 --- a/rust/optics-base/src/settings/ethereum.rs +++ b/rust/optics-ethereum/src/settings.rs @@ -30,14 +30,14 @@ macro_rules! construct_box_contract { ($contract:ident, $name:expr, $domain:expr, $address:expr, $provider:expr, $signer:expr) => {{ if let Some(signer) = $signer { let provider = ethers::middleware::SignerMiddleware::new($provider, signer); - Box::new(optics_ethereum::$contract::new( + Box::new(crate::$contract::new( $name, $domain, $address, provider.into(), )) } else { - Box::new(optics_ethereum::$contract::new( + Box::new(crate::$contract::new( $name, $domain, $address, @@ -105,7 +105,8 @@ pub struct EthereumConf { } impl EthereumConf { - fn signer(&self) -> Option { + /// Try to get a signer from the config + pub fn signer(&self) -> Option { self.signer.try_into_signer().ok() } diff --git a/rust/updater/Cargo.toml b/rust/updater/Cargo.toml index bdf3c8c87..129d74108 100644 --- a/rust/updater/Cargo.toml +++ b/rust/updater/Cargo.toml @@ -22,6 +22,7 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb" } optics-core = { path = "../optics-core" } optics-base = { path = "../optics-base" } +optics-ethereum = { path = "../optics-ethereum" } [dev-dependencies] mockall = "0.9.1" diff --git a/rust/updater/src/settings.rs b/rust/updater/src/settings.rs index 29e88eb5b..844a0dfde 100644 --- a/rust/updater/src/settings.rs +++ b/rust/updater/src/settings.rs @@ -1,5 +1,6 @@ //! Configuration -use optics_base::{decl_settings, settings::ethereum::EthereumSigner}; +use optics_base::decl_settings; +use optics_ethereum::EthereumSigner; decl_settings!(Settings { agent: "updater", diff --git a/rust/watcher/Cargo.toml b/rust/watcher/Cargo.toml index 79e383a61..d7e657428 100644 --- a/rust/watcher/Cargo.toml +++ b/rust/watcher/Cargo.toml @@ -22,6 +22,7 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb" } optics-core = { path = "../optics-core" } optics-base = { path = "../optics-base" } +optics-ethereum = { path = "../optics-ethereum" } [dev-dependencies] tokio-test = "0.4.0" diff --git a/rust/watcher/src/settings.rs b/rust/watcher/src/settings.rs index aacf284cc..6b68c913c 100644 --- a/rust/watcher/src/settings.rs +++ b/rust/watcher/src/settings.rs @@ -1,6 +1,7 @@ //! Configuration -use optics_base::{decl_settings, settings::ethereum::EthereumSigner}; +use optics_base::decl_settings; +use optics_ethereum::EthereumSigner; decl_settings!(Settings { agent: "watcher",