diff --git a/Cargo.lock b/Cargo.lock index e51b8cba2..33f45cc49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,6 +158,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-json-rpc", + "alloy-network", "alloy-node-bindings", "alloy-provider", "alloy-pubsub", @@ -166,7 +167,10 @@ dependencies = [ "alloy-serde", "alloy-signer", "alloy-signer-local", + "alloy-transport", "alloy-transport-http", + "alloy-transport-ipc", + "alloy-transport-ws", ] [[package]] @@ -221,6 +225,7 @@ dependencies = [ "alloy-dyn-abi", "alloy-json-abi", "alloy-primitives 0.7.7", + "alloy-rlp", "alloy-sol-types", ] @@ -250,6 +255,7 @@ dependencies = [ "alloy-rlp", "alloy-serde", "c-kzg", + "derive_more 0.99.18", "once_cell", "serde", "sha2 0.10.8", @@ -382,6 +388,7 @@ dependencies = [ "alloy-signer-local", "alloy-transport", "alloy-transport-http", + "alloy-transport-ipc", "alloy-transport-ws", "async-stream", "async-trait", @@ -449,6 +456,7 @@ dependencies = [ "alloy-pubsub", "alloy-transport", "alloy-transport-http", + "alloy-transport-ipc", "alloy-transport-ws", "futures", "pin-project 1.1.7", @@ -467,6 +475,7 @@ name = "alloy-rpc-types" version = "0.1.4" source = "git+https://github.com/alloy-rs/alloy.git?rev=83343b172585fe4e040fb104b4d1421f58cbf9a2#83343b172585fe4e040fb104b4d1421f58cbf9a2" dependencies = [ + "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "alloy-serde", @@ -482,6 +491,23 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-rpc-types-engine" +version = "0.1.4" +source = "git+https://github.com/alloy-rs/alloy.git?rev=83343b172585fe4e040fb104b4d1421f58cbf9a2#83343b172585fe4e040fb104b4d1421f58cbf9a2" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives 0.7.7", + "alloy-rlp", + "alloy-rpc-types-eth", + "alloy-serde", + "jsonwebtoken 9.3.0", + "rand 0.8.5", + "serde", + "thiserror 1.0.69", +] + [[package]] name = "alloy-rpc-types-eth" version = "0.1.4" @@ -674,6 +700,24 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-transport-ipc" +version = "0.1.4" +source = "git+https://github.com/alloy-rs/alloy.git?rev=83343b172585fe4e040fb104b4d1421f58cbf9a2#83343b172585fe4e040fb104b4d1421f58cbf9a2" +dependencies = [ + "alloy-json-rpc", + "alloy-pubsub", + "alloy-transport", + "bytes 1.8.0", + "futures", + "interprocess", + "pin-project 1.1.7", + "serde_json", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "alloy-transport-ws" version = "0.1.4" @@ -4234,6 +4278,35 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite", + "log", + "parking", + "polling", + "rustix 0.37.28", + "slab", + "socket2 0.4.10", + "waker-fn", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener", +] + [[package]] name = "async-mutex" version = "1.4.0" @@ -4351,7 +4424,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes 1.8.0", - "fastrand", + "fastrand 2.2.0", "hex", "http 0.2.12", "ring 0.17.8", @@ -4390,7 +4463,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes 1.8.0", - "fastrand", + "fastrand 2.2.0", "http 0.2.12", "http-body 0.4.6", "once_cell", @@ -4442,7 +4515,7 @@ dependencies = [ "aws-smithy-xml", "aws-types", "bytes 1.8.0", - "fastrand", + "fastrand 2.2.0", "hex", "hmac 0.12.1", "http 0.2.12", @@ -4655,7 +4728,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "bytes 1.8.0", - "fastrand", + "fastrand 2.2.0", "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", @@ -5362,6 +5435,183 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bridge-config" +version = "0.0.2" +dependencies = [ + "alloy", + "anyhow", + "aptos-crypto", + "aptos-sdk", + "dot-movement", + "godfig", + "rand 0.7.3", + "serde", + "tokio", + "tracing-subscriber 0.3.18", +] + +[[package]] +name = "bridge-grpc" +version = "0.0.2" +dependencies = [ + "buildtime", + "prost 0.13.3", + "tonic 0.12.3", + "tonic-build", + "tonic-reflection 0.12.3", +] + +[[package]] +name = "bridge-indexer-db" +version = "0.0.2" +dependencies = [ + "anyhow", + "bigdecimal", + "bridge-util", + "chrono", + "diesel", + "diesel_migrations", + "godfig", + "hex", + "serde", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "bridge-integration-tests" +version = "0.0.2" +dependencies = [ + "alloy", + "alloy-contract", + "alloy-network", + "alloy-primitives 0.7.7", + "alloy-sol-types", + "anyhow", + "aptos-framework", + "aptos-language-e2e-tests", + "aptos-logger", + "aptos-sdk", + "aptos-types", + "bcs 0.1.6 (git+https://github.com/movementlabsxyz/bcs.git?rev=bc16d2d39cabafaabd76173dd1b04b2aa170cf0c)", + "bridge-config", + "bridge-grpc", + "bridge-service", + "bridge-setup", + "bridge-util", + "chrono", + "dot-movement", + "ethabi", + "futures", + "godfig", + "hex", + "poem", + "rand 0.7.3", + "reqwest 0.12.9", + "serde_json", + "tiny-keccak", + "tokio", + "tokio-stream", + "tonic 0.12.3", + "tracing", + "tracing-subscriber 0.3.18", + "url", +] + +[[package]] +name = "bridge-service" +version = "0.0.2" +dependencies = [ + "alloy", + "alloy-network", + "alloy-primitives 0.7.7", + "alloy-rlp", + "anyhow", + "aptos-api", + "aptos-api-types", + "aptos-sdk", + "aptos-types", + "async-stream", + "async-trait", + "bcs 0.1.6 (git+https://github.com/movementlabsxyz/bcs.git?rev=bc16d2d39cabafaabd76173dd1b04b2aa170cf0c)", + "bridge-config", + "bridge-grpc", + "bridge-indexer-db", + "bridge-util", + "delegate", + "derive-new", + "derive_more 0.99.18", + "dot-movement", + "futures", + "futures-time", + "futures-timer", + "godfig", + "hex", + "keccak-hash", + "mcr-settlement-client", + "poem", + "rand 0.7.3", + "rand_chacha 0.2.2", + "reqwest 0.12.9", + "serde", + "serde_json", + "serde_with", + "thiserror 1.0.69", + "tiny-keccak", + "tokio", + "tokio-stream", + "tonic 0.12.3", + "tracing", + "tracing-subscriber 0.3.18", + "url", +] + +[[package]] +name = "bridge-setup" +version = "0.0.2" +dependencies = [ + "alloy", + "alloy-primitives 0.7.7", + "anyhow", + "aptos-sdk", + "bridge-config", + "bridge-service", + "bridge-util", + "commander", + "dot-movement", + "ethabi", + "godfig", + "hex", + "k256", + "maptos-execution-util", + "mcr-settlement-config", + "rand 0.7.3", + "serde_json", + "tokio", + "tracing", + "tracing-subscriber 0.3.18", +] + +[[package]] +name = "bridge-util" +version = "0.0.2" +dependencies = [ + "alloy", + "anyhow", + "async-trait", + "derive_more 0.99.18", + "futures", + "hex", + "rand 0.7.3", + "serde", + "thiserror 1.0.69", + "tokio", + "tokio-stream", + "tracing", +] + [[package]] name = "bs58" version = "0.5.1" @@ -6781,6 +7031,17 @@ dependencies = [ "uuid", ] +[[package]] +name = "delegate" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "der" version = "0.5.1" @@ -6840,6 +7101,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive-new" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "derive_arbitrary" version = "1.4.1" @@ -7096,6 +7368,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +[[package]] +name = "doctest-file" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" + [[package]] name = "dot-movement" version = "0.0.2" @@ -7389,6 +7667,50 @@ dependencies = [ "version_check", ] +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3 0.10.8", + "thiserror 1.0.69", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash 0.8.0", + "impl-rlp", + "impl-serde 0.4.0", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash 0.8.0", + "impl-rlp", + "impl-serde 0.4.0", + "primitive-types 0.12.2", + "uint", +] + [[package]] name = "ethnum" version = "1.5.0" @@ -7428,6 +7750,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.2.0" @@ -7762,6 +8093,21 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.31" @@ -7785,6 +8131,18 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +[[package]] +name = "futures-time" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6404853a6824881fe5f7d662d147dc4e84ecd2259ba0378f272a71dab600758a" +dependencies = [ + "async-channel", + "async-io", + "futures-core", + "pin-project-lite", +] + [[package]] name = "futures-timer" version = "3.0.3" @@ -8692,7 +9050,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.5.7", "tokio", "tower-service", "tracing", @@ -8822,7 +9180,7 @@ dependencies = [ "http-body 1.0.1", "hyper 1.5.0", "pin-project-lite", - "socket2", + "socket2 0.5.7", "tokio", "tower-service", "tracing", @@ -9080,6 +9438,15 @@ dependencies = [ "parity-scale-codec 3.7.0", ] +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + [[package]] name = "impl-serde" version = "0.3.2" @@ -9089,6 +9456,15 @@ dependencies = [ "serde", ] +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -9235,6 +9611,21 @@ dependencies = [ "parking_lot 0.12.3", ] +[[package]] +name = "interprocess" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "894148491d817cb36b6f778017b8ac46b17408d522dd90f539d677ea938362eb" +dependencies = [ + "doctest-file", + "futures-core", + "libc", + "recvmsg", + "tokio", + "widestring 1.1.0", + "windows-sys 0.52.0", +] + [[package]] name = "io-lifetimes" version = "1.0.11" @@ -9608,6 +9999,16 @@ dependencies = [ "sha3-asm", ] +[[package]] +name = "keccak-hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b286e6b663fb926e1eeb68528e69cb70ed46c6d65871a21b2215ae8154c6d3c" +dependencies = [ + "primitive-types 0.12.2", + "tiny-keccak", +] + [[package]] name = "latest-aptos-framework-migration" version = "0.0.2" @@ -9915,6 +10316,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -12077,7 +12484,7 @@ dependencies = [ "once_cell", "parking_lot 0.12.3", "thiserror 1.0.69", - "widestring", + "widestring 0.5.1", "winapi 0.3.9", ] @@ -12705,6 +13112,12 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "parking_lot" version = "0.11.2" @@ -13293,6 +13706,22 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + [[package]] name = "polyval" version = "0.6.2" @@ -13447,7 +13876,7 @@ checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" dependencies = [ "fixed-hash 0.7.0", "impl-codec 0.5.1", - "impl-serde", + "impl-serde 0.3.2", "uint", ] @@ -13459,6 +13888,8 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash 0.8.0", "impl-codec 0.6.0", + "impl-rlp", + "impl-serde 0.4.0", "uint", ] @@ -14029,7 +14460,7 @@ dependencies = [ "quinn-udp", "rustc-hash 2.0.0", "rustls 0.23.17", - "socket2", + "socket2 0.5.7", "thiserror 2.0.7", "tokio", "tracing", @@ -14064,7 +14495,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2", + "socket2 0.5.7", "tracing", "windows-sys 0.59.0", ] @@ -14229,6 +14660,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" + [[package]] name = "redis" version = "0.22.3" @@ -14827,6 +15264,20 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "rustix" +version = "0.37.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "519165d378b97752ca44bbe15047d5d3409e875f39327546b42ac81d7e18c1b6" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + [[package]] name = "rustix" version = "0.38.40" @@ -15179,7 +15630,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03ec815b5eab420ab893f63393878d89c90fdd94c0bcc44c07abb8ad95552fb7" dependencies = [ - "fastrand", + "fastrand 2.2.0", "tempfile", "windows-sys 0.52.0", ] @@ -15838,6 +16289,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "socket2" version = "0.5.7" @@ -16314,7 +16775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", - "fastrand", + "fastrand 2.2.0", "once_cell", "rustix 0.38.40", "windows-sys 0.59.0", @@ -16560,7 +17021,7 @@ dependencies = [ "parking_lot 0.12.3", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.7", "tokio-macros", "tracing", "windows-sys 0.52.0", @@ -16617,7 +17078,7 @@ dependencies = [ "postgres-protocol", "postgres-types", "rand 0.8.5", - "socket2", + "socket2 0.5.7", "tokio", "tokio-util", "whoami", @@ -16884,7 +17345,7 @@ dependencies = [ "pin-project 1.1.7", "prost 0.13.3", "rustls-pemfile 2.2.0", - "socket2", + "socket2 0.5.7", "tokio", "tokio-rustls 0.26.0", "tokio-stream", @@ -17633,6 +18094,12 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + [[package]] name = "walkdir" version = "2.5.0" @@ -17866,6 +18333,12 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + [[package]] name = "wildmatch" version = "2.4.0" diff --git a/Cargo.toml b/Cargo.toml index 82331be8e..0d0b79119 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,8 @@ resolver = "2" members = [ -# "protocol-units/bridge/config", -# "protocol-units/bridge/setup", + "protocol-units/bridge/config", + "protocol-units/bridge/setup", "protocol-units/execution/maptos/dof", "protocol-units/execution/maptos/opt-executor", "protocol-units/execution/maptos/fin-view", @@ -35,11 +35,11 @@ members = [ "util/collections", "util/whitelist", "networks/movement/*", -# "protocol-units/bridge/service", -# "protocol-units/bridge/grpc", -# "protocol-units/bridge/integration-tests", -# #"protocol-units/bridge/indexer-db", -# "protocol-units/bridge/util", + "protocol-units/bridge/service", + "protocol-units/bridge/grpc", + "protocol-units/bridge/integration-tests", + #"protocol-units/bridge/indexer-db", + "protocol-units/bridge/util", "benches/*", "util/signing/interface", "util/signing/integrations/aptos", @@ -64,13 +64,13 @@ rust-version = "1.75" [workspace.dependencies] # internal ## bridge -#bridge-util = { path = "protocol-units/bridge/util" } -#bridge-config = { path = "protocol-units/bridge/config" } -#bridge-service = { path = "protocol-units/bridge/service" } -#bridge-setup = { path = "protocol-units/bridge/setup" } -#bridge-integration-tests = { path = "protocol-units/bridge/integration-tests" } -#bridge-grpc = { path = "protocol-units/bridge/grpc" } -#bridge-indexer-db = { path = "protocol-units/bridge/indexer-db" } +bridge-util = { path = "protocol-units/bridge/util" } +bridge-config = { path = "protocol-units/bridge/config" } +bridge-service = { path = "protocol-units/bridge/service" } +bridge-setup = { path = "protocol-units/bridge/setup" } +bridge-integration-tests = { path = "protocol-units/bridge/integration-tests" } +bridge-grpc = { path = "protocol-units/bridge/grpc" } +bridge-indexer-db = { path = "protocol-units/bridge/indexer-db" } ## buildtime buildtime = { path = "util/buildtime" } buildtime-helpers = { path = "util/buildtime/buildtime-helpers" } diff --git a/protocol-units/bridge/indexer-db/Cargo.toml b/protocol-units/bridge/indexer-db/Cargo.toml index 64b431228..4fa6fad03 100644 --- a/protocol-units/bridge/indexer-db/Cargo.toml +++ b/protocol-units/bridge/indexer-db/Cargo.toml @@ -10,12 +10,14 @@ publish = { workspace = true } rust-version = { workspace = true } [dependencies] -diesel = { workspace = true, features = ["postgres", "numeric", "r2d2", "chrono"] } -diesel_migrations = { workspace = true } -bigdecimal = { workspace = true } +# Use specific version different from Aptos core one. +# Could use workplace version when Aptos core will have upgrade for a more recent version. +diesel = { version = "2.2.4", features = ["postgres", "numeric", "r2d2", "chrono"] } +diesel_migrations = { version = "2.2.0" } +bigdecimal = "0.4.0" + serde = { workspace = true } bridge-util = { workspace = true } -bridge-config = { workspace = true } anyhow = { workspace = true } hex = { workspace = true } chrono = { workspace = true } diff --git a/protocol-units/bridge/indexer-db/src/client.rs b/protocol-units/bridge/indexer-db/src/client.rs index 59e0ab8de..bb97d1c65 100644 --- a/protocol-units/bridge/indexer-db/src/client.rs +++ b/protocol-units/bridge/indexer-db/src/client.rs @@ -1,7 +1,6 @@ use crate::migrations::run_migrations; use crate::models::*; use crate::schema::*; -use bridge_config::Config; use bridge_util::chains::bridge_contracts::BridgeContractEvent; use bridge_util::types::BridgeTransferId; use bridge_util::TransferActionType; @@ -23,8 +22,8 @@ impl Client { Self { conn } } - pub fn from_bridge_config(config: &Config) -> Result { - let conn = PgConnection::establish(&config.indexer.indexer_url) + pub fn build_from_db_url(db_url: &str) -> Result { + let conn = PgConnection::establish(&db_url) .map_err(|e| anyhow::anyhow!("Failed to connect to postgresql instance: {}", e))?; Ok(Self::new(conn)) } diff --git a/protocol-units/bridge/indexer-db/src/lib.rs b/protocol-units/bridge/indexer-db/src/lib.rs index 6ef47f00f..b22c72c04 100644 --- a/protocol-units/bridge/indexer-db/src/lib.rs +++ b/protocol-units/bridge/indexer-db/src/lib.rs @@ -1,5 +1,4 @@ use crate::client::Client; -use bridge_config::Config; use bridge_util::chains::bridge_contracts::BridgeContractMonitoring; use bridge_util::types::BridgeTransferId; use bridge_util::TransferActionType; @@ -16,7 +15,7 @@ pub async fn run_indexer_client< SOURCE: Send + TryFrom> + std::clone::Clone + 'static + std::fmt::Debug, TARGET: Send + TryFrom> + std::clone::Clone + 'static + std::fmt::Debug, >( - config: Config, + db_url: String, mut stream_source: impl BridgeContractMonitoring
, mut stream_target: impl BridgeContractMonitoring
, _relayer_actions: Option>, @@ -25,7 +24,7 @@ where Vec: From, Vec: From, { - let mut indexer_db_client = match Client::from_bridge_config(&config) { + let mut indexer_db_client = match Client::build_from_db_url(&db_url) { Ok(mut client) => { client.run_migrations()?; client diff --git a/protocol-units/bridge/service/bin/start_indexer.rs b/protocol-units/bridge/service/bin/start_indexer.rs index 962664fd2..637b40d97 100644 --- a/protocol-units/bridge/service/bin/start_indexer.rs +++ b/protocol-units/bridge/service/bin/start_indexer.rs @@ -62,7 +62,12 @@ async fn main() -> Result<()> { tracing::info!("Bridge Eth and Movement Inited. Starting bridge loop."); // Start indexer - let indexer_jh = tokio::spawn(run_indexer_client(bridge_config, eth_stream, mvt_stream, None)); + let indexer_jh = tokio::spawn(run_indexer_client( + bridge_config.indexer.indexer_url, + eth_stream, + mvt_stream, + None, + )); tokio::select! { res = eth_healh_check_jh => {