Skip to content

Commit

Permalink
GH-747: Txn received from unknown wallets + start block set on the sa…
Browse files Browse the repository at this point in the history
…me db txn as where we account inward payments (#350)

* GH-554: rough infrastructure for PaymentAdjuster; almost get first round test running

* GH-672: simplifying GH-554, let's go on without the Neighborhood involved for the time being

* GH-672: PaymentAdjusterMock and the supertrait with ScannerEtensions implemented for a try

* GH-672-with-trait-impl-and-generics: perhaps going in the right direction

* GH-672-best-methodology-found: implementation works

* GH-672: first version of adjustment implemented

* GH-672: finished implementing the main test; not refactored yet

* GH-672: payment adjuster refactored; tuning logging; but wanna master features that are missing here

* GH-672: some logging integrated

* GH-672: fine debug log

* GH-672: interim commit

* GH-672: interim commit

* GH-672: another package of big changes (partly-private msgs; payment adjuster)

* GH-672: decent debug log for adjusted payables

* GH-672: broadening the adjustment capabilities with gas; rough framework

* GH-672: savepoint; before experimenting with early gas_limit computation

* GH-672: continuing in implementation of the check for gas availability.

* GH-672: some renaming and moving files

* GH-672: almost completed but there is a cenceptual error; maybe extra tests for BlockchainInterfaceClandestine should be made first

* GH-672: last details; adding tests for untested code from BlockchainInterfaceClandestine

* GH-672: almost done; some refactoring ahead

* GH-672: heading to auto-review

* GH-672: auto review findings

* GH-672: refactored scan scheduling code

* GH-672: fixing issues from the review; save point before the shift of responsibility of the estimated gas limit from BchI to Chain

* GH-672: before connecting the early fetched gas price and the actual gas price used for generating hashed transactions

* GH-672: logic redesigned + renaming

* GH-672: I believe the first review is answered by now

* GH-672: almost all the old code updated; will have to implement the transaction fee calculators

* GH-672: before serious changes with PayablePaymentsAgent starts

* GH-672-with-agent: saving when getting into troubles with testing

* GH-672-with-agent: going in a nice direction; interim commit

* GH-672-with-agent: approaching the fixture...this might work well; last vexing situations unhandled meaning there are like 8 failing tests at the moment

* GH-672-with-agent: could be called roughly complete; will go with refactoring and knocking off some todos left behind me

* GH-672-with-agent: interim commit

* GH-672-with-agent: hopefully the last changes before a review

* GH-672-with-agent: almost all what I found in my auto-review

* GH-672-with-agent: refactored the structure of PayablePaymentsSetupMsg

* GH-672-with-agent: formatting

* GH-672-wa-no-test-hack: recorder can also record and stop the system from PartalEq missing Actor messages; two of four tests repaired

* GH-672-wa-no-test-hack:  hurrah, managed to get out of the trap with an agent in Actor msgs even without having to implement Debug, PartialEq and Clone a trait object...this is definitely a lighter version

* GH-672-wa-no-test-hack: little modifications in comments

* GH-672: first batch of fixed items from the review 3

* GH-672: another batch of fixes

* GH-672: refactoring some complicated test concepts for actor_system_factory and adding one test for blockchain_bridge of that kind

* GH-672: more refactoring and little changes

* GH-672: fixing stuff araound blockchain_interface web3 and its initialization

* GH-672: savepoint

* GH-672: renaming

* GH-672: almost all things done; AgentDigest fully in

* GH-672: finished last few missing places

* GH-672: reworking comments and found a little mistake

* GH-672: match stop condition turned into easier one to use

* GH-672: protected payables implemented

* GH-672: until now the protected payables were implemented badly; improved design

* GH-672: compiling, but many failing tests

* GH-672: still fixing tests, but a lot of them passing now

* GH-672: halting hard with thoughts about implementation of the build_blockcahin_agent_method

* GH-672: blockchain interface onward and backwards move; messy rearrangement; wanna make a savepoint before trying cargo fix

* GH-672: all tests good; saving before cargo fix

* GH-672: roughly ready code; let's review now

* GH-672: renaming in accountant folders

* GH-672: reverting some renaming in favor of another branch taking care of this

* GH-672: interim commit

* GH-672: little fixes and adding more in to some null methods with todos

* GH-672: polishing; savepoint before moving get_transaction_receipt to plain_rpc

* GH-672: improved details

* GH-747: mostly complete, one test still left to be done and some ideas about refactoring arose

* GH-747: even more tests needed

* GH-747: last todo knocked out

* GH-747: db connection options for big_int_db_processor simplified

* GH-747: better design for 'other_params()'

* GH-747: alias types for easier reading

* GH-672: mostly done; just a few details left

* GH-672: abondoning enhancement of blockchain interface initializer...leaving as it is

* GH-672: unnoticable change for the augly low level tests in actor_system_factory

* GH-672: blockchain_bridge_shared_test_simplified

* GH-672: ready for review 5

* Revert "GH-747: db connection options for big_int_db_processor simplified"

This reverts commit e987841.

* GH-747: prepared for new big redesign of the test to watch the transaction roll back at panic for a hard error

* GH-747: most of this is over me

* GH-747: savepoint before trying to mess with lifetimes hard

* GH-747: savepoint before trying to mess with lifetimes hard

* GH-747: preparing for mocking BigIntProcessor

* GH-747: a lot stabilized...refactoring next??

* GH-747: found the right hierarchy in the code (redesigned to be cleaner and robust)... will have to fix a tougher test and figure out what to do with a manual Debug impl

* GH-747: renaming

* GH-747: hard work on creating a reliable test tool; yet more of the undone left

* GH-747: I'm gonna try to make the test tool more of how an unbiased viewer would expect to see it

* GH-747: tools enhanced and some little debrits cleaned up

* GH-747: small corrections in text

* GH-747-experiment-start-block: before trying to do 'impossible'

* GH-672: interim commit

* GH-672: finished review 5

* GH-672: review 6 answered

* GH-672: fixes in multinode tests

* GH-672: little cosmetics

* GH-747-experiment-start-block

* GH-747-experiment-start-block: interim commit

* GH-747-experiment-start-block: since now prepared for all sorts of testing; let's roll up our sleeves

* GH-747-experiment-start-block: new procedure for setting start block works first time

* GH-757-experiment-start-block: turned out a good idea... completed

* GH-747: a dull sketch

* GH-747: for both situations, no and some transactions found, start block setting implemented

* GH-747: last error handling missing - but added in

* GH-747: some small changes

* GH-747: working on a more convenient wrapper around the rusqlite transaction; also rephrased a big comment

* GH-747: first stage of enhancing the trasnaction wrapper seems done

* GH-747: better interface for wrapped transaction

* GH-747: interim commit

* GH-747: transaction wrapper redesigned successfuly

* GH-747: didn't include these accidently

* GH-747: builder implemented; interface now doesn't allow misuse of the inner tx wrapper

* GH-747: few more comments knocked off

* GH-747: transaction wrapper test version polishing

* GH-747: new little safety feature implemented

* GH-747: small improvements, still working the review

* GH-747: and again small impovements, still working the review

* GH-747: interim commit

* GH-747: more code neatened in big_int_db_processor

* GH-747: revamp in receivable (at least I think)

* GH-747: revamp of bulky comments

* GH-747: interim commit before a big revamp

* GH-747: I lost interst in the previous thing but will do files replacement now; save point

* GH-747: deleted files mistakely merged in

* GH-747: finished before trying master merge

* GH-747: finalizing before the review; writing better comments etc

* GH-747: more text revamped

* GH-747: first bunch of fixes after the 2nd review

* GH-747: second big bunch

* GH-747: some new minor changes

* GH-747: all comments addressed

* GH-747: clippy

* GH-747: review 2 reaction: revamping text

* GH-747: review 2 reaction: another attempt, smaller

* bumping version 0.8.0

---------

Co-authored-by: Bert <[email protected]>
  • Loading branch information
bertllll and Bert authored Jan 27, 2024
1 parent 99b68bf commit bd56d3f
Show file tree
Hide file tree
Showing 71 changed files with 2,775 additions and 1,179 deletions.
4 changes: 2 additions & 2 deletions automap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion automap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "automap"
version = "0.7.3"
version = "0.8.0"
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
license = "GPL-3.0-only"
description = "Library full of code to make routers map ports through firewalls"
Expand Down
4 changes: 2 additions & 2 deletions dns_utility/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dns_utility/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dns_utility"
version = "0.7.3"
version = "0.8.0"
license = "GPL-3.0-only"
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
copyright = "Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved."
Expand Down
2 changes: 1 addition & 1 deletion masq/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "masq"
version = "0.7.3"
version = "0.8.0"
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
license = "GPL-3.0-only"
description = "Reference implementation of user interface for MASQ Node"
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/change_password_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use clap::{App, Arg, SubCommand};
use masq_lib::messages::{
UiChangePasswordRequest, UiChangePasswordResponse, UiNewPasswordBroadcast,
};
use masq_lib::{as_any_in_trait_impl, short_writeln};
use masq_lib::{as_any_ref_in_trait_impl, short_writeln};
use std::io::Write;

#[derive(Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -79,7 +79,7 @@ impl Command for ChangePasswordCommand {
Ok(())
}

as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

pub fn change_password_subcommand() -> App<'static, 'static> {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/check_password_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::commands::commands_common::{
transaction, Command, CommandError, STANDARD_COMMAND_TIMEOUT_MILLIS,
};
use clap::{App, Arg, SubCommand};
use masq_lib::as_any_in_trait_impl;
use masq_lib::as_any_ref_in_trait_impl;
use masq_lib::messages::{UiCheckPasswordRequest, UiCheckPasswordResponse};
use masq_lib::short_writeln;
use masq_lib::utils::to_string;
Expand Down Expand Up @@ -51,7 +51,7 @@ impl Command for CheckPasswordCommand {
Ok(())
}

as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

impl CheckPasswordCommand {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/configuration_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::commands::commands_common::{
dump_parameter_line, transaction, Command, CommandError, STANDARD_COMMAND_TIMEOUT_MILLIS,
};
use clap::{App, Arg, SubCommand};
use masq_lib::as_any_in_trait_impl;
use masq_lib::as_any_ref_in_trait_impl;
use masq_lib::constants::NODE_NOT_RUNNING_ERROR;
use masq_lib::messages::{UiConfigurationRequest, UiConfigurationResponse};
use masq_lib::short_writeln;
Expand Down Expand Up @@ -64,7 +64,7 @@ impl Command for ConfigurationCommand {
}
}

as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

impl ConfigurationCommand {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/connection_status_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::commands::commands_common::{
transaction, Command, CommandError, STANDARD_COMMAND_TIMEOUT_MILLIS,
};
use clap::{App, SubCommand};
use masq_lib::as_any_in_trait_impl;
use masq_lib::as_any_ref_in_trait_impl;
use masq_lib::constants::NODE_NOT_RUNNING_ERROR;
use masq_lib::messages::{
UiConnectionStage, UiConnectionStatusRequest, UiConnectionStatusResponse,
Expand Down Expand Up @@ -62,7 +62,7 @@ impl Command for ConnectionStatusCommand {
}
}

as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

impl ConnectionStatusCommand {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/generate_wallets_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::commands::commands_common::{
};
use clap::{App, Arg, SubCommand};
use lazy_static::lazy_static;
use masq_lib::as_any_in_trait_impl;
use masq_lib::as_any_ref_in_trait_impl;
use masq_lib::messages::{UiGenerateSeedSpec, UiGenerateWalletsRequest, UiGenerateWalletsResponse};
use masq_lib::short_writeln;
use masq_lib::utils::DEFAULT_EARNING_DERIVATION_PATH;
Expand Down Expand Up @@ -165,7 +165,7 @@ impl Command for GenerateWalletsCommand {
Ok(())
}

as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

pub fn generate_wallets_subcommand() -> App<'static, 'static> {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/recover_wallets_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::commands::commands_common::{
};
use clap::{App, Arg, ArgGroup, SubCommand};
use itertools::{Either, Itertools};
use masq_lib::as_any_in_trait_impl;
use masq_lib::as_any_ref_in_trait_impl;
use masq_lib::messages::{UiRecoverSeedSpec, UiRecoverWalletsRequest, UiRecoverWalletsResponse};
use masq_lib::short_writeln;
use masq_lib::utils::to_string;
Expand Down Expand Up @@ -120,7 +120,7 @@ impl Command for RecoverWalletsCommand {
Ok(())
}

as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

const RECOVER_WALLETS_ABOUT: &str =
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/set_configuration_command.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::command_context::CommandContext;
use crate::commands::commands_common::{transaction, Command, CommandError};
use clap::{App, Arg, ArgGroup, SubCommand};
use masq_lib::as_any_in_trait_impl;
use masq_lib::as_any_ref_in_trait_impl;
use masq_lib::messages::{UiSetConfigurationRequest, UiSetConfigurationResponse};
use masq_lib::shared_schema::gas_price_arg;
use masq_lib::shared_schema::min_hops_arg;
Expand Down Expand Up @@ -53,7 +53,7 @@ impl Command for SetConfigurationCommand {
Ok(())
}

as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

const SET_CONFIGURATION_ABOUT: &str =
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/setup_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::command_context::CommandContext;
use crate::commands::commands_common::{transaction, Command, CommandError};
use crate::terminal::terminal_interface::TerminalWrapper;
use clap::{value_t, App, SubCommand};
use masq_lib::as_any_in_trait_impl;
use masq_lib::as_any_ref_in_trait_impl;
use masq_lib::constants::SETUP_ERROR;
use masq_lib::messages::{
UiSetupBroadcast, UiSetupInner, UiSetupRequest, UiSetupRequestValue, UiSetupResponse,
Expand Down Expand Up @@ -51,7 +51,7 @@ impl Command for SetupCommand {
Err(e) => Err(e),
}
}
as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

impl SetupCommand {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/wallet_addresses_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::commands::commands_common::{
};
use clap::{App, Arg, SubCommand};
use masq_lib::messages::{UiWalletAddressesRequest, UiWalletAddressesResponse};
use masq_lib::{as_any_in_trait_impl, short_writeln};
use masq_lib::{as_any_ref_in_trait_impl, short_writeln};

#[derive(Debug, PartialEq, Eq)]
pub struct WalletAddressesCommand {
Expand Down Expand Up @@ -66,7 +66,7 @@ impl Command for WalletAddressesCommand {
);
Ok(())
}
as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

#[cfg(test)]
Expand Down
6 changes: 3 additions & 3 deletions masq/src/communications/broadcast_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use masq_lib::messages::{
};
use masq_lib::ui_gateway::MessageBody;
use masq_lib::utils::ExpectValue;
use masq_lib::{as_any_in_trait, as_any_in_trait_impl, short_writeln};
use masq_lib::{as_any_ref_in_trait, as_any_ref_in_trait_impl, short_writeln};
use std::fmt::Debug;
use std::io::Write;
use std::thread;
Expand All @@ -20,15 +20,15 @@ use crate::notifications::connection_change_notification::ConnectionChangeNotifi

pub trait BroadcastHandle: Send {
fn send(&self, message_body: MessageBody);
as_any_in_trait!();
as_any_ref_in_trait!();
}

pub struct BroadcastHandleInactive;

impl BroadcastHandle for BroadcastHandleInactive {
//simply dropped (unless we find a better use for such a message)
fn send(&self, _message_body: MessageBody) {}
as_any_in_trait_impl!();
as_any_ref_in_trait_impl!();
}

pub struct BroadcastHandleGeneric {
Expand Down
2 changes: 1 addition & 1 deletion masq_lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "masq_lib"
version = "0.7.3"
version = "0.8.0"
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
license = "GPL-3.0-only"
description = "Code common to Node and masq; also, temporarily, to dns_utility"
Expand Down
25 changes: 23 additions & 2 deletions masq_lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ macro_rules! intentionally_blank {
}

#[macro_export]
macro_rules! as_any_in_trait {
macro_rules! as_any_ref_in_trait {
() => {
#[cfg(test)]
fn as_any(&self) -> &dyn std::any::Any {
Expand All @@ -423,7 +423,7 @@ macro_rules! as_any_in_trait {
}

#[macro_export]
macro_rules! as_any_in_trait_impl {
macro_rules! as_any_ref_in_trait_impl {
() => {
#[cfg(test)]
fn as_any(&self) -> &dyn std::any::Any {
Expand All @@ -432,6 +432,27 @@ macro_rules! as_any_in_trait_impl {
};
}

#[macro_export]
macro_rules! as_any_mut_in_trait {
() => {
#[cfg(test)]
fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
use masq_lib::intentionally_blank;
intentionally_blank!()
}
};
}

#[macro_export]
macro_rules! as_any_mut_in_trait_impl {
() => {
#[cfg(test)]
fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
self
}
};
}

#[macro_export]
macro_rules! test_only_use {
($($use_clause: item),+) => {
Expand Down
2 changes: 1 addition & 1 deletion multinode_integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "multinode_integration_tests"
version = "0.7.3"
version = "0.8.0"
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
license = "GPL-3.0-only"
description = ""
Expand Down
2 changes: 1 addition & 1 deletion multinode_integration_tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use masq_lib::test_utils::utils::TEST_DEFAULT_MULTINODE_CHAIN;
use masq_lib::utils::NeighborhoodModeLight;
use node_lib::accountant::db_access_objects::payable_dao::{PayableDao, PayableDaoReal};
use node_lib::accountant::db_access_objects::receivable_dao::{ReceivableDao, ReceivableDaoReal};
use node_lib::database::connection_wrapper::ConnectionWrapper;
use node_lib::database::db_initializer::{
DbInitializationConfig, DbInitializer, DbInitializerReal, ExternalData,
};
use node_lib::database::rusqlite_wrappers::ConnectionWrapper;
use node_lib::db_config::config_dao::{ConfigDao, ConfigDaoReal};
use node_lib::neighborhood::node_record::NodeRecordInner_0v1;
use node_lib::neighborhood::AccessibleGossipRecord;
Expand Down
10 changes: 5 additions & 5 deletions node/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "node"
version = "0.7.3"
version = "0.8.0"
license = "GPL-3.0-only"
authors = ["Dan Wiebe <[email protected]>", "MASQ"]
description = "MASQ Node is the foundation of MASQ Network, an open-source network that allows anyone to allocate spare computing resources to make the internet a free and fair place for the entire world."
Expand Down
2 changes: 1 addition & 1 deletion node/src/accountant/db_access_objects/banned_dao.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved.

use crate::accountant::db_access_objects::utils::{DaoFactoryReal, VigilantRusqliteFlatten};
use crate::database::connection_wrapper::ConnectionWrapper;
use crate::database::rusqlite_wrappers::ConnectionWrapper;
use crate::sub_lib::wallet::Wallet;
use lazy_static::lazy_static;
use rusqlite::{Error, ErrorCode, ToSql};
Expand Down
Loading

0 comments on commit bd56d3f

Please sign in to comment.