Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions core/tests/loadnext/src/sdk/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,20 @@ impl<S: EthereumSigner> EthereumProvider<S> {
.base_cost(gas_limit, L1_TO_L2_GAS_PER_PUBDATA, Some(gas_price))
.await
.map_err(|e| ClientError::NetworkError(e.to_string()))?;
let value = base_cost + operator_tip + l2_value;
let mint_value = base_cost + operator_tip + l2_value;
let tx_data = self.client().encode_tx_data(
"requestL2Transaction",
(
"bridgehubRequestL2Transaction",
((
self.client().sender_account(),
contract_address,
mint_value,
l2_value,
calldata,
gas_limit,
U256::from(L1_TO_L2_GAS_PER_PUBDATA),
factory_deps,
refund_recipient,
)
),)
.into_tokens(),
);

Expand All @@ -428,7 +430,6 @@ impl<S: EthereumSigner> EthereumProvider<S> {
tx_data,
Options::with(|f| {
f.gas = Some(U256::from(300000));
f.value = Some(value);
f.gas_price = Some(gas_price)
}),
Comment on lines 431 to 434
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The f.value field has been removed from the transaction options. In the ETH deposit path, the transaction must include msg.value to cover the mint_value (which includes the base cost, operator tip, and L2 value). Without setting f.value, the transaction will be sent with 0 ETH, causing it to revert on the L1 contract.

Suggested change
Options::with(|f| {
f.gas = Some(U256::from(300000));
f.value = Some(value);
f.gas_price = Some(gas_price)
}),
Options::with(|f| {
f.gas = Some(U256::from(300000));
f.value = Some(mint_value);
f.gas_price = Some(gas_price)
}),

)
Expand Down Expand Up @@ -536,7 +537,7 @@ impl<S: EthereumSigner> EthereumProvider<S> {
)
.await?
} else {
// TODO(EVM-571): This should be moved to the shared bridge, and the `requestL2Transaction` method
// TODO(EVM-571): This should be moved to the shared bridge end-to-end for deposit flows
let bridge_address =
bridge_address.unwrap_or(self.default_bridges.l1_erc20_default_bridge.unwrap());
let contract_function = self
Expand Down
13 changes: 7 additions & 6 deletions core/tests/via_loadnext/src/sdk/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,18 +406,20 @@ impl<S: EthereumSigner> EthereumProvider<S> {
.base_cost(gas_limit, L1_TO_L2_GAS_PER_PUBDATA, Some(gas_price))
.await
.map_err(|e| ClientError::NetworkError(e.to_string()))?;
let value = base_cost + operator_tip + l2_value;
let mint_value = base_cost + operator_tip + l2_value;
let tx_data = self.client().encode_tx_data(
"requestL2Transaction",
(
"bridgehubRequestL2Transaction",
((
self.client().sender_account(),
contract_address,
mint_value,
l2_value,
calldata,
gas_limit,
U256::from(L1_TO_L2_GAS_PER_PUBDATA),
factory_deps,
refund_recipient,
)
),)
.into_tokens(),
);

Expand All @@ -427,7 +429,6 @@ impl<S: EthereumSigner> EthereumProvider<S> {
tx_data,
Options::with(|f| {
f.gas = Some(U256::from(300000));
f.value = Some(value);
f.gas_price = Some(gas_price)
}),
Comment on lines 430 to 433
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The f.value field is missing in the transaction options. This is required to send the necessary ETH (mint_value) for the L2 transaction request. Removing it will lead to transaction failure as no ETH will be sent to the contract.

Suggested change
Options::with(|f| {
f.gas = Some(U256::from(300000));
f.value = Some(value);
f.gas_price = Some(gas_price)
}),
Options::with(|f| {
f.gas = Some(U256::from(300000));
f.value = Some(mint_value);
f.gas_price = Some(gas_price)
}),

)
Expand Down Expand Up @@ -535,7 +536,7 @@ impl<S: EthereumSigner> EthereumProvider<S> {
)
.await?
} else {
// TODO(EVM-571): This should be moved to the shared bridge, and the `requestL2Transaction` method
// TODO(EVM-571): This should be moved to the shared bridge end-to-end for deposit flows
let bridge_address =
bridge_address.unwrap_or(self.default_bridges.l1_erc20_default_bridge.unwrap());
let contract_function = self
Expand Down
Loading