Skip to content

Add network mapper from bitshares-1 #1372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

pmconrad
Copy link
Contributor

@pmconrad pmconrad commented Oct 13, 2018

@pmconrad pmconrad added the 2e Ready for Testing Status indicating the solution is sufficiently developed to begin testing label Oct 13, 2018
@abitmore abitmore added this to the 201812 - Feature Release milestone Oct 13, 2018
Copy link
Member

@cogutvalera cogutvalera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is different: somewhere 2 spaces, somewhere 3 spaces, and somewhere 4 spaces (network_mapper.cpp).

Copy link
Member

@cogutvalera cogutvalera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

fc::ip::address(), 0, 0,
my_node_id.get_public_key(),
signature,
chain_id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is looking ugly

Copy link
Member

@cogutvalera cogutvalera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

std::string hostname = endpoint_string.substr(0, colon_pos);
return fc::resolve(hostname, port);
}

int main(int argc, char** argv)
Copy link
Member

@cogutvalera cogutvalera Oct 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not to use boost::program_options like in cli_wallet for example ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in addition IMHO we should have some default values

Copy link
Member

@cogutvalera cogutvalera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after compiling this code, I cannot start witness_node, I see next error:

./programs/witness_node/witness_node
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_any_cast> >'
  what():  boost::bad_any_cast: failed conversion using boost::any_cast
Aborted (core dumped)

@abitmore
Copy link
Member

@cogutvalera:

boost::bad_any_cast

Please merge latest develop when testing. I believe it's fixed by #1374.

@cogutvalera
Copy link
Member

@abitmore Thanks ! ok sure will bump now, I believe too that it will help, just thought about this too ...

@cogutvalera
Copy link
Member

rebase helped !

@pmconrad
Copy link
Contributor Author

Thanks. If whoever tackles #1348 decides that this tool might be handy, we can invest time to reformat and think about boost::program_options.

@oxarbitrage
Copy link
Member

I wanted to giuve a try to this tool however i am getting the following error with any seed i tried:

alfredo@alfredo-System-Product-Name:~/CLionProjects/pull1372/bitshares-core$ ./programs/network_mapper/network_mapper 4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8 bts-seed1.abit-more.com:62015
116.239.98.243:62015 ran into an error!
0 checked, 0 active, 0 to do
alfredo@alfredo-System-Product-Name:~/CLionProjects/pull1372/bitshares-core$ 
alfredo@alfredo-System-Product-Name:~/CLionProjects/pull1372/bitshares-core$ ./programs/network_mapper/network_mapper 4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8 95.179.137.33:1776
95.179.137.33:1776 ran into an error!
0 checked, 0 active, 0 to do
alfredo@alfredo-System-Product-Name:~/CLionProjects/pull1372/bitshares-core$

I am not running it properly ?

@pmconrad
Copy link
Contributor Author

Hm, seems to be some kind of initialization problem. If you specify two seed nodes (or one with several addresses) it'll work.

@pmconrad
Copy link
Contributor Author

Fixed stupid error. Hint: don't use promise.wait(timeout).

@oxarbitrage oxarbitrage mentioned this pull request Jan 29, 2019
7 tasks
@ryanRfox
Copy link
Contributor

ryanRfox commented Feb 1, 2019

@pmconrad I modified the PR Description to reference #1550 so I believe it will close that Issue upon merge and leave the original Issue open for now.

@oxarbitrage
Copy link
Member

I have a hard time understanding the usefulness of this program. Here is a sample log: https://raw.githubusercontent.com/oxarbitrage/logs/master/network-mapper.txt

Can someone direct me to a practical example on what someone can do with this output ?

Another thing, if we merge we need to update the programs README if we add this new program: https://github.com/bitshares/bitshares-core/blob/develop/programs/README.md

@dnotestein
Copy link

I have a hard time understanding the usefulness of this program. Here is a sample log: https://raw.githubusercontent.com/oxarbitrage/logs/master/network-mapper.txt

It generates .DOT file that can be rendered by graphviz to make images of node connectivity.

The DOT file is created here:
std::ofstream dot_stream((data_dir / "network_graph.dot").string().c_str());

@oxarbitrage
Copy link
Member

Thank you @dnotestein , makes sense now.

However it seems to not be working, the dot file is not generated:

alfredo@alfredo-System-Product-Name:/tmp/network_map_4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8$ ls
alfredo@alfredo-System-Product-Name:/tmp/network_map_4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8$ 

maybe because of segfault?

Failed to connect 94.130.120.250:51174 - skipping!
2338483ms th_m       network_mapper.cpp:51         start                ] timeout connecting to node 104.237.1.18:1776
Failed to connect 104.237.1.18:1776 - skipping!
terminate called after throwing an instance of 'fc::assert_exception'

Thread 1 "network_mapper" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff6ab5801 in __GI_abort () at abort.c:79
#2  0x00007ffff74a88fb in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff74aed3a in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff74aed95 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff74aefe8 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00005555556da203 in fc::ecc::public_key::serialize (this=<optimized out>) at /home/alfredo/CLionProjects/pull1372/bitshares-core/libraries/fc/src/crypto/elliptic_secp256k1.cpp:119
#7  0x0000555555632126 in fc::ecc::public_key::operator fc::array<char, 33ul> (this=<optimized out>)
    at /home/alfredo/CLionProjects/pull1372/bitshares-core/libraries/fc/include/fc/crypto/elliptic.hpp:42
#8  main (argc=<optimized out>, argv=<optimized out>) at /home/alfredo/CLionProjects/pull1372/bitshares-core/programs/network_mapper/network_mapper.cpp:243

@pmconrad
Copy link
Contributor Author

pmconrad commented Feb 5, 2019

Replaced with #1555, see comment there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2e Ready for Testing Status indicating the solution is sufficiently developed to begin testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants