Skip to content

Commit

Permalink
taker gas limits v2
Browse files Browse the repository at this point in the history
  • Loading branch information
laruh committed Sep 10, 2024
1 parent b1626f7 commit ce7903d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
6 changes: 3 additions & 3 deletions mm2src/coins/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ pub mod gas_limit {
pub const ETH_MAX_TRADE_GAS: u64 = 150_000;
}

/// Gas limits for EthGasLimitV2
/// Default gas limits for EthGasLimitV2
pub mod gas_limit_v2 {
/// Gas limits for maker operations in EthGasLimitV2
/// Gas limits for maker operations in EtomicSwapMakerV2 contract
pub mod maker {
pub const ETH_SEND_PAYMENT: u64 = 65_000;
pub const ERC20_SEND_PAYMENT: u64 = 115_000;
Expand All @@ -265,7 +265,7 @@ pub mod gas_limit_v2 {
pub const ERC20_MAKER_REFUND_SECRET: u64 = 65_000;
}

/// Gas limits for taker operations in EthGasLimitV2
/// Gas limits for taker operations in EtomicSwapTakerV2 contract
pub mod taker {
pub const ETH_SEND_PAYMENT: u64 = 65_000;
pub const ERC20_SEND_PAYMENT: u64 = 115_000;
Expand Down
28 changes: 13 additions & 15 deletions mm2src/mm2_main/tests/docker_tests/eth_docker_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1452,11 +1452,9 @@ fn eth_coin_v2_activation_with_random_privkey(
coin
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_by_secret_eth() {
// sepolia test
thread::sleep(Duration::from_secs(5));
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ETH, &eth_sepolia_conf(), false);
let maker_coin = get_or_create_sepolia_coin(&MM_CTX, SEPOLIA_MAKER_PRIV, ETH, &eth_sepolia_conf(), false);

Expand Down Expand Up @@ -1514,10 +1512,9 @@ fn send_and_refund_taker_funding_by_secret_eth() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 100);
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_by_secret_erc20() {
thread::sleep(Duration::from_secs(130));
thread::sleep(Duration::from_secs(30));
let erc20_conf = &sepolia_erc20_dev_conf(&sepolia_erc20_contract_checksum());
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ERC20, erc20_conf, true);
let maker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_MAKER_PRIV, ERC20, erc20_conf, true);
Expand Down Expand Up @@ -1576,11 +1573,10 @@ fn send_and_refund_taker_funding_by_secret_erc20() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 200);
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_exceed_pre_approve_timelock_eth() {
thread::sleep(Duration::from_secs(12));
// sepolia test
thread::sleep(Duration::from_secs(60));
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ETH, &eth_sepolia_conf(), false);
let maker_coin = get_or_create_sepolia_coin(&MM_CTX, SEPOLIA_MAKER_PRIV, ETH, &eth_sepolia_conf(), false);

Expand Down Expand Up @@ -1641,10 +1637,10 @@ fn send_and_refund_taker_funding_exceed_pre_approve_timelock_eth() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 100);
}

#[ignore]
#[test]
fn taker_send_approve_and_spend_eth() {
// sepolia test
thread::sleep(Duration::from_secs(90));
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ETH, &eth_sepolia_conf(), false);
let maker_coin = get_or_create_sepolia_coin(&MM_CTX, SEPOLIA_MAKER_PRIV, ETH, &eth_sepolia_conf(), false);

Expand Down Expand Up @@ -1750,11 +1746,10 @@ fn taker_send_approve_and_spend_eth() {
block_on(taker_coin.wait_for_taker_payment_spend(&spend_tx, 0u64, payment_time_lock)).unwrap();
}

#[ignore]
#[test]
fn taker_send_approve_and_spend_erc20() {
// sepolia test
thread::sleep(Duration::from_secs(9));
thread::sleep(Duration::from_secs(120));
let erc20_conf = &sepolia_erc20_dev_conf(&sepolia_erc20_contract_checksum());
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ERC20, erc20_conf, true);
let maker_coin = get_or_create_sepolia_coin(&MM_CTX, SEPOLIA_MAKER_PRIV, ERC20, erc20_conf, true);
Expand Down Expand Up @@ -1860,11 +1855,10 @@ fn taker_send_approve_and_spend_erc20() {
block_on(taker_coin.wait_for_taker_payment_spend(&spend_tx, 0u64, payment_time_lock)).unwrap();
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_exceed_payment_timelock_eth() {
// sepolia test
thread::sleep(Duration::from_secs(25));
thread::sleep(Duration::from_secs(150));
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ETH, &eth_sepolia_conf(), false);
let maker_coin = get_or_create_sepolia_coin(&MM_CTX, SEPOLIA_MAKER_PRIV, ETH, &eth_sepolia_conf(), false);

Expand Down Expand Up @@ -1944,11 +1938,10 @@ fn send_and_refund_taker_funding_exceed_payment_timelock_eth() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 100);
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_exceed_payment_timelock_erc20() {
// sepolia test
thread::sleep(Duration::from_secs(28));
thread::sleep(Duration::from_secs(180));
let erc20_conf = &sepolia_erc20_dev_conf(&sepolia_erc20_contract_checksum());
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ERC20, erc20_conf, true);
let maker_coin = get_or_create_sepolia_coin(&MM_CTX, SEPOLIA_MAKER_PRIV, ERC20, erc20_conf, true);
Expand Down Expand Up @@ -2030,11 +2023,10 @@ fn send_and_refund_taker_funding_exceed_payment_timelock_erc20() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 100);
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_exceed_pre_approve_timelock_erc20() {
// sepolia test
thread::sleep(Duration::from_secs(200));
thread::sleep(Duration::from_secs(210));
let erc20_conf = &sepolia_erc20_dev_conf(&sepolia_erc20_contract_checksum());
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ERC20, erc20_conf, true);
let maker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_MAKER_PRIV, ERC20, erc20_conf, true);
Expand Down Expand Up @@ -2097,6 +2089,7 @@ fn send_and_refund_taker_funding_exceed_pre_approve_timelock_erc20() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 150);
}

#[ignore]
#[test]
fn send_maker_payment_and_refund_timelock_eth() {
thread::sleep(Duration::from_secs(150));
Expand Down Expand Up @@ -2149,6 +2142,7 @@ fn send_maker_payment_and_refund_timelock_eth() {
wait_for_confirmations(&maker_coin, &payment_tx_refund, 100);
}

#[ignore]
#[test]
fn send_maker_payment_and_refund_timelock_erc20() {
thread::sleep(Duration::from_secs(120));
Expand Down Expand Up @@ -2202,6 +2196,7 @@ fn send_maker_payment_and_refund_timelock_erc20() {
wait_for_confirmations(&maker_coin, &payment_tx_refund, 100);
}

#[ignore]
#[test]
fn send_maker_payment_and_refund_secret_eth() {
thread::sleep(Duration::from_secs(90));
Expand Down Expand Up @@ -2251,6 +2246,7 @@ fn send_maker_payment_and_refund_secret_eth() {
wait_for_confirmations(&maker_coin, &payment_tx_refund, 100);
}

#[ignore]
#[test]
fn send_maker_payment_and_refund_secret_erc20() {
thread::sleep(Duration::from_secs(60));
Expand Down Expand Up @@ -2301,6 +2297,7 @@ fn send_maker_payment_and_refund_secret_erc20() {
wait_for_confirmations(&maker_coin, &payment_tx_refund, 100);
}

#[ignore]
#[test]
fn send_and_spend_maker_payment_eth() {
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ETH, &eth_sepolia_conf(), false);
Expand Down Expand Up @@ -2362,6 +2359,7 @@ fn send_and_spend_maker_payment_eth() {
block_on(maker_coin.wait_for_maker_payment_spend(&spend_tx, 0u64, payment_time_lock)).unwrap();
}

#[ignore]
#[test]
fn send_and_spend_maker_payment_erc20() {
thread::sleep(Duration::from_secs(30));
Expand Down

0 comments on commit ce7903d

Please sign in to comment.