Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
10 changes: 5 additions & 5 deletions multinode_integration_tests/tests/verify_bill_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ fn verify_bill_payment() {
assert_balances(
&contract_owner_wallet,
&blockchain_interface,
"99995231980000000000",
"99994287232000000000",
"471999999700000000000000000",
);

Expand Down Expand Up @@ -409,7 +409,7 @@ fn verify_pending_payables() {
assert_balances(
&contract_owner_wallet,
&blockchain_interface,
"99995231980000000000",
"99994287232000000000",
"471999999700000000000000000",
);
assert_balances(
Expand Down Expand Up @@ -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 0xecab1c73ca90ebcb073526e28f1f8d4678704b74d1e0209779ddeefc8fb861f5 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 0xae0bf6400f0b9950a1d456e488549414d118714b81a39233b811b629cf41399b 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 0x89acc46da0df6ef8c6f5574307ae237a812bd28af524a62131013b5e19ca3e26 has been added to the blockchain;",
Duration::from_secs(5),
);
}
Expand Down
16 changes: 8 additions & 8 deletions node/src/accountant/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("758b00d9041ce3afe0f88c672ee07bf524d70aa101147942212cada6a753bc40")
.unwrap();
let pending_tx_hash_2 =
H256::from_str("0288ef000581b3bca8a2017eac9aea696366f8f1b7437f18d1aad57bccb7032c")
H256::from_str("4f2cd80b817ca717e33b27d73b4483bbe2baf15fdf3e72a59c0d554b96b76192")
.unwrap();
let _blockchain_client_server = MBCSBuilder::new(port)
// Blockchain Agent Gas Price
Expand Down Expand Up @@ -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 0x758b00d9041ce3afe0f88c672ee07bf524d70\
aa101147942212cada6a753bc40 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 0x4f2cd80b817ca717e\
33b27d73b4483bbe2baf15fdf3e72a59c0d554b96b76192 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 0x4f2cd80b817ca717e33b27d73b4483\
bbe2baf15fdf3e72a59c0d554b96b76192 completed their confirmation process succeeding",
);
}

Expand Down
5 changes: 3 additions & 2 deletions node/src/blockchain/blockchain_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ 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 expected_gas_price = (9395240960 * 13) / 10; // 30% increase
assert_eq!(
blockchain_agent_with_context_msg_actual.protected_qualified_payables,
qualified_payables
Expand All @@ -759,7 +760,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
Expand All @@ -776,7 +777,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use web3::transports::{Batch, Http};
use web3::types::{Address, BlockNumber, Filter, Log, TransactionReceipt};
use web3::{Error, Web3};

const GAS_PRICE_INCREASE_PERCENTAGE: u128 = 30;

#[derive(Debug, PartialEq, Eq, Clone)]
pub enum TransactionReceiptResult {
RpcResponse(TxReceipt),
Expand Down Expand Up @@ -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
}),
)
}

Expand Down Expand Up @@ -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, 30);
}

#[test]
fn get_transaction_fee_balance_works() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ 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 expected_gas_price_wei = 1_000_000_000 + 300_000_000;
assert_eq!(result.consuming_wallet(), &wallet);
assert_eq!(
result.consuming_wallet_balances(),
Expand Down
2 changes: 1 addition & 1 deletion node/src/blockchain/blockchain_interface_initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ mod tests {
assert_eq!(blockchain_agent.consuming_wallet(), &wallet);
assert_eq!(
blockchain_agent.agreed_fee_per_computation_unit(),
1_000_000_000
1_000_000_000 + 300_000_000
);
}

Expand Down