Skip to content

Commit

Permalink
Fix gas price on cast paymaster usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrigada committed Oct 31, 2024
1 parent 9093c3c commit 04b149c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 4 additions & 1 deletion crates/cast/bin/cmd/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ impl SendTxArgs {
None
};

let config = Config::from(&eth);
let mut config = Config::from(&eth);
config.zksync.startup = zksync_params.zksync;
config.zksync.compile = zksync_params.zksync;

let provider = utils::get_provider(&config)?;

let builder = CastTxBuilder::new(&provider, tx, &config)
Expand Down
4 changes: 2 additions & 2 deletions crates/cast/bin/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ where

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

if let Some(gas_limit) = tx_opts.gas_limit {
tx.set_gas_limit(gas_limit.to());
Expand All @@ -167,7 +167,7 @@ where
if let Some(gas_price) = tx_opts.gas_price {
// We need to set the gas price to be able to create the EIP-712 transaction in
// zkcontext
if legacy || config.zksync.startup {
if legacy {
tx.set_gas_price(gas_price.to());
} else {
tx.set_max_fee_per_gas(gas_price.to());
Expand Down
4 changes: 1 addition & 3 deletions crates/cast/tests/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,9 +1392,7 @@ casttest!(cast_using_paymaster, async |prj, cmd| {
"--zk-paymaster-input",
"0x8c5a344500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000",
"--rpc-url",
&url,
"--gas-price",
"1000000000000002",
&url
])
.assert_success();

Expand Down

0 comments on commit 04b149c

Please sign in to comment.