Skip to content

Commit 4196e90

Browse files
[CCCP-295] Migrate to alloy (#168)
* CCCP-295, chore: update abi * CCCP-295, chore: fix typo * CCCP-295, feature: migrate into alloy-rs (WIP) * CCCP-295, fix: remove redundant find * CCCP-295, chore: move deps to mod * CCCP-295, refactor: `fn get_sorted_signatures()` * CCCP-295, refactor: remove unused dependencies and simplify transaction handling - Removed `byteorder` dependency from `Cargo.toml` files in both root and client directories. - Updated transaction handling in various handlers to utilize `send_transaction` function for better task management and error handling. - Introduced `SpawnTaskHandle` in several handlers to facilitate asynchronous task spawning. - Cleaned up unused code and commented-out sections across multiple files, enhancing overall code readability and maintainability. - Adjusted imports and struct definitions to reflect the removal of redundant components. This commit streamlines the codebase by eliminating unnecessary dependencies and improving the transaction processing flow. * CCCP-295, refactor: streamline transaction management and clean up code - Removed unused traits and functions related to transaction management, enhancing code clarity. - Simplified imports by eliminating unnecessary components, focusing on essential dependencies. * CCCP-295, refactor: restart tasks separately on error (WIP) * CCCP-295, feat: move retry transport layer & add `br_metrics::increase_rpc_calls` * CCCP-295, feature: implement txpool flushing mechanism - Added a new method `flush_stalled_transactions` to handle stalled transactions in the transaction pool. - Enhanced transaction management by adjusting gas prices for legacy and EIP-1559 transactions based on current market conditions. - Updated the `send_transaction` function to call `flush_stalled_transactions` when encountering a "nonce too low" error, improving error handling and transaction reliability. * CCCP-295, chore: remove unnecessary locking * CCCP-476, feat: support core * CCCP-295, deps: update polkadot-sdk * CCCP-295, chore: update alloy to 0.8 * CCCP-295, refactor: simplify signature recovery in `recover_message` function * CCCP-295, refactor: migrate to AnyNetwork for improved flexibility in network handling - Updated various components to use `AnyNetwork` instead of specific network types, enhancing the adaptability of the codebase. - Adjusted type constraints in multiple structs and traits to accommodate the new network abstraction. * CCCP-295, chore: keypair_migrator never return * CCCP-295, chore: update doc comment * CCCP-295, chore: add missing sleep * CCCP-295, fix: check every chainlink feed existence * CCCP-295, fix: add missing tickers * CCCP-295, refactor: impl From trait for EthereumSignature * CCCP-295, fix: correct gas fee assignment in send_transaction function for bifrost network * CCCP-295, fix: use DynSolValue to encode poll input * CCCP-295, refactor: use max() * CCCP-295, fix: padding issue * CCCP-295, chore: gas coefficient * CCCP-295, chore: resolve clippy * CCCP-295, chore: debug_mode * feat: rollback barrier count * fix: is sequentially increased * CCCP-295, rollback sequential check and roundup barrier * CCCP-295, fix: use right encode * CCCP-295, fix: no relay to non relay target * CCCP-295, fix: bsc `estimateGas` issue * CCCP-295, fix: round relay sequential issue * CCCP-295, fix: add missing condition * CCCP-295, feature: flush txpool when tx fails to confirmed while 3 block pass * CCCP-295, feature: synchronous send transaction on bootstrap roundup relay * CCCP-295, fix: add flush condition * CCCP-295, refactor: simplify log processing in roundup relay handler * CCCP-295, refactor: streamline event handling and bootstrap state synchronization across BTC and ETH handlers * CCCP-295, fix: state check location * CCCP-295, fix: recursive issue * CCCP-295, fix: add transaction flushing on nonce too low error in roundup relay handler * CCCP-295, feat: retry on already known * CCCP-295, deps: bump sentry * CCCP-295, fix: use `CachedNonceManager` * CCCP-295, fix: fill chain_id * CCCP-295, chore: print sentry client init log * CCCP-295, fix: fillers * CCCP-295, refactor: roundup phase2 bootstrap * CCCP-295, refactor: bootstrap * CCCP-295, refactor: * CCCP-295, fix: comparison by ord for bootstrapstate * CCCP-295, fix: skip bootstrap when start from NormalStart * CCCP-295, fix: use signature constant * CCCP-295, deps: release v2.1.1 * CCCP-475 integrate aws-kms (#170) * CCCP-475, feature: dynamic signer (Local | AWS KMS) * CCCP-475, fix: make `private_key` field optional * CCCP-295, chore: wait for 3 block * CCCP-295, refactor: enhance transaction flushing logic and logging - Updated transaction handling to support different transaction types (Legacy and EIP1559). - Improved nonce management for pending transactions. - Added detailed logging for transaction flushing process, including success and failure messages. * CCCP-295, fix: also flush txpool: queued * CCCP-295, chore: add logs * CCCP-295, fix: flushing txpool on startup * CCCP-295, fix: empty check * CCCP-295, fix: deserialize to SecretString * CCCP-295, fix: use static tx timeout * CCCP-295, fix: remove unwrap * CCCP-295, fix: add missing relay target check * CCCP-295, fix: move wait_until_next_time * CCCP-488, support kms integrated keystore (#171) * CCCP-488, feat: init kms keystore * CCCP-488, chore: refactor * CCCP-488, chore: refactor service * CCCP-488, chore: add doc string * CCCP-488, fix: resolve conflict * CCCP-295, feat: init migrate-keystore cli * CCCP-488, refactor: init new password keystore * CCCP-488, fix: remove key_pair() usage * CCCP-488, fix: update migrate-keystore cli * CCCP-488, fix: support v1 keystore migration * CCCP-488, fix: remove some unwrap * CCCP-488, docs: add readme * CCCP-488, fix: allow optional keystore config * CCCP-488, test: test kms keystore * CCCP-488, test: test kms keystore decryption * CCCP-488, chore: apply cargo-clippy * refactor: remove `Display` implementation for `HandlerType` * CCCP-488, refactor: rewrite in dyn Trait * CCCP-488, fix: use fixed length aes key * CCCP-488, test: fix test_create_new_keypair_v1 * CCCP-488, fix: init aws client only once if needed * CCCP-488, chore: check decrypted pair * CCCP-488, chore: simplify expression * CCCP-488, chore: remove redundant, rename variables * CCCP-488, fix: wrap with block_in_place * chore: remove unused config parameter * chore: cleanup dependencies & migrate to 2024 * CCCP-488, fix: increase pending tx timeout * CCCP-488, fix: use stable branch --------- Co-authored-by: alstjd0921 <kwonarseus@gmail.com> * chore: update alloy to 0.12 * chore: remove unused feature * [CCCP-506] allow multiple signers for `signer_config` field (#173) * feature: multi account wallet for smooth relayer account update * feature: implement fn update_default_address * chore: log * CCCP-506, chore: vectorize signer_config * CCCP-506, chore: add doc-strings and update log * CCCP-506, chore: move log * CCCP-506, fix: remove redundant from field setters --------- Co-authored-by: dnjscksdn98 <dnjscksdn98@gmail.com> * fix: use proper chainid * fix: move signer update to the last step * relay as previous selected (#175) * fix: roundup relay as prev selected relayer * fix: remove helpless verify * fix: bootstrap * fix: pass previous round --------- Co-authored-by: dnjscksdn98 <dnjscksdn98@gmail.com> * fix: non-retryable errors * feat: check vote majority before send * chore: no logging for `already executed` errors * fix: use correct syntax * CCCP-514, feat: check bitcoin provider sync, add sentry alerts (#176) * CCCP-514, feat: check bitcoin provider sync, add sentry alerts * Improve bootstrap process (#177) * resolve bootstrap order * cleanup * fix: move block init, check if NormalStart * fix: use correct bootstrap round offset * CCCP-515, fix: check non-zero volume, symbol update (#178) * CCCP-295, fix: properly handle potential deadlocks * CCCP-295, fix: panic on-bootstrap-0 * CCCP-295, fix: set from field before flushing * CCCP-295, feat: check block rollback --------- Co-authored-by: Alex Won <dnjscksdn98@gmail.com>
1 parent fcb57a6 commit 4196e90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5517
-5412
lines changed

Cargo.toml

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[workspace]
2-
resolver = "2"
2+
resolver = "3"
33
members = [
4-
"client",
5-
"client/cli",
6-
"metrics",
7-
"periodic",
8-
"primitives",
9-
"relayer",
4+
"client",
5+
"client/cli",
6+
"metrics",
7+
"periodic",
8+
"primitives",
9+
"relayer",
1010
]
1111

1212
[profile.release]
@@ -15,70 +15,84 @@ panic = "unwind"
1515
[workspace.package]
1616
authors = ["bifrost-platform"]
1717
homepage = "https://www.bifrostnetwork.com"
18-
edition = "2021"
18+
edition = "2024"
1919
license = "Apache-2.0"
2020
repository = "https://github.com/bifrost-platform/bifrost-relayer.rs"
2121

2222
[workspace.dependencies]
2323
# General
2424
log = "0.4.20"
2525
env_logger = "0.10.0"
26-
sentry = { version = "0.32.1", default-features = false, features = [
27-
"reqwest",
28-
"rustls",
29-
"backtrace",
30-
"contexts",
31-
"panic",
26+
sentry = { version = "0.36.0", default-features = false, features = [
27+
"reqwest",
28+
"rustls",
29+
"backtrace",
30+
"contexts",
31+
"panic",
32+
] }
33+
secrecy = { version = "0.8.0", default-features = false, features = [
34+
"alloc",
35+
"serde",
3236
] }
3337

3438
async-trait = "0.1.73"
35-
async-recursion = "1.0.5"
3639
clap = "4.4.6"
37-
cron = "0.12.0"
40+
cron = "0.15.0"
3841
chrono = "0.4.31"
39-
thiserror = "1.0.49"
42+
thiserror = "2.0.11"
4043
futures = "0.3.28"
4144
reqwest = { version = "0.12.5", default-features = false, features = [
42-
"rustls-tls",
43-
"json",
44-
"http2",
45+
"rustls-tls",
46+
"json",
47+
"http2",
4548
] }
46-
rand = "0.8.5"
49+
rand = "0.9.0"
4750
lazy_static = "1.4.0"
4851
url = "2.5.0"
4952
array-bytes = "6.1"
53+
eyre = "0.6"
54+
tower = "0.5.0"
5055

5156
serde_yaml = "0.9.25"
5257
serde = "1.0.188"
5358
serde_json = "1.0.107"
5459

5560
hex = "0.4.3"
56-
ethers = { git = "https://github.com/bifrost-platform/ethers-rs", tag = "ethers-v2.0.10-arbitrum-support" }
61+
alloy = { version = "0.12", default-features = false, features = [
62+
"full",
63+
"reqwest-rustls-tls",
64+
"json-rpc",
65+
"signer-aws",
66+
] }
5767
k256 = "0.13.1"
5868
sha3 = "0.10.8"
69+
aes-gcm = "0.10.3"
70+
71+
aws-sdk-kms = "1.54.0"
72+
aws-config = { version = "1.5.13", features = ["behavior-version-latest"] }
5973

6074
miniscript = "11.0.0"
6175
bitcoincore-rpc = { git = "https://github.com/bifrost-platform/rust-bitcoincore-rpc", branch = "reqwest-migration" }
6276

63-
tokio = "1.33.0"
64-
tokio-stream = "0.1.14"
77+
tokio = "1.43.0"
78+
tokio-stream = "0.1.17"
6579

66-
subxt = "0.37.0"
80+
subxt = "0.39.0"
6781

6882
# Substrate Clients
69-
sc-cli = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-v1.12.0" }
70-
sc-utils = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-v1.12.0" }
71-
sc-service = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-v1.12.0" }
72-
sc-sysinfo = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-v1.12.0" }
73-
sc-keystore = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-v1.12.0" }
74-
prometheus-endpoint = { package = "substrate-prometheus-endpoint", default-features = false, git = "https://github.com/bifrost-platform/polkadot-sdk", branch = "bifrost-polkadot-v1.12.0" }
83+
sc-cli = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-stable2407" }
84+
sc-utils = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-stable2407" }
85+
sc-service = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-stable2407" }
86+
sc-sysinfo = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-stable2407" }
87+
sc-keystore = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-stable2407" }
88+
prometheus-endpoint = { package = "substrate-prometheus-endpoint", default-features = false, git = "https://github.com/bifrost-platform/polkadot-sdk", branch = "bifrost-polkadot-stable2407" }
7589

7690
# Substrate Primitives
77-
sp-core = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-v1.12.0" }
78-
sp-application-crypto = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-v1.12.0" }
91+
sp-core = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-stable2407" }
92+
sp-application-crypto = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-stable2407" }
7993

8094
# Substrate Builds
81-
substrate-build-script-utils = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-v1.12.0" }
95+
substrate-build-script-utils = { git = "https://github.com/bifrost-platform/polkadot-sdk", default-features = false, branch = "bifrost-polkadot-stable2407" }
8296

8397
[profile.production]
8498
inherits = "release"

abi/abi.socket.bitcoin.json

Lines changed: 21 additions & 21 deletions
Large diffs are not rendered by default.

abi/abi.socket.merged.json

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@
143143
{
144144
"components": [
145145
{
146-
"internalType": "ChainIndex",
147-
"name": "chain",
146+
"internalType": "bytes4",
147+
"name": "ChainIndex",
148148
"type": "bytes4"
149149
},
150150
{
@@ -170,13 +170,13 @@
170170
{
171171
"components": [
172172
{
173-
"internalType": "ChainIndex",
174-
"name": "chain",
173+
"internalType": "bytes4",
174+
"name": "ChainIndex",
175175
"type": "bytes4"
176176
},
177177
{
178-
"internalType": "RBCmethod",
179-
"name": "method",
178+
"internalType": "bytes16",
179+
"name": "RBCmethod",
180180
"type": "bytes16"
181181
}
182182
],
@@ -187,12 +187,12 @@
187187
{
188188
"components": [
189189
{
190-
"internalType": "Asset_Index",
190+
"internalType": "bytes32",
191191
"name": "tokenIDX0",
192192
"type": "bytes32"
193193
},
194194
{
195-
"internalType": "Asset_Index",
195+
"internalType": "bytes32",
196196
"name": "tokenIDX1",
197197
"type": "bytes32"
198198
},
@@ -272,8 +272,8 @@
272272
"name": "BFC_MAIN",
273273
"outputs": [
274274
{
275-
"internalType": "ChainIndex",
276-
"name": "",
275+
"internalType": "bytes4",
276+
"name": "ChainIndex",
277277
"type": "bytes4"
278278
}
279279
],
@@ -496,8 +496,8 @@
496496
{
497497
"components": [
498498
{
499-
"internalType": "ChainIndex",
500-
"name": "chain",
499+
"internalType": "bytes4",
500+
"name": "ChainIndex",
501501
"type": "bytes4"
502502
},
503503
{
@@ -537,8 +537,8 @@
537537
{
538538
"components": [
539539
{
540-
"internalType": "ChainIndex",
541-
"name": "chain",
540+
"internalType": "bytes4",
541+
"name": "ChainIndex",
542542
"type": "bytes4"
543543
},
544544
{
@@ -626,8 +626,8 @@
626626
{
627627
"components": [
628628
{
629-
"internalType": "ChainIndex",
630-
"name": "chain",
629+
"internalType": "bytes4",
630+
"name": "ChainIndex",
631631
"type": "bytes4"
632632
},
633633
{
@@ -818,8 +818,8 @@
818818
{
819819
"components": [
820820
{
821-
"internalType": "ChainIndex",
822-
"name": "chain",
821+
"internalType": "bytes4",
822+
"name": "ChainIndex",
823823
"type": "bytes4"
824824
},
825825
{
@@ -845,13 +845,13 @@
845845
{
846846
"components": [
847847
{
848-
"internalType": "ChainIndex",
849-
"name": "chain",
848+
"internalType": "bytes4",
849+
"name": "ChainIndex",
850850
"type": "bytes4"
851851
},
852852
{
853-
"internalType": "RBCmethod",
854-
"name": "method",
853+
"internalType": "bytes16",
854+
"name": "RBCmethod",
855855
"type": "bytes16"
856856
}
857857
],
@@ -862,12 +862,12 @@
862862
{
863863
"components": [
864864
{
865-
"internalType": "Asset_Index",
865+
"internalType": "bytes32",
866866
"name": "tokenIDX0",
867867
"type": "bytes32"
868868
},
869869
{
870-
"internalType": "Asset_Index",
870+
"internalType": "bytes32",
871871
"name": "tokenIDX1",
872872
"type": "bytes32"
873873
},
@@ -1354,8 +1354,8 @@
13541354
{
13551355
"inputs": [
13561356
{
1357-
"internalType": "ChainIndex",
1358-
"name": "_this",
1357+
"internalType": "bytes4",
1358+
"name": "ChainIndex",
13591359
"type": "bytes4"
13601360
}
13611361
],
@@ -1447,8 +1447,8 @@
14471447
"name": "this_chain",
14481448
"outputs": [
14491449
{
1450-
"internalType": "ChainIndex",
1451-
"name": "",
1450+
"internalType": "bytes4",
1451+
"name": "ChainIndex",
14521452
"type": "bytes4"
14531453
}
14541454
],
@@ -1460,8 +1460,8 @@
14601460
{
14611461
"components": [
14621462
{
1463-
"internalType": "ChainIndex",
1464-
"name": "chain",
1463+
"internalType": "bytes4",
1464+
"name": "ChainIndex",
14651465
"type": "bytes4"
14661466
},
14671467
{
@@ -1484,13 +1484,13 @@
14841484
{
14851485
"components": [
14861486
{
1487-
"internalType": "ChainIndex",
1488-
"name": "chain",
1487+
"internalType": "bytes4",
1488+
"name": "ChainIndex",
14891489
"type": "bytes4"
14901490
},
14911491
{
1492-
"internalType": "RBCmethod",
1493-
"name": "method",
1492+
"internalType": "bytes16",
1493+
"name": "RBCmethod",
14941494
"type": "bytes16"
14951495
}
14961496
],
@@ -1501,12 +1501,12 @@
15011501
{
15021502
"components": [
15031503
{
1504-
"internalType": "Asset_Index",
1504+
"internalType": "bytes32",
15051505
"name": "tokenIDX0",
15061506
"type": "bytes32"
15071507
},
15081508
{
1509-
"internalType": "Asset_Index",
1509+
"internalType": "bytes32",
15101510
"name": "tokenIDX1",
15111511
"type": "bytes32"
15121512
},
@@ -1578,13 +1578,13 @@
15781578
{
15791579
"components": [
15801580
{
1581-
"internalType": "ChainIndex",
1582-
"name": "chain",
1581+
"internalType": "bytes4",
1582+
"name": "ChainIndex",
15831583
"type": "bytes4"
15841584
},
15851585
{
1586-
"internalType": "RBCmethod",
1587-
"name": "method",
1586+
"internalType": "bytes16",
1587+
"name": "RBCmethod",
15881588
"type": "bytes16"
15891589
}
15901590
],
@@ -1595,12 +1595,12 @@
15951595
{
15961596
"components": [
15971597
{
1598-
"internalType": "Asset_Index",
1598+
"internalType": "bytes32",
15991599
"name": "tokenIDX0",
16001600
"type": "bytes32"
16011601
},
16021602
{
1603-
"internalType": "Asset_Index",
1603+
"internalType": "bytes32",
16041604
"name": "tokenIDX1",
16051605
"type": "bytes32"
16061606
},

0 commit comments

Comments
 (0)