diff --git a/multinode_integration_tests/tests/verify_bill_payment.rs b/multinode_integration_tests/tests/verify_bill_payment.rs index 5d682fea4..edb264fed 100644 --- a/multinode_integration_tests/tests/verify_bill_payment.rs +++ b/multinode_integration_tests/tests/verify_bill_payment.rs @@ -234,7 +234,7 @@ fn verify_bill_payment() { assert_balances( &contract_owner_wallet, &blockchain_interface, - "99995231980000000000", + "99992712652000000000", "471999999700000000000000000", ); @@ -409,7 +409,7 @@ fn verify_pending_payables() { assert_balances( &contract_owner_wallet, &blockchain_interface, - "99995231980000000000", + "99992712652000000000", "471999999700000000000000000", ); assert_balances( @@ -450,17 +450,17 @@ fn verify_pending_payables() { ); MASQNodeUtils::assert_node_wrote_log_containing( real_consuming_node.name(), - "Transaction 0x75a8f185b7fb3ac0c4d1ee6b402a46940c9ae0477c0c7378a1308fb4bf539c5c has been added to the blockchain;", + "Transaction 0x7e08536811791ff20855e459fed222e1cc06bcd684524ae1beaa36fb28dca4f8 has been added to the blockchain;", Duration::from_secs(5), ); MASQNodeUtils::assert_node_wrote_log_containing( real_consuming_node.name(), - "Transaction 0x384a3bb5bbd9718a97322be2878fa88c7cacacb2ac3416f521a621ca1946ddfc has been added to the blockchain;", + "Transaction 0x21aee15c389bd8894e4b8ffbc35a9f5084c4eea91d01d6ba5b7a93a58555d4e8 has been added to the blockchain;", Duration::from_secs(5), ); MASQNodeUtils::assert_node_wrote_log_containing( real_consuming_node.name(), - "Transaction 0x6bc98d5db61ddd7676de1f25cb537156b3d9e066cec414fef8dbe9c695908215 has been added to the blockchain;", + "Transaction 0x619c64860fea5593d74fccb48fd8e3d44fe374345ff4bb657c053b2d83b71138 has been added to the blockchain;", Duration::from_secs(5), ); } diff --git a/node/src/accountant/mod.rs b/node/src/accountant/mod.rs index 0a74d076c..923a6d0fc 100644 --- a/node/src/accountant/mod.rs +++ b/node/src/accountant/mod.rs @@ -3437,10 +3437,10 @@ mod tests { init_test_logging(); let port = find_free_port(); let pending_tx_hash_1 = - H256::from_str("e66814b2812a80d619813f51aa999c0df84eb79d10f4923b2b7667b30d6b33d3") + H256::from_str("acc64bde11847ec2186914c8cf18b9b153bf1b6e02b534aa314946fc3a828df0") .unwrap(); let pending_tx_hash_2 = - H256::from_str("0288ef000581b3bca8a2017eac9aea696366f8f1b7437f18d1aad57bccb7032c") + H256::from_str("e91c8324cb47305eefc0bff30b5981353326910eede7d3cf41579b5fcce712b4") .unwrap(); let _blockchain_client_server = MBCSBuilder::new(port) // Blockchain Agent Gas Price @@ -3770,16 +3770,16 @@ mod tests { ); let log_handler = TestLogHandler::new(); log_handler.exists_log_containing( - "WARN: Accountant: Broken transactions 0xe66814b2812a80d619813f51aa999c0df84eb79d10f\ - 4923b2b7667b30d6b33d3 marked as an error. You should take over the care of those to make sure \ + "WARN: Accountant: Broken transactions 0xacc64bde11847ec2186914c8cf18b9b153bf\ + 1b6e02b534aa314946fc3a828df0 marked as an error. You should take over the care of those to make sure \ your debts are going to be settled properly. At the moment, there is no automated process \ fixing that without your assistance"); - log_handler.exists_log_matching("INFO: Accountant: Transaction 0x0288ef000581b3bca8a2017eac9\ - aea696366f8f1b7437f18d1aad57bccb7032c has been added to the blockchain; detected locally at \ + log_handler.exists_log_matching("INFO: Accountant: Transaction 0xe91c8324cb47305eef\ + c0bff30b5981353326910eede7d3cf41579b5fcce712b4 has been added to the blockchain; detected locally at \ attempt 4 at \\d{2,}ms after its sending"); log_handler.exists_log_containing( - "INFO: Accountant: Transactions 0x0288ef000581b3bca8a2017eac9aea696366f8f1b7437f18d1aad5\ - 7bccb7032c completed their confirmation process succeeding", + "INFO: Accountant: Transactions 0xe91c8324cb47305eefc0bff30b5981353326910eede7\ + d3cf41579b5fcce712b4 completed their confirmation process succeeding", ); } diff --git a/node/src/blockchain/blockchain_bridge.rs b/node/src/blockchain/blockchain_bridge.rs index e4275b036..ab95ab6fb 100644 --- a/node/src/blockchain/blockchain_bridge.rs +++ b/node/src/blockchain/blockchain_bridge.rs @@ -598,7 +598,7 @@ mod tests { use std::time::{Duration, SystemTime}; use web3::types::{TransactionReceipt, H160}; use masq_lib::constants::DEFAULT_MAX_BLOCK_COUNT; - use crate::blockchain::blockchain_interface::blockchain_interface_web3::lower_level_interface_web3::{TransactionBlock, TxReceipt}; + use crate::blockchain::blockchain_interface::blockchain_interface_web3::lower_level_interface_web3::{TransactionBlock, TxReceipt, GAS_PRICE_INCREASE_PERCENTAGE}; impl Handler> for BlockchainBridge { type Result = (); @@ -745,6 +745,9 @@ mod tests { let accountant_received_payment = accountant_recording_arc.lock().unwrap(); let blockchain_agent_with_context_msg_actual: &BlockchainAgentWithContextMessage = accountant_received_payment.get_record(0); + let gas_price_from_rpc = 9395240960; + let gas_price_increase = (gas_price_from_rpc * GAS_PRICE_INCREASE_PERCENTAGE) / 100; + let expected_gas_price = gas_price_from_rpc + gas_price_increase; assert_eq!( blockchain_agent_with_context_msg_actual.protected_qualified_payables, qualified_payables @@ -759,7 +762,7 @@ mod tests { blockchain_agent_with_context_msg_actual .agent .agreed_fee_per_computation_unit(), - 0x230000000 + expected_gas_price ); assert_eq!( blockchain_agent_with_context_msg_actual @@ -776,7 +779,7 @@ mod tests { blockchain_agent_with_context_msg_actual .agent .estimated_transaction_fee_total(1), - (1 * 0x230000000 * (gas_limit_const_part + WEB3_MAXIMAL_GAS_LIMIT_MARGIN)) + (1 * expected_gas_price * (gas_limit_const_part + WEB3_MAXIMAL_GAS_LIMIT_MARGIN)) ); assert_eq!( blockchain_agent_with_context_msg_actual.response_skeleton_opt, diff --git a/node/src/blockchain/blockchain_interface/blockchain_interface_web3/lower_level_interface_web3.rs b/node/src/blockchain/blockchain_interface/blockchain_interface_web3/lower_level_interface_web3.rs index 5879a47a3..9c9e9cd78 100644 --- a/node/src/blockchain/blockchain_interface/blockchain_interface_web3/lower_level_interface_web3.rs +++ b/node/src/blockchain/blockchain_interface/blockchain_interface_web3/lower_level_interface_web3.rs @@ -12,6 +12,8 @@ use web3::transports::{Batch, Http}; use web3::types::{Address, BlockNumber, Filter, Log, TransactionReceipt}; use web3::{Error, Web3}; +pub const GAS_PRICE_INCREASE_PERCENTAGE: u128 = 80; + #[derive(Debug, PartialEq, Eq, Clone)] pub enum TransactionReceiptResult { RpcResponse(TxReceipt), @@ -93,7 +95,12 @@ impl LowBlockchainInt for LowBlockchainIntWeb3 { self.web3 .eth() .gas_price() - .map_err(|e| QueryFailed(e.to_string())), + .map_err(|e| QueryFailed(e.to_string())) + .map(|price| { + let increase = + price * U256::from(GAS_PRICE_INCREASE_PERCENTAGE) / U256::from(100); + price + increase + }), ) } @@ -184,7 +191,12 @@ mod tests { use masq_lib::utils::find_free_port; use std::str::FromStr; use web3::types::{BlockNumber, Bytes, FilterBuilder, Log, TransactionReceipt, U256}; - use crate::blockchain::blockchain_interface::blockchain_interface_web3::lower_level_interface_web3::{TxReceipt, TxStatus}; + use crate::blockchain::blockchain_interface::blockchain_interface_web3::lower_level_interface_web3::{TxReceipt, TxStatus, GAS_PRICE_INCREASE_PERCENTAGE}; + + #[test] + fn constants_have_correct_values() { + assert_eq!(GAS_PRICE_INCREASE_PERCENTAGE, 80); + } #[test] fn get_transaction_fee_balance_works() { diff --git a/node/src/blockchain/blockchain_interface/blockchain_interface_web3/mod.rs b/node/src/blockchain/blockchain_interface/blockchain_interface_web3/mod.rs index 92f8e9145..9ec9c052a 100644 --- a/node/src/blockchain/blockchain_interface/blockchain_interface_web3/mod.rs +++ b/node/src/blockchain/blockchain_interface/blockchain_interface_web3/mod.rs @@ -459,7 +459,7 @@ mod tests { use std::str::FromStr; use web3::transports::Http; use web3::types::{H256, U256}; - use crate::blockchain::blockchain_interface::blockchain_interface_web3::lower_level_interface_web3::{TransactionBlock, TxReceipt, TxStatus}; + use crate::blockchain::blockchain_interface::blockchain_interface_web3::lower_level_interface_web3::{TransactionBlock, TxReceipt, TxStatus, GAS_PRICE_INCREASE_PERCENTAGE}; #[test] fn constants_are_correct() { @@ -855,7 +855,9 @@ mod tests { let expected_transaction_fee_balance = U256::from(65_520); let expected_masq_balance = U256::from(65_535); - let expected_gas_price_wei = 1_000_000_000; + let gas_price_from_rpc = 1_000_000_000; + let gas_price_increase = (gas_price_from_rpc * GAS_PRICE_INCREASE_PERCENTAGE) / 100; + let expected_gas_price_wei = gas_price_from_rpc + gas_price_increase; assert_eq!(result.consuming_wallet(), &wallet); assert_eq!( result.consuming_wallet_balances(), diff --git a/node/src/blockchain/blockchain_interface_initializer.rs b/node/src/blockchain/blockchain_interface_initializer.rs index ee87519a0..3d8306e86 100644 --- a/node/src/blockchain/blockchain_interface_initializer.rs +++ b/node/src/blockchain/blockchain_interface_initializer.rs @@ -58,6 +58,7 @@ mod tests { use masq_lib::constants::DEFAULT_CHAIN; use masq_lib::test_utils::mock_blockchain_client_server::MBCSBuilder; use masq_lib::utils::find_free_port; + use crate::blockchain::blockchain_interface::blockchain_interface_web3::lower_level_interface_web3::GAS_PRICE_INCREASE_PERCENTAGE; #[test] fn initialize_web3_interface_works() { @@ -83,10 +84,12 @@ mod tests { .wait() .unwrap(); + let gas_price_from_rpc = 1_000_000_000; + let gas_price_increase = (gas_price_from_rpc * GAS_PRICE_INCREASE_PERCENTAGE) / 100; assert_eq!(blockchain_agent.consuming_wallet(), &wallet); assert_eq!( blockchain_agent.agreed_fee_per_computation_unit(), - 1_000_000_000 + gas_price_from_rpc + gas_price_increase ); }