diff --git a/justfile b/justfile index 5918c637..87fd165d 100644 --- a/justfile +++ b/justfile @@ -93,7 +93,7 @@ test-rollups-echo: build-rust-workspace test-rollups-honeypot: build-rust-workspace just -f ./prt/tests/rollups/justfile test-honeypot-all test-rollups-honeypot-ci: build-rust-workspace - just -f ./prt/tests/rollups/justfile test-honeypot-ci + GAS_LIMIT=15000000 just -f ./prt/tests/rollups/justfile test-honeypot-ci test-rollups-honeypot-case CASE: build-rust-workspace just -f ./prt/tests/rollups/justfile test-honeypot-case {{CASE}} view-rollups-logs: diff --git a/prt/client-rs/core/src/tournament/sender.rs b/prt/client-rs/core/src/tournament/sender.rs index 4e240d7b..65382138 100644 --- a/prt/client-rs/core/src/tournament/sender.rs +++ b/prt/client-rs/core/src/tournament/sender.rs @@ -146,16 +146,17 @@ impl ArenaSender for EthArenaSender { new_right_node: Digest, ) -> Result<()> { let tournament = tournament::Tournament::new(tournament, &self.provider); - let tx_result = tournament - .advanceMatch( - match_id.into(), - left_node.into(), - right_node.into(), - new_left_node.into(), - new_right_node.into(), - ) - .send() - .await; + let mut call = tournament.advanceMatch( + match_id.into(), + left_node.into(), + right_node.into(), + new_left_node.into(), + new_right_node.into(), + ); + if let Some(limit) = std::env::var("GAS_LIMIT").ok().and_then(|v| v.parse().ok()) { + call = call.gas(limit); + } + let tx_result = call.send().await; allow_revert_rethrow_others("advanceMatch", tx_result).await } diff --git a/prt/contracts/src/tournament/Tournament.sol b/prt/contracts/src/tournament/Tournament.sol index fa0e4bb5..abda1766 100644 --- a/prt/contracts/src/tournament/Tournament.sol +++ b/prt/contracts/src/tournament/Tournament.sol @@ -74,7 +74,7 @@ contract Tournament is ITournament { Time.Instant lastMatchDeleted; uint256 constant MAX_GAS_PRICE = 50 gwei; - uint256 constant MESSAGE_SENDER_PROFIT = 10 gwei; + uint256 constant PRIORITY_FEE_CAP = 10 gwei; bool transient locked; mapping(Tree.Node => Clock.State) clocks; @@ -952,7 +952,7 @@ contract Tournament is ITournament { address(this).balance, bondValue() * gasEstimate / _totalGasEstimate(), (Gas.TX + gasBefore - gasAfter) - * (tx.gasprice + MESSAGE_SENDER_PROFIT) + * tx.gasprice.min(block.basefee + PRIORITY_FEE_CAP) ); (bool status, bytes memory ret) = diff --git a/prt/contracts/src/tournament/libs/Gas.sol b/prt/contracts/src/tournament/libs/Gas.sol index 260a0e73..6ba1a665 100644 --- a/prt/contracts/src/tournament/libs/Gas.sol +++ b/prt/contracts/src/tournament/libs/Gas.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.17; library Gas { - uint256 constant TX = 21000; + uint256 constant TX = 25000; uint256 constant ADVANCE_MATCH = 65175 + TX; uint256 constant WIN_MATCH_BY_TIMEOUT = 86203 + TX; diff --git a/prt/contracts/test/Tournament.t.sol b/prt/contracts/test/Tournament.t.sol index ee49aec0..ca4f4e9e 100644 --- a/prt/contracts/test/Tournament.t.sol +++ b/prt/contracts/test/Tournament.t.sol @@ -295,6 +295,7 @@ contract TournamentTest is Util { uint256 tournamentBalanceBefore = address(topTournament).balance; uint256 callerBalanceBefore = address(this).balance; + vm.txGasPrice(2); topTournament.eliminateMatchByTimeout(_matchId); uint256 tournamentBalanceAfter = address(topTournament).balance; uint256 callerBalanceAfter = address(this).balance;