Skip to content

Commit c129b59

Browse files
authored
fix: gas price estimation cast send zk (#683)
* Fix gas price on cast paymaster usage * Remove outdated comment
1 parent 2cbbd12 commit c129b59

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

crates/cast/bin/cmd/send.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ impl SendTxArgs {
144144
None
145145
};
146146

147-
let config = Config::from(&eth);
147+
let mut config = Config::from(&eth);
148+
config.zksync.startup = zksync_params.zksync;
149+
config.zksync.compile = zksync_params.zksync;
150+
148151
let provider = utils::get_provider(&config)?;
149152

150153
let builder = CastTxBuilder::new(&provider, tx, &config)

crates/cast/bin/tx.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ where
154154

155155
let chain = utils::get_chain(config.chain, &provider).await?;
156156
let etherscan_api_key = config.get_etherscan_api_key(Some(chain));
157-
let legacy = tx_opts.legacy || chain.is_legacy();
157+
let legacy = tx_opts.legacy || chain.is_legacy() || config.zksync.run_in_zk_mode();
158158

159159
if let Some(gas_limit) = tx_opts.gas_limit {
160160
tx.set_gas_limit(gas_limit.to());
@@ -165,9 +165,7 @@ where
165165
}
166166

167167
if let Some(gas_price) = tx_opts.gas_price {
168-
// We need to set the gas price to be able to create the EIP-712 transaction in
169-
// zkcontext
170-
if legacy || config.zksync.startup {
168+
if legacy {
171169
tx.set_gas_price(gas_price.to());
172170
} else {
173171
tx.set_max_fee_per_gas(gas_price.to());

crates/cast/tests/cli/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,9 +1400,7 @@ casttest!(cast_using_paymaster, async |prj, cmd| {
14001400
"--zk-paymaster-input",
14011401
"0x8c5a344500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000",
14021402
"--rpc-url",
1403-
&url,
1404-
"--gas-price",
1405-
"1000000000000002",
1403+
&url
14061404
])
14071405
.assert_success();
14081406

0 commit comments

Comments
 (0)