Skip to content

Commit d0d24da

Browse files
committed
feat: last redesign of gas bumping
1 parent 581460a commit d0d24da

File tree

16 files changed

+360
-143
lines changed

16 files changed

+360
-143
lines changed

TODO.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
## TODO List
44

55
31st September plan:
6-
- Last change for the gas bumping + price in bump_every config
76
- Look into authentication to login and then use it outside rrelayer.yaml
87
- Reread documentation
98
- TransactionSpeed code snippets tag default
9+
- max_gas_price_multiplier: 4
1010
- Get CI builds / releases working
11-
- Testing
12-
- loading up ALL supported gas providers so it works
13-
- Testing handling custom gas with http call
14-
- Release—20:00 UK time
1511

1612
# AFTER
1713

18-
- Create CI to run E2E tests on push
19-
- Write go and python SDK (create issues)
20-
- cron job to hit a contract call with parameters every n minutes
21-
- send tx on event firing using rindexer
14+
- Testing
15+
- loading up ALL supported gas providers so it works
16+
- Testing handling custom gas with http call
17+
- Create CI to run E2E tests on push

crates/cli/src/commands/network.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ async fn handle_add(project_path: &ProjectLocation) -> Result<(), NetworkError>
109109
api_keys: None,
110110
enable_sending_blobs: Some(true),
111111
gas_bump_blocks_every: Default::default(),
112+
max_gas_price_multiplier: 4,
112113
});
113114

114115
project_path.overwrite_setup_config(setup_config)?;

crates/cli/src/commands/new.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub async fn handle_init(path: &Path) -> Result<(), InitError> {
7373
api_keys: None,
7474
enable_sending_blobs: Some(true),
7575
gas_bump_blocks_every: Default::default(),
76+
max_gas_price_multiplier: 4,
7677
}],
7778
gas_providers: None,
7879
api_config: ApiConfig {

crates/core/src/relayer/api/clone_relayer.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ pub async fn clone_relayer(
5252
let id = relayer.id;
5353
let address = relayer.address;
5454

55-
let gas_bump_config = state
56-
.network_configs
57-
.iter()
58-
.find(|config| config.chain_id == relayer.chain_id)
59-
.map(|config| config.gas_bump_blocks_every.clone())
60-
.unwrap_or_default();
55+
let network_config =
56+
state.network_configs.iter().find(|config| config.chain_id == relayer.chain_id);
57+
58+
let gas_bump_config =
59+
network_config.map(|config| config.gas_bump_blocks_every.clone()).unwrap_or_default();
60+
61+
let max_gas_price_multiplier =
62+
network_config.map(|config| config.max_gas_price_multiplier).unwrap_or(2);
6163

6264
state
6365
.transactions_queues
@@ -73,6 +75,7 @@ pub async fn clone_relayer(
7375
Default::default(),
7476
state.safe_proxy_manager.clone(),
7577
gas_bump_config,
78+
max_gas_price_multiplier,
7679
),
7780
state.transactions_queues.clone(),
7881
)

crates/core/src/relayer/api/create_relayer.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ pub async fn create_relayer(
5656
let id = relayer.id;
5757
let address = relayer.address;
5858

59-
let gas_bump_config = state
60-
.network_configs
61-
.iter()
62-
.find(|config| config.chain_id == chain_id)
63-
.map(|config| config.gas_bump_blocks_every.clone())
64-
.unwrap_or_default();
59+
let network_config = state.network_configs.iter().find(|config| config.chain_id == chain_id);
60+
61+
let gas_bump_config =
62+
network_config.map(|config| config.gas_bump_blocks_every.clone()).unwrap_or_default();
63+
64+
let max_gas_price_multiplier =
65+
network_config.map(|config| config.max_gas_price_multiplier).unwrap_or(2);
6566

6667
state
6768
.transactions_queues
@@ -77,6 +78,7 @@ pub async fn create_relayer(
7778
Default::default(),
7879
state.safe_proxy_manager.clone(),
7980
gas_bump_config,
81+
max_gas_price_multiplier,
8082
),
8183
state.transactions_queues.clone(),
8284
)

crates/core/src/transaction/queue_system/start.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,16 @@ pub async fn startup_transactions_queues(
389389
repopulate_transaction_queue(&postgres, &relayer_id, &TransactionStatus::MINED)
390390
.await?;
391391

392-
let gas_bump_config = network_configs
393-
.iter()
394-
.find(|config| config.chain_id == relayer.chain_id)
392+
let network_config =
393+
network_configs.iter().find(|config| config.chain_id == relayer.chain_id);
394+
395+
let gas_bump_config = network_config
395396
.map(|config| config.gas_bump_blocks_every.clone())
396397
.unwrap_or_default();
397398

399+
let max_gas_price_multiplier =
400+
network_config.map(|config| config.max_gas_price_multiplier).unwrap_or(2);
401+
398402
transaction_relayer_setups.push(TransactionRelayerSetup::new(
399403
relayer,
400404
evm_provider,
@@ -410,6 +414,7 @@ pub async fn startup_transactions_queues(
410414
.map(|transaction| (transaction.id, transaction))
411415
.collect(),
412416
gas_bump_config,
417+
max_gas_price_multiplier,
413418
));
414419
}
415420
}

0 commit comments

Comments
 (0)