Compare commits

...

3093 Commits

Author SHA1 Message Date
Nik Bougalis
d8a5f5b094 Set version to 0.50.2 2017-01-30 15:49:01 -08:00
Nik Bougalis
1ede09760e Set version to 0.50.1 2017-01-28 22:00:03 -08:00
Nik Bougalis
708fc6cd6f Improve SSL handshaking & cipher negotiation:
The default SSL cipher list introduced with 0.50.0 in
commit 2c87739 was overly restrictive and resulted in
clients unable to negotiate SSL connections.

Adjust the default cipher to the more sensible:

    HIGH:MEDIUM:!aNULL:!MD5:!DSS:!3DES:!RC4:!EXPORT

Correct a bug that would not allow an SSL handshake
to properly complete if the port was configured using
the `wss` keyword.
2017-01-28 22:00:02 -08:00
Nik Bougalis
77999579b5 Set version to 0.50.0 2017-01-26 21:57:49 -08:00
Nik Bougalis
d24bb65639 Set version to 0.50.0-rc2 2017-01-26 12:12:21 -08:00
Nik Bougalis
d810f29e99 Merge release (0.40.1) into develop (0.50.0-rc1) 2017-01-26 12:11:24 -08:00
Nik Bougalis
6e3e717876 Set version to 0.50.0-rc1 2017-01-17 17:20:52 -08:00
Nik Bougalis
2c87739d6c Harden default TLS configuration (RIPD-1332, RIPD-1333, RIPD-1334):
The existing configuration includes 512 and 1024 bit DH
parameters and supports ciphers such as RC4 and 3DES and
hash algorithms like SHA-1 which are no longer considered
secure.

Going forward, use only 2048-bit DH parameters and define
a new default set of modern ciphers to use:

    HIGH:!aNULL:!MD5:!DSS:!SHA1:!3DES:!RC4:!EXPORT:!DSS

Additionally, allow administrators who wish to have different
settings to configure custom global and per-port ciphers suites
in the configuration file using the `ssl_ciphers` directive.
2017-01-17 17:19:58 -08:00
Nik Bougalis
b00b81a861 Require at least OpenSSL 1.0.1g or 1.0.2j and later (RIPD-1331) 2017-01-17 17:19:58 -08:00
Vinnie Falco
a0a4eedc27 Set version to 0.50.0-b6 2017-01-17 15:28:44 -05:00
Vinnie Falco
c0e9e3df49 Update Beast subtree to 1.0.0-b23:
Merge commit '7028579170d83cb81a97478b620f3cb15a2fd693' into develop
2017-01-17 15:27:51 -05:00
Vinnie Falco
7028579170 Squashed 'src/beast/' changes from 1ab7a2f..c00cd37
c00cd37 Set version to 1.0.0-b23
f662e36 Travis CI improvements:
b05fa33 Fix message constructor and special members
b4722cc Add copy special members
420d1c7 Better logging in async echo server
149e3a2 Add file and line number to thrown exceptions
3e88b83 Tune websocket echo server for performance

git-subtree-dir: src/beast
git-subtree-split: c00cd37b8a441a92755658014fdde97d515ec7ed
2017-01-17 14:50:38 -05:00
Nik Bougalis
84ada74d53 Set version to 0.50.0-b5 2017-01-13 15:01:35 -08:00
Mike Ellery
be0fb67d8d Add ledger save/load test (RIPD-1378)
Provide unit test to invoke ledger load at startup.
2017-01-13 15:01:20 -08:00
Brad Chase
fb60cc9b5b Cleanup unit test support code (RIPD-1380):
* Remove `src/test/support/mao`
* Flatten `src/test/support/jtx` to `src/test/jtx`
2017-01-13 15:01:20 -08:00
Brad Chase
3c4d3b10c1 Update RPC handler role/usage (RIPD-557):
* Properly use the RPC method to determine required role for HTTP/S RPC calls.
* Charge for malformed RPC calls over HTTP/S
2017-01-13 15:01:20 -08:00
Edward Hennis
d9ef5ef98f Fix broken Intellisense (MSVC):
* MSVC Intellisense will ignore all file-level static_asserts.
2017-01-13 15:01:20 -08:00
Scott Schurr
be9c955506 Convert Workers to std::thread (RIPD-1189) 2017-01-13 15:01:20 -08:00
Edward Hennis
1989b1028f Add ledger_current_index to fee RPC result (RIPD-1300) 2017-01-13 15:01:20 -08:00
Mike Ellery
0d577d9349 Remove unused websocket files (RIPD-1293) 2017-01-13 15:01:20 -08:00
Mike Ellery
7536c53a48 Eliminate ledger data setup in test (RIPD-1372):
Change ledger-data json test fixture to simple jtx/Env setup.
2017-01-13 15:01:20 -08:00
Mike Ellery
e3ff30657c Eliminate npm tests (RIPD-1369)
Remove mention of npm tests in developer docs. Eliminate `npm test` from
automation and ci scripts.
2017-01-13 15:01:20 -08:00
Mike Ellery
698ea58b39 Improve setup for account_tx paging test (RIPD-1371):
Remove dependency on external fixture data by creating a ledger state
using jtx Env.
2017-01-13 10:38:21 -08:00
MarkusTeufelberger
a5500721db Don't consider function for ASAN
ge25519_scalarmult_base_choose_niels leads to errors (#1668) when compiled with address sanitizer.
2017-01-13 10:38:21 -08:00
Vinnie Falco
fd4ad29418 Set version to 0.50.0-b4 2017-01-11 16:53:13 -05:00
Vinnie Falco
905c627043 Check error on HTTP request in server 2017-01-11 16:52:45 -05:00
Vinnie Falco
8d8907e340 Update for Beast changes 2017-01-11 16:52:39 -05:00
Vinnie Falco
6724a63230 Update .vcxproj 2017-01-11 16:52:31 -05:00
Vinnie Falco
af4fe24939 Squashed 'src/beast/' changes from 2f9a844..1ab7a2f
1ab7a2f Set version to 1.0.0-b22
2eb4b0c Fix code sample in websocket.qbk
58802f4 Fix typos in design.qbk
19dc4bb Update documentation examples
10dbc5b Disable Boost.Coroutine deprecation warning
01c76c7 Fix websocket stream read documentation
d152c96 Update README.md example programs
995d86f Avoid copies in handler_alloc
851cb62 Add handler helpers
114175c Implement asio dealloc-before-invoke guarantee:
681db2e Add missing include
7db3c6e Fix broken Intellisense (MSVC)
09c183d Set version to 1.0.0-b21
1cb01fe Remove extraneous includes
62e65ed Set version to 1.0.0-b20
45eaa8c Increase utf8 checker code coverage
9ff1a27 Add zlib module:
a0a3359 Refactor HTTP identifier names (API Change):
79be7f8 Set version to 1.0.0-b19
eda1120 Tidy up internal name
4130ad4 Better buffer_cat:
f94f21d Fix consuming_buffers value_type (API Change):
2c524b4 prepared_buffers is private (API Change)
df2a108 Fix prepare_buffers value_type:
a4af9d6 Use boost::lexical_cast instead of std::to_string
62d670b Fix with_body example:
a63bd84 Increase code coverage
84a6775 Boost library min/max guidance:
02feea5 Add read, async_read for message_headers:
f224585 Add write, async_write, operator<< for message_headers:
ea48bcf Make chunk_encode public:
f6dd744 Refactor message and message_headers declarations:
9fd8aed Move sync_ostream to core/detail
c98b2d3 Optimize mask operations
d4dfc1a Optimize utf8 validation
7b4de4b Set version to 1.0.0-b18
feb5204 Add websocket::stream pong and async_pong
d4ffde5 Close connection during async_read on close frame:
644d518 Move clamp to core
427ba38 Fix write_frame masking and auto-fragment handling
54a51b1 Write buffer option does not change capacity
591dbc0 Meet DynamicBuffer requirements for static_streambuf
46d5e72 Reorganize source files and definitions
efa4b8f Override incremental link flags:
eef6e86 Higher optimization settings for MSVC builds
b6f3a36 Check invariants in parse_op:
47b0fa6 Remove unused field in test
8b8e57e unit_test improvements:
e907252 Clean up message docs
1e3543f Set version to 1.0.0-b17
de97a69 Trim unused code
796b484 Doc fixes
95c37e2 Fix unused parameter warnings and missing includes:
8b0d285 Refactor read_size_helper
97a9dcb Improve websocket example in README.md
236caef Engaged invokable is destructible:
d107ba1 Add headers_parser:
2f90627 Fix handling of body_what::pause in basic_parser_v1
9353d04 Add basic_parser_v1::reset
658e03c Add on_body_what parser callback (API Change):
50bd446 Fix parser traits detection (API Change):
df8d306 Tidy up documentation:
47105f8 Tidy up basic_headers for documentation
ada1f60 Refine message class hierarchy:
cf43f51 Rework HTTP concepts (API Change):
8a261ca HTTP Reader (API Change):
183055a Parser callbacks may not throw (API Change)
ebebe52 Add basic_streambuf::alloc_size
c9cd171 Fix basic_streambuf::capacity
0eb0e48 Tidying:
c5c436d Change implicit_value to default_value
01f939d Set version to 1.0.0-b16
206d0a9 Fix websocket failure tests
6b4fb28 Fix Writer exemplar in docs
4224a3a Relax ForwardIterator requirements in FieldSequence
14d7f8d Refactor base_parser_v1 callback traits:
d812344 Add pause option to on_headers interface:
c59bd53 Improve first line serialization
78ff20b Constrain parser_v1 constructor
2765a67 Refine Parser concept:
c329d33 Fix on_headers called twice from basic_parser_v1
55c4c93 Put back missing Design section in docs
90cec54 Make auto_fragment a boolean option
03642fb Rename to write_buffer_size
0ca8964 Frame processing routines are member functions
d99dfb3 Make value optional in param-list
325f579 Set version to 1.0.0-b15
c54762a Fix handling empty HTTP headers in parser_v1.hpp
c39cc06 Regression test for empty headers
60e637b Tidy up error types:
d54d597 Tidy up DynamicBuffer requirements
707fb5e Fix doc reference section
38af0f7 Fix message_v1 constructor
027c4e8 Add Secure WebSocket example
5baaa49 Add HTTPS example
076456b rfc7230 section 3.3.2 compliance
a09a044 Use bin/sh
1ff192d Update README.md for CppCon 2016 presentation
70b8555 Set version to 1.0.0-b14
b4a8342 Update and tidy documentation
8607af5 Update README.md
4abb43e Use BOOST_ASSERT
b5bffee Don't rely on undefined behavior
8ee7a21 Better WebSocket decorator:
38f0d95 Update build scripts for MSVC, MinGW
2a5b116 Fix error handling in server examples
4c7065a Add missing rebind to handler_alloc

git-subtree-dir: src/beast
git-subtree-split: 1ab7a2f04ca9a0b35f2032877cab78d94e96ebad
2017-01-11 16:50:38 -05:00
Vinnie Falco
c1c80dfc52 Merge commit 'af4fe2493925bc57c5c3343c383719fa72dea262' into b4.2 2017-01-11 16:50:38 -05:00
Vinnie Falco
87273e21d8 Set version to 0.50.0-b3 2017-01-10 12:44:52 -05:00
Nik Bougalis
610e51a162 Increase sqlite database limits 2017-01-10 12:43:55 -05:00
Nik Bougalis
e91aacc9a3 Set version to 0.40.1 2017-01-05 09:38:28 -08:00
Nik Bougalis
6e54461f4b Increase sqlite database limits 2017-01-05 09:32:17 -08:00
Brad Chase
ef23d72562 Set version to 0.50.0-b2 2016-12-29 13:53:19 -05:00
Edward Hennis
a1c0d15a1f Provide BOOST_ROOT to CMake docs target (RIPD-1364):
* Should make building docs with CMake incrementally easier and more
reliable.
* Wrap makeqbk in explicit bash shell (if available).
2016-12-29 13:50:57 -05:00
Brad Chase
b6a01ea41c Move support test code to src/test/support (RIPD-1313) 2016-12-23 20:39:02 -05:00
Nik Bougalis
8425e4558a Set version to 0.50.0-b1 2016-12-23 14:43:54 -08:00
Nik Bougalis
5a688f9236 Correct a check during RsaSha256 fulfillment loading:
The specification requires that we verify that the
signature and modulus of an RSA-SHA256 fulfillment
are both the same length (specifically that they
have "the same number of octets") referring to the
encoded length.

We were, instead, checking the number of bytes that
the signature and modulus had after decoding.
2016-12-23 14:43:53 -08:00
Miguel Portilla
effd8c9737 Fix scons 64bit OS detection 2016-12-23 14:36:11 -08:00
Miguel Portilla
a7c4d682d2 Ledger header RPC enhancements (RIPD-692):
This combines two enhancements to the ledger_data RPC
command and related commands.

The ledger_data RPC command will now return the ledger header
in the first query (the one with no marker specified).

Also, ledger_data and related commands will now provide the
ledger header in binary if binary output is specified.

Modified existing ledgerdata unit test to cover new functionality.
2016-12-23 14:36:11 -08:00
JoelKatz
e00a6b0e5a Enable amendments in genesis ledger (RIPD-1281)
When started with "--start", put all known, non-vetoed
amendments in the genesis ledger. This avoids the need
to wait 256 ledgers before amendments are enabled when
testing with a fresh ledger.
2016-12-23 14:36:11 -08:00
JoelKatz
dc3571184a Add a flag to the ledger for SHAMapV2
This will allow code that looks at the ledger header to know what version the
SHAMap uses. This is helpful for code that rebuilds ledger binary structures
from the leaves.
2016-12-23 14:36:11 -08:00
JoelKatz
22a375a5f4 Add support for tick sizes (RIPD-1363):
Add an amendment to allow gateways to set a "tick size"
for assets they issue. There are no changes unless the
amendment is enabled (since the tick size option cannot
be set).

With the amendment enabled:

AccountSet transactions may set a "TickSize" parameter.
Legal values are 0 and 3-15 inclusive. Zero removes the
setting. 3-15 allow that many decimal digits of precision
in the pricing of offers for assets issued by this account.

For asset pairs with XRP, the tick size imposed, if any,
is the tick size of the issuer of the non-XRP asset. For
asset pairs without XRP, the tick size imposed, if any,
is the smaller of the two issuer's configured tick sizes.

The tick size is imposed by rounding the offer quality
down to nearest tick and recomputing the non-critical
side of the offer. For a buy, the amount offered is
rounded down. For a sell, the amount charged is rounded up.

Gateways must enable a TickSize on their account for this
feature to benefit them.

The primary expected benefit is the elimination of bots
fighting over the tip of the order book. This means:

- Quicker price discovery as outpricing someone by a
  microscopic amount is made impossible. Currently
  bots can spend hours outbidding each other with no
  significant price movement.

- A reduction in offer creation and cancellation spam.

- More offers left on the books as priority means
  something when you can't outbid by a microscopic amount.
2016-12-23 14:36:11 -08:00
Scott Schurr
3337d17fdd Convert DeadlineTimer to std::thread (RIPD-1189) 2016-12-23 14:36:11 -08:00
Scott Schurr
8ab2236cdd Convert DeadlineTimer to chrono (RIPD-1189) 2016-12-23 14:36:10 -08:00
Rome Reginelli
0cb6a0f961 Correct PaymentChannelClaim flag names in comment 2016-12-23 14:36:10 -08:00
Mike Ellery
28ae522ea2 Migrate freeze-test to cpp (RIPD-1154):
Port all active tests in freeze-test.coffee to c++.
2016-12-23 14:36:10 -08:00
Mike Ellery
c0cf7bd3c1 Port discrepancy-test.coffee to c++ (RIPD-1352):
Add jtx unit test that verifies a transaction net balance against the
reported fee.
2016-12-23 14:36:10 -08:00
Mike Ellery
fd7a2835e4 Migrate path tests to cpp (RIPD-1155):
Implement the existing declarative-path-test in jtx framework.
2016-12-23 14:36:10 -08:00
Mike Ellery
3d0314c621 Remove websocketpp support (RIPD-1293) 2016-12-23 14:36:10 -08:00
Mike Ellery
8d83aa5c07 Add server/connection tests (RIPD-1336):
Migrate tests in uniport-test.js to cpp/jtx. Handle exceptions in
WSClient and JSONRPClient constructors. Use shorter timeout
for HTTP and WS Peers when client is localhost. Add missing call to
start_timer in HTTP Peer. Add incomplete WS Upgrade request test
to prove that server timeout is working.
2016-12-23 14:36:10 -08:00
Lieefu Way
7ff243ade9 Remove redundant call to clearNeedNetworkLedger 2016-12-23 14:36:10 -08:00
Howard Hinnant
2fd0540ed4 Recognize ripplerpc 2.0 requests and respond in kind:
* Force jtx to request/receive the 2.0 API
* Force the JSON and WebSocket tests to use 2.0 API
*  This specifically allows the Websocket to create 2.0 json/ripple
   and get back a 2.0 response.
* Add test for malformed json2
* Add check for parse failure
* Add check for params to be in array form.
* Correct type-o discovered in tests due to stricter checking.
* Add API version to the WSClient & JSONRPCClient test
* Update source.dox with more headers
2016-12-23 14:36:10 -08:00
wilsonianb
cdf470e68d Forward manifests from new peer (RIPD-1325):
Previously, manifests sent to new peers were marked as history so that
they would not be forwarded. However, this prevented a starting up
node's new manifest from being forwarded beyond its directly connected
peers. Stale or invalid manifests are still not forwarded.
2016-12-23 14:36:10 -08:00
Nik Bougalis
7fc780dd70 Set version to 0.40.0 2016-12-20 09:20:17 -08:00
seelabs
4d7b1a3b61 Set version to 0.40.0-rc3 2016-12-07 11:52:51 -05:00
seelabs
9a9dffa4ff Merge release into develop 2016-12-07 11:51:56 -05:00
seelabs
51e7f595bb Set version to 0.40.0-rc2 2016-12-06 21:38:13 -05:00
seelabs
293e520efc Set unfunded offers fix switch date 2016-12-06 21:38:10 -05:00
Nik Bougalis
9e960ff6b8 Set version to 0.40.0-rc1 2016-11-21 09:27:12 -08:00
Brad Chase
0a8e690917 Remove duplicate translation unit names 2016-11-21 09:22:43 -08:00
Brad Chase
cf60d4c30e Improve dependency installation during CI builds. 2016-11-21 09:21:55 -08:00
Nik Bougalis
8f2480225b Set version to 0.40.0-b11 2016-11-18 12:17:36 -08:00
Nik Bougalis
44167a6bcb Cleanup code identified in code review 2016-11-18 12:17:30 -08:00
seelabs
db95808206 Set unfunded offers fix switch date 2016-11-18 12:17:29 -08:00
Edward Hennis
fd901f8081 Support parallel 64- and 32-bit boost binaries (RIPD-1317):
* CMake and scons
* Update Visual Studio build docs
* Cache Appveyor PIP downloads for scons builds
* Rename the CMakeFuncs `find_` functions to `use_`
2016-11-18 12:17:29 -08:00
Mike Ellery
b6ce0aa75a Add build instructions for macOS:
Update existing wiki build instructions for macOS and migrate to
in-repo markdown file.
2016-11-18 12:17:29 -08:00
Mike Ellery
b712125bc0 Add TrustAndBalance Tests (RIPD-1153):
Migrate tests in send-test.js to cpp/jtx.
2016-11-18 12:17:29 -08:00
Nik Bougalis
d69b16895c Conditional Suspended Payments (RIPD-1140):
A conditional suspended payment is a suspended payment where
completion of the payment is contingent upon the fulfillment
of a condition defined by the sender during creation of the
suspended payment.

This commit also introduces the "CryptoConditions" amendment
which controls whether cryptoconditions will be supported
in suspended payments. The existing "SusPay" amendment can
be used to enable suspended payments without enabling the
cryptoconditions code.
2016-11-18 12:17:28 -08:00
Nik Bougalis
d198b439fd Cryptoconditions: RSA-SHA-256 (RIPD-1213) 2016-11-18 12:17:27 -08:00
Nik Bougalis
83aa5517c0 Cryptoconditions: PREFIX-SHA-256 (RIPD-1211) 2016-11-18 12:17:26 -08:00
Nik Bougalis
5711e7caa9 Cryptoconditions: ED25519 (RIPD-1214) 2016-11-15 21:42:31 -08:00
Nik Bougalis
8d0c93691d Cryptoconditions: PREIMAGE-SHA-256 (RIPD-1210) 2016-11-15 21:41:48 -08:00
Nik Bougalis
d8d0cb17ba Cryptoconditions Framework (RIPD-1139):
Cryptoconditions provide a mechanism to describe a signed message such
that multiple actors in a distributed system can all verify the same
signed message and agree on whether it matches the description. This
provides a useful primitive for event-based systems that are distributed
on the Internet since we can describe events in a standard deterministic
manner (represented by signed messages) and therefore define generic
authenticated event handlers.

The cryptoconditions specification implemented is available at:
    https://tools.ietf.org/html/draft-thomas-crypto-conditions-01
2016-11-15 21:41:25 -08:00
Nik Bougalis
47a919faf0 Set version to 0.40.0-b10 2016-11-09 13:58:53 -08:00
Nik Bougalis
d572de769b Improve peer iteration in overlay 2016-11-09 13:58:04 -08:00
seelabs
810a6b0f30 Add pthread flag 2016-11-09 13:58:04 -08:00
seelabs
665ad180cb Set unfunded offers fix switch date 2016-11-09 13:58:04 -08:00
Edward Hennis
361917e902 CMake unity and nonunity builds per project (RIPD-1326):
* Still respects "-Dtarget" unity/nonunity selection. Still defaults to
  unity.
* Adds a new target (rippled_classic or rippled_unity) depending on
  unity/nonunity selection.
* New target does not build by default.
  eg. Use `cmake --build . -target rippled_classic`
* Copy all config variables (Debug/Release to DebugClassic/ReleaseClassic) for nonunity builds
* CI uses the more generic "cmake --build" command
2016-11-09 13:58:04 -08:00
Miguel Portilla
4b261b12a4 Prevent misuse of JobQueue header files:
* Move `JobCoro` to `JobQueue::Coro` and remove separate JobCoro.h
2016-11-09 13:58:04 -08:00
wilsonianb
afd4b45036 Fix overlay README.md (RIPD-1330) 2016-11-09 13:58:04 -08:00
wilsonianb
47adc728db Add Linux instructions to docs/README.md 2016-11-09 13:58:04 -08:00
Mike Ellery
7e39d645b9 Add Ticket Tests (RIPD-1328):
Migrate ticket-test.js to cpp. Add coverage for Change/Cancel ticket
handlers.
2016-11-09 13:58:03 -08:00
Mike Ellery
35504f1723 Add Ledger RPC Tests (RIPD-1297):
Migrate tests in remote-test.js to cpp/jtx. Add coverage for
ledger_entry RPC request.
2016-11-09 13:58:03 -08:00
Brad Chase
61d9dda4e0 Expand unit test coverage of SetTrust:
* Unit test malformed/tem responses
* Update free trust line test to cover the case where creation is actually adding the opposite trust direction to an existing account lines ledger entry
* Add unit tests for setting and removing quality on trust lines.
2016-11-09 13:58:03 -08:00
Brad Chase
38ca9d4a97 Set version to 0.40.0-b9 2016-10-27 15:18:37 -04:00
Edward Hennis
f37aa1d6c8 Improve CMake find_boost compatibility:
* Put all the relevant calls together.
* Sensibly handle stage vs. stage64 lib directories.
* Unable to move target_link_libraries acur_project not defined in new location, so breaks non-win builds
2016-10-27 15:17:21 -04:00
Scott Schurr
db13ddf844 Fix unused variable warning from clang 2016-10-27 12:45:01 -04:00
Miguel Portilla
bf642404c7 Use ws2 as default in unit tests 2016-10-27 12:43:14 -04:00
S. Matthew English
d53d5cfc42 Fix typos/style issues in documentation 2016-10-27 12:41:11 -04:00
wilsonianb
bbf52056f9 Publish new manifest signature 2016-10-27 12:39:20 -04:00
Brad Chase
b8cae2dfaf Unit test for free trust lines (RIPD-911) 2016-10-27 12:36:01 -04:00
Scott Schurr
795ee8bb5e Add MacOS documentation to docs/README.md 2016-10-27 12:33:48 -04:00
Mike Ellery
cfcd618aa6 Add Offer tests (RIPD-938):
Migrate tests in offer-test.js to cpp/jtx. Minimally reformat existing
test code. Augment self-cross test to include partner account as well as bridged and
direct crossing.
2016-10-27 12:30:54 -04:00
Miguel Portilla
19258cf980 Remove application dependency from SyncFilters 2016-10-27 12:19:26 -04:00
seelabs
cdaafeb4b6 Improve openssl directory finding 2016-10-18 14:18:41 -04:00
Edward Hennis
7688a97d95 Set version to 0.40.0-b8 2016-10-17 15:32:34 -04:00
Nik Bougalis
027b289c91 Remove an unused argument from ripple::verify 2016-10-17 15:28:21 -04:00
wilsonianb
b55edfa8f0 Sign manifest with ephemeral and master keys (RIPD-1083) 2016-10-17 15:28:12 -04:00
Edward Hennis
7d46d153c6 Add CMake target for docs:
* Includes docs/ files in VC and xcode projects.
* Does NOT build automatically, so will not affect systems without the
  build toolchain.
2016-10-17 15:25:39 -04:00
Edward Hennis
96b17749af Setup instructions for doc toolchain for Windows 2016-10-17 15:18:49 -04:00
Vinnie Falco
f27348c4d5 Add HTML documentation framework 2016-10-17 15:18:40 -04:00
seelabs
c6923dcf88 Report error if OS is not 64-bit 2016-10-17 15:10:19 -04:00
David Schwartz
f456355da2 Begin consensus refactor (RIPD-1011):
* New RCLCx* classes
* Refactor consensus positions
* Refactor proposed transaction sets
* Refactor disputed transactions
* Refactor position broadcast/replay
2016-10-17 15:02:36 -04:00
JoelKatz
97806b42c4 Consensus refactor preliminary changes (RIPD-1011):
* Remove extraneous passing of transaction set hashes
* Remove recentPositions_. InboundTXs does the job now
* Move responsibility for sending "have TX set" out of consensus
2016-10-17 15:01:33 -04:00
JoelKatz
ed02b0717e Snapshotting an unbacked SHAMap should yield an unbacked SHAMap 2016-10-17 15:01:24 -04:00
Edward Hennis
2963e91752 Improve CI / cmake for ripple-libpp support (RIPD-1255):
* Simplify Travis APT config.
* Automatically retry Travis build and test script. Will result in fewer
  false negatives.
* Travis install scripts use absolute paths.
* Build a library of cmake functions for reuse.
* Disallow cmake builds in project root.
* Disallow cmake default 32-bit Visual Studio builds.
* Add several missing nonunity / header files, including all unit tests to
  cmake.
* Change gcc.debug.nounity Travis build to use cmake, instead of adding
  builds.
* Change Appveyor build to cmake. Eliminates most spurious failures, which
  are caused by python or scons failing to download.
2016-10-03 12:04:46 -04:00
Nik Bougalis
aa11effdd6 Set version to 0.40.0-b7 2016-10-01 19:10:17 -07:00
Nik Bougalis
6e9c15af92 Correctly parse multi-buffer JSON messages (RIPD-1306):
When attempting to parse a BufferSequence as a JSON object,
if the sequence contained more than buffer, the JSON parser
would incorrectly attempt to decode each buffer as a separate
JSON object, instead of one complete object.
2016-10-01 19:10:16 -07:00
Edward Hennis
0ddeb29c35 Add regression test for multi-buffer JSON message parsing (RIPD-1306) 2016-10-01 19:10:06 -07:00
Vinnie Falco
98f878cf10 Set version to 0.33.0-hf1 2016-10-01 12:36:40 -04:00
Nik Bougalis
69b47890e6 Correctly parse multi-buffer JSON messages (RIPD-1306):
When attempting to parse a BufferSequence as a JSON object,
if the sequence contained more than buffer, the JSON parser
would incorrectly attempt to decode each buffer as a separate
JSON object, instead of one complete object.
2016-10-01 12:36:37 -04:00
Edward Hennis
41851022d3 Add regression test for multi-buffer JSON message parsing (RIPD-1306) 2016-10-01 12:36:37 -04:00
Nik Bougalis
a7630aaa55 Set version to 0.40.0-b6 2016-09-30 08:46:47 -07:00
Nik Bougalis
1d15af6afd Merge master into develop 2016-09-30 08:46:07 -07:00
Nik Bougalis
dd0075f2b8 Set version to 0.40.0-b5 2016-09-29 16:28:37 -07:00
Nik Bougalis
4b0d8b630c Improve Buffer and Slice:
* Make Buffer constructible from a Slice
* Fix self-move-assignment in Buffer
* Add unit tests
2016-09-29 16:28:37 -07:00
Howard Hinnant
b421559a47 Prepare for boost 1.62
These changes are compatible with previous boost releases.
2016-09-29 19:24:49 -04:00
Mike Ellery
05e7373086 Add book_offers RPC tests (RIPD-1283):
Migrate orderbook-test.js to cpp tests. Provide
coverage for error conditions in book_offers
RPC method.
2016-09-29 19:24:49 -04:00
seelabs
bb0b97f46b Fix unfunded offer not removed (RIPD-1298):
If the mantissas of two non-native amounts differ by less than 10, then
subtracting them leaves a result of zero. This can cause situations
where `a>b`, yet `a-b == 0`.

One consequence of this is unfunded offers were incorrectly left in
order books. The code would check if the offer would be
consumed (`amount in offer > amount needed`), assume it wouldn't be,
yet when `amount needed` was subtracted from `amount in offer` the
result was zero and the offer was unfunded. This unfunded offer
incorrectly remained on the order book.

This patch fixes this bug.
2016-09-29 19:24:49 -04:00
Vinnie Falco
3b639afac2 Integrate NuDB 2016-09-29 19:24:15 -04:00
Vinnie Falco
bd93ecbd6b Merge commit '79159ffd87bf86e92ab5af6fffd5cc93c205a630' as 'src/nudb' 2016-09-29 19:24:13 -04:00
Vinnie Falco
79159ffd87 Squashed 'src/nudb/' content from commit 00adc6a
git-subtree-dir: src/nudb
git-subtree-split: 00adc6a4f16679a376f40c967f77dfa544c179c1
2016-09-29 19:24:12 -04:00
Nik Bougalis
f05321d501 Set version to 0.33.0 2016-09-29 12:02:57 -07:00
johannakate
8734458cfb add the getInfoRippled.sh support script:
The script can be used to quickly and easily retrieve
information to assess the health of a rippled server
2016-09-29 12:02:47 -07:00
Nik Bougalis
bdbb3caf47 Set version to 0.33.0-rc3 2016-09-21 12:11:44 -07:00
seelabs
076658e0f6 Set issuer fix switch date 2016-09-21 11:40:53 -07:00
Miguel Portilla
b2499c8fa0 Add Status page:
* Make HTTP(S) requests on websocket ports reply with Status page
* Fix isWebsocketUpgrade to compare case insensitive
* Make websocket upgrades with no websocket protocols configured report error
* Create unit test for unauthorized requets and the status page
2016-09-21 14:17:32 -04:00
Nik Bougalis
231a5ae6fb Set version to 0.40.0-b4 2016-09-21 11:02:54 -07:00
seelabs
45249e8746 Set issuer fix switch date 2016-09-21 09:03:55 -07:00
Miguel Portilla
e6ed9ae4d8 Add Status page:
* Make HTTP(S) requests on websocket ports reply with Status page
* Fix isWebsocketUpgrade to compare case insensitive
* Make websocket upgrades with no websocket protocols configured report error
* Create unit test for unauthorized requests and the status page
2016-09-21 09:03:55 -07:00
Aishraj Dahal
aca6db5601 Fix typo 2016-09-21 09:03:54 -07:00
Vinnie Falco
8e9f9599b8 Set version to 0.40.0-b3 2016-09-15 17:05:41 -04:00
Vinnie Falco
71d7d87bf3 Update for Beast 1.0.0-b13 2016-09-15 17:05:08 -04:00
Vinnie Falco
7ffef30f1c Add 'src/beast/' from commit '2f9a8440c2432d8a196571d6300404cb76314125'
git-subtree-dir: src/beast
git-subtree-mainline: 7c90b9ef88
git-subtree-split: 2f9a8440c2
2016-09-15 15:07:45 -04:00
Vinnie Falco
7c90b9ef88 Remove Beast subtree in preparation for git-subtree add 2016-09-15 15:07:34 -04:00
Vinnie Falco
4bb74196c0 Merge commit '2f9a8440c2432d8a196571d6300404cb76314125' into develop 2016-09-15 14:21:55 -04:00
seelabs
35fa20a110 Set version to 0.40.0-b2 2016-09-13 18:53:50 -04:00
seelabs
ddaeae2855 Set version to 0.33.0-rc2 2016-09-13 18:33:40 -04:00
seelabs
9c8e3776de Set issuer fix switch date 2016-09-13 18:31:47 -04:00
seelabs
633cf86ad8 Set issuer fix switch date 2016-09-13 18:18:58 -04:00
Nik Bougalis
66ce8779e8 Set version to 0.40.0-b1 2016-09-12 09:23:42 -07:00
Nik Bougalis
a9b3042d7e Remove unused tables from wallet.db 2016-09-12 09:23:41 -07:00
Nik Bougalis
4df24c0e8e Upgrade SQLite to 3.14.1 2016-09-12 09:23:40 -07:00
Nik Bougalis
9a988963e9 Refactor STObject, STLedgerEntry:
* Normalize names
* Remove unused and deprecated members
2016-09-12 09:23:39 -07:00
Nik Bougalis
5be33a650d Report ledger information in account_lines RPC (RIPD-1276) 2016-09-12 09:23:38 -07:00
Will
5b09dc731f Add jtx cpp test for noripple flag (RIPD-1259):
- Set and clear noripple flag
 - DefaultRipple on account
 - Set noripple on trustline with -ve balance
 - Pairwise noripple
2016-09-12 09:23:30 -07:00
Mike Ellery
51d7e7336f Improve multisign tests (RIPD-1273):
* Migrate some error case tests from js into jTx.
* Create test that invokes sign_for and submit_multisigned rpc methods.
2016-09-12 09:23:29 -07:00
Mike Ellery
ad9be4dbf6 Add LedgerClosed test (RIPD-1272)
Migrate the logic in monitor-test.js to a new jtx test
that covers the ledger_closed RPC method.
2016-09-11 14:01:36 -07:00
seelabs
87756b9324 Set version to 0.33.0-rc1 2016-09-07 16:56:37 -04:00
seelabs
e611a7a0f8 Set issuer fix switch date 2016-09-07 14:35:37 -04:00
Vinnie Falco
2f9a8440c2 Set version to 1.0.0-b13 2016-09-02 16:56:33 -04:00
Vinnie Falco
a40dd2690a Better dstream:
* non-Windows dstream is a simple reference alias
* dstream constructor takes a target ostream argument
* dstream inherits the unitbuf setting of the target stream
2016-09-02 16:56:19 -04:00
Vinnie Falco
802c2395c1 Set version to 0.33.0-b8 2016-09-02 15:31:19 -04:00
Brad Chase
8f97889176 Don't include unit test sources in code coverage (RIPD-1132):
Most files containing unit test code are moved to
src/test. JTx and the test client code are not yet moved.
2016-09-02 15:26:16 -04:00
Vinnie Falco
104f12a9e2 Tidy up CMakeLists 2016-09-02 10:38:43 -04:00
Vinnie Falco
e499743cdd Remove bin and bin64 directories:
These directories are removed, to make it easier for developers
to delete the entire directory contents when rebuilding CMake targets
after a configuration change.
2016-09-02 10:01:32 -04:00
Vinnie Falco
241795cd73 Set version to 1.0.0-b12 2016-08-29 15:07:23 -04:00
Vinnie Falco
411b2534ed Use -p to print suites from unit test main 2016-08-29 15:07:15 -04:00
Vinnie Falco
253f138aff Add BEAST_EXPECTS test failure macro:
New overloads of suite::expect take the file and line number
as individual parameters, cleaning up the file name output
by showing only the filename part (to not leak the full path,
which might contain sensitive information).

A new macro BEAST_EXPECTS allows an additional reason
string as well as reporting the file and line. Typical usage:

    ```
    error_code ec;
    ...
    if(! BEAST_EXPECTS(! ec, ec.message()))
        return;
    ```
2016-08-29 13:46:31 -04:00
Vinnie Falco
dadbab4c0f Fix unit test runner to output all case names:
Also fixes a bug where suite::log was incorrectly flushed.
2016-08-29 11:48:45 -04:00
Vinnie Falco
d9017a3f76 Tidy up whitespace 2016-08-29 11:47:01 -04:00
Vinnie Falco
aedfaab93d Update README, rename CHANGELOG 2016-08-29 10:29:07 -04:00
Nik Bougalis
8687f64429 Set version to 0.33.0-b7 2016-08-27 18:00:05 -07:00
Nik Bougalis
1d08075c43 Simplify Beast code:
- Use std instead of custom Beast classes
- Remove Beast heap block allocator
- Remove function call timer
2016-08-27 18:00:00 -07:00
Howard Hinnant
8a6c7f9208 Move varint out of NuDB
varint is no longer used by NuDB.  It is now only used by codec.h in
nodestore and so has been moved there.
2016-08-27 17:59:36 -07:00
Mike Ellery
fd061bba8a Augment LedgerRequestRPC tests (RIPD-1270):
Add basic ledger_request validation tests to replace the existing
ledger.js tests. Provide tests that trigger some error conditions
in RPC handling code.
2016-08-27 17:59:36 -07:00
Mike Ellery
8f41817cb9 Add ledger_data RPC tests (RIPD-1260):
Migrate ledger-data-test.js to cpp tests. Provide coverage for
paging limits and input error cases.
2016-08-27 17:59:27 -07:00
seelabs
cf8b6be494 Set issuer in balanceHook 2016-08-26 16:08:30 -07:00
Vinnie Falco
d263d4d449 Set version to 1.0.0-b11 2016-08-26 13:06:51 -04:00
Keaton Okkonen
b39e4817e5 Update README.md (fix #62) 2016-08-26 13:06:44 -04:00
Vinnie Falco
4dfa250a34 Rename websocket echo servers (fix #46) 2016-08-26 13:06:44 -04:00
Vinnie Falco
8a6908c072 Rename to DynamicBuffer (fix #47) 2016-08-26 13:06:43 -04:00
Vinnie Falco
d8fe737ad7 Number error codes from 1 (fix #54) 2016-08-26 13:06:43 -04:00
Vinnie Falco
61023c3f4a Update HTTP documentation (fix #61, #60, #59) 2016-08-26 13:06:42 -04:00
Vinnie Falco
b607d47bd3 Restyle sources 2016-08-26 13:06:42 -04:00
Vinnie Falco
878c0f2a19 Set URI in generated WebSocket Upgrade requests (fix #64):
The 'resource' parameter in the call to stream::handshake is
used when building the HTTP request to perform the upgrade.
2016-08-26 13:06:42 -04:00
Vinnie Falco
19dd983d2b Fix integer warnings in 64-bit Windows build 2016-08-26 13:06:41 -04:00
Vinnie Falco
c15751ced6 Update documentation and images 2016-08-26 13:06:41 -04:00
Vinnie Falco
a55d9aa4c3 Tidy up 32 and 64 bit build support (fix #49):
This fixes up support for building both 32 and 64 bit targets, especially on Windows.
2016-08-26 13:06:39 -04:00
Nik Bougalis
037d52114a Print the testcase header prior to logging (fix #56) 2016-08-26 07:33:43 -07:00
seelabs
68e123a8d6 Set version to 0.33.0-b6 2016-08-18 11:34:59 -04:00
seelabs
b92a7d415e Use deferred credits in XRPEndpointStep:
The XRPEndpointStep bypassed the logic in deferred credits and
incorrectly counted funds acquired during a payment as available for
use in the payment. It also incorrectly used the current ownerCount when
calculating the reserve instead of the owner count as it was at the
beginning of the payment (reducing the owner count is analogous to
acquiring funds during a payment.)
2016-08-18 11:34:12 -04:00
JoelKatz
fc73fbd050 Remove old-style pathfinding code
All cases that still used the old RPF code now use new-style pathfinding.
This includes unit tests, RPF requests with a ledger specified, and RPF
requests in standalone mode.
2016-08-18 11:34:12 -04:00
seelabs
ab45c490d7 Require empty string for empty peer account on account_lines:
A recent commit (0d0227e744) broke the
parser for the rpc command `account_lines` such that an empty
string ("") was no longer required for the second parameter. This commit
fixes that bug.

Note the empty peer field string requirement only applies to the rippled
command line. It can be comitted with a ledger via HTTP or WebSocket.
2016-08-16 08:29:01 -04:00
Nik Bougalis
d8b85c00e8 Set version to 0.33.0-b5 2016-08-15 11:21:27 -07:00
Howard Hinnant
e453c14b0a Add SHAMapV2 to supportedAmendments 2016-08-15 11:21:10 -07:00
Mike Ellery
1c6e32ccc2 Migrate SetRegularKey unit tests (RIPD-1258):
Create SetRegularKey test to replace existing js test. Copy and simplify
some existing test logic from Env_test.cpp and MultiSign.test.cpp. Add
coverage for tfUniversalMask tx flag error case.
2016-08-15 11:18:40 -07:00
Mike Ellery
c4e581179c Migrate AccountSet unit tests (RIPD-1249):
Move existing functionality of account_set-tests.js into a native
unit test. Improve coverage by testing more cases.
2016-08-15 11:15:35 -07:00
Mike Ellery
0d803e0fa2 Refactor uses of strCopy (RIPD-1256)
Replace the sparsely used strCopy function with Slice. Change some of
the SHAMap interface to use Slice instead of Blob, which should
eliminate a copy.
2016-08-15 11:09:45 -07:00
Edward Hennis
c1b8efb7af Clear queue for account with high fee tx (RIPD-1246):
* If an account has any transactions in the transaction queue, submitting
  a transaction that covers the differences to the open ledger fee level
  for prior queued transactions plus itself will cause all those
  transactions to be applied to the open ledger.
* tel failures in `TxQ::accept` will leave tx in the queue to retry later.
2016-08-15 11:09:18 -07:00
seelabs
b0704b47e8 Remove _FORTIFY_SOURCES from build:
This option is silently ignorned at -O0
2016-08-15 11:08:38 -07:00
seelabs
2fa84e95b9 Add test for path with offer that changes issuer only 2016-08-15 11:08:21 -07:00
seelabs
b02ec47b4f Fix signed comparison bug in range_check_cast 2016-08-15 11:07:58 -07:00
Vinnie Falco
3ff56eb071 Set version to 1.0.0-b10 2016-08-12 21:02:44 -04:00
Vinnie Falco
9e8a5a5765 Update README.md for CppCon 2016 2016-08-12 21:02:40 -04:00
Vinnie Falco
461a8ea846 Add WebSocket implementation comparison doc 2016-08-12 21:02:40 -04:00
Vinnie Falco
8d9c0daa9d Add BEAST_EXPECT macro:
This macro is used in the unit test framework to assist in
reporting the file and line number of test failures.
2016-08-12 21:02:40 -04:00
Ties Jan Hefting
1537527927 Fix warnings 2016-08-12 21:02:39 -04:00
seelabs
d51a2785ee Set version to 0.33.0-b4 2016-08-08 12:25:57 -04:00
Nik Bougalis
e8a7ad4748 Prevent concurrent write operations in websockets 2016-08-07 13:15:19 -07:00
seelabs
2ca18670d2 Set version to 0.33.0-b3 2016-08-05 11:13:59 -04:00
seelabs
d4a56f223a Payment Channels (RIPD-1224):
Payment channels permit off-ledger checkpoints of XRP payments flowing
in a single direction. A channel sequesters the owner's XRP in its own
ledger entry. The owner can authorize the recipient to claim up to a
give balance by giving the receiver a signed message (off-ledger). The
recipient can use this signed message to claim any unpaid balance while
the channel remains open. The owner can top off the line as needed. If
the channel has not paid out all its funds, the owner must wait out a
delay to close the channel to give the recipient a chance to supply any
claims. The recipient can close the channel at any time. Any transaction
that touches the channel after the expiration time will close the
channel. The total amount paid increases monotonically as newer claims
are issued. When the channel is closed any remaining balance is returned
to the owner. Channels are intended to permit intermittent off-ledger
settlement of ILP trust lines as balances get substantial. For
bidirectional channels, a payment channel can be used in each direction.
2016-08-05 11:13:57 -04:00
seelabs
2e7f5502bf Fix RPC parsing bug 2016-08-05 11:13:57 -04:00
seelabs
4483079181 Remove extra path separator from CMAKE_SOURCE_DIR 2016-08-05 11:13:57 -04:00
Nik Bougalis
2f0b3bd427 Set version to 0.33.0-b2 2016-08-02 15:13:11 -07:00
Edward Hennis
d1ce07ef5d Minor refactor of LoadFeeTrack (RIPD-956):
* Load scaling functions are free, and take `Fees`.
* Move LoadFeeTrack to app/misc.
* Update naming convention.
2016-08-02 18:05:08 -04:00
Edward Hennis
a252fefede Report escalated ledger fee in load_factor (RIPD-1207):
* Updates both server_info and server_state
* Adds "load_factor_server", which reports the server-only portion of the
  load (if appropriate) so clients can decide an appropriate fee to pay if
  the open ledger fee is higher than they're willing to pay.

=== Release Notes ===
==== Updated Features ====

Both `server_info` and `server_state` report the escalated ledger fee in
the `load_factor` result parameter. If appropriate, `load_factor_server`
reports the server-only portion of the load so clients can submit a fee
between those two values to get into the queue.
2016-08-02 18:04:47 -04:00
Edward Hennis
e762d09e7e Tx queue enhancements and RPC info (RIPD-1205, RIPD-1206):
* Account-related queue stats (RIPD-1205). Boolean "queue" parameter to
  account_info only if requesting the open ledger.
* Account for the TxQ when autofilling sequence in sign-and-submit (RIPD-1206)
* Tweak TxQ::accept edge case when choosing which tx to try next.
* Labels for experimental "x_" submit parameters use correct separator.

=== Release Notes ===
==== New features ====

When requesting `account_info` for the open ledger, include the `queue :
true` to get extra information about any queued transactions for this
account. (RIPD-1205).

==== Bug fixes ====

When using sign-and-submit mode to autofill a transaction's sequence
number, the logic will not reuse a sequence number that is in the queue
for this account. (RIPD-1206).

Labels for experimental "x_queue_okay" and "x_assume_tx" parameters to
`sign` and `submit` updated to use correct separator.
2016-08-02 18:03:53 -04:00
Will
348e65074e fix bug in error propagation for account badSeed (RIPD-1248) 2016-08-02 13:25:48 -07:00
Will
64f2576fc8 Add jtx cpp test for account_objects RPC (RIPD-1230)
port of js test, account_objects-test.js
- bob account setup and rpc invoke
- error tests; no account, non-existant account, bad seed, validation
- combined unstepped testcase then stepped with limit/marker
2016-08-02 13:25:48 -07:00
Mike Ellery
9926d3188a Add jtx test for account_offers RPC (RIPD-1236)
Details
 -------

  * covers existing account_offers-test.js
  * adds new coverage for results limiting and some
    negative tests (bad input)
  * fix bug in json value copying logic for bad seed/account error
    case
  * using new BEAST_EXPECT macros
2016-08-02 13:25:48 -07:00
seelabs
cc8671b8b2 Add OwnerPays to supportedAmendments 2016-08-02 13:25:48 -07:00
wilsonianb
f5fcdd0b80 Update pywin32 version in appveyor 2016-08-02 13:25:48 -07:00
Miguel Portilla
71a30a57cb Fix scons vcxproj in OS X 2016-08-02 13:25:48 -07:00
Miguel Portilla
f9fe2ef90f Fix inbound ledger add peers logic 2016-08-02 13:25:48 -07:00
Scott Schurr
6c8673c7c3 Remove unused member variable in ApplyBaseView 2016-08-02 13:25:48 -07:00
JoelKatz
11b64e049c Report frozen lines in gateway_balances(RIPD-1217):
* Report lines frozen by the gateway separately
* Add unit test for gateway_balances
* Clean up some existing code
2016-08-02 13:25:48 -07:00
JoelKatz
33f153fc9a Consensus refactor preliminary changes (RIPD-1011):
* Standardize names of LedgerConsensusImp members
* Rework visitStoredProposals
* Clean up mapComplete
* Move status helpers out of LedgerConsensusImp
* Move applyTransaction out of LedgerConsensusUmp
* Clean up applyTransactions
2016-08-02 13:25:48 -07:00
JoelKatz
4758050444 SHAMap fixups:
* Change state_ to Invalid if inner node types mismatch
* flushDirty before unsharing to ensure modified nodes get written
* Remove unnecessary code
* Fix updateHash for V2 inner nodes
* In descend, call isInconsistentNode only if node is found
* getMissingNodes could request duplicates in some cases
* An invalid node with the right hash is useful, it proves the map invalid
2016-08-02 13:25:48 -07:00
Nik Bougalis
a5589dcec6 Set version to 0.33.0-b1 2016-07-29 17:58:26 -07:00
Nik Bougalis
08ea245101 Hoist version string to namespace level 2016-07-29 17:58:24 -07:00
seelabs
3b58e36621 Add CMake support:
cmake support in rippled. Currently supports:

 * unity/nounity debug/release
 * running protobuf
 * sanitizer builds
 * optional release build with assert turned on
 * `target` variable to easily set compiler/debug/unity
    (i.e. -Dtarget=gcc.debug.nounity)
 * gcc/clang/visual studio/xcode
 * linux/mac/win
 * gcc 4 ABI, when needed
 * ninja builds
 * check openssl for acceptably recent release
 * static builds

TBD:
 * jemalloc support
 * count

Notes:
 * Use the -G"Visual Studio 14 2015 Win64" generator on Windows. Without
   this a 32-bit project will be created. There is no way to set the
   generator or force a 64-bit build in CMakeLists.txt (setting
   CMAKE_GENERATOR_PLATFORM won't work). The best solution may be to
   wrap cmake with a script.

 * It is not possible to generate a visual studio project on linux or
   mac. The visual studio generator is only available on windows.

 * The visual studio project can be _either_ unity or
   non-unity (selected at generation time).  It does not appear possible
   to disable compilation based on configuration.

 * Language is _much_ worse than python, poor documentation and "quirky"
   language support (for example, generator expressions can only be used
   in limited contexts and seem to work differently based on
   context (set_property can set multiple values, add_compile_options
   can not/or is buggy)

 * Could not call out to `sed` because cmake messed with the regular
   expression before calling the external command. I did not see a way
   around this.

 * Makefile generators want to be single target. It wants a separate
   directory for each target type. I saw some mentions on the web for
   ways around this bug haven't look into it. The visual studio project
   does support debug/release configurations in the same project (but
   not unity/non-unity).
2016-07-29 17:57:50 -07:00
Miguel Portilla
b343b0468a Use lock_guard over unique_lock 2016-07-29 17:57:49 -07:00
Will
69b91065c5 Remove OpenSSL Base64 encoding dependency (RIPD-1238) 2016-07-29 17:57:49 -07:00
Vinnie Falco
e39316882e Add BEAST_EXPECT, replace calls to expect 2016-07-29 17:46:56 -07:00
Nik Bougalis
1ff972fbd3 Set version to 0.32.1 2016-07-29 12:52:26 -07:00
Vinnie Falco
8204d9524e Set version to 1.0.0-b9 2016-07-22 11:57:13 -04:00
wilsonianb
07bf106cd3 Handle undefined VARIANT in cmake 2016-07-22 11:56:40 -04:00
Vinnie Falco
225b5a1204 Set version to 1.0.0-b8 2016-07-21 17:03:54 -04:00
Vinnie Falco
054d5de877 Fix rfc2616 Section 4.2 compliance:
basic_headers no longer combines fields with the same name by appending
a comma and concatenating the two values together. This was breaking
certain header fields which expect each value to be distinct, such as
the "Set-Cookie" header.

Now the container behaves more like a multi set with respect to insertion
of multiple values with the same field name. Additional member functions
are provided to provide extra functionality.
2016-07-21 17:03:19 -04:00
Vinnie Falco
5349bcc1c5 Update Example code in documentation 2016-07-21 17:03:18 -04:00
Jack Bond-Preston
17fd2ef2e2 Fix to_string.hpp include path in example code 2016-07-21 17:03:18 -04:00
wilsonianb
e199c0555c Build coverage and usan Travis CI targets with CMake 2016-07-21 17:03:18 -04:00
seelabs
42557b800c Add cmake and clang build to travis 2016-07-21 17:03:18 -04:00
Casey Bodley
ef2330d477 Use Threads::Threads interface library in cmake
in addition to passing ${CMAKE_THREAD_LIBS_INIT} to the linker, this
interface library will also add -pthread to the compile options when
supported

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2016-07-21 17:03:17 -04:00
Nik Bougalis
cb7d0b508d Set version to 0.32.1-rc1 2016-07-14 17:31:32 -07:00
Nik Bougalis
cf72d70eca Clarify owner reserve requirements for trust lines (DOC-456) 2016-07-12 13:35:27 -07:00
seelabs
cf9d65f973 Set version to 0.32.1-b4 2016-07-07 14:45:17 -04:00
seelabs
dd2feb8d1f Use boost::thread_specific_ptr instead of thread_local:
`thread_local` causes deployment problems with CentOS 7
2016-07-07 14:45:15 -04:00
seelabs
d790c3b671 Set version to 0.32.1-b3 2016-07-06 14:09:41 -04:00
seelabs
a56c43f3b3 Rename file to avoid duplicate object file name 2016-07-06 14:08:31 -04:00
seelabs
6f3a35e8be Better unhandled exception handling:
Log thread name and exception type on unhandled exceptions and use a
terminate handler to get a stack trace that includes the function that
thows the exception.
2016-07-06 14:07:57 -04:00
seelabs
c9d8fa9e96 Rename reportUncaughtExceptions to threadEntry 2016-07-06 14:07:57 -04:00
wilsonianb
b72724a4a4 Ignore empty CONFIG_DIR for validators file (RIPD-1221) 2016-07-06 14:06:56 -04:00
Vinnie Falco
f8a1ec0348 Set Beast version to 1.0.0-b7 2016-07-06 13:37:28 -04:00
Vinnie Falco
8375ae647e Add skip_body parser option 2016-07-06 13:36:15 -04:00
Vinnie Falco
69da298aa7 Remove extraneous header file status.hpp 2016-07-06 13:36:15 -04:00
Vinnie Falco
6765507cc4 Add usage example to rfc7230 javadocs 2016-07-06 13:36:14 -04:00
Vinnie Falco
e2c67a1666 Fixes and documentation for teardown and use with SSL:
This solves a problem where clang and gcc locate the deleted
version of teardown and async_teardown instead of the overloaded
version. It requires overloads to add `teardown_tag` into the signature
so that the rules for argument dependent lookup can find the
right function. Improve documentation of teardown requirements

The documentation is updated to clearly explain the need for including
<beast/websocket/ssl.hpp> to use SSL streams with WebSocket.

The default implementations of teardown and async_teardown now use
static_assert to alert the user of improper usage, with comments
providing guidance for resolving the error.
2016-07-06 13:36:14 -04:00
Vinnie Falco
6397025435 Remove deprecated example http::stream wrapper 2016-07-06 13:36:12 -04:00
Vinnie Falco
2a448065da Simplify HTTP crawler example 2016-07-06 13:36:00 -04:00
Vinnie Falco
5c7130e4fd Fixes and simplifications to HTTP example server:
The example HTTP server is updated to provide the correct MIME-type.
It no longer uses the now-deprecated http::stream class, since that
implementation does not provide flow control. A new example async_write
function is provided in the asynchronous server for managing the
lifetime of a message sent asynchronously.

The logging is thread-safe, and a bug causing connections to
malfunction is fixed.
2016-07-06 13:36:00 -04:00
Vinnie Falco
bbad20c66f Qualify some calls:
This fixes a problem where a call to read() is ambiguous because
the argument list contains objects from both boost::asio and
beast::http.

Users invoking read may need to do so fully qualified, by writing:
    beast::http::read(...);
2016-07-06 13:35:57 -04:00
seelabs
e29163e922 Set version to 0.32.1-b2 2016-07-01 17:14:37 -04:00
JoelKatz
2633949d5b Fix access to obsolete reference in PathRequest (RIPD-1219):
* Don't access jvArray if newStatus is replaced
* Remove iLastLevel and use just iLevel
2016-07-01 17:13:16 -04:00
Nik Bougalis
16a38f3979 Catch unhandled exceptions in I/O service threads (RIPD-1166) 2016-07-01 17:13:16 -04:00
Scott Schurr
c4f8b38148 Remove undesirable Journal::Stream constructor:
Constructing a Stream from a Sink would elide specifying the
Severity level of the Stream.  That constructor is removed so
if a Stream is constructed from a Sink the Severity must be
specified.
2016-07-01 17:13:16 -04:00
Scott Schurr
40678e9a78 Make debugLog() return a beast::Journal (RIPD-1209):
Previously, writes using debugLog() tagged every entry with
"TRC:".  Now users of debugLog() must specify the severity
level they want their information logged at.
2016-07-01 17:13:16 -04:00
Miguel Portilla
8f5449dafb Fix BaseHTTPPeer::write strand thread context 2016-07-01 17:13:16 -04:00
Nik Bougalis
8c90ef810a Catch exception from websocketpp 2016-07-01 17:13:16 -04:00
Edward Hennis
177a52473a Improve TxQ edge-case handling logic (RIPD-1200):
* HashRouter: Track relay expiration separately from item lifespan.
** Renamed `swapSet` to `shouldRelay`.
** Cleaned up `HashRouter` member names and removed unused code.
** Remove `SF_RELAYED` flag.
* Fix TxQ edge case replacing dropped transactions.
* Fix TxQ bug in maximumTxnPerAccount check.
2016-07-01 17:13:11 -04:00
Miguel Portilla
a22fa21ce4 Set version to 0.32.1-b1 2016-06-28 14:54:04 -04:00
Miguel Portilla
beb9883705 Remove incompatible OS X switches in Test.py 2016-06-28 14:53:49 -04:00
Edward Hennis
654772a860 Autofill with x-queue-okay uses mult_max fee (RIPD-1194):
* Only relevant if escalated fee is larger than mult_max.
* Will improved queue position, giving tx more chance to succeed.
2016-06-28 14:53:49 -04:00
Edward Hennis
9cc80b7cb6 Test.py exit code accurate in all cases (RIPD-1193):
* Also remove some redundant output.
2016-06-28 14:53:48 -04:00
seelabs
d46c21cc5f Travis install clang from tar file:
The llvm apt repos are offline. This is a workaround to install clang
directly from a tar file.
2016-06-28 14:53:48 -04:00
seelabs
da18f7c053 Fix V2 line-quality bugs 2016-06-28 14:53:47 -04:00
Scott Schurr
0952ebfc1d Add jtx support for trust line quality (RIPD-1094) 2016-06-28 14:53:47 -04:00
Nik Bougalis
a698104c55 Use Rate to represent transfer rates (RIPD-201, RIPD-983):
The Ripple protocol represent transfer rates and trust line
qualities as fractions of one billion. For example, a transfer
rate of 1% is represented as 1010000000.

Previously, such rates where represented either as std::uint32_t
or std::uint64_t. Other, nominally related types, also used an
integral representation and could be unintentionally substituted.

The new Rate class addresses this by providing a simple, type
safe alternative which also helps make the code self-documenting
since arithmetic operations now can be clearly understood to
involve the scaling of an amount by a rate.
2016-06-28 14:53:46 -04:00
Edward Hennis
f060820f3b Sign-and-submit: Test escalated fee autofill (RIPD-1188) 2016-06-28 14:53:46 -04:00
Edward Hennis
119d5c1e47 JTx sign-and-submit mode support 2016-06-28 14:53:45 -04:00
seelabs
2d53ee4051 Add FlowV2 to supportedAmendments 2016-06-28 14:53:45 -04:00
seelabs
66f0caa309 Use protobuf int64 type 2016-06-28 14:53:45 -04:00
Howard Hinnant
d88b63d4c8 Complete SHAMap V2 cutover 2016-06-28 14:53:44 -04:00
Miguel Portilla
63a5522406 Add custom define to disable uncaught exception logging. 2016-06-27 14:35:21 -04:00
seelabs
d22eb0caa2 Set version to 0.32.0 2016-06-24 14:12:17 -04:00
seelabs
138cadc01c Set version to 0.32.0-rc2 2016-06-23 18:29:59 -04:00
seelabs
b590e2c96f Change RIPD-1141 Switchover date 2016-06-23 18:20:15 -04:00
Vinnie Falco
c4c8a620c8 Initialize Writer in prepare:
Writer requires a call to Writer::init to call content_length. This
changes prepare to correctly call init. A consequences is that
prepare can now throw unexpectedly for user-defined writers that
can fail their initialization.
2016-06-20 11:12:26 -04:00
seelabs
5dd8f28290 Set version to 0.32.0-rc1 2016-06-07 13:26:29 -04:00
seelabs
078436212c Resolve warning 2016-06-07 13:26:27 -04:00
Miguel Portilla
10521de2fc Remove obsolete Internal command (RIPD-888) 2016-06-07 13:00:55 -04:00
Edward Hennis
7d11471619 clang: Allow Travis CI builds to succeed 2016-06-07 13:00:53 -04:00
seelabs
434855f500 Fix sendMax path bug 2016-06-07 10:36:13 -04:00
seelabs
11c4ca00d5 Put flowV2 on an amendment only 2016-06-06 20:01:58 -04:00
seelabs
f16d701a2c Add FlowDebugInfo to easily compare diffs between flow V1 and V2 2016-06-06 20:01:53 -04:00
seelabs
34d590d93a Add balanceChanges to PaymentSandbox
fold
2016-06-06 20:01:53 -04:00
seelabs
a87f56448a Prefer paths with more liquidity when qualities are equal 2016-06-06 19:52:25 -04:00
Nik Bougalis
bb61ad2afe Set version to 0.32.0-b18 2016-06-06 07:28:38 -07:00
Nik Bougalis
57b8eb6ccd Merge remote-tracking branch 'upstream/release' into develop 2016-06-06 07:27:30 -07:00
Edward Hennis
7f52249e40 Change fee escalation algorithms (RIPD-1177):
* Minimum factor 256*500, don't multiply by base fee
* Change autofill fee behavior to pay the open ledger fee.
** Experimental options: x-assume-tx - assume <int> more transactions in
   the open queue when computing escalated fee, x-queue-okay - if true
   and escalated fee is over limit, try with load fee.
* Port of 75af4ed.
2016-06-06 07:24:56 -07:00
Nik Bougalis
321e2a94fe Revert "Increase minimum local fee":
The code is no longer necessary, as the fee is now dynamically
adjusted using the new fee escalation logic.

This reverts commit 57625e06ed.
2016-06-06 07:24:56 -07:00
Nik Bougalis
ceb01fb6a3 Correctly handle validations with no LedgerSequence 2016-06-06 07:24:54 -07:00
Nik Bougalis
2206d0ef65 Remove unused functions & cleanup code:
* Remove superseded ECDSA key functions
* Remove unused string helper functions
* Remove beast::FatalError
* Cleanup SSL context generation
* Improve parsing of RPC commands during startup
2016-06-06 07:24:52 -07:00
Nik Bougalis
279c2a6f82 Simplify PeerSet, InboundLedger and TransactionAcquire:
* Use std::mutex instead of std::recursive_mutex
* Remove unnecessary type alias
* Use std::set instead of ripple::hash_map
* Don't reinvent virtual functions
2016-06-06 07:24:50 -07:00
Nik Bougalis
d1200224e2 Update Release Notes 2016-06-06 07:24:48 -07:00
Scott Schurr
fdd1f2ec36 Log uncaught exceptions at the top of threads (RIPD-1166) 2016-06-06 07:10:36 -07:00
Edward Hennis
7295d7f4bb RPC fee command checks open ledger rules (RIPD-1183):
* Matches internal getMetric() to avoid races.
2016-06-06 07:10:36 -07:00
wilsonianb
05d98f4380 Generate master validator public key from master secret 2016-06-06 07:10:36 -07:00
wilsonianb
a187750b32 Include config manifest in server_info admin response (RIPD-1172) 2016-06-03 18:24:11 -07:00
MarkusTeufelberger
55377c12d3 Add build_all script to Builds:
This script will compile rippled, run unit tests and then delete all build
artifacts in many possible configurations (in Linux).

The script will automatically use all available cores to improve compile
speed. All commands are chained via &&, so if any of them fail, the script
will stop at the error.
2016-06-03 16:29:04 -07:00
Vinnie Falco
cd11f3755e Set version to 0.32.0-b17 2016-06-03 18:16:22 -04:00
Vinnie Falco
289c8c9f09 Refactor Server (RIPD-1120):
* Make Handler a template argument
2016-06-03 18:16:18 -04:00
Vinnie Falco
80a9a2bf5d Changes for Beast 1.0.0-b6 2016-06-03 17:54:29 -04:00
Vinnie Falco
1b0b8d7043 Merge subtree Beast 1.0.0-b6:
Merge commit '999e2fa0318b5982736d3ea01a418770ea802671'
2016-06-03 17:05:45 -04:00
Nik Bougalis
b81ec3545f Set version to 0.31.2 2016-06-03 09:05:22 -07:00
Vinnie Falco
999e2fa031 Set Beast version to 1.0.0-b6 2016-06-03 11:49:43 -04:00
Vinnie Falco
c060d08767 rfc7230 compliance, limits, and tests for basic_parser_v1:
New parser set_option function for controlling independent size limits
on headers and body. By default request and response parsers are set up
with reasonable limits to prevent resource exhaustion attacks.

* Parser adheres strictly to rfc7230
* Increased test coverage
* Headers and body maximum size limit options
2016-06-03 11:49:11 -04:00
The Gitter Badger
27ca1b2698 Add Gitter badge 2016-06-03 11:43:56 -04:00
Edward Hennis
75af4ed9b5 Change fee escalation algorithms (RIPD-1177):
* Minimum factor 256*500, don't multiply by base fee
* Change autofill fee behavior to pay the open ledger fee.
** Experimental options: x-assume-tx - assume <int> more transactions in
   the open queue when computing escalated fee, x-queue-okay - if true
   and escalated fee is over limit, try with load fee.
2016-06-02 15:50:17 -07:00
Nik Bougalis
1edc5e5ee0 Revert "Increase minimum local fee":
The code is no longer necessary, as the fee is now dynamically
adjusted using the new fee escalation logic.

This reverts commit 57625e06ed.
2016-06-01 14:52:50 -07:00
Nik Bougalis
28f90d17ac Set version to 0.31.1 2016-05-31 18:10:49 -07:00
Vinnie Falco
50b5dab5df Rename concept to DynamicBuffer (API change):
Conform to the Networking TS by renaming the Streambuf concept
to DynamicBuffer in all places. Values of types meeting the
requirements of DynamicBuffer are renamed to dynabuf.

See:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4478.html#requirements.dynamic_buffers

* Headers renamed
* Formal parameter names renamed
* Template argument types renamed
* Documentation updated
2016-05-28 18:39:18 -04:00
Vinnie Falco
8afdcb9e9f Add message swap members and free functions 2016-05-28 18:39:18 -04:00
Vinnie Falco
7e8f5401b2 Add HTTP field value parsers:
ext_list:
    Iterable container of comma separated extensions, where each extension
    is a token followed an optional list of semicolon delimited parameters,
    with each parameter consisting of a name / value pair. The value can
    be a token or quoted-string.

param_list:
    Iterable container of semicolon delimited parameters, where each parameter
    is a name / value pair. The value can be a token or quoted-string.

token_list
    Iterable container of comma delimited tokens.

* Remove obsolete rfc2616 functions

* Refactor and consolidate case-insensitive string helpers
2016-05-28 18:39:17 -04:00
Vinnie Falco
5a0a47cbae Tidy up use of GENERATING_DOCS 2016-05-28 07:59:34 -04:00
Vinnie Falco
bc2642f423 Use beast::error_code instead of nested types 2016-05-28 07:59:19 -04:00
Vinnie Falco
cd41a0decd Use SFINAE on return values 2016-05-28 07:59:17 -04:00
Vinnie Falco
803d145a5e Add CHANGELOG 2016-05-28 07:59:03 -04:00
Nicholas Dudfield
8303266430 Travis CI updates:
* Run autobahn/valgrind tests when target branch in {master, develop}
* Add coveralls
* Show full stacktrace for usan (RIPD-1150)
* Manual launch of coverage (RIPD-1152)
* Use lldb on Darwin (RIPD-1152)
* Set defaults if not CI (RIPD-1152)
* Add autobahn result parser (RIPD-1147)
2016-05-28 07:16:31 -04:00
seelabs
44e33121c7 Set version to 0.32.0-b16 2016-05-26 12:41:45 -04:00
seelabs
8a6ff4803c Set flowV2 switchover time 2016-05-26 12:41:43 -04:00
Miguel Portilla
abbf4b82b0 Consolidate RPC utility functions (RIPD-947) 2016-05-26 12:41:43 -04:00
Edward Hennis
9752268308 Standalone mode uses temp DB files by default (RIPD-1129):
* If a [database_path] is configured, it will always be used, and tables
  will be upgraded on startup.
2016-05-26 12:31:46 -04:00
Vinnie Falco
1fe983948f Set version to 0.32.0-b15 2016-05-25 15:08:52 -04:00
Nik Bougalis
39829a09cb Update test logging text for change in newlines 2016-05-25 15:05:32 -04:00
Vinnie Falco
3de738429f Changes for beast logging 2016-05-25 15:05:20 -04:00
Vinnie Falco
fa0ef25ffb Merge subtree Beast 1.0.0-b5
Merge commit 'a9e507da9b636d394bb43d6bf8002d013530f57a' into develop
2016-05-25 14:49:07 -04:00
Vinnie Falco
a9e507da9b Set Beast version to 1.0.0-b5 2016-05-25 12:00:25 -04:00
Vinnie Falco
20dfecd2b6 HTTP improvements:
* Increased code coverage

* New Body concepts:
    is_Body
    is_ReadableBody
    is_WritableBody
2016-05-25 12:00:14 -04:00
Vinnie Falco
eb7bd6a2f1 WebSocket ping, fixes, coverage:
* Improve test coverage
* tests for invokable in composed ops

* Update documentation
* Add License badge to README
* Target Windows 7 SDK and later
* Make role_type private
* Remove extra unused masking functions
* Allow stream reuse / reconnect after failure
* Restructure logic of composed operations
* Allow 0 for read_message_max meaning no limit
* Respect keep alive when building HTTP responses
* Check version in upgrade request
* Response with 426 status on unsupported WebSocket version
* Remove unnecessary Sec-WebSocket-Key in HTTP responses
* Rename to mask_buffer_size

* Remove maybe_throw
* Add ping, async_ping, async_on_pong
* Add ping_op
* Add pong_op
* Fix crash in accept_op
* Fix suspend in close_op
* Fix read_frame_op logic
* Fix crash in read_op
* Fix races in echo sync and async echo servers
2016-05-25 12:00:14 -04:00
Vinnie Falco
a570b74038 Fix parser off by one accessing buffer bug:
This fixed a bug where in some cases the parser could dereference
past the end of the caller provided buffer. The unit test is
improved to allocate memory in separate pieces for the split-buffer
matrix test, to give address-sanitizer more to work with.
2016-05-25 12:00:13 -04:00
Vinnie Falco
18c82465b2 Always flush reporter output stream on log 2016-05-25 12:00:13 -04:00
Vinnie Falco
d46db18a31 Update documentation:
* http parse functions
* Parser concept
* More detail on concepts
* Better hyperlinking
2016-05-25 12:00:13 -04:00
Vinnie Falco
5cf4f4a5e2 Fix resume of invokables in websocket composed operations:
When a suspended composed operation is resumed, the operation
now posts to the io_service to get in the correct context. Previously,
invokables resumed in the context of a different completion handler.

* asio_handler_invoke for any resumed invokable will return `true`.
2016-05-25 12:00:12 -04:00
seelabs
e3ee23bcfd Do not run coverage until all jobs have finished:
Sometimes lcov would report negative counts. This may be related to lcov
running while the job it was collecting counts for was also running.
This patch makes two changes: Do not run the coverage build under
gdb, and wait for all jobs to finish before running lcov.
2016-05-25 12:00:12 -04:00
Nik Bougalis
846cbf8c78 Set version to 0.32.0-b14 2016-05-24 12:44:06 -07:00
Miguel Portilla
b14555c742 Improve websocket send performance (RIPD-1158) 2016-05-24 12:40:27 -07:00
Miguel Portilla
154e90b1ca Fix StreambufWSMsg prepare (RIPD-1144).
Return value was set incorrect in some cases.
The buffer was not being prepared.
Add websocket log support.
2016-05-24 12:40:23 -07:00
Nik Bougalis
97c89168f7 Improve exception handling:
* Self-document the code by renaming Throw to Rethrow.
* Write a message to the debug log when we throw or
  rethrow an exception.
2016-05-24 12:37:46 -07:00
Nik Bougalis
a039e7593a Serialize access to the debug journal 2016-05-24 12:37:46 -07:00
Nik Bougalis
acebbf58eb Use only requested amount of aligned_storage 2016-05-24 12:37:46 -07:00
Nik Bougalis
84e3184106 Stricter validation of JSON input (RIPD-1100):
Passing in objects, arrays or non-string objects previously generated
nondescript errors. Improve the error messages returned to clients.

Add unit tests to ensure that incorrect inputs are reliably detected
and generate descriptive and accurate errors.
2016-05-24 12:29:00 -07:00
Scott Schurr
3a1fa4a552 Add "seed" to JSONRPC unit tests (RIPD-1099):
There was a bug in version 0.30.1 where signing with an ed25519
key and a corrupt seed would cause the "sign" and "sign_for"
commands to return an unexpected error.  That bug was fixed in
the 0.31.0 release.

These unit tests verify the fix.  The error message for a corrupt
seed is also slightly improved.
2016-05-24 12:29:00 -07:00
seelabs
1cf518e82c Set version to 0.32.0-b13 2016-05-24 12:36:41 -04:00
Nik Bougalis
951f479a1b Update README.md file (#1656) 2016-05-24 12:36:38 -04:00
Edward Hennis
a6e408510a Update ter documentation:
* terQUEUED txns can be forwarded.
2016-05-24 12:29:23 -04:00
wilsonianb
f2f195f43e Use sys.exit() in Manifests.py to run as program 2016-05-24 12:29:23 -04:00
seelabs
21c563f83a Fix false dry and other payment bugs:
The Owner count could decrease while evaluating a strand, causing
different behavior in forward passes and reverses passes. The fix treats
a decreased owner count like a deferred credit.

In some situations, deferred credits could cause an XRP balance to be
calculated as negative, triggering some asserts.

When XRP is used as a bridge currency, a path could be falsely marked as
dry. This happens when the XRP/XXX offer recursively checks the XXX/XRP
offer and the XXX/XRP offer could not satisfy the request in a single
call.

With a single strand and limit quality the old payment code incorrectly
computed with multiquailty set to true. This could cause the total
quality to go below the requested quality even if there was liquidity
available above the requested quality value.
2016-05-24 12:29:23 -04:00
seelabs
67b1acbf78 Resolve warnings:
Add boost to system path when compiling with clang.
Remove check for null for a var that can never be null.
2016-05-24 12:29:23 -04:00
wilsonianb
4ed6cbdd5b Get quorum and trusted master validator keys from validators.txt:
* Load specified [validators_file] relative to config dir
* Add default [validators_file] to rippled-example.cfg
* Remove [validators] and [validation_quorum] from rippled-example.cfg
* Add [validation_quorum] to validators-example.txt
* Allow validators.txt to be a symlink
* Throw for invalid [validators_file] instead of logging
* Trust own master public key from configured manifest
* Do not load untrusted manifests from database

Trusted validators are loaded from [validators] and [validator_keys]
sections from both rippled.cfg and validators.txt

Quorum is loaded from [validation_quorum] section in validators.txt
only if it is not configured in rippled.cfg
2016-05-24 12:29:23 -04:00
Edward Hennis
7e3dbce3d2 Access base_uint through public members (RIPD-898):
* Updates many (but probably not all) locations that access base_uint
  private storage.
* More calls to access base_uint through members.
* Use an iterator to write Serializer collections.
2016-05-24 10:37:01 -04:00
Edward Hennis
e38f01d1f4 Additional base_uint and stVector256 serialization tests 2016-05-24 10:36:54 -04:00
Nik Bougalis
32a01df0e1 Improve directory creation (RIPD-928):
* Simplify quality describer
* Use keylet instead of naked uint256
2016-05-24 10:29:17 -04:00
Nik Bougalis
814a8258fd Simplify Ledger fetching and construction:
* Remove single-use functions
2016-05-24 10:16:52 -04:00
Nicholas Dudfield
f3b2153ba7 Travis CI updates:
* Use clang 3.8
* Add msan/usan variants
* Build only gcc.coverage and clang.{asan,usan,msan}
* Make sure (correct) llvm-symbolizer is on PATH
2016-05-23 07:30:37 -04:00
Vinnie Falco
651fb45598 Refactor unit_test logging:
The log member is changed to derive from std::ostream. A new
class dstream is derived from std::ostream to support redirection
to the Visual Studio Output Window if a debugger is attached.

Obsolete classes abstract_ostream and its derived variants are
removed.
2016-05-23 07:30:37 -04:00
Vinnie Falco
b5dc8eb9ce Add dstream 2016-05-23 07:30:37 -04:00
Vinnie Falco
b12d1570a7 Set version to 0.32.0-b12 2016-05-12 19:26:21 -04:00
Vinnie Falco
cd38492ceb Changes for Beast 2016-05-12 19:24:35 -04:00
Vinnie Falco
411a12693d Merge subtree Beast 1.0.0-b4:
Merge commit 'c0952e54db7bd519440dc0611db7347cb048296d' into
2016-05-12 19:24:11 -04:00
Vinnie Falco
c0952e54db Set Beast version to 1.0.0-b4 2016-05-12 19:22:59 -04:00
seelabs
09c566a6eb Tidying and fix warnings 2016-05-12 19:22:00 -04:00
seelabs
97b1ac6eab Update CMakeLists for non-Windows platforms 2016-05-12 19:20:57 -04:00
Vinnie Falco
2a8de0fd6b Parser concept, fixes:
A new concept Parser is introduced with routines to read from a stream
into the parser. This solves a problem with the old read interface where
messages must be default constructible and move assignable.

Parser fixes:

* Fix detect invalid reason-phrase octets
* Fix write_eof to set the 'complete' state on success
* Fix consider parse complete if eof received on empty body

WebSocket:

* Increase coverage
2016-05-12 19:20:57 -04:00
Vinnie Falco
8921da91b8 Fixes, fail testing:
Core:

* Test buffer_cat iterator move members

HTTP:

* Fixed yield / resume in writer
* Fixed message serialization with chunked encoding

* Test yield / resume in writer
* Test all conditional branches during message serialization
* Test chunked encoding
* Increase coverage on parse_error
* Add parse_error::general

WebSocket:

* Add error::general
* Increase coverage in error
2016-05-12 19:20:57 -04:00
Vinnie Falco
2b69831f49 New constructors for message:
The message class now behaves like a pair with respect to the construction
of the body and headers. Additional constructors allow construction of
just the body portion from a tuple, leaving the headers default
constructed.

Previous constructors are removed as they were a notational convenience
for assembling HTTP/1 requests and responses. They are not necessary
as this library aims at library writers and not end users.
2016-05-12 19:20:55 -04:00
Howard Hinnant
e9f924ca31 Set version to 0.32.0-b11 2016-05-10 18:16:25 -04:00
Howard Hinnant
595912f82d Remove unused GenericScopedLock and GenericScopedTryLock.
* Update documentation of GenericScopedUnlock.
2016-05-10 17:38:38 -04:00
wilsonianb
ec1ffa2945 Publish all validation fields for signature verification:
Publish own validations to subscription stream
2016-05-10 17:38:38 -04:00
JoelKatz
45ff08b6aa Fix advisory delete affect on history acquisition (RIPD-1112):
* Revert 0efb929898
* Advisory delete setting of 0 (never) does not affect history fetching

The previous commit addressing RIPD-1112 could interact with
advisory delete and cause some history not to be acquired even
configured to acquire. This reverts that commit and provides
a better fix.

The advisory delete setting protects ledgers from being
removed by online delete by exempting them until they are
approved for purge by administrative command. However, not
connecting this with history acquisition could cause new
ledgers in the protected range not to be acquired if the
server loses sync.

With this change, the default advisory delete setting, zero (never)
causes the regular server history setting to control the acquisition
of history. Setting advisory delete to a value greater than zero,
if advisory delete is enabled, will cause the server to fetch and
maintain history back to that point.

This should produce sane behavior across server restarts, losses of
sync, and so on. You can no longer use the "hack" of setting
advisory delete to zero to tell the server to fetch and keep as much
history as possible, but you can achieve the same effect by setting
it to one.
2016-05-10 17:38:38 -04:00
Nik Bougalis
ab9e0c06b8 Log when number of available FDs is insufficient (RIPD-1125) 2016-05-10 17:38:38 -04:00
seelabs
c549c9dff0 Transfer fee changes:
An offer owner pays the transfer fee and only change a transfer fee
when transfering an IOU (as the old code does).
2016-05-10 17:38:37 -04:00
Miguel Portilla
d7a778ce6a Add support for Beast Websockets (RIPD-1097) 2016-05-10 17:38:37 -04:00
Nik Bougalis
f45e279e06 Run CircleCI unit tests under gdb 2016-05-10 17:38:37 -04:00
Nik Bougalis
4d19b8be07 Reject invalid MessageKey in SetAccount handler (RIPD-308, RIPD-990) 2016-05-10 17:38:37 -04:00
Nik Bougalis
2ae68923cc Remove unused legacy endpoint reporting 2016-05-10 17:38:36 -04:00
Nik Bougalis
d197c9780a Remove obsolete sendGetPeers support (RIPD-164) 2016-05-10 17:38:36 -04:00
Nik Bougalis
3d063edb72 Remove unused ECIES routines 2016-05-10 17:38:36 -04:00
Nik Bougalis
f081e80c28 Remove legacy arbitrary precision integer support:
The CBigNum class is a wrapper around OpenSSL's BIGNUM implementation
to make use simpler.

Replacing the implementation with boost::multiprecision helps reduce
the size of the codebase and improves performance (benchmarks show
the new boost-based implementation is ~7x faster).
2016-05-10 17:38:36 -04:00
Howard Hinnant
1c3ee48146 Install SHAMapInnerNodeV2
* Inner node optimization.
2016-05-10 17:38:35 -04:00
MarkusTeufelberger
e499e908d2 CI: get lcov from github
...instead of sourceforge.com (which seems to be in its final breaths)
2016-05-10 17:38:35 -04:00
Vinnie Falco
e0956c36c1 Tidy up core sources:
The core headers are moved to their own directory (but remain in
the same namespace).
2016-05-10 13:41:28 -04:00
Vinnie Falco
2893f8c82a Improvements to code coverage:
More tests and test cases are added to bring up
the percentage of library code covered by tests.
2016-05-10 13:41:27 -04:00
Vinnie Falco
036c3098f3 Tidy up test sources:
Test support classes are moved to beast/extras/test.
2016-05-10 13:41:26 -04:00
seelabs
24612eba4c Fix invalid access after async initiation 2016-05-10 13:41:26 -04:00
Vinnie Falco
6512b8894a Refactor extras:
A new directory extras/ is added, and code not part of the official
public Beast interface is moved there.
2016-05-10 13:41:26 -04:00
Vinnie Falco
1b44c9a3df Improvements to increase code coverage:
* Don't include the test code in coverage reports
* Add test code for missing coverage

Other:

* Improve the README.md
* Fix warning in sha1_context
* Tidy up the examples use of namespaces
* Various fixes to documentation and javadocs
2016-05-10 13:41:25 -04:00
Vinnie Falco
8499cc9767 websocket::stream fail testing 2016-05-10 13:41:25 -04:00
Vinnie Falco
d49faa0f5c Put echo peer logging on toggle, default to off 2016-05-10 13:41:25 -04:00
Vinnie Falco
258cd2cb87 Tidy up declarations and files:
* Adjust formatting
* Fix inline namespace warning in main.cpp
* Fix streambuf op ambiguous variadic constructor
* Rename variables for clarity
2016-05-10 13:41:24 -04:00
Vinnie Falco
7eed701682 Don't perform an extra clear 2016-05-10 13:41:24 -04:00
Vinnie Falco
e62b9dc4c1 Fix SHA1 calculation 2016-05-06 15:23:52 -04:00
Vinnie Falco
36ac1124f4 Set version to 0.32.0-b10 2016-05-06 14:53:33 -04:00
Vinnie Falco
ddb34f1ed1 Update for beast changes:
* Use simplified http::headers
* Use new beast::http::message:
  - Call beast::http::prepare
  - message::method is now a string
* Remove deprecated_http
2016-05-06 14:53:24 -04:00
Nicholas Dudfield
76b761d8e2 Adjustments to code coverage reports:
* src/beast is removed since it has its own coverage and CI integration.
2016-05-06 14:53:16 -04:00
Vinnie Falco
92b3cdb6f8 Merge subtree Beast 1.0.0-b3
Merge commit '47eb7fcc2f30df883b0036d97aac6a0fa90b0e9f'
2016-05-06 14:52:21 -04:00
Vinnie Falco
47eb7fcc2f Set Beast version to 1.0.0-b3 2016-05-06 14:51:41 -04:00
Vinnie Falco
6d8c73cc52 Tidy up tests, build scripts, and documentation:
* Concepts split up into individual files
* Function definitions moved to .ipp files
* Add more tests to fill gaps in coverage
* Fix documentation Xsl
2016-05-06 12:58:10 -04:00
Vinnie Falco
9e5e16c18d Distinguish HTTP/1 messages from general HTTP messages:
The version field is moved into message_v1, all public interfaces
are reworked to identify HTTP/1 wire format operations (suffix "_v1")
versus general HTTP.
2016-05-06 12:58:09 -04:00
Nicholas Dudfield
3af4cf0a28 Travis-CI additions:
* Address sanitizer target
* Code coverage target
* Results for codecov.io
2016-05-06 12:58:09 -04:00
seelabs
d6903efc0c Fix invokable order of invocation:
The call to the final handler in a composed operation MUST be
the last thing performed, as the handler may cause the end of
object lifetimes before it returns.
2016-05-05 11:22:13 -04:00
Vinnie Falco
9390eb016c WebSocket refactoring and tests:
websocket:

* Move echo server to test/
* Fix warnings
* Fix maskgen being uncopyable
* Simplify utf8_checker special member declarations
* Fix stream move assignable when owning the next layer
* Add javadocs for stream special members
* Add stream unit tests
* Move throwing member definitions to the .ipp file
* Use get_lowest_layer in stream declaration
* Perform type checks at each call site instead of constructor
* Demote close_code to a non-class enum:
    Otherwise, application specific close codes
    cannot be assigned without using static_cast.

core:

* Add streambuf_readstream special members tests
* Add move assignment operator to streambuf_readstream
* Add detail/get_lowest_layer trait
* Add static_string tests
* Move static_string from websocket to core
2016-05-05 11:22:13 -04:00
Vinnie Falco
47dc31d8c2 Refactor beast core, http, tests, and examples:
* Fix warnings
* Port cmake scripts to linux
* Add command line options for running test suites
* Add examples to CMakeLists
* Return std::uint64_t from writer::content_length
* basic_parser::write takes asio::const_buffer instead of pointer and size
* Turn message test back on now that it passes
* Rename to http::headers, use std::allocator, remove http_headers
* http::message::method is now a string
* Refactor to_string for ConstBufferSequence
* Remove chunk_encode from the public interface
* Initialize members for default constructed iterators
* Disallow default construction for dependent buffer sequences

Refactor http::message serialization:

* Serialization no longer creates a copy of the
  headers and modifies them
* New function prepare(), sets Connection, Transfer-Encoding,
  Content-Length based on the body attributes and caller options.
  Callers can use prepare() to have the fields set automatically,
  or they can set the fields manually.
* Use write for operator<<
* Tests for serialization
2016-05-05 11:22:12 -04:00
seelabs
f3c3e0bfff Fix destruction of basic_headers elements:
* Add missing call to destroy
* Use traits to destroy the element
2016-05-04 15:12:16 -04:00
Vinnie Falco
fbb5a753b1 Set version to 0.32.0-b9 2016-05-03 13:52:25 -04:00
Miguel Portilla
a1951aff02 Fix buffer to string conversion escaping vertical white space 2016-05-03 13:52:17 -04:00
Nik Bougalis
c28d36b500 Always run unit tests under gdb 2016-05-03 13:52:16 -04:00
JoelKatz
0efb929898 Fix history acquire check (RIPD-1112)
The various history acquire conditions were not combined
properly, resulting in historical ledgers being acquired
in cases where they should not be.
2016-05-03 13:52:16 -04:00
mDuo13
3f84dd8cf9 Add historical release notes through 0.30.1 2016-05-03 13:52:16 -04:00
Howard Hinnant
5d9e53a37d Migrate off of posix_time and most uses of C time_t. 2016-05-03 13:52:15 -04:00
Edward Hennis
2e2a7509cd Multiple transactions per account in TxQ (RIPD-1048):
* Tweak account XRP balance and sequence if needed before preclaim.
* Limit total fees in flight to minimum reserve / account balance.
* LastLedgerSequence must be at least 2 more than the current ledger to be queued.
* Limit 10 transactions per account in the queue at a time.
* Limit queuing multiple transactions after transactions that affect authentication.
* Zero base fee transactions are treated as having a fixed fee level of 256000 instead of infinite.
* Full queue: new txn can only kick out a tx if the fee is higher than that account's average fee.
* Queued tx retry limit prevents indefinitely stuck txns.
* Return escalation factors in server_info and _state when escalated.
* Update documentation.
* Update experimental config to only include the % increase.
* Convert TxQ metric magic numbers to experimental config.
2016-05-03 13:52:15 -04:00
Vinnie Falco
7f97b7bc05 Remove unused directory 2016-05-01 10:55:28 -04:00
Vinnie Falco
073ccf2705 Set version to 0.32.0-b8 2016-04-29 08:51:16 -04:00
Vinnie Falco
6d8b25fdf8 Use new beast::http::message: 2016-04-29 08:51:00 -04:00
Vinnie Falco
22f62af9be Merge subtree Beast 1.0.0-b2:
Merge commit '6c8b4b2f8dde72b01507e4ac7fde4ffea57ebc99'
2016-04-29 05:24:45 -04:00
Vinnie Falco
2a014df60d Merge Beast subtree:
Merge commit 'ba7031cb3b4840c1135515eccd77b002f2ceae9f'
2016-04-29 05:24:18 -04:00
Vinnie Falco
6c8b4b2f8d Set Beast version to 1.0.0-b2 2016-04-29 05:22:59 -04:00
Vinnie Falco
8dad543671 Add CMake scripts 2016-04-29 05:22:59 -04:00
Miguel Portilla
cf0cea38fd Add UTF8_checker unit test 2016-04-29 05:17:59 -04:00
Vinnie Falco
db7b65ed42 Various fixes, warnings:
* Fix sig_wait
* Fix websocket strict aliasing warning
* Fix invokable strict aliasing
* Silence fread warning in examples
* Silence integer conversion warnings
* Build parser-bench as test
* Disable unused variable warning for asio:
    Caused by static variables declared in <boost/asio/error.hpp>
    No known workaround.
2016-04-29 05:17:59 -04:00
Vinnie Falco
61a8f7f078 New header-only basic_parser:
The basic_parser is rewritten to be header-only. The nodejs parser is
removed from the include subtree and placed into the test directory.
Other changes:

* Parser specific error codes in parse_error.hpp
* Add parser-bench performance testing, nodejs vs beast
* New random message generator for fuzz tests
* Test for header-only parser using random message generator
* Augmented some existing message tests to check more cases
2016-04-29 05:17:59 -04:00
Nik Bougalis
e4f0b36f61 Set version to 0.32.0-b7 2016-04-26 18:00:58 -07:00
Nik Bougalis
b7c34d8a96 Improve validation of JSON-formatted ledgers during load 2016-04-26 17:59:29 -07:00
Nik Bougalis
b5dbd7942f Correctly handle connections that fail security checks (RIPD-1114):
* Return error code 400 to the peer along with a descriptive message
* Release the slot and decrement IP connection counters.
2016-04-26 17:59:28 -07:00
wilsonianb
5e5d5fdee4 Make wallet_propose seed generation consistent:
Allow 'seed' or 'seed_hex' if 'key_type' is not specified.
Use legacy passphrase seed generation if 'key_type' is specified.
2016-04-26 17:59:09 -07:00
Miguel Portilla
89c05efe22 Remove UTF8_checker from WSClient unit test. 2016-04-26 17:57:20 -07:00
Edward Hennis
e5bf824c3b Stricter checking on integer json inputs. 2016-04-26 17:57:20 -07:00
Edward Hennis
b509263ef5 Make fee command public (RIPD-1113) 2016-04-26 17:57:19 -07:00
seelabs
13ec104154 Update dependency scripts for Ubuntu 16.04 2016-04-26 17:57:19 -07:00
Vinnie Falco
4cfa1d5cd3 Add streambuf write():
This function performs serialization of a variable list of arguments
to a streambuf. It accepts a wide variety of argument types, using
boost::asio::buffer and boost::lexical_cast where possible.
2016-04-26 18:38:02 -04:00
Nik Bougalis
48396aebd1 Correctly handle validations with no LedgerSequence 2016-04-25 18:04:15 -07:00
Vinnie Falco
7cfdab936c Beast documentation work 2016-04-25 05:08:47 -04:00
Vinnie Falco
010444d77a Add WebSocket tests 2016-04-22 15:01:37 -04:00
Vinnie Falco
1c8c3207fe Set version to 0.32.0-b6 2016-04-22 12:56:22 -04:00
Vinnie Falco
ba7031cb3b Complete examples in beast html documentation 2016-04-22 12:49:02 -04:00
Vinnie Falco
7e88fdd0f1 Complete examples in beast html documentation 2016-04-22 12:49:02 -04:00
Vinnie Falco
af3d721f82 Reduce requirements to C++11 only 2016-04-22 11:59:03 -04:00
Vinnie Falco
e09249abad Reduce requirements to C++11 only 2016-04-22 11:59:03 -04:00
sublimator
0061f03cef Add Travis support 2016-04-22 11:38:11 -04:00
sublimator
53c82d54ea Add Travis support 2016-04-22 11:38:11 -04:00
Vinnie Falco
5602a24b22 Fix basic_streambuf:
prepare() is rewritten to operate more simply; the state of
the container is always consistent even between internal operations.
2016-04-21 15:17:04 -04:00
Vinnie Falco
f4cbb9d8e9 Fix basic_streambuf:
prepare() is rewritten to operate more simply; the state of
the container is always consistent even between internal operations.
2016-04-21 15:17:04 -04:00
Howard Hinnant
df82a734af Fix includes, remove unused type checks 2016-04-21 11:22:06 -04:00
Howard Hinnant
2179ea85f8 Fix includes, remove unused type checks 2016-04-21 11:22:06 -04:00
Vinnie Falco
f5299209d4 Set version to 0.32.0-b5 2016-04-20 13:15:00 -04:00
Vinnie Falco
ca2384f230 beast doc/test work 2016-04-20 12:01:26 -04:00
Vinnie Falco
9c88f76338 beast doc/test work 2016-04-20 12:01:26 -04:00
Vinnie Falco
f07cd8ceb4 Reorganize source files 2016-04-20 12:01:25 -04:00
Vinnie Falco
4469ff4b9a Reorganize source files 2016-04-20 12:01:25 -04:00
Vinnie Falco
54f6f0ceba Beast.WebSocket:
Beast.WebSocket provides developers with a robust WebSocket
implementation built on Boost.Asio with a consistent asynchronous
model using a modern C++ approach.
2016-04-20 12:01:24 -04:00
Vinnie Falco
2cb3834bbb Beast.WebSocket:
Beast.WebSocket provides developers with a robust WebSocket
implementation built on Boost.Asio with a consistent asynchronous
model using a modern C++ approach.
2016-04-20 12:01:24 -04:00
Vinnie Falco
2e302a43aa Add SHA1 algorithm 2016-04-20 12:01:23 -04:00
Vinnie Falco
5e8d028da2 Add SHA1 algorithm 2016-04-20 12:01:23 -04:00
Vinnie Falco
8b62c23ab6 Beast.HTTP:
New classes are introduced to represent HTTP messages and their
associated bodies. The parser interface is reworked to use CRTP,
error codes, and trait checks.

New classes:

* basic_headers

  Models field/value pairs in a HTTP message.

* message

  Models a HTTP message, body behavior defined by template argument.
  Parsed message carries metadata generated during parsing.

* parser

  Produces parsed messages.

* empty_body, string_body, basic_streambuf_body

  Classes used to represent content bodies in various ways.

New functions:

* read, async_read, write, async_write

  Read and write HTTP messages on a socket.

New concepts:

* Body: Represents the HTTP Content-Body.
* Field: A HTTP header field.
* FieldSequence: A forward sequence of fields.
* Reader: Parses a Body from a stream of bytes.
* Writer: Serializes a Body to buffers.

basic_parser changes:

* add write methods which throw exceptions instead
* error_code passed via parameter instead of return value
* fold private member calls into existing callbacks
* basic_parser uses CRTP instead of virtual members
* add documentation on Derived requirements for CRTP

impl/http-parser changes:

* joyent renamed to nodejs to reflect upstream changes
2016-04-20 12:01:15 -04:00
Vinnie Falco
bcbe22c780 Beast.HTTP:
New classes are introduced to represent HTTP messages and their
associated bodies. The parser interface is reworked to use CRTP,
error codes, and trait checks.

New classes:

* basic_headers

  Models field/value pairs in a HTTP message.

* message

  Models a HTTP message, body behavior defined by template argument.
  Parsed message carries metadata generated during parsing.

* parser

  Produces parsed messages.

* empty_body, string_body, basic_streambuf_body

  Classes used to represent content bodies in various ways.

New functions:

* read, async_read, write, async_write

  Read and write HTTP messages on a socket.

New concepts:

* Body: Represents the HTTP Content-Body.
* Field: A HTTP header field.
* FieldSequence: A forward sequence of fields.
* Reader: Parses a Body from a stream of bytes.
* Writer: Serializes a Body to buffers.

basic_parser changes:

* add write methods which throw exceptions instead
* error_code passed via parameter instead of return value
* fold private member calls into existing callbacks
* basic_parser uses CRTP instead of virtual members
* add documentation on Derived requirements for CRTP

impl/http-parser changes:

* joyent renamed to nodejs to reflect upstream changes
2016-04-20 12:01:15 -04:00
Vinnie Falco
3461bafaa2 Beast.Asio:
New classes:

  class async_completion:
    Helper class for implementing asynchronous initiation functions.
    See n3964:
        Library Foundations for Asynchronous Operations, Revision 1
        http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3964.pdf

  class basic_streambuf:
    Meets the requirements of Streambuf.

  class buffered_readstream:
    Buffers a ReadStream with a ConstBufferSequence.

  class consuming_buffers:
    Adapts a BufferSequence which wraps the underlying buffer
    sequence and presents fewer bytes, with the retained bytes
    occurring at the end of the sequence.

  class handler_alloc:
    A C++ Allocator the uses asio handler allocation hooks.

  class static_streambuf:
    An implementation of the Streambuf concept that uses a
    fixed size buffer with size determined at compile-time.

  class streambuf_readstream:
    Buffers a ReadStream with a Streambuf.

New functions:

  append_buffers()
    Returns a new BufferSequence which efficiently concatenates
    two or more buffer sequences together.

  prepare_buffers()
    Shortens a buffer sequence. The bytes excluded are at the
    end of the underlying buffer sequence.

  boost::asio::read_until()
    A copy of boost::asio::read_until overloads, modified to work
    with a beast::asio::basic_streambuf.

Debugging:

  buffers_to_string()

    Convert a ConstBufferSequence to a human readable string
    suitable for diagnostics.

type_check.h:

  Metafunctions for checking asio concepts:
    AsyncReadStream, AsyncWriteStream
    SyncReadStream, SyncWriteStream
    ConstBufferSequence, MutableBufferSequence
    Streambuf
    Handler

Changes:

* All symbols moved up a namespace level.
* streambuf provides all move and copy special members,
  behavior of moved from objects is well-defined.

Fixes:

* Fix basic_streambuf iterator category.
2016-04-20 05:16:38 -04:00
Vinnie Falco
f25b448a49 Beast.Asio:
New classes:

  class async_completion:
    Helper class for implementing asynchronous initiation functions.
    See n3964:
        Library Foundations for Asynchronous Operations, Revision 1
        http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3964.pdf

  class basic_streambuf:
    Meets the requirements of Streambuf.

  class buffered_readstream:
    Buffers a ReadStream with a ConstBufferSequence.

  class consuming_buffers:
    Adapts a BufferSequence which wraps the underlying buffer
    sequence and presents fewer bytes, with the retained bytes
    occurring at the end of the sequence.

  class handler_alloc:
    A C++ Allocator the uses asio handler allocation hooks.

  class static_streambuf:
    An implementation of the Streambuf concept that uses a
    fixed size buffer with size determined at compile-time.

  class streambuf_readstream:
    Buffers a ReadStream with a Streambuf.

New functions:

  append_buffers()
    Returns a new BufferSequence which efficiently concatenates
    two or more buffer sequences together.

  prepare_buffers()
    Shortens a buffer sequence. The bytes excluded are at the
    end of the underlying buffer sequence.

  boost::asio::read_until()
    A copy of boost::asio::read_until overloads, modified to work
    with a beast::asio::basic_streambuf.

Debugging:

  buffers_to_string()

    Convert a ConstBufferSequence to a human readable string
    suitable for diagnostics.

type_check.h:

  Metafunctions for checking asio concepts:
    AsyncReadStream, AsyncWriteStream
    SyncReadStream, SyncWriteStream
    ConstBufferSequence, MutableBufferSequence
    Streambuf
    Handler

Changes:

* All symbols moved up a namespace level.
* streambuf provides all move and copy special members,
  behavior of moved from objects is well-defined.

Fixes:

* Fix basic_streambuf iterator category.
2016-04-20 05:16:38 -04:00
Vinnie Falco
874bbd0b8a C++17 compatibility:
* std::void_t
* std::bool_constant
2016-04-20 05:16:37 -04:00
Vinnie Falco
73ddda4651 C++17 compatibility:
* std::void_t
* std::bool_constant
2016-04-20 05:16:37 -04:00
Vinnie Falco
a433804ee6 unit_test::suite fix warning 2016-04-20 05:16:33 -04:00
Vinnie Falco
08171dad5e unit_test::suite fix warning 2016-04-20 05:16:33 -04:00
Vinnie Falco
f60eeaf08c unit_test::thread fixes:
* Fail on exception in unit_test::thread
* Add unit_test:🧵:detach()
2016-04-20 05:16:32 -04:00
Vinnie Falco
7b3550c46e unit_test::thread fixes:
* Fail on exception in unit_test::thread
* Add unit_test:🧵:detach()
2016-04-20 05:16:32 -04:00
Vinnie Falco
db8fb177b8 Remove unused or obsolete classes and files 2016-04-20 05:16:32 -04:00
Vinnie Falco
203739f7a4 Remove unused or obsolete classes and files 2016-04-20 05:16:32 -04:00
Nik Bougalis
735c341fae Set version to 0.32.0-b4 2016-04-19 17:17:46 -07:00
Edward Hennis
7bb9264c3d Update Travis to Boost 1.60 2016-04-19 17:17:32 -07:00
seelabs
4b8d227922 Better numerical stability for deferred credits:
Before this change, the deferred credits algorithm took the current
balance and subtracted the recorded credits. Conceptually, this is the
same as taking the original balance, adding all the credits,
subtracting all the debits, and subtracting all the credits. The new
algorithm records the original balance and subtracts the debits. This
prevents errors that occur when the original balance and the recorded
credits have large differences in magnitude.

Additionally, XRP credits were recorded incorrectly in the deferred
credits table (the line was between the sender and receiver, rather than
the root account).
2016-04-19 17:17:23 -07:00
Nik Bougalis
4124850481 Merge remote-tracking branch 'upstream/release' into develop 2016-04-19 17:17:08 -07:00
Nik Bougalis
637fee5ecc Set version to 0.31.0 2016-04-19 17:01:48 -07:00
Nik Bougalis
47eb4da080 Check file handle limit on startup (RIPD-442, RIPD-1024):
Calculate the number of file descriptors that are needed during
execution based on the configuration file, with a hard floor
of 1024, adjusting the limit if possible. Refuse to run if enough
fds are not available.

Additionally, allow administrators to limit the number of incoming
connections a configured port will accept. By default no limit is
imposed.
2016-04-19 17:01:33 -07:00
Nik Bougalis
79ca82c078 Improve watchdog start logic 2016-04-19 17:01:25 -07:00
Miguel Portilla
d2a787805a Fix secured Websocket closing.
Websocketpp was incorrectly handling close before or during protocol negotiation. This issue addresses lingering CLOSE_WAIT file descriptors.
2016-04-19 17:01:15 -07:00
David Schwartz
d2071b7ea7 Small Websocket cleanups. 2016-04-19 17:01:09 -07:00
Edward Hennis
61ba1743ef Lock Appveyor CI build to scons 2.5.0
* Workaround for misbehaving 2.5.0.post1, and can be reverted if the next version works better.
2016-04-19 16:53:07 -04:00
Vinnie Falco
d60426a19f .gitignore: VS Update 2 database files 2016-04-19 16:50:44 -04:00
Vinnie Falco
a88bc564ee .gitignore: VS Update 2 database files 2016-04-19 16:50:44 -04:00
Nik Bougalis
a5d5856638 Set version to 0.31.0 2016-04-18 14:23:18 -07:00
Nik Bougalis
4e64e3f1dd Check file handle limit on startup (RIPD-442, RIPD-1024):
Calculate the number of file descriptors that are needed during
execution based on the configuration file, with a hard floor
of 1024, adjusting the limit if possible. Refuse to run if enough
fds are not available.

Additionally, allow administrators to limit the number of incoming
connections a configured port will accept. By default no limit is
imposed.
2016-04-18 14:23:18 -07:00
Nik Bougalis
51850ded05 Improve watchdog start logic 2016-04-18 14:23:17 -07:00
Miguel Portilla
76d7c1c01a Fix secured Websocket closing.
Websocketpp was incorrectly handling close before or during protocol negotiation. This issue addresses lingering CLOSE_WAIT file descriptors.
2016-04-18 14:23:00 -07:00
David Schwartz
dabc5567f7 Small Websocket cleanups. 2016-04-18 14:23:00 -07:00
Nik Bougalis
5c5ee6f763 Set version to 0.31.0-rc2 2016-04-01 14:32:00 -07:00
Nik Bougalis
06bfcad671 Validate the tx_json field in sign_for (RIPD-1100) 2016-04-01 14:31:40 -07:00
Nik Bougalis
73e48e6595 Only object instances can have members (RIPD-1100) 2016-04-01 14:31:34 -07:00
Nik Bougalis
64a005565d Set version to 0.32.0-b3 2016-04-01 10:51:07 -07:00
Nik Bougalis
aa5098866c Remove unused HTTPRequest class 2016-04-01 10:18:07 -07:00
Nik Bougalis
60ff83f280 Validate the tx_json field in sign_for (RIPD-1100) 2016-04-01 10:18:07 -07:00
Nik Bougalis
8dbad62153 Only object instances can have members (RIPD-1100) 2016-04-01 10:18:07 -07:00
Nik Bougalis
4a78b343d9 Annotate Throw functions as noreturn 2016-04-01 10:18:07 -07:00
Nik Bougalis
ab8102f927 Warn if a low-entropy passphrase is used to create a wallet 2016-04-01 10:18:07 -07:00
wilsonianb
fa02409c92 Include amendments in validations subscription 2016-04-01 10:18:07 -07:00
wilsonianb
3a45ef0e65 Test on CircleCI with Boost 1.60:
* Run on Ubuntu 14.04
* Do not build Docker images
2016-04-01 10:18:07 -07:00
Edward Hennis
f2cdeb7d9a Simplify Transaction ordering unit test 2016-03-31 18:46:21 -07:00
JoelKatz
ff7a2c63f2 Remove unused fields
These fields were likely added in error. They are
needed in the corresponding transaction formats but
not in the ledger formats.
2016-03-31 18:44:33 -07:00
Miguel Portilla
efe4c9cae3 Convert throws to Throws. 2016-03-31 18:43:49 -07:00
Miguel Portilla
c37261858a Normalize WSClient JSON output (RIPD-1095):
JSON returned from the WSClient is normalized to resemble JSON-RPC
output, to make unit tests agnostic to the transport used.
2016-03-31 18:43:13 -07:00
seelabs
ef3dc5bb58 Return unfunded and expired offers when flow fails:
Payments do not remove unfunded and expired offers when a payment
fails. However, offer crossing is now using the payment engine and needs
to know what offers were found in a removable state, even on failure.
2016-03-31 18:42:55 -07:00
seelabs
968327d577 Set version to 0.32.0-b2 2016-03-23 15:32:29 -04:00
Vinnie Falco
eedf724ccd Fix streambuf::prepare:
In some edge cases, calling prepare could leave the output
sequence with the incorrect size. This happens when out_end_
is non-zero and the call to prepare should leave out_end_ at 0.
2016-03-23 15:32:26 -04:00
Vinnie Falco
bf3f33f8cb Fix streambuf::prepare:
In some edge cases, calling prepare could leave the output
sequence with the incorrect size. This happens when out_end_
is non-zero and the call to prepare should leave out_end_ at 0.
2016-03-23 15:32:26 -04:00
seelabs
271feb02b8 Add command-line switch to enable asserts 2016-03-23 15:32:26 -04:00
seelabs
f254ebb4ca Improve BookStep precision:
A computation like: `amount_remaining = amount_wanted - amount_got`, can
leave `amount_remaining == 0` without `amount_wanted == amount_got`.
This happens if the amounts differ by less than the smallest
representable value. Fix BookStep to handle this case.
2016-03-23 15:32:26 -04:00
Scott Schurr
c9f1966e08 Remove Env::disable_testing() stub 2016-03-23 15:32:26 -04:00
wilsonianb
095f85f159 List all trusted validator keys under single config section:
Trusted master public keys can be listed under either [validators] or
[validator_keys] config sections. All keys listed under [validators] are
added to permanent trusted keys list regardless of key type.

A master public key is moved from permanent key list to manifest cache
when one of its manifests is received. This allows rippled operators to
list all trusted keys under the [validators] config section.
2016-03-23 15:30:56 -04:00
Howard Hinnant
fdd2740f8b Align mutex and condition_variable 2016-03-23 15:24:15 -04:00
Edward Hennis
8268162cac Fix SHAMapStore test timing consistency 2016-03-18 15:01:32 -04:00
seelabs
30eff2b520 Set version to 0.32.0-b1 2016-03-17 17:36:30 -04:00
wilsonianb
d3962718aa Mark validations as full or partial:
Set kFullFlag in STValidation constructor and include validation
type (full or partial) in subscription stream.
2016-03-17 17:35:39 -04:00
Scott Schurr
388fd1262a Access Journal::Stream using member functions (RIPD-1087):
Replace Journal public data members with member function accessors
in order to make Journal lighter weight.  The change makes a
Journal cheaper to pass by value.

Also add missing stream checks (e.g., calls to JLOG) to avoid
text processing that ultimately will not be stored in the log.
2016-03-17 17:35:06 -04:00
Scott Schurr
7a4bd2278d Access Journal::Stream using member functions (RIPD-1087):
Replace Journal public data members with member function accessors
in order to make Journal lighter weight.  The change makes a
Journal cheaper to pass by value.

Also add missing stream checks (e.g., calls to JLOG) to avoid
text processing that ultimately will not be stored in the log.
2016-03-17 17:35:06 -04:00
Miguel Portilla
b3f5986c83 Charge pathfinding consumers per source currency (RIPD-1019):
The IP address used to perform pathfinding operations is now charged an
additional resource increment for each source currency in the path set.

* NOTE: This charge is a local resource charge, not a transaction fee
  charge.
2016-03-17 17:35:06 -04:00
Miguel Portilla
48d28826d0 Pathfinding cleanup 2016-03-17 17:35:06 -04:00
seelabs
122a5cdf89 Add V2 implementation of payments:
Add a new algorithm for finding the liquidity in a payment path. There
is still a reverse and forward pass, but the forward pass starts at the
limiting step rather than the payment source. This insures the limiting
step is completely consumed rather than potentially leaving a 'dust'
amount in the forward pass.

Each step in a payment is either a book step, a direct step (account to
account step), or an xrp endpoint. Each step in the existing
implementation is a triple, where each element in the triple is either
an account of a book, for a total of eight step types.

Since accounts are considered in pairs, rather than triples, transfer
fees are handled differently. In V1 of payments, in the payment path
A -> gw ->B, if A redeems to gw, and gw issues to B, a transfer fee is
changed. In the new code, a transfer fee is changed even if A issues to
gw.
2016-03-17 17:34:37 -04:00
seelabs
f3e93bbbeb Add operator!= to STPathElement 2016-03-17 17:34:24 -04:00
seelabs
6d2f7e46dd Add IOU/XRP Amount support to Offers 2016-03-17 17:34:08 -04:00
seelabs
3d9589f010 Add IOU and XRP Amounts 2016-03-17 17:31:47 -04:00
Miguel Portilla
906ef761ba Set version to 0.31.0-rc1 2016-03-15 15:12:35 -04:00
Miguel Portilla
6b87a67592 Merge remote-tracking branch 'upstream/release' into develop 2016-03-15 15:10:05 -04:00
Edward Hennis
e16361826e Set version to 0.31.0-b14 2016-03-10 15:02:04 -05:00
Edward Hennis
a327cecee6 Create new Validations columns properly:
* Thread-safe preparation of Validations cleanup query
* Followup to RIPD-870
2016-03-10 14:57:59 -05:00
Vinnie Falco
64d9f7c23e Set version to 0.31.0-b13 2016-03-09 17:48:58 -05:00
Vinnie Falco
4f16a1cee9 Disable SHAMapStore test:
The test depends on an asynchronous operation completing
in a certain time, failing periodically due to timing.
2016-03-09 17:47:37 -05:00
Miguel Portilla
8f83f69325 RPC robust transaction unit test (RIPD-1079) 2016-03-09 16:23:26 -05:00
Miguel Portilla
1d0ca51c88 RPC book unit test (RIPD-1077) 2016-03-09 16:23:25 -05:00
Miguel Portilla
ca70f4fab1 RPC subscribe unit test (RIPD-1076) 2016-03-09 16:23:25 -05:00
Miguel Portilla
72cdf3f555 Improve held transaction submission:
Removed redundant validity checks for held transactions in NetworkOPsImp::apply.
2016-03-09 16:23:24 -05:00
Miguel Portilla
1c68fddad7 Subscribe cleanup 2016-03-09 16:23:24 -05:00
Miguel Portilla
2f3b5f6d0a Log websocket received messages 2016-03-09 16:23:24 -05:00
Miguel Portilla
5663c45a0d Add jtx::json string constructor 2016-03-09 16:23:23 -05:00
Miguel Portilla
172356d299 Add JobCoro destructor completion assert
Make JobCoro non copyable
2016-03-09 16:23:23 -05:00
Vinnie Falco
2323ea4493 Add WSClient 2016-03-09 16:23:23 -05:00
Vinnie Falco
d6a666f4e0 Add wsproto 2016-03-09 16:23:22 -05:00
Vinnie Falco
6e70a6c6f5 Remove 'skip on stop' job attribute 2016-03-09 16:23:22 -05:00
Vinnie Falco
b82be0a9b0 Skip websocket commands on stop 2016-03-09 16:23:22 -05:00
Vinnie Falco
94a47569d6 Check suspended coros for JobQueue stop condition 2016-03-09 16:23:21 -05:00
Vinnie Falco
73df97f2d0 Add JobQueue::rendezvous 2016-03-09 16:23:21 -05:00
Vinnie Falco
e8b75b80c2 Remove obsolete JobQueue thread tracking 2016-03-09 16:23:21 -05:00
Vinnie Falco
f6bec473d5 Reduce the runtime of nudb.recover test 2016-03-09 16:23:20 -05:00
Vinnie Falco
9ab5611c65 Fix destructor race in Job 2016-03-09 16:23:20 -05:00
Vinnie Falco
92391332d7 Reduce the runtime of nudb.recover test 2016-03-09 16:23:20 -05:00
Vinnie Falco
8e26b187be Set TCP_NODELAY on plain, loopback JSONRPC clients 2016-03-09 16:23:20 -05:00
Vinnie Falco
79ce5901f3 Improved write buffering in JSONRPC client 2016-03-09 16:23:19 -05:00
Vinnie Falco
29a4849024 Improve socket writes in BaseHTTPPeer 2016-03-09 16:23:19 -05:00
Nik Bougalis
0a1731c4c9 Assign non-default Rules correctly 2016-03-09 13:48:12 -05:00
Nik Bougalis
5cac2befb0 Avoid deriving a known PublicKey 2016-03-09 13:32:16 -05:00
Vinnie Falco
be60348f8f Update parser for http-parser:
* Remove unused raw_parser
* C++ parser wrapper is updated
2016-03-08 12:01:41 -05:00
Vinnie Falco
e6d4436e9d Update parser for http-parser:
* Remove unused raw_parser
* C++ parser wrapper is updated
2016-03-08 12:01:41 -05:00
Vinnie Falco
c4e9a464e7 Update http-parser subtree:
Source: https://github.com/nodejs/http-parser/commits/master
Commit: fd65b0fbbdb405425a14d0e49f5366667550b1c2
Merge commit '404d58d77c3ecbea68e0bd4fa1e7ff4b7c000fc5' into parser
2016-03-04 12:27:24 -05:00
Vinnie Falco
16b1adfa86 Update http-parser subtree:
Source: https://github.com/nodejs/http-parser/commits/master
Commit: fd65b0fbbdb405425a14d0e49f5366667550b1c2
Merge commit '404d58d77c3ecbea68e0bd4fa1e7ff4b7c000fc5' into parser
2016-03-04 12:27:24 -05:00
Vinnie Falco
404d58d77c Squashed 'src/beast/beast/http/impl/http-parser/' changes from cba704c..fd65b0f
fd65b0f src: refactor method parsing
678a9e2 test: Assert against correct error messages
e2e467b Update http-parser to 2.6.1
4e382f9 readme: fix build status badge
bee4817 Bump version to 2.6.0
777ba4e src: introduce `http_parser_url_init`
483eca7 doc: updated README.md to include multi-threading example
e557b62 src: support LINK/UNLINK (RFC 2068, draft-snell-link-method)
e01811e src: fixed compile error C2143 for vs2012
b36c2a9 header: treat Wine like MinGW
eb5e992 src: support ACL (WebDAV, RFC3744, Section 8.1).
4f69be2 readme: update WebSocket link to RFC6455
b5bcca8 test: `SEARCH`, `PURGE` and `MKCALENDAR`
8b1d652 src: support BIND/REBIND/UNBIND (WebDAV, RFC5842)
7d75dd7 src: support IPv6 Zone ID as per RFC 6874
ab0b162 src: use ARRAY_SIZE instead of sizeof()
39ff097 src: remove double check
f6f436a src: fix invalid memory access in http_parse_host
2896229 make: fix dynamic library extension for OS X
39c2c1e Bump version to 2.5.0
dff604d src: support body in Upgrade requests
d767545 src: callbacks chunk boundaries: header/complete
2872cb7 test: regression test for incomplete/corrupted hdr
5d414fc makefile: add un/install targets
d547f3b url_parser: remove mixed declarations
7ecf775 src: partially revert 959f4cb to fix nread value
7ba3123 header: fix field sizes
53063b7 Add function to initialize http_parser_settings
1b31580 Bump version to 2.4.2
59569f2 src: skip lws between `connection` values
36f107f Bump version to 2.4.1
280af69 src: fix build on MSVC
956c8a0 Bump version to 2.4.0
167dcdf readme: fix typo
3f7ef50 src: annotate with likely/unlikely
265f9d0 bench: add chunked bytes
091ebb8 src: simple Connection header multi-value parsing
959f4cb src: remove reexecute goto
0097de5 src: use memchr() in h_general header value
c6097e1 src: faster general header value loop
2630060 src: less loads in header_value loop
0cb0ee6 src: tighten header field/value loops
6132d1f src: save progress
3f1a05a benchmark: initial
94a55d1 send travis irc notifications to #node-ci
5fd51fd Fix warning on test suite found by Clang Analyzer
0b43367 http_parser: Follow RFC-7230 Sec 3.2.4
11ecb42 Docs fix
7bbb774 doc: add very basic docs for `http_parser_execute`
17ed7de header: typo fix in a comment
5b951d7 src: fix clang warning
1317eec Added support for MKCALENDAR
08a2cc3 very minor spelling/grammar changes in README.md
158dd3b signing the CLA is no longer a requirement
8d9e5db fix typo in README comment
d19e129 contrib: fixed resource leak in parsertrace
24e2d2d Allow HTTP_MAX_HEADER_SIZE to be defined externally
56f7ad0 Bump version to 2.3.0
76f0f16 Fix issues around multi-line headers
5d9c382 Include separating ws when folding header values

git-subtree-dir: src/beast/beast/http/impl/http-parser
git-subtree-split: fd65b0fbbdb405425a14d0e49f5366667550b1c2
2016-03-04 12:26:41 -05:00
Nik Bougalis
6c712ff2df Set version to 0.31.0-b12 2016-03-03 13:16:06 -08:00
Scott Schurr
e3414bf042 Test how beast::is_call_possible<> handles const-ness. 2016-03-03 13:16:02 -08:00
Scott Schurr
308aaa6f78 Test how beast::is_call_possible<> handles const-ness. 2016-03-03 13:16:02 -08:00
Edward Hennis
eb62959216 Clear old Validations during online delete (RIPD-870):
* Add Validations.LedgerSeq and .InitialSeq fields.
* Clean up logging.
* Lower online delete minimum for standalone mode.
* Unit tests of online_delete.
2016-03-03 13:16:02 -08:00
JoelKatz
70d5c4eca7 Avoid passing SHAMapNodeID's to sync filters 2016-03-03 13:10:28 -08:00
Nik Bougalis
a025d365b8 Verify that returned RPC codes are known 2016-03-03 13:05:11 -08:00
Nik Bougalis
89fa10b40b Add description of rpcSENDMAX_MALFORMED error 2016-03-03 13:05:04 -08:00
Nik Bougalis
34e85ccb62 Refactor treatment of Ledger:
All handling of Ledger in shared_ptr is modified to
use a const managed object when the context requires
immutable semantics.
2016-03-03 13:02:13 -08:00
Nik Bougalis
77a4218a9e Set version to 0.31.0-b11 2016-02-29 13:46:37 -05:00
seelabs
93bcdf5318 Chrono fixes for VS Update 2 2016-02-29 13:42:55 -05:00
seelabs
d8ee487c19 Fix underflow issue for XRP:
In some cases multiplying or dividing STAmounts gave incorrect results.

This happens when:

1) The result should be rounded up
2) The STAmount represents a native value (XRP)
3) The rounded up value was less than one drop

In this case, the result was zero, instead of one drop. This could
cause funded offers to be removed as unfunded.
2016-02-29 13:42:55 -05:00
Nik Bougalis
bac303273f Report slow stop times only in release builds 2016-02-29 13:42:55 -05:00
seelabs
3605bf1f60 Chrono fixes for VS Update 2 2016-02-29 13:42:55 -05:00
Scott Schurr
7c2e5f3ac8 Cleanups in beast::Journal:
The Journal API is affected.  There are two uses for the
Journal::Severity enum:

 o It is used to declare a threshold which log messages must meet
   in order to be logged.

 o It declares the current logging level which will be compared
   to the threshold.

Those uses that affect the threshold are now named threshold()
rather than severity() to make the uses easier to distinguish.

Additionally, Journal no longer carries a Severity variable.
All handling of the threshold() is now delegated to the
Journal::Sink.

Sinks are no longer constructed with a default threshold of
kWarning; their threshold must be passed in on construction.
2016-02-29 13:42:55 -05:00
Nik Bougalis
d3b43bfa37 Report slow stop times only in release builds 2016-02-29 13:42:55 -05:00
Nik Bougalis
bf6079797f Simplify logging:
* Construct Logs with the correct severity
* Remove deprecatedLogs and log squelching support
* Use debugJournal for AutoSocket logging
2016-02-29 13:42:55 -05:00
Scott Schurr
6366f62f11 Cleanups in beast::Journal:
The Journal API is affected.  There are two uses for the
Journal::Severity enum:

 o It is used to declare a threshold which log messages must meet
   in order to be logged.

 o It declares the current logging level which will be compared
   to the threshold.

Those uses that affect the threshold are now named threshold()
rather than severity() to make the uses easier to distinguish.

Additionally, Journal no longer carries a Severity variable.
All handling of the threshold() is now delegated to the
Journal::Sink.

Sinks are no longer constructed with a default threshold of
kWarning; their threshold must be passed in on construction.
2016-02-29 13:42:55 -05:00
Nik Bougalis
427c33dbd7 Set version to 0.30.1-hf2 2016-02-26 15:58:09 -08:00
seelabs
675cbb72a6 Fix underflow issue for XRP:
When specifying that a result should be rounded up,
the code rounded up to a value suitable for a non-xrp
amount. When called with an xrp amount, if that rounded-up
value was less than one drop, the code rounded down to zero.

This could cause funded offers to be removed as unfunded.
2016-02-26 15:57:39 -08:00
Vinnie Falco
f846b1a88f Set version to 0.31.0-b10 2016-02-25 13:57:10 -05:00
Vinnie Falco
4bfcd12897 Disable Rules assignment in Ledger::setup:
This is a temporary fix for a thread-unsafe access.
2016-02-25 13:57:04 -05:00
Nik Bougalis
d736232142 Pathfinding cleanup:
* Remove unused code
* Do not use `pointer` and `ref` type aliases
* Misc. cleanups
2016-02-25 13:38:46 -05:00
Scott Schurr
9cb02028ed Increase JLOG usage. 2016-02-25 13:38:45 -05:00
Scott Schurr
0703441ee7 Extend View.cpp unit test coverage. 2016-02-25 13:34:58 -05:00
Vinnie Falco
2c3128d9ba Ignore error on socket shutdown 2016-02-25 13:34:57 -05:00
Vinnie Falco
7837eed21b Disable Rules assignment in Ledger::setup:
This is a temporary fix for a thread-unsafe access.
2016-02-22 14:40:44 -05:00
Nik Bougalis
db092449f9 Set version to 0.31.0-b9 2016-02-18 13:54:15 -08:00
Nik Bougalis
d321b446db Remove tracking by public key in Overlay 2016-02-18 13:54:10 -08:00
Nik Bougalis
78ce7a08c0 Return correct error code during unfunded offer cross (RIPD-1082):
When placing an offer that sells XRP, if the account's balance was
low enough that paying the transaction fee would drop the balance
below the reserve, the transaction should return tecUNFUNDED_OFFER.

The existing implementation returned a tesSUCCESS instead. Although
the net result is the same as far as the transaction's effects are
concerned (the offer is not placed on the books and the transaction
fee is charged) the incorrect result code makes deciphering metadata
difficult.

Add unit test that verifies the new behavior.
2016-02-18 13:54:10 -08:00
Nik Bougalis
15adb73a13 Unit tests for offer creation:
* Test whether offers which either already below the reserve (or
  would go below during processing) can execute if they cross.
* Test the "Fill or Kill" and "Immediate or Cancel" flags.
2016-02-18 13:54:10 -08:00
Scott Schurr
f15cc6c4f6 Document feature RPC command in --help. 2016-02-17 16:33:02 -08:00
seelabs
61e6e5694c Add virtual destructor to Logs 2016-02-17 16:33:02 -08:00
Edward Hennis
66bc0bb424 Copy rules from parent ledger 2016-02-17 16:33:02 -08:00
David Schwartz
25589bacea Ensure fee change transactions have a unique transaction ID
Include the ledger sequence number in fee change transactions to ensure
each such transaction has a unique transaction ID.

We tolerate the absence of a ledger sequence in fee change transactions so
that past fee change transactions remain parseable. Since no live amendment
transactions have yet happened, there is no need to tolerate an absent
ledger sequence there.
2016-02-17 16:33:02 -08:00
JoelKatz
d721d35a2d Update SQLite from 3.8.11.1 to 3.11.0 2016-02-17 16:29:00 -08:00
Vinnie Falco
ba84fc2c77 Set version to 0.31.0-b8 2016-02-11 18:43:06 -05:00
Vinnie Falco
0f7dbc7bc0 Fix Server race conditions:
Class io_list manages children that perform asynchronous
I/O operations. The treatment of close and destruction is
refactored to fix race conditions during exit.
2016-02-11 18:42:34 -05:00
Vinnie Falco
137dd351b8 Refactor Server:
* Remove HTTP namespace
* Rename connection classes
* Mark Server test automatic
* Build server sources in classic
2016-02-11 18:42:33 -05:00
Vinnie Falco
ba38bfad9d Server deadlock fixes 2016-02-11 18:42:33 -05:00
Vinnie Falco
be71e8afa2 Get X-Forwarded-For from Session request 2016-02-11 18:42:33 -05:00
Vinnie Falco
076a061997 Add suite::this_suite 2016-02-11 18:42:32 -05:00
Vinnie Falco
de416adadd Disable WebSocket logging 2016-02-11 18:42:32 -05:00
Vinnie Falco
1fda99ba82 Add suite::this_suite 2016-02-11 18:42:32 -05:00
Vinnie Falco
9f5b58c8ab Fix short_read test race/deadlock 2016-02-11 18:42:31 -05:00
Vinnie Falco
a5131515ec Increase severity on Stoppable logging 2016-02-11 18:42:30 -05:00
Vinnie Falco
8c11d24454 Reinforce Env Application log severity 2016-02-11 18:42:30 -05:00
Vinnie Falco
924b6b663e Increase severity on Stoppable logging 2016-02-11 18:42:30 -05:00
Nik Bougalis
688452d971 Fix OptionalProxy<T> equality comparison 2016-02-11 18:41:42 -05:00
Scott Schurr
2f94e16359 Add SignerList to account_info response (RIPD-1061):
The caller of the account_info RPC command can optionally
specify that they want the account's SignerList returned by
adding the argument:

"signer_lists": "true"

The returned SignerList is in an array.  This leaves us room to
support multiple signer lists on an account in the future without
changing the syntax of the result.

The command-line version of account_info does not support the new
option.
2016-02-11 18:41:03 -05:00
Miguel Portilla
fbf736f169 Improved reporting for delivered_amount:
* Determine tx success from metadata result.
* Report delivered_amount for legacy account_tx queries.
2016-02-11 18:39:12 -05:00
Vinnie Falco
f0624581d1 Set version to 0.30.1-hf1 2016-02-11 18:19:31 -05:00
Vinnie Falco
cb23352a35 Revert "Set version to 0.30.1-hf1"
This reverts commit 9fea06ad84.
2016-02-11 18:19:08 -05:00
Vinnie Falco
9fea06ad84 Set version to 0.30.1-hf1 2016-02-11 15:48:32 -05:00
Miguel Portilla
2beeb9a293 Improved reporting for delivered_amount:
* Determine tx success from metadata result.
* Report delivered_amount for legacy account_tx queries.
2016-02-11 15:47:40 -05:00
Nik Bougalis
1e92ac3cf5 Set version to 0.31.0-b7 2016-02-08 15:50:12 -08:00
Scott Schurr
acaf91a2f7 Add AccountLinesRPC unit tests. 2016-02-08 15:50:02 -08:00
seelabs
41125a0a34 Support for clang specific boost and protobuf dirs:
Clang does not understand gcc 5's new ABI. On linux systems
that default to the new ABI (such as ubuntu 15.10), building
with clang requires using C++ libraries built with the the old
gcc ABI.

When building with the clang protobuf lib, a common error is to
load the gcc protobuf library at run time. When set, PROTOBUF_ROOT
is added to rpath to make sure the correct lib is loaded.

Adds a script to install clang and download and build boost and
protobuf with boost.
2016-02-08 15:50:02 -08:00
Nik Bougalis
35ed095dbf Cleanup ledger fetching 2016-02-08 15:50:02 -08:00
Nik Bougalis
ce31e26f58 Enable amendment support 2016-02-08 15:47:57 -08:00
Nik Bougalis
2b640532f2 Merge remote-tracking branch 'upstream/release' into develop 2016-02-08 15:45:10 -08:00
Nik Bougalis
c717006c44 Set version to 0.30.1 2016-02-08 15:37:02 -08:00
Nik Bougalis
fd33d693c4 Merge remote-tracking branch 'upstream/master' 2016-02-08 15:36:04 -08:00
Nik Bougalis
31ecb4dcf3 Revert "Set version to 0.30.1"
This reverts commit 5a4e900a21.
2016-02-08 15:35:22 -08:00
Nik Bougalis
5a4e900a21 Set version to 0.30.1 2016-02-03 14:49:07 -08:00
Nik Bougalis
94ed5b3a53 Set version to 0.31.0-b6 2016-02-01 21:07:52 -08:00
Scott Schurr
2eaf211e9b Improve error message when signing fails (RIPD-1066):
With the addition of multisigning there are a variety of reasons
a signature may fail.  We now return a more descriptive message
for the reason certain signature checks fail.
2016-02-01 21:07:41 -08:00
Miguel Portilla
ed9f5639a8 Throws, explicits and trivial cleanups 2016-02-01 21:07:41 -08:00
Edward Hennis
8e842b5893 Disable tx sig checking at the Application level:
* Only skip sig checking on the RPC/Websocket interface.
* Used by Env tests which submit unsigned transactions.
2016-02-01 21:07:41 -08:00
JoelKatz
1b378172b6 Clean up some consensus edge cases:
* Ensure sufficient time for proposals before increasing avalanche threshold
* Only validators should count themselves towards 80% needed for consensus
2016-02-01 21:07:41 -08:00
Markus Teufelberger
0dc911c091 Do not show progess bar on npm install on CI
See https://github.com/npm/npm/issues/11283 for more discussion on this.
2016-02-01 21:07:41 -08:00
Vinnie Falco
2be11874e3 Improved unit test logging:
Logging from the Application object in the Env is
redirected to the suite::log, with the severity level
set to error and above.
2016-02-01 21:07:41 -08:00
Nik Bougalis
5ac744ff66 Implement a debug Journal 2016-02-01 21:06:56 -08:00
Nik Bougalis
57d6ab091c Cleanups:
* Use Throw instead of directly throwing an exception
2016-02-01 21:06:56 -08:00
Nik Bougalis
f13668371e Amendment RPC enhancements:
* RPC command to veto/unveto
* Store votes
* Add vote information to JSON
* Add ledger majority information to JSON
* Config section for vetos
2016-02-01 21:06:56 -08:00
Nik Bougalis
c9486863c3 Set version to 0.31.0-b5 2016-01-28 12:05:08 -08:00
Nik Bougalis
e9e0277b7c Improve manifest loading 2016-01-28 12:05:00 -08:00
Miguel Portilla
b69f0356ec Convert PathRequest to use std::chrono (RIPD-1069) 2016-01-28 12:05:00 -08:00
Edward Hennis
4d72fc225a Unit test of RPC ledger_request 2016-01-28 12:04:58 -08:00
Edward Hennis
9786e432f8 ledger_request index must be positive 2016-01-28 12:04:57 -08:00
Vinnie Falco
040d7ebb46 Refactor Env for AbstractClient:
Env is changed to use the AbstractClient interface,
which generalizes the transport for submitting client
requests to the Env server instance.

The JSONRPCClient implementation is added, supporting
a simple, synchronous interface. Env is changed to
use the JSONRPCClient implementation instead of the
built in JSON-RPC client.
2016-01-28 12:04:57 -08:00
Scott Schurr
f9f2b8124d Add cmdLineToJSONRPC (RIPD-1074) 2016-01-28 12:04:55 -08:00
Vinnie Falco
dd5d938aa3 Make ParsedPort public 2016-01-28 12:04:55 -08:00
Edward Hennis
7c82adcc84 Avoid missing node errors on genesis ledger creation 2016-01-28 12:04:53 -08:00
Howard Hinnant
bdb1966573 Remove lvalue overload of SHAMap::addItem:
This overload was mistakenly used, but not needed
in the Ledger logic.  Removing this overload turns
this performance bug into a compile time error.
2016-01-28 09:39:30 -08:00
Howard Hinnant
a1582c610e Consolidate getStack into walkTowardsKey:
*  This removes duplicate functionality.
2016-01-28 09:39:30 -08:00
Howard Hinnant
2f9f217c11 Remove NodeStack:
*  This gets all parts of SHAMap using a single type of stack.
*  This paves the way for more code sharing.
2016-01-28 09:39:30 -08:00
seelabs
278f679bb1 Enable underflow fix after specified date 2016-01-28 09:39:30 -08:00
seelabs
96bc727fcb Enforce no-ripple constraints 2016-01-27 17:05:31 -05:00
seelabs
7d2809eb27 Unit test for enforcing no ripple 2016-01-27 17:05:31 -05:00
Nik Bougalis
5062e65277 Set version to 0.30.1-rc4 2016-01-27 13:33:07 -08:00
seelabs
bd44880d5a Enforce no-ripple constraints 2016-01-27 13:32:38 -08:00
Nik Bougalis
ad2383bd4b Set version to 0.30.0-hf2 2016-01-27 12:27:27 -08:00
Nik Bougalis
5b5a01989c Improve compile-time OpenSSL version check 2016-01-27 12:27:18 -08:00
seelabs
c17f7e8b37 Enforce no-ripple constraints 2016-01-26 13:52:41 -08:00
Nik Bougalis
9b8133f65f Set version to 0.31.0-b4 2016-01-25 10:35:56 -08:00
Vinnie Falco
77c0236cae Serialize Application start up:
These changes ensure the caller can block until the
Application object can be fully prepared (especially
listening sockets). Solves the problem where tests
can attempt connections before the server sockets are
ready.

* WebSocket blocks until listening
* Application setup blocks until prepared and started
2016-01-25 10:35:54 -08:00
seelabs
07c4262392 Fix websocket deadlock:
A copy of the connection list is made on stop so it
can be iterated without holding the endpoint lock.
2016-01-25 10:35:54 -08:00
Vinnie Falco
10a5421987 Remove unused websocket04 2016-01-25 10:35:54 -08:00
Scott Schurr
06beddcee6 Convert fast manual unit tests to automatic 2016-01-25 10:35:53 -08:00
Scott Schurr
48f0e1f51d CBigNum unit tests 2016-01-25 10:35:53 -08:00
seelabs
6701b7f1d0 Do not destroy objects until all threads exit in Stoppable test
Objects of class `A` could be destroyed before all their member
functions finished running.
2016-01-25 10:35:53 -08:00
Scott Schurr
9063953ee7 Convert fast manual unit tests to automatic 2016-01-25 10:35:53 -08:00
seelabs
7315d9c300 Do not destroy objects until all threads exit in Stoppable test
Objects of class `A` could be destroyed before all their member
functions finished running.
2016-01-25 10:35:53 -08:00
wilsonianb
05c248f297 Include ledger_index in validations subscription stream 2016-01-25 10:35:53 -08:00
wilsonianb
b92a58d11e Allow random seed with specified wallet_propose key_type (RIPD-1030) 2016-01-25 10:35:53 -08:00
Nik Bougalis
767d253593 Improve manifest public key loading 2016-01-25 10:35:53 -08:00
Nik Bougalis
046a8f443d Add unit tests for Endpoint string parsing 2016-01-25 09:07:41 -08:00
Nik Bougalis
78e59191ed Add unit tests for Endpoint string parsing 2016-01-25 09:07:41 -08:00
Nik Bougalis
958b3a1dc0 Simplify Beast:
* Remove asio HTTP classes
 * Remove beast::File, beast::String, beast::Stream, beast::Array,
   beast::MemoryBlock, beast::CriticalSection and other unused
   classes.
 * Remove unused platform-specific code.
 * Reduce Beast custom assert and debugging helper macros.
2016-01-25 09:07:41 -08:00
Nik Bougalis
de4d872b7a Simplify Beast:
* Remove asio HTTP classes
 * Remove beast::File, beast::String, beast::Stream, beast::Array,
   beast::MemoryBlock, beast::CriticalSection and other unused
   classes.
 * Remove unused platform-specific code.
 * Reduce Beast custom assert and debugging helper macros.
2016-01-25 09:07:41 -08:00
Nik Bougalis
921b34eafd Use boost::filesystem instead of beast::File 2016-01-25 09:07:41 -08:00
Nik Bougalis
77955c74bc Use boost::filesystem instead of beast::File 2016-01-25 09:07:41 -08:00
Nik Bougalis
555cd59a59 Cleanups:
* Reduce Beast dependencies
* Remove unnecessary includes
* Don't use deprecated bassert macros
* Don't use beast::String in Json::Value
2016-01-25 09:07:41 -08:00
Edward Hennis
b4f8dc7abf Set version to 0.31.0-b3 2016-01-20 22:46:38 -05:00
Miguel Portilla
14dde47173 Convert STAmount switchovers to tls (RIPD-1068) 2016-01-20 22:46:09 -05:00
Miguel Portilla
4fb6bf3e67 Add coroutine thread specific storage 2016-01-20 22:46:07 -05:00
Miguel Portilla
f73c55a922 Add JobCoro::join 2016-01-20 22:46:06 -05:00
Vinnie Falco
49c86768e6 Peer to peer network simulator:
* Refine the Peer concept
* Remove incremental consensus simulations (coverage)
* Add unit test (coverage)
* Fix BasicNetwork::remove
2016-01-20 22:46:04 -05:00
Scott Schurr
0fca91c6c1 Remove tapENABLE_TESTING. 2016-01-20 22:46:02 -05:00
wilsonianb
749b4adc7c Add manifests subscriptions
Add verify method to manifest script to check signature
2016-01-20 22:46:00 -05:00
Edward Hennis
a67e4ab9f1 Port test/transaction_ordering_test.js to C++ 2016-01-20 22:45:58 -05:00
Edward Hennis
e0b2a26805 TxQ unit tests account for localTx. 2016-01-20 22:45:56 -05:00
Edward Hennis
6c5b23b317 OpenLedger::accept, flip order of modifier and locals:
* And call in to the TxQ if enabled.
2016-01-20 22:45:55 -05:00
Edward Hennis
8da2a724fb Close/advance Env ledgers through RPC interface 2016-01-20 22:45:54 -05:00
Vinnie Falco
d5363d1a85 Submit Env transactions through RPC interface 2016-01-20 22:45:53 -05:00
seelabs
8f74ee1d96 Add sanitize build support 2016-01-20 22:45:52 -05:00
Miguel Portilla
796ee8e3de Path find source currency limits (RIPD-1062) 2016-01-20 22:45:50 -05:00
Nik Bougalis
25f611d0ec Delete unfunded offers in predictable order 2016-01-20 22:45:49 -05:00
Nik Bougalis
08e518af73 Correctly interrogate child process status 2016-01-20 22:36:57 -05:00
Nik Bougalis
5f4fe9fccb Set version to 0.30.1-rc3 2016-01-20 15:56:16 -08:00
Nik Bougalis
db9885e1fc Delete unfunded offers in predictable order 2016-01-20 15:56:10 -08:00
Nik Bougalis
27673c1c3f Set version to 0.31.0-b2 2016-01-19 15:43:13 -08:00
Miguel Portilla
3394129894 Remove unused declaration 2016-01-19 15:43:03 -08:00
Nik Bougalis
57625e06ed Increase minimum local fee 2016-01-14 14:11:20 -08:00
Nik Bougalis
bdfb5fa2bc Set version to 0.30.1-rc2 2016-01-14 13:36:34 -08:00
Nik Bougalis
b2c9179100 Increase minimum local fee 2016-01-14 13:36:18 -08:00
Nik Bougalis
d7935192dd Set version to 0.31.0-b1 2016-01-12 18:50:58 -08:00
Howard Hinnant
dd3e170e08 Correct handling of comparators in boost::intrusive:
This facilitates the port of rippled to boost 1.60 while
maintaining compatibility with previous versions of boost.
2016-01-12 18:50:53 -08:00
Howard Hinnant
97d5325468 Correct handling of comparators in boost::intrusive:
This facilitates the port of rippled to boost 1.60 while
maintaining compatibility with previous versions of boost.
2016-01-12 18:50:53 -08:00
Scott Schurr
8433851652 Add SignerList support to account_objects (RIPD-1061):
Return just SignerList objects on an account using the
account_objects RPC command with "type":"signer_list".
2016-01-12 18:45:36 -08:00
Edward Hennis
f7b2b84ece Integration test for transaction ordering. 2016-01-12 18:45:36 -08:00
Edward Hennis
8be67c1766 Speed up out of order transaction processing (RIPD-239):
* After successfully applying a transaction to the open ledger, resubmit any held transactions from the same account.
* All held transactions will continue to be retried after consensus round.
2016-01-12 18:45:36 -08:00
Edward Hennis
4d2e7ed404 LedgerMaster hash lookups return boost::optional. 2016-01-12 18:45:36 -08:00
Edward Hennis
e1018546ac Devirtualize LedgerMaster. 2016-01-12 18:45:36 -08:00
JoelKatz
44fcab1081 SHAMap improvements:
* Run key SHAMap unit tests on both backed and unbacked maps
* Remove obsolete version of SHAMapTree::addRootNode
* Our position maps should be unbacked and immutable
* Minimize hash operations for unbacked SHAMaps
  Not setting the sequence numbers to zero in
  SHAMap::walkSubTree causes extra hashes to be
  performed on subsequent operations
2016-01-12 18:45:36 -08:00
JoelKatz
6dab1657b1 Some pathfinding cleanups and optimizations:
* Reduce the log level of an expensive debug message
* Don't hold the request lock while pathfinding
2016-01-12 18:45:36 -08:00
Nik Bougalis
60ad21ae0d Pathfinding cleanups:
* Return std::pair instead of returning by reference
* Use std algorithms when possible
* Use auto and C++14 lambdas
2016-01-12 18:45:36 -08:00
Nik Bougalis
3974ddd8f7 Remove RippleAddress:
The RippleAddress class was used to represent a number of fundamentally
different types: account public keys, account secret keys, node public
keys, node secret keys, seeds and generators.

The class is replaced by the following types:
* PublicKey for account and node public keys
* SecretKey for account and node private keys
* Generator for generating secp256k1 accounts
* Seed for account, node and generator seeds
2016-01-12 18:45:36 -08:00
Nik Bougalis
8064e82774 Simplify Beast:
* Remove obsolete RNG facilities
* Flatten directory structure
* Use std::recursive_mutex instead of beast::RecursiveMutex
2016-01-12 18:45:35 -08:00
Nik Bougalis
e0af6ec567 Streamlined UNL/validator list:
The new code removes the ability to specify domain names
in the [validators] configuration block, and no longer
supports the [validators_site] option.

More details on the supported configurations are available
under doc/rippled-example.cfg.
2016-01-12 18:45:35 -08:00
Nik Bougalis
0a96f3a249 Simplify Beast:
* Remove obsolete RNG facilities
* Flatten directory structure
* Use std::recursive_mutex instead of beast::RecursiveMutex
2016-01-12 18:45:35 -08:00
Nik Bougalis
40363f96a9 Generic PRNG framework:
* A new, unified interface for generating random numbers and
  filling buffers supporting any engine that fits the
  UniformRandomNumberGenerator concept;
* Automatically seeded replacement for rand using the fast
  xorshift+ PRNG engine;
* A CSPRNG engine that can be used with the new framework
  when needing to to generate cryptographically secure
  randomness.
* Unit test cleanups to work with new engine.
2016-01-12 18:45:35 -08:00
Nik Bougalis
1c9577a1ac Simplify blob encoding 2016-01-12 16:06:18 -08:00
Nik Bougalis
a7a30396be Define NOMINMAX for Windows 2016-01-12 16:06:18 -08:00
Nik Bougalis
fee19390f5 Improve watchdog restart logic:
Stop attempting to restart the server after five consecutive
restarts fail to remain operational for at least ten seconds.
2016-01-12 16:06:18 -08:00
Nik Bougalis
ff6c9e329f Set version to 0.30.1-rc1 2016-01-12 10:40:21 -08:00
Vinnie Falco
f997384fca Merge remote-tracking branch 'upstream/release' into develop 2016-01-12 13:38:06 -05:00
seelabs
edbd3794e0 Set version to 0.30.1-b15 2016-01-08 15:14:47 -05:00
Miguel Portilla
1f90b177a1 Require boost 1.57 2016-01-08 15:14:13 -05:00
JoelKatz
a064fcd8e5 Don't pass websocket messages to coroutine 2016-01-08 15:14:13 -05:00
Miguel Portilla
457ad333b2 Websocket dispatch fix 2016-01-08 15:14:13 -05:00
seelabs
034e99562f Force install of clang 3.6 on CircleCI 2016-01-08 15:14:13 -05:00
Scott Schurr
b4d2f66d43 Use canonical method to access base fee in unit tests. 2016-01-08 15:14:13 -05:00
Scott Schurr
32fcf28e1f Test handling of secp256r1 signatures (RIPD-1040):
Commit 6ec5fa9cae fixed a bug that
would cause a crash when a transaction signed with a secp256r1 was
presented. This adds a regression test, ensuring that such
signatures fail gracefully.
2016-01-08 15:14:13 -05:00
Miguel Portilla
5fce652890 Improve sub and unsub errors (RIPD-702) 2016-01-08 15:14:13 -05:00
Edward Hennis
7728f69100 Allow fractional fee multipliers (RIPD-626):
* Auto-fill fee maximum is `base * fee_mult_max / fee_div_max`.
* `fee_div_max` defaults to 1 to preserve backward compatibility.
2016-01-08 15:14:13 -05:00
Edward Hennis
e78b8e4cf3 mulDiv returns 0 if numerator is 0 and denominator isn't:
* Otherwise overflow checks result in divide by 0.
* If denominator is 0, let the divide by 0 exception throw.
* Move mulDiv out of STAmount
2016-01-08 15:14:13 -05:00
Vinnie Falco
2c9c3f4b6e Set version to 0.30.1-b14 2016-01-05 12:37:37 -05:00
Scott Schurr
1e1aa76139 Fix CircleCI "g++ can't be a slave of gcc" error. 2016-01-05 12:37:10 -05:00
Vinnie Falco
39b95903e3 Set version to 0.30.1-b13 2015-12-29 12:43:43 -05:00
Edward Hennis
1bce85d7b6 Don't use tapENABLE_TESTING for TxQ.
* Enable FeeEscalation feature in TxQ tests.
* Elapsed time for simulated consensus.
2015-12-29 12:38:23 -05:00
Vinnie Falco
a5583de6e6 Use features instead of ApplyFlags:
tapENABLE_TESTING is removed from checks, and feature enablement
is the sole method for activating features. Unit tests are updated
to enable required features in the construction of the Env.

Tickets are put on a feature switch instead of a build macro.
2015-12-29 12:38:22 -05:00
Edward Hennis
48e0466a2b Use temp folder for Env test sqlite files:
* Moved empty path check to DatabaseCon, and only for non-standalone.
* No more "DummyForUnitTest" files getting left behind in repo after running unit tests.
2015-12-29 12:38:22 -05:00
Vinnie Falco
1320898fbe Refactor jtx::Env:
These changes eliminate the Env's OpenLedger member and make
transactions go through the Application associated with each
instance of the Env, making the unit tests follow a code path
closer to the production code path.

* Add Env::open() for open ledger
* Add Env::now()
* Rename to Env::current()

* Inject ManualTimeKeeper in Env Application
* Make Config mutable
* Move setupConfigForUnitTests
* Launch Env Application thread
* Use Application ledgers in Env
* Adjust Application clock on ledger close
* Adjust close time for close resolution
* Scrub obsolete clock types
* Enable features via Env ctor
* Make Env::master Account object global

* Cache SSL context (performance)
* Cache master wallet keys in Ledger ctor (performance)
2015-12-29 12:38:21 -05:00
Scott Schurr
90466d6cde Use addWithoutSigningFields in jtx::sign 2015-12-29 12:34:02 -05:00
Vinnie Falco
3c6534dc91 Add Stoppable::alertable_sleep_for 2015-12-23 11:58:38 -05:00
Vinnie Falco
889afd0cbd Don't check free disk space in stand-alone mode. 2015-12-23 11:58:38 -05:00
Vinnie Falco
0141aadf3e Use alertable_sleep_for in LoadManager:
This allows the LoadManager to exit immediately
instead of sleeping for up to 1 second on a stop.
2015-12-23 11:58:38 -05:00
Vinnie Falco
0d6ad47051 Add Stoppable::alertable_sleep_for 2015-12-23 11:58:38 -05:00
Vinnie Falco
95dcdf7ddc Log slow calls to Stoppable::onStop 2015-12-23 11:58:36 -05:00
Vinnie Falco
035b308d7c Log slow calls to Stoppable::onStop 2015-12-23 11:58:36 -05:00
Nik Bougalis
81a03285ec Set version to 0.30.1-b12 2015-12-18 22:34:00 -08:00
Miguel Portilla
cb280b10c1 Improve ledger_request response 2015-12-18 22:33:57 -08:00
JoelKatz
4f40e94c99 Fix proposal relaying (RIPD-1057):
Stash the signature so we can relay a proposal later
2015-12-18 22:33:57 -08:00
JoelKatz
bb944466f2 Consensus singleton and lock changes (RIPD-1054):
* Make LedgerConsensus object a singleton
* Protect consensus structures with their own locks
* Simplify NetworkOPs interaction with LedgerConsensus
* Log when we build and validate the same ledger
2015-12-18 22:17:03 -08:00
Nik Bougalis
2a97bd3848 Do not open peer port in standalone mode 2015-12-18 21:33:03 -08:00
Nik Bougalis
e91f18946e Improve STTx construction:
* Remove the ability to construct an empty transaction by type, only
  to then have to add fields to it. Instead, offer a constructor that
  accepts a transaction type and a lambda that can insert fields into
  the STTx during construction.
* Remove now obsolete boost::optional transaction ID.
2015-12-18 16:39:29 -08:00
Nik Bougalis
6fd11db5a9 Set version to 0.30.1-b11 2015-12-17 10:29:27 -08:00
Nik Bougalis
5185fa3a92 Check validations for currency based on close time 2015-12-17 00:00:28 -08:00
Mark Travis
f26835e507 Command line option to not log to console after startup 2015-12-17 00:00:24 -08:00
Howard Hinnant
5423fa25d4 Change the use of integrals to chrono types as appropriate 2015-12-16 11:35:59 -08:00
Miguel Portilla
d17c8e235f Fix RPF early response (RIPD-1064) 2015-12-16 11:35:59 -08:00
Miguel Portilla
754dea8d47 Handle account_objects empty response (RIPD-958) 2015-12-16 11:35:59 -08:00
Miguel Portilla
3fa2028eb2 Add expiration to account_offers (RIPD-1049) 2015-12-16 11:35:59 -08:00
Miguel Portilla
d5c14755ce Add owner_funds to txs in RPC ledger (RIPD-1050) 2015-12-16 11:35:59 -08:00
Howard Hinnant
e86ff5daa1 Change the use of integrals to chrono types as appropriate 2015-12-16 11:35:59 -08:00
Howard Hinnant
bacf2605a4 Simplify SHAMap::firstBelow:
* Add SHAMap iteration test
2015-12-16 11:35:59 -08:00
Howard Hinnant
382c9c68b8 Have upper_bound use logic in walkToPointer:
*  Rename walkToPointer to walkToKey
*  Have walkToKey optionally take a stack
2015-12-16 11:35:54 -08:00
Howard Hinnant
bdd733bc0b Simplify initial node-finding loop in SHAMap::upper_bound 2015-12-16 11:35:40 -08:00
Howard Hinnant
05ac32064f Remove unused SHAMap::fetch 2015-12-16 11:35:40 -08:00
Howard Hinnant
bbe7457049 Make SHMapSyncFilter virtual functions const 2015-12-16 11:35:37 -08:00
Howard Hinnant
48ed44d117 Change SHAMapSyncFilter to use SHAMapHash:
*  This also involves changing TaggedCache to use SHAMapHash
2015-12-16 11:35:35 -08:00
Howard Hinnant
0dbacedb58 Change signature of SHAMap::getFetchPack to use SHAMapHash 2015-12-16 11:35:33 -08:00
Nik Bougalis
493752e1c6 Set version to 0.30.1-b10 2015-12-09 12:11:35 -08:00
Nik Bougalis
25fe66bafc Report server uptime in server_info 2015-12-09 12:11:27 -08:00
Mark Travis
496fea5995 Secure gateway:
This is designed for use by proxies in front of rippled. Configured IPs
can forward identifying user data in HTTP headers, including
user name and origin IP. If the user name exists, then resource limits
are lifted for that session. However, administrative commands are still
reserved only for administrative sessions.
2015-12-09 11:25:57 -08:00
Miguel Portilla
810175ae95 Remove ScopedMetrics 2015-12-09 11:24:45 -08:00
JoelKatz
45b07ff9ec Consensus ledger switch improvements
* Expire validations faster based on when we first saw them.
* Never jump to a ledger prior to the latest fully-valid ledger
* Drop validations with signing times too far in the future immediately
2015-12-08 10:35:41 -08:00
seelabs
469d5494ea Search /etc/opt/ripple for rippled.cfg 2015-12-08 10:28:49 -08:00
seelabs
e19e6c6b0a Change link order for static links 2015-12-08 03:59:36 -08:00
Nik Bougalis
f6f4452231 Set version to 0.30.1-b9 2015-12-04 20:52:35 -08:00
JoelKatz
a8cdd4f66d Must hold lock to call LedgerConsensusImp::getJson. 2015-12-04 20:51:58 -08:00
seelabs
999701e384 Fix underflow rounding issue:
Very small payment could fail when STAmount::mulRound underflowed
and returned zero, when it should have rounded up to the smallest
representable value.
2015-12-01 11:02:27 -08:00
wltsmrz
4626992474 Disable deprecation warnings 2015-12-01 10:59:56 -08:00
wltsmrz
6066c254c8 Add multi-sign test 2015-12-01 10:59:56 -08:00
wltsmrz
f2dfde3ee1 Add patches for ripple-lib core 2015-12-01 10:59:55 -08:00
Vinnie Falco
2401b44bed Use qalloc for RawStateTable and OpenView::txs_ 2015-12-01 10:59:55 -08:00
Miguel Portilla
3e5ec91977 Store index before publish (RIPD-1052, RIPD-1053) 2015-12-01 10:59:55 -08:00
Miguel Portilla
108906cb20 Implement new coroutines (RIPD-1043) 2015-12-01 10:59:55 -08:00
Miguel Portilla
880f354b90 Convert throws and catch alls (RIPD-1046) 2015-12-01 10:59:55 -08:00
Nik Bougalis
0633ef1ba1 Remove already-triggered ledger switches 2015-12-01 05:48:46 -08:00
Nik Bougalis
298ef4ac4d Improve error code lookup 2015-12-01 05:48:46 -08:00
Nik Bougalis
01c9baf8ca Set version to 0.30.1-b8 2015-11-24 13:22:26 -08:00
JoelKatz
3c496b07f9 Don't include zero traffic levels 2015-11-24 01:34:34 -08:00
JoelKatz
9f96d7ea38 Correct delivered_amount reporting for minor ledgers (RIPD-1051)
The existing delivered_amount logic will erroneously report
unavailable for ledgers that aren't in the network's live
chain because it is based solely on ledger sequence number.
This adds a check based on the ledger close time to permit
the code to give correct results in standalone mode and on
test networks.
2015-11-24 01:34:34 -08:00
David Schwartz
d9905ec719 Ledger close time optimizations (RIPD-998, RIPD-791):
Add a LedgerMaster function to get a ledger's
close time from either its hash or sequence number.
Use this function when adding the 'date' fields to
transaction JSON. This avoids constructing large numbers
of ledgers.
2015-11-24 01:33:55 -08:00
JoelKatz
3a039fff66 Add "tx" option to "ledger" command line 2015-11-24 01:33:55 -08:00
JoelKatz
c726377012 Add SeritalIter::skip 2015-11-24 01:33:55 -08:00
JoelKatz
1601f6bbc9 Improve ledger close timing
Added a safety to close the ledger quickly if there's
evidence validators we trust have already closed the
ledger. Base the minimum ledger open time on how long
we saw the ledger open. Do not rely on the rounded
close time for enforcing the minimum ledger open time.
2015-11-24 01:33:55 -08:00
Edward Hennis
b87eff2115 Improve TxQ test coverage:
* LastLedgerSequence
* Zero-fee txn has infinite fee level.
* Remove pseudo-transaction fee levels, since pseudos never get to the open ledger.
* preflight/preclaim failure cases
* Queued transaction failure handling.
2015-11-24 01:33:55 -08:00
Edward Hennis
9c8204f945 Fix TxQ LastLedgerSequence handling 2015-11-24 01:33:53 -08:00
Scott Schurr
289bc7deb3 Reduce interface to STAccount (RIPD-994):
Since a non-default STAccount is now guaranteed to always be
160 bits, it was possible to reduce the number of methods that
it provides.

In the process of narrowing the STAccount interface it became
reasonable to remove some methods that duplicated functionality.
A few classes offered both a value() and a getValue() method.
The getValue() method is removed from those classes.
2015-11-24 01:33:53 -08:00
Scott Schurr
f72b14ec36 Make STAccount only constructible with 160 bits (RIPD-994):
If someone attempts to construct an STAccount with something
other than 160 bits the constructor now throws.

Since an STAccount now enforces that it always stores exactly
160 bits, we use a fixed-sized uint160 for the storage, replacing
a variable sized STBlob.

In order to leave the ledger and wire formats unaffected, the
STAccount still serializes and deserializes itself as though
it were variable length.
2015-11-24 01:33:53 -08:00
Scott Schurr
f63867e958 Add STAccount unit tests (RIPD-994) 2015-11-24 01:33:51 -08:00
Scott Schurr
fa05ded88e Use std::thread in LedgerCleaner (RIPD-236) 2015-11-24 01:33:51 -08:00
Nik Bougalis
7bb4ff901e Set version to 0.30.1-b7 2015-11-12 21:55:48 -08:00
Nik Bougalis
03516a14da Defer checking whether master key was used for signing 2015-11-12 21:54:44 -08:00
Nik Bougalis
0c67364e6c Allow multiple incoming connections from the same IP:
Multiple servers behind NAT might share a single public IP, making it
difficult for them to connect to the Ripple network since multiple
incoming connections from the same non-private IP are currently not
allowed.

RippleD now automatically allows between 2 and 5 incoming connections,
from the same public IP based on the total number of peers that it is
configured to accept.

Administrators can manually change the limit by adding an "ip_limit"
key value pair in the [overlay] stanza of the configuration file and
specifying a positive non-zero number. For example:

[overlay]
ip_limit=3

The previous "one connection per IP" strategy can be emulated by
setting "ip_limit" to 1.

The implementation imposes both soft and hard upper limits and will
adjust the value so that a single IP cannot consume all inbound slots.
2015-11-12 21:54:44 -08:00
Nik Bougalis
f00c09d9fc Case-insensitive configuration file option parsing 2015-11-12 21:54:44 -08:00
Howard Hinnant
21a7b62c2b Make the SHAMap hash a distinct type from a uint256.
* Implement a type safe distinction between a node hash and a node id.
* This is just the first phase, limited to SHAMap's internals.
2015-11-12 21:54:44 -08:00
Vinnie Falco
49c4a063c1 Exit immediately in Resource::ManagerImp::~ManagerImp 2015-11-12 21:54:44 -08:00
Miguel Portilla
f8edc203e7 Reduce DeliverNodeReverse log severity 2015-11-12 21:54:44 -08:00
JoelKatz
9a6a064307 Be more robust about storing/replaying proposals:
Store a proposal even if it arrives outside a round. Make sure we catch
up on any missed proposals as we start a round.
2015-11-12 21:54:32 -08:00
JoelKatz
22678b5cfa Rework close time voting:
Properly take close time rounding and monotonic ledger close times
into account when determining if we have a close time consensus.

In some cases, we send an extra proposal at the end of a round. This
can be removed once all servers have the correct end of round detection
logic.
2015-11-12 21:53:53 -08:00
JoelKatz
269008b311 Better logging of built/validated discrepancies:
If we built a different ledger from the one we ultimately
validate, log the status of the consensus round. This will
make it easier to rule out transaction processing issues
as the cause of these discrepancies and generally make them
easier to diagnose.
2015-11-12 21:53:28 -08:00
JoelKatz
0458d1910e Cleanups 2015-11-12 21:52:10 -08:00
wilsonianb
98bdb9de68 Use [ips_fixed] over r.ripple.com as the default [ips] 2015-11-12 21:40:20 -08:00
Nik Bougalis
aa4f347e7c Set version to 0.30.0-hf1 2015-11-05 16:47:41 -08:00
Vinnie Falco
0a0adaac6d Set admin privileges on websocket:
When the websocket connection is established, any configured administrative
privileges are applied to resource limits.
2015-11-05 16:45:19 -08:00
Nik Bougalis
124ea41d85 Set version to 0.30.1-b6 2015-11-05 14:52:05 -08:00
Nik Bougalis
818130a8c0 Separate cluster tracking from UNL:
* Simplify code
* Leverage C++14 transparent comparators
2015-11-05 14:51:29 -08:00
seelabs
41ff751cd2 Fix ABI settings for clang on linux 2015-11-05 14:51:29 -08:00
Scott Schurr
a8cc9033b4 Add unit test for zero fee transaction. 2015-11-05 14:50:16 -08:00
Mark Travis
fdd012c420 State accounting:
Record total duration spent in and every transition to each
possible server state. Display as counters through server_info
RPC call.
2015-11-05 14:49:05 -08:00
JoelKatz
3d2aae9ea5 Make close time consensus detection use montonic close time rules 2015-11-04 13:49:54 -08:00
JoelKatz
3d5ff2b4cd Prevent some missed proposals, faster consensus catch up 2015-11-04 13:49:54 -08:00
David Schwartz
d20f0d5014 Make sure LedgerHistory::builtLedger gets called 2015-11-03 14:00:28 -08:00
Nik Bougalis
b71ff4cb88 Set version to 0.30.1-b5 2015-10-28 14:45:55 -07:00
Nik Bougalis
ca17adf7ec Avoid serializing ledger proposals 2015-10-28 14:45:35 -07:00
Scott Schurr
323164877c Make submit_multisigned command line consistent (RIPD-182):
In command line usage (only), the "sign", "submit", and "sign_for"
commands do not require the submitted JSON to be wrapped in a
tx_json object.  Make the submit_multisigned command line behave
consistently with the command line form of those other commands.
2015-10-28 14:45:35 -07:00
JoelKatz
6dbbb7406c Allow subscription to peer status changes (RIPD-579)
Subscribe to "peer_status" stream (admin only) permits
reception of "peerStatusChange" notifications.

These can include the event the peer is reporting, the peer's
new status, the peer's currently accepted ledger hash and sequence,
the peer's network time, and the range of ledgers the peer has
available for remote querying.
2015-10-28 14:45:35 -07:00
JoelKatz
75bed5efcf Permit pathfinding to be disabled. (RIPD-271)
If you do not need pathfinding, you can disable it and save some
resources by setting path_search_max to zero in your config file.
2015-10-28 14:45:35 -07:00
JoelKatz
45f00362db Report connection uptime in peer command (RIPD-927) 2015-10-28 14:45:34 -07:00
seelabs
ded2a5c076 Automate process of using gcc5:
* SConstruct will set ABI based on ubuntu flavor
* Script to bring in packages for various ubuntu flavors
* Script to bring in packages for various fedora 22
* Remove unneeded environment variable from travis
* Script to build boost with correct API flags
* `--static` flag to control static linking
2015-10-28 14:45:34 -07:00
Edward Hennis
b6cb981a8b Update VS2015 build instructions.
* Include Python and Scons, and new OpenSSL lib path.
2015-10-28 10:20:35 -07:00
Edward Hennis
d0770cdb1a Use C++14 lambda declaration. 2015-10-28 10:15:58 -07:00
Edward Hennis
6464d1abc1 Clean up src/ripple/app/tx directory:
* Move InboundTransactions to app/ledger
* Move TransactionAcquire to app/ledger
* Move LocalTxs to app/ledger
* Move Transaction to app/misc
* Move TransactionMaster to app/ledger
2015-10-28 11:37:15 -04:00
Edward Hennis
7d0d89faae Convert HashRouter to use aged_unordered_map. 2015-10-28 11:25:50 -04:00
Edward Hennis
9329aafe53 Transaction queue and fee escalation (RIPD-598):
The first few transactions are added to the open ledger at
the base fee (ie. 10 drops).  Once enough transactions are
added, the required fee will jump dramatically. If additional
transactions are added, the fee will grow exponentially.

Transactions that don't have a high enough fee to be applied to
the ledger are added to the queue in order from highest fee to
lowest. Whenever a new ledger is accepted as validated, transactions
are first applied from the queue to the open ledger in fee order
until either all transactions are applied or the fee again jumps
too high for the remaining transactions.

Current implementation is restricted to one transaction in the
queue per account. Some groundwork has been laid to expand in
the future.

Note that this fee logic escalates independently of the load-based
fee logic (ie. LoadFeeTrack). Submitted transactions must meet
the load fee to be considered for the queue, and must meet both
fees to be put into open ledger.
2015-10-28 11:15:19 -04:00
Edward Hennis
dc1276efa3 OpenLedger::current returns OpenView const. 2015-10-28 11:15:11 -04:00
Edward Hennis
5707988155 Env::postconditions function for alternate validation. 2015-10-28 11:15:10 -04:00
Edward Hennis
382adcc93c Move mulDiv and lowestTerms to STAmount.cpp 2015-10-28 11:15:08 -04:00
Vinnie Falco
656a6c5eb5 Add modify function to OpenLedger::accept 2015-10-28 11:12:47 -04:00
Vinnie Falco
a8859b495b Set version to 0.30.0 2015-10-21 18:26:02 -07:00
seelabs
6700e44793 Set version to 0.30.1-b4 2015-10-20 13:37:41 -04:00
JoelKatz
d6df73747f Remove the small fetch optimization
In some cases, it significantly increased ledger fetch traffic.
2015-10-20 13:37:07 -04:00
seelabs
d8f265e8ac Upgrade to C++-14:
* Remove cxx14 compatibility layer from ripple
  * Update travis to clang 3.6 and drop gcc 4.8
  * Remove unneeded beast CXX14 defines
  * Do not run clang build with gdb with travis
  * Update circle ci to clang 3.6 & gcc-5
  * Don't run rippled in gdb, clang builds crash gdb
  * Staticly link libstdc++, boost, ssl, & protobuf
  * Support builds on ubuntu 15.10
2015-10-20 11:35:24 -04:00
seelabs
8db0094c73 Remove cxx14 compatibility layer from beast 2015-10-20 09:52:25 -04:00
seelabs
d67d8c2ced Remove cxx14 compatibility layer from beast 2015-10-20 09:52:25 -04:00
Scott Schurr
4568c38597 Use std::thread in WebSocket (RIPD-236). 2015-10-20 09:52:25 -04:00
Mark Travis
e636669850 Fix display of default websocket test page. 2015-10-20 09:52:25 -04:00
Scott Schurr
7149765892 sign_for RPC command improvements (RIPD-1036):
o The sign_for RPC command automatically fills in an empty
   "SigningPubKey" field if the field is missing.

 o The sign_for command returns the Signers list inside the
   tx_json.  This re-establishes symmetry with the
   submit_multisigned command.  It also means the returned
   tx_blob might be useful, since it contains the multisignature.

 o The sign_for command also now allows the inclusion of a Signers
   array field in the input tx_json.  If a Signers array is present,
   the new signature is incorporated into the passed array.  This
   supports a model where multisignatures are accumulated serially.

 o Syntax hints are improved.
2015-10-20 09:52:25 -04:00
Scott Schurr
c28c516b22 sign_for RPC command fixes (RIPD-182):
o Remove warning written to log by sign_for command.

 o The sign_for RPC command previously only worked in the
   "json sign_for" form.  The command now works as a straight
   "sign_for".  The "offline" parameter also works.

 o Don't autofill Fee or Paths when signing offline.
2015-10-16 15:36:53 -07:00
Vinnie Falco
780a553662 Set version to 0.30.1-b3 2015-10-16 08:18:08 -07:00
wilsonianb
c755a7ff9b Remove rippled.spec rpm file 2015-10-16 08:18:03 -07:00
Vinnie Falco
8296d81edf Cache tid in STTx:
The digest for a transaction (its transaction ID, or tid) is
computed once upon constructed when the STTx is deserialized.
Subsequent calls to retrieve the digest use the cached value.

Any code which modifies the STTx and then attempts to
retrieve the digest will terminate the process with a
logic error contract violation.

* Nested types removed
* All STTx are contained as const
  (Except in transaction sign, which must modify)
* tid in STTx is computed once on deserialization
2015-10-16 08:18:03 -07:00
JoelKatz
0622e4fd44 Process batch during OpenLedger::modify 2015-10-15 18:14:32 -07:00
JoelKatz
3e8e2c2fee Fix incorrect capture in handleLCL 2015-10-15 18:10:08 -07:00
Scott Schurr
8296041f9e Convert Resource::Manager to use std::thread (RIPD-236) 2015-10-15 18:10:07 -07:00
Nik Bougalis
43a480f02d Set version to 0.30.1-b2 2015-10-13 17:33:35 -07:00
Edward Hennis
9154cbf8e1 Consolidate transaction signature checking.
* All checks flow through ripple::checkValidity, which transparently caches result flags.
* All external transaction submission code paths use checkValidity.
* SF_SIGGOOD flag no longer appears outside of HashRouter / checkValidity.
* Validity can be forced in known or trusted scenarios.
2015-10-13 17:33:16 -07:00
Edward Hennis
66b55f91ba Aggressive HashRouter cache expiration 2015-10-13 17:33:16 -07:00
David Schwartz
fe89c74e3b Tuning and cleanups for ledger fetching
* Track stats for ledger fetch and output
* Reduce entries queried on timeout
* Allow duplicate node requests on timeout
* Don't query deep on timeout
* Adjust latency tuning
* Change high latency cutoff
* Set absolute limit on reply entries
* Small optimizations
2015-10-13 17:15:46 -07:00
JoelKatz
61e5359231 Track peer traffic by category 2015-10-13 17:15:46 -07:00
Nik Bougalis
7373a26333 Use more C++11 features:
* Remove beast::static_initializer
* Remove noexcept VS2013 workaround
* Use [[noreturn]] attribute
2015-10-13 17:15:45 -07:00
JoelKatz
5ee94f8928 Fix some account_tx issues: (RIPD-1035)
* Sanely handled specified ledger in account_tx
* Reject un-validated ledger in account_tx
* Wait to publish a ledger until it's indexed
* Add unit test for PendingSaves
2015-10-13 17:15:45 -07:00
Nik Bougalis
d4c4a03e42 Remove beast::SharedData 2015-10-13 17:15:45 -07:00
Scott Schurr
caa4ed31de Convert LoadManager to use std::thread (RIPD-236) 2015-10-13 17:15:45 -07:00
Nik Bougalis
570bb2e139 Use more C++11 features:
* Remove beast::static_initializer
* Remove noexcept VS2013 workaround
* Use [[noreturn]] attribute
2015-10-13 17:15:45 -07:00
Nik Bougalis
b7c3b96516 Remove beast::SharedData 2015-10-13 17:15:45 -07:00
Nik Bougalis
0e7c8ce554 Use OpenSSL for digests 2015-10-13 17:15:44 -07:00
Vinnie Falco
97feec6b5e Set version to 0.30.1-b1 2015-10-06 17:01:26 -07:00
Edward Hennis
9b80081122 Add preclaim functionality to transactors:
The preclaim() function performs static validity
analysis of transactions using limited information
from a ledger.
2015-10-06 17:01:21 -07:00
Miguel Portilla
ad8e9a76ed Add BookDir container and iterator (RIPD-1027) 2015-10-06 16:03:39 -07:00
Miguel Portilla
20f186d855 Path find cleanup (RIPD-1023) 2015-10-06 16:03:39 -07:00
Miguel Portilla
3af0c38315 Remove BookRef and IssueRef (RIPD-1028) 2015-10-06 16:03:38 -07:00
Nik Bougalis
6db0ceaf81 Allow multiple connections from private IPs 2015-10-06 15:52:59 -07:00
Nik Bougalis
6f81d2e45d Warn if no outbound connections will be made 2015-10-06 15:52:59 -07:00
seelabs
442ad4e445 Suppress warnings & allow copy elision:
* Suppress warnings from rocksdb2
* Add `override` to rippled rocksdb functions
* Remove moves preventing copy elision
2015-10-06 13:08:48 -07:00
Vinnie Falco
9315d98aa9 Isolate Application object in Env:
This change causes each instance of Env to construct its own
isolated Application object for testing. Also included is
part of a framework to create multiple Application objects
in the same unit test and connect them together.
2015-10-06 13:08:47 -07:00
Scott Schurr
19903674af Improve syntax of submit_multisigned [RIPD-182]
In usage it was determined that the submit_multisigned RPC
command could be improved by moving the Signers array inside the
tx_json in the submitted form of the command.  This has the
advantage that the RPC command is more similar to the native form.
Also the returned JSON looks more like the submitted JSON.
2015-10-06 13:08:47 -07:00
Scott Schurr
434a63fa07 Improve tecNO_ALTERNATIVE_KEY error text (RIPD-182) 2015-10-06 13:08:47 -07:00
Scott Schurr
b44d68ea5d Trap another malformed transaction form (RIPD-182):
A transaction with both a Signers array and a TxnSignature field
is malformed.
2015-10-06 13:08:46 -07:00
Nik Bougalis
f424ae6942 Use standard C++ types instead of type aliases:
* Remove ripple::RippleMutex and ripple::RippleRecursiveMutex
  and use std::mutex and std::recursive_mutex respectively.
* Use std::lock_guard instead of std::unique_lock when the
  additional features of std::unique_lock are not needed.
2015-10-06 13:08:46 -07:00
JoelKatz
333ba69d60 Some trivial cleanups/fixes:
* Avoid throwing in OrderBookDB::processTxn
* Fix missing space in debug output
* Avoid duplicate lock of PathRequest in updateAll
* Avoid shadowing in insertPathRequest
* Improve indentation in runOnCoroutine
* Remove extraneous space in ServerHandlerImp::processRequest
2015-10-06 13:08:46 -07:00
David Schwartz
5b6cc3b036 Make sure LedgerHistory::builtLedger gets called 2015-10-06 13:08:45 -07:00
Vinnie Falco
8b8334af86 Set admin privileges on websocket:
When the websocket connection is established, any configured administrative
privileges are applied to resource limits.
2015-10-06 13:08:45 -07:00
Vinnie Falco
84c0ae1c6d OpenSSL: Visual Studio 2015 support 2015-10-06 13:08:45 -07:00
Miguel Portilla
caccee1d98 Set version to 0.30.0-rc1 2015-10-01 14:18:56 -04:00
seelabs
379110a8a2 Improve treatment of signature components 2015-09-30 21:44:02 -04:00
Miguel Portilla
8d37cd9169 Disable RPC coroutines 2015-09-30 19:05:00 -04:00
Nik Bougalis
b40ade5165 Set version to 0.30.0-b1 2015-09-28 17:30:42 -07:00
wilsonianb
c475b23c7d Fix and update rippled.spec for rpm builds 2015-09-28 17:24:05 -07:00
Miguel Portilla
d6b9cfcc34 Enable websocket coroutines 2015-09-28 17:24:05 -07:00
JoelKatz
0c05bd3def Improve transport security:
* Add fields for local and remote IP addresses in hello.
* Add configuration for known local public IP address
* Set fields appropriately
* Check the fields
* Disallow self connection by key
2015-09-28 17:24:05 -07:00
JoelKatz
206cd3b529 IPAddressV4 fixes:
* Loopback addresses are not publicly routable
* The Internet is not classful
2015-09-28 17:24:04 -07:00
JoelKatz
8f7ab21423 IPAddressV4 fixes:
* Loopback addresses are not publicly routable
* The Internet is not classful
2015-09-28 17:24:04 -07:00
JoelKatz
07418cfb34 Make transaction ordering much more difficult to predict
Randomize the initial transaction execution order for closed
ledgers based on the hash of the consensus set. Transaction
processing change will take effect October 27, 2015 at
11:00 AM Pacific time.
2015-09-28 17:24:04 -07:00
Vinnie Falco
ac9816c01d Release PeerFinder slot on error 2015-09-28 17:24:04 -07:00
Nik Bougalis
bd3e4ac11c Correctly parse the --rpc_port command line argument 2015-09-28 16:49:46 -07:00
Nik Bougalis
926d08db6f Adjust ledger switch time and disambiguate logging:
- The new activation date for 1e9624270d
  is now October 27, 2015 at 11:00 PDT
2015-09-28 16:49:35 -07:00
Nik Bougalis
a23f6457dc Initialize HTTP client after the config is loaded 2015-09-27 13:17:20 -07:00
Vinnie Falco
4f9dba22c7 Set version to 0.29.1-rc1 2015-09-25 16:21:44 -07:00
Vinnie Falco
97e1a7db25 Merge branch 'release' into develop 2015-09-25 16:21:16 -07:00
JoelKatz
e03effd63b Disable compatible ledger safety if quorum is strict 2015-09-25 14:18:18 -07:00
JoelKatz
f9a65e4966 Add '--valid" command line option to consider starting ledger valid 2015-09-25 14:18:06 -07:00
JoelKatz
3c52fdfabe Allow the "quorum" command line option to lock the quorum 2015-09-25 14:18:03 -07:00
Vinnie Falco
938b2fed7c Set version to 0.29.1-b14 2015-09-25 13:43:32 -07:00
JoelKatz
d6875975ab Fix OpenLedger::empty:
* Fix logic of OpenLedger::empty
* Add regression test
* Remove some dead code
2015-09-25 11:37:54 -07:00
seelabs
92b2ca70b7 Inject journals:
Calls to WriteLog are replaced with injected journals
2015-09-25 06:29:08 -07:00
Vinnie Falco
df6ac8f7f5 Use injected Logs 2015-09-25 06:29:07 -07:00
Nik Bougalis
fa796a2eb5 Inject Config:
* Use dependency injections instead
* Remove deprecated fee interfaces
2015-09-25 06:29:07 -07:00
Miguel Portilla
c7b3153958 Upgrade ripple-lib. Fix OS X warnings 2015-09-24 20:22:07 -04:00
Vinnie Falco
5bbb89753d Set version to 0.29.1-b13 2015-09-22 17:06:23 -07:00
Miguel Portilla
654084d181 Allow partialPayment with path_find 2015-09-22 17:05:51 -07:00
Nik Bougalis
094f08211a Set version to 0.29.1-b12 2015-09-21 10:55:57 -07:00
JoelKatz
74b0a7c633 Improve SHAMap missing node behavior:
* Prevent recursive invocation of missing node handler
* Do not throw from ledger constructor
2015-09-21 10:55:30 -07:00
JoelKatz
8f09d3449d Improve ledger replay logic
Build a replay structure holding the transactions
in execution order along with the close time. Use
this structure when replaying a ledger close.
2015-09-21 10:55:30 -07:00
JoelKatz
0c7a7903b6 Use the new OpenView/OpenLedger classes
The server's open ledger is now an instance of the OpenView
class, managed by an instance of the OpenLedger class. This
should improve the performance of operations on open ledgers
because they are no longer Ledger/SHAMap operation.
2015-09-21 10:55:30 -07:00
seelabs
6a8d24372e Fix Travis compile 2015-09-21 08:59:15 -07:00
Edward Hennis
884dc11365 Set version to 0.29.1-b11 2015-09-18 12:19:32 -04:00
Howard Hinnant
83830ef9c0 Install upper_bound in ReadView:
*  And use it in doLedgerData.
2015-09-18 12:18:41 -04:00
Tom Ritchford
849e1ce5f4 Bring some constants into RPC::Tuning.h. 2015-09-18 12:18:40 -04:00
Nicholas Dudfield
4eb6020813 Add npm test for ledger_data command. 2015-09-18 12:18:39 -04:00
Tom Ritchford
d655fdca56 Honor markers in ledger_data requests (RIPD-1010). 2015-09-18 12:18:39 -04:00
seelabs
b6df6748df Use gcc-5 in travis 2015-09-18 12:18:38 -04:00
seelabs
269809dd1a Transitional support gcc 5.2 2015-09-18 12:18:37 -04:00
Vinnie Falco
65fdf1dc5e Add order book stuffing tests:
* PlumpBook makes sure large order books remain sane
* OversizeMeta checks for tecOVERSIZE handling
* FindOversizeBook probes metadata offer limits
2015-09-18 11:51:49 -04:00
Vinnie Falco
60002bf9bc Improve Env::ter and ter() funclet 2015-09-18 11:51:48 -04:00
Vinnie Falco
dd94de2830 jtx: Allow disabling of sig checks 2015-09-18 11:51:47 -04:00
Howard Hinnant
37bf76692d Add override keyword on all derived functions:
This silences warnings on latest clang compiler.
2015-09-18 11:50:33 -04:00
Howard Hinnant
e1fc81f66f Add override keyword on all derived functions:
This silences warnings on latest clang compiler.
2015-09-18 11:50:33 -04:00
Tom Ritchford
b2cf1e4c65 Extract common function RPC::readLimitField. 2015-09-18 11:18:17 -04:00
Miguel Portilla
a65f692ab7 Disable RPC websocket coroutines 2015-09-18 11:16:12 -04:00
Howard Hinnant
44e4a50050 Fix stack bug in upper_bound 2015-09-18 11:14:34 -04:00
Vinnie Falco
ffbcb96eff Inject Application (cont.) 2015-09-18 11:09:40 -04:00
Scott Schurr
eed1a891a7 Remove TxnSignApiFacade (RIPD-945):
Replace TxnSignApiFacade with separate passed in arguments to
the various sign/submit RPC commands.

Also increase unit test coverage of the submit_multisign RPC
command.
2015-09-18 11:09:37 -04:00
Vinnie Falco
9b787434c9 Inject Application:
Calls to getApp are replaced with dependency injections.
2015-09-18 11:09:22 -04:00
Nicholas Dudfield
f4fe55caff Add coverage tracking via codecov.io
Conflicts:
	.travis.yml
2015-09-17 15:57:56 -04:00
Edward Hennis
8df88238cd Migrate Travis to container-based infrastructure
* http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade
2015-09-17 11:46:06 -04:00
Nik Bougalis
ea0bd08660 Set version to 0.29.1-b10 2015-09-13 14:28:46 -07:00
Tom Ritchford
c1f50ca7b3 Use lambdas everywhere in JobQueue.
Conflicts:
	src/ripple/app/ledger/impl/LedgerConsensusImp.cpp
2015-09-13 14:28:38 -07:00
Tom Ritchford
a6f866b4d8 Use std::function in JobQueue. 2015-09-13 14:28:38 -07:00
Tom Ritchford
545b2fd6b1 Better suspend for continuation 2015-09-13 14:28:38 -07:00
JoelKatz
b0a855a10e Upgrade SQLite from 3.8.8.2 to 3.8.11.1 2015-09-13 14:28:37 -07:00
seelabs
b5600e940a Minor VS2015 doc update 2015-09-13 14:28:37 -07:00
seelabs
7f5d273e53 Tidy SetHex* function calls & misc cleanups
* Renamed SetHexExact -> SetHexUnchecked
* Removed calls to SetHexUnchecked with empty strings
* Marked ledger class as final, as it calls virtuals in its ctor
2015-09-13 14:28:37 -07:00
Nik Bougalis
b0e6be93ff Add Rate class to support scaling of IOU and XRP amounts 2015-09-13 14:28:37 -07:00
Nik Bougalis
324c42ae09 Support to_string for IOUAmount and XRPAmount 2015-09-11 14:10:35 -07:00
Nik Bougalis
acd03faee5 Use XRPAmount for fees and ledger headers 2015-09-11 14:10:35 -07:00
Nik Bougalis
94af42da44 Support STAmount conversions to XRPAmount and IOUAmount 2015-09-11 14:10:35 -07:00
Nik Bougalis
1e9624270d Make ledger close times increase strictly monotonically 2015-09-11 12:50:26 -07:00
Nik Bougalis
a50d67257c Limit the total number of offers processed while crossing 2015-09-11 12:46:03 -07:00
JoelKatz
3759c553b0 Remove unfunded offers on tecOVERSIZE 2015-09-11 12:39:08 -07:00
JoelKatz
332114c02a Allow more deliver loops when multiquality 2015-09-11 12:33:19 -07:00
Nik Bougalis
5d841c13b7 Set version to 0.29.0-hf2 2015-09-09 15:19:59 -07:00
Nik Bougalis
caecf78a6d Limit the total number of offers processed while crossing 2015-09-09 15:18:58 -07:00
JoelKatz
408a62f7d0 Remove unfunded offers on tecOVERSIZE 2015-09-09 15:18:58 -07:00
JoelKatz
b822d061ef Allow more deliver loops when multiquality 2015-09-09 09:50:57 -07:00
Vinnie Falco
020a112e77 Set version to 0.29.1-b9 2015-09-08 19:20:54 -07:00
Vinnie Falco
8e33ae78f8 Create zero balance trust lines with auth flag (RIPD-1003):
This allows a TrustSet transaction to create a trust line
if the only thing being changed is setting the tfSetfAuth
flag.
2015-09-08 19:18:08 -07:00
wltsmrz
dbddc6b7f2 Update integration tests 2015-09-08 19:14:42 -07:00
Vinnie Falco
f32be2b28d Fix SusPay condition check in Finish:
On a SusPayFinish, a check is added to make sure that the
presented digest matches the digest in the SusPay ledger
entry. Another check is added to make Finish transactions
containing sfProof fields that are not 32 bytes malformed.

This includes regression unit tests.
2015-09-07 18:12:46 -07:00
Vinnie Falco
0f05ebd834 Set version to 0.29.1-b8 2015-09-07 14:05:27 -07:00
Edward Hennis
26fc812e21 Changes to support VS2015 2015-09-07 14:04:53 -07:00
Edward Hennis
14db51e3e4 Visual Studio 2015 support 2015-09-07 14:04:53 -07:00
Edward Hennis
8f3bb286f2 Changes to support VS2015 2015-09-07 14:04:53 -07:00
Nik Bougalis
258c93f8d8 Set version to 0.29.1-b7 2015-09-07 11:28:28 -07:00
JoelKatz
88f885f2e7 Limit changed node count 2015-09-07 11:27:15 -07:00
Nik Bougalis
91eee1a42d Limit the number of offers that can be consumed during crossing 2015-09-07 11:27:09 -07:00
Nik Bougalis
6a55f99ede Set version to 0.29.0-hf1 2015-09-07 09:17:06 -07:00
JoelKatz
0b457497d0 Limit changed node count 2015-09-07 09:16:30 -07:00
Nik Bougalis
b7c9e33343 Limit the number of offers that can be consumed during crossing 2015-09-07 09:00:25 -07:00
Scott Schurr
502d5689bf Set version to 0.29.1-b6 2015-09-03 16:53:12 -07:00
seelabs
d015debe2b Remove unused config param 2015-09-03 15:45:24 -07:00
Howard Hinnant
d8aab5a749 Optimize SHAMapItem construction 2015-09-03 14:18:43 -07:00
Vinnie Falco
7ed2094a6a Fix missing 'age' field from server_info 2015-09-03 14:11:46 -07:00
Miguel Portilla
464410d8be Differentiate path_find response (RIPD-1013) 2015-09-03 14:05:48 -07:00
Vinnie Falco
aa0e17dd93 Add consensus simulations 2015-09-03 13:44:37 -07:00
Vinnie Falco
4e345b1c8a Make suite::log_t public 2015-09-03 13:27:16 -07:00
Vinnie Falco
b2cb4df29a Make suite::log_t public 2015-09-03 13:27:16 -07:00
Miguel Portilla
3d777f3f5d Convert all of an asset (RIPD-655) 2015-09-03 13:10:50 -07:00
Vinnie Falco
1842878c40 Tidy up STPathElement constructor 2015-09-03 12:59:15 -07:00
Vinnie Falco
23f47adb60 Add jtx::path funclet 2015-09-03 12:52:02 -07:00
Nicholas Dudfield
377e3d479c Always show fields that contribute to the hash in ledger header json 2015-09-03 12:30:33 -07:00
Tom Ritchford
d5193a776e Replace calls to new(). (#243)
* Replace all unavoidable uses of `new` with `std::make_unique` or
  `std::make_shared`.

* Fix some 80-column issues.
2015-09-03 12:09:44 -07:00
Scott Schurr
ef51128270 Enable simple multisign with a Feature (RIPD-182):
Eventually multisign will need to be enabled onto the network, at
which point compiling it in or out will no longer be an option.
In preparation, the compile guards are removed and multisign is
being enabled with a Feature.

You can locally enable a Feature using your config file.  To
enable multisign with your config file add a section like this:

[features]
MultiSign

The exact spelling and capitalization of both "features" and
"MultiSign" is important.  If you don't get those right multisign
will not be enabled.

There is a minor issue.  The "sign_for" and "submit_multisigned"
RPC commands are only enabled if multisign is enabled.  However
those commands are still shown in the help message even if
multisign is disabled.  This is because the code that produces
the help message doesn't read the config file (where the Features
are kept).  This problem will become irrelevant once multisign is
enabled onto the network.
2015-09-03 11:43:25 -07:00
Scott Schurr
9b15c88b0e Make Rules available outside of Transactors (RIPD-182):
Allows multisign to be enabled with a Feature.
2015-09-03 11:36:23 -07:00
Scott Schurr
f1c29ae20b Allow an account to be exclusively multisigned (RIPD-182):
An account can be made signable with only its regular key by
disabling the master key.  Now an account can also be made
exclusively multisigned by both disabling the master key and
having no regular key.

In order to prevent an account from becoming unsignable the
network uses these rules:

 o An account can always add or replace a regular key or a
   SignerList as long as the fee and reserve can be met by the
   account.

 o The master key on an account can be disabled if either a
   regular key or a SignerList (or both) is present on the account.
   Either the regular key or the SignerList can be used to
   re-enable the master key later if that is desired.

 o The regular key on an account may only be removed if either the
   master key is enabled or the account has a SignerList (or both).

 o The SignerList on an account may only be removed if either the
   master key is enabled or a regular key is present (or both).

As a consequence of this change, the tecMASTER_DISABLED error
code is renamed to tecNO_ALTERNATIVE_KEY.  The error code number
(130 decimal) is unchanged.
2015-09-03 11:16:36 -07:00
Nik Bougalis
6d2e3da306 Set version to 0.29.1-b5 2015-08-18 11:16:25 -07:00
seelabs
7695ea2822 Remove obsolete test file 2015-08-18 11:16:18 -07:00
seelabs
c729ceab20 Add includes for boost in_place 2015-08-18 11:16:18 -07:00
seelabs
e8643dd8cc Fix calling incorrect require function in tests 2015-08-18 11:16:18 -07:00
Miguel Portilla
7b69592fe1 Pass by reference in succ 2015-08-18 11:16:18 -07:00
Howard Hinnant
12e11721f9 Eliminate redundant traversal logic of SHAMap:
*  Only the const_iterator interface remains.
2015-08-18 11:16:18 -07:00
Tom Ritchford
96c13f0d98 Restrict source files to 80 columns. 2015-08-18 11:16:18 -07:00
Edward Hennis
df728cd2cd Reference fee unit clean up
* Use config object or ledger instead of hard coded value.
* The value is still const, and has no change mechanism.
2015-08-18 11:16:18 -07:00
Edward Hennis
0d7cad8d64 Devirtualize HashRouter
* Include some simple renames
2015-08-18 11:16:17 -07:00
Nicholas Dudfield
d69285f6ad Use unabbreviated "SuspendedPayment" for LedgerEntryType 2015-08-18 11:16:17 -07:00
Scott Schurr
b8e192e058 Increased fees for multisigned transactions (RIPD-182):
Multisigned transactions place a higher load on the network than
non-multisigned transactions, requiring a higher fee.

- A non-multisigned transaction always has a minimum fee - the
  network base fee.

- A multisigned transaction has a minimum fee equal to the number
  of multisigners plus one times the network base fee.
2015-08-18 11:16:17 -07:00
Vinnie Falco
aeebfeab10 Remove unused unl module code 2015-08-18 11:16:17 -07:00
Vinnie Falco
8aafebbb75 Move tests to app/tests 2015-08-18 09:02:25 -07:00
Vinnie Falco
c3da2e1f03 Update to soci 3.2 2015-08-18 08:48:16 -07:00
Nik Bougalis
c8c8003677 Merge commit 'caab155a00ca0158dcb16844bea5326e2a2c2562' into dn 2015-08-18 08:47:41 -07:00
Nik Bougalis
caab155a00 Squashed 'src/soci/' changes from 6e9312c..b2855dc
b2855dc Merge pull request #378 from ravselj/sqlite_memory_leak
bf5dad9 Memory leak fix in sqlite3_session_backend.
165737c Fix incorrect pointer instead pointee comparison.
625db74 Merge pull request #376 from ravselj/cmake_debug_postfix2
f3a1055 Added proper support for SOCI_DEBUG_POSTFIX by changing backend-loader macro. If debug postfix is specified in CMake then it is passed forward to soci-core backend loader which then combines proper name based on build configuration.
3459d7d Minor CMake fix that checks if shared mode is set before adding shared test(s).
66d407a Merge pull request #373 from musopr/ambiguous_session
9070742 Merge pull request #372 from musopr/clang_cxx_c11
7b08ec7 Fixed ambiguous 'session' reference
e9748de Include SOCI_CXX_VERSION_FLAGS when compiling Clang
abd6775 Merge pull request #368 from ravselj/cmake_debug_postfix
cae0086 Added CMAKE_DEBUG_POSTFIX to SOCI_LIB_SUFFIX. This fixes backend loading when CMAKE_DEBUG_POSTFIX is used.
3dd4726 Enable MSVC multi process compiling by setting /MP flag.( VS2005+ )
e5f577f Merge pull request #365 from ravselj/sqlite_msvc_fixes
c4dde08 Some trivial fixes in code to resolve MSVC warnings in SQLite back-end
330f0e0 Merge pull request #364 from ravselj/connection_pars
b78c8ef Merge pull request #358 from ArnaudD-FR/bind_clean_up
9f415ee Merge pull request #362 from ArnaudD-FR/sqlite3_optim_split
f1f0162 sqlite3 backend optimizations
0b1a835 Include soci-platform.h because of snprintf
ac65d58 Merge pull request #361 from ArnaudD-FR/blob
24c8383 Bug fix - std::map with key type of const char* is replaced with std::string
3e02a54 Changes due to compiler warnings.
0c88f8c New data_type dt_blob and simple-interface support
403b8de Fix bind_clean_up when using 'row'
92ada95 Merge pull request #363 from ravselj/oracle_win_fix
d1ad52f Add a unit test for CHAR(N) fields padding behaviour.
274d08a Explicitly set character set in Firebird unit tests for CHAR(N).
7623f76 More and better MSVC warnings fixes.
caa2370 Removed dummy and not compilable operator<<(boost::optional).
c025cc8 Fix inserting strings longer than 8000 bytes with ODBC/MS SQL.
d8d765f Update documentations
b5d6507 - oracle cmake Windows fix - test oracle compilation error fix
a6b3514 Split Statement::clean_up into bind_clean_up and clean_up
ba453c7 Make SQL state in ODBC backend error messages more clear.
a374e54 Make ODBC backend error messages more homogeneous.
c4255c9 Delete old /docs folder.
0d3b6b9 Merge pull request #344 from OniDaito/markdown_doc
04f9461 Merge pull request #352 from ravselj/cmake_bug_shared
955a915 - CMake bug fix when building MSVC with SHARED option enabled
f7be373 Merge pull request #348 from msobczak/classic-makefiles
36f373f Added classic Makefile for PostgreSQL test.
615cb94 Updated classic Makefile for PostgreSQL backend.
821092c Don't use both -ansi and -std=gnu++98 flags with g++.
07543f5 Merge pull request #346 from msobczak/classic-makefiles
291fbe7 Merge pull request #347 from jsonn/master
a87776e Make it easier to override SOCI_LIBDIR.
96e66f5 Corrected handling of generated file with backend search path.
0b26c32 Updated classic Makefiles for Oracle Express 11.2.
15a3705 Removed all the crap debian packaging threw in
6db2a65 Merge pull request #343 from OniDaito/master
cf11404 Added Markdown docs
ffbfdc0 Inlined the pragmas for the C++11 tests
ae3ac9d Mistake with CXX11 pragma fixed in session.h
303a966 Merge pull request #341 from mloskot/issues/340
7d7516d Add more qualifications uses of session class with namespace soci::session.
caa3e2b Merge pull request #335 from mloskot/issues/258
1e89d43 Fully qualify uses of session class with namespace soci::session.
1ed81ca Restore setting session with query transformation
84d29e2 Merge branch 'pull/336'
949924a Cope with GNU <=4.6 warning about the #pragma
3494b2b Wrap stream operator for boost::optional<int> with HAVE_BOOST
af4b1a3 Report SOCI_CXX_C11 in CMake output
5744a16 Merge branch 'master' of https://github.com/OniDaito/soci into pull/336
0ab7b37 Remove old build .tcl scripts.
8f2195a Check Postgression availability before proceeding with build.
cd3af53 Remove #include "error.h" of non-existent header
48a8bfa Added the C++11 changes back in
1aee2d1 Add -Wl,-flat_namespace -Wl,-undefined -Wl,suppress to LINK_FLAGS on Apple/OSX
2bf3aa7 Disable test of set_query_transformation with C++ lambda
1d26033 CMake should not terminate on unknown toolset
d8b64cb Remove SociSystemInfo.cmake modul as redundant.
fc3391f List Boost.DateTime in core dependencies
f4ff281 Indicate Travis CI builds Oracle WITH_BOOST=OFF
4863376 Merge pull request #326 from mloskot/issues/224
0c18240 Restore Oracle build with tests on Travis CI.
bc4abd7 Throw instead of truncating VARCHAR columns in Firebird backend.
4c612af No changes, just small code simplification in Firebird backend.
ba206ed Extract common part of MySQL and ODBC MySQL tests in a header.
a0fd859 Remove asserts from the SOCI headers and code.
b36944c Check vector indices instead of asserting that they are valid.
75ef8d8 Handle dt_unsigned_long_long in the "simple" SOCI layer.
2e2f60b Remove asserts on unknown type from the "simple" SOCI layer.
e21aef7 Throw instead of asserting if connection_pool::lease() fails.
4b4cecb Replace left over asserts with CATCH CHECK in the tests code.
388a8d3 Use compile-time asserts to check SQLINTEGER size.
af80fd8 Use SQLT_BDOUBLE instead of SQLT_FLT in Oracle backend.
c74132b Fix warning about pointer-to-int conversion in Firebird backend.
4916551 Reorganize more unit tests to use CATCH sections.
787b428 Fix duplicate test name in Oracle unit tests.
7f65799 Avoid warnings about int-to-pointer conversions in DB2 backend.
7e80c68 Use parameter names from the query, if given, in error messages.
8b0c372 Don't clean up SQLite3 statement prematurely.
9119ed8 Rename db2_statement_backend::names field to names_.
f5c86b7 Make SOCI_NORETURN public and use it in declaration.
62c17b2 Add mktime_from_ymdhms() helper.
ee0b9e4 Fix a clash between CATCH test cases defined in different files.
60a33f4 Reorganize "Use and into" unit test to use CATCH sections.
db59a48 Merge pull request #314 from rpiotaix/release/3.2
82ea95f Don't add DB2_INCLUDE_DIR to global include directories.
4f570d7 Restore Travis CI builds for other databases
71edca9 Merge pull request #306 from mloskot/postgression
1e4b365 Add a Travis build using PostgreSQL server at Postgression.
6abb7e1 Typo
1ccff47 Replace raw & with &amp; entity.
56d3aa6  No real changes, just remove trailing whitespace.
ef6d90d Fix previous attempt to correct include of SQLite3 backend header
31a22a1 Include SQLite3 backend public headers using soci/ prefix.
e4376ed Merge branch 'master' into develop-3.2.3
111b50a Merge branch 'hotfix/3.2.3'
0ef4912 Add 3.2.3 release notes
8da98b2 Add new contributors
ee7e155 Bump version number in docs
30c02f3 Merge branch 'master' of git://github.com/Alex-Vol/soci into hotfix/3.2.3-PR263
5577606 Improve readability of ODBC error message Closes #229
8e14c5b Improve error message when an odbc error occurs
8a50af6 Merge branch 'hotfix/3.2.3' of https://github.com/SOCI/soci into hotfix/3.2.3
a948ab3 Remove unused HAVE_XXX defines
2c85be1 Fix missing strtoll on Cygwin and MinGW
d9c059e Clarify documenation and examples on bulk operations.
a08d750 [travis] Disable Oracle build
70e67aa Replace prefix underscore with suffix in private member names
c799e4f Append each member of tuple/fusion instead of adding tuple/fusion
645e7a2 Merge github.com:pacocamberos/soci into pacocamberos-branch-mysql-blob
e96bc2b Ignore CMakeLists.txt.user created by Qt Creator IDE
f694e30 Bump library version number to 3.2.3
5ecebe9 fixed link error for msvc 64 bit
3278579 Fix email notifications for Travis CI builds.
ad9075c Configure Travis CI to fail the build a.s.a.p.
7481868 Explicitly set extra_float_digits when using PostgreSQL in ODBC.
83bbbd4 update sqlite3 backend documentation
57530a1 Merge pull request #302 from vadz/rich-exceptions
5cda82a Avoid throwing from soci_error copy ctor and assignment operator.
8bb6610 Provide context of the error in soci_error when possible.
a8ba1cb Add use_type_base::dump_value() for richer diagnostics.
76b3089 Add soci_error::get_error_message() method.
e8e5978 No real changes, just remove trailing whitespace.
a90018b Merge catch-tests branch.
7b8b37b Use REQUIRE() and not CHECK() for a test that can't be allowed to fail.
c9dbe19 Move all tests from tests/assert to tests directory itself.
246f657 Convert the tests to use CATCH testing framework.
b2060fb Add single header version of CATCH testing framework.
b87407e Add values::get_number_of_columns() accessor.
9628081 Define SOCI_NORETURN: a portable __attribute__((noreturn)) equivalent.
6ebcbcd Remove the never used details::statement_impl::namedUses_.
0f1f295 Add helper exchange_type_cast<>() template function.
02207fc Rename "version" class in the ODBC test to "odbc_version".
42549d0 Merge pull request #297 from nbougalis/unshadow
7d5eb2d Use a base-class member instead of shadowing it.
37fbe8f Don't always disable ODBC MS SQL test under Unix, just when using Travis.
ed37399 Fix ODBC backend get_affected_rows() when using FreeTDS driver.
f212ca9 Skip test which fails when using ODBC with MS SQL Server.
629386f Merge pull request #294 from denisarnaud/develop
294becb Fix for the issue #169: cleaner way to include headers.
120b88c Accept oraocci12 as a possible Oracle library name too.
8e1ddcd Merge pull request #213 from ayllon/develop
6552eb1 No real changes, just simplify Firebird backend code a little.
34be702 Test exact round trip for NUMERIC values for all backends.
24c0539 Fix rounding error in Firebird NUMERIC/DECIMAL conversions.
69352bc Speculatively enable exact floating point comparisons for all backends.
f497fb8 Disable exact floating point when using PostgreSQL ODBC driver.
6f9dd54 No changes, just fix a repetitive typo in "assert" in comments.
02f0a69 No changes, just remove annoying "EXECEPTION" typo.
4bf2d3c Explicitly disable exact floating point comparison in MySQL test.
1f3dd92 Replace accidental assignment with a comparison in Firebird unit test.
c3cd309 Make text-to-double conversion exact in PostgreSQL backend.
ff9146a Explicitly disable exact floating point comparison in SQLite test.
7039d00 Compare floating point values exactly in tests whenever possible.
53cd24e Don't start implicit transaction too eagerly in Firebird backend.
66f0d82 Add possibility to build Firebird using embedded library.
1489811 Update version to 4.0.0 in cmake too.
5838cc6 Reenable building, if not testing, Oracle backend.
dc4fb73 Move ORACLE_HOME to Oracle-specific script.
f9167a1 Avoid many warnings about floating point values comparison.
c85744b Define GCC_WARNING_SUPPRESS and GCC_WARNING_RESTORE macros.
ef7e9a9 Avoid warning about set but unused variable in Oracle backend.
86a4598 Avoid g++ warnings about casting away const with C-style casts.
2c887b3 Ignore CMake-generated files.
f61d7f5 Add missing include for std::max
21824a1 fixed deadlock in soci::connection_pool::try_lease
6e6bd46 Documentation for SQLite3 result code support.
97cbb0a Update PostgreSQL backend documentation for UUID type support.
5448cf1 Spelling fix in an error message: s/Commiting/Committing/.
5b073e3 Remove the unnecessary "error.h" inclusion from PostgreSQL code.
5776dd4 Introduced sqlite3_soci_error exception as subclass of soci_error. This new exception exposes the SQLite3 result code returned when any failure happens. Using this method is preferable to scrubbing string error messages in soci_error exceptions. Useful when there needs to be a distinction between general errors and database constraint errors. Unit test added to prove the funtionality does what is expected.
6d766e7 Introduced support for UUID column type in PostgreSQL statement.cpp. Unit test added for UUID column support testing all supported kinds of UUID formatted strings on input and standardized UUID formatted strings on output.
e106dc0 Optionally use the environment locale in the tests.
1b65061 Make sqlite3 and mysql backends work with any locale too.
8548642 Use locale-independent function for converting doubles to strings.
1260d4f Reimplement cstring_to_double() without using C++ standard library.
bc884fe Remove unused HAVE_XXX defines
4ffb21b Fix missing strtoll on Cygwin and MinGW
7bd4991 Clarify documenation and examples on bulk operations.
4d0785e Temporarily disable using Oracle backend on Travis.
da7e42c Merge pull request #242 from vadz/pgsql8-bytea
070b278 Merge branch 'fix_odbc_msvc_x86_64' of github.com:snikulov/soci into snikulov-fix_odbc_msvc_x86_64
fce8560 [travis] Disable Oracle build
0ff0e01 Replace prefix underscore with suffix in private member names
65a5ee3 Append each member of tuple/fusion instead of adding tuple/fusion
8e9fb42 Merge github.com:pacocamberos/soci into pacocamberos-branch-mysql-blob
3dca4e3 Ignore CMakeLists.txt.user created by Qt Creator IDE
de7e6f0 Bump library version number to 3.2.3
946dd5a Fix PostgreSQL unit test to pass with PostgreSQL < 9.0.
0a47eaf vs2013 got strtoll/strtoull
58d31f9 Update version to 4.0.0.
89df841 Merge pull request #239 from vadz/soci-headers-prefix
417ef5c Include all public headers using "soci/" prefix inside SOCI itself.
5a99a15 Merge pull request #238 from vadz/cstrtod
0585bb1 Merge pull request #237 from vadz/odbc-header-fix
6f4162c Add helper cstring_to_double() and use it in PostgreSQL backend.
73119cb Fix compilation of ODBC-specific SOCI header with new include paths.
d877390 Delete obsolete src/<backend>/test directories
06a970f Revert CMake setup for ODBC DB2 test
f04147a Move ODBC test DSN files to new tests location
0219c43 Fix paths to ODBC test DSN files
928174c Fix Firebird includes of private headers
bc171b6 Fix copy-n-paste error in CMake macro parameter name
1f4d6ef Fix includes to point to backend headers in subdirectories
552e81c Enable other tests in tests/assert
7a018a3 Move tests/assert into separate subdirectories
e2ec7ff Ignore Qt Creator and Eclipse files
5d527ec Fix windows.h case for cross-compilation
024ccc8 Firebird: fix harmless warning in 64 bit builds.
802f78e Merge pull request #216 from dgrambow/develop
32c5f88 Add get_last_insert_id tests for sqlite3 and mysql backends
ccd4c0d Add get_last_insert_id for sqlite3 and mysql backends Update docs/beyond.html accordingly
42aec23 Fix in soci::oracle to allow spaces in the params
b2ea9f7 fixed link error for msvc 64 bit
ef69fa9 [travis] Disable building tests due to #199
09acb8c [travis] Fix bash script syntax error
cba671f [travis] Disable ctest run due to #199
d8f7d9d [travis] Restore soci-devel notifications
22257b3 [cmake] Remove unused log message
0cffb8a CMake 2.8.7 have problems with per target includes
b430cb0 Attempt to correct -I paths for backend test
6c0721d Attempt to correct -I paths for backend folders
69d70c5 [travis] Disable tempoarily soci-devel notifications
f4802f1 [travis] Log build script name
8890aea [travis] Set CMAKE_VERBOSE_MAKEFILE=ON
717c38a [travis] Remove superfluos ] from make invocation
843a43c Fix travis-ci to run CMake from root directory
9e43795 Update copyright year
da025df Merge branch 'feature/125-new-layout' into develop
04a34f2 Link presentation from London C++ Meeting
11ef1fa Fix doc/index.html menu links
5393ee5 Merge branch 'hotfix/3.2.2' into develop
b6d97ff Implement new source tree layout #125

git-subtree-dir: src/soci
git-subtree-split: b2855dce54340522f149221c6ebe2d14fd1129ba
2015-08-18 08:43:51 -07:00
Nik Bougalis
1b85b6eaba Set version to 0.29.1-b4 2015-08-04 14:55:43 -07:00
JoelKatz
863add6a19 Remove spurious format string from log 2015-08-04 14:55:30 -07:00
JoelKatz
64b80e0573 Fix ledger loading on startup 2015-08-04 14:55:30 -07:00
Nik Bougalis
ed902d9dea Set feature activation date to Aug 17 2015-08-04 14:55:30 -07:00
Nik Bougalis
f38b373cb6 Exit if OpenSSL doesn't have secp256k1 support (RIPD-900) 2015-08-04 14:40:16 -07:00
Nik Bougalis
b8f2fdb6ac Remove obsolete DHUtil 2015-08-04 14:40:16 -07:00
Nik Bougalis
182f570f24 Reduce Transactor virtual interface 2015-08-04 14:40:16 -07:00
Nik Bougalis
5b90ccf65d Validate fee during preflight 2015-08-04 14:40:16 -07:00
Edward Hennis
22a8e25538 Fix display discrepancy in fee. 2015-08-04 14:40:16 -07:00
Edward Hennis
d63aab6312 Test display discrepancy in fee. 2015-08-04 14:40:16 -07:00
Tom Ritchford
641ab8ddaf Replace tabs with spaces. 2015-08-04 13:51:02 -07:00
seelabs
774dcad392 Remove common_ledger 2015-08-04 13:51:02 -07:00
Tom Ritchford
7b7b27ee9e Replace tabs with spaces. 2015-08-04 13:51:02 -07:00
Vinnie Falco
c5adbc859a Fix OpenView::sles 2015-08-04 13:51:02 -07:00
Vinnie Falco
2cc12b2f2f Add Env::meta() 2015-08-04 13:51:02 -07:00
Vinnie Falco
13b33b5d4d Store STTx in JTx
Conflicts:
	src/ripple/test/jtx/impl/Env.cpp
2015-08-04 13:51:02 -07:00
Howard Hinnant
c7dea3ed17 Improve LoadFeeTrack::scaleFeeLoad:
* Move lock protection to where it is needed.
* Use gcd to reduce problem to lowest terms.
* Use improved overflow avoidance to retain
  as much precision as possible.
* Detect overflow if it can be shown that the
  final result will not fit in a uint64_t.
2015-08-04 13:51:01 -07:00
Edward Hennis
a7e6ecb5b3 Devirtualize LoadFeeTrack 2015-08-04 13:51:01 -07:00
Nik Bougalis
5964710f73 Set version to 0.29.0 2015-08-04 13:22:45 -07:00
Nik Bougalis
262a61564c Set feature activation date to Aug 17 2015-08-04 13:22:17 -07:00
Edward Hennis
4cc4421c82 Fix display discrepancy in fee. 2015-08-04 11:22:38 -07:00
JoelKatz
2786950c16 Fix ledger loading on startup 2015-08-04 11:05:02 -07:00
Nik Bougalis
e45c1b238f Set version to 0.29.1-b3 2015-07-31 17:42:16 -07:00
Tom Ritchford
d166e6a45e Add more documentation to Builds/Test.py. 2015-07-31 17:41:27 -07:00
Vinnie Falco
e759137f15 Thread SusPay to all affected accounts 2015-07-31 17:41:05 -07:00
JoelKatz
0bb570a36d Be paranoid about ledger compatibility:
* Consider ledgers incompatible based on last valid ledger
* Test against even ledgers not acquired yet
* Don't validate an incompatible ledger
* Don't switch to an incompatible ledger
* Protect against an unreasonably small quorum
2015-07-31 17:40:39 -07:00
JoelKatz
38c6083a2f Reduce some logging severity 2015-07-31 17:39:39 -07:00
JoelKatz
cfdf0d2f0a Remove a ledger from the set of present ledgers where needed
* If we encounter it in RPC
* If we fully-validate a ledger that doesn't have it in its history
2015-07-31 17:39:35 -07:00
JoelKatz
f0dc2bc425 Confirm valid suspend before relying on suspension 2015-07-31 17:39:14 -07:00
Tom Ritchford
b783e353c4 Remove trailing spaces. 2015-07-31 17:39:03 -07:00
Tom Ritchford
32ec3fe089 Remove trailing spaces. 2015-07-31 17:39:03 -07:00
Scott Schurr
9e69bd5c56 Simple multisigning (RIPD-182):
With this changeset two-level multisigning is removed from the
codebase and replaced with single-level multisigning.

Additionally, SignerLists in the ledger are prepared for the
possibility of multiple SignerLists per account.  This was done
by adding a defaulted 32-bit SignerListID to each SignerList.
The SignerListIndex calculation incorporates the SignerListID.

There are three known missing elements:

 1. Multisigned transactions should require higher fees than
    regular (single-signed) transaction.  That's not yet
    implemented.

 2. It should be possible to disable the master key on an account
    if that account is multisign enabled (has a signer list).
    That's not yet implemented.

 3. Documentation about multisigning needs to be improved.

Multisigning is still compiled out of the code base.  To enable
multisigning for a stand-alone rippled, change the
RIPPLE_ENABLE_MULTI_SIGN macro (in BeastConfig.h) to "1" and
rebuild.

This commit also addresses:
 o RIPD-912: Remove multisign APIs from STObject, and
 o RIPD-944: Replace common_transactor with jtx at call sites.
2015-07-31 17:31:18 -07:00
Vinnie Falco
ceeb36039e New peer to peer network simulators 2015-07-31 17:31:01 -07:00
Vinnie Falco
2bfae2f0ac Tidy up UNL module:
* Renamed module to unl
* Renamed classes and members
* Removed cyclic dependency in Horizon
2015-07-31 17:30:56 -07:00
Vinnie Falco
b25f322c93 Set version to 0.29.0-rc6 2015-07-29 18:43:02 -07:00
JoelKatz
f77ecba896 Confirm valid suspend before relying on suspension 2015-07-29 18:42:14 -07:00
Nik Bougalis
5d2d88209f Set version to 0.29.1-b2 2015-07-29 12:50:58 -04:00
Nik Bougalis
ecf1a3c69c Initialize close offset 2015-07-29 12:50:41 -04:00
Vinnie Falco
3f0eacf5e7 Add SuspendedPayment feature (RIPD-992):
The code is enabled in jtx::Env, and enabled in production
ledgers only if the SuspendedPayment amendment is voted
into a ledger.
2015-07-29 11:56:10 -04:00
Vinnie Falco
d49f9ea109 Add [features] section to .cfg:
This non-production config section allows features to be enabled
by listing their text descriptions, one line each, in the config
section titled "features".

NOTE: Feature names with leading or trailing whitespace, or
      containing an equals sign ('=') are not supported.
2015-07-29 11:56:08 -04:00
Vinnie Falco
2ec40cb6f1 Add operator[] field accessors to STObject:
New array index operators allow for concise reading and
writing of fields in the STObject, with associated unit test.
2015-07-29 11:56:07 -04:00
Vinnie Falco
3e342e4b71 Add st.h module header 2015-07-29 11:56:05 -04:00
Vinnie Falco
147fee0272 Add describeOwnerDir 2015-07-29 11:56:04 -04:00
Vinnie Falco
fa900de548 Fix applyFlags when testing is disabled 2015-07-29 11:56:02 -04:00
Vinnie Falco
1883b40083 Add except, unexcept in suite 2015-07-29 11:56:01 -04:00
Vinnie Falco
8cd44c637d Add except, unexcept in suite 2015-07-29 11:56:01 -04:00
Vinnie Falco
729caaacff Add THROW contract call 2015-07-29 11:56:00 -04:00
Edward Hennis
2f5d721ec1 Track STTx validity with HashRouter. (RIPD-977) 2015-07-29 11:55:58 -04:00
Edward Hennis
c15394c42a Add preflight functionality to transactors:
The preflight() function performs static validity
analysis of transactions without requiring a ledger.

* Use tx in ApplyContext
* Remove unused journal
* Document apply()
* Add preflight(), which takes an OpenView, uses its rules.
* Change `TER preCheck` to `void preCompute` since it can no longer fail.
2015-07-29 11:55:57 -04:00
JoelKatz
36a62f110c Switch some Ledger instances to ReadView instances
* Remove ltCURRENT
* Change getOwnerInfo
* Use ReadView in TransactionSign
* Change AcceptedLedger and ProposedTransaction to use ReadView
* Change RPC::accounts
2015-07-29 11:46:01 -04:00
Nik Bougalis
2d02b46253 Fix parsing in ledger_request 2015-07-28 20:27:00 -07:00
Miguel Portilla
6cf75f0fc2 Add uptime to crawl data (RIPD-997) 2015-07-28 20:26:51 -07:00
Nik Bougalis
1a3e2e3f36 Set features activation to Aug 10 2015-07-28 20:26:41 -07:00
Tom Ritchford
645e32b19e Fix coroutine suspend 2015-07-28 20:26:30 -07:00
Tom Ritchford
fa0a61b5d7 Revert "Always use co-routines:"
This reverts commit 3d6e76046c.
2015-07-28 20:26:19 -07:00
Nik Bougalis
2336fe2708 Set version to 0.29.0-rc5 2015-07-28 20:14:10 -07:00
Nik Bougalis
0cbd81146f Fix parsing in ledger_request 2015-07-28 20:07:53 -07:00
Miguel Portilla
a268c1a7ad Add uptime to crawl data (RIPD-997) 2015-07-28 20:07:53 -07:00
Nik Bougalis
3b7107b255 Set features activation to Aug 10 2015-07-28 20:07:53 -07:00
Tom Ritchford
a2ea89c64e Fix coroutine suspend 2015-07-28 20:07:19 -07:00
Tom Ritchford
b44cb1a64c Revert "Always use co-routines:"
This reverts commit 3d6e76046c.
2015-07-28 19:27:27 -07:00
Vinnie Falco
1dc3acb071 Set version to 0.29.1-b1 2015-07-23 14:23:23 -07:00
Vinnie Falco
0cf58cc505 Add Rules to ReadView:
An instance of Rules provides information on the tx
processing rules in a particular ledger.

* OpenView allows rules to be set on construction.

Conflicts:
	src/ripple/unity/ledger.cpp
2015-07-23 14:23:13 -07:00
Vinnie Falco
eb49e1bf47 Convert OrderBookDB to ReadView 2015-07-23 14:23:13 -07:00
Vinnie Falco
0627d3487b Add OpenLedger::empty 2015-07-23 14:23:13 -07:00
Vinnie Falco
5063839ce5 Remove deprecated abstract_clock::elapsed 2015-07-23 14:23:12 -07:00
Vinnie Falco
84161b86c7 Add ReadView::sles 2015-07-23 14:23:12 -07:00
Vinnie Falco
110bbf3956 Add CachedLedger:
This type alias provide cache-wrapping for Ledger objects.
Through the CachedLedger interface, access to the underlying
Ledger is permitted to allow for cases where the implementation
must perform Ledger specific activities. For example, building
a fetch pack from the contained SHAMap objects.

The CachingReadView is refactored:

* Renamed to CachedView
* Templated on Base, the base type
* base() returns a shared_ptr to the wrapped object
* Constructor requires a shared_ptr<Base>
2015-07-23 14:23:12 -07:00
Vinnie Falco
fad9998f9d Remove deprecated abstract_clock::elapsed 2015-07-23 14:23:12 -07:00
Vinnie Falco
b38a96ae82 Add TimeKeeper:
This class tracks Ripple network time and closing time.

Conflicts:
	src/ripple/ledger/ReadView.h
2015-07-23 14:23:11 -07:00
Vinnie Falco
e82d774d32 Move SNTPClient to core:
* Refactor SNTPClient
* asio best practices
* Not derived from Stoppable
2015-07-23 14:23:11 -07:00
Miguel Portilla
8d1b169f5a Skip List unit test (RIPD-926) 2015-07-23 14:23:11 -07:00
Miguel Portilla
70ccdabf7c Squelch logs in Env (RIPD-982) 2015-07-23 14:23:10 -07:00
Nik Bougalis
af36942e1f Tidy up offer crossing:
* Clarify use of cancel view in OfferCreate transactor
* Reduce OfferStream public interface
* Reduce severity of some developer-only logging from ERROR to DEBUG
2015-07-23 14:23:10 -07:00
Nik Bougalis
b1b98fa3b0 Tidy up JLOG 2015-07-23 14:23:08 -07:00
Tom Ritchford
bb251063fc Remove deprecated 'accepted' parameter. 2015-07-23 12:34:08 -07:00
Tom Ritchford
663742e0d1 Fix compilation warnings in secp256k1. 2015-07-23 12:34:07 -07:00
Nik Bougalis
16c89aee04 Set version to 0.29.0-rc4 2015-07-23 12:32:43 -07:00
Nik Bougalis
abe735102a Fix metadata during apply:
Metadata is correctly generated for the case where a ledger entry is only changed as
a consequence of threading. This changes the result compared to previous versions,
which produced more than necessary for these cases.
2015-07-23 12:29:35 -07:00
David Schwartz
70a37811bd Set the fees in Ledger::setImmutable 2015-07-21 11:40:41 -07:00
Nik Bougalis
edab96e973 Set version to 0.29.0-rc3 2015-07-20 15:41:25 -07:00
Nik Bougalis
e7a50e2a5a Fix apply table metadata updates 2015-07-20 15:40:46 -07:00
Vinnie Falco
e18ba24670 Set version to 0.29.0-rc2 2015-07-17 13:31:08 -07:00
Vinnie Falco
f41fc87a33 Put OfferCreate bug fix on a ledger switch:
The fix for an off-by one bug that overstates the account reserve
during OfferCreate is set to become active on August 3rd. Before
this date, the program will exhibit the old behavior.
2015-07-17 13:25:03 -07:00
Vinnie Falco
5ec3534fea Set version to 0.29.0-rc1 2015-07-15 16:56:48 -07:00
Vinnie Falco
6bd39a316e Tidy up amendment feature macro 2015-07-15 16:56:45 -07:00
Yana
8434203e71 Add copyright notice 2015-07-15 16:56:44 -07:00
Nik Bougalis
59431c513a Add IOUAmount and XRPAmount (RIPD-976):
These numeric types replace the monolithic functionality
found in STAmount. They are not used yet.
2015-07-15 16:56:44 -07:00
Miguel Portilla
edc1bc35fd Add path find response field full_reply (RIPD-894) 2015-07-15 16:56:44 -07:00
Miguel Portilla
18ccdf8bd4 Add Directory container and iterator (RIPD-968) 2015-07-15 16:56:43 -07:00
seelabs
a0dcc4da8c Enable rm funded offer fix after a switch over date 2015-07-15 16:56:43 -07:00
seelabs
2b91e62d5d Fix funded offer removal during payment (RIPD-113):
In some cases, funded offers were incorrectly removed. This happened
when:

1) There are multiple payment paths.
2) A payment path has several offers in a row.
3) An offer causes a previous offer to become unfunded when calculating
   reverse liquidity and that offer does not satisfy the payment and
   there is another offer at the same quality.
4) The payment path is not used to satisfy the payment (there are other
   paths at better quality that do the job).
2015-07-15 16:56:43 -07:00
Vinnie Falco
bc5a25168a Update chrono types
Conflicts:
	src/ripple/test/jtx/impl/Env.cpp
2015-07-15 16:56:43 -07:00
Vinnie Falco
f453c58389 Fix manifest message handler 2015-07-15 16:56:42 -07:00
Vinnie Falco
ad74606ab3 Fix fees in Ledger construction
Conflicts:
	src/ripple/app/ledger/Ledger.cpp
	src/ripple/app/ledger/Ledger.h
	src/ripple/app/main/Application.cpp
	src/ripple/ledger/impl/View.cpp
	src/ripple/ledger/tests/View_test.cpp
	src/ripple/test/jtx/impl/Env.cpp
2015-07-15 16:56:42 -07:00
Vinnie Falco
bb15295935 Refactor computation of Ledger hash 2015-07-15 16:56:42 -07:00
Vinnie Falco
f0c1fbb098 Use LedgerInfo hash in applyHeldTransactions 2015-07-15 16:56:41 -07:00
Vinnie Falco
692f224e1c Tidy up genesis Ledger construction 2015-07-15 16:56:41 -07:00
Vinnie Falco
5bd9cd2ee8 Tidy up and move sources 2015-07-15 16:56:41 -07:00
Tom Ritchford
70fc091e74 Split up RPC handlers for classic build. 2015-07-15 16:56:40 -07:00
Tom Ritchford
1d09c54fdc Replace Ledger with ReadView in most RPC handlers. 2015-07-15 16:56:40 -07:00
Tom Ritchford
c7ebe7205c Move fields from Ledger to LedgerInfo. 2015-07-15 16:56:39 -07:00
Tom Ritchford
1b6c707abb Extract LedgerToJson.cpp from LedgerToJson.h. 2015-07-15 16:56:39 -07:00
Tom Ritchford
a0010effbc Simplify lookupLedger to use an RPC::Context. 2015-07-15 16:56:39 -07:00
Tom Ritchford
c094772bc0 Restrict Ledger.cpp to 80 columns. 2015-07-15 16:56:38 -07:00
Vinnie Falco
7ce871f3b2 Merge branch 'release' into develop
Conflicts:
	Builds/rpm/rippled.spec
	src/ripple/protocol/impl/BuildInfo.cpp
2015-07-15 16:56:10 -07:00
Nik Bougalis
77b3ad5de1 Set version to 0.29.0-b12 2015-07-13 16:38:40 -07:00
Tom Ritchford
a75a0c0b84 Mention rippled in the websocket test page. 2015-07-13 16:38:40 -07:00
Tom Ritchford
072fc53019 Rename duplicate .cpp files. 2015-07-13 16:38:39 -07:00
wilsonianb
5bad2db667 Add validations subscriptions (RIPD-504) 2015-07-13 16:38:39 -07:00
Miguel Portilla
7c2478480d DeliverMin enable switch and precheck greater than dest amount 2015-07-13 16:38:39 -07:00
Nik Bougalis
761f218c0a Refactor NetworkOPs:
* Reduce public API
* Use LedgerMaster interface from RPC
* Remove fetch pack management to LedgerMaster
2015-07-13 16:38:39 -07:00
Vinnie Falco
163e8eb8fc Use SecretKey, PublicKey 2015-07-13 16:37:04 -07:00
Vinnie Falco
6fccd07479 Add new cryptographic token types:
This replaces the equivalent functionality in RippleAddress.

* New PublicKey, SecretKey, Seed, Generator
* Removed AnyPublicKey, AnySecretKey
2015-07-13 16:37:04 -07:00
Vinnie Falco
c86a40a361 Tidy up digest functions:
* Add sha512_half_hasher
* Move sha512Half functions to digest.h
* Add explicit OpenSSL equivalents
2015-07-13 15:25:20 -07:00
Vinnie Falco
362726de4a Slice improvements:
* Rename to makeSlice
* Well defined default construction
* Add `empty`
* Add operator[]
* Buffer arithmetic
2015-07-13 15:25:20 -07:00
Vinnie Falco
5962a4817a Add secp256k1 module 2015-07-12 12:03:27 -07:00
Vinnie Falco
2e05471d72 Fix compilation with C++ 2015-07-12 12:03:27 -07:00
Vinnie Falco
d998c6461e Merge commit '94f13fb6061ead96fd5bc6ecd6ee5d9c5565a966' as 'src/secp256k1' 2015-07-12 12:03:20 -07:00
Vinnie Falco
94f13fb606 Squashed 'src/secp256k1/' content from commit 0cbc860
git-subtree-dir: src/secp256k1
git-subtree-split: 0cbc8600f3147c97ff0b404abebf5db19025b20b
2015-07-12 12:03:20 -07:00
Vinnie Falco
7edf783102 Set version to 0.29.0-b11 2015-07-12 11:51:27 -07:00
JoelKatz
efc2159441 Implement new amendment majority semantics :
This implements the tracking of when an amendment achieved a majority
in the ledger, ensuring that there's always network-wide agreement
on which amendments have achieved a majority and how long they've
held it.

* New fields
* Change transactor changes
* AmendmentTable API and implementation changes
* Update amendment enabled status on validated ledgers
* Reinstate support for ledger sequence in fee transactions
2015-07-12 11:51:27 -07:00
David Schwartz
3078c6da12 Check if synchronized in ripple_path_find
If a call to ripple_path_find does not specify a ledger,
the call should fail if the server is not synchronized
to the network.
2015-07-12 11:51:27 -07:00
Miguel Portilla
de6f678de7 Pass by reference in processTransaction 2015-07-12 11:51:26 -07:00
Nicholas Dudfield
d8d51e8103 Add quality to account_offers 2015-07-12 11:51:26 -07:00
Howard Hinnant
361f1da5b8 Optimize and clean up SHAMap::iterator:
* Remove dependence on boost::iterator_facade.
* Rename iterator to const_iterator.
* Change value_type from shared_ptr<SHAMapItem const> to SHAMapItem.
* Install a stack-path to the current SHAMapItem in the const_iterator.
2015-07-12 11:51:26 -07:00
Vinnie Falco
30e068ae17 Tidy up compilation units 2015-07-12 11:50:34 -07:00
Mark Travis
3b751cc6e6 Set version to 0.28.2-hf1 2015-07-09 22:57:16 +00:00
Miguel Portilla
6d60f19d73 Change NetOps processTransaction to use ref param 2015-07-09 22:56:03 +00:00
Vinnie Falco
94235d4b4f Set version to 0.29.0-b10 2015-07-09 14:21:49 -07:00
Vinnie Falco
367c3a5bfc Refactor View classes:
The View hierarchy of classes is reorganized to include new
classes with member functions moved and renamed, to solve
defects in the original design:

OpenView accumulates raw state and tx changes and
can be applied to the base. ApplyView accumulates changes
for a single transaction, including metadata, and can be
applied to an OpenView. The Sandbox allows changes with
the option to apply or throw them out. The PaymentSandbox
provides a sandbox with account credit deferral.

Call sites are changed to use the class appropriate for
the task.
2015-07-09 13:25:18 -07:00
Vinnie Falco
f3b172b0c9 Use OpenLedger in Env 2015-07-09 13:25:18 -07:00
Vinnie Falco
023715474c Add OpenLedger:
The OpenLedger class encapsulates the functionality of
maintaining the open ledger. It uses an OpenView with the
last closed ledger as its base. Routines are provided to
modify the open ledger to add new transactions, and to
accept a new last closed ledger. Business logic for
performing transaction retries is rewritten to fit this
framework and used in the implementation of accept.

When the RIPPLE_OPEN_LEDGER macro is set to 1 (BeastConfig.h),
the global Application OpenLedger singleton maintains
its open ledger in parallel by applying new transactions
and accepting new last closed ledgers. In the current
implementation this does not affect transaction processing
but logs any differences in the results as compared to
the original code.

Logging shows an occasional mismatch in what the OpenLedger
builds versus the original code, usually an OfferCreate
which gets a terINSUF_RESERVE instead of tesSUCCESS.
2015-07-09 13:20:28 -07:00
Vinnie Falco
f5873bcad0 Add unfunded account Env test 2015-07-07 12:55:56 -07:00
Vinnie Falco
9f27801b8d Log metadata differences on built ledger mismatch 2015-07-07 12:55:56 -07:00
Vinnie Falco
9eb0c2964c Pass a reference in SHAMap::compare 2015-07-07 12:22:50 -07:00
Vinnie Falco
73d64bbafc Set version to 0.29.0-b9 2015-07-07 10:14:31 -07:00
Tom Ritchford
ea67a2d051 Remove jss::account_index and jss::peer_index. 2015-07-07 10:14:31 -07:00
Vinnie Falco
1e7588d0ab Fix open ledger flag when jumping 2015-07-07 10:14:31 -07:00
Vinnie Falco
b6b3548c0c Remove redundant unit test 2015-07-07 10:14:27 -07:00
Vinnie Falco
097a8ce640 Merge branch 'release' into develop
Conflicts:
	Builds/VisualStudio2013/RippleD.vcxproj
	Builds/VisualStudio2013/RippleD.vcxproj.filters
	Builds/rpm/rippled.spec
	src/ripple/app/misc/NetworkOPs.cpp
	src/ripple/app/tx/impl/TransactionEngine.cpp
	src/ripple/protocol/impl/BuildInfo.cpp
	src/ripple/unity/app_tx.cpp
2015-07-07 09:35:41 -07:00
Vinnie Falco
6374aad9bc Set version to 0.28.2 2015-07-07 09:21:44 -07:00
Vinnie Falco
fed3f7b74b Set version to 0.29.0-b8 2015-07-02 15:53:05 -07:00
Vinnie Falco
c079d9ae38 Env_test fixes 2015-07-02 15:53:00 -07:00
Nik Bougalis
6a093b1b44 Fix SHAMapTreeNode deserialization 2015-07-02 15:50:11 -07:00
Miguel Portilla
4dc573f195 Add DeliverMin transaction field (RIPD-930) 2015-07-02 15:50:11 -07:00
Vinnie Falco
b7f07aed00 Add BasicView::txs memberspace interface 2015-07-02 15:09:10 -07:00
Vinnie Falco
cb791482a0 Serializer improvements:
* Add getSlice()
* Make getVLDataLength public
2015-07-02 15:09:10 -07:00
Vinnie Falco
95eaf254c9 Tidy up abstract_clock:
* Add clock_type
* Make elapsed() const
2015-07-02 15:09:09 -07:00
Vinnie Falco
bd7eb94d69 Refactor clock declarations in chrono.h 2015-07-02 15:09:09 -07:00
Vinnie Falco
223389a464 Tidy up abstract_clock:
* Add clock_type
* Make elapsed() const
2015-07-02 15:09:09 -07:00
Vinnie Falco
575f124fb8 Tidy up transactors:
* Rename some members
* Don't use SLE cached from the base view
2015-07-02 15:09:09 -07:00
Vinnie Falco
483f768370 Use BasicView:
Many functions and classes that used a Ledger now use a BasicView.

Calls to cachedRead are changed to call member read on the view,
note that this bypasses the SLECache optimization. To restore the
optimization, the BasicView passed at the top of call stacks
should be wrapped with a caching view, coming in future commits.
2015-07-02 15:09:08 -07:00
Vinnie Falco
ab20ca95aa Add hash to ViewInfo 2015-07-02 15:09:08 -07:00
Vinnie Falco
bf775036bc Add MetaView hold parameter 2015-07-02 15:09:08 -07:00
Vinnie Falco
08bfd302fe Apply tx to new open ledger on switch (RIPD-972):
When the last closed ledger jumps, transactions from the
old open ledger and local transactions need to be applied
to the new open ledger or else transactions could get lost
locally (but still relayed, and therefore make it into a ledger).

A harmful effect is that rippled will report that the transaction
was not applied even when it was, making robust transaction
submission malfunction.
2015-07-02 15:09:07 -07:00
Vinnie Falco
3b6ea02920 Fix missing tefEXCEPTION handling in apply 2015-07-02 15:09:07 -07:00
Howard Hinnant
26bfeb1319 Replace Serializer with Blob in SHAMapItem:
* This helps decouples SHAMap and Serializer.
* Restyle data member names.
* Rename getTag() to key().
2015-07-02 15:06:09 -07:00
Vinnie Falco
72659d431e Set version to 0.29.0-b7 2015-07-01 13:06:51 -07:00
Howard Hinnant
53dabe68ef Fix warning 2015-07-01 13:06:47 -07:00
Nik Bougalis
ccd6b46995 Fix shadowing 2015-07-01 12:34:00 -07:00
Vinnie Falco
91b3227a0f Fix canonicalization race in batch apply 2015-07-01 12:29:46 -07:00
Vinnie Falco
adebba94dc Set version to 0.28.2-rc3 2015-07-01 12:27:21 -07:00
Vinnie Falco
9d3b3f7a01 Fix canonicalization race in batch apply 2015-07-01 12:27:21 -07:00
seelabs
b354360bc0 Port DeferredCredits test to jtx and views 2015-07-01 13:45:56 -04:00
seelabs
8c24f7eb03 Account for deferred credits of parent views 2015-07-01 10:59:02 -04:00
Vinnie Falco
f473eade5a Set version to 0.29.0-b6 2015-06-30 19:52:28 -07:00
mDuo13
dc74a44b70 Update command-line usage message (RIPD-922) 2015-06-30 19:51:23 -07:00
Vinnie Falco
f96ac3db67 Refactor View, MetaView, and tx processing:
This tidies up the View interface and makes transaction
application a free function, with the removal of the
TransactionEngine class. A new class ApplyContext provides
all the state information needed to apply a Transactor. The
Transactor is refactored to perform all the processing
activities previously part of TransactionEngine.

The calculation of metadata from a MetaView is improved.
A new apply function performs all the steps for calculating
and inserting metadata into the tx map.

Transaction processing code path is passed a Config instead
of retrieving the global, and uses the Journal supplied in
the call to apply() consistently.

To support transaction processing and RPC operations, a
new POD type ViewInfo is added which consolidates static
information about open and closed ledgers, such as the ledger
sequence number or the closing times. Ledger and MetaView are
refactored to use this info.

The ViewInfo now contains the "open ledger" setting. The
tapOPEN_LEDGER ViewFlag is removed. The view property of
being an open ledger is obtained from the base or by using
the MetaView constructor which presents a closed ledger as
an open one.

View, MetaView:

* Fix missing includes
* Add apply free function
* Use Journal in TransactionEngine
* Use BasicView in TransactionEngine
* inline NetworkOPs::batchApply
* Add shallow_copy, open_ledger MetaView ctor tags
* Add ViewInfo with open flag, seq, close times
* Make parent_ a reference
* Tidy up ctor arguments and base_ name
* Remove tapOPEN_LEDGER
* add assert to MetaView::apply
* ViewInfo comment
* Throw, pass Journal in txInsert
* Add BasicView::txCount

TransactionEngine:

* Add apply
* Make TransactionEngine private
* Refactor MetaView::apply and apply()
* Rename to TxMeta
* Refactor treatment of metadata in MetaView, TransactionEngine
* Rename to ApplyContext
* Use ApplyContext& in Transactor
* Pass Config in ApplyContext
* Declare Transactor classes in headers
* Use view flags in Transactor
2015-06-30 19:26:02 -07:00
Vinnie Falco
b11b9939f4 Add contract interface 2015-06-30 12:29:58 -07:00
Vinnie Falco
e595fd5e02 Add JLOG macro 2015-06-30 12:29:57 -07:00
Vinnie Falco
af52276cd9 Set version to 0.29.0-b5 2015-06-30 11:33:45 -07:00
Vinnie Falco
2eec47415e Add enableTesting flag to applyTransactions 2015-06-30 11:33:45 -07:00
Vinnie Falco
4a2af70c2c Return tefEXCEPTION in TransactionEngine 2015-06-30 11:11:34 -07:00
Vinnie Falco
6211065802 Disable Websocket ping timer 2015-06-30 11:01:34 -07:00
Vinnie Falco
a338d9efe0 Return tefEXCEPTION in transaction engine 2015-06-30 10:59:39 -07:00
Vinnie Falco
e2ef423624 Disable Websocket ping timer 2015-06-30 10:56:48 -07:00
Nik Bougalis
0f8206e269 Set version to 0.29.0-b4 2015-06-29 17:19:52 -07:00
Nik Bougalis
4ccc3751d6 Remove unused function 2015-06-29 17:19:48 -07:00
Tom Ritchford
7ef6e58024 Tidy Json:
* Remove unused code.
  * Rename .inl file to .cpp.
  * Remove duplicate macros.
2015-06-29 17:11:17 -07:00
Vinnie Falco
57689c4e66 Refine View interfaces:
This shores up the View interface support for contextual
transaction processing by putting params in the View, and
provides support for replacing the open ledger with the
open MetaView.

Transaction metadata is now part of the View interface.
Stacked MetaViews correctly apply their transaction
metadata to the parent.

* Add lastCloseTime to View
* Add insertTx to View, implement in MetaView
* Add View::txExists for transaction checking
* Add Fees to View, cache fees in Ledger and MetaView
* Use ViewFlags in View
* Use tapENABLE_TESTING flag for features
* Use cached Fees in View
* Rename to ViewFlags
* Move FreezeHandling to View.h, remove ViewAPIBasics.h
* Remove BasicView::parent hack
* Remove calls to getLedger in Transactors
2015-06-29 17:06:48 -07:00
Nik Bougalis
2fc8d70655 Set version to 0.29.0-b3 2015-06-26 20:02:45 -07:00
Edward Hennis
7ee9f8513c Levelize RipplePathFind.h 2015-06-26 20:02:45 -07:00
Nik Bougalis
1a843fb4f6 Refactor consensus:
Classes implementing the consensus process on Ripple are cleaned
up in preparation for modularizations and compartmentalization.

Functions and state related to inter-round consensus are moved out
of NetworkOPs and into Consensus, where they are more effectively
isolated.

Some member functions are changed to free functions and some free
functions have their scope reduced to specific translation units.

* Track inter-round consensus state using new Consensus object
* Devirtualize interfaces
* Reduce NetworkOPs, Consensus and LedgerConsensus interfaces
* Add comments
2015-06-26 20:02:45 -07:00
Tom Ritchford
9111ad1a9d Handle empty Json values:
* Replace Json::Value::isNull() and Json::Value::empty with operator bool()
2015-06-26 20:01:02 -07:00
Tom Ritchford
a5a9242f4e Handle empty strings in Json::Value::empty() 2015-06-26 20:00:44 -07:00
Nik Bougalis
3fcf4ae8b7 Set version to 0.28.2-rc2 2015-06-25 14:46:43 -07:00
Nik Bougalis
c3d34aaf4d Fix shadowing 2015-06-25 14:45:32 -07:00
Vinnie Falco
e4f585b7fe Set version to 0.29.0-b2 2015-06-25 11:17:10 -07:00
Tom Ritchford
874b685a83 Remove duplicate and shadow variables. 2015-06-25 11:17:09 -07:00
Tom Ritchford
e3ac1001be Tidy up locks and locals. 2015-06-25 11:17:09 -07:00
Tom Ritchford
67f2a5d9d6 Remove duplicate and shadow variables. 2015-06-25 11:17:09 -07:00
Edward Hennis
89b9fa0b35 Fix shadowing 2015-06-25 10:57:03 -07:00
JoelKatz
4c0de726c8 Require longer delays before disconnecting peers 2015-06-25 10:55:59 -07:00
JoelKatz
7d96075e14 Avoid lock overlap:
Prefer to release the InboundLedgers lock before acquiring
a lock on a specific ledger
2015-06-25 10:55:40 -07:00
JoelKatz
924a8cdd4b Rework of InboundLedgers::mRecentFailures:
This provides more precise tracking of failed ledger acquires
and more useful information in fetch_info.
2015-06-25 10:55:36 -07:00
Miguel Portilla
b27d078c67 Path finding unit tests (RIPD-731)
Conflicts:
	src/ripple/app/paths/tests/Path_test.cpp
	src/ripple/unity/app_paths.cpp
2015-06-25 10:54:45 -07:00
JoelKatz
c64ec9cfb9 Use continuation in legacy pathfinding:
Handle legacy (ripple_path_find) requests that don't specify a ledger
the same way regular path_find requests are. This provides a
performance improvement for these requests and reduces the problem
of server busy errors.

Conflicts:
	src/ripple/app/paths/PathRequest.cpp
2015-06-25 10:32:04 -07:00
JoelKatz
3d6e76046c Always use co-routines:
This permits RPC handlers to suspend and reschedule:
2015-06-25 10:30:06 -07:00
Vinnie Falco
48d6a4ab6a Refactor MetaView (RIPD-954):
Obsolete functionality is removed. DeferredCredits is moved
to a new class PaymentView, and used in RippleCalc.
2015-06-25 10:27:15 -07:00
JoelKatz
f535304e1b Use new MetaView functionality in RippleCalc (RIPD-954):
RippleCalc is changed to stack views when calculating results
instead of making a copy of the MetaView, improving efficiency.
2015-06-25 10:23:36 -07:00
Vinnie Falco
2f485672fa Refactor AccountID (RIPD-953):
All AccountID functionality is removed from RippleAddress and
replaced with free functions. The AccountID to string conversion
cache is factored out as an explicit type with an instance in
the Application object. New base58 conversion functions are used,
with no dependence on OpenSSL.

All types and free functions related to AccountID are consolidated
into one header file. Routines to operate on "tokens" are also
introduced and consolidated into a single header file.

A token one of the cryptographic primitives used in Ripple:

    Secret Seed
    Server Public Key
    Server Secret Key
    Account ID
    Account Public Key
    Account Private Key

    and these deprecated primitives:

    Account Family Seed
    Account Family Generator
2015-06-25 09:05:06 -07:00
Vinnie Falco
63d438c979 Add digest.h and protocol digest classes 2015-06-24 16:28:36 -07:00
Vinnie Falco
ea5fe35b54 Add SHA256 and RIPEMD-160:
* Renamed files to reflect digest family names
* Add SHA256 to SHA2
* Add RIPEMD-160 to RIPEMD
* Reduce duplicated code
2015-06-24 16:28:35 -07:00
Vinnie Falco
c955c03197 Add SHA256 and RIPEMD-160:
* Renamed files to reflect digest family names
* Add SHA256 to SHA2
* Add RIPEMD-160 to RIPEMD
* Reduce duplicated code
2015-06-24 16:28:35 -07:00
Vinnie Falco
ceff6bc271 Set version to 0.29.0-b1 2015-06-22 19:32:26 -07:00
seelabs
80a5f5878f Add offer jtx test 2015-06-22 19:32:26 -07:00
Howard Hinnant
1e6111c09c Make the data of a SHAMap const:
* Hold a shared_ptr<SHAMapItem const> instead of a shared_ptr<SHAMapItem>.
* Compiler helps us enforce data immutability.
* Make SHAMapAbstractNode::addRaw const

Conflicts:
	src/ripple/app/ledger/Ledger.cpp
	src/ripple/app/ledger/Ledger.h
	src/ripple/app/ledger/LedgerHistory.cpp
	src/ripple/app/ledger/LedgerToJson.h
2015-06-22 18:39:33 -07:00
Vinnie Falco
d468deee12 Refactor Ledger and LedgerEntrySet:
Member functions and free functions on Ledger and LedgerEntrySet are
rewritten in terms of new abstract interfaces `BasicView` and `View`,
representing the set of non-decomposable primitives necessary to read
and write state map items in a ledger, and to overlay a discardable
view onto a Ledger that can calculate metadata during transaction
processing. const-correctness is enforced through the parameter and
return types.

The MetaView now supports multi-level stacking: A MetaView can be
stacked on top of either a Ledger or another MetaView, up to any
number of levels.

The getSLEi member function is removed. The CachedView wrapper
replaces it, wrapping a View such that any function called with a
CachedView will go through the SLECache.

* Add BasicView, View, CachedView
* Rename LedgerEntrySet to MetaView
* Factor out free functions
* Consolidate free functions in ViewAPI
* Remove unused class members and free functions
2015-06-22 18:39:33 -07:00
Vinnie Falco
e7eb3aa63d Set version to 0.28.2-rc1 2015-06-19 16:03:42 -07:00
JoelKatz
749f31f69d Tidy up SHAMap node handling of invalid wire formats 2015-06-19 16:03:42 -07:00
Vinnie Falco
2d6af1da1d Add SigningPubKey regression test 2015-06-19 16:03:42 -07:00
JoelKatz
6ec5fa9cae Fix null pointer in ec wrapper 2015-06-19 15:53:41 -07:00
JoelKatz
72832c0fa2 More robust call to get the valid ledger index 2015-06-19 15:53:32 -07:00
Vinnie Falco
7d329570f4 Set version to 0.28.2-b10 2015-06-18 15:35:48 -07:00
Edward Hennis
c334093223 jtx: Add ledger advance.
Conflicts:
	src/ripple/test/jtx/impl/Env_test.cpp
2015-06-18 15:35:46 -07:00
Edward Hennis
27274c9620 jtx: Add JTx properties. 2015-06-18 15:34:41 -07:00
Vinnie Falco
cd5e36045c jtx: json, memo funclets, fixes, improvements:
* Add json funclet
* Add memo funclet
* Add Env::trace
* Add PrettAmount regression test
* Fix PrettyAmount construction
* Make Env::trust balance-neutral
* Log parse errors during signing
2015-06-18 15:33:44 -07:00
Tom Ritchford
3ed1382bbe Fix warning 2015-06-18 13:56:15 -07:00
Tom Ritchford
0062a260b9 Fix warning 2015-06-18 13:56:15 -07:00
Nik Bougalis
fdd2ea8feb Set version to 0.28.2-b9 2015-06-15 19:43:03 -07:00
Tom Ritchford
fbc1768784 Fix JobQueue synchronization. 2015-06-15 19:43:03 -07:00
Vinnie Falco
c53b9f3713 Add SHAMap::iterator 2015-06-15 19:43:03 -07:00
Vinnie Falco
b3749e4d95 Fix MSVC link 2015-06-15 19:43:02 -07:00
Vinnie Falco
eb709f415b Tidy up jtx:
* Tidy declaration order
* Remove AccountInfo
* Remove Env autofill settings
2015-06-15 19:43:02 -07:00
Vinnie Falco
9dd08e4dab Rename Account to AccountID 2015-06-15 19:43:02 -07:00
Tom Ritchford
e1cd1e9e32 Add header 2015-06-15 19:43:02 -07:00
Howard Hinnant
f875603525 Split SHAMapTreeNode into leaf and inner nodes.
* This reduces the memory requirements of both leaf and inner nodes.
* The name SHAMapTreeNode is retained for leaf nodes so as to keep
  the public API of SHAMap stable.
2015-06-15 19:43:02 -07:00
JoelKatz
e95ab65396 Improve peer send queue management:
* Disconnect peers on sustained large send queues
* Disconnect peers on sustained failure to pong
* Refuse some queries if send queue is at target
* Allow latency to exceed ping timer interval
2015-06-15 19:43:02 -07:00
JoelKatz
e0907ede4f GatewayBalances RPC command
RPC command to get a gateway's hot wallet balances
and total obligations.
2015-06-15 19:43:02 -07:00
Vinnie Falco
17020ffc54 Fix MSVC link 2015-06-15 19:43:02 -07:00
Vinnie Falco
237b5e704f Convert to bool in suite::expect 2015-06-13 21:02:51 -07:00
Nik Bougalis
abd05a6378 Set version to 0.28.2-b8 2015-06-13 21:02:51 -07:00
Vinnie Falco
189592938a Improvements to jtx framework:
This adds "require" functionality which allows invariants
to be checked after processing transactions using a simple,
terse interface. Also adds more comprehensive test coverage
for the framework itself, verifying that the more sophisticated
language constructs work in all ways.

All functions and classes have been split up into individual
files which may be included a-la carte, or accessed through
a single convenience header <ripple/test/jtx.h>

* Move, rename all sources
* Put everything in the jtx namespace
* Add sendmax funclet
* Rename funclet to paths
* Correctly set input issue and destination amount in path
* Conditionally invoke funclets using is_call_possible
* Add any() function means "any currency they will accept"
* Add None, none modifiers on amounts to mean "no amount"
* Add require conditions to JTx
* Add Env::require variadic condition checker
* Add le, rename some items for consistency
* Add require functors, balance, flags, nflags
* Add require functors lines, owners, offers, tickets
* Add ticket example of extending the system
* Add noripple modifier for funding accounst
* Add Env::st to parse Json into STTx
* Add tests to ensure correctness of fund()
* Add virtual Env member hooks
* Add Env::balance
* Add Env::seq
* Add PrettyAmount
* Add all container Account support
* IOU and XRP return PrettyAmount amounts
* IOUs print the issuer's name instead of base58
* Fix int and double conversions to XRP
* Fix autofill of Env::fund with noripple
2015-06-13 21:02:51 -07:00
Vinnie Falco
4f34724c5a Conditionally enable tickets at run time 2015-06-13 21:02:51 -07:00
Vinnie Falco
e958f72ba9 Convert to bool in suite::expect 2015-06-13 21:02:51 -07:00
Vinnie Falco
0fcd3da046 Add is_call_possible 2015-06-13 21:02:50 -07:00
Vinnie Falco
5c5b121b62 Add is_call_possible 2015-06-13 21:02:50 -07:00
Vinnie Falco
d21171b21e Refactor LedgerEntrySet:
* Remove duplicate:
    This changes behavior to fix an apparent bug. The
    copy will now correctly inherit mParams instead
    of reverting to tapNONE

* Tidy up LedgerEntrySet declarations
* Tidy up TransactionEngine
* Tidy PathCursor declarations
* Add LedgerEntrySet::apply
* Add LedgerEntrySet ctor
* Add Keylet, keylet namespace
* Add defaulted copy members
* Use optional in TransactionEngine
* Use optional<LedgerEntrySet> in PathState
* Return shared_ptr in Ledger::fetch
* Don't call entryCache with zero
* Deprecate invalidate
* Remove default constructor
* Remove unused container API
* Remove CountedObject base class
* Remove insert, clear
* Remove entryCreate overload
* Remove unused and tidy up STLedgerEntry
* Make getEntry private and tidy
* Replace members with adjustOwnerCount free function
* Replace accountFunds with funds free function
2015-06-13 21:02:50 -07:00
MarkusTeufelberger
aead038215 Fix docs 2015-06-13 12:02:28 -07:00
Nik Bougalis
a16c07c78a Remove unused NodeIdentity table fields 2015-06-13 12:02:22 -07:00
Nik Bougalis
9930b12d9d Beast clean up:
* Remove binding, dispatch handling and exit hooks in favor
  of std alternatives; remove crash-handling infrastructure,
  error message framework, system-specific process handling
  and Objective-C interop helpers.
* Simplify Beast function profiling
* Simplify beast::Time interface
* Simplify beast::String interface
* Simplify beast::File interface
2015-06-13 11:55:03 -07:00
Nik Bougalis
3aebabce3d Revert "Enable EDH only for anonymous SSL contexts":
The issue was caused by client-side functionality added to IE
to protect against LOGJAM. By properly supporting larger keys
we no longer need to disable Ephemeral DH.

This reverts commit 3028ffd083.
2015-06-13 11:55:03 -07:00
JoelKatz
7239bcf0b7 Support larger EDH keys:
In the past we used only 512-bit EDH keys. To protect against the
LOGJAM attack, OpenSSL 1.0.1n and later versions reject EDH keys
that are less than 768 bits and a future version will increase the
minimum to 1024.

We now have DH parameters for 1024-bit and 2048-bit EDH keys and
will correctly return and use those, when asked. Note that at this
time, OpenSSL will only ask for 512 or 1024 bit keys.
2015-06-13 11:55:03 -07:00
Tom Ritchford
623faa1550 Fix warning 2015-06-13 11:55:03 -07:00
Nik Bougalis
60fad25476 Beast clean up:
* Remove binding, dispatch handling and exit hooks in favor
  of std alternatives; remove crash-handling infrastructure,
  error message framework, system-specific process handling
  and Objective-C interop helpers.
* Simplify Beast function profiling
* Simplify beast::Time interface
* Simplify beast::String interface
* Simplify beast::File interface
2015-06-13 11:55:03 -07:00
Tom Ritchford
d06e07ef0e Correctly compare JSON values. 2015-06-13 11:55:03 -07:00
Mark Travis
ca800f9e8d Batched transaction application:
Applying multiple transactions to the open ledger
reduces SHAMap modification overhead.
2015-06-13 11:53:45 -07:00
Nik Bougalis
4225b78bf5 Set version to 0.28.2-b7 2015-06-10 16:02:29 -07:00
Nik Bougalis
8c68eff460 Cleanup object templates:
* Avoid exposing class members - use boost::iterator_range instead
* Use std::make_unique instead of naked new
2015-06-10 15:59:52 -07:00
Tom Ritchford
c2814308f1 Remove unused parameters to accountFromString. 2015-06-10 15:56:24 -07:00
Nik Bougalis
f237187b0d Remove cache sweep profiling 2015-06-10 15:55:05 -07:00
Nik Bougalis
187b4caf3c Add logging support to Taker:
Log progress during offer crossing and flow calculations to
allow for easier debugging and transaction analysis. All
logging is done at debug and trace level and will normally
not be visible.
2015-06-10 15:54:27 -07:00
Tom Ritchford
b8526f7894 Allow RPC yield to be a continuation. 2015-06-10 15:54:07 -07:00
Tom Ritchford
b2b0377717 New method JobQueue::getJobForThread().
* Clean up mutability.
* Add override specifiers.
* Get rid of unused parameters.
2015-06-10 15:53:59 -07:00
Nik Bougalis
24ea1ab035 Parse pathsets when accounts are specified in hex 2015-06-10 15:53:04 -07:00
Nik Bougalis
e980e69eca Acquire logic fixes:
In InboundLedgers::acquire, properly return a ledger if we are
able to create one immediately.

In LedgerMaster::walkHashBySeq, don't walk the whole ledger if
we already know we have it.
2015-06-10 15:52:48 -07:00
Vinnie Falco
2904add428 Set version to 0.28.2-b6 2015-06-08 17:25:17 -07:00
Vinnie Falco
babaac9305 Refactor Ledger and support classes:
This performs a deep refactor on the Ledger class and its supporting
classes, in preparation for the move to shared_ptr<SLE const> in
places where the SLE is immutable and we are currently using
shared_ptr<SLE>.

Member functions are converted to free functions, the SLECache is an
explicit parameter, one line convenience functions are removed to
streamline the interface. Some callers are changed to use <SLE const>
instead of <SLE>

SLECache:
* Moved to its own header file

RippleState:
* Remove unused functions
* Store the SLE as const
* Simplify callers

AccountState:
* Remove unused members
* Simplify existing members

Ledger:
* Replace writeBack with insert and update
* Remove unused functions
* Remove LedgerStateParams
* Move getLastFullLedger to Application
* add entryCacheI, exists, fetch, erase
* Use boost::optional where it makes sense
* Make member functions free functions

Free functions:
* fetch: cache-aware SLE retrieval
* forEachItem, forEachItemAfter
* (various)
2015-06-08 17:25:16 -07:00
Howard Hinnant
9cdc06ce43 C++14 readiness 2015-06-08 15:38:19 -07:00
Vinnie Falco
454d2f8c45 Add SHAMap::fetch returning SHAMapItem const 2015-06-08 15:38:19 -07:00
Howard Hinnant
5d42d52660 C++14 readiness 2015-06-08 15:38:19 -07:00
Edward Hennis
a0e87c7aee ConnectedAddresses stores Addresses to avoid port issues.
* Also change log level on a couple of Overlay messages.
2015-06-08 15:07:06 -07:00
Edward Hennis
49c4ec6f93 Travis build unity and nounity. 2015-06-08 15:06:28 -07:00
Nik Bougalis
eb0ece417d Fix move sequencing 2015-06-08 15:05:33 -07:00
seelabs
7b5bf7f129 Add support for scons ninja backend 2015-06-08 15:05:20 -07:00
Vinnie Falco
ab8ffc1a00 Set version to 0.28.2-b5 2015-06-02 18:00:31 -07:00
Vinnie Falco
64c8335e22 New Env transaction testing framework:
This adds a suite of tools used to write unit tests. The Env provides
a context containing a ledger, and routines that assemble transactions
from JSON with optional "funclets" that add details in an exensible, terse
notation.
2015-06-02 18:00:31 -07:00
Vinnie Falco
4cfffdf76f Add pretty(Json::Value) 2015-06-02 16:52:23 -07:00
Vinnie Falco
8adc4c1e3c Add rpcErrorString function 2015-06-02 16:52:22 -07:00
Vinnie Falco
02c118981f Add jss fields 2015-06-02 16:52:22 -07:00
Vinnie Falco
4825cefbf8 Add strHex(Slice) 2015-06-02 16:52:22 -07:00
Vinnie Falco
4b91a18532 Remove linefeed from JSON to string conversion 2015-06-02 16:52:21 -07:00
Vinnie Falco
ff2453e42c Add missing include 2015-06-02 12:55:25 -07:00
Vinnie Falco
269ad321e6 Allow multi-sign to be enabled at runtime:
This lets unit tests exercise multi-sign interfaces
without having to set RIPPLE_MULTI_SIGN_ENABLE.
2015-06-02 12:55:25 -07:00
Vinnie Falco
7382a0c142 Refactor Serializer, SerialIter, SHAMapItem, NodeObject:
* Make LessThan private
* Make NodeObject::isSame private
* Remove hotTRANSACTION
* Remove some Serializer members
* Remove unused SHAMapItem::getRaw
* Remove unused STLedgerEntry::getOwners
* Remove Serializer constructors
* Remove unused Serializer members
* Remove SerialIter ctor
2015-06-02 12:55:07 -07:00
Vinnie Falco
8be4e7e65f Refactor Serializer, SerialIter, SHAMapItem, NodeObject:
* Make LessThan private
* Make NodeObject::isSame private
* Remove hotTRANSACTION
* Remove some Serializer members
* Remove unused SHAMapItem::getRaw
* Remove unused STLedgerEntry::getOwners
* Remove Serializer constructors
* Remove unused Serializer members
* Remove SerialIter ctor
2015-06-02 12:55:07 -07:00
Vinnie Falco
c25184cc88 Add sha512Half and SHA512HashHasher:
These routines replace existing code to compute SHA512-Half hashes.
The new code accumulates serialized data into a hashing context
instead of allocating a buffer, for improved performance.
2015-06-02 12:52:10 -07:00
Vinnie Falco
360e3fb81e Add SHA512 hasher:
* Remove unused SHA256
2015-06-02 12:49:30 -07:00
Vinnie Falco
06823349f9 Tidy up Serializer:
* Remove getSHA512Half size parameter
* Remove unused Serializer::getSHA256
* Remove Serializer::getRIPEMD160
2015-06-02 12:49:30 -07:00
Vinnie Falco
d11510c34c Update hash_append to latest draft specification 2015-06-02 12:49:30 -07:00
Vinnie Falco
e18c6f63cc Add SHA512 hasher:
* Remove unused SHA256
2015-06-02 12:49:30 -07:00
Vinnie Falco
36a864106d Update hash_append to latest draft specification 2015-06-02 12:49:30 -07:00
JoelKatz
3028ffd083 Enable EDH only for anonymous SSL contexts
Enabling EDH breaks compatibility with some versions of IE. Disabling
EDH is an acceptable workaround.
2015-06-02 12:49:11 -07:00
Nik Bougalis
a3d5a97df6 Remove unused old-style unity files 2015-06-02 12:48:44 -07:00
Mark Travis
52879d964e Revert "Reduce SHAMapTreeNode copying during SHAMap unsharing:"
This reverts commit 47c6ab0ced.
2015-06-02 12:48:30 -07:00
Vinnie Falco
aaf209485c Merge remote-tracking branch 'david/lz4' into develop 2015-06-02 12:47:51 -07:00
Scott Schurr
4515ac0bca Replace base_uint(string) with from_hex_text<> (RIPD-897)
Removes the base_uint constructor that took a string.  Replaces
that functionality with two free functions named from_hex_text<>.
Use of from_hex_text<> looks like this:

auto v = from_hex_text<uint256>("AAA555");
static_assert (std::is_same<decltype(v), uint256>::value, "Huh!");

from_hex_text<> only operates on base_uint types.  At the moment the
list of those types include:

 o uint128,
 o uint160,
 o uint256,
 o Directory,
 o Account,
 o Currency, and
 o NodeID.

Using from_hex_text<> with any other types will not compile due to
an enable_if.
2015-06-02 12:46:03 -07:00
seelabs
d7def5509d Remove temp_db (RIPD-887) 2015-06-02 12:45:29 -07:00
JoelKatz
4ff845ac91 Merge commit 'df26c08a34b4e07235d33fcd7e2fb311d83f069f' into HEAD
Synchronize LZ4 with upstream
2015-05-29 15:03:27 -07:00
JoelKatz
df26c08a34 Squashed 'src/lz4/' changes from e25b51d..baf78e7
baf78e7 Merge pull request #111 from Cyan4973/dev
6f50184 Updated NEWS
acae59a Fixed : default sparse mode disabled on stdout, to support ` >>`  redirection scenario reported by Takayuki Matsuoka (#110)
91c1b9a Performance fix : big compression speed boost for clang (+30%)
0fb0392 Merge branch 'dev' of github.com:Cyan4973/lz4 into dev
bb22103 Merge pull request #107 from t-mat/issue/103pr2
7d72c0c Added LZF
e769a0e Combine unique .lz4 file info
ffff9ee Support iterative edit and testing
a8fdeb4 Add log output of succeeded decompression to test script
5151c30 Add log of same files and sha1 hash of unique files to versionstest
26065c3 Fixed  : LZ4IO exits too early when frame crc not present, reported by Yongwoon Cho (#106)
87e560e minor tests improvements
a9ff13a minor test refactor
58b5aad Fixed sparse issue with non seekable streams (#105)
60d657a removed "flush" argument to please Travis's python version
cdb136d cosmetic changes, 2nd try
c779c80 minor cosmetic changes for Takayuki's testVersions
26021db Merge branch 'dev' of github.com:Cyan4973/lz4 into dev
e3b5bf3 Merge pull request #104 from t-mat/issue/103pr2
fe11e0b Issue #103 : Add compatibility test between releases
f02c467 Added a few more interoperability tests (32bits vs 64 bits)
05c3f66 Updated a few comments
9607848 Fixed minor typo
45e1995 minor introduction update
7d182b8 Merge pull request #102 from Cyan4973/dev
fdd0029 minor parsing update
672bfde Updated comments
b4ef93a Fixed typo
efbebd2 Added : LZ4_compress_destSize()
1c3e633 Added compilation flag -Wcast-qual
05b0aa6 Updated readme
e05088d Updated lz4hc API
b4348a4 Fixed minor Visual warning
1171303 Updated streaming examples
1b17bf2 New lz4 API, using LZ4_compress_fast()
b495c91 Merge pull request #99 from eberge/dev
791512c Fixed bug 9318
2a974d7 refactored lz4hc
1e751a7 Install the lz4frame.h header in the cmake build
ad2dd6d moved lz4frame context types to incomplete typedef
c9cbb8f Increased aligment requirement for lz4frame context pointer
ef55dfb Modified lz4frame context typedef, to enforce stricter alignment condition
87a1c70 Fixed minor static analyzer warning
d6dc0a4 streaming API : Improved ring buffer management
bda38fd Merge pull request #98 from eberge/dev
a9a24e8 cmake support for AIX, HPUX, Solaris and Windows
9c6fb8b Added LZ4_compress_fast_extState()
b05d3d7 Frame content size disabled by default when using LZ4F_compressFrame(), to be in better coherence with the advanced API LZ4F_compress_update()
b805d58 Removed obsolete functions from lz4 cli
f11afaf Removed LZ4_compress() (obsolete) from lz4
72e6794 Updated LZ4F_freeDecompressionContext(), to provide stage hint as result
a01e10d Changed LZ4F compressionLevel from unsigned to signed, in anticipation for LZ4_compress_fast() integration.
cbcdd88 Fixed frame concatenation
e18aa90 Fixed frametest
c035b7a Restored make-lz4
197982e Fixed unfinished frame (issue #75)
409f816 Updated LZ4F_getFrameInfo() behavior, related to uncomplete frame header decoding attempts
47c3040 added --no-sparse test
9fd4f1f Sparse file support is now enabled by default
7644bee test error message in multiple files mode
bce2eeb Reclassified some notification messages as errors
9e92bee stronger arm tests
2ed9dcc fix minor "divide by zero" risk
633c1ca fixed minor leak
0ed2e71 Static analyzer generates error codes on bug suspicion
2cf8a19 minor header refactoring
634e4ee Merge pull request #96 from t-mat/improve-pr-95
e328d41 minor optimization for small files
13c6e16 Removed status notification in multiple-files mode
d153aaa Add LZ4F_OBSOLETE_ENUM() to describe obsolete enums
a430b85 Multiple files decompression refactoring
4e574e7 Updated lz4frame error names
d37926b Merge pull request #95 from t-mat/issue/90
240b554 Merge pull request #94 from t-mat/dev
3d46d4b Fix LZ4_DEPRECATED() in lz4hc.h
5f732e1 Merge pull request #91 from t-mat/dev
175890f Issue#90 : Change old enum names to new one
585bab8 Issue#90 : Change old enum to macro to maximize compatibility
081bcca Issue#90 : Add LZ4F_ prefix
e1283c7 Fix LZ4_DEPRECATED() for older/non-gcc/clang/MSVC compilers
d7298d2 Replace GCC_VERSION with LZ4_GCC_VERSION
9851583 Merge pull request #93 from drcrallen/descriptiveFrameErrors
b664a72 Revert "Revert "Add more descriptive frame errors""
3f4f623 Valgrind tests generate errors
83e350d Merge branch 'dev' of github.com:Cyan4973/lz4 into dev
066e9d3 Merge pull request #92 from Cyan4973/revert-89-descriptiveFrameErrors
5a66527 Revert "Add more descriptive frame errors"
0dc8308 Merge pull request #89 from drcrallen/descriptiveFrameErrors
05a46fc Changes LZ4F_compressBound() definition using NULL prefsPtr to cover worst case instead of default.
348f509 lz4io refactoring
eabc6d8 New valgrind test with multiple files
113b150 Fix leak issue with compression of multiple files
c64200d Improved performance when compressing a lot of small files
cc24124 minor compatibility fixes
ccba7a0 Merge pull request #86 from KyleJHarper/origin/r129/multiple_inputs_patch
d535214 Add more descriptive frame errors
bc28fc1 Merge pull request #87 from t-mat/fix-example2
fd77bad Replace obsolete functions
b036eaa Add snprintf macro for MSVC
7f2f1fc Added support for continuation of file compression and decompression if input files are missing.  Should more closely match gzip/bzip2/xz and so forth.  Also removed a debug print accidentally left in.
0169502 Added new LZ4IO_decompressMultipleFilenames to allow decompression of multiple files with the -m switch added in r128 (ref: google code issue 151).  Limitation: will only process files matching LZ4_EXTENSION macro, which for now seems reasonable.
da11725 new memory leak test for fullbench using multi-files
2c79887 Shortened tests durations
42e5bc4 Updated badges
2852b9e Fixed issue #84
8f49666 Fixed : minor coverity warning
8a61000 Fixed a few coverity warnings
138673d fixed minor g++ warning
cc8d617 Merge pull request #82 from t-mat/add-lz4-prefix
81fdd9d Fixed a few Valgrind warnings
ad86910 Add LZ4 prefix to deprecation macros
66b8a4a Fixed : minor Visual warnings
62ed153 Fixed : a few minor coverity warnings
9443f3d Extended obsolete warning messages to lz4hc
973e385 Implemented obsolete warning message
be9d248 Update lz4hc API : LZ4_compressHC_safe()
a07db74 Clarified lz4frame.h inline doc
8b8e5ef fixed minor sanitize warning
c22a0e1 Updated : fuzzer tests can be programmed for a timelength
a2864fd Fixed a few minor sanitize warnings
33134fb Added : sanitize test
f344fbd Fixed a few warnings from -fsanitize=undefined
2f8a4c3 New LZ4_compress_safe() API
1853622 fixed over-cautious visual warning
b41137f minor Makefile test refactoring
327cb04 minor memory leak fix and test
43e0535 fix g++ typecast
61d7416 updated doc
17f8614 added : memtest on fullbench
d38b0b6 Merge pull request #73 from funcodeio/dev
979a991 memcpy speed as reference
157a739 Merge pull request #74 from Cyan4973/fastMode
dd69902 Removed unused lines.
43eaf8f Merge pull request #72 from fzort/master
f72761f new tests for large files with content size support (#70)
90c0104 Added : progress indicator, in fast and decompression modes
1d3ab5d Cygwin has fileno, so there's no need to use _fileno.
78d2dfd fullbench : tests of _limitedOutput variants intentionnally provides less memory space than safe (LZ4_compressBound())
ef7cd83 Fixed issue 160, reported by Eric Berge
28e237e simplified LZ4_compress_limitedOutput()
89eee0d Removed make dist
0615eb4 Stricter tests : treat warnings as errors
76a03c1 simplified LZ4_compress_withState()
6625068 simplified LZ4_compress()
886b199 Modified files rights
7b5e945 Removed Visual 2013 solution, as AppVeyor automated mode only works with a single solution
117ab8c Added : Visual 2013 solution
08b24af Updated Visual 2012 solution : + 3 projects (fullbench, frametest, datagen)
a761546 Fix : minor warning under Visual
bf146ec Removed .suo & .user files from Visual solutions
7db6678 Restored proper credit
3bba55c Fixed : Windows compilation Added : Appveyor badge
160661c Merge pull request #69 from Cyan4973/dev
8437a0e Fixed : Visual compilation
7c26b03 Updated make dist
f174964 Added : Frame documentation in MarkDown format
880381c Removed HTML Frame Format documentation
5b9fb69 minor tweak
4783cb8 Updated readme
4c227a4 Added LZ4_compress_fast()
003af71 Merge pull request #67 from Cyan4973/dev
2a82619 fixed fullbench memory allocation error
6c69dc1 faster compression in 64 bits mode
44793b8 Updated documentation
b93f629 changed file name
eeb8bea Updated comments on LZ4F_getFrameInfo()
002ec60 restored lz4hc compression ratio
987e78c Merge pull request #66 from Cyan4973/dev
8cb06d5 lz4frame validates contentSize during decompression
d5da787 Changed struct member to contentSize
2d4fed5 Merge pull request #65 from Cyan4973/dev
ce71b07 converted to markdown friendly syntax
1ba37f3 Reference format doc
5780864 Fixed : Makefile
b009767 windows friendly make clean
27f7d06 minor beautifier (make clean)
b4755c7 Added : arm cross-compilation test
a357f43 Fixed cast-align warnings on 32-bits
4a9335b Added : doc authorship
e652285 Merge pull request #63 from t-mat/comment-on-example-directory
2af52a9 Add "Examples" subtree
679afea Add README.md as table of contents
19665c9 Add document for "Line by Line Text Compression" example
438fee9 Add document for "Double Buffer" example
a38166b Add document : "Streaming API Basics"
80e71c6 Updated man page : "--[no-]X"
5950f72 Updated tests
6b923d5 Updated long commands, with reverse "--no-" variants
d0f8d40 updated dist list
00c3208 Merge pull request #61 from Cyan4973/dev
7f436a1 lz4 cli supports frame content size
a28b147 removed useless man pages
7cf4e5c Updates tests & Man pages
f02adc7 new long commands
86715b2 Some more tests related to frame content size
7ee7256 frame content size support
7d87d43 Updated lz4io sparse file support (alignment properties)
b54d256 minor lz4frame optimisation (no more malloc() on using LZ4F_compressFrame() in fast mode)
da9402c minor lz4frame refactoring
859fe3b Updated LZ4 frame format documentation
8edb7f1 Added : Readme into lib directory, to explain what does each file
e7fb4d1 lz4 utility supports "pass-through" mode
2a02455 minor refactoring
3a68324 skippable frames support
93849d1 minor CMakeLists update
471eabe Merge pull request #60 from Cyberunner23/master
ef029a1 Removed checking of CMAKE_SYSTEM_PROCESSOR when adding -fPIC, breaks when that var is '64bit'.
c9a2b14 removed -s command from lz4c specific list of legacy commands
207aafd Added :  unlz4 symbolic link to "lz4 -d"
2b55752 changed "make install" default install directory to /usr/local
bbcfe21 Added : clang test
8a87769 Fix : static analyzer test on Travis
45b0642 scan-build tests
a18fb43 Merge pull request #58 from Cyan4973/sparseFile
248b761 windows sparse file support
d11ac40 Improved sparse files support
45a357f Improved sparse file support
e38c268 Fixed minor g++ warnings
12ab415 Preliminary support for sparse files
e3f33d2 Fixed minor warnings
74a6b14 Merge pull request #57 from alexDarcy/master
f2cc4be Updated Cmake configuration for non-gnu compiler
ceec6fa g++ compatibility
6b0c39b Updated datagen (can create sparse files)
e277511 Merge pull request #54 from t-mat/gc-issue/155
e1d9b59 Fixed : static library (x64 binary)
32a85fc NetBSD compatibility (#48)
488029e Updated : compress multiple files
046bd3a Merge pull request #52 from KyleJHarper/r128/multiple_inputs
dcdd628 Fix sentinel bit pattern
de5c930 Fix sentinel size miscalculation
eed7952 Add GNU coreutil's is_nul() method to isSparse()
b372f45 Add Neil's method to isSparse()
01a24af Improve isSparse()
4a5d92b Adjust coding style
97679fa Google Code Issue 155: lz4 cli should support sparse file https://code.google.com/p/lz4/issues/detail?id=155
fa27d23 Added support for multiple input files to act more like other compressors. For example: gzip file1 file2 file3. You can now do: lz4 [args] -m file1 file2 file3. Fixes 151.
67f3b41 Merge pull request #49 from t-mat/msvc-fseeki64
e68d1c9 restored lz4 hc compression ratio
41b6ed3 Replace fseek with _fseeki64 to avoid MSVC's 2GiB barrier
8f4e201 Fix : lz4frame.h within uninstaller
9fd92de Added : Visual project directory

git-subtree-dir: src/lz4
git-subtree-split: baf78e7e4dcbdf824a76f990ffeb573d113bbbdb
2015-05-29 15:03:27 -07:00
Tom Ritchford
e9d147f4b8 Set version to 0.28.2-b4 2015-05-29 13:45:23 -04:00
Tom Ritchford
f1a1ef49d5 Remove duplicate types. 2015-05-29 13:45:16 -04:00
Tom Ritchford
fd03c3297c Fix dangling pointer in websocketpp/error.hpp. 2015-05-29 13:45:07 -04:00
wilsonianb
ffd2e884f2 Clean up LedgerConsensus log message
Add missing space and use consistent pluralization.
2015-05-29 13:44:59 -04:00
Nik Bougalis
0d700d9833 Unsubscribe from normal data feeds on destruction 2015-05-29 13:44:52 -04:00
Nik Bougalis
dd902292ed Consensus cleanup:
* Inject dependencies, make functions free and levelize
* Add comments to document the intent behind the code
* Reduce class public interfaces
* Remove support for proposals without ledger hashes
2015-05-29 13:44:44 -04:00
seelabs
1b4e0f5f48 Tidying & Selectively forward manifests to peers:
* Do not forward manifests to peers that already know that manifest
* Do not forward historical manifests to peers
* Save/Load ValidatorManifests from a database
* Python test for setting ephmeral keys
* Cleanup manifest interface
2015-05-28 08:16:56 -07:00
Tom Ritchford
31d352b3aa Productionize manifest generator.
* Better output.
* Better error checking and reporting.
* Clearer names.
* Python style.
2015-05-28 07:22:34 -07:00
Tom Ritchford
c26b8124e5 Add original manifest.py. 2015-05-28 07:22:34 -07:00
Tom Ritchford
6bf7de2415 Add ecdsa Python library. 2015-05-28 07:22:33 -07:00
Tom Ritchford
18c51f4e4a Add ed25519 Python library. 2015-05-28 07:22:33 -07:00
Tom Ritchford
adf4860988 Move Python code to its own directory. 2015-05-28 07:22:33 -07:00
Josh Juran
0dd6b95ac2 Add Validator Manifests (RIPD-772):
A Validator Manifest allows validators to use a generated ed25519
secret key as a master key for generating new validator public/secret
key pairs. Using this mechanism, rippled instances trust the master
ed25519 public key instead of the now-ephemeral validator public key.

Through a new message and propagation scheme, this lets a validator
change its ephemeral public key without requiring that all rippled
instances on the network restart after maintaining the configuration
file.
2015-05-28 07:22:32 -07:00
Vinnie Falco
41a840e776 Tidying:
* Add missing includes
* Use preincrement
* Rearrange some declarations
* Fix some comments
2015-05-28 07:21:08 -07:00
Josh Juran
7d75041fb1 Fixes to cryptographic containers:
* Include Sign.cpp in unity builds
* Fix AnySecretKey publicKey and sign
* Make AnyPublicKey copyable
* Define op != for Slice
* Overload op << for Slice
* Overload op << for KeyType
2015-05-27 13:25:20 -07:00
Vinnie Falco
6675ee7f5c Set version to 0.28.2-b3 2015-05-22 11:12:44 -07:00
Howard Hinnant
845c9f8a51 Change typedef to using.
Conflicts:
	src/ripple/app/TODO.md
	src/ripple/app/ledger/Ledger.h
	src/ripple/protocol/Protocol.h
2015-05-22 11:09:50 -07:00
Howard Hinnant
155fcdbcd0 Change typedef to using.
Conflicts:
	src/ripple/app/TODO.md
	src/ripple/app/ledger/Ledger.h
	src/ripple/protocol/Protocol.h
2015-05-22 11:09:50 -07:00
Vinnie Falco
52f298f150 Tidy up app unity sources 2015-05-22 10:58:16 -07:00
Vinnie Falco
860ab3523c Refactor Ledger:
* Consolidate constructors
* Use pointer/size instead of Serializer
* Factor out PendingSaves
* Make some members free functions
* Reduce size of constructor initializer lists
2015-05-22 10:58:04 -07:00
Nik Bougalis
36ac3bc672 Set version to 0.28.2-b2 2015-05-21 14:51:46 -07:00
crazyquark
fc9ab12bf9 Add build instructions for Eclipse CDT + SConsolidator plugin. 2015-05-21 14:51:46 -07:00
Miguel Portilla
b39c1eb92c Require port in ips (RIPD-893) 2015-05-21 14:51:46 -07:00
JoelKatz
6994423a49 Don't consider broken peers candidates for history 2015-05-21 14:51:46 -07:00
JoelKatz
172e967a73 Latency-aware fetch pack target selection 2015-05-21 14:51:46 -07:00
Nik Bougalis
6f5d8bba2d Reduce STAmount public interface (RIPD-867):
* Implement subtraction as addition to the additive inverse
* Do not allow comparison with, addition to or subtraction from integers
* Remove unused functions
* Convert member functions to free functions
* Isolate unit-test specific code into the unit test
2015-05-21 14:51:41 -07:00
Nik Bougalis
67b18e4bea Check the fee early and return an error if it's malformed 2015-05-21 14:50:49 -07:00
Vinnie Falco
9ad5644a8c Reduce thread count in static_initializer test (RIPD-864) 2015-05-20 13:24:13 -07:00
Vinnie Falco
e932ba591f Set version to 0.28.2-b1 2015-05-20 13:24:13 -07:00
Vinnie Falco
f58399d2f3 Reduce thread count in static_initializer test (RIPD-864) 2015-05-20 13:24:13 -07:00
Nik Bougalis
730cd5d513 Cleanup consensus helper functions:
* Reduce public class interfaces
* Use free functions when possible
* Add self-documenting function return values
* Simplify ledger close resolution calculations
2015-05-20 13:24:12 -07:00
Edward Hennis
e838b30def Integration test to validate the WS ledger results.
* Also replace a couple of magic values with the relevant Tuning param.
2015-05-20 13:24:12 -07:00
Howard Hinnant
dddcc09378 Restrict access to data members. 2015-05-20 13:24:12 -07:00
JoelKatz
5adb68bba4 Easier way to get the validated ledger index 2015-05-20 13:24:12 -07:00
Scott Schurr
d6ef66646f 2-level transaction multi-signatures (RIPD-182):
This commit provides support for 2-level multi-signing of
transactions.  The ability is usually compiled out, since other
aspects of multi-signing are not yet complete.

Here are the missing parts:

 o Full support for Tickets in transactions.
 o Variable fees based on the number of signers,
 o Multiple SignerLists with access control flags on accounts,
 o Enable / disable operations based on access control flags,
 o Enable / disable all of multi-signing based on an amendment,
 o Integration tests, and
 o Documentation.
2015-05-20 13:24:06 -07:00
Scott Schurr
cf1638e6de sign_for RPC command (RIPD-182):
The sign_for RPC command returns a field suitable for
signing a multi-signed transaction.  Actual multi-signed
transactions are in the next commit.
2015-05-20 13:23:59 -07:00
Scott Schurr
64ebd64d2b SignerListSet txn and InnerObjectFormats (RIPD-182):
Add support for the SignerListSet transaction as a step toward
multi-sign support.

As part of the SignerListSet implementation, add InnerObjectFormat
templates (similar to TxFormats and LedgerFormats) and enforce them
in STObject, STArray, and STParsedJSON.
2015-05-20 13:23:52 -07:00
Scott Schurr
92799187ed Improvements to protocol serialization:
A few serialization changes coming from m-of-n development:

 o Improve readability of SField.cpp.
 o Better initialization of STObject.
 o Trimming of STObject public methods.
 o Add STObject::getFieldObject and STObject::setFieldObject.
 o Make STObject::isEquivalent more robust.
 o Improvements to whitespace, overrides, and virtuals.
2015-05-20 12:34:20 -07:00
Vinnie Falco
2f3834359e Modularize app/tx:
* Move LedgerView declaration
* Move CrossType
* Move Clock declaration
* Move Quality to protocol/
* Move Amounts to protocol/
* Move book to tx/impl
* Remove 0.27 legacy support
* Remove unused AmountType
* Remove core namespace
* Use STAmount
2015-05-20 12:34:19 -07:00
Miguel Portilla
399c43cae6 Set version to 0.28.1 2015-05-20 13:34:29 -04:00
Tom Ritchford
80acbe6f6b Change ArchLinux/PKGBUILD to have correct ripple build line. 2015-05-20 13:29:54 -04:00
Miguel Portilla
d90ba775e8 Require port in ips_fixed (RIPD-892) 2015-05-20 13:24:21 -04:00
Miguel Portilla
ea4161d880 Change example configuration protocol on loopback IP (RIPD-886) 2015-05-20 13:24:04 -04:00
Torrie Fischer
172a060330 circle: docker: Don't tag branches if its a PR (PKG-33) 2015-05-20 13:23:38 -04:00
Nik Bougalis
231efb5aa5 Set version to 0.28.1-rc3 2015-05-18 13:00:15 -07:00
JoelKatz
079475e491 Only touch InboundLedgers on success so failed acquires can expire 2015-05-18 13:00:15 -07:00
Tom Ritchford
aa775b4d3d Clean up rippled-example.cfg and update for new node_db settings 2015-05-18 13:00:00 -07:00
Nik Bougalis
216c8125e2 Expedite zero flow handling 2015-05-18 12:52:03 -07:00
Vinnie Falco
c61d0c663e Merge branch 'master' into develop 2015-05-13 13:29:54 -07:00
Nik Bougalis
0187c6a5a1 Set version to 0.28.0-hf2 2015-05-13 13:21:32 -07:00
Nik Bougalis
8289d4140a Correctly clamp when the taker balance is the limiting factor 2015-05-13 13:21:26 -07:00
Vinnie Falco
c7118a183a Set version to 0.28.1-rc2 2015-05-13 12:41:04 -07:00
JoelKatz
b1881e798b Control query depth based on latency:
This changes TMGetLedger protocol in a backward-compatible way to include
a "query depth" parameter - the number of extra levels in the SHAMap tree
that a server should return in the corresponding TMLedgerData. Depending
on the value or absence of the field, a server may adjust the amount of
returned data based on the observed latency of the requestor: higher
latencies will return larger data sets (to compensate for greater
request/response turnaround times).
2015-05-13 12:40:16 -07:00
Nik Bougalis
d44230b745 Correctly clamp when the taker balance is the limiting factor 2015-05-13 12:40:09 -07:00
Vinnie Falco
7b417b9d51 Set version to 0.28.1-rc1 2015-05-12 17:21:48 -07:00
Vinnie Falco
cc05e5727d Merge release into develop 2015-05-12 17:20:43 -07:00
Vinnie Falco
764a8f2644 Set version to 0.28.1-b10 2015-05-12 12:47:56 -07:00
JoelKatz
a15785eb64 Reduce severity of some logging messages 2015-05-12 12:47:56 -07:00
Vinnie Falco
688f8c5f3f Add historical ledger fetches per minute to get_counts 2015-05-12 12:47:56 -07:00
Vinnie Falco
dde5ccf7fa Add DecayWindow implementation 2015-05-12 12:47:55 -07:00
Vinnie Falco
d5a6313c71 Add RangeSet::lebesgue_sum 2015-05-12 09:50:12 -07:00
Vinnie Falco
f030aab759 Set version to 0.28.1-b9 2015-05-11 18:14:45 -07:00
JoelKatz
4393f98a2c History fetch changes:
* Don't pollute ledger cache with history
* Avoid race condition when getting ledger sequence numbers
* Make fetch packs larger
2015-05-11 18:14:45 -07:00
JoelKatz
c377d6c94b InboundLedgers improvements:
* Change findCreate to acquire
* Return Ledger rather than InboundLedger
2015-05-11 18:14:45 -07:00
JoelKatz
16aa015682 Fix off-by-one error in SHAMapNodeID:
Limit is 64 inner nodes at depth 0-63, and one leaf at depth 64
2015-05-11 18:14:45 -07:00
Miguel Portilla
9cded76cf0 Fix RPC ledger synchronization requirements:
* Better rules specific to each lookup case:
* By hash: Any ledger found by hash is valid.
* By numeric index: If rippled is out of sync, and the index is after the
* validated ledger, return "InsufficientNetworkMode" error.
* By named index: If rippled is out of sync, or closed/current is requested and significantly older than the validated ledger, return "InsufficientNetworkMode" error.
2015-05-11 18:14:45 -07:00
Vinnie Falco
4ad07bb6b2 Fix hops adjustment for validations 2015-05-11 18:14:45 -07:00
David Schwartz
d0b28a6700 Compute validated ledger age from signing time 2015-05-11 18:14:39 -07:00
Vinnie Falco
18299c3f7a Tidy up PeerSet:
* Move PeerSet to overlay/
* Remove unused functions
* Make some public members private
* Rename some functions
* Add comments
2015-05-11 12:06:14 -07:00
Miguel Portilla
ca07a1230b Add filtering to Account Objects (RIPD-868) 2015-05-11 11:58:35 -07:00
Edward Hennis
e0ad66d967 Fail Travis if scons vcxproj produces differences 2015-05-11 11:56:45 -07:00
seelabs
5615c4a2a7 Force scons to include soci version file:
Running `scons vcxproj` will sometimes include
soci's version.h and sometimes it will not. This
patch forces it to always include the file.
2015-05-11 11:56:42 -07:00
Nik Bougalis
d7fbef6764 Set version to 0.28.1-b8 2015-05-06 14:00:34 -07:00
JoelKatz
e95bda3bdf Peer latency tracking (RIPD-879):
Track peer latency, report in RPC, make peer selection for
fetching latency aware.

This also cleans up the PeerImp timer to minimize
resetting. Indirect routing is made latency-aware as well.
2015-05-06 13:38:59 -07:00
JoelKatz
c010a85ef5 Check the correct progress flag on transaction root node receipt 2015-05-06 13:38:59 -07:00
MarkusTeufelberger
798d36efcf Fix typo in LedgerMaster.cpp 2015-05-06 13:25:50 -07:00
Nik Bougalis
2d44c8568f Eliminate need for ledger in delivered_amount calculation (RIPD-860) 2015-05-06 13:25:50 -07:00
Nik Bougalis
7232bdb40c Reduce PeerFinder log verbosity 2015-05-06 13:25:50 -07:00
David Schwartz
45f092488a Simplify InboundLedger expiration (RIPD-873)
Let sweep logic remove obsolete ledger requests.
Touch inbound ledgers to prevent sweeping on requests.
Update sequence number if possible.
2015-05-06 13:25:50 -07:00
JoelKatz
4244e1070d Improvements to STParsedJSON:
* Cleanups and reduction of copying
* Add STArray::back, operator[], push_back(&&)
* Add make_stvar
* Rework STParsedJSON
* Fix code and unit tests that use STParsedJSON
* STTx move constructor
2015-05-06 13:11:24 -07:00
Nik Bougalis
5a7fa8cfa9 Reduce STAmount public interface (RIPD-867):
The STAmount class includes a number of functions which serve as thin
wrappers, which are unused or used only in one place, or which break
encapsulation by exposing internal implemenation details. Removing
such functions simplifies the interface of the class and ensures
consistency.

* getSNValue and getNValue are now free functions
* canonicalizeRound is no longer exposed
* Removed addRound and subRound
* Removed overloads of multiply, mulRound, divide and divRound
2015-05-06 13:11:24 -07:00
Josh Juran
daf4f8fcde Remove wallet_accounts and generator maps (RIPD-804):
* Remove the deprecated wallet_accounts command.
 * Remove dead code for generator maps.
 * Remove the help for the obsolete wallet_add and wallet_claim commands
   (which have already been removed).
2015-05-06 13:11:24 -07:00
Miguel Portilla
d182d1455e Relax RPC ledger synchronization requirements (RIPD-27, RIPD-840):
This enhances the reporting capability of RPC::LookupLedger and reduces
the requirement of a current ledger for many RPC commands.

The perceived up-time of client handlers improves since requests will
not depend on the server being fully synced.
2015-05-06 13:10:47 -07:00
Vinnie Falco
dc2260adbe Set version to 0.28.1-b7 2015-04-29 16:44:47 -07:00
Vinnie Falco
83a01e0c7d Set hopsAware version cutoff to 0.28.1-b7 2015-04-29 16:44:05 -07:00
Tom Ritchford
53c1269ebd Set version to 0.28.1-b6 2015-04-29 14:34:54 -04:00
Nik Bougalis
f8bfe3a550 Terminate process on SIGINT in all cases 2015-04-29 14:34:54 -04:00
Vinnie Falco
90bb53af20 Structured Overlay support for TTL limited messages:
When the [overlay] configuration key "expire" is set to 1, proposals
and validations will include a hops field. The hops is incremented with
each relay. Messages with a hop count will be dropped when they exceed
the TTL (Time to Live). Messages containing a hops field will not be
relayed or broadcast to older versions of rippled that don't understand
the field.

This change will not affect normal operation of the network or rippled
instances that do not set "expire" to 1.
2015-04-29 14:34:54 -04:00
Vinnie Falco
ef1604a729 Tidy up aged container declarations 2015-04-29 14:34:53 -04:00
Vinnie Falco
c77a2f335a Tidy up some business logic:
* Add OverlayImpl::for_each to tidy up some call sites
* Add comment about computing the unique ID for message routing
* Remove unused code
2015-04-29 14:34:53 -04:00
Vinnie Falco
8e34a1f6a7 Tidy up aged container declarations 2015-04-29 14:34:53 -04:00
Tom Ritchford
2564b62f5c Fix C++ style issues.
* Restrict files to 80 columns.
* Function names in GenerateDeterministicKey now start with lower case.
* Remove deprecated boost::format calls.
2015-04-29 14:34:53 -04:00
seelabs
a7598c5610 Remove unused database table (RIPD-755) 2015-04-29 14:34:52 -04:00
seelabs
8377f2516b Cache and apply account credits after payment processing (RIPD-821):
Credits made to any account during the processing of a payment are delayed until
the payment completes, enforcing a new invariant: liquidity for any paths
during a payment's execution may never increase. This eliminates the need for special
code to handle a variety of corner cases where consuming liquidity in one path
increases liquidity in others.
2015-04-29 14:34:52 -04:00
Vinnie Falco
7efd0ab0d6 Set version to 0.28.0 2015-04-24 18:57:36 -07:00
Vinnie Falco
14d38a1a8d Fix --rpc_ip and --rpc_port (RIPD-679)
This reverts commit 2b040569e7.
2015-04-24 18:57:04 -07:00
seelabs
c8447c190c Report the inbound listening port during crawl (RIPD-866) 2015-04-24 18:55:53 -07:00
Mark Travis
aa5d16b3d8 Skip inefficent SQL query (RIPD-870):
For large data sets the JOIN may not make forward progress in time.
This prevents the deletion of those entries in the database during
online delete. The number of such entries is very small compared to
the total size of the data anyway. A future version will address
this more thoroughly.
2015-04-24 18:55:49 -07:00
Vinnie Falco
fd1135315c Set version to 0.28.1-b5 2015-04-24 18:44:30 -07:00
Vinnie Falco
98c915b2ca Fix --rpc_ip and --rpc_port (RIPD-679)
This reverts commit 2b040569e7.
2015-04-24 18:44:30 -07:00
seelabs
9114f3d2e6 Report the inbound listening port during crawl (RIPD-866) 2015-04-24 18:19:10 -07:00
Mark Travis
5b0109055d Skip inefficent SQL query (RIPD-870):
For large data sets the JOIN may not make forward progress in time.
This prevents the deletion of those entries in the database during
online delete. The number of such entries is very small compared to
the total size of the data anyway. A future version will address
this more thoroughly.
2015-04-24 17:21:27 -07:00
Tom Ritchford
5a3168c9ff Set version to 0.28.1-b4 2015-04-23 16:47:23 -04:00
seelabs
a14f29f84f Remove obsolete code 2015-04-23 16:47:23 -04:00
Tom Ritchford
6c1190a361 Remove unnecessary thread in Soci (RIPD-862). 2015-04-23 16:47:22 -04:00
Howard Hinnant
100a76f0e8 Remove nested types SField::ref and SField::ptr...
* This silences a warning about a redundant cv-qualifier.
* This makes future coding mistakes about redundant
  cv-qualifiers much less likely.
* This makes the code easier to read.
2015-04-23 16:47:22 -04:00
JoelKatz
47482acf83 In consensus, get relative times from a steady clock (RIPD-859)
Using the system clock to get relative times for consensus
timing can result in performance issues if the system time
changes frequently.
2015-04-23 16:47:21 -04:00
seelabs
1185103a3d Fix ownership of memory buffers in StatsDCollector (RIPD-756):
* Ownership of buffer memory in StatsDCollector is passed to the
boost::asio callback function. Before this, the memory may have been
freed before async_send was finished with the memory.
2015-04-23 16:47:20 -04:00
Nik Bougalis
54ef4ee6ef Reduce severity level of offer cancellation logging 2015-04-23 16:47:20 -04:00
seelabs
2389abc295 Fix ownership of memory buffers in StatsDCollector (RIPD-756):
* Ownership of buffer memory in StatsDCollector is passed to the
boost::asio callback function. Before this, the memory may have been
freed before async_send was finished with the memory.
2015-04-23 16:47:20 -04:00
Nik Bougalis
67c666b033 Clean up LedgerEntrySet and TransactionEngine:
* Reduce public interfaces
* Remove wrapper functions
* Remove freeze timed cutover code
* Return results directly instead of via ref parameters
2015-04-23 16:47:19 -04:00
Vinnie Falco
5ce3ed3555 Set version to 0.28.1-b3 2015-04-21 14:01:44 -07:00
Nik Bougalis
d30b32fcde Set TX processing change date to 2015-05-12 13:00:00PDT 2015-04-21 14:01:25 -07:00
Miguel Portilla
568e4cebda Fix check for current ledger ID in RPC 2015-04-21 14:01:18 -07:00
Tom Ritchford
29d644e9d3 Fix WebSockets treatment of ping timer:
This solves a problem that caused a hang on shutdown related to
the lifetime of the ping timer completion handlers used in WebSockets.

* Turn the ping timer back on
* Use std::weak_ptr for WebSockets timer callbacks.
* Disable WebSocket pings if frequency in the .cfg is non-positive.
2015-04-21 14:01:13 -07:00
Torrie Fischer
2dbb7301fb Fix circleci 2015-04-21 14:01:09 -07:00
seelabs
d2cba1c54f Tidy up SQLite table creation:
* Check if tables and indexes exist
* Remove commands for unused table
2015-04-21 14:01:05 -07:00
seelabs
6a0c26a709 Fix return value when looking up non existent transactions 2015-04-21 14:01:00 -07:00
JoelKatz
e44ae6af93 Give ledger data requests their own job type:
This gives requests for ledger data (and transaction set data)
from peers a separate job type and prioritizes it appropriately.
Previously it was lumped in with fetch packs which have a low
concurrency limit. This should improve the performance of
retrieving historical information.
2015-04-21 14:00:54 -07:00
Vinnie Falco
837b0799ac Set version to 0.28.0-rc3 2015-04-21 13:48:39 -07:00
Nik Bougalis
bc85a8b24f Set TX processing change date to 2015-05-12 13:00:00PDT 2015-04-21 13:48:38 -07:00
Miguel Portilla
15d68649d5 Fix check for current ledger ID in RPC 2015-04-21 13:48:30 -07:00
Tom Ritchford
e0d96ae807 Fix WebSockets treatment of ping timer:
This solves a problem that caused a hang on shutdown related to
the lifetime of the ping timer completion handlers used in WebSockets.

* Turn the ping timer back on
* Use std::weak_ptr for WebSockets timer callbacks.
* Disable WebSocket pings if frequency in the .cfg is non-positive.
2015-04-21 12:26:11 -07:00
Torrie Fischer
3aa39ced60 Fix circleci 2015-04-21 12:23:23 -07:00
seelabs
1f1c0618e1 Tidy up SQLite table creation:
* Check if tables and indexes exist
* Remove commands for unused table
2015-04-21 12:21:27 -07:00
seelabs
7788aa25b5 Fix return value when looking up non existent transactions 2015-04-21 12:20:53 -07:00
JoelKatz
d5b460a85c Give ledger data requests their own job type:
This gives requests for ledger data (and transaction set data)
from peers a separate job type and prioritizes it appropriately.
Previously it was lumped in with fetch packs which have a low
concurrency limit. This should improve the performance of
retrieving historical information.
2015-04-21 12:15:59 -07:00
Vinnie Falco
9019f3a4f2 Set version to 0.28.1-b2 2015-04-20 15:57:02 -07:00
seelabs
006020aef2 Support for boost 1.58 2015-04-20 15:55:48 -07:00
seelabs
dfda0d566a Support for boost 1.58 2015-04-20 15:55:48 -07:00
Vinnie Falco
99c2fac143 STVar: optimized storage for STObject (RIPD-825):
This introduces the STVar container, capable of holding any STBase-derived
class and implementing a "small string" optimization. STObject is changed
to store std::vector<STVar> instead of boost::ptr_vector<STBase>. This
eliminates a significant number of needless dynamic memory allocations and
deallocations during transaction processing when ledger entries are
deserialized. It comes at the expense of larger overall storage requirements
for STObject.
2015-04-20 15:54:26 -07:00
Nicholas Dudfield
4c5308da8d Update account_objects test:
* Use Request over json-rpc
* Use lodash to filter irrelevant fields from expectations
* Use LedgerState for state setup
* Test using limit and marker

Conflicts:
	test/account_objects-test.js
2015-04-20 15:54:14 -07:00
Miguel Portilla
4d0ed3d857 RPC account_objects (RIPD-777)
General RPC command that can retrieve objects in the account root.
  * Add account objects integration test.
  * Support tickets.

* Add removeElement in Json::Value
2015-04-20 15:54:09 -07:00
Vinnie Falco
0b5582ed0d Disable redundant ping timer 2015-04-20 15:52:38 -07:00
Tom Ritchford
17734f833c Revert "Checkpoint SOCI exactly every 1000 pages."
This reverts commit e874a2624f.
2015-04-20 15:52:33 -07:00
Vinnie Falco
98a9d5d424 Lower the severity of some PeerFinder logging 2015-04-20 15:52:29 -07:00
Vinnie Falco
6d74f36449 Fix Crawl handshake header parsing in Overlay 2015-04-20 15:52:20 -07:00
Vinnie Falco
22d08b70ec Fix beast::ci_equal 2015-04-20 15:52:16 -07:00
Vinnie Falco
47a5bf6aa5 Fix beast::ci_equal 2015-04-20 15:52:16 -07:00
Vinnie Falco
2805e9eb3b Set version to 0.28.0-rc2 2015-04-20 15:19:07 -07:00
Vinnie Falco
72a1a86886 Disable redundant ping timer 2015-04-20 13:42:00 -07:00
Tom Ritchford
ec190bae33 Revert "Checkpoint SOCI exactly every 1000 pages."
This reverts commit e874a2624f.
2015-04-20 11:01:23 -07:00
Vinnie Falco
83003e43d7 Lower the severity of some PeerFinder logging 2015-04-20 11:01:20 -07:00
Vinnie Falco
3b20dc2994 Fix Crawl handshake header parsing in Overlay 2015-04-20 11:00:03 -07:00
Vinnie Falco
a7198298e7 Fix beast::ci_equal 2015-04-20 10:59:58 -07:00
Vinnie Falco
f3d76d5780 Set version to 0.28.1-b1 2015-04-17 11:43:51 -07:00
Vinnie Falco
e2305c3c5e Merge branch 'release' into develop
Conflicts:
	Builds/rpm/rippled.spec
	src/ripple/protocol/impl/BuildInfo.cpp
2015-04-17 11:43:09 -07:00
Vinnie Falco
ba737d7e58 Set version to 0.28.0-rc1 2015-04-17 11:41:50 -07:00
Vinnie Falco
88f69204c8 Merge 0.28.0-b21 into release 2015-04-17 11:41:17 -07:00
Vinnie Falco
bb4561c2b8 Set version to 0.28.0-b22 2015-04-16 11:31:57 -07:00
seelabs
4710f764e4 Quiet unused variable warning 2015-04-16 11:31:57 -07:00
JoelKatz
11a59a767e Adjust cache parameters for 'huge' node size 2015-04-16 11:31:54 -07:00
Miguel Portilla
4cf3157aad Set version to 0.28.0-b21 2015-04-14 18:54:31 -04:00
Miguel Portilla
b1f6cb349b Improved parsing of universal port configuration settings (RIPD-856) 2015-04-14 18:51:53 -04:00
David Schwartz
0c134582ca Track peer "sanity" (RIPD-836)
* Each peer has a "sane/insane/unknown" status
* Status updated based on peer ledger sequence
* Status reported in peer json
* Only sane peers preferred for historical ledgers
* Overlay endpoints only accepted from known sane peers
* Untrusted proposals not relayed from insane peers
* Untrusted validations not relayed from insane peers
* Transactions from insane peers are not processed
* Periodically drop outbound connections to bad peers
* Bad peers get bootcache valence of zero

Peer "sanity" is based on the ledger sequence number they are on.  We
quickly become able to assess this based on current trusted validations.
We quarrantine rogue messages and disconnect bad outbound connections to
help maintain the configured number of good outbound connections.
2015-04-14 18:51:52 -04:00
Nik Bougalis
acf2833362 Set version to 0.28.0-b20 2015-04-13 10:24:47 -07:00
Nik Bougalis
20f9971096 Finalize date for switchover to 0.28.0 processing semantics 2015-04-13 10:24:47 -07:00
Nik Bougalis
cefeaceef0 Signal error for incorrect configuration during unit test 2015-04-13 10:24:47 -07:00
Howard Hinnant
1ba7c4b6ee Remove unneeded member initializer:
* This works around a clang bug.
* Also un-commented correctly deleted copy members.
2015-04-13 10:24:47 -07:00
Vinnie Falco
1b49776819 Add fetchBatch Backend interface 2015-04-10 19:14:57 -07:00
Vinnie Falco
41c68f4bbc Use static_initializer in KnownFormats singleton 2015-04-10 19:14:57 -07:00
Nik Bougalis
56ac830405 Refund owner's ticket reserve when a ticket is canceled (RIPD-855) 2015-04-10 19:12:51 -07:00
Nik Bougalis
ebcf821d81 Return descriptive error from account_currencies RPC (RIPD-806):
The 'account_index' field is expected to be an integer. If something
else is specified, the error message should clearly indicate which
field is at fault.
2015-04-10 19:11:28 -07:00
Tom Ritchford
e874a2624f Checkpoint SOCI exactly every 1000 pages. 2015-04-10 19:11:28 -07:00
Tom Ritchford
03d1c0ed21 Clean SOCI code.
* Throw exception rather than SEGV.
* Hide details of checkpointing from clients.
* Restrict to 80 columns and minor style tweaks.
2015-04-10 19:11:28 -07:00
Tom Ritchford
1b8c77eee0 Allow logging to be used outside the ripple namespace.
* Split logging macros over multiple lines.
* Restrict Log.h to 80 columns.
2015-04-10 19:11:28 -07:00
Tom Ritchford
d575cd50b1 Clean up Sustain.h and Sustain.cpp.
* Bring out magic numbers.
  * Get rid of boost::format.
2015-04-10 19:11:28 -07:00
Tom Ritchford
2b040569e7 Remove deprecated flags --rpc_ip and --rpc_port. 2015-04-10 19:11:28 -07:00
Miguel Portilla
7a53f86fff Compare current seq vs validated (RIPD-669) 2015-04-10 19:11:28 -07:00
Torrie Fischer
a90bb53cd2 Drop nexmo SMS support. Reverts 58b3cc1d. 2015-04-10 19:11:27 -07:00
Tom Ritchford
b450d62138 Port to Python: Build and run tests for multiple build configurations. 2015-04-10 19:11:27 -07:00
seelabs
ab77e36c70 Add workaround include for Windows.h NOMINMAX 2015-04-10 19:00:45 -07:00
Nik Bougalis
1a9d65c52a Set version to 0.28.0-b19 2015-04-10 19:00:45 -07:00
seelabs
05f4746bbe Add workaround include for Windows.h NOMINMAX 2015-04-10 19:00:45 -07:00
seelabs
a2530de06a Safer macro restoration using MSVC extensions 2015-04-10 19:00:34 -07:00
seelabs
1c587723fa Safer macro restoration using MSVC extensions 2015-04-10 19:00:34 -07:00
Nik Bougalis
b2a9c79de5 Fix transaction enumeration in account_tx (RIPD-734):
In some corner cases, an incorrect resume marker could be
returned, preventing the complete enumeration of account
transactions.

* Robust markers via improved paging support
* New unit tests
* Cleanup
2015-04-10 19:00:22 -07:00
Nik Bougalis
64259c7bcb Better transaction analysis (RIPD-755):
The analysis of differences between locally built ledgers and consensus
ledgers is now more intelligent. Differences in these values will be
categorized:

 - Operation results
 - Transaction ordering
 - Generated metadata
2015-04-10 18:58:52 -07:00
Nik Bougalis
a7efdb4e52 Improve version switchover semantics:
* Support PreviousTxnID until the switchover
* Implement "No Ripple" for issue_iou and redeem_iou.
* Do not utilize issue_iou and redeem_iou from legacy code
* Rename 0.27.x legacy files to account for VS build process
* Misc. cleanups
2015-04-10 18:56:52 -07:00
Tom Ritchford
091ff0cce0 Set version to 0.28.0-b18 2015-03-31 21:50:45 -04:00
seelabs
7e25a3a942 Fix SQL in online delete cleanup:
* SQL statement is corrected to perform an implicit JOIN
* Add unit test
2015-03-31 21:50:45 -04:00
Nik Bougalis
b3254e2b18 Remove unsupported proof-of-work command parsing 2015-03-31 21:50:44 -04:00
JoelKatz
9a0fa79144 Fix duplication of full below cache and tree node cache 2015-03-31 21:50:43 -04:00
JoelKatz
352db260b2 STArray optimization 2015-03-31 21:50:43 -04:00
Nik Bougalis
f072b5b679 Avoid copying and improve optimization opportunities 2015-03-31 21:50:43 -04:00
Vinnie Falco
c7c7084423 NuDB: Enforce pool_thresh minimum of 1:
pool_thresh is prevented from going to zero. This solves a problem when
using callgrind where the CPU is monopolized, causing operations that
should complete quickly to take days.
2015-03-31 21:50:42 -04:00
JoelKatz
b4058a813b Small changes to improve transaction benchmarking:
* Set transaction valid in hash router correctly
* Properly account for root nodes in walkLedger
* If loaded ledger is insane, log details
* Extra logging while loading replay ledger
* Don't test unsigned transactions expecting them to succeed
* Don't be too noisy about signature failures
2015-03-31 21:50:42 -04:00
Vinnie Falco
b27e152ead NuDB: Enforce pool_thresh minimum of 1:
pool_thresh is prevented from going to zero. This solves a problem when
using callgrind where the CPU is monopolized, causing operations that
should complete quickly to take days.
2015-03-31 21:50:42 -04:00
Tom Ritchford
936e83759d Remove three warnings. 2015-03-31 21:50:41 -04:00
Tom Ritchford
18fdc175c6 Clean structure of RPC::addPaymentDeliveredAmount 2015-03-31 21:50:41 -04:00
JoelKatz
47c6ab0ced Reduce SHAMapTreeNode copying during SHAMap unsharing:
In some code paths, we bump the SHAMap sequence number
before we unshare. This forces SHAMapTreeNode to be
copied. By making the ledger immutable we cause the
unsharing to occur earlier, eliminating the copies.
2015-03-31 21:50:40 -04:00
seelabs
4868135d47 Improve build times:
* Get classic & unity sources once only
* Use MD5-Timestamp
* Use implicit cache for specific debug builds
* Skip prep work for targets what will not be built
2015-03-31 21:50:39 -04:00
Miguel Portilla
5e70db651d Improved local tx error messages (RIPD-720)
Failed local built transactions report the specific error.
2015-03-31 21:50:39 -04:00
David Schwartz
1fedede771 Remove transaction set acquire logic from consensus object
This creates a new InboundTransactions object that handles transaction sets,
removing this responsibility from the consensus object. The main benefit is
that many inbound transaction operations no longer require the master lock.

Improve logic to decide which peers to query, when to add more peers, and
when to re-query existing peers.
2015-03-31 21:50:38 -04:00
seelabs
00596f1436 Reduce memory allocation, remove some functions in Serializer. 2015-03-31 21:50:37 -04:00
Nik Bougalis
db840b5604 Perform Transactor checks early (RIPD-751):
Certain checks that determine if a transaction is malformed can be performed
without needing to look up accounts or access the ledger.

Perform those checks as early as possible to optimize transaction processing.
2015-03-31 06:49:53 -07:00
Nik Bougalis
45070d0e51 Reduce Transaction public interface 2015-03-30 13:05:42 -07:00
Howard Hinnant
30121de963 Change several uses of std::list to alternative containers:
*  Performance motivated.
*  Several of these called size() which is O(N) in gcc-4.8.
*  Remove container copy from LedgerConsensusImp::playbackProposals().
*  Addresses RIPD-284.
2015-03-26 12:38:33 -04:00
Tom Ritchford
8a1081f9ef Set version to 0.28.0-b17 2015-03-26 12:38:33 -04:00
Howard Hinnant
fbf9c86c5c Remove unnecessary allocation/deallocation from masterLock
* Add make_lock.
* Rename Application::LockType to Application::MutexType:
* Rename getMasterLock to getMasterMutex.
* Use getMasterMutex and make_lock.
* Remove unused code.
2015-03-26 12:38:33 -04:00
seelabs
ac84e44161 Correct missing semicolons on sql statements 2015-03-26 12:38:33 -04:00
seelabs
836dfb6503 Do not log errors from initial database statements 2015-03-26 12:38:33 -04:00
Edward Hennis
35a8ce2349 Pathfinding unit tests:
* Refactor ripple path find to be more testable.
* Reimplements the first 4 tests from `tests\path-test.js`
* Verify balances in Ledger test.
2015-03-26 12:38:33 -04:00
Tom Ritchford
bb7d68b3b9 Add notes about Rippled's container classes. 2015-03-26 12:38:33 -04:00
Howard Hinnant
1979846e5e Change several uses of std::list to alternative containers:
*  Performance motivated.
*  Several of these called size() which is O(N) in gcc-4.8.
*  Remove container copy from LedgerConsensusImp::playbackProposals().
*  Addresses RIPD-284.
2015-03-26 12:38:33 -04:00
Howard Hinnant
a61ffab3f9 Remove unnecessary allocation/deallocation from masterLock
* Add make_lock.
* Rename Application::LockType to Application::MutexType:
* Rename getMasterLock to getMasterMutex.
* Use getMasterMutex and make_lock.
* Remove unused code.
2015-03-26 12:38:33 -04:00
Howard Hinnant
698fe73608 Move SHAMap hash computations from dirtyUp to walkSubTree
in order to reduce the total number of hash computations.
2015-03-26 12:38:33 -04:00
Josh Juran
0083c32629 Update VS project files 2015-03-26 12:38:33 -04:00
Nik Bougalis
f313caaa73 Set version to 0.28.0-b16 2015-03-19 07:55:19 -07:00
Edward Hennis
6e3f07ddce Remove unused / redundant functions. 2015-03-19 07:41:57 -07:00
Mark Travis
11d28c4856 Always increment payment pass counter 2015-03-19 07:41:57 -07:00
Nik Bougalis
e9394ca85a Implement "Default Ripple" logic in active direction:
When a balance change invokes trustCreate, we need to set the no ripple flag
if the "active" account's asfRippleDefault flag is cleared.
2015-03-19 07:41:57 -07:00
Nik Bougalis
9445a30e72 Implement "Default Ripple" logic in LedgerEntrySet::checkState 2015-03-19 07:41:57 -07:00
JoelKatz
185b1a3d36 Add noripple_check RPC command
To help gateways make the changes needed to adjust to the
"default ripple" flag, we've added the "noripple_check"
RPC command. This command tells gateways what they need
to do to set this flag and fix any trust lines created
before they set the flag.

Once your server is running and synchronized, you can run
the tool from the command line with a command like:
  rippled json noripple_check '
  {
    "account" : "<gateway_trusted_address_here>",
    "role" : "gateway",
    "transactions" : "true"
  }'

The server will respond with a list of "problems" that it
sees with the configuration of the account and its trust
lines. It will also return a "transactions" array suggesting
the transactions needed to fix the problems it found.
2015-03-19 07:41:57 -07:00
JoelKatz
1c2f5d60a5 Subscribe/Unsubscribe improvements:
* Don't acquire the master lock where it's not needed
* InfoSub tracks RT and validated accounts separately
* Correctly remove accounts from the InfoSub
2015-03-19 07:41:57 -07:00
JoelKatz
2f32910bef Reduce master lock scope in some RPC functions 2015-03-19 07:41:57 -07:00
JoelKatz
8de1b20bb5 Defer/avoid acquiring the master lock on proposals 2015-03-19 07:41:57 -07:00
David Schwartz
60a7abcef6 Decongest the master lock:
* Reduce scope of lock in ledger accept
* Remove duplicate tracking of transaction sets
* Need master lock to secure ledger sequencing
2015-03-19 07:41:57 -07:00
David Schwartz
e44e75fa6b Track and report peer load:
* PeerImp::charge only calls fail if dispatched from the peer
* Add "load" to output of RPC command "peer"
* Add Resource::Charge values for peer commands
* Impose some fee for every peer command
* Cleanup fee imposition
2015-03-19 07:41:57 -07:00
JoelKatz
ff7dc0b446 Reduce chatty log outputs 2015-03-19 07:41:57 -07:00
JoelKatz
f813cb2310 Tolerate LedgerSequence field in pseudo-transactions:
This will enable a forthcoming change to prevent pseudo-transactions
from reusing a transaction ID
2015-03-19 07:41:57 -07:00
JoelKatz
cba19d7e23 Document and cleanup ledger advance logic
* Don't acquire if validated ledger is old
* Don't try to publish if no valid ledger
* Update README.md file
2015-03-19 07:41:57 -07:00
Miguel Portilla
233127393f Better admin IP management in .cfg (RIPD-820):
* Deprecate rpc_admin_allow section from configuration file
* New port-specific setting 'admin':
  * Comma-separated list of IP addresses that are allowed administrative
    privileges (subject to username & password authentication if configured)
  * 127.0.0.1 is no longer a default admin IP.
  * 0.0.0.0 may be specified to indicate "any IP" but cannot be combined
    with other IP addresses.
2015-03-18 19:39:30 -07:00
Nicholas Dudfield
9479c0e12d Update uniport tests to use new config 2015-03-18 19:39:30 -07:00
Nicholas Dudfield
65c9c45ec6 Rename test file so npm test finds it 2015-03-18 19:39:30 -07:00
Miguel Portilla
6d79004d4f Better admin IP management in .cfg (RIPD-820):
* Deprecate rpc_admin_allow section from configuration file
* New port-specific setting 'admin':
  * Comma-separated list of IP addresses that are allowed administrative
    privileges (subject to username & password authentication if configured)
  * 127.0.0.1 is no longer a default admin IP.
  * 0.0.0.0 may be specified to indicate "any IP" but cannot be combined
    with other IP addresses.
2015-03-18 19:39:30 -07:00
seelabs
97623d20c5 Use soci in more places:
* Validator, peerfinder, SHAMapStore,
  RpcDB, TxnDB, LedgerDB, WalletDB use soci backend.
2015-03-18 19:39:26 -07:00
seelabs
d37802a42f Remove SqliteFactory. 2015-03-18 19:37:09 -07:00
seelabs
4a47ba9b35 Remove beast's sqdb module.
Conflicts:
	src/beast/beast/module/sqdb/api/backend.h
	src/beast/beast/module/sqdb/api/blob.h
	src/beast/beast/module/sqdb/api/into.h
	src/beast/beast/module/sqdb/api/session.h
	src/beast/beast/module/sqdb/api/statement.h
	src/beast/beast/module/sqdb/api/transaction.h
	src/beast/beast/module/sqdb/api/type_conversion_traits.h
	src/beast/beast/module/sqdb/api/use.h
	src/beast/beast/module/sqdb/detail/error_codes.h
	src/beast/beast/module/sqdb/detail/exchange_traits.h
	src/beast/beast/module/sqdb/detail/into_type.h
	src/beast/beast/module/sqdb/detail/once_temp_type.h
	src/beast/beast/module/sqdb/detail/prepare_temp_type.h
	src/beast/beast/module/sqdb/detail/ref_counted_prepare_info.h
	src/beast/beast/module/sqdb/detail/ref_counted_statement.h
	src/beast/beast/module/sqdb/detail/statement_imp.h
	src/beast/beast/module/sqdb/detail/type_conversion.h
	src/beast/beast/module/sqdb/detail/type_ptr.h
	src/beast/beast/module/sqdb/detail/use_type.h
	src/beast/beast/module/sqdb/sqdb.h
2015-03-18 19:37:08 -07:00
seelabs
9b837a24aa Remove beast's sqdb module.
Conflicts:
	src/beast/beast/module/sqdb/api/backend.h
	src/beast/beast/module/sqdb/api/blob.h
	src/beast/beast/module/sqdb/api/into.h
	src/beast/beast/module/sqdb/api/session.h
	src/beast/beast/module/sqdb/api/statement.h
	src/beast/beast/module/sqdb/api/transaction.h
	src/beast/beast/module/sqdb/api/type_conversion_traits.h
	src/beast/beast/module/sqdb/api/use.h
	src/beast/beast/module/sqdb/detail/error_codes.h
	src/beast/beast/module/sqdb/detail/exchange_traits.h
	src/beast/beast/module/sqdb/detail/into_type.h
	src/beast/beast/module/sqdb/detail/once_temp_type.h
	src/beast/beast/module/sqdb/detail/prepare_temp_type.h
	src/beast/beast/module/sqdb/detail/ref_counted_prepare_info.h
	src/beast/beast/module/sqdb/detail/ref_counted_statement.h
	src/beast/beast/module/sqdb/detail/statement_imp.h
	src/beast/beast/module/sqdb/detail/type_conversion.h
	src/beast/beast/module/sqdb/detail/type_ptr.h
	src/beast/beast/module/sqdb/detail/use_type.h
	src/beast/beast/module/sqdb/sqdb.h
2015-03-18 19:37:08 -07:00
seelabs
d0ef2f7dd8 Use soci in some places:
* Brings the soci subtree into rippled.
* Validator, peerfinder, and SHAMapStore use new soci backend.
* Optional postgresql backend for soci (if POSTGRESQL_ROOT env var is set).
2015-03-18 19:37:08 -07:00
seelabs
44932b170f Update sqlite3 to 3.8.8.2. 2015-03-18 19:37:03 -07:00
seelabs
c7cfd23580 Update sqlite3 to 3.8.8.2. 2015-03-18 19:37:03 -07:00
Vinnie Falco
9708a12607 Squashed 'src/soci/' content from commit 6e9312c
git-subtree-dir: src/soci
git-subtree-split: 6e9312c4bb3748907bd28d62c40feca42878cfef
2015-03-18 19:36:00 -07:00
Vinnie Falco
7cf1ec3f89 Merge commit '9708a1260720d879d76a10f894925962f20611bc' as 'src/soci' 2015-03-18 19:36:00 -07:00
Nik Bougalis
92812fe723 Set version to 0.27.4 2015-03-18 17:54:57 -07:00
JoelKatz
79417ac59a Limit passes in the payment engine to prevent endless looping:
This adds a limit of 1,000 passes to the payment engine. It protects against
possible cases where the execution of a pass fails to exhaust the liquidity
that made the pass possible or cases where two passes alternate providing
liquidity for each other.
2015-03-18 17:53:52 -07:00
Mark Travis
984f66e083 Don't VACUUM SQLite databases on startup with online delete enabled. 2015-03-18 17:53:42 -07:00
Tom Ritchford
ef2a436769 Set version to 0.28.0-b15 2015-03-16 20:54:17 -04:00
Edward Hennis
7f1a95550f Clean up unit test logs on success.
* Add a little bit of shell variable safety and tweak output.
2015-03-16 20:54:17 -04:00
seelabs
803f5b5613 Use buffer in STBlob 2015-03-16 20:54:15 -04:00
Nicholas Dudfield
8ca9fa1c26 Fix testutils.create_accounts
* Don't call ledger_wait inside parallel async loop
2015-03-16 20:54:14 -04:00
David Schwartz
3b3b897193 Add "Default Ripple" account flag and associated logic:
AccountSet set/clear, asfDefaultRipple = 8

AccountRoot flag, lsfDefaultRipple = 0x00800000

In trustCreate, set no ripple flag if appropriate.

If an account does not have the default ripple flag set,
new ripple lines created as a result of its offers being
taken or people creating trust lines to it have no ripple
set by that account's side automatically

Trust lines can be deleted if the no ripple flag matches
its default setting based on the account's default ripple
setting.

Fix default no-rippling in integration tests.
2015-03-16 20:54:14 -04:00
Torrie Fischer
6c364f63cc Build docker images on circleci based on travis.yml 2015-03-16 20:54:14 -04:00
seelabs
6b9e842ddd Replaces StringPairArray with Section in Config. 2015-03-16 20:54:13 -04:00
Nik Bougalis
8f88d915ba Support switchover from 0.27 to 0.28 processing semantics based on time:
Changes made to support autobridging and improve the offer-crossing and
pathfinding logic result in transaction-breaking changes which cause
incompatibilities between 0.27 and 0.28 builds of RippleD.

This patch simplifies deployment of 0.28 on the Ripple network by allowing
RippleD to emulate the 0.27 semantics while the last closed ledger closed
before March 30, 2015 at 13:00:00 PDT, after which time the new 0.28
semantics will become active.

The transaction-breaking changes addressed in this commit are:
    3ccbd7c9b2
    b203db27a4
2015-03-16 20:54:12 -04:00
JoelKatz
eaa1f47f00 Limit passes in the payment engine to prevent endless looping:
This adds a limit of 1,000 passes to the payment engine. It protects against
possible cases where the execution of a pass fails to exhaust the liquidity
that made the pass possible or cases where two passes alternate providing
liquidity for each other.
2015-03-16 20:54:11 -04:00
JoelKatz
cbeae85731 Fix specified destination issuer in pathfinding (RIPD-812)
* Compute the effective recipient.
* Make sure the effective recipient exists.
* Prohibit paths to the recipient, if not the effective recipient.
* Treat paths to the effective recipient as complete.
* Don't find looped paths.
* Use the effective recipient for getPathsOut weight.
2015-03-16 20:54:09 -04:00
Nik Bougalis
84e618b3f2 Improve pool seeding during startup:
* When starting up, we no longer rely just on the standard
  system RNG to generate entropy: we attempt to squeeze some
  from the execution state, and to recover any entropy that
  we had previously stored.

* When shutting down, if sufficient entropy has been accumulated
  attempt to store it for future use.
2015-03-16 20:54:08 -04:00
JoelKatz
382a16ff07 Avoid excess ledger header requests 2015-03-16 20:54:07 -04:00
JoelKatz
7bd339b645 Balance peer selection in getFetchPack 2015-03-16 20:54:07 -04:00
David Schwartz
70d8b2c4b7 getMissingNode performance and logging improvements 2015-03-16 20:54:07 -04:00
David Schwartz
3764a83c6b Ledger binary option
Conflicts:
	src/ripple/app/ledger/Ledger.cpp
	src/ripple/app/ledger/Ledger.h
	src/ripple/rpc/handlers/Ledger.cpp
2015-03-16 20:54:06 -04:00
Tom Ritchford
c3d200ddcd Set version to 0.28.0-b14 2015-03-13 11:21:02 -04:00
Tom Ritchford
44c5e337ab Remove obsolete comments from doc/CHANGELOG. 2015-03-13 11:21:02 -04:00
Nik Bougalis
040982e321 Only report 'delivered_amount' for executed payments (RIPD-827) 2015-03-13 11:21:00 -04:00
Nik Bougalis
6c81ea846c Calculate deep offer quality 2015-03-13 11:20:59 -04:00
Josh Juran
d082a0696d Support Ed25519 keys and signatures:
Recognize a new JSON parameter `key_type` in handlers for wallet_propose
and sign/submit.  In addition to letting the caller to specify either of
secp256k1 or ed25519, its presence prohibits the (now-deprecated) use of
heuristically polymorphic parameters for secret data -- the `passphrase`
parameter to wallet_propose will be not be considered as an encoded seed
value (for which `seed` and `seed_hex` should be used), and the `secret`
parameter to sign and submit will be obsoleted entirely by the same trio
above.

* Use constants instead of literals for JSON parameter names.
* Move KeyType to its own unit and add string conversions.
* RippleAddress
  * Pass the entire message, rather than a hash, to accountPrivateSign()
    and accountPublicVerify().
  * Recognize a 33-byte value beginning with 0xED as an Ed25519 key when
    signing and verifying (for accounts only).
  * Add keyFromSeed() to generate an Ed25519 secret key from a seed.
  * Add getSeedFromRPC() to extract the seed from JSON parameters for an
    RPC call.
  * Add generateKeysFromSeed() to produce a key pair of either type from
    a seed.
* Extend Ledger tests to cover both key types.
2015-03-12 21:53:59 -07:00
Nik Bougalis
f999839e59 Set version to 0.27.3-sp2 2015-03-12 13:37:47 -07:00
JoelKatz
f1bc662a24 Add noripple_check RPC command
To help gateways make the changes needed to adjust to the
"default ripple" flag, we've added the "noripple_check"
RPC command. This command tells gateways what they need
to do to set this flag and fix any trust lines created
before they set the flag.

Once your server is running and synchronized, you can run
the tool from the command line with a command like:
  rippled json noripple_check '
  {
    "account" : "<gateway_trusted_address_here>",
    "role" : "gateway",
    "transactions" : "true"
  }'

The server will respond with a list of "problems" that it
sees with the configuration of the account and its trust
lines. It will also return a "transactions" array suggesting
the transactions needed to fix the problems it found.
2015-03-12 13:37:06 -07:00
Nik Bougalis
232693419a Set version to 0.27.3-sp1 2015-03-11 10:26:39 -07:00
Nicholas Dudfield
ed66b951c6 Fix testutils.create_accounts
* Don't call ledger_wait inside parallel async loop
2015-03-11 10:25:27 -07:00
Nik Bougalis
70c2854f7c Set version to 0.27.3 2015-03-10 14:06:33 -07:00
David Schwartz
e9381ddeb2 Add "Default Ripple" account flag and associated logic:
AccountSet set/clear, asfDefaultRipple = 8

AccountRoot flag, lsfDefaultRipple = 0x00800000

In trustCreate, set no ripple flag if appropriate.

If an account does not have the default ripple flag set,
new ripple lines created as a result of its offers being
taken or people creating trust lines to it have no ripple
set by that account's side automatically

Trust lines can be deleted if the no ripple flag matches
its default setting based on the account's default ripple
setting.

Fix default no-rippling in integration tests.
2015-03-10 14:05:18 -07:00
Tom Ritchford
1b46e003c3 Set version to 0.28.0-b13 2015-03-09 17:49:39 -04:00
Howard Hinnant
4611d5a35f Remove unused SyncUnorderedMap 2015-03-09 17:49:39 -04:00
Nicholas Dudfield
2e59378ab7 Fix AppVeyor:
* Detect continuous integration environment via `CI` variable
* Use double quotes for build cache path
2015-03-09 17:49:39 -04:00
JoelKatz
fc8bf39043 Simplify tracking of recently requested ledger entries
Instead of tracking recently-requested entries from inbound
ledgers by node ID, track by hash. This allows state and
transaction entries to be tracked in the same set.
2015-03-09 17:49:38 -04:00
Vinnie Falco
0675c2b374 Fix gentex usage in nudb 2015-03-09 17:49:37 -04:00
Vinnie Falco
2cccd8ab28 Fix gentex usage in nudb 2015-03-09 17:49:37 -04:00
Vinnie Falco
bc5fcbbc88 Tidy up nudb:
* Define WIN32_LEAN_AND_MEAN before including Windows.h
* Remove unnecessary template argument
* Rename to identity
* Make identity default api codec
2015-03-09 17:49:37 -04:00
Vinnie Falco
d537ceedd6 Tidy up nudb:
* Define WIN32_LEAN_AND_MEAN before including Windows.h
* Remove unnecessary template argument
* Rename to identity
* Make identity default api codec
2015-03-09 17:49:37 -04:00
Tom Ritchford
ac7243b309 Remove unused static function. 2015-03-02 17:40:12 -05:00
Tom Ritchford
607e983f37 Set version to 0.28.0-b12 2015-03-02 16:50:01 -05:00
Mark Travis
02f7326b7e Remove orphan function. 2015-03-02 16:50:01 -05:00
Edward Hennis
b688f69031 Builds/test-only.sh will build and test by scons target.
* test-all.sh simplified to call test-only.sh.
* Script fails if build or tests fail. Allows chaining and git bisect run.
* Add copyright notice
* Ignore gprof performance data created by testing the profile builds.
2015-03-02 16:50:00 -05:00
Tom Ritchford
df41329df9 Replace "it's" with "its" in several places. 2015-03-02 16:49:59 -05:00
Tom Ritchford
0825bd7076 Cleanups to Json Object code.
* Replace Json::JsonException with std::logic_error.
* Move two functions definitions to Object.cpp.
* Fix include guards.
2015-03-02 16:49:56 -05:00
Tom Ritchford
e9b7003cf5 Move streaming Json objects to ripple/json. 2015-03-02 16:49:56 -05:00
Tom Ritchford
c5d673c426 Better integration between JsonObject and Json::Value. 2015-03-02 16:49:56 -05:00
Nik Bougalis
9cc8eec773 Set version to 0.27.2 2015-03-01 14:56:44 -08:00
Nik Bougalis
0b45535061 Calculate deep offer quality 2015-02-28 13:28:54 -08:00
Tom Ritchford
9f64ad8d89 Add WebSocket 04 interface.
* New WebSocket04 traits class implements strategies.
* New "websocket_version" configuration setting selects between 0.2 and 0.4.
2015-02-28 14:57:38 -05:00
Tom Ritchford
e5b0b7e9a7 Expose a method and add a handler in websocketpp.
* Expose websocketpp::transport::asio::connection::get_strand().
* Add new send_empty_handler to websocketpp::endpoint.
2015-02-28 14:57:38 -05:00
Tom Ritchford
9c3522cb70 Isolate WebSocket 0.2-specific code.
* Hide implementation details of the WebSocket server from clients.
* Extract a generic traits class.
2015-02-28 14:57:38 -05:00
Tom Ritchford
b357390215 Remove redundant post to strand in websocket. 2015-02-27 12:11:54 -05:00
Tom Ritchford
c66fc2f656 Rename all WebSocket code into one directory. 2015-02-27 12:11:54 -05:00
Tom Ritchford
64554aca6d Set version to 0.28.0-b11 2015-02-26 21:02:39 -05:00
Nik Bougalis
f1df9a02fa Fix declaration/implementation mismatches 2015-02-26 21:02:38 -05:00
JoelKatz
f3725bdd2e Return a validated ledger if there is one (RIPD-814)
LedgerMaster::getLedgerBySeq should return a validated
ledger (rather than the the open or closed ledger) for
a sequence number for which it has a fully-validated ledger.
2015-02-26 21:02:37 -05:00
Tom Ritchford
cb92b94d55 Remove unused variable. 2015-02-26 21:02:36 -05:00
Vinnie Falco
da21c77ae3 Support per-target ExcludeFromBuild in VSProject 2015-02-26 21:02:35 -05:00
Vinnie Falco
ef01f82e0c Add nounity targets to msvc projects 2015-02-26 21:02:35 -05:00
Vinnie Falco
4ba7ee8c92 Support per-target ExcludeFromBuild in VSProject 2015-02-26 21:02:35 -05:00
Howard Hinnant
c59633a588 Make SHAMap::fetchNodeFromDB const
When fetchNodeFromDB discovers a missing node in the database it
must reset the ledger sequence to 0.  By treating this as a logically
const operation, even though not physically const, many other member
functions can be made const, including compare.
2015-02-26 21:02:33 -05:00
Vinnie Falco
f56e37398c Always use HTTP handshaking in overlay:
Inbound and outbound peer connections always use HTTP handshakes to
negotiate connections, instead of the deprecated TMHello protocol
message.

rippled versions 0.27.0 and later support both optional HTTP handshakes
and legacy TMHello messages, so always using HTTP handshakes should not
cause disruption. However, versions before 0.27.0 will no longer be
able to participate in the overlay network - support for handshaking
via the TMHello message is removed.
2015-02-26 21:02:32 -05:00
Tom Ritchford
e43ffa6f2b Set version to 0.28.0-b10 2015-02-25 20:26:12 -05:00
Yana
6991bc9723 Spelling corrections 2015-02-25 20:26:12 -05:00
Miguel Portilla
9d6106a80b Require boost 1.57 2015-02-25 20:26:12 -05:00
Tom Ritchford
9e70404411 Get rid of compilation warning. 2015-02-25 20:26:12 -05:00
Nik Bougalis
bc48d299b6 Report server versions when crawling the overlay network 2015-02-25 20:26:12 -05:00
mDuo13
a8db5650a5 Add online_delete reminder to ledger_history in example cfg 2015-02-25 19:56:47 -05:00
Nicholas Dudfield
91871b418b Changes to Universal Port:
* Add tests
* Introduce requestRole helper
* Always honor admin=no
* Welcome guests anywhere admin privileges aren't required
2015-02-25 19:46:56 -05:00
Tom Ritchford
aaf98082e9 Set version to 0.28.0-b9 2015-02-24 20:28:43 -05:00
Tom Ritchford
ac228deeda Replace LEDGER_JSON_ macros with an enum. 2015-02-24 20:28:43 -05:00
Edward Hennis
fc661c83ef Build and run tests on all available build types
* Tests include unit and integration (npm)
2015-02-24 20:28:43 -05:00
Vinnie Falco
a2acffdfa3 New serialized object, public key, and private key interfaces
This introduces functions get and set, and a family of specialized
structs called STExchange. These interfaces allow efficient and
seamless interchange between serialized object fields and user
defined types, especially variable length objects.

A new base class template TypedField is mixed into existing SField
declarations to encode information on the field, allowing template
metaprograms to both customize interchange based on the type and
detect misuse at compile-time.

New types AnyPublicKey and AnySecretKey are introduced. These are
intended to replace the corresponding functionality in the deprecated
class RippleAddress. Specializations of STExchange for these types
are provided to allow interchange. New free functions verify and sign
allow signature verification and signature generation for serialized
objects.

* Add Buffer and Slice primitives
* Add TypedField and modify some SField
* Add STExchange and specializations for STBlob and STInteger
* Improve STBlob and STInteger to support STExchange
* Expose raw data in RippleAddress and Serializer
2015-02-24 20:28:43 -05:00
David Schwartz
79ce4ed226 Document cluster configuration and monitoring (RIPD-732) 2015-02-24 20:28:43 -05:00
Nik Bougalis
e3a7aa0033 Constrain valid inputs for memo fields (RIPD-712) 2015-02-24 20:25:34 -05:00
Vinnie Falco
95973ba3e8 Set version to 0.27.1 2015-02-24 13:31:13 -08:00
Vinnie Falco
49673c33b4 Use all parts of suite name to detect duplicates 2015-02-24 12:33:59 -05:00
Tom Ritchford
fde6303ae6 Set version to 0.28.0-b8 2015-02-24 12:33:59 -05:00
Miguel Portilla
c489975015 Display human readable SSL error codes 2015-02-24 12:33:59 -05:00
Vinnie Falco
b4a1948951 Use all parts of suite name to detect duplicates 2015-02-24 12:33:59 -05:00
Miguel Portilla
b927028416 Display human readable SSL error codes 2015-02-24 12:33:59 -05:00
Tom Ritchford
fe5d1ff6c5 Set version to 0.28.0-b7 2015-02-23 11:53:21 -08:00
Yana
1308656000 Update README.md file (RIPD-802) 2015-02-23 11:53:20 -08:00
Howard Hinnant
ec1e6b9385 Cleanup and simplifications to SHAMap:
SHAMapTreeNode
* Remove SHAMapTreeNode::pointer and SHAMapTreeNode::ref.
* Add std includes necessary to make the header standalone.
* Remove implementation from the SHAMapTreeNode declaration.
* Make clear what part of SHAMapTreeNode is:
  1) Truly public.
  2) Used only by SHAMap.
  3) Truly private to SHAMapTreeNode.

SHAMapItem
* Remove SHAMapItem::pointer and SHAMapItem::ref.
* Add std includes necessary to make the header standalone.
* Remove implementation from the SHAMapItem declaration.
* Make clear what part of SHAMapItem is:
  1) Truly public.
  2) Used only by SHAMapTreeNode.
  3) Truly private to SHAMapItem.

SHAMapSyncFilter
* Add override for SHAMapSyncFilter-derived functions.
* Add missing header.
* Default the destructor and delete the SHAMapSyncFilter copy members.

SHAMapNodeID
* Remove unused mHash member.
* Remove unused std::hash and boost::hash specializations.
* Remove unused constructor.
* Remove unused comparison with uint256.
* Remove unused getNodeID (int depth, uint256 const& hash).
* Remove virtual specifier from getString().
* Fix operator<= and operator>=.
* Document what API is used outside of SHAMap.
* Move inline definitions outside of the class declaration.

SHAMapMissingNode
* Make SHAMapType a enum class to prevent unwanted conversions.
* Remove needless ~SHAMapMissingNode() declaration/definition.
* Add referenced std includes.

SHAMapAddNode
* Make SHAMapAddNode (int good, int bad, int duplicate) ctor private.
* Move all member function definitions out of the class declaration.
* Remove dependence on beast::lexicalCastThrow.
* Make getGood() const.
* Make get() const.
* Add #include <string>.

SHAMap
* Remove unused enum STATE_MAP_BUCKETS.
* Remove unused getCountedObjectName().
* Remove SHAMap::pointer
* Remove SHAMap::ref
* Remove unused fetchPackEntry_t.
* Remove inline member function definitions from class declaration.
* Remove unused getTrustedPath.
* Remove unused getPath.
* Remove unused visitLeavesInternal.
* Make SHAMapState an enum class.
* Explicitly delete SHAMap copy members.
* Reduce access to nested types as much as possible.
* Normalize member data names to one style.

* Change last of the typedefs to usings under shamap.
* Reorder some includes ripple-first, beast-second.
* Declare a few constructions from make_shared with auto.
* Mark those SHAMap member functions which can be, with const.

* Add missing includes
2015-02-23 11:44:57 -08:00
Tom Ritchford
315a8b6b60 Use jss for many Json fields.
* Document JsonFields.
  * Remove some unused JsonFields values.
2015-02-23 14:36:34 -05:00
Nik Bougalis
558c6b621b Clean up JSON code:
* Remove obsolete files
* Remove obsolete preprocessor configuration tags and decorations
* Remove arcane functionality (YAML compatibility, comment support)
* Enforce strict mode (single root)
* Improve parsing of numerical types
* Misc. cleanups
2015-02-23 14:36:34 -05:00
Edward Hennis
6d91d02c62 Unit test simulated ledgers can do signature verification. 2015-02-23 14:34:37 -05:00
Josh Juran
436ded68b7 Add unit tests for wallet keypair generation:
* Allow `passphrase` to be a seed encoded in any of three formats or a
    literal passphrase.
  * Recognize the absence of `passphrase` as requesting a random seed.

Extract walletPropose() and keypairForSignature() as separately factored
functions (from doWalletPropose() and transactionSign() respectively) to
facilitate unit testing.
2015-02-23 14:34:35 -05:00
JoelKatz
3ec88b3665 Implement getFetchPack using visitDifferences 2015-02-23 14:34:34 -05:00
Tom Ritchford
2caedb38a6 Set version to 0.28.0-b6 2015-02-18 13:31:31 -05:00
Vinnie Falco
9bbcbd546b Fix streambuf bug:
The buffers_type::iterator could hold a pointer to a buffers_type that
was destroyed. This changes buffers_type::iterator to point to the
original streambuf instead, which always outlives the iterator.
2015-02-18 13:31:18 -05:00
Vinnie Falco
49378ab7fe Fix streambuf bug:
The buffers_type::iterator could hold a pointer to a buffers_type that
was destroyed. This changes buffers_type::iterator to point to the
original streambuf instead, which always outlives the iterator.
2015-02-18 13:31:18 -05:00
Tom Ritchford
7aa6b6b21d Update nudb comments. 2015-02-18 13:31:18 -05:00
Vinnie Falco
982dc6aa8c Reject invalid requests on peer port sooner. 2015-02-18 13:31:18 -05:00
Mark Travis
33175187b7 Don't VACUUM SQLite databases on startup with online delete enabled. 2015-02-18 13:31:18 -05:00
Tom Ritchford
0339904920 Update nudb comments. 2015-02-18 13:31:18 -05:00
Vinnie Falco
8bda9487c6 Add shamap::Family injection bundle 2015-02-18 13:31:18 -05:00
seelabs
617d84c0ef BasicConfig support for legacy values:
* A legacy value is a config section with a single-line.
* These values may be read from the BasicConfig interface so
  the deprecated Config class does not need to be exposed to
  clients.
* Made Config class more testable.
2015-02-18 13:31:18 -05:00
Vinnie Falco
ac64731d55 Set version to 0.27.1-rc3 2015-02-12 12:59:48 -08:00
Vinnie Falco
5dc064e971 Revert "Disable Overlay socket handoffs"
This reverts commit 8eb05d0950.
2015-02-12 12:59:48 -08:00
Vinnie Falco
c24732ed4e Fix streambuf bug:
The buffers_type::iterator could hold a pointer to a buffers_type that
was destroyed. This changes buffers_type::iterator to point to the
original streambuf instead, which always outlives the iterator.
2015-02-12 12:59:35 -08:00
Vinnie Falco
ba710bee86 Reject invalid requests on peer port sooner. 2015-02-12 12:43:42 -08:00
Vinnie Falco
c20392ca80 Set version to 0.27.1-rc2 2015-02-11 20:53:27 -08:00
Vinnie Falco
8eb05d0950 Disable Overlay socket handoffs 2015-02-11 20:53:27 -08:00
Howard Hinnant
0a0795328f Add missing includes. 2015-02-11 20:42:38 -05:00
Tom Ritchford
b11ad375cd Set version to 0.28.0-b5 2015-02-11 20:42:38 -05:00
Vinnie Falco
df89999891 Remove obsolete classes:
Legacy workarounds for Visual Studio non thread-safe initialization
of function local objects with static storage duration are removed:

* Remove LeakChecked
* Remove StaticObject
* Remove SharedSingleton
2015-02-11 20:42:38 -05:00
Josh Juran
7a6d533014 Refactor GenerateDeterministicKey and its call sites:
Remove the use of ec_key parameters and return values from ECDSA crypto
prototypes.  Don't store key data into an ec_key variable only to fetch
it back into the original type again.  Use uint256 and Blob explicitly.

Pass private keys as uint256, and pass public keys as either pointer and
length or Blob in calls to ECDSA{Sign,Verify}() and {en,de}cryptECIES().

Replace GenerateRootDeterministicKey() with separate functions returning
either the public or private key, since no caller needs both at once.

Simplify the use of GenerateDeterministicKey within RippleAddress.  Call
a single routine rather than pass the result of one as input to another.

Add openssl unit with RAII classes for bignum, bn_ctx, and ec_point plus
free utility functions.

Rewrite the functions in GenerateDeterministicKey.cpp to use RAII rather
than explicit cleanup code:
  * factor out secp256k1_group and secp256k1_order for reuse rather than
    computing them each time
  * replace getPublicKey() with serialize_ec_point(), which makes, sets,
    and destroys an ec_key internally (sparing the caller those details)
    and calls i2o_ECPublicKey() directly
  * return bignum rather than ec_key from GenerateRootDeterministicKey()
  * return ec_point rather than EC_KEY* from GenerateRootPubKey()

Move ECDSA{Private,Public}Key() to a new ECDSAKey unit.
Move ec_key.h into impl/ since it's no longer used outside crypto/.

Remove now-unused member functions from ec_key.

Change tabs to spaces; trim trailing whitespace (including blank lines).
2015-02-11 20:42:38 -05:00
Howard Hinnant
be44f75d2d Add missing includes. 2015-02-11 20:42:38 -05:00
Vinnie Falco
ab14123aed Remove obsolete classes:
Legacy workarounds for Visual Studio non thread-safe initialization
of function local objects with static storage duration are removed:

* Remove LeakChecked
* Remove StaticObject
* Remove SharedSingleton
2015-02-11 20:42:38 -05:00
Tom Ritchford
a963a6d10d Add noexcept qualifier to swaps and moves. 2015-02-11 20:42:38 -05:00
Vinnie Falco
11c472d701 Speed up some unit tests:
A few of the slowest unit tests are modified to process a smaller data
set size, to reduce the time required to run all unit tests.
2015-02-11 20:14:44 -05:00
Vinnie Falco
69b4cd22a2 Speed up some unit tests:
A few of the slowest unit tests are modified to process a smaller data
set size, to reduce the time required to run all unit tests.
2015-02-11 20:14:44 -05:00
Vinnie Falco
e81d35c4db Add elapsed time report for unit test runner:
When unit tests are complete, the longest running tests if any are logged.
2015-02-11 20:14:44 -05:00
Vinnie Falco
958325653f Add elapsed time report for unit test runner:
When unit tests are complete, the longest running tests if any are logged.
2015-02-11 20:14:44 -05:00
Josh Juran
c5dc419f9e Remove unused source file 2015-02-11 20:14:44 -05:00
Vinnie Falco
2a201f9525 Add RocksDB to nudb import tool (RIPD-781,785):
This custom tool is specifically designed for very fast import of
RocksDB nodestore databases into NuDB.
2015-02-11 20:14:44 -05:00
Vinnie Falco
b7ba509618 NuDB: Use nodeobject codec in Backend (RIPD-793):
This adds codecs for snappy and lz4, and a new nodeobject codec. The
nodeobject codec provides a highly efficient custom compression scheme
for inner nodes, which make up the majority of nodestore databases.
Non inner node objects are compressed using lz4.

The NuDB backend is modified to use the nodeobject codec. This change
is not backward compatible - older NuDB databases cannot be opened or
imported.
2015-02-11 14:41:33 -08:00
Vinnie Falco
f946d7b447 Remove obsolete NodeObject fields:
Legacy fields of NodeObject are removed, as they are no longer
used and there is a space savings from omitting them:

* Remove LedgerIndex
2015-02-11 14:41:32 -08:00
Vinnie Falco
33c5f98824 NuDB: Performance improvements (RIPD-793,796):
This introduces changes in nudb to improve speed, reduce database size,
and enhance correctness. The most significant change is to store hashes
rather than entire keys in the key file. The output of the hash function
is reduced to 48 bits, and stored directly in buckets.

The API is also modified to introduce a Codec parameter allowing for
compression and decompression to be supported in the implementation
itself rather than callers.

THe data file no longer contains a salt, as the salt is applicable
only to the key and log files. This allows a data file to have multiple
key files with different salt values. To distinguish physical files
belonging to the same logical database, a new field UID is introduced.
The UID is a 64-bit random value generated once on creation and stored
in all three files.

Buckets are zero filled to the end of each block, this is a security
measure to prevent unintended contents of memory getting stored to
disk. NuDB offers the varint integer type, this is identical to
the varint described by Google.

* Add varint
* Add Codec template argument
* Add "api" convenience traits
* Store hash in buckets
* istream can throw short read errors
* Support std::uint8_t format in streams
* Make file classes part of the public interface
* Remove buffers pessimization, replace with buffer
* Consolidate creation utility functions to the same header
* Zero fill unused areas of buckets on disk
* More coverage and improvements to the recover test
* Fix file read/write to loop until all bytes processed
* Add verify_fast, faster verify for large databases

The database version number is incremented to 2; older databases can
no longer be opened and should be deleted.
2015-02-11 14:41:31 -08:00
Vinnie Falco
e2a5535ed6 NuDB: Performance improvements (RIPD-793,796):
This introduces changes in nudb to improve speed, reduce database size,
and enhance correctness. The most significant change is to store hashes
rather than entire keys in the key file. The output of the hash function
is reduced to 48 bits, and stored directly in buckets.

The API is also modified to introduce a Codec parameter allowing for
compression and decompression to be supported in the implementation
itself rather than callers.

THe data file no longer contains a salt, as the salt is applicable
only to the key and log files. This allows a data file to have multiple
key files with different salt values. To distinguish physical files
belonging to the same logical database, a new field UID is introduced.
The UID is a 64-bit random value generated once on creation and stored
in all three files.

Buckets are zero filled to the end of each block, this is a security
measure to prevent unintended contents of memory getting stored to
disk. NuDB offers the varint integer type, this is identical to
the varint described by Google.

* Add varint
* Add Codec template argument
* Add "api" convenience traits
* Store hash in buckets
* istream can throw short read errors
* Support std::uint8_t format in streams
* Make file classes part of the public interface
* Remove buffers pessimization, replace with buffer
* Consolidate creation utility functions to the same header
* Zero fill unused areas of buckets on disk
* More coverage and improvements to the recover test
* Fix file read/write to loop until all bytes processed
* Add verify_fast, faster verify for large databases

The database version number is incremented to 2; older databases can
no longer be opened and should be deleted.
2015-02-11 14:41:31 -08:00
Vinnie Falco
0f94e2c0c3 Set version to 0.27.1-rc1 2015-02-10 16:22:14 -08:00
Vinnie Falco
a25508b98d Add RocksDB to nudb import tool (RIPD-781,785):
This custom tool is specifically designed for very fast import of
RocksDB nodestore databases into NuDB.
2015-02-10 16:22:14 -08:00
Vinnie Falco
e825433a38 NuDB: Use nodeobject codec in Backend (RIPD-793):
This adds codecs for snappy and lz4, and a new nodeobject codec. The
nodeobject codec provides a highly efficient custom compression scheme
for inner nodes, which make up the majority of nodestore databases.
Non inner node objects are compressed using lz4.

The NuDB backend is modified to use the nodeobject codec. This change
is not backward compatible - older NuDB databases cannot be opened or
imported.
2015-02-10 16:22:13 -08:00
Vinnie Falco
d1c08889fe Remove obsolete NodeObject fields:
Legacy fields of NodeObject are removed, as they are no longer
used and there is a space savings from omitting them:

* Remove LedgerIndex
2015-02-10 16:22:13 -08:00
Vinnie Falco
0b82b5a0d6 NuDB: Performance improvements (RIPD-793,796):
This introduces changes in nudb to improve speed, reduce database size,
and enhance correctness. The most significant change is to store hashes
rather than entire keys in the key file. The output of the hash function
is reduced to 48 bits, and stored directly in buckets.

The API is also modified to introduce a Codec parameter allowing for
compression and decompression to be supported in the implementation
itself rather than callers.

THe data file no longer contains a salt, as the salt is applicable
only to the key and log files. This allows a data file to have multiple
key files with different salt values. To distinguish physical files
belonging to the same logical database, a new field UID is introduced.
The UID is a 64-bit random value generated once on creation and stored
in all three files.

Buckets are zero filled to the end of each block, this is a security
measure to prevent unintended contents of memory getting stored to
disk. NuDB offers the varint integer type, this is identical to
the varint described by Google.

* Add varint
* Add Codec template argument
* Add "api" convenience traits
* Store hash in buckets
* istream can throw short read errors
* Support std::uint8_t format in streams
* Make file classes part of the public interface
* Remove buffers pessimization, replace with buffer
* Consolidate creation utility functions to the same header
* Zero fill unused areas of buckets on disk
* More coverage and improvements to the recover test
* Fix file read/write to loop until all bytes processed
* Add verify_fast, faster verify for large databases

The database version number is incremented to 2; older databases can
no longer be opened and should be deleted.
2015-02-10 16:22:13 -08:00
Vinnie Falco
a33d0d4fb6 Add general delimiter split() to rfc2616 2015-02-08 19:43:37 -08:00
Vinnie Falco
ba42334d36 Add lz4
Conflicts:
	Builds/VisualStudio2013/RippleD.vcxproj
	Builds/VisualStudio2013/RippleD.vcxproj.filters
2015-02-08 19:43:26 -08:00
Vinnie Falco
dad460dcfc Squashed 'src/lz4/' content from commit e25b51d
git-subtree-dir: src/lz4
git-subtree-split: e25b51de7b51101e04ceea194dd557fcc23c03ca
2015-02-08 19:43:04 -08:00
Vinnie Falco
2e62641aa4 Merge commit 'dad460dcfc8466a8e1c59529d490829fcfaeee73' as 'src/lz4' 2015-02-08 19:43:04 -08:00
Vinnie Falco
3ae23b6a54 Remove spurious call to fetch in NuDBBackend 2015-02-08 19:42:07 -08:00
Vinnie Falco
97126f18b1 Add /crawl cgi request feature to peer protocol (RIPD-729):
This adds support for a cgi /crawl request, issued over HTTPS to the configured
peer protocol port. The response to the request is a JSON object containing
the node public key, type, and IP address of each directly connected neighbor.
The IP address is suppressed unless the neighbor has requested its address
to be revealed by adding "Crawl: public" to its HTTP headers. This field is
currently set by the peer_private option in the rippled.cfg file.
2015-02-08 19:42:01 -08:00
Vinnie Falco
3838d222c2 NuDB: limit size of mempool (RIPD-787):
Insert now blocks when the size of the memory pool exceeds a predefined
threshold. This solves the problem where sustained insertions cause the
memory pool to grow without bound.
2015-02-08 19:41:54 -08:00
Vinnie Falco
96c3292210 Add missing include 2015-02-08 19:41:48 -08:00
Vinnie Falco
b0fd92cb3f Fix unsafe iterator dereference in PeerFinder 2015-02-08 19:41:43 -08:00
Vinnie Falco
b70cd27bda Add general delimiter split() to rfc2616 2015-02-07 15:19:55 -08:00
Vinnie Falco
62c5b5e570 Add general delimiter split() to rfc2616 2015-02-07 15:19:55 -08:00
Vinnie Falco
feaa0871ac Add lz4 2015-02-07 06:38:37 -08:00
Vinnie Falco
9f41976926 Merge commit '1784f24c5f81e864bf0ad8dcfdf4266ca1108290' as 'src/lz4' 2015-02-05 15:40:04 -08:00
Vinnie Falco
1784f24c5f Squashed 'src/lz4/' content from commit e25b51d
git-subtree-dir: src/lz4
git-subtree-split: e25b51de7b51101e04ceea194dd557fcc23c03ca
2015-02-05 15:40:04 -08:00
Vinnie Falco
fc47d9fc4d Set version to 0.28.0-b4 2015-02-03 16:24:34 -08:00
Vinnie Falco
eade9f8f2b Revert RocksDB backend settings:
This reverts the change that makes RocksDBQuick the default settings for
node_db "type=rocksdb". The quick settings can be obtained by setting
"type=rocksdbquick".

RocksDBQuick settings are implicated in memory over-utilization problems
seen recently.
2015-02-03 16:24:34 -08:00
Vinnie Falco
6276c55cc9 Set version to 0.27.0-sp1 2015-02-03 14:58:02 -08:00
Vinnie Falco
afa6ff7c4b Revert RocksDB backend settings:
This reverts the change that makes RocksDBQuick the default settings for
node_db "type=rocksdb". The quick settings can be obtained by setting
"type=rocksdbquick".

RocksDBQuick settings are implicated in memory over-utilization problems
seen recently.
2015-02-03 14:57:54 -08:00
Vinnie Falco
f4dcbe3a84 Remove spurious call to fetch in NuDBBackend 2015-02-03 12:56:35 -08:00
Vinnie Falco
9c02cc1b17 Add /crawl cgi request feature to peer protocol (RIPD-729):
This adds support for a cgi /crawl request, issued over HTTPS to the configured
peer protocol port. The response to the request is a JSON object containing
the node public key, type, and IP address of each directly connected neighbor.
The IP address is suppressed unless the neighbor has requested its address
to be revealed by adding "Crawl: public" to its HTTP headers. This field is
currently set by the peer_private option in the rippled.cfg file.
2015-02-03 12:56:35 -08:00
seelabs
70a27b900a Add missing include:
* Compile previously failed on Mac with clang
2015-02-03 12:56:32 -08:00
seelabs
0cc3ef8f90 Add missing include:
* Compile previously failed on Mac with clang
2015-02-03 12:56:32 -08:00
Tom Ritchford
4cbbacc946 Set version to 0.28.0-b3 2015-02-02 17:01:50 -08:00
Vinnie Falco
18c63a75fb NuDB: limit size of mempool (RIPD-787):
Insert now blocks when the size of the memory pool exceeds a predefined
threshold. This solves the problem where sustained insertions cause the
memory pool to grow without bound.
2015-02-02 17:01:19 -08:00
Vinnie Falco
9a0c71d4a7 NuDB: limit size of mempool (RIPD-787):
Insert now blocks when the size of the memory pool exceeds a predefined
threshold. This solves the problem where sustained insertions cause the
memory pool to grow without bound.
2015-02-02 17:01:19 -08:00
Vinnie Falco
d9aec19c87 Add missing include 2015-02-02 17:01:18 -08:00
Vinnie Falco
0f1b831de7 Add missing include 2015-02-02 17:01:18 -08:00
Tom Ritchford
bff5212386 Fix C++ guards in beast. 2015-02-02 17:01:18 -08:00
Vinnie Falco
37a7a2aacd Fix unsafe iterator dereference in PeerFinder 2015-02-02 17:01:18 -08:00
Tom Ritchford
635b157b11 Fix C++ guards in beast. 2015-02-02 17:01:18 -08:00
Tom Ritchford
c3ae4da83a Fix include guards in rippled. 2015-02-02 17:01:17 -08:00
Tom Ritchford
c3809ece67 New RPC method "version". 2015-02-02 17:01:17 -08:00
Howard Hinnant
bfc436dccd Add metadata to transaction difference logging: RIPD-775 2015-02-02 17:01:16 -08:00
Vinnie Falco
3c32d0fbc3 Remove buffer_view 2015-01-28 16:34:33 -08:00
Nik Bougalis
71d6874236 Set version to 0.28.0-b2 2015-01-28 16:34:33 -08:00
Vinnie Falco
9bf1f994ae Remove buffer_view 2015-01-28 16:34:33 -08:00
Vinnie Falco
bb4127a6fb Refactor Serializer and SerializerIterator interfaces:
* Remove unused members
* SerialIter holds only a pointer and offset now
* Use free functions for some Serializer members
* Use SerialIter in some places instead of Serializer
2015-01-28 16:34:33 -08:00
Edward Hennis
a691632995 Support a "--noserver" command line option in tests:
* Run npm/integration tests without launching rippled, using a
  running instance of rippled (possibly in a debugger) instead.
* Works for "npm test" and "mocha"
2015-01-28 16:34:33 -08:00
Miguel Portilla
5d6ea3d75f Combine history_ledger_index and online_delete (RIPD-774) 2015-01-28 16:34:33 -08:00
Mark Travis
43873b1b2c Initialize canDelete_ properly in the constructor. 2015-01-28 16:34:33 -08:00
Mark Travis
9430f3665b Speed up access to ledger index value that can be deleted. 2015-01-28 16:34:33 -08:00
Vinnie Falco
f3c1f63444 Remove LevelDB and HyperLevelDB backends:
The LevelDB and HyperLevelDB are removed from the backend choices. Neither
were recommended for production environments. As RocksDB is not available
on Windows platforms yet, the recommended backend choice for Windows is NuDB.
2015-01-28 13:43:00 -08:00
Nik Bougalis
b5c7232d6f Set version to 0.28.0-b1 2015-01-27 18:21:54 -08:00
Edward Hennis
2f3677d593 Change timing on "sequence realignment" test. 2015-01-27 18:21:54 -08:00
Howard Hinnant
1e0efaffe8 Add missing includes. 2015-01-27 18:21:54 -08:00
Vinnie Falco
fc79754750 Remove unused SHAMap fields 2015-01-26 19:25:38 -08:00
Miguel Portilla
0e4de42be8 Add RPC metrics (RIPD-705)
Add metrics to record the number of RPC requests received. Record the number of
node store fetches performed per request. Additionally record the byte size of
each request response and measure the response time of each request in
milliseconds.

A new class, ScopedMetrics, uses the Boost Thead Local Storage mechanism to
efficiently record NodeStore metrics within the same thread.
2015-01-26 19:25:38 -08:00
Scott Determan
4e389127b5 Use microsecond granularity for sqlite lock backoff algorithm:
When sql tries to acquire a lock that is already held, it sleeps for some
microseconds using the usleep function and then try to acquire the lock
again. However, if the HAVE_USLEEP macro is not defined then the sleep
function will be used.

This fix will define HAVE_USLEEP even when it is not already defined by
the system. Although some Linux distros may not define HAVE_USLEEP,
all supported versions provide usleep. If the system does not actually
have a usleep function, then the compiler will flag the error.
2015-01-26 19:13:40 -08:00
Nik Bougalis
47593730d6 Modernize code:
* Clean STBase-derived class creation interfaces
* Annotate overriden STBase virtual functions
* Optimize path deserialization
* Prefer range-based for
* Prefer std::unique_ptr
* Remove BOOST_FOREACH
2015-01-26 19:13:40 -08:00
Tom Ritchford
e742da73bd Simplify lookupLedger(). 2015-01-26 19:13:40 -08:00
Vinnie Falco
890bf3cce1 Add PeerFinder Logic backoff unit test 2015-01-26 19:13:40 -08:00
Nik Bougalis
60eb312e3b Fix order of construction of Application members 2015-01-26 19:13:40 -08:00
Tom Ritchford
06207da185 Move Context.h up into rpc/. 2015-01-26 19:13:40 -08:00
Nicholas Dudfield
4dc2cf8a6b Update tests to support latest ripple-lib:
* Update ripple-lib api usage
* Use latest npm ripple-lib
  * Tested with bignumber.js branch and tip of develop
* Use new version of coffee-script
  * Better source maps
* Update mocha
* Add assert-diff for better error reporting
* Add rconsole, enabled via USE_RCONSOLE env var
  * For use with manual installation only
2015-01-26 19:13:40 -08:00
Scott Determan
44450bf644 Enable Amendments from config file or static data (RIPD-746):
* The rippled.cfg file has a new section called "amendments"

* Each line in this section contains two white-space separated items
** The first item is the ID of the amendment (a 256-bit hash)
** The second item is the friendly name

* Replaces config section name macros with variables

* Make addKnown arguments safer

* Added lock to addKnown
2015-01-26 19:13:02 -08:00
Nik Bougalis
312aec79ca Remove WalletAdd (RIPD-725) 2015-01-26 12:39:13 -08:00
Nik Bougalis
a8578c73f8 Remove support for deprecated PreviousTxnID field (RIPD-710):
The PreviousTxnID field has been deprecated and should not be used for
transactions that use the field will now be rejected.

The AccountTxnID feature should be used instead by enabling transaction
tracking and specifying a transaction ID at submission. More details
are available at: https://ripple.com/build/transactions/#accounttxnid
2015-01-26 12:39:13 -08:00
Miguel Portilla
c522ffa6db Eliminate temREDUNDANT_SEND_MAX (RIPD-590):
The rules for when a SendMax is redundant are complicated. It is easier to
always allow a SendMax and eliminate temREDUNDANT_SEND_MAX.
2015-01-26 12:39:13 -08:00
Nik Bougalis
93b7599b1c Fix missing 'else' when handling sfMessageKey:
When clearing out a message key the transactor would incorrectly
create an empty `sfMessageKey` field instead of simply deleting
the field.

Clarify logic by reordering checks.
2015-01-26 12:39:13 -08:00
Nik Bougalis
3ccbd7c9b2 Finalize autobridging implementation (RIPD-179):
Autobridging uses XRP as a natural bridge currency to allow IOU-to-IOU orders
to be satisfied not only from the direct IOU-to-IOU books but also over the
combined IOU-to-XRP and XRP-to-IOU books.

This commit addresses the following issues:

* RIPD-486: Refactoring the taker into a unit-testable architecture
* RIPD-659: Asset-aware offer crossing
* RIPD-491: Unit tests for IOU to XRP, XRP to IOU and IOU to IOU
* RIPD-441: Handle case when autobridging over same owner offers
* RIPD-665: Handle case when autobridging over own offers
* RIPD-273: Groom order books while crossing
2015-01-26 12:39:13 -08:00
Nik Bougalis
385a87db31 Claim a fee when a required destination tag is not specified (RIPD-574) 2015-01-26 12:39:12 -08:00
Nik Bougalis
5530353eef Add simplified explicit interfaces to handle XRP and IOU transfers:
The new interfaces take into account the different semantics of XRP, which
do not have an issuer or transfer fees, and IOUs which have issuers and
(optional) transfer fees.

For XRP, the new `LedgerEntrySet::transfer_xrp` will transfer the specified
amount of XRP between from a given source to a given destination.

For IOU, two new functions are introduced:
* `LedgerEntrySet::issue_iou` which transfers the specified amount of an
IOU from the IOU's issuer to an account.
* `LedgerEntrySet::redeem_iou` which transfers the specified amount of an
IOU from an account to the IOU's issuer.

A transfer from user-to-user (e.g. to fill an order during offer crossing)
requires the use of `redeem_iou` followed by `issue_iou`. This helps to
enforce the Ripple invariant that IOUs never flow directly from user to
user, but only through a gateway. Additionally, this  allows for the
explicit calculation and application of transfer fees by varying the
amounts redeemed and issued.

The new interfaces promote type safety since you cannot use the issue
and redeem APIs with XRP or the transfer API with IOU, and the issuer
to be used is implied by the currency being issued or redeemed.
2015-01-26 12:39:12 -08:00
Nik Bougalis
d1193093ef Require the master key when performing certain operations (RIPD-666):
* When disabling the use of the master key; or
* When enabling 'no freeze'.
2015-01-26 12:39:12 -08:00
David Schwartz
b203db27a4 Fix offer->ACCOUNT->offer 2015-01-26 12:39:12 -08:00
JoelKatz
0a3e1af04c When pathfinding, don't output a redundant account node 2015-01-26 12:39:12 -08:00
Vinnie Falco
c6c8e5d70c Set version to 0.27.0 2015-01-26 10:56:11 -08:00
Nik Bougalis
fa354ec8d9 Set version to 0.27.0-b11 2015-01-23 17:37:18 -08:00
Nik Bougalis
4699b17508 Invoke correct deleter 2015-01-23 17:34:30 -08:00
Nik Bougalis
d0375f697d Invoke correct deleter 2015-01-23 17:34:30 -08:00
Vinnie Falco
33c8257d25 Set version to 0.27.0-b10 2015-01-21 15:25:11 -08:00
Scott Determan
b8c716a918 VSProject: Handle tuples in CPPDEFINES:
The VSProject generator now handles tuples in addition to strings and
dicts when converting environment variables such as CPPDEFINES.
2015-01-21 15:20:06 -08:00
Scott Determan
f389bc33c3 VSProject: Handle tuples in CPPDEFINES:
The VSProject generator now handles tuples in addition to strings and
dicts when converting environment variables such as CPPDEFINES.
2015-01-21 15:20:06 -08:00
Vinnie Falco
4d5dca71ce Squelch Peerfinder fixed connection attempts 2015-01-21 14:59:47 -08:00
Vinnie Falco
a9c44a1b9c Set version to 0.27.0-b9 2015-01-21 14:23:50 -08:00
Vinnie Falco
4144f800a1 Fix PeerImp concurrent access of socket:
The PeerImp::run launch function is now dispatched on the strand to prevent
undefined behavior resulting from concurrent access to the ssl::stream object.
2015-01-21 14:21:43 -08:00
Vinnie Falco
6ef9a81017 Set version to 0.27.0-b8 2015-01-21 14:21:43 -08:00
Vinnie Falco
8c6722f3c5 Remove use of date and time from rocksdb unity build 2015-01-21 14:21:43 -08:00
Vinnie Falco
34f0f9dcf1 Fix Journal::Stream::active to return the correct value 2015-01-21 10:48:32 -08:00
Vinnie Falco
40e138627b Fixes to Overlay:
* Make ~Peer virtual
* Call close in ConnectAttempt::stop
* Handle nullptr return in new_outbound_slot
* Check gracefulClose_ in read loop
2015-01-21 10:48:32 -08:00
Vinnie Falco
a470dda4e6 Fix Journal::Stream::active to return the correct value 2015-01-21 10:48:32 -08:00
Edward Hennis
b725410623 Option to specify rippled path on command line.
* --rippled=<absolute or relative path>
* Works for "npm test" and "mocha"
* Remove "rippled_path" from config.js to require CLI path.
2015-01-21 10:48:31 -08:00
Miguel Portilla
a9dfb33126 Log abnormal close time offsets (RIPD-572) 2015-01-21 10:48:31 -08:00
Miguel Portilla
8b848770dc Add config "ledger_history_index" functionality (RIPD-559) 2015-01-21 10:48:31 -08:00
Vinnie Falco
8d1cfaabe7 Add NuDB: A Key/Value Store For Decentralized Systems
NuDB is a high performance key/value database optimized for insert-only
workloads, with these features:

* Low memory footprint
* Values are immutable
* Value sizes from 1 2^48 bytes (281TB)
* All keys are the same size
* Performance independent of growth
* Optimized for concurrent fetch
* Key file can be rebuilt if needed
* Inserts are atomic and consistent
* Data file may be iterated, index rebuilt.
* Key and data files may be on different volumes
* Hardened against algorithmic complexity attacks
* Header-only, nothing to build or link
2015-01-21 10:48:30 -08:00
Vinnie Falco
94629edb9b Add NuDB backend:
The NuDB database backend is a high performance key/value store presented
as an alternative to RocksDB on Mac and Linux deployments, and the preferred
backend option for Windows deployments. The LevelDB backend is deprecated for
all platforms.

This includes these changes:

* Add Backend::verify API for doing consistency checks
* Add Database::close so caller can catch exceptions
* Improved Timing test for NodeStore creates a simulated workload
2015-01-21 10:48:30 -08:00
Vinnie Falco
2a3f2ca28d Add NuDB: A Key/Value Store For Decentralized Systems
NuDB is a high performance key/value database optimized for insert-only
workloads, with these features:

* Low memory footprint
* Values are immutable
* Value sizes from 1 2^48 bytes (281TB)
* All keys are the same size
* Performance independent of growth
* Optimized for concurrent fetch
* Key file can be rebuilt if needed
* Inserts are atomic and consistent
* Data file may be iterated, index rebuilt.
* Key and data files may be on different volumes
* Hardened against algorithmic complexity attacks
* Header-only, nothing to build or link
2015-01-21 10:48:30 -08:00
Edward Hennis
8ab1e7d432 Integration test to subscribe to offer books. 2015-01-20 16:45:04 -08:00
Miguel Portilla
b2ba6a0c85 Fix RPC subscribe with multiple books 2015-01-20 16:45:04 -08:00
Tom Ritchford
cca5421aed Fix Subscribe RPC to correctly distinguish bids and asks. 2015-01-20 16:45:04 -08:00
Nik Bougalis
f78269b02d Ensure that hash_append will never throw
Conflicts:
	src/beast/beast/net/IPAddress.h
2015-01-20 16:45:03 -08:00
Nik Bougalis
799d9a73e6 Ensure that hash_append will never throw
Conflicts:
	src/beast/beast/net/IPAddress.h
2015-01-20 16:45:03 -08:00
Scott Determan
b0781622b2 Handle nullptr return values to InboundLedgers::findCreate
In normal operation, InboundLedgers::findCreate never returns null, but
during system shutdown, it will return null.

Since this only happens in system shutdown, when findCreate returns null
the calling function stops what it was doing and returns.

During testing, an issue where destroying the application object
and creating a new one caused problems with a static PathTable. This table
is now cleared when re-initialized.
2015-01-20 16:45:03 -08:00
Tom Ritchford
0d0eec6345 Clean up test documentation and a log message. 2015-01-20 16:45:03 -08:00
Nik Bougalis
1af79f7960 Properly validate the configured online delete interval 2015-01-20 16:45:03 -08:00
Vinnie Falco
15b570bbdd Add profile targets for gcc and clang 2015-01-20 16:45:02 -08:00
Tom Ritchford
7aa5599cc2 Remove unused parameter in two lambdas. 2015-01-20 16:45:02 -08:00
JoelKatz
676293ec42 Ensure account_tx queries over and returns correct range 2015-01-20 16:45:02 -08:00
Vinnie Falco
e8c07717fc Tidy up container hash functions:
* Add xxhasher
* Move fnv1a, siphash, spookyto hash/
* Move hash_append, uhash to hash/
* Move hash_speed_test to hash/
* Move hash classes to individual header files
* Remove hardened_hash
2015-01-20 16:45:01 -08:00
Nik Bougalis
abc4fb81b1 Improve RippleLineCache hashing 2015-01-20 16:45:01 -08:00
Vinnie Falco
9ca6740db3 Add rngfill 2015-01-20 16:45:01 -08:00
Vinnie Falco
53a16f354f Add hardened_hash to basics/:
xxhasher is the default hash function for hardened_hash.
2015-01-20 16:45:01 -08:00
Vinnie Falco
6ab1ecd836 Tidy up container hash functions:
* Add xxhasher
* Move fnv1a, siphash, spookyto hash/
* Move hash_append, uhash to hash/
* Move hash_speed_test to hash/
* Move hash classes to individual header files
* Remove hardened_hash
2015-01-20 16:45:01 -08:00
Vinnie Falco
e7b16e7b47 Add rngfill 2015-01-20 16:45:01 -08:00
Vinnie Falco
92c9ebb0d6 Optimize calls to unit_test::suite::expect:
This changes expect and unexpected to receive the reason text as a
template argument, allowing the std::string conversion of char const*
parameters to take place only if the condition evaluates to false. This
cuts all calls to malloc and free on tests that pass.
2015-01-20 16:45:00 -08:00
Vinnie Falco
14804f81a8 Optimize calls to unit_test::suite::expect:
This changes expect and unexpected to receive the reason text as a
template argument, allowing the std::string conversion of char const*
parameters to take place only if the condition evaluates to false. This
cuts all calls to malloc and free on tests that pass.
2015-01-20 16:45:00 -08:00
Vinnie Falco
8432b9e29a Improve streambuf unit test 2015-01-20 16:45:00 -08:00
Vinnie Falco
9a61b8d77d Declare base_uints with using statements 2015-01-20 16:45:00 -08:00
Vinnie Falco
f42c2763d5 Improve streambuf unit test 2015-01-20 16:45:00 -08:00
Vinnie Falco
98d4e0e1b5 Fix ZeroCopyOutputStream:
Added a destructor that commits the last block of data
if there was no final call to BackUp.
2015-01-20 16:45:00 -08:00
Tom Ritchford
9156633baf Set version to 0.27.0-b7 2015-01-20 17:59:55 -05:00
Tom Ritchford
bcf4f836b4 Use websocketpp_02 namespace. 2015-01-20 17:08:15 -05:00
Vinnie Falco
dbc1d70f99 Set version to 0.27.0-b6 2015-01-20 09:41:27 -08:00
Vinnie Falco
78bc190a85 Merge commit '02855d7fed46d3c1aa1f2cefbcf4a42720575c3f' as 'src/websocketpp' 2015-01-20 09:35:00 -08:00
Vinnie Falco
02855d7fed Squashed 'src/websocketpp/' content from commit 875d420
git-subtree-dir: src/websocketpp
git-subtree-split: 875d420952
2015-01-20 09:35:00 -08:00
Vinnie Falco
6fdd5d32be Rename websocket/ to websocketpp_02 2015-01-20 09:34:54 -08:00
Vinnie Falco
d7f32b105b Set version to 0.27.0-b5 2015-01-13 11:50:58 -08:00
Vinnie Falco
0ac480a0bd Fix extra increment in GenerateRootDeterministicKey 2015-01-13 11:49:59 -08:00
Tom Ritchford
417996de02 Set version to 0.27.0-b4 2015-01-13 11:30:23 -05:00
Tom Ritchford
6c2d60cec2 Prevent RPC handlers from returning non-objects. 2015-01-13 11:30:23 -05:00
Tom Ritchford
743bd6c917 Fix RPC command logrotate to return a Json object. 2015-01-13 11:30:14 -05:00
Edward Hennis
ab61aa41d9 Set version to 0.27.0-b3 2015-01-12 18:00:55 -05:00
Edward Hennis
36396ae29e rippled.cfg [db_node] options for RocksDB
* open_files and compression.
2015-01-12 18:00:54 -05:00
Vinnie Falco
749e083e6e NodeStore improvements:
* Add Backend::verify API for doing consistency checks
* Add Database::close so caller can catch exceptions
* Improved Timing test for NodeStore creates a simulated workload
2015-01-12 18:00:52 -05:00
Vinnie Falco
faf91d6697 Improved support for exceptions in threads spawned by unit tests:
Unit tests that wish to spawn threads for testing concurrency may now do so
by using unit_test::thread as a replacement for std::thread. These threads
propagate unhandled exceptions to the unit test, and work with the abort on
failure feature.
2015-01-12 17:17:09 -05:00
Vinnie Falco
67b9cf9e82 Improved support for exceptions in threads spawned by unit tests:
Unit tests that wish to spawn threads for testing concurrency may now do so
by using unit_test::thread as a replacement for std::thread. These threads
propagate unhandled exceptions to the unit test, and work with the abort on
failure feature.
2015-01-12 17:17:09 -05:00
Vinnie Falco
adc69e72df Add xor_shift_engine 2015-01-12 17:17:07 -05:00
Vinnie Falco
27fb20f3ab Add xor_shift_engine 2015-01-12 17:17:07 -05:00
Josh Juran
1c71b274f0 SConstruct: Add ed25519.c
Conflicts:
	Builds/VisualStudio2013/RippleD.vcxproj
	Builds/VisualStudio2013/RippleD.vcxproj.filters
	SConstruct
2015-01-12 12:16:26 -08:00
Vinnie Falco
fcd20b63fe Merge commit '8ec344ac1b6c66d936fa0f7005490e126a434a70' as 'src/ed25519-donna' 2015-01-12 11:27:15 -08:00
Vinnie Falco
8ec344ac1b Squashed 'src/ed25519-donna/' content from commit 04223b0
git-subtree-dir: src/ed25519-donna
git-subtree-split: 04223b04e22f5eff32c6c27e25194d4d984c6f41
2015-01-12 11:27:15 -08:00
Vinnie Falco
df966a9ac6 Set version to 0.27.0-b2 2015-01-05 18:49:18 -08:00
Vinnie Falco
f634666dc6 Make rocksdbquick settings default:
This removes the old default configuration for the "rocksdb" backend and
replaces it with the configuration that was formerly available using
the experimental backend "rocksdbquick".

The new configuration setting improves the performance of the key/value
database by changing the compaction style and tuning the size parameters for
the typical rippled workload. Testing shows a decrease in I/O spikes for both
reading and writing.
2015-01-05 18:49:17 -08:00
Tom Ritchford
e2f9f5d7e5 Fix compilation warnings. 2015-01-05 18:49:17 -08:00
Tom Ritchford
d078b0d143 Extract the git ID into a separate compilation unit. 2015-01-05 18:49:15 -08:00
Nik Bougalis
0ccdea3cd8 Disable Ticket transactions and tests 2015-01-05 14:18:27 -08:00
Vinnie Falco
df54b47cd0 Tidy up includes and add modules to the classic build:
An alternative to the unity build, the classic build compiles each
translation unit individually. This adds more modules to the classic build:

* Remove unity header app.h
* Add missing includes as needed
* Remove obsolete NodeStore backend code
* Add app/, core/, crypto/, json/, net/, overlay/, peerfinder/ to classic build
2015-01-05 13:35:57 -08:00
Vinnie Falco
c8ae3d1751 Levelize SHAMap:
The SHAMap class is refactored into a separate module where each translation
unit compiles separate without errors. Dependencies on higher level business
logic are removed. SHAMap now depends only on basics, crypto, nodestore,
and protocol:

* Inject NodeStore::Database& to SHAMap
* Move sync filter instances to app/ledger/
* Move shamap to its own module
* Move FullBelowCache to shamap/
* Move private code to shamap/impl/
* Refactor SHAMap treatment of missing node handler
* Inject and use Journal for logging in SHAMap
2015-01-05 11:46:11 -08:00
Vinnie Falco
2e595830b3 Levelize SHAMap:
The SHAMap class is refactored into a separate module where each translation
unit compiles separate without errors. Dependencies on higher level business
logic are removed. SHAMap now depends only on basics, crypto, nodestore,
and protocol:

* Inject NodeStore::Database& to SHAMap
* Move sync filter instances to app/ledger/
* Move shamap to its own module
* Move FullBelowCache to shamap/
* Move private code to shamap/impl/
* Refactor SHAMap treatment of missing node handler
* Inject and use Journal for logging in SHAMap
2015-01-05 11:46:11 -08:00
Vinnie Falco
96fbcc9a5a Refactor NodeStore:
Manager is changed to be a Meyer's singleton, with factories automatically
registering upon construction.
2015-01-05 11:46:11 -08:00
Vinnie Falco
6283801981 Add non-unity build targets:
The SConstruct is modified to provide a new family of targets, ending with
the suffix ".nounity", which compile individual translation units instead of
some of the unity translation units ("classic" builds). Two modules updated
for this treatment are ripple/basics/ and ripple/protocol/, with plans to
update more in the future. A consequence is longer build times in some cases.
A benefit of classic builds is that missing includes can be identified
through compiler errors.
2015-01-05 11:46:11 -08:00
Vinnie Falco
9a3214d46e Normalize files containing unit test code:
Source files are split to place all unit test code into translation
units ending in .test.cpp with no other business logic in the same file,
and in directories named "test".

A new target is added to the SConstruct, invoked by:
    scons count
This prints the total number of source code lines occupied by unit tests,
in rippled specific code and excluding library subtrees.
2015-01-05 11:46:07 -08:00
Vinnie Falco
79f9cc534d Don't leak track StringPairArray 2015-01-05 11:44:15 -08:00
Vinnie Falco
9eb7c8344f Don't leak track StringPairArray 2015-01-05 11:44:15 -08:00
Vinnie Falco
4140bbb1f7 Set version to 0.27.0-b1 2015-01-05 11:37:01 -08:00
Vinnie Falco
ea44497136 Fix msvc ICE on initializer-list 2015-01-05 11:37:00 -08:00
Howard Hinnant
5100eadf12 Fix undefined behavior 2014-12-31 01:55:10 -08:00
Nik Bougalis
07737c6e5b Add 'delivered_amount' to Transaction JSON (RIPD-643):
The synthetic field 'delivered_amount' can be used to determine the exact
amount delivered by a Payment without having to check the DeliveredAmount
field, if present, or the Amount field otherwise.

The field is only returned when metadata is available and the data is not
returned in binary format.
2014-12-31 01:55:10 -08:00
Nik Bougalis
1d6721d345 Reduce Beast dependencies by leveraging C++11 features:
* Remove beast::Atomic (RIPD-728):
  * Use std-provided alternatives
  * Eliminate atomic variables where possible

* Cleanup beast::Thread interface:
  * Use std::string instead of beast::String
  * Remove unused functions and parameters

* Remove unused code:
  * beast::ThreadLocalValue
  * beast::ServiceQueue
2014-12-31 01:55:10 -08:00
JoelKatz
98d5eefc86 Pathfinding bugfixes (RIPD-735):
* Fix specifying paths and search level for ripple_path_find
* Don't modify the pathfinder, it has issuer-neutral paths.
* Handle previous paths correctly
* Compare paths correctly
2014-12-31 01:55:10 -08:00
JoelKatz
4f2d93bb65 Avoid processing transactions if we need a network ledger
Not processing tranasctions without a network ledger makes
initial network synchronization faster.
2014-12-31 01:55:10 -08:00
Edward Hennis
a5df3f1747 Support a "no_server" flag in test config.
* Will use a running instance of rippled (possibly in a debugger).
* Modify all tests to respect the server_default value.
* Fail test if new account already exists and has a balance.
* README.md with instructions for advanced test debugging, particularly using no_server.
2014-12-31 01:55:10 -08:00
Howard Hinnant
7f5f73887d Fix undefined behavior 2014-12-31 01:55:10 -08:00
Nik Bougalis
91ce7807b9 Remove legacy LoadTypes (RIPD-365) 2014-12-31 01:55:10 -08:00
Nik Bougalis
d26fae9875 Reduce Beast dependencies by leveraging C++11 features:
* Remove beast::Atomic (RIPD-728):
  * Use std-provided alternatives
  * Eliminate atomic variables where possible

* Cleanup beast::Thread interface:
  * Use std::string instead of beast::String
  * Remove unused functions and parameters

* Remove unused code:
  * beast::ThreadLocalValue
  * beast::ServiceQueue
2014-12-31 01:55:10 -08:00
Nik Bougalis
60bdc79ec4 Remove unused sitefiles module 2014-12-30 12:33:41 -08:00
Tom Ritchford
253ddf2998 Split off CheckLibraryVersions.test.cpp. 2014-12-30 12:33:41 -08:00
Nik Bougalis
9fa15b390a Always initialize LedgerHandler options field 2014-12-29 11:21:19 -08:00
Josh Juran
e7d6fe6c8b Cull duplicate/unused code in RippleAddress:
Deduplicate a call to GeneratePublicDeterministicKey().
Remove unused member functions.
2014-12-29 11:21:19 -08:00
Tom Ritchford
9650b1aa70 New ripple::TestSuite with method expectEquals(). 2014-12-29 11:21:19 -08:00
Howard Hinnant
eafa6f960f API for improved Unit Testing (RIPD-432):
* Added new test APIs allowing easy ways to create ledgers, apply
  transactions to them, close and advance them.

* Moved Ledger tests from Ledger.cpp to Ledger.test.cpp.

* Changed several TransactionEngine log priorities from lsINFO to lsDEBUG to
  reduce unnecessary verbosity in the log messages while running these tests.

* Moved LedgerConsensus:applyTransactions from a private member function to a
  free function so that it could be accessed externally, and without having to
  reference a LedgerConsensus object.  This was done to facilitate the new
  testing API.
2014-12-29 11:21:19 -08:00
Yana
c62ccf4870 Update README.md (RIPD-601) 2014-12-29 11:21:19 -08:00
Vinnie Falco
ef34439a79 Set version to 0.26.5-rc1 2014-12-22 15:20:03 -08:00
Nik Bougalis
b328ec2462 Prevent passing of non-POD types to POD-only interfaces:
This tidies up the code that produces random numbers to conform
to programming best practices and reduce dependencies.

* Use std::random_device instead of platform-specific code
* Remove RandomNumbers class and use free functions instead
2014-12-22 15:19:48 -08:00
Vinnie Falco
60f27178b8 Levelization, improve structure of source files:
Source files are moved between modules, includes changed and added,
and some code rewritten, with the goal of reducing cross-module dependencies
and eliminating cycles in the dependency graph of classes.

* Remove RippleAddress dependency in CKey_test
* ByteOrder.h, Blob.h, and strHex.h are moved to basics/. This makes
  the basics/ module fully independent of other ripple sources.
* types/ is merged into protocol/. The protocol module now contains
  all primitive types specific to the Ripple protocol.
* Move ErrorCodes to protocol/
* Move base_uint to basics/
* Move Base58 to crypto/
* Remove dependence on Serializer in GenerateDeterministicKey
* Eliminate unity header json.h
* Remove obsolete unity headers
* Remove unnecessary includes
2014-12-22 10:23:49 -08:00
Vinnie Falco
c01b4e6baa Tidy up usage of std::begin, std::end 2014-12-19 11:55:43 -08:00
Vinnie Falco
e3fbb83ad0 Tidy up usage of std::begin, std::end 2014-12-19 11:55:43 -08:00
Nik Bougalis
28b70a7b9a Remove 'Proof of Work' code 2014-12-19 11:00:29 -08:00
Nicholas Dudfield
dcdc341d0f Add appveyor 2014-12-19 11:00:29 -08:00
Tom Ritchford
fce77c9372 Configuration for yielding RPC server. 2014-12-19 11:00:28 -08:00
Tom Ritchford
a360c481c2 Refactor out a version of lookupLedger returning Status. 2014-12-19 11:00:28 -08:00
Tom Ritchford
c72db5fa5f Refactor away RPCHandler::doRpcCommand 2014-12-19 11:00:28 -08:00
Tom Ritchford
fc9a23d6d4 Send output incrementally in ServerHandlerImp. 2014-12-19 11:00:27 -08:00
Tom Ritchford
167f4666e2 New generic Ledger RPC handler. 2014-12-19 11:00:27 -08:00
Tom Ritchford
1cbcc7be21 Allow the Ledger to generically output to both Json models. 2014-12-19 11:00:27 -08:00
Tom Ritchford
8053598069 Better interoperation between Json::Value and JsonObject.
* Generic functions to add entries to both object models.
* Add Json::Value into JsonObjects.
* Write Json::Value to string incrementally.
* Get rid of ripple::RPC::New namespace
2014-12-19 11:00:26 -08:00
Tom Ritchford
7cfac1a91a Wrap Output in a coroutine that periodically yields. 2014-12-19 11:00:26 -08:00
Tom Ritchford
192cdd028e Change Output to be a generic std::function. 2014-12-19 11:00:26 -08:00
Tom Ritchford
029c143922 Add a comment to ledger/Ledger.h. 2014-12-19 11:00:26 -08:00
Tom Ritchford
00298cc68c Simplify LedgerData.cpp. 2014-12-19 11:00:25 -08:00
Tom Ritchford
d9c7db51af Make three ErrorCode functions generic. 2014-12-19 11:00:25 -08:00
Vinnie Falco
f12b15d22b Fix logic in HTTP/S server:
These bugs do not affect production code since callers do not invoke
`write` multiple times, but these would become a problem in the future.

* Access to Peer::write_queue_ is synchronized correctly.
* Remove unsafe access to deleted container element.
2014-12-19 11:00:25 -08:00
Vinnie Falco
409b8bac00 Remove unused and obsolete Ripple identifiers and tidy up:
These identifiers were part of a failed set of classes to replace
the functionality combined into RippleAddress. They are not used
and therefore can be removed.

* Remove RippleAccountPrivateKey
* Remove RippleAccountPublicKey
* Remove RippleAccountID
* Remove RipplePrivateKey
* Remove RipplePublicKeyHash
* Remove RippleLedgerHash
* Remove unused withCheck argument
* Remove CryptoIdentifier
* Remove IdentifierStorage
* Remove IdentifierType
* Remove SimpleIdentifier
* Add missing include
2014-12-19 11:00:24 -08:00
Vinnie Falco
28b09bde4b Simplify RipplePublicKey:
This implements the bare minimum necessary to store a 33 byte public
key and use it in ordered containers. It is an efficient and well
defined alternative to RippleAddress when the caller only needs
a node public key.
2014-12-19 11:00:24 -08:00
Vinnie Falco
2f6af906f4 Validators work (RIPD-703):
This replaces the experimental validators module with foundational
code to implement a new system for tracking validators, validations and
the UNL. The code is turned off by default, in BeastConfig.h

* Remove obsolete public Manager interfaces
* Remove obsolete database methods
* Remove obsolete ChosenList concept
* Remove obsolete code
* Add missing includes
* Tidy up STValidation.h
* Move factory function to Validators::make_Manager
* Add Connection object for tracking STValidations
2014-12-19 11:00:23 -08:00
Vinnie Falco
16021591b2 Add waitable_executor 2014-12-18 10:26:55 -08:00
Vinnie Falco
628e3ac1eb Add waitable_executor 2014-12-18 10:26:55 -08:00
Josh Juran
fbf5785e35 Combine STTx::checkSign overloads:
Callers don't need to specify the signing key -- they're just retrieving
the key from the SerializedTransaction and then passing it back.

This simplifies Ed25519 implementation.
2014-12-12 20:14:02 -08:00
Nicholas Dudfield
eeea2b1ff8 Use ppa:afrank/boost 1.57 for Travis 2014-12-12 20:14:02 -08:00
Vinnie Falco
32062e439f Split peer connect logic to another class (RIPD-711):
All of the logic for establishing an outbound peer connection including
the initial HTTP handshake exchange is moved into a separate class. This
allows PeerImp to have a strong invariant: All PeerImp objects that exist
represent active peer connections that have already gone through the
handshake process.
2014-12-12 20:14:02 -08:00
Vinnie Falco
930a0beaf1 Add ZeroCopyOutputStream and tidy up 2014-12-12 20:14:02 -08:00
Nik Bougalis
4a49fefdd9 Various cleanups:
* Replace SYSTEM_NAME and other macros with C++ constructs
* Remove RIPPLE_ARRAYSIZE and use std::extent or ranged for loops
* Remove old-style, unused offer crossing unit test
* Make STAmount::saFromRate free and remove default argument
2014-12-12 20:14:02 -08:00
Nik Bougalis
8e792855e0 Do not use path if path expansion fails 2014-12-10 16:55:06 -08:00
Tom Ritchford
69f5c6987a Whitespace: clean WebSockets to 80 columns. 2014-12-10 16:55:06 -08:00
Nik Bougalis
85fc9e4ecf Revert e4c9822d78 "Enable processor-specific optimizations when available:" 2014-12-08 14:54:03 -08:00
Mark Travis
d5c3f0c9cf Stability bugfixes for online delete SHAMapStore:
The correct ledger age is necessary for checking health
status, and the previous behavior caused the online deletion process to
abort if the process took too long.

The tuning parameter added and the parameter whose default was modified both
minimize impact of SQL DELETE operations by decreasing the default batch size
for deletes and for increasing the backoff period between deletion batches.
These parameters decrease contention for the SQLite and I/O with the trade-off
of longer processing time for online delete. Online-delete is not a
time-critical function, so a little slowness in wall-clock time is not harmful.
2014-12-08 14:54:03 -08:00
JoelKatz
a48120e675 Fix incorrect source issuer for XRP source 2014-12-08 14:54:03 -08:00
Nik Bougalis
36f8e4f2ad Improve hex conversion & parsing routines 2014-12-08 14:54:03 -08:00
David Schwartz
1084a39a45 Improve the humanAccountID cache (RIPD-693)
Profiling indicated some performance issues coming from the
cache of 160-bit account IDs to base58 format. This replaces
the single cache with two caches and rotates out old
entries.
2014-12-08 14:54:03 -08:00
Tom Ritchford
86df482842 Make sure that handlers always return Json::objectValue. 2014-12-01 17:16:24 -05:00
Tom Ritchford
b0d47ebcc6 Use better base64 handling in ServerHandlerImp. 2014-12-01 17:15:23 -05:00
Tom Ritchford
a237f9d28c Make beast::detail::chunk_encoded_buffers::to_hex() static 2014-12-01 11:12:59 -05:00
Tom Ritchford
fffdf1dfba Make beast::detail::chunk_encoded_buffers::to_hex() static 2014-12-01 11:12:59 -05:00
Tom Ritchford
f1eb9d4f89 Remove unused BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES. 2014-12-01 10:56:03 -05:00
Tom Ritchford
3273ed2616 Remove unused BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES. 2014-12-01 10:56:03 -05:00
Vinnie Falco
aa7b0a31b0 Refactor protocol message parsing:
This replaces the stateful class parser with a stateless free function.
The protocol buffer message is parsed using a ZeroCopyInputStream.

* Invoke method is now a free function.
* Protocol handler doesn't need to derive from an abstract interface
* Only up to one message is processed at a time by the invoker.
* Remove error_code return from the handler's message processing functions.
* Add ZeroCopyInputStream implementation that wraps a BufferSequence.
* Free function parses up to one protocol message and calls the handler.
* Message type and size can be calculated from an iterator
  range or a buffer sequence.
2014-11-26 12:23:21 -08:00
Vinnie Falco
fb0d44d403 Use cluster state in Slot instead of PeerImp 2014-11-26 12:23:10 -08:00
Vinnie Falco
cd8ec89cbb Use injections from OverlayImpl in PeerImp 2014-11-26 12:23:02 -08:00
Vinnie Falco
1da5e090d5 Fixes to beast::asio::streambuf:
* Fix to_string conversion
* Fix assert on debug invariant checks
* Fix the treatment of the output position when the entire output is committed.
* Add unit test
2014-11-26 12:22:55 -08:00
Vinnie Falco
252f271dc5 Fixes to beast::asio::streambuf:
* Fix to_string conversion
* Fix assert on debug invariant checks
* Fix the treatment of the output position when the entire output is committed.
* Add unit test
2014-11-26 12:22:55 -08:00
Vinnie Falco
62d400c3a9 Move the call to cancel_timer to the right place 2014-11-26 12:22:46 -08:00
Scott Schurr
f9aa3e0da5 Add more unit tests to rpc/impl/TransactionSign (RIPD-480):
By adding a mock it is possible to test the transactionSign
function without interacting with the ledger.  This is the
smallest change I could come up with that allows transactionSign
to be unit tested.

The unit tests are white boxed.  Each test case is a result
of examining the code and identifying behavior associated with
different JSON fields.  That means the tests are not based on
requirements, they are based on observed behavior.
2014-11-26 12:07:44 -08:00
Vinnie Falco
5cde522d5e Remove unused chrono::time_point stream conversions 2014-11-25 19:19:56 -08:00
Vinnie Falco
685fe5b0fb Don't call std::exit on clean exit 2014-11-25 19:19:56 -08:00
Vinnie Falco
8aa4a027bb Template abstract_clock on Clock:
The abstract_clock is now templated on a type meeting the requirements of
the Clock concept. It inherits the nested types of the Clock on which it
is based. This resolves a problem with the original design which broke the
type-safety of time_point from different abstract clocks.
2014-11-25 19:19:56 -08:00
Vinnie Falco
5180e71a0d Remove unused chrono::time_point stream conversions 2014-11-25 19:19:56 -08:00
Vinnie Falco
55637f7508 Template abstract_clock on Clock:
The abstract_clock is now templated on a type meeting the requirements of
the Clock concept. It inherits the nested types of the Clock on which it
is based. This resolves a problem with the original design which broke the
type-safety of time_point from different abstract clocks.
2014-11-25 19:19:56 -08:00
Nicholas Dudfield
7d72dfe0be Updated freeze tests:
* Always run freeze tests (and  enforcement tests)
* book_offers filtering tests are broken
2014-11-25 11:46:34 -08:00
Mark Travis
02529a0fc2 SHAMapStore Online Delete (RIPD-415):
Makes rippled configurable to support deletion of all data in its key-value
store (nodestore) and ledger and transaction SQLite databases based on
validated ledger sequence numbers. All records from a specified ledger
and forward shall remain available in the key-value store and SQLite, and
all data prior to that specific ledger may be deleted.

Additionally, the administrator may require that an RPC command be
executed to enable deletion. This is to align data deletion with local
policy.
2014-11-25 11:44:02 -08:00
JoelKatz
b44974677e Cleanup some stray formatting left in logs 2014-11-21 17:13:13 -08:00
Vinnie Falco
d4fd5e4fce HTTP Handshaking for Peers on Universal Port (RIPD-446):
This introduces a considerable change in the way that peers handshake. Instead
of sending the TMHello protocol message, the peer making the connection (client
role) sends an HTTP Upgrade request along with some special headers. The peer
acting in the server role sends an HTTP response completing the upgrade and
transition to RTXP (Ripple Transaction Protocol, a.k.a. peer protocol). If the
server has no available slots, then it sends a 503 Service Unavailable HTTP
response with a JSON content-body containing IP addresses of other servers to
try. The information that was previously contained in the TMHello message is
now communicated in the HTTP request and HTTP response including the secure
cookie to prevent man in the middle attacks. This information is documented
in the overlay README.md file.

To prevent disruption on the network, the handshake feature is rolled out in
two parts. This is part 1, where new servents acting in the client role will
send the old style TMHello handshake, and new servents acting in the server
role can automatically detect and accept both the old style TMHello handshake,
or the HTTP request accordingly. This detection happens in the Server module,
which supports the universal port. An experimental .cfg setting allows clients
to instead send HTTP handshakes when establishing peer connections. When this
code has reached a significant fraction of the network, these clients will be
able to establish a connection to the Ripple network using HTTP handshakes.

These changes clean up the handling of the socket for peers. It fixes a long
standing bug in the graceful close sequence, where remaining data such as the
IP addresses of other servers to try, did not get sent. Redundant state
variables for the peer are removed and the treatment of completion handlers is
streamlined. The treatment of SSL short reads and secure shutdown is also fixed.

Logging for the peers in the overlay module are divided into two partitions:
"Peer" and "Protocol". The Peer partition records activity taking place on the
socket while the Protocol partition informs about RTXP specific actions such as
transaction relay, fetch packs, and consensus rounds. The severity on the log
partitions may be adjusted independently to diagnose problems. Every log
message for peers is prefixed with a small, unique integer id in brackets,
to accurately associate log messages with peers.

HTTP handshaking is the first step in implementing the Hub and Spoke feature,
which transforms the network from a homogeneous network where all peers are
the same, into a structured network where peers with above average capabilities
in their ability to process ledgers and transactions self-assemble to form a
backbone of high powered machines which in turn serve a much larger number of
'leaves' with lower capacities with a goal to improve the number of
transactions that may be retired over time.
2014-11-21 16:47:12 -08:00
Vinnie Falco
d9c49386cb Add WrappedSink:
This class puts a configured string prefix in front of
each line of Journal output.
2014-11-21 16:46:57 -08:00
Vinnie Falco
30123eaa4a Add WrappedSink:
This class puts a configured string prefix in front of
each line of Journal output.
2014-11-21 16:46:57 -08:00
Nik Bougalis
454ec97d51 Replace custom exceptions with std::runtime_error 2014-11-21 13:15:41 -08:00
Vinnie Falco
cd98d1c1f9 Fix unit_test suite matching with full names 2014-11-21 12:59:32 -08:00
Vinnie Falco
c2ac331e78 Fix unit_test suite matching with full names 2014-11-21 12:59:32 -08:00
Nik Bougalis
756ac603db Simplify the Beast fatal error reporting framework:
* Reduce interface to a single function which reports error details
* Remove unused functions
2014-11-21 12:59:32 -08:00
Nik Bougalis
be4a35af11 Clarify SetAccount logic and clean up existing code 2014-11-21 12:59:32 -08:00
Tom Ritchford
445b29ad0d Fix RPC handlers to use the results of lookupLedger. 2014-11-21 12:59:32 -08:00
Vinnie Falco
64d0f7fffd Fix DecayingSample treatment of the window 2014-11-21 12:59:32 -08:00
Nik Bougalis
baf0d09455 Simplify the Beast fatal error reporting framework:
* Reduce interface to a single function which reports error details
* Remove unused functions
2014-11-21 12:59:32 -08:00
Vinnie Falco
933a98b97c Add http::chunk_encode:
This transforms a ConstBufferSequence into a new ConstBufferSequence whose
data is encoded according to the Content transfer encoding rules of RFC2616.
The implementation does not copy any memory.
2014-11-20 20:15:29 -08:00
Vinnie Falco
08a81a0ab9 Tidy up the structure of sources in protocol/:
Split out and rename STValidation
Split out and rename STBlob
Split out and rename STAccount
Split out STPathSet
Split STVector256 and move UintTypes to protocol/
Rename to STBase
Rename to STLedgerEntry
Rename to SOTemplate
Rename to STTx
Remove obsolete AgedHistory
Remove types.h and add missing includes
Remove unnecessary includes in app.h
Remove unnecessary includes in app.h
Remove include app.h from app1.cpp
2014-11-20 20:15:29 -08:00
Donovan Hide
b14751aad9 Use asio signal handling in Application (RIPD-140):
* Use signal_set as cross platform way of handling SIGINT
* Remove polling on main thread for shutdown.
* Add extra logging for received signal.
* Clean up exit handling on error in setup routines.
* Reuse isStopped() from Stoppable for status (could be isStopping() instead).
* Ctrl-C should now work for standalone mode as well on Windows.

Also small fixes to Resolver:
* Add Resolver prefix to logging.
* Fix AsyncObject::removeReference() logic.
* Fix work remaining logic.
2014-11-20 20:15:29 -08:00
Nik Bougalis
31110c7fd9 Cleanup ripple::Ledger:
* Convert static member functions to free functions
* Adopt consistent naming convention
* De-inline code
2014-11-20 20:15:29 -08:00
Vinnie Falco
0e1dd92d9b Fix case where slot==nullptr in Overlay:
This changes the Overlay to correctly handle the case when nullptr is
returned by PeerFinder new_inbound_slot on a detected self-connection.
2014-11-20 20:15:29 -08:00
Vinnie Falco
a3204a4df7 Add http::chunk_encode:
This transforms a ConstBufferSequence into a new ConstBufferSequence whose
data is encoded according to the Content transfer encoding rules of RFC2616.
The implementation does not copy any memory.
2014-11-20 20:15:29 -08:00
Donovan Hide
2288ab48b9 Use asio signal handling in Application (RIPD-140):
* Use signal_set as cross platform way of handling SIGINT
* Remove polling on main thread for shutdown.
* Add extra logging for received signal.
* Clean up exit handling on error in setup routines.
* Reuse isStopped() from Stoppable for status (could be isStopping() instead).
* Ctrl-C should now work for standalone mode as well on Windows.

Also small fixes to Resolver:
* Add Resolver prefix to logging.
* Fix AsyncObject::removeReference() logic.
* Fix work remaining logic.
2014-11-20 20:15:29 -08:00
mDuo13
670401884c Improve the human-readable description of the tesSUCCESS code:
Transactions that return tesSUCCESS have only been accepted and
propagated on the Ripple network and should not be considered
final until they have been included in a validated ledger.
2014-11-20 20:14:04 -08:00
Yana
37181c341e Changed doc/rippled-example.cfg to specify default for ssl_verify 2014-11-14 11:19:42 -08:00
wltsmrz
be7e677448 Update integration tests for changes to ripple-lib account request API:
Account requests expect an object as first argument
2014-11-14 11:10:12 -08:00
Josh Juran
b2eeb49a45 Clean up CKey and RippleAddress (RIPD-672)
* Remove CKey dependency on RippleAddress
* Create RAII ec_key wrapper that hides EC_KEY and other OpenSSL details
* Move CKey member logic into free functions
* Delete CKey class
* Rename units that are no longer CKey-related
* Delete code that was unused
2014-11-14 11:10:12 -08:00
Vinnie Falco
f3ebd508d6 Accept generic arguments in ci_equal 2014-11-14 11:10:11 -08:00
Vinnie Falco
9aa040d917 Accept generic arguments in ci_equal 2014-11-14 11:10:11 -08:00
Vinnie Falco
5d33ce352e Tidy up split_commas function and use it in Server
Conflicts:
	src/ripple/server/impl/ServerHandlerImp.cpp
2014-11-14 11:10:11 -08:00
Vinnie Falco
c2043a223b Tidy up split_commas function and use it in Server
Conflicts:
	src/ripple/server/impl/ServerHandlerImp.cpp
2014-11-14 11:10:11 -08:00
Vinnie Falco
f24e859f17 Construct Server after Overlay and WSDoors:
When the ServerHandler is constructed before the Overlay, an incoming
connection received after the server's listening ports have been opened
but before the Overlay object has been created causes a crash.
2014-11-14 11:10:11 -08:00
Vinnie Falco
737b33f9d1 Merge branch 'release' into develop 2014-11-14 10:56:45 -08:00
David Schwartz
00791d2151 Set version to 0.26.4-sp3 2014-11-11 16:33:52 -08:00
David Schwartz
b141598f9b Fix bugs in pathfinding with XRP as the source currency 2014-11-11 16:27:39 -08:00
Tom Ritchford
d1618d79b0 Fix pathfinding with multiple issuers for one currency (RIPD-618).
* Allow pathfinding requests where the starting currency may have
  multiple issuers.

* Cache paths over all issuers to avoid repeating work.

* Clear the ledger checkpoint in one retry case.

* Add an additional node at the front of paths when the starting issuer
  is not the source account.
2014-11-11 16:27:03 -08:00
Tom Ritchford
00c84dfe5c Clean up Pathfinder.
* Restrict to 80-columns and other style cleanups.
* Make pathfinding a free function and hide the class Pathfinder.
* Split off unrelated utility functions into separate files.
2014-11-11 16:26:38 -08:00
Vinnie Falco
95f31b98a8 Set version to 0.26.4-sp2 2014-11-11 14:22:37 -08:00
Miguel Portilla
10d74ed100 Fix account_lines, account_offers and book_offers result (RIPD-682):
The RPC account_lines and account_offers commands respond with the correct ledger info. account_offers, account_lines and book_offers allow admins unlimited size on the limit param. Specifying a negative value on limit clamps to the minimum value allowed. Incorrect types for limit are correctly reported in the result.
2014-11-11 14:21:49 -08:00
Vinnie Falco
8a7f612d5b Revert pathfinding changes:
* 5e7c527 Revert "Fix account_lines, account_offers and book_offers result (RIPD-682):"
* b3417ca Revert "Fix pathfinding with multiple issuers for one currency (RIPD-618)."
* 00db7f5 Revert "Clean up Pathfinder."
2014-11-11 14:21:40 -08:00
Tom Ritchford
c1e070c042 Add missing header needed for boost 1.57 compatibility. 2014-11-10 23:23:53 -05:00
Tom Ritchford
0829ee9234 Add missing header needed for boost 1.57 compatibility. 2014-11-10 23:23:53 -05:00
Nik Bougalis
ade26e2c86 Make Stoppable unit tests manual 2014-11-10 23:23:53 -05:00
Nik Bougalis
b22e33444b Make Stoppable unit tests manual 2014-11-10 23:23:53 -05:00
David Schwartz
d115a12cbe Remove dead TxQueue code 2014-11-10 23:23:53 -05:00
Nik Bougalis
b7b744de94 Remove sole use of beast::MurmurHash 2014-11-10 15:00:20 -08:00
Nik Bougalis
b668b79341 Remove MurmurHash from Beast 2014-11-10 14:00:54 -08:00
Nik Bougalis
68e46e406a Remove MurmurHash from Beast 2014-11-10 14:00:54 -08:00
Miguel Portilla
a46ae4efec Set version to 0.26.4-sp1 2014-11-10 16:25:45 -05:00
Miguel Portilla
62777a794e Fix account_lines, account_offers and book_offers result (RIPD-682):
The RPC account_lines and account_offers commands respond with the correct ledger info. account_offers, account_lines and book_offers allow admins unlimited size on the limit param. Specifying a negative value on limit clamps to the minimum value allowed. Incorrect types for limit are correctly reported in the result.
2014-11-10 16:25:14 -05:00
Tom Ritchford
329a969761 Remove unused RPCServer. 2014-11-10 12:53:21 -08:00
Vinnie Falco
7bc26c5ea0 Add WrappedSink 2014-11-10 12:52:57 -08:00
Vinnie Falco
30170bc394 Add short_read manual unit test:
This manual unit test explores the outcomes of shutting down
SSL stream connections at various point during a session.
2014-11-10 12:52:57 -08:00
Vinnie Falco
f193302e15 Add WrappedSink 2014-11-10 12:52:57 -08:00
Vinnie Falco
5ece1fa568 Add operator<< for basic_streambuf 2014-11-10 12:52:43 -08:00
Vinnie Falco
7c4870d641 Add operator<< for basic_streambuf 2014-11-10 12:52:43 -08:00
Vinnie Falco
98ea17f7fc Make ci_equal a function 2014-11-10 12:52:42 -08:00
Vinnie Falco
8b84a76d5d Make ci_equal a function 2014-11-10 12:52:42 -08:00
Vinnie Falco
8d25cc3c92 Add rfc2616::parse_csv 2014-11-10 12:52:42 -08:00
Vinnie Falco
a4cd761372 Add rfc2616::parse_csv 2014-11-10 12:52:42 -08:00
Miguel Portilla
63d2cfd6ba Fix account_lines, account_offers and book_offers result (RIPD-682):
The RPC account_lines and account_offers commands respond with the correct
ledger info. account_offers, account_lines and book_offers allow admins
unlimited size on the limit param. Specifying a negative value on limit clamps
to the minimum value allowed. Incorrect types for limit are correctly reported
in the result.
2014-11-10 12:46:36 -08:00
Tom Ritchford
bb44bdd047 Fix pathfinding with multiple issuers for one currency (RIPD-618).
* Allow pathfinding requests where the starting currency may have
  multiple issuers.

* Cache paths over all issuers to avoid repeating work.

* Clear the ledger checkpoint in one retry case.

* Add an additional node at the front of paths when the starting issuer
  is not the source account.
2014-11-10 12:07:57 -05:00
Tom Ritchford
6904e66384 Clean up Pathfinder.
* Restrict to 80-columns and other style cleanups.
* Make pathfinding a free function and hide the class Pathfinder.
* Split off unrelated utility functions into separate files.
2014-11-10 12:06:49 -05:00
Vinnie Falco
15c1055ff4 Fix weak_fn unit test. 2014-11-09 20:27:05 -08:00
Vinnie Falco
fbffe2367e Fix weak_fn unit test. 2014-11-09 20:27:05 -08:00
Vinnie Falco
e442a2846d Overlay improvements and bug fixes:
PeerImp::detach had a default argument graceful=true which did not
correctly close the socket and cause the Overlay to often hang on exit.
The logging for Overlay and Peers has been reworked. All the socket activity
is logged to Peers while protocol activity goes to Protocol. Every log line
is prefixed by a small integer ID unique to the connection.
* Removed graceful PeerImp::detach option
* Peer and Protocol log message handle respective types of logging
* Log messages prefixed with peer unique integer
* Prevent call to timer ancel from throwing an exception
2014-11-08 14:39:46 -08:00
Vinnie Falco
f6985586ea Better logging when opening Server ports. 2014-11-08 14:36:45 -08:00
Vinnie Falco
2bae5b0959 Throw if rippled.cfg is missing a [server] section 2014-11-08 14:36:45 -08:00
Vinnie Falco
c930151a95 Remove obsolete get_pointer 2014-11-08 14:36:44 -08:00
Vinnie Falco
1e58809fcc Remove obsolete get_pointer 2014-11-08 14:36:44 -08:00
Vinnie Falco
3d7c6f831c Add weak_fn 2014-11-08 14:36:44 -08:00
Vinnie Falco
6b1d213cc2 Add weak_fn 2014-11-08 14:36:44 -08:00
David Schwartz
ef57b3954c Add missing include needed for std::bad_cast in LexicalCast.h 2014-11-07 15:23:43 -08:00
David Schwartz
42bec13a83 Add missing include needed for std::bad_cast in LexicalCast.h 2014-11-07 15:23:43 -08:00
Vinnie Falco
4415a179b3 Update freeze test for moved TxFlags.h 2014-11-07 14:12:43 -08:00
Vinnie Falco
878070084e Refactor the structure of source files:
* New src/ripple/crypto and src/ripple/protocol directories
* Merged src/ripple/common into src/ripple/basics
* Move resource/api files up a level
* Add headers for "include what you use"
* Normalized include guards
* Renamed to JsonFields.h
* Remove obsolete files
* Remove net.h unity header
* Remove resource.h unity header
* Removed some deprecated unity includes
2014-11-07 13:40:43 -08:00
Vinnie Falco
5d42604efd Refactor the structure of source files:
* New src/ripple/crypto and src/ripple/protocol directories
* Merged src/ripple/common into src/ripple/basics
* Move resource/api files up a level
* Add headers for "include what you use"
* Normalized include guards
* Renamed to JsonFields.h
* Remove obsolete files
* Remove net.h unity header
* Remove resource.h unity header
* Removed some deprecated unity includes
2014-11-07 13:40:43 -08:00
Vinnie Falco
ef5adc507a Add missing includes. 2014-11-07 12:24:02 -08:00
Vinnie Falco
b134b7d3f6 Add missing includes. 2014-11-07 12:24:02 -08:00
Vinnie Falco
788219fe05 Adjust SSL context generation for Server:
The creation of self-signed certificates slows down the command
line client when launched repeatedly during unit test.
* Contexts are no longer generated for the command line client
* A port with no secure protocols generates an empty context
2014-11-07 06:13:56 -08:00
Tom Ritchford
9a7f66cfe9 Fix compilation errors in RPC/RipplePathFind.cpp 2014-11-06 21:58:13 -05:00
Tom Ritchford
daa4d16e61 Remove unused isXRP(Issue) function. 2014-11-06 20:17:13 -05:00
Tom Ritchford
cf05f87795 Fix pathfinding with multiple issuers for one currency (RIPD-618).
* Allow pathfinding requests where the starting currency may have
  multiple issuers.

* Cache paths over all issuers to avoid repeating work.

* Clear the ledger checkpoint in one retry case.

* Add an additional node at the front of paths when the starting issuer
  is not the source account.
2014-11-06 20:14:01 -05:00
Tom Ritchford
c2f2f83b7c Clean up Pathfinder.
* Restrict to 80-columns and other style cleanups.
* Make pathfinding a free function and hide the class Pathfinder.
* Split off unrelated utility functions into separate files.

Conflicts:
	src/ripple/rpc/handlers/RipplePathFind.cpp
2014-11-06 16:58:10 -08:00
Tom Ritchford
b30b2a523f Fix public member names of RPC::Context.
Conflicts:
	src/ripple/rpc/handlers/AccountTx.cpp
	src/ripple/rpc/handlers/AccountTxOld.cpp
	src/ripple/rpc/handlers/Ledger.cpp
	src/ripple/rpc/handlers/LedgerData.cpp
	src/ripple/rpc/handlers/RipplePathFind.cpp
	src/ripple/rpc/handlers/ServerInfo.cpp
	src/ripple/rpc/handlers/ServerState.cpp
	src/ripple/rpc/handlers/Submit.cpp
	src/ripple/rpc/handlers/Subscribe.cpp
	src/ripple/rpc/handlers/TxHistory.cpp
	src/ripple/rpc/handlers/Unsubscribe.cpp
	src/ripple/rpc/impl/Context.h
2014-11-06 16:55:20 -08:00
Nicholas Dudfield
150a3810a8 Update npm test rippled.cfg to use [server]:
The test now generates a configuration file with the new
configuration sections define by the Universal Port feature.
2014-11-06 16:10:00 -08:00
Vinnie Falco
ac0eaa912b Universal Port (RIPD-160):
This changes the behavior and configuration specification of the listening
ports that rippled uses to accept incoming connections for the supported
protocols: peer (Peer Protocol), http (JSON-RPC over HTTP), https (JSON-RPC)
over HTTPS, ws (Websockets Clients), and wss (Secure Websockets Clients).
Each listening port is now capable of handshaking in multiple protocols
specified in the configuration file (subject to some restrictions). Each
port can be configured to provide its own SSL certificate, or to use a
self-signed certificate. Ports can be configured to share settings, this
allows multiple ports to use the same certificate or values. The list of
ports is dynamic, administrators can open as few or as many ports as they
like. Authentication settings such as user/password or admin user/admin
password (for administrative commands on RPC or Websockets interfaces) can
also be specified per-port.

As the configuration file has changed significantly, administrators will
need to update their ripple.cfg files and carefully review the documentation
and new settings.

Changes:

* rippled-example.cfg updated with documentation and new example settings:
  All obsolete websocket, rpc, and peer configuration sections have been
  removed, the documentation updated, and a new documented set of example
  settings added.

* HTTP::Writer abstraction for sending HTTP server requests and responses
* HTTP::Handler handler improvements to support Universal Port
* HTTP::Handler handler supports legacy Peer protocol handshakes
* HTTP::Port uses shared_ptr<boost::asio::ssl::context>
* HTTP::PeerImp and Overlay use ssl_bundle to support Universal Port
* New JsonWriter to stream message and body through HTTP server
* ServerHandler refactored to support Universal Port and legacy peers
* ServerHandler Setup struct updated for Universal Port
* Refactor some PeerFinder members
* WSDoor and Websocket code stores and uses the HTTP::Port configuration
* Websocket autotls class receives the current secure/plain SSL setting
* Remove PeerDoor and obsolete Overlay peer accept code
* Remove obsolete RPCDoor and synchronous RPC handling code
* Remove other obsolete classes, types, and files
* Command line tool uses ServerHandler Setup for port and authorization info
* Fix handling of admin_user, admin_password in administrative commands
* Fix adminRole to check credentials for Universal Port
* Updated Overlay README.md

* Overlay sends IP:port redirects on HTTP Upgrade peer connection requests:
  Incoming peers who handshake using the HTTP Upgrade mechanism don't get
  a slot, and always get HTTP Status 503 redirect containing a JSON
  content-body with a set of alternate IP and port addresses to try, learned
  from PeerFinder. A future commit related to the Hub and Spoke feature will
  change the response to grant the peer a slot when there are peer slots
  available.

* HTTP responses to outgoing Peer connect requests parse redirect IP:ports:
  When the [overlay] configuration section (which is experimental) has
  http_handshake = 1, HTTP redirect responses will have the JSON content-body
  parsed to obtain the redirect IP:port addresses.

* Use a single io_service for HTTP::Server and Overlay:
  This is necessary to allow HTTP::Server to pass sockets to and from Overlay
  and eventually Websockets. Unfortunately Websockets is not so easily changed
  to use an externally provided io_service. This will be addressed in a future
  commit, and is one step necessary ease the restriction on ports configured
  to offer Websocket protocols in the .cfg file.
2014-11-06 16:10:00 -08:00
Vinnie Falco
05a04aa801 Set version to 0.26.4 2014-11-03 16:53:37 -08:00
Vinnie Falco
ea7013a34d Improved beast::http::message:
* Add headers::erase
* Set http::message version with std::pair
* Use std::pair for headers::value_type
2014-11-03 16:40:57 -08:00
Vinnie Falco
e37d4043f6 Add missing includes to make headers compile separately 2014-11-03 16:40:57 -08:00
Vinnie Falco
d073425b44 Improved beast::http::message:
* Add headers::erase
* Set http::message version with std::pair
* Use std::pair for headers::value_type
2014-11-03 16:40:57 -08:00
Nicholas Dudfield
825b18cf71 Add bin/stop-test.js shutdown testing script:
This script launches rippled repeatedly and then issues a stop command
after a variable amount of time. This is to test the shutdown of the
application and catch errors.
2014-11-03 16:31:21 -08:00
Vinnie Falco
549ad3204f Fix race conditions closing HTTP I/O objects:
This fixes a case where stop can sometimes skip calling close on some
I/O objects or crash in a rare circumstance where a connection is in the
process of being torn down at the exact time the server is stopped. When
the acceptor receives errors, it logs the error and continues listening
instead of stopping.
2014-11-03 14:11:06 -08:00
Vinnie Falco
35f9499b67 Fix Overlay stop on exit:
The stop sequence for Overlay had a race condition where autoconnect could
be called after close_all, resulting in a hang on exit. This resolves the
problem by putting the close and timer operations on a strand:
* Rename some Overlay members
* Put close on strand and tidy up members
* Use completion handler instead of coroutine for timer
* Use App io_service in PeerFinder
2014-11-03 14:11:05 -08:00
Vinnie Falco
db82c35c17 Remove spurious assert in ResolverAsioImpl 2014-11-03 14:11:05 -08:00
Vinnie Falco
73c74f753c Change to the Application io_service:
* Simplified the implementation and removed class IoServicePool
* The io_service outlives the components of the Application
2014-11-03 14:11:05 -08:00
JoelKatz
a38fb2a5dc Clear the acquiring ledger when shutting down NetworkOPs:
This solves a circular destruction problem on exit.
2014-11-03 14:11:04 -08:00
Donovan Hide
38e99e01f9 Improve nodestore benchmarking:
* Use more succinct while loops on NodeFactory.
* Better formatting of multiple test results.
* Updated benchmarks.
* Use simpler and faster RNG to generate test data.
2014-11-02 07:16:08 -08:00
Donovan Hide
a1f46e84b8 Add new RocksDBQuickFactory for benchmarking:
This new factory is intended for benchmarking against the existing RocksDBFactory and has the following differences.
* Does not use BatchWriter
* Disables WAL for writes to memtable
* Uses a hash index in blocks
* Uses RocksDB OptimizeFor… functions
See Benchmarks.md for further discussion of some of the issues raised by investigation of RocksDB performance.
2014-11-01 07:12:09 -07:00
Donovan Hide
6540804571 Add repeatable NodeStore timing benchmark:
The timing test is changed to overcome possible file buffer cache effects by creating different read access patterns. The unittest-arg command line arguments allow running the benchmarks against any of the available backends and altering the parameters passed in the same format as rippled.cfg. The num_objects parameter permits variation of the number of key/values inserted. The data is random but matches reasonably well the values that rippled might generate.
2014-11-01 07:12:08 -07:00
Howard Hinnant
eb64a4387d Refactor Stoppable:
The Stoppable interface aids in the enforcement of invariants needed to
successful start and stop a multi-threaded application composed of classes
that depend on each other in complex ways.
* Test written to confirm the current behavior.
* Comments updated to reflect the current behavior.
* Public API reduced to what is currently in use.
* Protected data members made private.
* volatile bool members changed to std::atomic<bool>.
* std::atomic<int> members changed to std::atomic<bool>.
* Name storage uses std::string
2014-10-31 21:29:16 -07:00
Howard Hinnant
ffe6707595 Refactor Stoppable:
The Stoppable interface aids in the enforcement of invariants needed to
successful start and stop a multi-threaded application composed of classes
that depend on each other in complex ways.
* Test written to confirm the current behavior.
* Comments updated to reflect the current behavior.
* Public API reduced to what is currently in use.
* Protected data members made private.
* volatile bool members changed to std::atomic<bool>.
* std::atomic<int> members changed to std::atomic<bool>.
* Name storage uses std::string
2014-10-31 21:29:16 -07:00
Tom Ritchford
68fe1a7c8f New class TempDirectory in UnitTestUtilities. 2014-10-31 21:21:54 -07:00
Tom Ritchford
9b21740c9f Delete temporary directories at the end of tests (RIPD-460). 2014-10-31 21:21:54 -07:00
Tom Ritchford
bd12e2ab95 New class TempDirectory in UnitTestUtilities. 2014-10-31 21:21:54 -07:00
Donovan Hide
bffb5ef8b4 Avoid zero initialization of Blob:
This seemed to improve the performance of the copy, although there did seem to be some byte by byte copying still present. Further investigation recommended.
2014-10-31 20:12:39 -07:00
Donovan Hide
e4c9822d78 Enable processor-specific optimizations when available:
The SConstruct is modified to enable processor specific optimizations on clang and gcc toolchains. This improves the performance of RocksDB's CRC function. It might also enable other used libraries that are in the codebase now or in the future to apply cpu-specific optimisations. The mtune option ensures that a binary compiled on one machine will function on another,
2014-10-31 20:12:39 -07:00
Vinnie Falco
73187d8832 Remove obsolete multitls and proxy websocket features 2014-10-31 15:15:40 -07:00
Vinnie Falco
8101154d5e Remove obsolete websocket PROXY port 2014-10-31 15:15:40 -07:00
Vinnie Falco
c02937fd6f Remove obsolete sections from rippled-example.cfg:
* peer_port_proxy is obsolete since the MultiSocket was removed.
* peer_ssl_cipher_list has no effect, SSL ciphers are hard coded for security.
2014-10-31 15:15:40 -07:00
Vinnie Falco
3430be4075 Add PeerFinder onRedirects function 2014-10-31 13:27:55 -07:00
Vinnie Falco
320897bad6 Add streambuf to_string function 2014-10-31 13:27:38 -07:00
Vinnie Falco
3f2b6f771f Add streambuf to_string function 2014-10-31 13:27:38 -07:00
Vinnie Falco
6e39b49cc2 Add Json::stream to write Value to a Streambuf 2014-10-31 13:27:33 -07:00
Vinnie Falco
71c34ed4e0 Remove unused ErrorReply function 2014-10-31 13:25:54 -07:00
Vinnie Falco
477178675c Fix parseIniFile for duplicate sections 2014-10-31 13:25:30 -07:00
Vinnie Falco
dbdf68b248 Refactor HTTP::Server to support Universal Port:
These changes are necessary to support the Universal port feature. Synopsis:

* Persist HTTP peer io_service::work lifetime:
This simplification eliminates any potential for bugs caused by incorrect
lifetime management of the io_service::work object.

* Restructure Door to prevent data races, and handle clean exit:
The Server, Door, Door::detector, and Peer objects work together to
correctly implement graceful stop and destructors that block until
all child objects have been destroyed.

Cleanups:
* De-pimpl HTTP::Server
* Rename ServerImpl data members
* Tidy up HTTP::Port interface
2014-10-30 16:02:19 -07:00
Vinnie Falco
2fd139b307 Refactor Overlay and add [overlay] config section (experimental):
These changes prepare Overlay for the Universal Port and Hub and Spoke
features.

* Add [overlay configuration section:
The [overlay] section uses the new BasicConfig interface that
supports key-value pairs in the section. Some exposition is added to the
example cfg file. The new settings for overlay are related to the Hub and
Spoke feature which is currently in development. Production servers should
not set these configuration options, they are clearly marked experimental
in the example cfg file.

Other changes:
* Use _MSC_VER to detect Visual Studio
* Use ssl_bundle in Overlay::Peer
* Use shared_ptr to SSL context in Overlay:
* Removed undocumented PEER_SSL_CIPHER_LIST configuration setting
* Add Section::name: The Section object now stores its name for better diagnostic messages.
2014-10-30 13:55:01 -07:00
Vinnie Falco
0b692080cd Add shared_ptr<boost::asio::ssl::context> to ssl_bundle:
This gives the ssl_bundle shared ownership of the underlying ssl context
so that ownership of the bundle may be transferred to other classes without
introduce lifetime issues.
2014-10-30 13:55:00 -07:00
Vinnie Falco
a6c2657062 Add shared_ptr<boost::asio::ssl::context> to ssl_bundle:
This gives the ssl_bundle shared ownership of the underlying ssl context
so that ownership of the bundle may be transferred to other classes without
introduce lifetime issues.
2014-10-30 13:55:00 -07:00
Vinnie Falco
eaa021c2e2 Make streambuf buffers_type iterators default constructible 2014-10-30 13:55:00 -07:00
Vinnie Falco
78a0bc0e2c Make streambuf buffers_type iterators default constructible 2014-10-30 13:55:00 -07:00
Edward Hennis
d352a744a5 Enable std::array overloads for boost::asio on clang:
* Remove Boost config option from beast config.
* Define from compiler, or let Boost figure out itself.
2014-10-30 13:55:00 -07:00
Edward Hennis
d7116d6867 Enable std::array overloads for boost::asio on clang:
* Remove Boost config option from beast config.
* Define from compiler, or let Boost figure out itself.
2014-10-30 13:55:00 -07:00
Josh Juran
edc15b9fa2 Use a self-signed certificate for peers (RIPD-108):
Generate a new RSA key pair and a self-signed X.509v3 certificate to use
with SSL connections to rippled peers.  New credentials are created each
startup.
2014-10-30 13:54:49 -07:00
Josh Juran
93d4b73b2f RippleSSLContext: Add openssl wrappers 2014-10-30 10:52:37 -07:00
Vinnie Falco
8e3849e591 Create Ripple SSL contexts using std::make_shared. 2014-10-30 10:52:36 -07:00
Vinnie Falco
14b439ce43 Separate beast::http::body from beast::http::message (RIPD-660):
This changes the http::message object to no longer contain a body. It modifies
the parser to store the body in a separate object, or to pass the body data
to a functor. This allows the body to be stored in more flexible ways. For
example, in HTTP responses the body can be generated procedurally instead
of being required to exist entirely in memory at once.
2014-10-29 19:23:53 -07:00
Vinnie Falco
acaa1098f7 Separate beast::http::body from beast::http::message (RIPD-660):
This changes the http::message object to no longer contain a body. It modifies
the parser to store the body in a separate object, or to pass the body data
to a functor. This allows the body to be stored in more flexible ways. For
example, in HTTP responses the body can be generated procedurally instead
of being required to exist entirely in memory at once.
2014-10-29 19:23:53 -07:00
Vinnie Falco
9e4c4ad8e5 Add beast::asio::basic_streambuf (RIPD-661):
This is class whose interface is identical to the boost::asio::basic_streambuf,
and uses an implementation that stores the data in multiple discontiguous
linear buffers, expanding and shrinking as needed.
2014-10-29 19:23:53 -07:00
Vinnie Falco
c1a5e88752 Use beast::asio::streambuf in Overlay 2014-10-29 19:23:53 -07:00
Vinnie Falco
74b99014d2 Add beast::asio::basic_streambuf (RIPD-661):
This is class whose interface is identical to the boost::asio::basic_streambuf,
and uses an implementation that stores the data in multiple discontiguous
linear buffers, expanding and shrinking as needed.
2014-10-29 19:23:53 -07:00
Tom Ritchford
9cba944d21 Add Json::to_string:
This allows the declaration for FastWriter to be hidden and makes
conversion of Json::Value objects to strings a little less clunky.
2014-10-29 19:23:52 -07:00
Tom Ritchford
8c1c2f5d05 Eliminate a copy of the string returned by FastWriter 2014-10-29 19:22:44 -07:00
Tom Ritchford
bf0fa8c562 Add 'sample' npm test:
test/sample-test.js is the smallest possible npm test.
2014-10-28 10:59:59 -07:00
Donovan Hide
3e1fc9ba6c Update unit testing command line parser parameters:
A string passed by the '--unittest-arg' command line parameter is passed to
suites when unit tests run and can be used to customize test behavior.
* Add '--unittest-arg' command line argument
* Remove obsolete '--unittest-format' command line argument
2014-10-28 10:55:44 -07:00
Vinnie Falco
f5941041d4 Improvements to beast::unit_test framework:
* Some runner member functions are now thread-safe.
* De-inline and tidy up declarations and definitions.
* arg() interface allows command lines to be passed to suites.
2014-10-28 10:41:10 -07:00
Vinnie Falco
4ceba603e4 Improvements to beast::unit_test framework:
* Some runner member functions are now thread-safe.
* De-inline and tidy up declarations and definitions.
* arg() interface allows command lines to be passed to suites.
2014-10-28 10:41:10 -07:00
Vinnie Falco
6591c21ace Set version to 0.26.4-rc4 2014-10-27 11:49:39 -07:00
Vinnie Falco
e8d03c7b9b Update rocksdb unity file 2014-10-27 11:48:21 -07:00
Vinnie Falco
6fbce4c2f7 Update src/rocksdb2 to rocksdb-3.5.1:
Merge commit 'c168d54495d7d7b84639514f6443ad99b89ce996' into develop
2014-10-27 11:37:01 -07:00
Vinnie Falco
c168d54495 Squashed 'src/rocksdb2/' changes from 25888ae..1fdd726
1fdd726 Hotfix RocksDB 3.5
d67500a Add `make install` to Makefile in 3.5.fb.
4cb631a update HISTORY.md
cfd0946 comments about the BlockBasedTableOptions migration in Options
REVERT: 25888ae Merge pull request #329 from fyrz/master
REVERT: 89833e5 Fixed signed-unsigned comparison warning in db_test.cc
REVERT: fcac705 Fixed compile warning on Mac caused by unused variables.
REVERT: b3343fd resolution for java build problem introduced by 5ec53f3edf62bec1b690ce12fb21a6c52203f3c8
REVERT: 187b299 ForwardIterator: update prev_key_ only if prefix hasn't changed
REVERT: 5ec53f3 make compaction related options changeable
REVERT: d122e7b Update INSTALL.md
REVERT: 986dad0 Merge pull request #324 from dalgaaf/wip-da-SCA-20140930
REVERT: 8ee75dc db/memtable.cc: remove unused variable merge_result
REVERT: 0fd8bbc db/db_impl.cc: reduce scope of prefix_initialized
REVERT: 676ff7b compaction_picker.cc: remove check for >=0 for unsigned
REVERT: e55aea5 document_db.cc: fix assert
REVERT: d517c83 in_table_factory.cc: use correct format specifier
REVERT: b140375 ttl/ttl_test.cc: prefer prefix ++operator for non-primitive types
REVERT: 43c789c spatialdb/spatial_db.cc: use !empty() instead of 'size() > 0'
REVERT: 0de452e document_db.cc: pass const parameter by reference
REVERT: 4cc8643 util/ldb_cmd.cc: prefer prefix ++operator for non-primitive types
REVERT: af8c2b2 util/signal_test.cc: suppress intentional null pointer deref
REVERT: 33580fa db/db_impl.cc: fix object handling, remove double lines
REVERT: 873f135 db_ttl_impl.h: pass func parameter by reference
REVERT: 8558457 ldb_cmd_execute_result.h: perform init in initialization list
REVERT: 063471b table/table_test.cc: pass func parameter by reference
REVERT: 93548ce table/cuckoo_table_reader.cc: pass func parameter by ref
REVERT: b8b7117 db/version_set.cc: use !empty() instead of 'size() > 0'
REVERT: 8ce050b table/bloom_block.*: pass func parameter by reference
REVERT: 53910dd db_test.cc: pass parameter by reference
REVERT: 68ca534 corruption_test.cc: pass parameter by reference
REVERT: 7506198 cuckoo_table_db_test.cc: add flush after delete
REVERT: 1f96330 Print MB per second compaction throughput separately for reads and writes
REVERT: ffe3d49 Add an instruction about SSE in INSTALL.md
REVERT: ee1f3cc Package generation for Ubuntu and CentOS
REVERT: f0f7955 Fixing comile errors on OS X
REVERT: 99fb613 remove 2 space linter
REVERT: b2d64a4 Fix linters, second try
REVERT: 747523d Print per column family metrics in db_bench
REVERT: 56ebd40 Fix arc lint (should fix #238)
REVERT: 637f891 Merge pull request #321 from eonnen/master
REVERT: 827e31c Make test use a compatible type in the size checks.
REVERT: fd5d80d CompactedDB: log using the correct info_log
REVERT: 2faf49d use GetContext to replace callback function pointer
REVERT: 983d2de Add AUTHORS file. Fix #203
REVERT: abd70c5 Merge pull request #316 from fyrz/ReverseBytewiseComparator
REVERT: 2dc6f62 handle kDelete type in cuckoo builder
REVERT: 8b8011a Changed name of ReverseBytewiseComparator based on review comment
REVERT: 389edb6 universal compaction picker: use double for potential overflow
REVERT: 5340484 Built-in comparator(s) in RocksJava
REVERT: d439451 delay initialization of cuckoo table iterator
REVERT: 94997ea reduce memory usage of cuckoo table builder
REVERT: c627595 improve memory efficiency of cuckoo reader
REVERT: 581442d option to choose module when calculating CuckooTable hash
REVERT: fbd2daf CompactedDBImpl::MultiGet() for better CuckooTable performance
REVERT: 3c68006 CompactedDBImpl
REVERT: f7375f3 Fix double deletes
REVERT: 21ddcf6 Remove allow_thread_local
REVERT: fb4a492 Merge pull request #311 from ankgup87/master
REVERT: 611e286 Merge branch 'master' of https://github.com/facebook/rocksdb
REVERT: 0103b44 Merge branch 'master' of ssh://github.com/ankgup87/rocksdb
REVERT: 1dfb7bb Add block based table config options
REVERT: cdaf44f Enlarge log size cap when printing file summary
REVERT: 7cc1ed7 Merge pull request #309 from naveenatceg/staticbuild
REVERT: ba6d660 Resolving merge conflict
REVERT: 51eeaf6 Addressing review comments
REVERT: fd7d3fe Addressing review comments (adding a env variable to override temp directory)
REVERT: cf7ace8 Addressing review comments
REVERT: 0a29ce5 re-enable BlockBasedTable::SetupForCompaction()
REVERT: 55af370 Remove TODO for checking index checksums
REVERT: 3d74f09 Fix compile
REVERT: 53b0039 Fix release compile
REVERT: d0de413 WriteBatchWithIndex to allow different Comparators for different column families
REVERT: 57a32f1 change target_file_size_base to uint64_t
REVERT: 5e6aee4 dont create backup_input if compaction filter v2 is not used
REVERT: 49b5f94 Merge pull request #306 from Liuchang0812/fix_cast
REVERT: 787cb4d remove cast, replace %llu with % PRIu64
REVERT: a7574d4 Update logging.cc
REVERT: 7e0dcb9 Update logging.cc
REVERT: 57fa3cc Merge pull request #304 from Liuchang0812/fix-check
REVERT: cd44522 Merge pull request #305 from Liuchang0812/fix-logging
REVERT: 6a031b6 remove unused variable
REVERT: 4436f17 fixed #303: replace %ld with % PRId64
REVERT: 7a1bd05 Merge pull request #302 from ankgup87/master
REVERT: 423e52c Merge branch 'master' of https://github.com/facebook/rocksdb
REVERT: bfeef94 Add rate limiter
REVERT: 32f2532 Print compression_size_percent as a signed int
REVERT: 976caca Skip AllocateTest if fallocate() is not supported in the file system
REVERT: 3b897cd Enable no-fbcode RocksDB build
REVERT: f445947 RocksDB: Format uint64 using PRIu64 in db_impl.cc
REVERT: e17bc65 Merge pull request #299 from ankgup87/master
REVERT: b93797a Fix build
REVERT: adae3ca [Java] Fix JNI link error caused by the removal of options.db_stats_log_interval
REVERT: 90b8c07 Fix unit tests errors
REVERT: 51af7c3 CuckooTable: add one option to allow identity function for the first hash function
REVERT: 0350435 Fixed a signed-unsigned comparison in spatial_db.cc -- issue #293
REVERT: 2fb1fea Fix syncronization issues
REVERT: ff76895 Remove some unnecessary constructors
REVERT: feadb9d fix cuckoo table builder test
REVERT: 3c232e1 Fix mac compile
REVERT: 54cada9 Run make format on PR #249
REVERT: 27b22f1 Merge pull request #249 from tdfischer/decompression-refactoring
REVERT: fb6456b Replace naked calls to operator new and delete (Fixes #222)
REVERT: 5600c8f cuckoo table: return estimated size - 1
REVERT: a062e1f SetOptions() for memtable related options
REVERT: e4eca6a Options conversion function for convenience
REVERT: a7c2094 Merge pull request #292 from saghmrossi/master
REVERT: 4d05234 Merge branch 'master' of github.com:saghmrossi/rocksdb
REVERT: 60a4aa1 Test use_mmap_reads
REVERT: 94e43a1 [Java] Fixed 32-bit overflowing issue when converting jlong to size_t
REVERT: f9eaaa6 added include for inttypes.h to fix nonworking printf statements
REVERT: f090575 Replaced "built on on earlier work" by "built on earlier work" in README.md
REVERT: faad439 Fix #284
REVERT: 49aacd8 Fix make install
REVERT: acb9348 [Java] Include WriteBatch into RocksDBSample.java, fix how DbBenchmark.java handles WriteBatch.
REVERT: 4a27a2f Don't sync manifest when disableDataSync = true
REVERT: 9b8480d Merge pull request #287 from yinqiwen/rate-limiter-crash-fix
REVERT: 28be16b fix rate limiter crash #286
REVERT: 04ce1b2 Fix #284
REVERT: add22e3 standardize scripts to run RocksDB benchmarks
REVERT: dee91c2 WriteThread
REVERT: 540a257 Fix WAL synced
REVERT: 24f034b Merge pull request #282 from Chilledheart/develop
REVERT: 49fe329 Fix build issue under macosx
REVERT: ebb5c65 Add make install
REVERT: 0352a9f add_wrapped_bloom_test
REVERT: 9c0e66c Don't run background jobs (flush, compactions) when bg_error_ is set
REVERT: a9639bd Fix valgrind test
REVERT: d1f24dc Relax FlushSchedule test
REVERT: 3d9e6f7 Push model for flushing memtables
REVERT: 059e584 [unit test] CompactRange should fail if we don't have space
REVERT: dd641b2 fix RocksDB java build
REVERT: 53404d9 add_qps_info_in cache bench
REVERT: a52cecb Fix Mac compile
REVERT: 092f97e Fix comments and typos
REVERT: 6cc1286 Added a few statistics for BackupableDB
REVERT: 0a42295 Fix SimpleWriteTimeoutTest
REVERT: 06d9862 Always pass MergeContext as pointer, not reference
REVERT: d343c3f Improve db recovery
REVERT: 6bb7e3e Merger test
REVERT: 88841bd Explicitly cast char to signed char in Hash()
REVERT: 5231146 MemTableOptions
REVERT: 1d284db Addressing review comments
REVERT: 55114e7 Some updates for SpatialDB
REVERT: 171d4ff remove TailingIterator reference in db_impl.h
REVERT: 9b0f7ff rename version_set options_ to db_options_ to avoid confusion
REVERT: 2d57828 Check stop level trigger-0 before slowdown level-0 trigger
REVERT: 659d2d5 move compaction_filter to immutable_options
REVERT: 048560a reduce references to cfd->options() in DBImpl
REVERT: 011241b DB::Flush() Do not wait for background threads when there is nothing in mem table
REVERT: a2bb7c3 Push- instead of pull-model for managing Write stalls
REVERT: 0af157f Implement full filter for block based table.
REVERT: 9360cc6 Fix valgrind issue
REVERT: 02d5bff Merge pull request #277 from wankai/master
REVERT: 88a2f44 fix comments
REVERT: 7c16e39 Merge pull request #276 from wankai/master
REVERT: 8237738 replace hard-coded number with named variable
REVERT: db8ca52 Merge pull request #273 from nbougalis/static-analysis
REVERT: b7b031f Merge pull request #274 from wankai/master
REVERT: 4c2b1f0 Merge remote-tracking branch 'upstream/master'
REVERT: a5d2863 typo improvement
REVERT: 9f8aa09 Don't leak data returned by opendir
REVERT: d1cfb71 Remove unused member(s)
REVERT: bfee319 sizeof(int*) where sizeof(int) was intended
REVERT: d40c1f7 Add missing break statement
REVERT: 2e97c38 Avoid off-by-one error when using readlink
REVERT: 40ddc3d add cache bench
REVERT: 9f1c80b Drop column family from write thread
REVERT: 8de151b Add db_bench with lots of column families to regression tests
REVERT: c9e419c rename options_ to db_options_ in DBImpl to avoid confusion
REVERT: 5cd0576 Fix compaction bug in Cuckoo Table Builder. Use kvs_.size() instead of num_entries in FileSize() method.
REVERT: 0fbb3fa fixed memory leak in unit test DBIteratorBoundTest
REVERT: adcd253 fix asan check
REVERT: 4092b7a Merge pull request #272 from project-zerus/patch-1
REVERT: bb6ae0f fix more compile warnings
REVERT: 6d31441 Merge pull request #271 from nbougalis/cleanups
REVERT: 0cd0ec4 Plug memory leak during index creation
REVERT: 4329d74 Fix swapped variable names to accurately reflect usage
REVERT: 45a5e3e Remove path with arena==nullptr from NewInternalIterator
REVERT: 5665e5e introduce ImmutableOptions
REVERT: e0b99d4 created a new ReadOptions parameter 'iterate_upper_bound'
REVERT: 51ea889 Fix travis builds
REVERT: a481626 Relax backupable rate limiting test
REVERT: f7f973d Merge pull request #269 from huahang/patch-2
REVERT: ef5b384 fix a few compile warnings
REVERT: 2fd3806 Merge pull request #263 from wankai/master
REVERT: 1785114 delete unused Comparator
REVERT: 1b1d961 update HISTORY.md
REVERT: 703c3ea comments about the BlockBasedTableOptions migration in Options
REVERT: 4b5ad88 Merge pull request #260 from wankai/master
REVERT: 19cc588 change to filter_block std::unique_ptr support RAII
REVERT: 9b976e3 Merge pull request #259 from wankai/master
REVERT: 5d25a46 Merge remote-tracking branch 'upstream/master'
REVERT: dff2b1a typo improvement
REVERT: 343e98a Reverting import change
REVERT: ddb8039 RocksDB static build Make file changes to download and build the dependencies .Load the shared library when RocksDB is initialized

git-subtree-dir: src/rocksdb2
git-subtree-split: 1fdd726a8254c13d0c66d8db8130ad17c13d7bcc
2014-10-27 11:36:32 -07:00
Vinnie Falco
9ab4f7bcc6 Update SQLite to 3.8.7:
sha1: 3e23079f062fc06705eead4db108ee429878b532
2014-10-27 11:04:46 -07:00
Vinnie Falco
2cce22052b Update SQLite to 3.8.7:
sha1: 3e23079f062fc06705eead4db108ee429878b532
2014-10-27 11:04:46 -07:00
Tom Ritchford
4e19d5f625 Adjust paths and costs in Pathfinder. 2014-10-27 11:03:19 -07:00
Tom Ritchford
5b667da526 Squelch some warnings in rippled and third-party code. 2014-10-27 10:00:03 -07:00
Nik Bougalis
f9fc9a3518 Reduce RippleD dependencies on Beast:
* Use static_assert where appropriate
* Use std::min and std::max where appropriate
* Simplify RippleD error reporting
* Remove use of beast::RandomAccessFile
2014-10-27 09:55:58 -07:00
Nik Bougalis
186ca9c235 Reduce Beast public interface and eliminate unused code:
Beast includes a lot of code for encapsulating cross-platform differences
which are not used or needed by rippled. Additionally, a lot of that code
implements functionality that is available from the standard library.

This moves away from custom implementations of features that the standard
library provides and reduces the number of platform-specific interfaces
andfeatures that Beast makes available.

Highlights include:
* Use std:: instead of beast implementations when possible
* Reduce the use of beast::String in public interfaces
* Remove Windows-specific COM and Registry code
* Reduce the public interface of beast::File
* Reduce the public interface of beast::SystemStats
* Remove unused sysctl/getsysinfo functions
* Remove beast::Logger
2014-10-27 09:55:43 -07:00
Nik Bougalis
e005cfd70e Reduce Beast public interface and eliminate unused code:
Beast includes a lot of code for encapsulating cross-platform differences
which are not used or needed by rippled. Additionally, a lot of that code
implements functionality that is available from the standard library.

This moves away from custom implementations of features that the standard
library provides and reduces the number of platform-specific interfaces
andfeatures that Beast makes available.

Highlights include:
* Use std:: instead of beast implementations when possible
* Reduce the use of beast::String in public interfaces
* Remove Windows-specific COM and Registry code
* Reduce the public interface of beast::File
* Reduce the public interface of beast::SystemStats
* Remove unused sysctl/getsysinfo functions
* Remove beast::Logger
2014-10-27 09:55:43 -07:00
Vinnie Falco
feb997481c Refactor the structure of ServerHandler:
This is a cleanup to the structure of the sources.
* Rename to ServerHandler
* Move private implementation declaration to separate header
* De-inline function definitions in the class declaration.
2014-10-27 09:50:03 -07:00
Vinnie Falco
2c8e90c9d8 Remove obsolete RPCServerHandler:
This removes the legacy RPCServerHandler, which has been replaced by the
asynchronous RPC-HTTP/S server and corresponding RPCHTTPHandler.
2014-10-27 09:50:03 -07:00
Vinnie Falco
fefdb32d08 Remove unused and obsolete classes and tidy up:
Many classes required to support type-erasure of handlers and boost::asio
types are now obsolete, so these classes and files are removed:
HTTPClientType, FixedInputBuffer, PeerRole, socket_wrapper,
client_session, basic_url, abstract_socket, buffer_sequence, memory_buffer,
enable_wait_for_async, shared_handler, wrap_handler, streambuf,
ContentBodyBuffer, SSLContext, completion-handler based handshake detectors.
These structural changes are made:
* Some missing includes added to headers
* asio module directory flattened
2014-10-26 08:40:52 -07:00
Vinnie Falco
ec96d5afa0 Remove unused and obsolete classes and tidy up:
Many classes required to support type-erasure of handlers and boost::asio
types are now obsolete, so these classes and files are removed:
HTTPClientType, FixedInputBuffer, PeerRole, socket_wrapper,
client_session, basic_url, abstract_socket, buffer_sequence, memory_buffer,
enable_wait_for_async, shared_handler, wrap_handler, streambuf,
ContentBodyBuffer, SSLContext, completion-handler based handshake detectors.
These structural changes are made:
* Some missing includes added to headers
* asio module directory flattened
2014-10-26 08:40:52 -07:00
Vinnie Falco
8be8853c33 Remove obsolete classes, disable unused code, and tidy up:
* Removed MultiSocket. Code that previously used the MultiSocket now uses
  a combination of boost::asio coroutines and CRTP.
* Sitefiles headers rolled up and directory flattened.
* Disabled Sitefiles use of deprecated HTTPClient.
* Validators headers tidied up.
* Disabled Validators use of deprecated HTTPClient.
2014-10-26 08:38:37 -07:00
Vinnie Falco
c228f5a244 Set version to 0.26.4-rc3 2014-10-25 08:07:40 -07:00
Vinnie Falco
d4c8b4e3ac Merge branch 'release' into develop 2014-10-25 08:07:30 -07:00
Vinnie Falco
6564f6c164 Fix incorrect socket closure in Overlay peers:
On Application exit, Overlay was calling PeerImp::close for each peer.
The implementation of PeerImp::close only canceled all pending I/O and did not
call functions necessary for proper transition of Peer state during socket
closure. The correct transition is ensured by calling PeerImp::detach. This
changes PeerImp::close to call PeerImp::detach instead, ensuring that Overlay
invariants are maintained. Specifically, that reference counts for pending I/O
on peers will be correctly unwound by canceling operations and that the Peer
object will be destroyed, thus allowing the Overlay to stop correctly.
2014-10-25 08:01:57 -07:00
Vinnie Falco
1e37a5509c Add missing includes 2014-10-24 08:13:55 -07:00
Vinnie Falco
1e9503deaa Set version to 0.26.2-rc2 2014-10-23 13:49:22 -07:00
Vinnie Falco
ab1f36c565 Revert "Add [overlay] configuration section (experimental):"
This reverts commit 856fd9d69f.
2014-10-23 13:48:52 -07:00
Vinnie Falco
5a212cd626 Set version to 0.26.4-rc1 2014-10-23 13:01:12 -07:00
Vinnie Falco
856fd9d69f Add [overlay] configuration section (experimental):
This configuration section uses the new BasicConfig interface that supports
key-value pairs in the section. Some exposition is added to the example cfg
file. The new settings for overlay are related to the Hub and Spoke feature
which is currently in development. Production servers should not set
these configuration options, they are clearly marked experimental in the
example cfg file.

Conflicts:
	src/ripple/overlay/impl/OverlayImpl.cpp
	src/ripple/overlay/impl/OverlayImpl.h
	src/ripple/overlay/impl/PeerImp.cpp
	src/ripple/overlay/impl/PeerImp.h
2014-10-23 12:56:16 -07:00
Vinnie Falco
4606d99951 Don't use MultiSocket in Overlay:
The MultiSocket is obsolete technology which is superceded by a more
straightforward, template based implementation that is compatible with
boost::asio::coroutines. This removes support for the unused PROXY handshake
feature. After this change a large number of classes and source files may be
removed.
2014-10-23 12:56:16 -07:00
Tom Ritchford
dbd75169e5 New JsonWriter for improved client performance (RIPD-439):
When JSON-RPC and Websocket responses are calculated, the result is stored
in intermediate Json::Value objects and later composed in a single linear
memory buffer before being sent to the socket.  These classes support a
new model for building responses that supports incremental construction
of JSON replies in constant time and removes the requirement that all
data returned be located in continuguous memory.
* New JsonWriter incrementally writes JSON with O(1) granularity and memory.
* Array, Object are RAII wrappers for the O(1) JsonWriter.
2014-10-23 07:04:47 -07:00
Vinnie Falco
3cd391daa6 Return error_code from beast::http::basic_parser:
This changes the HTTP parser interface to return an error_code instead
of a bool. This eliminates the need for the error() member function and
simplifies calling code.
2014-10-22 19:36:28 -07:00
Vinnie Falco
f5b39ee911 Remove HTTP::ScopedStream:
This class was used to allow stream style operator<< to write to the
HTTP::Session. This is being superceded by a more robust object-based model
that supports coroutines.
2014-10-22 19:36:28 -07:00
Vinnie Falco
88cb0a1f7a Add beast::asio::ssl_bundle workaround:
This works around the limitation that 1.56 boost::asio::ssl::stream objects
do not support r-value move or construction. It is required when the stream
does not own the socket.
2014-10-22 19:36:28 -07:00
Vinnie Falco
db5d52b4b2 Keep a list of section config values that are not key/value pairs:
This change to BasicConfig stores all appended lines which are not key/value
pairs in a separate values vector which can be retrieved later. This is to
support sections containing both key/value pairs and a list of values.
2014-10-22 19:36:28 -07:00
Vinnie Falco
dfeb9967b8 Return error_code from beast::http::basic_parser:
This changes the HTTP parser interface to return an error_code instead
of a bool. This eliminates the need for the error() member function and
simplifies calling code.
2014-10-22 19:36:28 -07:00
Vinnie Falco
673e860c18 Add beast::asio::ssl_bundle workaround:
This works around the limitation that 1.56 boost::asio::ssl::stream objects
do not support r-value move or construction. It is required when the stream
does not own the socket.
2014-10-22 19:36:28 -07:00
Vinnie Falco
9deae34b20 Workaround for MSVC stdlib and coroutine interaction:
If beast::Time::currentTimeMillis is first called from a coroutine launched
using boost::asio::spawn, Win32 throws an exception. This workaround calls
getCurrentTime once in main to prevent the exception.
Reference:
    https://svn.boost.org/trac/boost/ticket/10657
2014-10-22 19:36:27 -07:00
Vinnie Falco
ec92344fb4 Use autotls instead of multitls in websocket:
The MultiSocket class implements a socket that handshakes in multiple
protocols including SSL and PROXY. Unfortunately the way it type-erases the
handlers and buffers is incompatible with boost::asio coroutines. To pave the
way for coroutines this is part of a larger set of changes that roll back the
usage of MultiSocket to older code, and some custom implementations that use
templates. The custom implementations are more simple since they use
coroutines. Removing MultiSocket will make many other classes and source files
unused, a big win for trimming down the codebase size.
2014-10-22 19:34:48 -07:00
Donovan Hide
44c68d6174 Change NodeStore::Backend tests to reflect observed patterns:
Empirical evidence shows a database access pattern with few hits
and many misses (objects that don't exist). This changes the timing
tests so they more accurately reflect rippled's actual usage:
* Add read missing keys test
* Increase numObjectsToTest to 1,000,000
* Alter PredictableObjectFactory to seed RNG once only
* Make NodeStoreTiming a manual test
2014-10-22 19:29:29 -07:00
Howard Hinnant
f0f082d3e3 Fix OS X version parsing/error related to OS X 10.10 update. 2014-10-22 19:29:28 -07:00
Howard Hinnant
5b7f172d03 Fix OS X version parsing/error related to OS X 10.10 update. 2014-10-22 19:29:28 -07:00
JoelKatz
65125eac87 Add "deferred" flag to transaction relay message
If we receive a deferred transaction from a server in our
cluster, treat it as if it wasn't received from a server
in our cluster.

This currently has no effect but is needed for server to
interoperate with future code that will relay deferred
transactions.
2014-10-22 19:29:28 -07:00
Scott Schurr
761902864a Refactor STParsedJSON to parse an object or array [RIPD-480]
The implementation of multi-sign has a SigningAccounts array as a
member of the outermost object.  This array could not be parsed
by the previous implementation of STParsedJSON, which only knew
how to parse objects.  This refactor supports the required parsing.

The refactor divides the parsing into three separate functions:

 o parseNoRecurse() which parses most rippled data types.
 o parseObject() which parses object types that may contain
   arbitrary other types.
 o parseArray() which parses object types that may contain
   arbitrary other types.

The change is required by the multi-sign implementation, but is
independent.  So the parsing change is going in as a separate
commit.

The parsing is still far from perfect.  But this was as much as
needs doing to accomplish the ends and mitigate risk of breaking
the parser.
2014-10-22 19:29:28 -07:00
Vinnie Falco
4a8555b3bf Workaround for MSVC move special members. 2014-10-18 08:16:12 -07:00
Vinnie Falco
af24d541d1 Workaround for MSVC move special members. 2014-10-18 08:16:12 -07:00
Nik Bougalis
9d33e4bd7b Fix URL compositing in Beast (RIPD-636). 2014-10-16 21:44:36 -04:00
Donovan Hide
3ad68a617e Fix dependency on boost::thread on OS/X. 2014-10-16 21:44:36 -04:00
Nik Bougalis
9e1a6589d4 Return descriptive error message from memo validation (RIPD-591). 2014-10-16 21:44:36 -04:00
Josh Juran
da8ceed07e RippleSSLContext.cpp cleanup.
* These cleanups precede work on RIPD-108.
2014-10-16 21:44:36 -04:00
Nik Bougalis
35935adc98 Fix URL compositing in Beast (RIPD-636). 2014-10-16 21:44:36 -04:00
Howard Hinnant
75c8d7aa57 Detab beast 2014-10-15 19:39:30 -04:00
Howard Hinnant
5b4a501f68 Detab beast 2014-10-15 19:39:30 -04:00
Tom Ritchford
5425a90f16 Fix tabs and trailing whitespace. 2014-10-15 19:39:30 -04:00
Mark Travis
f034b02b92 Disable SSLv3 2014-10-15 19:37:25 -04:00
Donovan Hide
7eaca149c1 Remove boost_thread dependency (RIPD-216).
Fixes RIPD-216
2014-10-15 19:37:25 -04:00
Mark Travis
4b5fd95657 Disable SSLv3 2014-10-15 19:37:25 -04:00
Nik Bougalis
96dedf553e Refactor SerializedTransaction:
* Use boost:tribool instead of two intertwined bool variables
* Trim down public interface, reduce member variables
2014-10-15 19:37:25 -04:00
sublimator
23219f2662 Disable transaction submission tests under Travis. 2014-10-15 19:37:25 -04:00
Vinnie Falco
af78ed608e Call Stoppable::stopped in PeerFinder onStop. 2014-10-15 19:37:25 -04:00
Vinnie Falco
51dc59e019 Fix outgoing bytes calculation in HTTP server. 2014-10-15 19:37:25 -04:00
Tom Ritchford
afc102e90a New class RPC::Status enforces JSON-RPC 2.0 error format.
* Relevant issues:
  * RIPD-92
  * RIPD-97
  * RIPD-98
  * RIPD-439
2014-10-15 19:37:25 -04:00
David Schwartz
fc560179e0 SHAMap performance improvements (RIPD-434)
This reworks the way SHAMaps are stored, flushed, backed, and
traversed. Rather than storing the linkages in the SHAMap itself,
that information is now stored in the nodes. This makes
snapshotting much cheaper and also allows traverse work done on
behalf of one SHAMap to be used by other SHAMaps that share inner
nodes with that SHAMap.

When a SHAMap is modified, nodes are modified all the way up to the
root. This means that the modified nodes in a SHAMap can easily be
traversed for flushing. So they don't need to be separately tracked.

Summary
* Remove mTNByID
* Remove mDirtyNodes
* Much faster traverses
* Much Faster snapshots
* New algorithm for flushing
* New vistNodes/visitLeaves
* Avoid I/O if a map is unbacked
2014-10-14 13:32:17 -04:00
sublimator
d26241de0e Remove Og from debug mode
Last time I used gdb, iterating over a directory's `Indexes`, each uint256 printed as `<optimized out>`.

Debug mode is for debugging ...
2014-10-14 12:57:41 -04:00
Howard Hinnant
96a3a34fa4 Gracefully cast from std:🧵:hardware_concurrency 2014-10-14 12:35:17 -04:00
Howard Hinnant
00310f4f10 Silence clang warnings 2014-10-14 12:35:17 -04:00
Howard Hinnant
e965b7c0da Guarantee C locale
*  Remove all calls to setlocale to ensure that the global
   locale is always C.

*  Also replace beast::SystemStats::getNumCpus() with
   std:🧵:hardware_concurrency()
2014-10-14 12:35:17 -04:00
Howard Hinnant
8caae219cf Gracefully cast from std:🧵:hardware_concurrency 2014-10-14 12:35:17 -04:00
Howard Hinnant
2264ae9247 Guarantee C locale
*  Remove all calls to setlocale to ensure that the global
   locale is always C.

*  Also replace beast::SystemStats::getNumCpus() with
   std:🧵:hardware_concurrency()
2014-10-14 12:35:17 -04:00
Nicholas Dudfield
29225bbe75 Attempt to fix spurious travis failures 2014-10-14 12:35:17 -04:00
Vinnie Falco
4b5625fd59 Load PeerFinder database in Stoppable::onPrepare:
OverlayImpl::onStart calls into PeerFinder before PeerFinder::Manager::onStart,
causing tests to sometimes fail and the application to intermittently not start.
The order of calls to Stoppable::onStart is implementation defined and not
predictable.

This changes PeerFinder to load the database in Stoppable::onPrepare, before
threads are launched. In general, creation and initialization of resources that
are shared between classes should happen in onPrepare rather than onStart,
to solve this problem.
2014-10-10 19:38:52 -07:00
Vinnie Falco
7c0c2419f7 Refactor PeerFinder:
Previously, the PeerFinder manager constructed with a Callback object
provided by the owner which was used to perform operations like connecting,
disconnecting, and sending messages. This made it difficult to change the
overlay code because a single call into the PeerFinder could cause both
OverlayImpl and PeerImp to be re-entered one or more times, sometimes while
holding a recursive mutex. This change eliminates the callback by changing
PeerFinder functions to return values indicating the action the caller should
take.

As a result of this change the PeerFinder no longer needs its own dedicated
thread. OverlayImpl is changed to call into PeerFinder on a timer to perform
periodic activities. Furthermore the Checker class used to perform connectivity
checks has been refactored. It no longer uses an abstract base class, in order
to not type-erase the handler passed to async_connect (ensuring compatibility
with coroutines). To allow unit tests that don't need a network, the Logic
class is now templated on the Checker type. Currently the Manager provides its
own io_service. However, this can easily be changed so that the io_service is
provided upon construction.

Summary
* Remove unused SiteFiles dependency injection
* Remove Callback and update signatures for public APIs
* Remove obsolete functions
* Move timer to overlay
* Steps toward a shared io_service
* Templated, simplified Checker
* Tidy up Checker declaration
2014-10-10 15:04:37 -07:00
Vinnie Falco
5f59282ba1 Clean up Overlay and PeerFinder sources:
* Tidy up identifiers and declarations
* Merge PeerFinder headers into one file
* Merge handout classes and functions into one file
2014-10-10 15:04:36 -07:00
Vinnie Falco
7847ac3144 Add pending_handlers 2014-10-10 13:26:08 -07:00
Vinnie Falco
db03ce939c Add pending_handlers 2014-10-10 13:26:08 -07:00
Vinnie Falco
6708311a66 Add missing include in beast header 2014-10-10 13:26:08 -07:00
Vinnie Falco
68bcbbb701 Add missing include in beast header 2014-10-10 13:26:08 -07:00
David Schwartz
8bdf7b3983 Remove unused file 2014-10-10 10:27:47 -07:00
Vinnie Falco
4ab427d315 Cleanup: Combine Section and BasicConfig, move to basics 2014-10-09 14:49:10 -07:00
Vinnie Falco
9a0a434dd8 Fix incorrect address in connectivity check report:
The remoteAddress is the address as seen on the socket, which for
incoming connections has a random port chosen by the remote implementation
that is different from the port number used to accept connections by the
remote listening socket. The checkedAddress is the remote address as seen
on the socket, combined with the port advertised in the TMEndpoints message.
This fixes the reporting and metadata associated with addresses tested
for connectivity.

The README has been updated to reflect that uptime is no longer part of
the metadata associated with IP addresses saved for bootstrapping.
2014-10-09 14:48:54 -07:00
Nik Bougalis
33d1dda954 Handle BIGNUM conversion failure 2014-10-06 11:24:42 -07:00
Howard Hinnant
8e9efb4ceb Remove unused transaction code. 2014-10-06 11:18:15 -07:00
Nik Bougalis
8835af11d5 Cleanups and surface reduction:
* Don't use friendship unless needed
* Trim down interfaces
* Make classes feel more like std containers
2014-10-06 11:18:15 -07:00
Nik Bougalis
cfb6b678f1 Remove HashMaps 2014-10-02 14:58:14 -07:00
miguelportilla
365500da98 Create orderbook integration test (RIPD-483) 2014-10-02 14:58:14 -07:00
Miguel Portilla
f14d75e798 Optimize account_lines and account_offers (RIPD-587)
Conflicts:
	src/ripple/app/ledger/Ledger.h
2014-10-02 14:58:14 -07:00
Tom Ritchford
0f71b4a378 Fix most compilation warnings for gcc, clang, release, debug. 2014-10-02 14:58:14 -07:00
JoelKatz
b651e0146d Fix some fee logic: (RIPD-614)
* fee_default sets cost in drops of reference transaction
* Offline signing uses fee_default
* Signing multiplier maximum works correctly
* Fix bugs in load fee track
* Remove dead code, add comments
2014-10-02 14:58:14 -07:00
Tom Ritchford
a0dbbb2d84 Update and sort ErrorCode descriptions 2014-10-02 14:57:31 -07:00
Torrie Fischer
a85fbf69e0 Update rocksdb 2014-10-02 14:57:31 -07:00
Torrie Fischer
92b8c7961b Squashed 'src/rocksdb2/' changes from 37c6740..25888ae
25888ae Merge pull request #329 from fyrz/master
89833e5 Fixed signed-unsigned comparison warning in db_test.cc
fcac705 Fixed compile warning on Mac caused by unused variables.
b3343fd resolution for java build problem introduced by 5ec53f3edf62bec1b690ce12fb21a6c52203f3c8
187b299 ForwardIterator: update prev_key_ only if prefix hasn't changed
5ec53f3 make compaction related options changeable
d122e7b Update INSTALL.md
986dad0 Merge pull request #324 from dalgaaf/wip-da-SCA-20140930
8ee75dc db/memtable.cc: remove unused variable merge_result
0fd8bbc db/db_impl.cc: reduce scope of prefix_initialized
676ff7b compaction_picker.cc: remove check for >=0 for unsigned
e55aea5 document_db.cc: fix assert
d517c83 in_table_factory.cc: use correct format specifier
b140375 ttl/ttl_test.cc: prefer prefix ++operator for non-primitive types
43c789c spatialdb/spatial_db.cc: use !empty() instead of 'size() > 0'
0de452e document_db.cc: pass const parameter by reference
4cc8643 util/ldb_cmd.cc: prefer prefix ++operator for non-primitive types
af8c2b2 util/signal_test.cc: suppress intentional null pointer deref
33580fa db/db_impl.cc: fix object handling, remove double lines
873f135 db_ttl_impl.h: pass func parameter by reference
8558457 ldb_cmd_execute_result.h: perform init in initialization list
063471b table/table_test.cc: pass func parameter by reference
93548ce table/cuckoo_table_reader.cc: pass func parameter by ref
b8b7117 db/version_set.cc: use !empty() instead of 'size() > 0'
8ce050b table/bloom_block.*: pass func parameter by reference
53910dd db_test.cc: pass parameter by reference
68ca534 corruption_test.cc: pass parameter by reference
7506198 cuckoo_table_db_test.cc: add flush after delete
1f96330 Print MB per second compaction throughput separately for reads and writes
ffe3d49 Add an instruction about SSE in INSTALL.md
ee1f3cc Package generation for Ubuntu and CentOS
f0f7955 Fixing comile errors on OS X
99fb613 remove 2 space linter
b2d64a4 Fix linters, second try
747523d Print per column family metrics in db_bench
56ebd40 Fix arc lint (should fix #238)
637f891 Merge pull request #321 from eonnen/master
827e31c Make test use a compatible type in the size checks.
fd5d80d CompactedDB: log using the correct info_log
2faf49d use GetContext to replace callback function pointer
983d2de Add AUTHORS file. Fix #203
abd70c5 Merge pull request #316 from fyrz/ReverseBytewiseComparator
2dc6f62 handle kDelete type in cuckoo builder
8b8011a Changed name of ReverseBytewiseComparator based on review comment
389edb6 universal compaction picker: use double for potential overflow
5340484 Built-in comparator(s) in RocksJava
d439451 delay initialization of cuckoo table iterator
94997ea reduce memory usage of cuckoo table builder
c627595 improve memory efficiency of cuckoo reader
581442d option to choose module when calculating CuckooTable hash
fbd2daf CompactedDBImpl::MultiGet() for better CuckooTable performance
3c68006 CompactedDBImpl
f7375f3 Fix double deletes
21ddcf6 Remove allow_thread_local
fb4a492 Merge pull request #311 from ankgup87/master
611e286 Merge branch 'master' of https://github.com/facebook/rocksdb
0103b44 Merge branch 'master' of ssh://github.com/ankgup87/rocksdb
1dfb7bb Add block based table config options
cdaf44f Enlarge log size cap when printing file summary
7cc1ed7 Merge pull request #309 from naveenatceg/staticbuild
ba6d660 Resolving merge conflict
51eeaf6 Addressing review comments
fd7d3fe Addressing review comments (adding a env variable to override temp directory)
cf7ace8 Addressing review comments
0a29ce5 re-enable BlockBasedTable::SetupForCompaction()
55af370 Remove TODO for checking index checksums
3d74f09 Fix compile
53b0039 Fix release compile
d0de413 WriteBatchWithIndex to allow different Comparators for different column families
57a32f1 change target_file_size_base to uint64_t
5e6aee4 dont create backup_input if compaction filter v2 is not used
49b5f94 Merge pull request #306 from Liuchang0812/fix_cast
787cb4d remove cast, replace %llu with % PRIu64
a7574d4 Update logging.cc
7e0dcb9 Update logging.cc
57fa3cc Merge pull request #304 from Liuchang0812/fix-check
cd44522 Merge pull request #305 from Liuchang0812/fix-logging
6a031b6 remove unused variable
4436f17 fixed #303: replace %ld with % PRId64
7a1bd05 Merge pull request #302 from ankgup87/master
423e52c Merge branch 'master' of https://github.com/facebook/rocksdb
bfeef94 Add rate limiter
32f2532 Print compression_size_percent as a signed int
976caca Skip AllocateTest if fallocate() is not supported in the file system
3b897cd Enable no-fbcode RocksDB build
f445947 RocksDB: Format uint64 using PRIu64 in db_impl.cc
e17bc65 Merge pull request #299 from ankgup87/master
b93797a Fix build
adae3ca [Java] Fix JNI link error caused by the removal of options.db_stats_log_interval
90b8c07 Fix unit tests errors
51af7c3 CuckooTable: add one option to allow identity function for the first hash function
0350435 Fixed a signed-unsigned comparison in spatial_db.cc -- issue #293
2fb1fea Fix syncronization issues
ff76895 Remove some unnecessary constructors
feadb9d fix cuckoo table builder test
3c232e1 Fix mac compile
54cada9 Run make format on PR #249
27b22f1 Merge pull request #249 from tdfischer/decompression-refactoring
fb6456b Replace naked calls to operator new and delete (Fixes #222)
5600c8f cuckoo table: return estimated size - 1
a062e1f SetOptions() for memtable related options
e4eca6a Options conversion function for convenience
a7c2094 Merge pull request #292 from saghmrossi/master
4d05234 Merge branch 'master' of github.com:saghmrossi/rocksdb
60a4aa1 Test use_mmap_reads
94e43a1 [Java] Fixed 32-bit overflowing issue when converting jlong to size_t
f9eaaa6 added include for inttypes.h to fix nonworking printf statements
f090575 Replaced "built on on earlier work" by "built on earlier work" in README.md
faad439 Fix #284
49aacd8 Fix make install
acb9348 [Java] Include WriteBatch into RocksDBSample.java, fix how DbBenchmark.java handles WriteBatch.
4a27a2f Don't sync manifest when disableDataSync = true
9b8480d Merge pull request #287 from yinqiwen/rate-limiter-crash-fix
28be16b fix rate limiter crash #286
04ce1b2 Fix #284
add22e3 standardize scripts to run RocksDB benchmarks
dee91c2 WriteThread
540a257 Fix WAL synced
24f034b Merge pull request #282 from Chilledheart/develop
49fe329 Fix build issue under macosx
ebb5c65 Add make install
0352a9f add_wrapped_bloom_test
9c0e66c Don't run background jobs (flush, compactions) when bg_error_ is set
a9639bd Fix valgrind test
d1f24dc Relax FlushSchedule test
3d9e6f7 Push model for flushing memtables
059e584 [unit test] CompactRange should fail if we don't have space
dd641b2 fix RocksDB java build
53404d9 add_qps_info_in cache bench
a52cecb Fix Mac compile
092f97e Fix comments and typos
6cc1286 Added a few statistics for BackupableDB
0a42295 Fix SimpleWriteTimeoutTest
06d9862 Always pass MergeContext as pointer, not reference
d343c3f Improve db recovery
6bb7e3e Merger test
88841bd Explicitly cast char to signed char in Hash()
5231146 MemTableOptions
1d284db Addressing review comments
55114e7 Some updates for SpatialDB
171d4ff remove TailingIterator reference in db_impl.h
9b0f7ff rename version_set options_ to db_options_ to avoid confusion
2d57828 Check stop level trigger-0 before slowdown level-0 trigger
659d2d5 move compaction_filter to immutable_options
048560a reduce references to cfd->options() in DBImpl
011241b DB::Flush() Do not wait for background threads when there is nothing in mem table
a2bb7c3 Push- instead of pull-model for managing Write stalls
0af157f Implement full filter for block based table.
9360cc6 Fix valgrind issue
02d5bff Merge pull request #277 from wankai/master
88a2f44 fix comments
7c16e39 Merge pull request #276 from wankai/master
8237738 replace hard-coded number with named variable
db8ca52 Merge pull request #273 from nbougalis/static-analysis
b7b031f Merge pull request #274 from wankai/master
4c2b1f0 Merge remote-tracking branch 'upstream/master'
a5d2863 typo improvement
9f8aa09 Don't leak data returned by opendir
d1cfb71 Remove unused member(s)
bfee319 sizeof(int*) where sizeof(int) was intended
d40c1f7 Add missing break statement
2e97c38 Avoid off-by-one error when using readlink
40ddc3d add cache bench
9f1c80b Drop column family from write thread
8de151b Add db_bench with lots of column families to regression tests
c9e419c rename options_ to db_options_ in DBImpl to avoid confusion
5cd0576 Fix compaction bug in Cuckoo Table Builder. Use kvs_.size() instead of num_entries in FileSize() method.
0fbb3fa fixed memory leak in unit test DBIteratorBoundTest
adcd253 fix asan check
4092b7a Merge pull request #272 from project-zerus/patch-1
bb6ae0f fix more compile warnings
6d31441 Merge pull request #271 from nbougalis/cleanups
0cd0ec4 Plug memory leak during index creation
4329d74 Fix swapped variable names to accurately reflect usage
45a5e3e Remove path with arena==nullptr from NewInternalIterator
5665e5e introduce ImmutableOptions
e0b99d4 created a new ReadOptions parameter 'iterate_upper_bound'
51ea889 Fix travis builds
a481626 Relax backupable rate limiting test
f7f973d Merge pull request #269 from huahang/patch-2
ef5b384 fix a few compile warnings
2fd3806 Merge pull request #263 from wankai/master
1785114 delete unused Comparator
1b1d961 update HISTORY.md
703c3ea comments about the BlockBasedTableOptions migration in Options
4b5ad88 Merge pull request #260 from wankai/master
19cc588 change to filter_block std::unique_ptr support RAII
9b976e3 Merge pull request #259 from wankai/master
5d25a46 Merge remote-tracking branch 'upstream/master'
9b58c73 call SanitizeDBOptionsByCFOptions() in the right place
a84234a Ignore missing column families
8ed70fc add assert to db Put in db_stress test
7f19bb9 Merge pull request #242 from tdfischer/perf-timer-destructors
8438a19 fix dropping column family bug
6614a48 Refactor PerfStepTimer to stop on destruct
076bd01 Fix compile
990df99 Fix ios compile
7dcadb1 Don't let flush preempt compaction in certain cases
dff2b1a typo improvement
985a31c Merge pull request #251 from nbougalis/master
f09329c Fix candidate file comparison when using path ids
7e9f28c limit max bytes that can be read/written per pread/write syscall
d20b8cf Improve Cuckoo Table Reader performance. Inlined hash function and number of buckets a power of two.
0f9c43e ForwardIterator: reset incomplete iterators on Seek()
722d80c reduce recordTick overhead in compaction loop
22a0a60 Merge pull request #250 from wankai/master
be25ee4 delete unused struct Options
0c26e76 Merge pull request #237 from tdfischer/tdfischer/faster-timeout-test
1d23b5c remove_internal_filter_policy
2a8faf7 Compact SpatialDB as we go, not at the end
7f71448 Implementing a cache friendly version of Cuckoo Hash
d977e55 Don't let other compactions run when manual compaction runs
d5bd6c7 Fix ios compile
6b46f78 Merge pull request #248 from wankai/master
528a11c Update block_builder.h
536e997 Remove assert in vector rep
4142a3e Adding a user comparator for comparing Uint64 slices.
1913ce2 more concurrent flushes in SpatialDB
808e809 Adjust SpatialDB column family options
0c39f54 Use Vector memtable when bulk loading SpatialDB
b6fd781 Don't do memtable lookup in db_impl_readonly if memtables are empty while opening db.
9dcb75b Add is-file-deletions-enabled property
1755581 improve OptimizeForPointLookup()
d9c0785 Fix assertion in PosixRandomAccessFile
bda6f33 fix valgrind error in c_test caused by BlockBasedTableOptions
0db6b02 Update timeout to 50ms instead of 3.
ff6ec0e Optimize SpatialDB
2386185 ReadOptions.total_order_seek to allow total order seek for block-based table when hash index is enabled
a98badf print table options
66f62e5 JNI changes corresponding to BlockBasedTableOptions migration
3844001 move block based table related options BlockBasedTableOptions
17b54ae Merge pull request #243 from andybons/patch-1
0508691 Add missing include to use std::unique_ptr
42ea795 Fix concurrency issue in CompactionPicker
bb530c0 Merge pull request #240 from ShaoYuZhang/master
f76eda7 Fix compilation issue on OSX
08be7f5 Implement Prepare method in CuckooTableReader
47b452c Fix the error of c_test.c
562b7a1 Add missing implementaiton of SanitizeDBOptions in simple_table_db_test.cc
63a2215 Improve Options sanitization and add MmapReadRequired() to TableFactory
e173bf9 Eliminate VersionSet memory leak
10720a5 Revert the unintended change that DestroyDB() doesn't clean up info logs.
01cbdd2 Optimize storage parameters for spatialDB
045575a Add CuckooHash table format to table_reader_bench
7c5173d test: db: fix test to have a smaller timeout for when it runs on faster hardware
6929b08 Remove BitStream* tests
50b790c Removing BitStream* functions
162b815 Adding Column Family support in db_bench.
28b5c76 WriteBatchWithIndex: a wrapper of WriteBatch, with a searchable index
5585e00 Update release note of 3.4
343e98a Reverting import change
ddb8039 RocksDB static build Make file changes to download and build the dependencies .Load the shared library when RocksDB is initialized
68eed8c Bump up version
36e759d Adding Cuckoo Table SST option to db_bench
a6fd14c Fix valgrind error in c_test
c703715 attempt to fix auto_roll_logger_test
c8ecfae Merge pull request #230 from cockroachdb/spencerkimball/send-user-keys-to-v2-filter
570ba5a Avoid retrying to read property block from a table when it does not exist.
625b9ef Merge pull request #234 from bbiao/master
59a2763 Fix typo huage => huge
f611935 Fix autovector iterator increment/decrement comments
58b0f9d Support purging logs from separate log directory
2da53b1 [Java] Add purgeOldBackups API
6c4c159 fix_sst_dump_for_old_sst_format
8dfe2fd fix compile error under Mac OS X
58c4946 Allow env_posix to lower background thread IO priority
6a2be31 fix_valgrind_error_caused_in_db_info_dummper
e91ebf1 print compaction_filter name in Options.Dump
5a5953b Add histogram for DB_SEEK
5e64240 log db path info before open
0c9dc9f Remove malloc from FormatFileNumber
bcefede Update HISTORY.md
4808177 Revert "Include candidate files under options.db_log_dir in FindObsoleteFiles()"
0138b8e Fixed compile errors (signed / unsigned comparison) in cuckoo_table_db_test on Mac
1562653 Fixed a signed-unsigned comparison error in db_test
218857b remove tailing_iter.h/cc
5d0074c set bytes_per_sync to 1MB if rate limiter is enabled
3fcf7b2 Pass parsed user key to prefix extractor in V2 compaction
2fa6434 Add scope guard
06a52bd Flush only one column family
9674c11 Integrating Cuckoo Hash SST Table format into RocksDB

git-subtree-dir: src/rocksdb2
git-subtree-split: 25888ae0068c9b8e3d9421ea8c78a7be339298d8
2014-10-02 10:47:26 -07:00
Torrie Fischer
225f8ac12f Merge commit '92b8c7961b433d12d9d77da5d61c26a920bbd370' into updated-rocksdb 2014-10-02 10:47:26 -07:00
Howard Hinnant
1161511207 Fix two Wunused-private-field warnings. 2014-10-01 08:47:56 -07:00
Nicholas Dudfield
ca8eda412e Make travis build and use debug variants for tests 2014-10-01 08:47:56 -07:00
Mark Travis
ec4ec48fb8 Add counters to track nodestore read and write activities. 2014-10-01 08:47:56 -07:00
Tom Ritchford
af7f0b5074 Fix compiler warnings under gcc. 2014-10-01 08:47:55 -07:00
Nik Bougalis
c0b69e8ef7 Remove the use of beast::String from rippled (RIPD-443) 2014-10-01 08:47:55 -07:00
Tom Ritchford
4241dbb600 Clean and harden Transaction.
* Replace boolean parameter with enumerated type.
* Get rid of std::ref.
* 80-column cleanups.
* Replace an std::bin with a lambda.
2014-10-01 08:47:55 -07:00
Tom Ritchford
f54280aaad New DatabaseReader reads ledger numbers from database. 2014-10-01 08:47:55 -07:00
Tom Ritchford
6069400538 Fix compiler warnings under gcc. 2014-10-01 08:47:55 -07:00
Nik Bougalis
78dfb6bcf5 Allow beast::lexicalCast to parse 'true' & 'false' into a bool 2014-10-01 08:47:54 -07:00
Howard Hinnant
616be1d76c Miscellaneous cleanups:
* Limit HashPrefix construction and disallow assignment

* Give KnownFormats deleted copy members so that derived
  classes will give the right answers if queried with the
  std::is_copy_constructible/assignable traits.

* Replace SharedSingleton with a local static in
  LedgerFormats::getInstance() to be consistent with
  similar code in other places.  This also allows the
  LedgerFormats default constructor to be marked private
  so that the compiler enforces the design that
  LedgerFormats is a singleton type.

* Change return types of LedgerFormats::getInstance() and
  TxFormats::getInstance() from pointer to non-const to
  reference to const so as follow more established design
  guidelines for singletons.  This prevents pointers being
  mistaken for heap-allocated objects, and the const
  ensures the singleton isn't mutable.

* Change RippleAddress to inherit privately from
  CBase58Data instead of publicly.  This lets the compiler
  enforce that there are no unintended conversions from
  RippleAddress to CBase58Data.  This change allows us
  to remove a comment warning about unwanted conversions.
2014-10-01 08:47:54 -07:00
Nik Bougalis
8e91ce67c5 Allow beast::lexicalCast to parse 'true' & 'false' into a bool 2014-10-01 08:47:54 -07:00
JoelKatz
c1ecd661c3 Fix broken assert in built/validated ledger mismatch handler 2014-10-01 08:47:54 -07:00
JoelKatz
b27e2aad07 Improve transaction security
* Check signatures of every transaction on every validator
* Remove obsolete code
* Check transaction status in submit/sign RPC handler
2014-10-01 08:47:54 -07:00
MarkusTeufelberger
5ce508e09d Change output range names of ledger_cleaner
The input parameters are called "min_ledger" and "max_ledger", they are also called "minRange" and "maxRange" in the code BUT "ledger_min" and ledger_max" if printed. This is inconsistent and should be changed, as it might lead to confusion on how to call this module via RPC.
2014-10-01 08:47:53 -07:00
Nik Bougalis
3cfa5a41b1 Improve BuildInfo interface:
* Remove unnecessary beast::String dependency
* Explicitly cast to result type while packing a version
* Add unit tests for version formatting
2014-10-01 08:47:53 -07:00
Vinnie Falco
6c072f37ef Remove unused testoverlay module 2014-10-01 08:47:53 -07:00
Nik Bougalis
4640079f55 Use namespaces instead of static-only classes 2014-10-01 08:47:52 -07:00
Nik Bougalis
dbd993ed2b Use namespaces instead of static-only classes 2014-10-01 08:47:52 -07:00
Nik Bougalis
60330da25c Use deleted members to prevent copying in Beast (RIPD-268) 2014-10-01 08:47:52 -07:00
Nik Bougalis
45b5c4ba7a Use deleted members to prevent copying in Beast (RIPD-268) 2014-10-01 08:47:52 -07:00
Nik Bougalis
7933e5d1f9 Use deleted members to prevent copying in rippled (RIPD-268) 2014-10-01 06:28:32 -07:00
Vinnie Falco
01e52e6f9f Use trusted validators median fee
Conflicts:
	src/ripple/app/misc/Validations.cpp
2014-10-01 06:28:32 -07:00
Vinnie Falco
40a955e192 Consume handshake data in HTTP/S server 2014-10-01 06:28:12 -07:00
Vinnie Falco
a8296f7301 Set version to 0.26.3-sp4 2014-09-30 18:04:59 -07:00
Vinnie Falco
590c3b876b Use trusted validators median fee 2014-09-30 18:03:53 -07:00
Vinnie Falco
6dfc805eaa Rewrite HTTP/S server to use coroutines:
* Fix bug with more than one complete request in a read buffer
* Use stackful coroutines for simplified control flow
* Door refactored to detect handshakes
* Remove dependency on MultiSocket
* Remove dependency on handshake detect logic framework
2014-09-30 13:29:32 -07:00
Vinnie Falco
cd97b5beec Remove obsolete SharedArg 2014-09-29 07:18:51 -07:00
Vinnie Falco
5ce6068df5 Remove obsolete SharedArg 2014-09-29 07:18:51 -07:00
Nik Bougalis
bf9b8f4d1b Use secure RPC connections when configured 2014-09-28 04:39:49 -07:00
Vinnie Falco
d618581060 Config improvements:
* More fine-grained Section mutators
* Add remap for mapping legacy single sections to key value pairs
* Add output stream operators for BasicConfig and Section
* Allow section values to be overwritten from command line
* Update rpc key/value configs from command line
* Add RPC::Setup with defaults and remap legacy rpc sections
2014-09-28 04:39:49 -07:00
David Schwartz
2936bbfae8 Make path filtering smarter (RIPD-561)
* Break path liquidity checking into its own function
* Measure initial quality over minimum destination amount
* Test for available liquidity
2014-09-24 11:54:12 -07:00
Nik Bougalis
47b08bfc02 Add --quorum command line argument (RIPD-563) 2014-09-24 11:19:39 -07:00
Nik Bougalis
da4f77ca1f Return correct error message for invalid fields 2014-09-24 11:19:38 -07:00
David Schwartz
1c0a75d467 Distinguish Byzantine failure from tx bug (RIPD-523) 2014-09-24 11:19:38 -07:00
Nik Bougalis
659cf0c221 Decouple LedgerMaster from configuration 2014-09-24 11:19:38 -07:00
Howard Hinnant
430229fd84 Mark several Ledger member functions as const. 2014-09-24 11:19:37 -07:00
Howard Hinnant
81699a0971 Add +DEBUG to the raw version string for DEBUG builds.
This will show up in the rpc server_info command.
There is no impact on the version string for release builds.
2014-09-24 11:19:37 -07:00
MarkusTeufelberger
c54aff74b3 Build gcc.debug using -Og flag
Since gcc 4.8 is required anyways, it might be nice to use its features.

Intro to feature (second bullet point):
https://gcc.gnu.org/gcc-4.8/changes.html

-g (line 328) is still needed:
http://stackoverflow.com/questions/12970596/gcc-4-8-does-og-imply-g
2014-09-24 11:19:37 -07:00
Mark Travis
7f43ab9097 Improvements to SConstruct:
* Default target is release instead of debug (scons with no arguments).
* All targets now include debug symbols, including release.
Rationale: "out of the box" builds of rippled using plain "scons" or "scons -j4" will produce
a debug instead of a release build, which could underperform.
2014-09-24 11:19:36 -07:00
Miguel Portilla
d78f740250 Add account_offers paging (RIPD-344) 2014-09-19 16:38:10 -07:00
Miguel Portilla
cd1bd18a49 Add account_lines paging (RIPD-343) 2014-09-19 16:18:50 -07:00
sublimator
f81b084448 Set page sizes for ledger_data correctly (RIPD-249) 2014-09-19 16:16:49 -07:00
Vinnie Falco
02d9c77402 Set version to 0.26.3-sp2 2014-09-19 11:57:22 -07:00
Howard Hinnant
a0c903c68c Add needed #include <istream>
This is needed for the combination of boost 1.56 and libc++
2014-09-19 10:29:14 -07:00
JoelKatz
6aa325d3da On missing node in consensus, bow out (RIPD-567) 2014-09-18 15:12:45 -07:00
JoelKatz
041f874d4c Improve transaction security
* Check signatures of every transaction on every validator
* Remove obsolete code
* Check transaction status in submit/sign RPC handler
2014-09-18 14:25:09 -07:00
Nik Bougalis
526ecd6a81 Detect invalid inputs during STAmount conversion (RIPD-570):
* More robust validation of input
* XRP may not be specified using fractions
* Prevent creating native amounts larger than max possible value
* Add unit tests to verify correct parsing
2014-09-18 12:46:21 -07:00
Nik Bougalis
30eb927ad4 Templetize and improve beast string-to-integer conversions:
* Properly handle numbers at the edge of precision
* Improve and expand unit test coverage
2014-09-18 12:46:16 -07:00
Nik Bougalis
d373054fc4 Templetize and improve beast string-to-integer conversions:
* Properly handle numbers at the edge of precision
* Improve and expand unit test coverage
2014-09-18 12:46:16 -07:00
Vinnie Falco
b6d9f1d4b2 Add fee voting configuration and docs (RIPD-564) 2014-09-17 12:22:51 -07:00
Vinnie Falco
3fef916972 Move some constants to core/SystemParameters.h 2014-09-17 12:22:49 -07:00
Vinnie Falco
89a51e5b91 Split Section to its own header and add convenience accessors 2014-09-17 12:22:49 -07:00
miguelportilla
f87a6ccc7a Fix missing includes for boost 1.56.0 2014-09-16 15:22:00 -07:00
Nik Bougalis
f65cea66ef Remove unused macros, config variables, and file 2014-09-16 14:15:13 -07:00
Vinnie Falco
4239880acb Clean up and restructure sources 2014-09-16 14:15:12 -07:00
Vinnie Falco
579b1e6f79 Add missing includes and tidy up 2014-09-16 14:03:50 -07:00
Vinnie Falco
1dcd06a1c1 Add missing includes and tidy up 2014-09-16 14:03:50 -07:00
Vinnie Falco
0f30191d10 Refactor STAmount:
* Remove unused functions
* Remove unused constructor
* Use delegating constructors
* Mark some observers deprecated
* Clean up declaration parameter names
* Add checked and unchecked constructors
* De-inline unnecessary inlined functions
* Reorder and regroup members into sections
* Move globals from the unity file to the .cpp
* Change some member functions to be free functions
* Put implementation in one .cpp and the test in another .cpp

Remove unused STAmount constructor and delegate two others No change in functionality.
2014-09-16 07:39:50 -07:00
Vinnie Falco
8fb9d5daaa Set version to 0.26.4-alpha 2014-09-15 18:20:47 -07:00
Nik Bougalis
ed3c942ff1 Inject JobQueue in NetworkOPs 2014-09-15 16:05:01 -07:00
Nik Bougalis
80436d4a8b Cleanups:
* Remove obsolete string formatting function
* Remove unused ADDRESS macro
* Re-scope functions
2014-09-15 16:04:48 -07:00
Howard Hinnant
b5384cc964 Fix beast::http::headers move members 2014-09-15 16:03:36 -07:00
Howard Hinnant
cfc702c766 Fix beast::http::headers move members 2014-09-15 16:03:36 -07:00
Vinnie Falco
146d706343 Add base64 conversions and tests 2014-09-15 14:52:42 -07:00
Vinnie Falco
88ae15ea8e Add base64 conversions and tests 2014-09-15 14:52:42 -07:00
Vinnie Falco
b69ecfe75c Use transform_iterator in http::headers 2014-09-15 14:52:42 -07:00
Vinnie Falco
6bafca7386 Use transform_iterator in http::headers 2014-09-15 14:52:42 -07:00
Vinnie Falco
379e842080 Add BasicConfig simplified config interface 2014-09-15 12:46:04 -07:00
Vinnie Falco
c41ce469d0 Cleanup:
* Move QUALITY_ONE to Quality.h
* Move functional files up one level
* Remove core.h
* Merge routines into Config.cpp
* Rename Section to IniFileSections
* Rename IniFileSections routines
2014-09-15 12:21:36 -07:00
Vinnie Falco
a1ca68473d Merge branch 'release' into develop 2014-09-14 15:39:09 -07:00
Nik Bougalis
3345d03433 Avoid conversions whenever possible during RippleState lookups 2014-09-13 11:06:38 -07:00
Nik Bougalis
81a426608a Make log partitions case-insensitive 2014-09-13 11:06:19 -07:00
Vinnie Falco
2ad6f0a65e Set version to 0.26.3-sp1 2014-09-12 15:22:54 -07:00
Vinnie Falco
ee8bd8ddae Fix handling of HTTP/S keep-alives (RIPD-556):
* Proper shutdown for ssl and non-ssl connections
* Report session id in history
* Report histogram of requests per session
* Change print name to 'http'
* Split logging into "HTTP" and "HTTP-RPC" partitions
* More logging and refinement of logging severities
* Log the request count when a session is destroyed

Conflicts:
	src/ripple/http/impl/Peer.cpp
	src/ripple/http/impl/Peer.h
	src/ripple/http/impl/ServerImpl.cpp
	src/ripple/module/app/main/Application.cpp
	src/ripple/module/app/main/RPCHTTPServer.cpp
2014-09-12 15:19:17 -07:00
Vinnie Falco
319ac14e7d Add is_short_read() 2014-09-12 15:19:04 -07:00
Vinnie Falco
0215a7400d Fix handling of HTTP/S keep-alives (RIPD-556):
* Proper shutdown for ssl and non-ssl connections
* Report session id in history
* Report histogram of requests per session
* Change print name to 'http'
* Split logging into "HTTP" and "HTTP-RPC" partitions
* More logging and refinement of logging severities
* Log the request count when a session is destroyed
2014-09-12 14:20:30 -07:00
Vinnie Falco
02d834e9bb Add is_short_read() 2014-09-12 14:10:33 -07:00
Vinnie Falco
79db0ca7a6 Add is_short_read() 2014-09-12 14:10:33 -07:00
JoelKatz
1a7eafb699 Add ledger cleaner documentation (RIPD-555) 2014-09-09 22:33:42 -07:00
Nik Bougalis
81a06ea6cd Cleanups:
* Remove obsolete config variables
* Reduce coupling
* Use C++11 ownership containers
* Use auto when it makes sense
* Detect edge-case in unit tests
* Reduce the number of LedgerEntrySet public members
2014-09-09 22:33:42 -07:00
Nik Bougalis
e4ecc762c6 Refactor string-to-integer conversions 2014-09-09 21:38:09 -07:00
Nik Bougalis
de4be649ab Refactor string-to-integer conversions 2014-09-09 21:38:09 -07:00
sublimator
4f515adafe Normalize sort paths in Visual Studio project generator 2014-09-08 11:17:40 -07:00
sublimator
d90ec5f06c Normalize sort paths in Visual Studio project generator 2014-09-08 11:17:40 -07:00
Vinnie Falco
32065ced6e Add peer count to HTTP server properties 2014-09-08 11:17:39 -07:00
Scott Schurr
b5224a2227 Improve regularity of STObject and STArray (RIPD-448, RIPD-544):
* reduce duplicated code using templates
* replace BOOST_FOREACH with C++11 for loops
* remove most direct calls to new
* limit line length to 80 characters
* clearly identify virtual and overridden methods
* split STObject and STArray into their own files
* name files after the class they contain
2014-09-05 13:02:07 -07:00
Nik Bougalis
c55777738f Refactor LedgerEntrySet:
* Split adjustOwnerCount to increment and decrement paths.
* Move pathfinding-specific functions out of LedgerEntrySet
* Convert members to free functions
2014-09-05 11:50:17 -07:00
JoelKatz
c72dff5a24 Make more RocksDB tunables
Add support for universal compaction
2014-09-05 11:50:17 -07:00
JoelKatz
6b09e49c08 Increase the size of the tree cache:
This change will not significantly increase memory consumption
because most entries are pinned anyway.
2014-09-05 11:48:00 -07:00
Nik Bougalis
413218c4c4 Create the directory for the debug_logfile (RIPD-551) 2014-09-04 16:51:31 -07:00
Miguel Portilla
16c04b50ee Add date to tx command (RIPD-542) 2014-09-04 16:51:31 -07:00
Nik Bougalis
56c18f7768 Cleanups and fixes (RIPD-532):
* Properly handle sfWalletLocator field
* Plug a tiny memory leak
* Avoid naked pointers
* Remove unused variables
* Other small cleanups
2014-09-04 16:51:31 -07:00
Tom Ritchford
22ca13bc78 Cleanups to RPC code 2014-09-04 16:51:31 -07:00
Nicholas Dudfield
4c7fd18230 Ticket integration tests 2014-09-04 16:51:31 -07:00
Nik Bougalis
39730fc13e Ticket issuing (RIPD-368):
* New CreateTicket transactor to create tickets
* New CancelTicket transactor to cancel tickets
* Ledger entries for tickets & associated functions
* First draft of M-of-N documentation
2014-09-04 16:11:44 -07:00
Nik Bougalis
889c0a0d0f Transactor refactor:
* Allocate transactors on the stack instead of the heap.
* Remove header files and reduce transactor public interface.
2014-09-04 16:11:44 -07:00
Nik Bougalis
4f0a20ec68 Handle whitespace separating an 'ip port' correctly (RIPD-552) 2014-09-04 12:26:27 -07:00
Nik Bougalis
624a803955 Handle whitespace separating an 'ip port' correctly (RIPD-552) 2014-09-04 12:26:27 -07:00
Vinnie Falco
9f5c21f80e Set version to 0.26.3 2014-09-03 16:15:07 -07:00
Nik Bougalis
a3fe089367 Fix missing return value error check 2014-09-02 08:45:19 -07:00
Nik Bougalis
85d5cd3118 Fix missing return value error check 2014-09-01 21:11:31 -07:00
Vinnie Falco
61006e626d Also report mismatched built ledger 2014-08-28 18:03:50 -07:00
Nik Bougalis
15aad1cb24 Optimize pathfinding operations (RIPD-537):
* Calculate and cache Account hashes without holding locks.
* Fast hash-based path element comparison.
* Use emplace instead of find/insert
2014-08-28 15:57:29 -07:00
Tom Ritchford
95c1c5f54e Stream generated JSON. 2014-08-28 12:38:21 -07:00
Vinnie Falco
b12676f701 Fix special members for http classes 2014-08-28 12:38:03 -07:00
Vinnie Falco
c65fb91878 Fix special members for http classes 2014-08-28 12:38:03 -07:00
Vinnie Falco
d5a7e1331e Set version to 0.26.3-rc3 2014-08-27 15:58:41 -07:00
Vinnie Falco
b968821cc1 HTTP message and parser improvements:
* streambuf wrapper supports rvalue move
* message class holds a complete HTTP message
* body class holds the HTTP content body
* headers class holds RFC-compliant HTTP headers
* basic_parser provides class interface to joyent's http-parser
* parser class parses into a message object
* Remove unused http get client free function
* unit test for parsing malformed messages
2014-08-27 18:06:30 -04:00
Vinnie Falco
04bcd93ba3 HTTP(S)-RPC server improvements (RIPD-489, RIPD-533):
* Correct handling of Keep-Alive in socket handlers
* Report session history in print command
2014-08-27 18:06:30 -04:00
Vinnie Falco
f97ef7039a HTTP message and parser improvements:
* streambuf wrapper supports rvalue move
* message class holds a complete HTTP message
* body class holds the HTTP content body
* headers class holds RFC-compliant HTTP headers
* basic_parser provides class interface to joyent's http-parser
* parser class parses into a message object
* Remove unused http get client free function
* unit test for parsing malformed messages
2014-08-27 18:06:30 -04:00
Tom Ritchford
9160b46c1e Bug fixes and new features for LedgerTool:
* Fix RIPD-509, RIPD-514, RIPD-519, RIPD-525, RIPD-527, RIPD-529,
  RIPD-530 and RIPD-531.
* Protect people from ledger-spew and remove cruft.
* Better error messages and handling.
* Cache command lists or clears ledger cache.
* Better ledger summaries.
* Offline mode.
2014-08-27 18:05:44 -04:00
Edward Hennis
aa4b116498 Wrap RippleCalc into a single function (RIPD-500):
* Change public members of Input and Output to remove trailing _.
* Remove Input constructor and separate flags in RippleCalc to reduce
  duplication and confusion.
* Make calculation result private; add getter.
* Narrow scope of some of the results of calls to rippleCalculate.
2014-08-27 18:05:30 -04:00
Edward Hennis
d81154bf6c Add enable_if_lvalue 2014-08-27 17:10:24 -04:00
Edward Hennis
612bb71165 Add enable_if_lvalue 2014-08-27 17:10:24 -04:00
Torrie Fischer
5c67f99ef9 Remove old rocksdb/ 2014-08-27 12:37:13 -07:00
Torrie Fischer
101a4808a0 Update includes and scons 2014-08-27 12:37:05 -07:00
Torrie Fischer
1d38671f5e Squashed 'src/rocksdb2/' content from commit 37c6740
git-subtree-dir: src/rocksdb2
git-subtree-split: 37c6740c383bb9a6ee2747b04f08bc77fcfa10c5
2014-08-27 12:36:50 -07:00
Torrie Fischer
7f25d88f02 Merge commit '1d38671f5edc2322bc58417816674cc629ae7a70' as 'src/rocksdb2' 2014-08-27 12:36:50 -07:00
Vinnie Falco
be830d3dad Set version to 0.26.3-rc2 2014-08-26 10:00:03 -07:00
Nik Bougalis
5bc949d70f Fix a unit test warning 2014-08-26 10:00:03 -07:00
Vinnie Falco
43817bd722 Merge remote-tracking branch 'upstream/release' into tmp 2014-08-26 09:46:29 -07:00
JoelKatz
61623d6d75 Improve parallelization of getRippleLines 2014-08-26 09:28:10 -07:00
David Schwartz
9aad60f56d Make sure we update mTNByID when we replace the root 2014-08-26 09:28:09 -07:00
Vinnie Falco
e7cf3e8084 Add ledger.history.mismatch insight statistic 2014-08-26 09:28:07 -07:00
Tom Ritchford
c7c9a725b8 Compile git tags now include name and branch. (RIPD-493) 2014-08-22 18:10:17 -04:00
Tom Ritchford
e024e7c2ec Compile git tags now include name and branch. (RIPD-493) 2014-08-22 18:10:17 -04:00
Edward Hennis
6fc136ae9a Update npm tests & config to pass in Windows. (RIPD-209)
* Extend timeout for WebSocket test.
* Windows networking doesn't like connecting to 0.0.0.0. Use 127.0.0.1
* Additional command line options in config. Can potentially be used to run rippled in a debugger.
2014-08-22 18:10:17 -04:00
Edward Hennis
2b69ded1ea Convert rvalue to an lvalue. (RIPD-494)
* The rvalue gets destructed as soon as "rc" is constructed.
2014-08-22 18:10:17 -04:00
Tom Ritchford
8dd799aa6f New command line LedgerTool. (RIPD-243)
* Retrieve and process summary or full ledgers.
* Search using arbitrary criteria (any Python function).
* Search using arbitrary formats (any Python function).
* Caches ledgers as .gz files to avoid repeated server requests.
* Handles ledger numbers, ranges, and special names like validated or closed.
2014-08-22 18:10:11 -04:00
Vinnie Falco
83add658f9 Fix warnings and compile errors 2014-08-20 17:44:00 -07:00
Vinnie Falco
7230ef41ee Fix warnings and compile errors 2014-08-20 17:44:00 -07:00
Edward Hennis
a86f0a743c Clean up some docs
* Consistent line endings in rippled-example.cfg
* Rewrite CodingStyle.md. Get down to top priorities
2014-08-20 16:20:15 -07:00
Josh Juran
af75b55ef7 src/README.md: s/addded/added/ 2014-08-20 16:19:28 -07:00
Vinnie Falco
9ecb37dd4f Add validators aged container test 2014-08-20 16:09:52 -07:00
Scott Schurr
cb0e91c602 Use aged containers in Validators module (RIPD-349) 2014-08-20 16:09:51 -07:00
Vinnie Falco
2e3784a914 Tidy up sources 2014-08-20 16:09:51 -07:00
Scott Schurr
019c1af435 Use aged containers in Validators module (RIPD-349) 2014-08-20 16:09:51 -07:00
Vinnie Falco
97d87dff09 Fix exception safety in aged containers 2014-08-20 16:09:50 -07:00
Vinnie Falco
5322955f2b Fix exception safety in aged containers 2014-08-20 16:09:50 -07:00
Howard Hinnant
fe9d77734f Fix move constructor of aged_unordered_container (RIPD-490) 2014-08-20 16:08:59 -07:00
Howard Hinnant
a8ea4ce283 Fix move constructor of aged_unordered_container (RIPD-490) 2014-08-20 16:08:59 -07:00
Mark Travis
c12862f60d Enable heap profiling with jemalloc:
The jemalloc library (which must be downloaded and installed separately)
is required to perform heap profiling. Instructions on how to enable heap
profiling with rippled are available in doc/HeapProfiling.md
2014-08-13 20:36:38 -07:00
Tom Ritchford
e889183fc5 JSON cleanups:
* Fix Json headers to include what they use.
* Get rid of ripple/json/api directory.
2014-08-13 20:36:36 -07:00
Jeff Trull
7be695c6bd Handle changes to boost::optional in newly released boost 1.56:
To improve compatibility with the proposed std::optional a number
of changes were made, one of which is the removal of the implicit
conversion to bool.  As a result, returning boost::optional as a
bool value now fails.  Explicit conversion to bool used for clarity.
2014-08-13 19:00:17 -07:00
Nik Bougalis
956901ae02 Properly handle edge-cases when parsing JSON integers (RIPD-470):
* Properly handle both unsigned and signed integers
* Return parsing error for overlong JSON numbers
* Implement unit test checking the edge cases that are of interest
2014-08-13 18:46:32 -07:00
Nik Bougalis
d562c5b2d5 Account for high-ascii (RIPD-464) 2014-08-13 18:46:32 -07:00
Nik Bougalis
d7b054c3f6 When compiling debug builds with GCC use _FORTIFY_SOURCE=2:
This gcc/glibc feature adds some (supposedly) lightweight checks which can
help detect errors such as buffer overflows.
2014-08-13 18:33:30 -07:00
Tom Ritchford
901ccad0cf Clarify unfunded offer deletion strategy. 2014-08-13 18:33:03 -07:00
Vinnie Falco
b9454e0f0c Set version to 0.26.2 2014-08-12 12:19:13 -07:00
Vinnie Falco
26181907fc Merge branch 'release-next' into release
Conflicts:
	src/ripple/module/app/paths/cursor/ForwardLiquidity.cpp
	src/ripple/overlay/tests/peer_info.test.cpp
	src/ripple/unity/http.h
2014-08-12 12:19:04 -07:00
Miguel Portilla
8368798ad2 Add owner_funds to subscription streams (RIPD-377) 2014-08-12 11:56:07 -07:00
Miguel Portilla
ed597e5e99 Add owner_funds to subscription streams (RIPD-377) 2014-08-12 11:54:49 -07:00
Miguel Portilla
2c88c15f7f Fix unhandled exception in async HTTP server (RIPD-475) 2014-08-12 11:54:02 -07:00
Miguel Portilla
af7cd3cc04 Fix unhandled exception in async HTTP server (RIPD-475) 2014-08-12 11:46:45 -07:00
Howard Hinnant
9552551f9a Refactor SField (RIPD-431)
* Restrict access to SField constructors.
* Make all SField access const.
* Hide and simplify databases used to hold SField constants.
* Separate the two concerns of representing a field,
  and maintaining a database of fields.
2014-08-08 19:16:51 -07:00
Edward Hennis
1c73a0f649 Remove unused code:
* StringConcat was only being referenced by unit test.
* `runall.sh` is no longer needed. Use `npm test` instead.
2014-08-08 19:16:42 -07:00
Tom Ritchford
e3698b2a07 Fix Pathfinder::getPathsOut to use Issue 2014-08-08 19:16:34 -07:00
Tom Ritchford
8b59a2f6b6 Add the git tag to the compile (RIPD-238) 2014-08-08 19:16:33 -07:00
Tom Ritchford
c841f8b360 Add the git tag to the compile (RIPD-238) 2014-08-08 19:16:33 -07:00
Nik Bougalis
0857c6350d Refactor beast::SemanticVersion (RIPD-199) 2014-08-08 14:57:39 -07:00
wltsmrz
50f9b68d61 Bump ledger_wait timeout for Travis 2014-08-08 14:57:39 -07:00
Nik Bougalis
27b48bc16e Refactor beast::SemanticVersion (RIPD-199) 2014-08-08 14:57:39 -07:00
Edward Hennis
bccdbaed2b Update Doxyfile (RIPD-175):
* Clean up the include path to reflect updated code structure.
* Update PROJECT_BRIEF to more accurate title.
* Fix location of logo graphic.
* Hide all undocumented classes.
2014-08-08 14:57:39 -07:00
Nik Bougalis
398095a667 Cleanups and performance optimizations (RIPD-450):
* Remove AccountItems and AccountItem
* Restructure RippleLineCache to not require shared_ptr
* Avoid expensive copies of base_uint<160> in RippleState
2014-08-08 14:57:39 -07:00
Nik Bougalis
80095824b9 Remove obsolete nickname support 2014-08-08 14:57:39 -07:00
Nik Bougalis
d91c1f96cc Detect node store batch write failures (RIPD-270):
* Raise open file limit from the soft max to the hard max.
2014-08-08 14:57:39 -07:00
Howard Hinnant
1c005a0292 Fix macro setting for rocksdb unity file 2014-08-08 14:50:15 -07:00
miguelportilla
c7ced496ac Update rocksdb unity file (RIPD-352) 2014-08-08 15:42:41 -04:00
Vinnie Falco
d4ff18834c Merge commit 'f86d9fd626df1cee55bce4c577d06bb064dc827b' as 'src/rocksdb' 2014-08-08 11:57:41 -07:00
Vinnie Falco
f86d9fd626 Squashed 'src/rocksdb/' content from commit 224932d
git-subtree-dir: src/rocksdb
git-subtree-split: 224932d4d0
2014-08-08 11:57:41 -07:00
Vinnie Falco
854604f724 Remove rocksdb in preparation for subtree add 2014-08-08 11:57:29 -07:00
Vinnie Falco
cfd3642cb1 Set version to 0.26.2-alpha-4 2014-08-07 17:13:55 -07:00
Tom Ritchford
f493590604 Logic fix for multiquality issues. 2014-08-07 17:10:38 -07:00
Vinnie Falco
8c084a3de8 Set version to 0.26.2-alpha-3 2014-08-07 10:13:22 -07:00
Tom Ritchford
985aa803a4 Fix error with multi-quality paths. 2014-08-07 10:12:09 -07:00
Vinnie Falco
9e319d7bd6 Set version to 0.26.2-alpha-2 2014-08-06 10:16:13 -07:00
David Schwartz
a122e176d7 Pathfinding fixes:
* Don't consider global freeze if not enforcing
 * Log if a covering path fails to cover
2014-08-06 10:16:12 -07:00
Tom Ritchford
88a6f2931e Fix local variable unfundedOffers that was shadowing a class variable. 2014-08-06 09:26:22 -07:00
Vinnie Falco
bf403a6142 Fix missing return values in headers_t 2014-08-05 16:43:13 -07:00
Vinnie Falco
54f3a83e25 Fix missing return values in headers_t 2014-08-05 16:43:13 -07:00
Vinnie Falco
0955c0d8d3 Set version to 0.26.2-alpha-1 2014-08-05 15:40:34 -07:00
JoelKatz
6bb5be5216 Avoid a mutex 99+% of the time in SField::getField 2014-08-05 15:36:12 -07:00
JoelKatz
c9cd7e4be0 Rewrite STObject::setType for improved performance 2014-08-05 15:36:05 -07:00
Miguel Portilla
ce2cecf046 Add owner_funds to client subscription data (RIPD-377)
Conflicts:
	src/ripple/module/app/ledger/AcceptedLedger.cpp
2014-08-05 15:04:50 -07:00
Vinnie Falco
6e934ee6a1 HTTP handshake in peer protocol (RIPD-351):
* New I/O paths for client and server role
* New handshake_analyzer detects the peer protocol
* New basic_message class for parsing and storing HTTP messages
* Conditional compilation for selective feature enabling.
* Server supports both current handshake and HTTP handshake
2014-08-05 13:17:02 -07:00
Vinnie Falco
5b8bb822ba HTTP support improvements:
* RFC2616 compliance
* Case insensitive equality, inequality operators for strings
* Improvements to http::parser
* Tidy up HTTP method enumeration
2014-08-05 13:17:01 -07:00
Vinnie Falco
723d7d1263 HTTP support improvements:
* RFC2616 compliance
* Case insensitive equality, inequality operators for strings
* Improvements to http::parser
* Tidy up HTTP method enumeration
2014-08-05 13:17:01 -07:00
Scott Schurr
df32f27762 Improvements to aged_containers (RIPD-363)
- Added unit tests for element erase
- Added unit tests for range erase
- Added unit tests for touch
- Added unit tests for iterators and reverse_iterators
- Un-inlined operator== for unordered containers
- Fixed minor problems with ordered_container erase()
- Made ordered_container...
  - erase (reverse_iterator pos) not compile
  - erase (reverse_iterator first, reverse_iterator last) not compile
  - touch (reverse iterator pos) not compile
- Verified that ordered container...
  - insert() already rejects reverse_iterator
  - emplace_hint() already rejects reverse_iterator
- Made set/multiset iterators const

Regarding the set/multiset iterators, see section 1.5 of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2913.pdf
as pointed out by Vinnie.
2014-08-04 15:25:30 -07:00
Scott Schurr
298572893e Improvements to aged_containers (RIPD-363)
- Added unit tests for element erase
- Added unit tests for range erase
- Added unit tests for touch
- Added unit tests for iterators and reverse_iterators
- Un-inlined operator== for unordered containers
- Fixed minor problems with ordered_container erase()
- Made ordered_container...
  - erase (reverse_iterator pos) not compile
  - erase (reverse_iterator first, reverse_iterator last) not compile
  - touch (reverse iterator pos) not compile
- Verified that ordered container...
  - insert() already rejects reverse_iterator
  - emplace_hint() already rejects reverse_iterator
- Made set/multiset iterators const

Regarding the set/multiset iterators, see section 1.5 of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2913.pdf
as pointed out by Vinnie.
2014-08-04 15:25:30 -07:00
Mark Travis
405f6f7368 Make NetworkOPs::isFull() thread-safe 2014-08-04 11:19:07 -07:00
Tom Ritchford
648ccc7c17 Replace const Type& with Type const& for common types.
* std::string
* RippleAccount
* Account
* Currency
* uint256
* STAmount
* Json::Value
2014-08-04 11:18:44 -07:00
Mark Travis
f5afe0587f Fix filter_policy object leak in NodeStore backends 2014-08-04 11:16:44 -07:00
Tom Ritchford
91a227a475 Correct Pathfinder::getPaths out to handle order books (RIPD-427) 2014-08-02 10:38:57 -07:00
Tom Ritchford
4b905fe9ff Clean OrderBookDB::getBooksBy methods. 2014-08-02 10:38:57 -07:00
Howard Hinnant
0f409b7bec ASCII clean 2014-08-02 10:38:56 -07:00
Vinnie Falco
295c8de858 Detect inconsistency in PeerFinder self-connects (RIPD-411) 2014-07-31 16:10:54 -07:00
Nik Bougalis
e5252f90af Remove LedgerBase and decongest Ledger locks 2014-07-31 16:05:08 -07:00
Miguel Portilla
c2276155bf Add pubkey_node and hostid to server stream messages (RIPD-407) 2014-07-31 16:05:08 -07:00
Miguel Portilla
dbe49bcd87 Remove TRUST_NETWORK directive (RIPD-331) 2014-07-31 16:04:59 -07:00
David Schwartz
7b936de32c Freeze enforcing: (RIPD-399)
* Set enforce date: September 15, 2014
 * Enforce in stand alone mode
 * Enforce at source
 * Enforce intermediary nodes
 * Enforce global freeze in get paths out
 * Enforce global freeze in create offer
 * Don't consider frozen links a path out
 * Handle in getBookPage
 * Enforce in new offer transactors
2014-07-30 23:28:48 -07:00
evhub
ee570a49d0 More fixes to VSProject sorting algorithm 2014-07-30 08:56:54 -07:00
evhub
9eb34f542c More fixes to VSProject sorting algorithm 2014-07-30 08:56:54 -07:00
Tom Ritchford
194304e544 Refactor RippleCalc:
* Rationalize method and filenames, move to subdirectory.
* Use Issue in Node.
* Restrict access to PathState variables.
* Line length and readability cleanups.
* New PathCursor stores path calculation data during rippleCalc.
* Extract methods PathCursor::node(), PathCursor::previousNode()
  and RippleCalc::addPath
2014-07-30 08:29:29 -07:00
Howard Hinnant
c59fc332d5 Make CBase58Data/RippleAddress movable (RIPD-428):
This significantly increases the performance in returning
these types from factory functions.
2014-07-30 07:25:24 -07:00
Nik Bougalis
b43832fe57 Use std::atomic 2014-07-29 21:50:58 -04:00
Howard Hinnant
c24a497a23 Further documentation improvements to Ledger Consensus. 2014-07-29 21:41:19 -04:00
Tom Ritchford
4096fcd1bf Reduce scope of RPC locks and general cleanup (RIPD-458) 2014-07-29 16:24:44 -04:00
Vinnie Falco
9a0e806f78 Set version to 0.26.1 2014-07-28 12:05:01 -07:00
Vinnie Falco
20c9632996 Enable asynchronous handling of HTTP-RPC (RIPD-390)
* Activate async code path
* Tidy up HTTP server code
* Use shared_ptr in HTTP server
* Remove check for unspecified IP
* Remove hairtrigger
* Fix missing HTTP authorization check
* Fix multisocket flags in RPC-HTTP server
* Fix authorization failure when no credentials required
* Addresses RIPD-159, RIPD-161, RIPD-390
2014-07-28 12:05:01 -07:00
Vinnie Falco
65a628ca88 Add HTTPHeaders::build_map 2014-07-28 12:05:00 -07:00
Vinnie Falco
d82dbba096 Make bind_handler variadic ctor explicit 2014-07-28 12:05:00 -07:00
Howard Hinnant
58547f6997 Tidy up hardened containers (RIPD-380):
* Rename hardened containers for clarity
* Fixes https://ripplelabs.atlassian.net/browse/RIPD-380
2014-07-28 09:06:35 -07:00
Howard Hinnant
6a1071ccd3 Tidy up hardened_hash:
* Added siphash as a HashAlgorithm
* Refactored class responsibilities
2014-07-28 09:06:22 -07:00
Howard Hinnant
e6f4eedb1e Tidy up hardened_hash:
* Added siphash as a HashAlgorithm
* Refactored class responsibilities
2014-07-28 09:06:22 -07:00
Vinnie Falco
11d667c830 Fix intrinsic calls in static_initializer 2014-07-28 09:04:41 -07:00
Vinnie Falco
c5b963141f Fix intrinsic calls in static_initializer 2014-07-28 09:04:41 -07:00
Nik Bougalis
5df40bd746 Fix auth handling during OfferCreate (RIPD-414) 2014-07-28 08:57:22 -07:00
Howard Hinnant
403f15dc48 Documentation for Ledger Consensus implementation (RIPD-405) 2014-07-28 08:56:23 -07:00
Nik Bougalis
704d7451a0 Fix auth handling during OfferCreate (RIPD-414) 2014-07-25 11:42:42 -07:00
Vinnie Falco
fa11071443 Enable asynchronous handling of HTTP-RPC (RIPD-390)
* Activate async code path
* Tidy up HTTP server code
* Use shared_ptr in HTTP server
* Remove check for unspecified IP
* Remove hairtrigger
* Fix missing HTTP authorization check
* Fix multisocket flags in RPC-HTTP server
* Fix authorization failure when no credentials required
* Addresses RIPD-159, RIPD-161, RIPD-390
2014-07-24 20:22:55 -07:00
Vinnie Falco
cc11b498cc Add HTTPHeaders::build_map 2014-07-24 20:18:51 -07:00
Vinnie Falco
87351c8a0c Add HTTPHeaders::build_map 2014-07-24 20:18:51 -07:00
Vinnie Falco
ca71f18a6d Make bind_handler variadic ctor explicit 2014-07-24 20:18:51 -07:00
Vinnie Falco
2f5fb1e68e Make bind_handler variadic ctor explicit 2014-07-24 20:18:51 -07:00
Tom Ritchford
6b79b5fc74 Fix build warnings and .gitignore.
* Comment out unused local function for both clang and g++.
* Get rid of numerous Boost warnings for clang.
* Remove some unused local variables.
* Put TAGS into the .gitignore.
2014-07-24 20:18:51 -07:00
Tom Ritchford
96e1ec6d31 Fix build warnings and .gitignore.
* Comment out unused local function for both clang and g++.
* Get rid of numerous Boost warnings for clang.
* Remove some unused local variables.
* Put TAGS into the .gitignore.
2014-07-24 20:18:51 -07:00
Nik Bougalis
ac3cf05f1a Properly order warning suppression flags during compile 2014-07-24 20:18:51 -07:00
Tom Ritchford
6335e34395 Simplify locking and move a typedef.
* Make DatabaseCon's lock private and expose a scoped lock_guard.
* Get rid of DeprecatedRecursiveMutex and DeprecatedScopedLock entirely.
* Move CancelCallback to Job where it logically belongs.
2014-07-23 19:38:52 -07:00
Scott Schurr
02c2029ac1 Add more documentation of ledger acquisition (RIPD-373)
Capturing information from a seminar on the topic into the source tree.
2014-07-23 19:29:13 -07:00
David Schwartz
6914aa3e27 Check for payment increments that make no progress. (RIPD-374) 2014-07-23 19:27:55 -07:00
David Schwartz
f4fcb1cc9a Remove some dead SHAMapMissingNode code 2014-07-23 19:27:50 -07:00
David Schwartz
b6eec21ec0 Pathfinder cleanups, more efficient 'd' handling (RIPD-156) 2014-07-23 19:27:46 -07:00
David Schwartz
0ce3aeb189 Stop finding paths when enough are found (RIPD-156) 2014-07-23 19:27:42 -07:00
Nicholas Dudfield
713c8efcbe Fix intermittently failing send test 2014-07-23 02:27:19 -07:00
Vinnie Falco
9fa5e39872 Set version to 0.26.0 2014-07-22 09:59:45 -07:00
Vinnie Falco
ace53fa405 Set version to 0.26.0-rc2 2014-07-21 10:39:48 -07:00
Vinnie Falco
3c06980107 Merge branch 'release' into develop 2014-07-21 10:25:23 -07:00
Vinnie Falco
1f26fbb5af Set version to 0.26.0-rc1 2014-07-21 10:00:16 -07:00
Howard Hinnant
84c6622122 Fix bugs, typo in SHAMapNodeID 2014-07-18 17:45:51 -07:00
Miguel Portilla
63f099f2f6 Fix book_offers limit parameter (RIPD-295)
Conflicts:
	src/ripple/module/app/misc/NetworkOPs.cpp
2014-07-18 10:37:45 -07:00
Nicholas Dudfield
373ce72984 Update freeze tests
* Conditionally skip freeze enforcement tests
* Honour remote.fee_cushion setting
* Workaround ripple-lib regression
* Don't use mocha features from wrong version
2014-07-18 10:35:06 -07:00
JoelKatz
4cf29455e4 Freeze flags: (RIPD-394)
* Define all flags
 * Set/clear bits in transactors
 * Frozen line counts towards reserve, is non-default
 * Report trust line state
2014-07-18 10:35:06 -07:00
David Schwartz
07db5d497c Remove SHAMapNodeID from SHAMapTreeNode (RIPD-347)
This resolves the "right data, wrong ID" issue in the
tree node cache.
2014-07-18 10:35:06 -07:00
JoelKatz
f1bb0afc4e Improve transaction fee and execution logic (RIPD-323):
* tecINSUFF_FEE if balance doesn't cover fee
* Ensure transaction recovery is deterministic
* Reduce transaction retries
2014-07-18 10:35:06 -07:00
Vinnie Falco
d791fe3013 Fix msvc static initialization in SHAMapNodeID 2014-07-17 20:05:39 -07:00
Miguel Portilla
c16e22a5c6 Fix book_offers limit parameter (RIPD-295) 2014-07-17 18:01:20 -07:00
Miguel Portilla
db7a720445 Fix static initializers in RippleSSLContext (RIPD-375) 2014-07-17 18:01:19 -07:00
Miguel Portilla
df24ae0fbb Workaround gcc bug with static_initializer default ctor 2014-07-17 18:00:43 -07:00
Miguel Portilla
6c09a02099 Workaround gcc bug with static_initializer default ctor 2014-07-17 18:00:43 -07:00
Howard Hinnant
1b3356cafd Remove calls to SHAMapNode::getID (RIPD-347):
Calls in SHAMap::getCache and SHAMap::canonicalize are
purposefully left in place at this time (to be removed
later).
2014-07-17 15:58:03 -07:00
Scott Schurr
5869902f2c Tidy up Resource::Manager (RIPD-362):
* Style improvements
* More documentation
2014-07-17 14:18:18 -07:00
Howard Hinnant
28898031f0 Eliminate spurious SHAMap::getFetchPack failure (RIPD-379) 2014-07-17 10:38:07 -07:00
Vinnie Falco
1ce0f94638 Define OPENSSL_NO_SSL2 2014-07-17 10:18:37 -07:00
Vinnie Falco
b74cdb2f9d Fix static_initializer: …
* Prevents double construction, invalid access
* Unit test works on MSVC and non MSVC
2014-07-16 16:43:17 -07:00
Vinnie Falco
f876ad973f Fix static_initializer: …
* Prevents double construction, invalid access
* Unit test works on MSVC and non MSVC
2014-07-16 16:43:17 -07:00
Tom Ritchford
6014b13234 Use Books in Ledger. 2014-07-15 21:16:42 -07:00
Vinnie Falco
bb730c00e9 Support stream composition of testcase names 2014-07-15 18:23:01 -07:00
Vinnie Falco
3e9c702c47 Support stream composition of testcase names 2014-07-15 18:23:01 -07:00
Vinnie Falco
3ff919ccf1 Fix version to say 'rippled' 2014-07-15 13:03:40 -07:00
evhub
7a92ac91d0 Fix VSProject item sorting (again)
Conflicts:
	src/beast/site_scons/site_tools/VSProject.py
2014-07-15 12:51:57 -07:00
evhub
8dc0844c79 Fix VSProject item sorting (again)
Conflicts:
	src/beast/site_scons/site_tools/VSProject.py
2014-07-15 12:51:57 -07:00
David Schwartz
a2764b68ca Rate-limit SSL client renegotiation (RIPD-360) 2014-07-14 10:42:29 -07:00
Tom Ritchford
bbbae072ea Simplify initialization of Pathfinder using C++11 constructs. 2014-07-14 10:04:27 -07:00
evhub
e68b989af5 Fix VSProject item sorting:
* Use object type in the sort key
* Call _key recursively over containers
* Prevent passing of iterators to xsorted
* Fix VSProject generator with new sorting
2014-07-14 10:04:07 -07:00
evhub
b4735b5931 Fix VSProject item sorting:
* Use object type in the sort key
* Call _key recursively over containers
* Prevent passing of iterators to xsorted
* Fix VSProject generator with new sorting
2014-07-14 10:04:07 -07:00
Tom Ritchford
418638ad16 Serialization code improvements:
* Add generics to eliminate duplicate code in STHash
* Use generics in Serializer and callers
2014-07-11 12:00:49 -07:00
Scott Schurr
9fb09d3109 Pass and use time_point in DecayingSample ctor (RIPD-359)
Switches a number of places in Resource::Logic to use abstract_clock::now()
which returns a time_point.  Unfortunately Resource::Logic tracks time
locally also, but with ints, not time_point.  So Resource::Logic uses a
delicate mix of abstract_clock::now() and abstract_clock::elapsed() with
this commit.  That inconsistency could be addressed in a second commit.
2014-07-11 12:00:39 -07:00
Tom Ritchford
fd27bcd7ee Various tidying:
* Fix unused variable warnings.
* Clean unused items from TER.
* Improvement to LES use of shared_ptr.
2014-07-10 15:11:33 -07:00
Tom Ritchford
d7e08f96a5 Various tidying:
* Fix unused variable warnings.
* Clean unused items from TER.
* Improvement to LES use of shared_ptr.
2014-07-10 15:11:33 -07:00
JoelKatz
4d49d272eb Fix account_tx resume (RIPD-314) 2014-07-10 15:11:33 -07:00
JoelKatz
faa6890950 Find 'sabfd' paths (RIPD-335)
This permits USD/GW1 to be bridged to USD/GW2 by BTC/GW3 or
USD/GW1 to be bridged to BTC/GW2 by CNY/GW3.
2014-07-10 15:11:33 -07:00
David Schwartz
9c390f6da4 Impose a local limit on path lengths (RIPD-350) 2014-07-10 15:09:06 -07:00
Scott Schurr
6842277977 Add documentation for ledger entries (RIPD-361) 2014-07-10 15:08:07 -07:00
Mark Travis
ddf68d464d Set version to 0.25.2 2014-07-07 12:41:46 -07:00
JoelKatz
b2f19e8dc6 Find 'sabfd' paths
This permits USD/GW1 to be bridged to USD/GW2 by BTC/GW3 or
USD/GW1 to be bridged to BTC/GW2 by CNY/GW3. See RIPD-335.
2014-07-07 12:41:46 -07:00
David Schwartz
5714b42975 Impose a local limit on path lengths 2014-07-07 11:42:24 -07:00
David Schwartz
c4e9c49c10 Set version to 0.25.2-rc2 2014-07-07 11:33:26 -07:00
Mark Travis
9210efb051 In JSON, output unprintable currency codes as hex 2014-07-07 11:33:26 -07:00
Tom Ritchford
b9f1b05625 Use swapWith to save CPU; edit comment. 2014-07-07 11:33:26 -07:00
sublimator
828c2e3c71 Restore checkpointed ledger under all paths in PathFind. 2014-07-07 11:33:12 -07:00
Nik Bougalis
10150a7352 Patch Boost to suppress warnings on clang 2014-07-06 15:17:58 -07:00
Scott Schurr
baaa45f8c7 SHAMap Documentation 2014-07-06 14:57:59 -07:00
Tom Ritchford
322af30d6a Pathfinding Documentation 2014-07-06 14:57:59 -07:00
Tom Ritchford
206efbf30d Rename RippleAsset to Issue and RippleBook to Book:
* Split STAmount out of SerializedTypes.h
* New concept of "Issue consistency": when either both or neither of its
  currency and account are XRP.
* Stop checking for consistency of Issue in its constructor.
* Clarification of mIsNative logic in STAmount.
* Usual cleanups.
2014-07-06 14:57:59 -07:00
Tom Ritchford
a96dee85d2 Remove recursions from computeLiquidity 2014-07-06 14:57:58 -07:00
Vinnie Falco
d307568cbc Update rocksdb unity file 2014-07-03 17:49:17 -07:00
Vinnie Falco
0ee27b143c Merge commit '7bfb4a9ba5a2822f7d9ef7122b1388aea4be9404' as 'src/rocksdb' 2014-07-03 17:49:00 -07:00
Vinnie Falco
7bfb4a9ba5 Squashed 'src/rocksdb/' content from commit 78b8a7d
git-subtree-dir: src/rocksdb
git-subtree-split: 78b8a7d908
2014-07-03 17:49:00 -07:00
Vinnie Falco
110c73fc8d Remove rockdb subtree 2014-07-03 17:43:48 -07:00
Vinnie Falco
424d9b8385 Add preliminary Structured Overlay docs 2014-07-03 14:34:38 -07:00
Vinnie Falco
1b48ccc868 Fix base log partition severity 2014-07-03 11:57:14 -07:00
Howard Hinnant
f5eb22253d Remove boost::hash_value() overloads.
This addresses https://ripplelabs.atlassian.net/browse/RIPD-102
2014-07-02 15:33:11 -07:00
Howard Hinnant
fac82204b6 Remove boost::hash_value() overloads.
This addresses https://ripplelabs.atlassian.net/browse/RIPD-102
2014-07-02 15:33:11 -07:00
David Schwartz
61f114e655 Cleanup confusion of ledger base versus ledger header
The "ledger header" is the chunk of data that hashes to the
ledger's hash. It contains the sequence number, parent hash,
hash of the previous ledger, hash of the root node of the
state tree, and so on.

The term "ledger base" refers to a particular type of query
and response used in the ledger fetch process that includes
the ledger header but may also contain other information
such as the root node of the state tree.
2014-07-02 15:33:10 -07:00
MarkusTeufelberger
24410bf1bb Update Sconstruct 2014-07-01 19:12:47 -07:00
Vinnie Falco
aa24969eee Add README.md for ledger process 2014-07-01 12:42:41 -07:00
David Schwartz
a5297d13c4 Add new memo restrictions 2014-07-01 12:13:47 -07:00
David Schwartz
b06bdb83cb Fix a case where we put an extra node in the SHAMapDiff 2014-07-01 12:13:13 -07:00
David Schwartz
d06092212f Tighten up some serialization checks 2014-06-30 16:53:38 -07:00
David Schwartz
914778eae1 In JSON, output unprintable currency codes as hex 2014-06-30 16:40:53 -07:00
Nicholas Dudfield
e14c700c60 New integration tests:
* New tests for autobridging and freeze
* Discrepancy detection tests
* Don't let Mocha suppress load time errors
2014-06-28 18:27:33 -07:00
wltsmrz
0848e348bb Update ripple-lib integration tests 2014-06-28 13:17:31 -07:00
Vinnie Falco
3d5ae42660 Structured Overlay support:
* Add Peer Protocol detector
* Add RIPPLE_SINGLE_IO_SERVICE_THREAD setting
* Preliminary HTTP header parsing logic (disabled)
2014-06-26 18:24:50 -07:00
Vinnie Falco
0c5c901222 Improvements to HTTP parsing 2014-06-26 17:41:12 -07:00
Vinnie Falco
f207b6b4c9 Improvements to HTTP parsing 2014-06-26 17:41:12 -07:00
David Schwartz
ed2c5078ad Tighten up some serialization checks 2014-06-26 17:16:34 -07:00
sublimator
aec792f5b8 Restore checkpointed ledger under all paths in PathFind. 2014-06-26 17:16:34 -07:00
Nik Bougalis
17d64de3d5 During playback close ledger before accepting 2014-06-26 17:16:34 -07:00
Tom Ritchford
f6bea08535 Update state during pathfinding 2014-06-26 17:16:33 -07:00
Tom Ritchford
feab6c39b3 New types Account, Currency, Directory:
* New tagged uint types.
* Extract to_string functions from header to hide dependencies.
* Include what you use and C++11 for cleanups.
2014-06-26 17:16:30 -07:00
Nik Bougalis
e999c76882 Autobridging:
* Remove legacy OfferCreate transactor
* Misc. cleanups on LedgerEntrySet
* Fix a subtle bug with arithmetic operations on Quality
* Sanity check offers after taking
2014-06-26 12:03:52 -07:00
Miguel Portilla
0a93f8db22 Add ASIO strand to StatsDCollector 2014-06-26 12:03:51 -07:00
Miguel Portilla
686cc599a2 Add ASIO strand to StatsDCollector 2014-06-26 12:03:51 -07:00
Vinnie Falco
875f4c87ff Fix bug in VSProject when no LIBPATH in env 2014-06-26 12:03:51 -07:00
Vinnie Falco
92983556a0 Fix bug in VSProject when no LIBPATH in env 2014-06-26 12:03:51 -07:00
Scott Schurr
837872c3f3 Move static treeNodeCache from SHAMap to the Application
These changes address two JIRA issues:

 - 291 unittest reported leaked objects
 - 292 SHAMap::treeNodeCache should be a dependency injection

The treeNodeCache was a static member of SHAMap.  It's now a
non-static member of the Application accessed through
getTreeNodeCache().  That addressed JIRA 291

The SHAMap constructors were adjusted so the treeNodeCache is
passed in to the constructor.  That addresses JIRA 292,  It required
that any code constructing a SHAMap needed to be edited to pass
the new parameter to the constructed SHAMap.

In the mean time, SHAMap was examined for dead/unused code and
interfaces that could be made private.  Dead and unused interfaces
were removed and methods that could be private were made private.
2014-06-26 11:10:51 -07:00
Tom Ritchford
55222dc5d1 New types Account, Currency, Directory:
* New tagged uint types.
* Extract to_string functions from header to hide dependencies.
* Include what you use and C++11 for cleanups.
2014-06-24 11:11:25 -07:00
Howard Hinnant
7b4c705a3f Improve Journal logging framework:
* Allow partition log levels to be adjusted
* Cleanups
2014-06-23 20:19:53 -07:00
David Schwartz
adce6ae851 Ledger loading cleanups:
* Fix close time settings for ledger load
* More info in ledger_request and inbound ledger JSON replies
2014-06-23 20:19:53 -07:00
Howard Hinnant
9dc32cb791 SHAMap refactoring:
* Rename SHAMapNode to SHAMapNodeID.
* Cleanups
2014-06-23 20:19:53 -07:00
Howard Hinnant
23dc08c925 Improve Journal logging framework:
* Allow partition log levels to be adjusted
* Cleanups
2014-06-23 20:19:53 -07:00
Vinnie Falco
b11e857148 Fix case-sensitivity for NOLOGO in booltable 2014-06-18 17:04:31 -07:00
Vinnie Falco
488a44b88e Fix case-sensitivity for NOLOGO in booltable 2014-06-18 17:04:31 -07:00
evhub
530bdf975e Fix VSProject generation issues with SConstruct:
* Always describe the Visual Studio targets
* Prevent checking nonexistant enviro vars
* Prevent pkg-config protobuf env vars if not clang/gcc
* Don't use any pkg-config enviro vars unless clang/gcc
* Make all VSProject/config directories windows-style
* Prevent beastobjc.mm from showing up in vcxproj
* Remove duplicate \src\protobuf\src
* Consistent quoting
2014-06-18 16:41:34 -07:00
evhub
0568a40d8d Fixes to VSProject generator:
* Canonical sorting for all platforms
* Fix incorrect path separator
* Filter predefined duplicate environment switches
2014-06-18 16:38:26 -07:00
evhub
d7a6627a1f Fixes to VSProject generator:
* Canonical sorting for all platforms
* Fix incorrect path separator
* Filter predefined duplicate environment switches
2014-06-18 16:38:26 -07:00
Vinnie Falco
d6066183b9 Refactor Overlay for Structured Network support:
* Move overlay up one directory
* Add abstract_protocol_handler, message_stream
* Add peer_protocol_detector
* Tidy up some declarations
* Use strand::running_in_this_thread instead of bool
* Update README.md
* Replace protocol message read loop:
  - Process data in arbitrary size chunks
  - message_stream extracts individual messages
  - peer_protocol_detector identifies the handshake
  - abstract_protocol_handler used for dispatching messages
* Remove unused protocol message types:
  - mtACCOUNT
  - mtCONTACT
  - mtERROR
  - mtGET_ACCOUNT
  - mtGET_CONTACTS
  - mtGET_VALIDATIONS
  - mtSEARCH_TRANSACTION
  - mtUNUSED_FIELD

Conflicts:
	src/ripple/module/app/main/Application.cpp
	src/ripple/module/app/misc/NetworkOPs.cpp
	src/ripple/module/app/peers/PeerSet.cpp
2014-06-18 15:17:18 -07:00
Vinnie Falco
94dea7c06f Add missing beast includes 2014-06-18 14:07:18 -07:00
Vinnie Falco
3e2c3ba035 Add missing beast includes 2014-06-18 14:07:18 -07:00
Tom Ritchford
e24cba8c35 Better types and more comments in RippleCalc.
* Better automatic conversions to and from tagged uint160 varints.
* Start using tagged variants of uint160 for Currency, Account.
* Comments from 2014/6/11 RippleCalc session.
2014-06-18 12:38:06 -07:00
Tom Ritchford
a23013abc1 Tidy up rpc module:
* Move directory up to ripple/module/rpc
* Use C++11 idioms and best practices
2014-06-18 12:37:53 -07:00
evhub
8cd2ba48fc Process switches with regex in VSProject generator:
* Handles "DisableSpecificWarnings" switches
2014-06-16 19:01:28 -07:00
evhub
27a4f44de5 Process switches with regex in VSProject generator:
* Handles "DisableSpecificWarnings" switches
2014-06-16 19:01:28 -07:00
Vinnie Falco
4e07dbbefc Fix state check in PeerImp::recvHello 2014-06-16 18:14:25 -07:00
David Schwartz
dcf4ad2c21 Ledger load and ledger replay fixes:
* Stash the loaded ledger where consensus can find it.
 * When loading a ledger for startup, try the backend too
 * Apply replay transactions to a mutable snapshot
2014-06-16 17:29:11 -07:00
Nik Bougalis
04dd861fe3 Cleanup:
* Remove is_bit_set and use regular bitwise operations instead.
* Remove the function-like macro "nothing".
2014-06-16 17:29:11 -07:00
Vinnie Falco
c8ee6c6f6d Use std::thread instead of boost::thread 2014-06-16 16:18:10 -07:00
Vinnie Falco
9d819b95bf Fix MSVC workaround in basic_seconds_clock 2014-06-16 16:18:09 -07:00
Vinnie Falco
a57e4263d7 Fix MSVC workaround in basic_seconds_clock 2014-06-16 16:18:09 -07:00
Vinnie Falco
d26dadd9d8 Add static_initializer 2014-06-16 16:18:09 -07:00
Vinnie Falco
3d58f0d941 Add static_initializer 2014-06-16 16:18:09 -07:00
Vinnie Falco
a52c9232c4 Tidy up basics module:
* Move directory up
* Remove unity includes and "include what you use"
2014-06-15 18:51:05 -07:00
Vinnie Falco
55ca9fb090 Remove ScopedPointer, ContainerDeletePolicy 2014-06-15 18:35:12 -07:00
Vinnie Falco
7a059c7a73 Remove ScopedPointer, ContainerDeletePolicy 2014-06-15 18:35:12 -07:00
Vinnie Falco
58ec5d5afe Tidy up includes:
* Replace boost with std equivalents:
  - bind, ref, cref, function, placeholders
* More "include what you use"
* Remove unnecessary includes
2014-06-15 18:26:50 -07:00
Vinnie Falco
506910147f Tidy up includes:
* Replace boost with std equivalents:
  - bind, ref, cref, function, placeholders
* More "include what you use"
* Remove unnecessary includes
2014-06-15 18:26:50 -07:00
Vinnie Falco
cf3eb24eb0 Move nodestore to its own module 2014-06-15 12:50:44 -07:00
Vinnie Falco
c00a976ff6 Add missing beast includes 2014-06-15 12:37:52 -07:00
Vinnie Falco
d965b23b2a Add missing beast includes 2014-06-15 12:37:52 -07:00
Vinnie Falco
f660743065 Remove unused SHAMap::getItem 2014-06-13 14:00:17 -07:00
David Schwartz
4559bd9030 Improve the way we declare a close time consensus 2014-06-12 10:20:48 -07:00
David Schwartz
3ac98fb101 SyncUnorderedMap cleanup 2014-06-12 10:14:47 -07:00
David Schwartz
aff52db289 Re-use the serializer 2014-06-12 10:14:47 -07:00
David Schwartz
ea27dfe08d Find 'sbfd' paths. 2014-06-12 09:41:52 -07:00
Tom Ritchford
27620af1bf Further cleanups of RippleCalc.
* Rename many variables.
* Make most of PathState private.
* Extract out common Node::isAccount() code.
* Rename bConsumed to allLiquidityConsumed_.
* Extract out code into PathState::clear().
2014-06-09 12:57:26 -07:00
Tom Ritchford
bf116308d4 Add newer validators to validators-example.txt 2014-06-09 12:41:27 -07:00
Tom Ritchford
3fb27d98ab Clean up LookupLedger and resolve issue 278.
* Use beast::zero to resolve issue 278.
* Rename variables and simplify logic.
* Restrict to 80 columns.
2014-06-09 12:40:38 -07:00
Tom Ritchford
7e45c17730 Rename ledger_get to ledger_request. 2014-06-09 12:37:24 -07:00
Tom Ritchford
626533d4a7 Clean up RPC messages from Main 2014-06-09 12:37:23 -07:00
Tom Ritchford
39719f4c17 Rearrange branch in accordance with new practices. 2014-06-09 12:37:23 -07:00
JoelKatz
526bd88dc4 Add ledger_get RPC command to fetch a ledger from the network
Conflicts:
	Builds/VisualStudio2013/RippleD.vcxproj
	Builds/VisualStudio2013/RippleD.vcxproj.filters
	Builds/VisualStudio2013/RippleD2.vcxproj
	Builds/VisualStudio2013/RippleD2.vcxproj.filters
	src/ripple_rpc/impl/Handlers.cpp
2014-06-09 12:37:22 -07:00
Vinnie Falco
37201ecaa6 Include BeastConfig.h from the root include path 2014-06-09 12:35:16 -07:00
Vinnie Falco
02ed879837 Update VS project file 2014-06-06 07:39:55 -07:00
Vinnie Falco
8b881d3a77 Add CBase58Data::hash_append 2014-06-05 20:00:24 -07:00
Miguel Portilla
97a1af43ed Fix VSProject.py extra dot 2014-06-05 17:47:46 -07:00
Miguel Portilla
f25456ce25 Fix VSProject.py extra dot 2014-06-05 17:47:46 -07:00
mDuo13
dfb1db4ab3 Return correct error for missing pathfinding request. Fixes RIPD-293 2014-06-05 17:47:28 -07:00
Vinnie Falco
4362cb660b Replace boost::shared_ptr with std::shared_ptr 2014-06-05 13:04:23 -07:00
Vinnie Falco
1aa0749ba8 Update rocksdb unity build 2014-06-04 17:20:43 -07:00
Vinnie Falco
c7f1f6a91f RocksDB changes to support unity build:
* Remove extra definition of TotalFileSize
* Remove extra definition of ClipToRange
* Move EncodedFileMetaData out from anonymous namespace
* Move version_set Saver to its own namespace
* Move some symbols into a named namespace
* Move symbols out of anonymous namespace (prevents warning)
* Make BloomHash inline
2014-06-04 17:15:28 -07:00
Vinnie Falco
888a3fec21 Merge commit '8514b88974c71c0fa85bb154507536ee49c33458' as 'src/rocksdb' 2014-06-04 16:10:38 -07:00
Vinnie Falco
8514b88974 Squashed 'src/rocksdb/' content from commit 457bae6
git-subtree-dir: src/rocksdb
git-subtree-split: 457bae6911
2014-06-04 16:10:38 -07:00
Vinnie Falco
724ec46129 Use per-file include directories for external code subtrees:
* leveldb, hyperleveldb, rocksdb, snappy
* SConstruct OSX fix regarding OpenSSL version check
2014-06-04 13:28:43 -07:00
Vinnie Falco
558b914c64 Reorganize source file hierarchy:
* Rename unity files
* Move some modules to new subdirectories
* Remove obsolete Visual Studio project files
* Remove obsolete coding style and TODO list
2014-06-03 21:43:59 -07:00
Vinnie Falco
4f1d1d2a8a Reorganize source file hierarchy:
* Rename unity files
* Move some modules to new subdirectories
* Remove obsolete Visual Studio project files
* Remove obsolete coding style and TODO list
2014-06-03 21:43:59 -07:00
Tom Ritchford
dda5fd7390 Check for openSSL version in SConstruct.
* Uses the platform specific openssl binary to detect the current version.
2014-06-02 10:56:21 -07:00
Tom Ritchford
39a387b54c Check for openSSL version in SConstruct.
* Uses the platform specific openssl binary to detect the current version.
2014-06-02 10:56:21 -07:00
Roberto Catini
2b0034667d Add Dockerfile:
* The ports are not automatically exposed.
* No test is performed after the build.
2014-06-02 10:27:09 -07:00
Tom Ritchford
98202c56ae base_uint now compares and assigns with beast::Zero.
Conflicts:
	src/ripple/types/api/base_uint.h
	src/ripple_basics/ripple_basics.h
2014-06-02 10:15:45 -07:00
Vinnie Falco
1e06ddf13c Refactor MultiSocket:
* Variadic constructor argument list
* Tidy up sources and filenames
2014-06-02 10:07:05 -07:00
Vinnie Falco
ce8f56727e Make all include paths relative to a root directory:
* Better include path support in the VSProject scons tool.
* Various manual fixes to include paths.
2014-06-02 09:16:28 -07:00
Vinnie Falco
560071bb68 Make all include paths relative to a root directory:
* Better include path support in the VSProject scons tool.
* Various manual fixes to include paths.
2014-06-02 09:16:28 -07:00
Nik Bougalis
2e49ec47a3 Revert "Ste version to 0.25.2-rc1"
This reverts commit 3f10924594.
2014-06-01 16:32:41 -07:00
Mark Travis
e70d618aff Set version to 0.25.2-rc1 2014-06-01 22:51:13 +00:00
Mark Travis
3e4cf426bd Detect paths with illegal bridging offers 2014-06-01 22:45:55 +00:00
Mark Travis
3f10924594 Ste version to 0.25.2-rc1 2014-06-01 22:35:12 +00:00
Mark Travis
f8182c335a Detect paths with illegal bridging offers 2014-06-01 01:26:11 +00:00
Vinnie Falco
1d8d6a6d68 Revert "Improve checking of library versions."
This reverts commit 69fccdf5c6.
2014-05-28 19:04:37 -07:00
Tom Ritchford
69fccdf5c6 Improve checking of library versions.
* Correctly handle openSSL version checking on Ubuntu, Debian, OS/X.
* Also check versions of openSSL, Boost, GCC and MSVC at C++ compile time.
* Get rid of over-engineered runtime CheckLibraryVersions.
2014-05-28 17:07:35 -07:00
Nik Bougalis
27e8d44a56 Autobridging:
Complete implementation of bridged offers crossings. While processing an offer
A:B we consider both the A:B order book and the combined A:XRP and XRP:B books
and pick the better offers. The net result is better liquidity and potentially
better rates.

* Rearchitect core::Taker to perform direct and bridged crossings.
* Compute bridged qualities.
* Implement a new Bridged OfferCreate transactor.
* Factor out common code from the Bridged and Direct OfferCreate transactors.
* Perform flow calculations without losing accuracy.
* Rename all transactors.
* Cleanups.
2014-05-28 16:35:03 -07:00
Vinnie Falco
d9755d33d0 Fix VSProject generator item sort 2014-05-28 16:35:02 -07:00
Vinnie Falco
72bc4ebf37 Fix VSProject generator item sort 2014-05-28 16:35:02 -07:00
Tom Ritchford
48d4fccc22 Fix a few warnings 2014-05-28 09:28:50 -07:00
Tom Ritchford
353f32e6af Fix a few warnings 2014-05-28 09:28:50 -07:00
Howard Hinnant
9bbaa9a2ae Report whether a ledger is validated:
This addresses https://ripplelabs.atlassian.net/browse/RIPD-275
Use Json::StaticString to improve performance.
Use inject_error instead of manually adding errors.
2014-05-28 09:27:22 -07:00
Nicholas Dudfield
096fcefae9 Fix clang/travis, prefer static libs when BOOST_ROOT is set. 2014-05-28 08:32:11 -07:00
Vinnie Falco
bfa8dec6f6 New http::client_session for making requests:
- Add 10,000 popular URL data set for unit tests
2014-05-28 08:31:45 -07:00
Vinnie Falco
0f1e292e34 New http::client_session for making requests:
- Add 10,000 popular URL data set for unit tests
2014-05-28 08:31:45 -07:00
Vinnie Falco
6e8230e1fb Add ci_char_traits 2014-05-28 07:30:02 -07:00
Vinnie Falco
195957a7cc Add ci_char_traits 2014-05-28 07:30:02 -07:00
Vinnie Falco
587a379b43 Tidy up includes 2014-05-28 07:29:59 -07:00
Vinnie Falco
eb122f45f9 Tidy up includes 2014-05-28 07:29:59 -07:00
Vinnie Falco
93021a054b Improved SConstruct:
* Automatic source list built via directory iteration
* Build multiple toolchains and flavors simulaneously:
    - Toolchains: gcc, clang, msvc
    - Flavors: debug, release
* Documentation on aliases (top of the SConstruct file)
2014-05-27 15:23:50 -07:00
Vinnie Falco
c51ac9d6da Fix rocksdb relative include 2014-05-27 15:23:50 -07:00
Vinnie Falco
97c9d02c43 Improved SConstruct:
* Automatic source list built via directory iteration
* Build multiple toolchains and flavors simulaneously:
    - Toolchains: gcc, clang, msvc
    - Flavors: debug, release
* Documentation on aliases (top of the SConstruct file)
2014-05-27 15:23:50 -07:00
Vinnie Falco
bf4dd0cbde Beast SCons tools:
* Add VSProject SCons Builder
* Add Protoc SCons Builder
* Add Beast build utilities python module
2014-05-27 15:23:49 -07:00
Vinnie Falco
0c06939f38 Beast SCons tools:
* Add VSProject SCons Builder
* Add Protoc SCons Builder
* Add Beast build utilities python module
2014-05-27 15:23:49 -07:00
Vinnie Falco
4ccc380a7b Tidy up some source filenames:
* Add .unity suffix to mark unity sources
* Fix some relative include paths
2014-05-27 15:23:48 -07:00
Vinnie Falco
5db677d74d Tidy up some source filenames:
* Add .unity suffix to mark unity sources
* Fix some relative include paths
2014-05-27 15:23:48 -07:00
Nik Bougalis
251ce4efbc base_uint cleanups:
* Remove unused and broken reverse iterators
* Use charUnHex to reduce code duplication
2014-05-27 09:26:18 -07:00
Nik Bougalis
9efac86bb7 Convert a unit test to manual 2014-05-26 15:29:48 -07:00
Nik Bougalis
386eabb61f Convert a unit test to manual 2014-05-26 15:29:48 -07:00
Nik Bougalis
b35eabe161 Optimize SQL query composition 2014-05-26 15:29:48 -07:00
Tom Swirly
9ad9845d69 Initialize unassigned variable bConsumed.
* Assigned in the code, but only to false.
* Someday will get assigned to true.
2014-05-23 12:16:24 -07:00
Tom Swirly
74eb25f9b5 RippleCalc: Stop using reference that might have been invalidated. 2014-05-23 12:16:22 -07:00
Nik Bougalis
044f390fe0 Properly standardize RFC1751 inputs 2014-05-23 11:06:43 -07:00
Miguel Portilla
06d6e4901e Complete NodeStore documentation
* Complete README.md
* Add missing doxygen
* Fix getHitRate bug
2014-05-19 10:53:40 -07:00
Tom Swirly
3ca9646329 Refactor the structure of RippleCalc
* Split code into multiple files
* Rename and move things
2014-05-19 10:53:40 -07:00
Tom Ritchford
4b3e629dfd Allow ledgers to be loaded from the command line.
Conflicts:

	src/ripple_data/protocol/BuildInfo.cpp
2014-05-19 10:53:39 -07:00
Tom Swirly
568fae9878 Add documentation comments 2014-05-19 10:53:39 -07:00
Tom Swirly
a844026f6b Clean up pre C++1 idioms:
* Use auto for in some loops
* Fix shadowing iterator declaration
* Rename NUMBER to ARRAYSIZE.
* Use placeholders instead of macros
* Replace macro BIND_TYPE with std::bind
* Replace BOOST_FOREACH with range-for
2014-05-19 10:53:38 -07:00
Vinnie Falco
b677cacb8c Set version to 0.25.1 2014-05-15 11:13:54 -07:00
Nik Bougalis
1d66169ef1 Fix rippled-example.cfg to list 'peers_max' 2014-05-15 11:11:16 -07:00
Vinnie Falco
8be17cd60d Use std::string in lexicalCast 2014-05-15 11:11:15 -07:00
Vinnie Falco
74653e57e6 Use std::string in lexicalCast 2014-05-15 11:11:15 -07:00
Vinnie Falco
29d1d5f062 Set version to 0.25.0 2014-05-14 09:01:44 -07:00
Vinnie Falco
d8e8693d9a Update rippled-example.cfg 2014-05-13 20:43:39 -07:00
Miguel Portilla
be737e0047 Enable Snappy compression for NodeStore backends.
* Configured via config.cfg
2014-05-13 12:21:01 -07:00
Vinnie Falco
83ef06748d Add snappy compression integration 2014-05-13 12:16:39 -07:00
Vinnie Falco
5a93f9991a Merge commit '8b0602a5824199d495f6720ef2447f695179257a' as 'src/snappy/snappy' 2014-05-13 12:16:31 -07:00
Vinnie Falco
8b0602a582 Squashed 'src/snappy/snappy/' content from commit 1ff9be9
git-subtree-dir: src/snappy/snappy
git-subtree-split: 1ff9be9b8fafc8528ca9e055646f5932aa5db9c4
2014-05-13 12:16:31 -07:00
Vinnie Falco
eb24ca6def Update .gitattributes 2014-05-13 12:15:59 -07:00
Nik Bougalis
22af79606a Fix lexicographical compare during tfRequireAuth processing 2014-05-13 12:10:39 -07:00
Nik Bougalis
bee12fb89d Autobridging future support:
* Refactor and cleanup transactors
* Introduce new direct and bridged transactors
* Rename existing transactor to indicate legacy status
* New direct transactor defaults to being turned off (preserve legacy behavior)
2014-05-13 12:09:47 -07:00
Nik Bougalis
1a9fbab165 CBase58Data Refactoring:
* Remove unnecessary functions.
* Load from a base_uint const& - don't use void pointers.
* Free comparison functions.
* Explicitly specify encoding alphabet.
* Miscellaneous cleanups.
2014-05-13 08:48:53 -07:00
David Schwartz
9a4b9aa69f Remove redundant checkAccept call 2014-05-13 08:48:52 -07:00
David Schwartz
227043e51f Make I/O latency available through server_info 2014-05-13 08:48:51 -07:00
JoelKatz
db3a387224 Fetch pack cleanups:
* Limit backed up fetch pack requests
* Cleanups
* Dispatch fetch packs sooner
2014-05-13 08:48:50 -07:00
David Schwartz
0075f36bbc At level 64, only leaves are allowed 2014-05-13 08:48:49 -07:00
David Schwartz
52f45669d1 Dispatch incoming TX set data 2014-05-13 08:48:48 -07:00
JoelKatz
294a13d653 Put newly-created nodes in the treeNodeCache 2014-05-13 08:48:48 -07:00
JoelKatz
eed66894db SHAMap::canonicalize must return a node with the correct ID 2014-05-13 08:48:47 -07:00
Vinnie Falco
caf5f7579e Fix vs2013 availability of make_reverse_iterator 2014-05-13 08:38:02 -07:00
Vinnie Falco
1434695c47 Fix vs2013 availability of make_reverse_iterator 2014-05-13 08:38:02 -07:00
Tom Swirly
390ea65e15 Refactor RippleCalc.cpp:
* Add comments
* Restrict code to 80 colums
* Remove boost::format
* Remove BOOST_FOREACH
* Make members private
* Add ripple_unordered_set to UnorderedContainers.h
* Replace boost::unordered_set with ripple::unordered_set
2014-05-09 12:03:57 -07:00
David Schwartz
6f2bcc6fb0 Keep SHAMapNodes that fault in handling client requests. 2014-05-09 11:46:24 -07:00
David Schwartz
66a762d504 Rework handling of modified ledger nodes:
* Track dirty nodes in a set
* Make flushDirty a member function
* Don't write deleted nodes
* Make sure new nodes are shareable
* Put new nodes in the treeNodeCache
2014-05-09 11:46:15 -07:00
David Schwartz
aaabec0b55 Use last closed ledger for old pathfinding 2014-05-09 11:46:05 -07:00
Nik Bougalis
6339800946 Refactor base_uint<> and STAmount::getText:
base_uint<>:
* Remove unnecessary typedefs and derived classes
* Factor out common code and eliminate redundancies
* Add tag support to improve type safety
* base_uint::ToString() -> to_string(base_uint const&)
* base_uint::GetHex() -> to_string(base_uint const&)

STAmount::getText:
* Don't overallocate
* Eliminate unnecessary copying
2014-05-09 11:45:44 -07:00
Nik Bougalis
191f4496a7 Implement C++14 std::make_reverse_iterator 2014-05-09 11:45:10 -07:00
Nik Bougalis
a3e4a34021 Implement C++14 std::make_reverse_iterator 2014-05-09 11:45:10 -07:00
David Schwartz
6fcf3fedb6 Use Json::StaticString to improve performance:
* Move JSON-RPC fields to jsonrpc_fields.h
2014-05-07 13:04:35 -07:00
David Schwartz
34cbb26e47 Improved performance monitoring of NodeStore backends:
* Add multi-sample interface to LoadMonitor
* Instrument fetch operations and completions for reporting in server_info
2014-05-05 14:17:23 -07:00
David Schwartz
07d0379edd Reduce number of async fetches 2014-05-05 14:17:23 -07:00
Tom Swirly
96e8cddfc2 New strConcat concatenates strings in O(n) time.
* Accepts std::string and char const*.
* Also accepts numbers, bools and chars.
* New ripple::toString function augments std::to_string to handle
  bools and chars.
2014-05-05 14:17:23 -07:00
Tom Swirly
3c5e4e440b Clean up of TransactionSign and friends. 2014-05-05 14:17:22 -07:00
Tom Swirly
5ffcbb9b65 Add documentation to SHAMap 2014-05-05 14:17:21 -07:00
Nik Bougalis
ec0fe312af Simplify and improve performance of STAmount::createHumanCurrency 2014-05-05 14:17:21 -07:00
Miguel Portilla
3025d8611b Rename Feature to Amendment:
* Added a README.md describing an Amendment
2014-05-05 13:50:00 -07:00
Miguel Portilla
98612a7cd6 Cleanup nodestore backend classes:
* Add README.md
* Add missing std::move calls
* Refactor visitAll in backend
2014-05-05 13:50:00 -07:00
MarkusTeufelberger
6e428054ef Update RPM spec file to version 0.24.0 2014-05-05 13:49:59 -07:00
Vinnie Falco
3eb1c7bd6f Set version to 0.24.0 2014-05-05 10:20:46 -07:00
Vinnie Falco
2ed2158309 Set version to 0.24.0-rc2 2014-05-02 13:01:17 -07:00
JoelKatz
112d383698 Pathfinding dispatch improvements
* Simplify decision whether to update a path
* Prevent pathfinding threads from blocking each other
2014-05-02 13:01:17 -07:00
Vinnie Falco
11d0c89a59 Set version to 0.24.0-rc1 2014-05-01 16:14:20 -07:00
JoelKatz
7cffd0e0f5 Add comments to LedgerHistory 2014-05-01 16:14:14 -07:00
JoelKatz
d1f5006e44 Validation timing fixes:
* Log whether consensus built a ledger we already had or were acquiring
* Don't trigger an acquire for a validation for a ledger we might be building
* When we finish building a ledger, try to accept that ledger
* If we cannot accept a built ledger, check held validations
* Correctly set isCurrent for untrusted validations
* Add appropriate logging

This fixes a race condition that could cause spurious and expensive
ledger fetches across the network and delayed recognition of
fully-validated ledger.
2014-05-01 16:14:09 -07:00
Vinnie Falco
df3f5e442d Fix VS2013 warnings about integer conversions 2014-04-17 13:06:06 -07:00
Howard Hinnant
fdfcebd1cb Refactoring of container usage:
* New ripple container aliases use hardened_hash
* Use std::tuple instead of boost::tuple
* Use std unordered containers instead of boost
* Fix Destroyer for new containers
* Fix warning for fnv1a on 32-bit arch
* Validator fixes for new containers
2014-04-16 19:00:13 -07:00
Tom Swirly
8f5b4a6c96 Add CleanCCPFiles.py, a utility for tidying up whitespace 2014-04-15 11:52:02 -07:00
Nik Bougalis
a45b532664 Add beast::tagged_integer:
* Wraps standard integer types to provide type-safety
 * Named types provide self-documenting semantics
 * Catches programmer errors involving mismatched types at compile time
 * Operators restrict mutation to only safe and meaningful operations
2014-04-15 11:48:35 -07:00
Vinnie Falco
c0dfbdc910 Fix Visual Studio 2013 build 2014-04-15 08:13:53 -07:00
Tom Swirly
a4ef993282 New Zero struct implements "compare with zero."
* Zero lets classes efficiently compare with 0, so
  you can use constructors like x < zero or y != zero.
* New BEAST_CONSTEXPR to handle Windows/C++11 differences
  regarding the constexpr specifier.
2014-04-14 11:14:11 -07:00
Tom Ritchford
6b0cec1189 Improvements to scons build for beast.
* Common code extracted to Python directories.
* Read ~/.scons file for scons environment defaults.
* Override scons settings with shell environment variables.
* New "tags" for debug, nodebug, optimize, nooptimize builds.
* Universal platform detection.
* Default value of environment variables set through prefix dictionaries.
* Check for correct Boost value and fail otherwise.
* Extract git describe --tags into a preprocesor variable, -DTIP_BRANCH
* More colors - blue for unchanged defaults, green for changed defaults, red for error.
* Contain unit tests for non-obvious stuff.
* Check to see that boost libraries have been built.
* Right now, we accept both .dylib and .a versions but it'd be easy to enforce .a only.
2014-04-11 10:40:26 -07:00
Howard Hinnant
4a3176e3a0 Force BOOST_ASIO_HAS_STD_ARRAY to 1
for the clang / gcc libstdc++ 4.8 combination
2014-04-03 14:58:28 -04:00
Howard Hinnant
fd9206584f Sub in std::array for boost::array and beast::FixedArray 2014-04-03 14:02:34 -04:00
Howard Hinnant
2ab7cfbf30 New hash_append robust container hash function framework:
* is_contiguous_hashable trait identifies optimizable types
* hash_append() function overloads for basic types:
  - scalars, floats
  - array, C array
  - pair, tuple
  - boost array and tuple (if configured)
* Provided Spooky hash wrapper for use with hash_append
* Use hash_append in hardened_hash and other places
* New Utility meta functions for working with variadics:
  - static_and
  - static_sum
* Added type_name utility function for diagnostics
* hash_metrics suite of functions to evalulate hash functions
* Test suites to measure hash function performance
* Various fixes
2014-03-31 15:49:23 -07:00
Vinnie Falco
6b467e7e59 Move hardened_hash to container/ 2014-03-25 15:22:34 -07:00
Vinnie Falco
d64f5a387c Add beast SConstruct and .travis.yml 2014-03-25 15:22:34 -07:00
Nik Bougalis
cc6cd0bb8f Transactor journal support and small cleanups 2014-03-25 15:22:13 -07:00
Vinnie Falco
3fbff6e620 beast cleanup and tidying:
* Replace custom types with C++11 <cstdint> types
* Fix sqlite integer intos and uses
* Fix String implicit integer constructors
* Escape the enclosing namespace in sqdb
* Replace contract checks with assert
* Make many header files compile independently
* Remove the dependence on beast_core.h in many places
* Remove unused or obsolete classes and functions
* Remove unused or obsolete macros
* Remove unused network functions and files
* Remove unused or obsolete classes:
  - ChildProcess
  - HighResolutionTimer
  - InterProcessLock
  - Throw
  - TrackedMutex
  - UntrackedMutex
  - XmlDocument
  - XmlElement
2014-03-23 15:23:55 -07:00
Vinnie Falco
5eb0aa2765 Add hardened_hash, prevents adversarial inputs 2014-03-22 18:42:18 -07:00
Vinnie Falco
f63cf33118 New unit_test framework:
* Header-only!
* No external dependencies or other beast modules
* Compilation options allow for:
  - Stand-alone application to run a single test suite
  - Stand-alone application to run a set of test suites
  - Global suite of tests inline with the host application
  - Disable test suite generation completely
* Existing tests reworked to use the new classes
2014-03-21 18:00:37 -07:00
Vinnie Falco
0bb6171a85 beast.streams improvements:
* New basic_std_ostream wraps any std::stream.
* New debug_ostream redirects output to debugger if attached.
2014-03-21 07:33:16 -07:00
Vinnie Falco
e92dd73169 Add const_container 2014-03-21 07:33:16 -07:00
Vinnie Falco
2d490f6e6a beast cleaning and tidying:
* Consolidate small modules into one
* Remove Android-specific platform support
* Remove Chrono.h from beast_core.h
* Removed files:
  - TypeTraits.h
  - Utility.h
  - Net.h
  - Asio.h
* Remove zlib support:
  - Remove inline zlib library sources
  - Remove GZIPCompressorOutputStream
  - Remove GZIPDecompressorInputStream
* Remove obsolete or unused classes:
  - AbstractObject
  - BigInteger
  - BufferedInputStream
  - CacheLine
  - CPUMeter
  - DatagramSocket
  - DynamicObject
  - FileLogger
  - FPUFlags
  - Identifier
  - JSON
  - LocalisedStrings
  - MACAddress
  - MemoryAlignment
  - MemoryInputStream
  - MemoryMappedFile
  - NamedValueSet
  - OptionalScopedPointer
  - PerformanceCounter
  - PropertySet
  - ScopedTimeInterval
  - SparseSet
  - SpinDelay
  - StreamingSocket
  - StringPool
  - SubregionStream
  - Uuid
  - Variant
2014-03-21 07:30:50 -07:00
Vinnie Falco
761affacc3 Update to SQLite 3.8.4.1 2014-03-20 19:17:25 -07:00
Howard Hinnant
979c834ee0 Fix and add tests for empty_base_optimization. 2014-03-20 13:47:48 -07:00
Vinnie Falco
aff0ec18b0 Fix error code assignment in raw_parser 2014-03-20 10:43:01 -07:00
Vinnie Falco
d32b91e0de Add abstract streams module:
* New basic_abstract_ostream template for generic output
* New abstract_ostream, common type alias
* basic_scoped_ostream, RAII output to abstract streams
2014-03-19 15:42:20 -07:00
Vinnie Falco
8b659a6d32 Add workaround/noexcept.h for visual studio 2014-03-19 13:42:05 -07:00
Vinnie Falco
18486169b3 Change to the treatment of BeastConfig.h
* No longer requires its own compiler include path
* Includes use relative paths to locate the file
* Client applications include the file themselves
* Inclusion of BeastConfig.h can be controlled via preprocessor directive
2014-03-19 13:42:04 -07:00
Howard Hinnant
d580e7c694 General tidy and refactoring:
* Use nullptr (C++11) instead of NULL.
* Put each file into its own namespace declaration.
* Remove "using namespace" directives and add scope qualifiers.
* Control when beast's implementation of std::equal (C++14) is used.
* Tidy up some const declarations.

Conflicts:
	src/ripple_app/shamap/SHAMapSync.cpp
	src/ripple_app/tx/TransactionEngine.cpp
2014-03-19 13:42:01 -07:00
Vinnie Falco
78ec5ccdbc Restructure joyent message parser (from Node.js):
* New http::raw_parser wrapper
* Convert parser errors to error_code
* Enumeration and strings for parsed HTTP method
* Move parser engine into joyent namespace
* Rename includes to be distinct
2014-03-19 10:41:24 -07:00
Vinnie Falco
d4a5c0353d beast, beast::asio improvements and fixes:
* New maybe_const_t alias for maybe_const
* New asio::enable_wait_for_async for safe cleanup
* New asio::memory_buffer, a managed boost::asio compatible buffer
* shared_handler improvements:
   - Can be 'empty' (no stored handler).
   - Default constructible as 'empty'.
   - Safe evaluation in bool contexts, false==empty
* Fix is_call_possible metafunction:
   - Works on empty argument lists
   - Works with reference types
* Replace SafeBool idiom with C++11 explicit operator bool
* Move IPAddress function definitions to the header
* Move cyclic_iterator to container/
* Remove unused BufferType
* Remove obsolete classes:
   - NamedPipe
   - ReadWriteLock
   - ScopedReadLock
   - ScopedWriteLock
   - LockGuard
2014-03-17 17:40:55 -07:00
Vinnie Falco
6546c30e17 Refactor beast::asio:
* New tools for completion handlers:
  - wrap_handler provides composed io_service execution guarantees.
  - bind_handler rebinds arguments to handlers.
  - shared_handler type-erases any completion handler.
  - buffer_sequence type-erases templated BufferSequences
  - abstract_socket replaces Socket
  - socket_wrapper replaces SocketWrapper
  - beast::asio placeholders to work with std::bind

* Removed obsolete classes and functions
  - AbstractHandler
  - ComposedAsyncOperation
  - SharedFunction
  - SharedHandler
  - SharedHandlerAllocator
  - SharedHandlerPtr
  - SharedHandlerType
  - SocketBase
  - SocketWrapperStrand
  - wrapHandler

* Refactored classes to use new tools
  - abstract_socket
  - socket_wrapper
  - HandshakeDetector
  - HttpClientType

* Miscellanous tidying
  - socket classes moved to beast::asio namespace
  - beast asio files provide their own namespace declaration.
  - Fix IsCallPossible conflicting template parameter name
  - Use <boost/get_pointer.hpp> for C++11 compatibility.
  - Remove extraneous include path from build environment.
2014-03-14 08:03:48 -07:00
Vinnie Falco
5478c540cb Add std::integer_sequence C++14 compatibility 2014-03-14 07:57:20 -07:00
Vinnie Falco
b5d81f4f92 Add beast::buffer_view 2014-03-14 07:57:19 -07:00
Vinnie Falco
2a99a8350f Add C++11 noexcept compatibility for VS2013 2014-03-14 07:57:19 -07:00
JoelKatz
028935a254 Handle unexpected relative paths from __FILE__
Fixes comref#RIPD-133
2014-03-13 16:49:20 -07:00
Vinnie Falco
6df466c692 Update http code for http parser API changes 2014-03-06 21:44:29 -08:00
Vinnie Falco
956f2b98b8 Merge commit '6c0edd2190bfd18ffc523f486367da3724cf98a3' into develop 2014-03-06 21:22:22 -08:00
Howard Hinnant
4e3dcd1ce6 Fix beast::asio failures on OS X.
There are 38 unittest failures on OS X.  These changes address all of
them by adjusting which side of the socket (send or receive) gets
shut down.  In each case, the failure was 'Socket is not connected'.
I've interpreted that to mean that the other thread had already shut
down its side of the connection.
2014-03-04 15:43:33 -08:00
Vinnie Falco
a690690b53 Remove unused TextDiff 2014-03-04 07:23:53 -08:00
Vinnie Falco
b9d0bf8822 Consolidate C++14 compatibility into new headers 2014-03-03 18:51:56 -08:00
Howard Hinnant
bb02112752 Fix clang warnings 2014-02-28 12:15:12 -08:00
Vinnie Falco
8eddcfd3d5 Remove unused classes 2014-02-28 12:03:33 -08:00
Vinnie Falco
78e1995365 New utility classes, containers, C++14 compatibility, and fixes:
* Add std::equal_to <void> (since C++14)
* Add heterogeneous std::equal (since C++14)
* Add maybe_const
* Add empty_base_optimization
* Add is_constructible specialization for pair, tuple
* Add aged associative containers:
  - aged_set, aged_map, aged_multiset, aged_multimap
  - aged_unordered_set, aged_unordered_map,
  - aged_unordered_multiset, aged_unordered_multimap
* Fix auto keyword pass by reference
* Fix basic_seconds_clock warning and project file
2014-02-24 19:25:01 -08:00
Vinnie Falco
c48b9244f2 Remove deprecated IPAddress 2014-02-22 21:33:00 -08:00
Vinnie Falco
e219008320 Make abstract_clock members const 2014-02-14 11:14:09 -08:00
Vinnie Falco
f603ae175b Add chrono APIs to DeadlineTimer 2014-02-12 12:58:20 -08:00
Nicholas Dudfield
f62d034692 Fix clang compile error 2014-02-11 19:13:45 -08:00
Vinnie Falco
deb180cc83 Update beast project file 2014-02-10 19:48:37 -08:00
Vinnie Falco
17b970a387 Fix insight object lifetimes in Group 2014-02-08 10:48:54 -08:00
Vinnie Falco
d060eb498f Improved logging for insight stat packets 2014-02-08 09:33:04 -08:00
NATTSiM
c2bc7e2c30 Fix clang compile 2014-02-07 08:09:15 -08:00
Vinnie Falco
eb5691e8fa Change bassert to always call assert 2014-02-06 14:30:03 -08:00
Vinnie Falco
864b20565b Refactor IP::Endpoint 2014-02-05 15:53:16 -08:00
Vinnie Falco
3e6818b407 Remove obsolete Visual Studio projects 2014-02-05 15:42:28 -08:00
Vinnie Falco
aaced060bf Add basic_seconds_clock, insight::Groups 2014-02-03 22:55:47 -08:00
Vinnie Falco
af77ff3eed Update Visual Studio 2013 project file 2014-02-03 22:36:29 -08:00
Vinnie Falco
98162cec33 Update project build requirements
* Add Visual Studio 2013 project file
* Update SConstruct for boost 1.55.0
2014-02-03 16:58:32 -08:00
Vinnie Falco
048a2d7bc3 Fix PropertyStream overloads 2014-01-29 07:53:27 -08:00
Vinnie Falco
307ad244b0 Use duration in insight::Event, add chrono_util 2014-01-21 10:28:35 -05:00
Vinnie Falco
0c0fa877cf Add ScopedPointer::reset 2014-01-21 10:28:34 -05:00
Vinnie Falco
49bd8ac880 Tidy up for C++11, and fixes:
* Remove shared_ptr legacy support
* Add make_unique support for pre-C++14 environments
* Fix comparison bug in sqdb
* Use std::shared_ptr in a few places
2014-01-17 12:19:04 -05:00
Vinnie Falco
969ea98fd9 Add std::make_unique 2014-01-17 12:19:03 -05:00
NATTSiM
bd0f4b95ae Fix Clang compile and link errors 2014-01-16 17:18:05 -05:00
NATTSiM
dda419ddd6 Improved PropertyStream find and print routines 2014-01-13 21:51:31 -08:00
Vinnie Falco
1f9e2c920c Add io_latency_probe 2014-01-10 22:54:00 -08:00
Nik Bougalis
43f38a240e Don't log StatsD messages to the console by default 2014-01-08 16:57:47 -08:00
Vinnie Falco
705e629001 Add std::hash <std::pair> specialization 2014-01-07 21:14:13 -08:00
Vinnie Falco
edc60e2e01 Fix warning in chrono_io 2014-01-07 21:14:07 -08:00
Vinnie Falco
9f65b26288 Add abstract_clock, manual_clock, chrono_io
Conflicts:
	src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
2014-01-07 17:17:26 -08:00
Vinnie Falco
496b337b27 General refactoring, using C++11
* Remove broken RecycledObjectPool

* Fix beast::ServiceQueue using List instead of LockFreeStack

* Add class semaphore, fixes broken Semaphore

* Move crytpo module files to new beast directory

* Use c++11 replacements for boost and beast types:
  - std::atomic instead of beast::Atomic
  - std::function instead of boost::function, beast::function
  - std::unique_ptr instead of beast::ScopedPointer
  - std::shared_ptr instead of boost::shared_ptr

* Remove modules:
  - beast_db
  - beast_crypto
  - beast_extras

* Remove unnecessary classes:
  - AbstractFifo
  - AddConst
  - AtomicCounter
  - AtomicFlag
  - AtomicPointer
  - AtomicState
  - CopyConst
  - Expression
  - ForwardList
  - IfCond
  - Interval
  - IntrusiveArray
  - KeyvaDB
  - PointerToOther
  - PointerTraits
  - RemoveConst
  - RemoveConstVolatile
  - RemoveReference
  - RemoveVolatile
  - SharedObjectArray
  - SingleThreadedSharedObject
  - SophiaDB factory
  - SortedSet
  - WeakReference
  - beast::unique_ptr
2014-01-07 15:57:45 -08:00
Vinnie Falco
3a895ccfaa Reduce StatsDCollector log verbosity 2014-01-02 19:32:27 -08:00
NATTSiM
eb19343f91 Fix clang compile 2013-12-27 17:46:51 -08:00
Vinnie Falco
893b2d4587 Add AbstractObject, cyclic_iterator, Journal improvements 2013-12-27 16:47:43 -08:00
Nik Bougalis
370d98a858 Add reference counting to AsyncObject 2013-12-19 14:39:26 -08:00
Vinnie Falco
d11983ae32 Add Beast.Insight stats collection module 2013-12-16 12:22:25 -08:00
Vinnie Falco
42692abd1c Add stl module for c++11 compatibility classes 2013-12-16 11:35:21 -08:00
Vinnie Falco
d1335a6efd Make AbstractObject unit test manual 2013-12-06 09:57:03 -08:00
Vinnie Falco
61cfa6e37e Add double conversion for PropertyStream map items 2013-11-30 17:56:25 -08:00
Vinnie Falco
f7aa4f9593 Refactor some Journal::Sink members 2013-11-30 17:32:50 -08:00
Vinnie Falco
1dfd9e3c10 IPAddress fixes and algorithm comparison functors 2013-11-30 09:21:46 -08:00
Vinnie Falco
2f656e09c6 Refactor and fix some object arithmetic comparisons 2013-11-30 06:28:29 -08:00
Vinnie Falco
6c9d88bd6d Fix missing assert in UnitTest runner 2013-11-30 01:42:37 -08:00
Vinnie Falco
045e38314a Add AbstractObject 2013-11-30 01:42:37 -08:00
Vinnie Falco
d346e6645a Tidy doc comments 2013-11-29 23:44:36 -08:00
JoelKatz
760f51910f Add BEAST_SQLITE_FORCE_NDEBUG option 2013-11-26 21:56:17 -08:00
Vinnie Falco
9e5619ce99 Fix Workers thread name 2013-11-22 15:51:20 -08:00
Vinnie Falco
b38dd98e71 Journal API improvements 2013-11-15 12:30:01 -08:00
Vinnie Falco
71db1dfa06 Fix severity check on ~ScopedStream 2013-11-15 11:29:45 -08:00
Patrick Dehne
08aa415c66 Beast improvements and vflib compatibility module work
* Add CallQueue vflib compatibility class
* Use run instead of run_one
* Merge BindableServiceQueue into CallQueue
* Take BEAST_VARIADIC_MAX into account
* Fix license headers as suggested by Vinnie
* Remove obsolete comment
* Add ManualServiceQueue
* Add ManualServiceQueue to beast_vflib include
* Move static unit test variables of header only classes to module cpp
* Remove no longer used mutex member
* _VARIADIC_MAX maxes out at 10
* Correctly apply BEAST_VARIADIC_MAX
* Merge BindableServiceQueue into CallQueue
* New GuiServiceQueue and its JUCE dependency
* Fix leftover merge errors
* Fix CallQueue unit test
* Don't use bassert for better CI support
2013-11-07 09:42:37 -08:00
Vinnie Falco
bf87614fa6 Fix warning 2013-11-05 03:23:15 -08:00
Vinnie Falco
55045b5fe9 Improve hasher for IPAddress 2013-11-05 03:15:09 -08:00
Vinnie Falco
56c5c2ebaa Fix compile error 2013-11-05 03:09:39 -08:00
Vinnie Falco
a2c574fa15 Set boolalpha for Journal::ScopedStream 2013-11-05 03:09:39 -08:00
Vinnie Falco
b560f5a474 Add ostream support for PropertyStream items 2013-11-05 03:09:39 -08:00
Vinnie Falco
206169476f Add to_string for asio endpoints 2013-11-05 03:09:39 -08:00
Nicholas Dudfield
30648a1819 Fix IPAddress::V4::Proxy 2013-11-05 03:02:20 -08:00
Vinnie Falco
00575cf847 Stoppable, make stop() require call to start() 2013-11-01 13:31:38 -07:00
Vinnie Falco
ef94f42b62 Improve URL string conversions and ostream support 2013-10-31 08:10:06 -07:00
Vinnie Falco
4ed36da458 Fix error parameter in HTTPClient logic 2013-10-31 08:10:06 -07:00
Vinnie Falco
68b5966fef Move ServiceQueueBase out of detail namespace 2013-10-31 08:10:05 -07:00
Vinnie Falco
7bae496257 Add hash function to URL 2013-10-31 08:10:05 -07:00
Vinnie Falco
dc591f8943 Move MurmurHash to beast 2013-10-31 08:10:04 -07:00
Vinnie Falco
31089931d3 Make ServiceQueue::enqueue virtual 2013-10-31 08:10:04 -07:00
Patrick Dehne
55dd5b5547 Add beast_vflib compatibility module and stand alone unit test app 2013-10-23 17:37:00 -07:00
Vinnie Falco
1f97a239dc Measure CPU usage in Workers 2013-10-22 17:23:54 -07:00
Vinnie Falco
8604e216eb Add IPAddressConversion and asio module 2013-10-22 11:45:30 -07:00
Vinnie Falco
f4120635e9 Rename to IPAddress and remove unused files 2013-10-22 10:43:16 -07:00
Vinnie Falco
e8f1dd8421 Squelch spurious linker warning 2013-10-22 10:43:15 -07:00
Vinnie Falco
2ec6050959 Fix crash in PropertyStream::find 2013-10-22 10:13:46 -07:00
Vinnie Falco
29c38ef0d4 RelativeTime tidying 2013-10-20 15:31:50 -07:00
Patrick Dehne
74d616ac78 monotonicCurrentTimeInSeconds should return seconds, not milliseconds 2013-10-21 00:11:44 +02:00
Patrick Dehne
504a892887 Wrap hiResCounterHandler in a function to prevent an order of initialization problems 2013-10-20 23:38:52 +02:00
Patrick Dehne
30cf0f8d3a Rename millisecondsSinceStartup to monotonicCurrentTimeInSeconds 2013-10-20 23:37:24 +02:00
Patrick Dehne
d794d7d30b #ifdef unneeded sys/prctl.h include in the mac build 2013-10-20 01:43:24 +02:00
Patrick Dehne
b112b333bd Make fromStartup compile on mac 2013-10-20 01:38:59 +02:00
Vinnie Falco
0e7bac945f Fix include path 2013-10-19 15:54:02 -07:00
Patrick Dehne
e5bb90fdfa Fix constness of Proxy 2013-10-19 15:54:02 -07:00
Patrick Dehne
ac0142a49e Use template cast 2013-10-19 15:54:02 -07:00
Patrick Dehne
ef6e381de3 Add missing Url.h include 2013-10-19 15:54:01 -07:00
Patrick Dehne
206e65cf05 Fix constness of operator[] 2013-10-19 15:54:01 -07:00
Patrick Dehne
695cc38b36 Use template instantiation for friend declaration 2013-10-19 15:54:01 -07:00
Vinnie Falco
7b1e03a585 Add BaseFromMember 2013-10-18 16:04:37 -07:00
Vinnie Falco
49bc04fa48 Make List<>::Node not uncopyable 2013-10-17 17:46:18 -07:00
Vinnie Falco
d5954fffa8 Add Journal to UnitTest 2013-10-17 17:46:13 -07:00
Vinnie Falco
58da1065d6 Temporarily disable ServiceQueue dtor precondition asserts 2013-10-16 15:59:04 -07:00
Vinnie Falco
fe58c1a383 Add missing #include 2013-10-07 14:26:26 -07:00
Vinnie Falco
2c02580c37 Add PropertyStream for server state introspection 2013-10-07 14:00:03 -07:00
Vinnie Falco
24c2315476 Add ScopedWrapperContext 2013-10-06 19:46:42 -07:00
Nik Bougalis
a3845f54e1 Add RelativeTime::value_type typedef 2013-10-06 18:33:53 -07:00
Vinnie Falco
7442932b5e Fix missing PropertyStream members 2013-10-06 18:25:53 -07:00
Vinnie Falco
ed5a98f697 More PropertyStream output for PeerFinder 2013-10-06 17:30:45 -07:00
Vinnie Falco
fcfa10d508 Add PropertyStream 2013-10-06 17:30:44 -07:00
Vinnie Falco
3cf0729878 Tidy up AbstractHandler usage in HTTPClient 2013-10-05 15:38:27 -07:00
Vinnie Falco
55171f42f6 Remove obsolete source files 2013-10-05 13:08:39 -07:00
Vinnie Falco
1311ca37e5 Increase arity of SharedFunction 2013-10-05 13:08:39 -07:00
Vinnie Falco
67d807d8fc Add IPEndpoint::key_equal 2013-10-05 02:41:29 -07:00
Vinnie Falco
ebf395ecc4 Add ErrorCode and boost library 2013-10-04 23:18:28 -07:00
Vinnie Falco
2c3ead339e Add ServiceQueue::wrap 2013-10-04 23:18:26 -07:00
Vinnie Falco
6c7f5d093c Move many Thread related classes 2013-10-04 14:34:01 -07:00
Vinnie Falco
93e9d8622e Measure CPU utilization in ServiceQueue 2013-10-04 14:34:00 -07:00
Vinnie Falco
ca47d72aee Move ServiceQueue, ThreadLocalValue, SpinLock 2013-10-04 14:34:00 -07:00
Vinnie Falco
c864e4d3db Move WaitableEvent 2013-10-04 14:33:59 -07:00
Vinnie Falco
ff305e63b6 Add CPUMeter and ScopedTimeInterval 2013-10-04 14:33:59 -07:00
Vinnie Falco
01fd05cb4b Add RecursiveMutex, UnlockGuard, TryLockGuard 2013-10-04 14:33:59 -07:00
Vinnie Falco
5831a53697 Remove Journal from most Stoppable overrides 2013-10-04 14:33:57 -07:00
Vinnie Falco
b60a7f3363 Add Request and Response HTTP parsers 2013-10-04 14:33:55 -07:00
Vinnie Falco
44445ff1b8 Refactor net buffers classes 2013-10-04 14:33:55 -07:00
Vinnie Falco
ac37c38133 Beast class refactor 2013-10-03 19:03:10 -07:00
Vinnie Falco
8b7056b06c Fix eof on HTTP client get 2013-10-03 18:36:55 -07:00
Vinnie Falco
228b664ecf Remove obsolete beast container classes 2013-10-03 18:36:53 -07:00
Vinnie Falco
1dfd655959 Use RelativeTime from startup in DeadlineTimer 2013-10-03 18:36:53 -07:00
Vinnie Falco
ae22d5dc8a Add more methods to RelativeTime 2013-10-03 18:36:53 -07:00
Vinnie Falco
c67929ea39 Remove unhandled exception catcher 2013-10-01 12:25:01 -07:00
Vinnie Falco
2472a902dd Add 64 bit output for MurmurHash 2013-10-01 12:25:01 -07:00
Vinnie Falco
f3d97c76df Add RelativeTime::fromStartup 2013-10-01 12:25:00 -07:00
Vinnie Falco
b0b8660132 IPEndpoint better parsing 2013-10-01 12:25:00 -07:00
Vinnie Falco
ae551cde63 Add alternate form string parsing to IPEndpoint 2013-09-30 09:29:37 -07:00
Vinnie Falco
d0a0dbf430 Don't break on Throw 2013-09-30 09:29:36 -07:00
Vinnie Falco
0e46762962 Add hasher functors for IPEndpoint 2013-09-30 09:29:36 -07:00
Vinnie Falco
a1ec423235 Add Thread::stopThreadAsync 2013-09-30 09:29:33 -07:00
Vinnie Falco
4f7dca3e5a Add compiler, stdlib, and platform skeleton to beast/config 2013-09-28 19:34:16 -07:00
Vinnie Falco
4394594518 Tidy up some use of Error for throw 2013-09-28 19:34:16 -07:00
Vinnie Falco
e5e0f527fe Journal console output improvements 2013-09-28 16:42:16 -07:00
Vinnie Falco
f07515eb88 Add Stoppable prepare and start interfaces 2013-09-28 15:30:01 -07:00
Vinnie Falco
d37dd46f65 Move RelativeTime to chrono, add ostream support 2013-09-28 15:09:12 -07:00
Vinnie Falco
3f6e7aa05a Add console feature to Journal 2013-09-28 15:09:12 -07:00
Vinnie Falco
ad0064a310 Journal option to write to Output window (MSVC) 2013-09-28 15:09:11 -07:00
Vinnie Falco
0b7574ba00 Add compilation test script 2013-09-28 15:09:11 -07:00
Vinnie Falco
cc05ce19f9 Add ServiceQueue 2013-09-28 15:09:10 -07:00
Vinnie Falco
e132aabdae Use boost for functional when the config is set 2013-09-28 15:09:10 -07:00
Vinnie Falco
026b9268ae Fix is_continuation for boost version 2013-09-28 15:09:09 -07:00
Vinnie Falco
c807a4e383 Fix invoked_type type reference 2013-09-28 15:09:09 -07:00
Vinnie Falco
2ff781b25f Remove LockFreeStack::size 2013-09-28 15:09:08 -07:00
Vinnie Falco
3acb474795 Add SharedData::ConstAccess 2013-09-28 15:09:08 -07:00
Vinnie Falco
7e4c834c0e Add LockFreeStack::empty 2013-09-28 15:09:07 -07:00
Vinnie Falco
9c61a6df62 Added AbstractHandler, WrapHandler. HTTPClient Fixes. 2013-09-28 15:09:07 -07:00
Alex Dupre
94e40dc554 Fix unittest, by removing recursive call. 2013-09-28 20:25:41 +02:00
Vinnie Falco
38bf40884c Fix nonstandard C++ extension in getNullSink 2013-09-27 05:18:34 -07:00
Vinnie Falco
1ef044d628 Build fixes 2013-09-27 05:15:55 -07:00
Vinnie Falco
d5d37466e0 Fix missing <cmath> include for Gentoo 2013-09-27 05:15:46 -07:00
Vinnie Falco
5f231d305f Update copyright notice and licenses 2013-09-25 17:27:06 -07:00
Vinnie Falco
7b89bf6cc7 Add FixedArray, IntrusiveArray, Crypto 2013-09-23 10:13:25 -07:00
Vinnie Falco
5c5de57290 Reorganize beast modules and files 2013-09-23 10:13:24 -07:00
Vinnie Falco
9e18bb3c31 Merge commit '43deaaa5cf0d0178a4a6c3cb69c02a2a9a43ec7d' as 'src/beast/beast/http/impl/http-parser' 2013-09-23 09:54:31 -07:00
Vinnie Falco
57703acf75 Fix BeforeBoost.h include 2013-09-22 11:52:26 -07:00
Vinnie Falco
fbc247bf53 Add Stoppable to beast 2013-09-22 11:51:46 -07:00
Vinnie Falco
56496d8287 IPEndpoint comparisons 2013-09-22 11:51:44 -07:00
Vinnie Falco
9d9c822efb Migrate some headers and general tidying 2013-09-22 11:51:44 -07:00
Vinnie Falco
1a3cddc002 Add SharedArg and AsyncObject 2013-09-22 11:51:43 -07:00
Vinnie Falco
373ca9cef0 Add HTTPRequest and improvements to HTTPMessage parsing 2013-09-22 11:51:43 -07:00
Vinnie Falco
9534516b42 Add some thread classes and fix SharedData with a simple mutex adapter 2013-09-21 16:58:55 -07:00
Vinnie Falco
755ab36f0d Make CallQueue unit test runManual 2013-09-20 01:12:21 -07:00
Vinnie Falco
c0ca0373b6 Remove Beast version printing on startup 2013-09-20 00:57:55 -07:00
Vinnie Falco
7efb6a3ab8 Reorganize some MPL and Utility classes and files 2013-09-19 21:37:47 -07:00
Vinnie Falco
69c26a180e Fix missing BeastConfig.h include in Net.cpp 2013-09-19 18:25:01 -07:00
Vinnie Falco
40aa552489 Disable Beast version printing in Ripple BeastConfig.h 2013-09-19 18:22:18 -07:00
Vinnie Falco
7b1352d9c5 Add InterruptibleThread unit test 2013-09-19 14:42:55 -07:00
Vinnie Falco
68cf7599d8 ThreadWithCallQueue unit test adjustment 2013-09-19 14:42:55 -07:00
Vinnie Falco
6501dea7a3 IPEndpoint parsing and tidying 2013-09-19 14:42:55 -07:00
Vinnie Falco
72fc42b60c Move and add some template metaprogramming classes 2013-09-19 14:42:54 -07:00
Vinnie Falco
2a164f0165 Change filname capitalization (end) 2013-09-19 14:42:54 -07:00
Vinnie Falco
6a14f251ba Change filename capitalization 2013-09-19 14:42:53 -07:00
Vinnie Falco
92fd417962 Move integer types to beast/CStdInt.h 2013-09-19 14:42:53 -07:00
Vinnie Falco
ebbd9ff414 Move TargetPlatform.h to beast/Config.h 2013-09-19 14:42:52 -07:00
Vinnie Falco
874b5240d2 Add IPEndpoint
Conflicts:
	src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
2013-09-19 14:42:52 -07:00
Vinnie Falco
14b34fc6ef Tidy up some zlib macro undefines 2013-09-19 14:42:52 -07:00
Vinnie Falco
34fffca202 Rename beast sources for consistency 2013-09-19 14:42:51 -07:00
Vinnie Falco
4e59ab2261 Add CallQueue unit test 2013-09-19 14:42:50 -07:00
Vinnie Falco
327d7a6524 Fixes for consolidated beast unity includes 2013-09-19 14:42:49 -07:00
Vinnie Falco
d5ece4e909 Remove unused and broken classes 2013-09-19 14:42:49 -07:00
Vinnie Falco
39f13beaf7 Remove unused ConcurrentObject 2013-09-19 14:42:48 -07:00
Vinnie Falco
37624a7303 Add ThreadWithCallQueue unit test 2013-09-19 14:42:47 -07:00
Vinnie Falco
e82ec68820 Remove obsolete beast_Function 2013-09-19 14:42:46 -07:00
JoelKatz
90551a6eaf Temporarily leave sqlite3 in whatever threading mode it was already in. 2013-09-19 10:33:22 -07:00
Vinnie Falco
43ebbb1c70 Fix SharedSingleton to use memoryBarrier 2013-09-17 17:58:21 -07:00
Vinnie Falco
f343941a96 Tidy up SharedSingleton doc comments 2013-09-17 17:47:06 -07:00
Vinnie Falco
001997e088 Fix leak on exit from Singleton dependency cycle 2013-09-17 17:47:06 -07:00
Vinnie Falco
83b9d22ff0 Rename to DeadlineTimer::cancel() 2013-09-17 17:47:05 -07:00
Vinnie Falco
77874ee518 Use new instead of ::new for placement 2013-09-17 17:47:05 -07:00
Vinnie Falco
2a04dcc334 Journal improvements 2013-09-17 17:47:04 -07:00
Vinnie Falco
50965ca9c0 SharedFunction improvements 2013-09-17 17:47:04 -07:00
Vinnie Falco
277e32bb1e Add LockFreeStack iterators 2013-09-17 17:47:04 -07:00
Vinnie Falco
d94e4c2491 Fix undefined behavior in UnsignedIntegerCalc (again) 2013-09-17 17:47:03 -07:00
Vinnie Falco
2dc25cec72 Fix DeadlineTimer, callback while holding lock 2013-09-17 14:13:27 -07:00
Vinnie Falco
207ffdec8e Fix undefined behavior in UnsignedIntegerCalc 2013-09-16 18:47:35 -07:00
Vinnie Falco
1ad8ff9b64 Fix UnsignedInteger::isZero 2013-09-13 13:06:45 -07:00
Vinnie Falco
1dd2836f1b Add support for multiprecision integer arithmetic and binary data encoding 2013-09-13 12:43:43 -07:00
Vinnie Falco
a45fc47682 Update .gitignore 2013-09-12 23:58:56 -07:00
Vinnie Falco
962a95d770 Tidy up UnsignedInteger 2013-09-12 23:58:56 -07:00
Vinnie Falco
ca695fa6e1 Add Time::isNull() 2013-09-12 23:58:55 -07:00
Vinnie Falco
e96ce99d3d Better random number facilities in UnitTest 2013-09-12 21:39:17 -07:00
Vinnie Falco
550b8e55ee Fine tune UnsignedInteger declaration 2013-09-12 19:18:31 -07:00
Vinnie Falco
8e7e3b7256 Allow negative relative expirations in DeadlineTimer 2013-09-12 18:07:57 -07:00
Vinnie Falco
f3dc7ce52c Add generic Journal class for logging 2013-09-12 15:06:28 -07:00
Vinnie Falco
bfdda3212a Make ChildProcess UnitTest manual since it malfunctions 2013-09-12 10:55:24 -07:00
Vinnie Falco
02acf7d6d0 General refactoring of beast framework classes 2013-09-12 10:55:24 -07:00
Vinnie Falco
84ef06e35c Fix ExitHook to derive from AtExitHook 2013-09-12 10:55:17 -07:00
Vinnie Falco
f0acc9c901 Reduce the max threads in the Workers unit test 2013-09-12 05:46:45 -07:00
Vinnie Falco
55447b05ac New SharedSingleton, resolves destruction of objects with static storage duration. 2013-09-12 05:38:39 -07:00
Vinnie Falco
41eb8a1e29 Remove deprecated SharedPtr::getObject 2013-09-12 04:47:03 -07:00
Vinnie Falco
9eda4bc6fa Make SharedObject members const, the counter mutable 2013-09-12 04:47:03 -07:00
Vinnie Falco
6eda7772eb Remove deprecated createOnDemandOnce SingletonLifetime option 2013-09-12 00:43:05 -07:00
Vinnie Falco
8c522aa758 Fix off by one in pending i/o count on HTTPClient 2013-09-11 21:40:17 -07:00
Vinnie Falco
057344e1af Add HTTPMessage::toString and family 2013-09-11 20:04:23 -07:00
Vinnie Falco
ee728e3dbc Add UniformResourceLocator::empty 2013-09-11 19:58:11 -07:00
Vinnie Falco
ae324fba94 Move ./modules to ./src 2013-09-11 11:20:53 -07:00
Vinnie Falco
43e6d345e4 General beast update, fixes, optimizations, features:
* Clean ups, optimizations, and new File::commonDocumentsDirectory enum
* Replace sortArray with std::sort for performance
* More error tolerance in XML parser, speedups
* Refactor some byte-order mark detection code
* Add String::appendCharPointer overloads
* More XML parser optimisations and better error detection
* Misc performance tweaks
* Fixes for support of non utf8 strings
* Increased precision when storing strings in XmlElement
* Minor clean-ups
* Minor fix to XmlDocument
* Cleanups to CriticalSection and related synchronization primitives
* Fix DynamicArray unit test
2013-09-10 10:36:46 -07:00
Vinnie Falco
27307fca0c Use SharedFunction in ProtectedCall 2013-09-10 08:04:54 -07:00
Vinnie Falco
8b1b6050e7 Put back BEAST_CATCH_UNHANDLED_EXCEPTIONS macro, but disabled by default 2013-09-10 08:04:46 -07:00
Vinnie Falco
da925ee5cc Update to SQLite 3.8.0.2 2013-09-10 07:45:34 -07:00
Vinnie Falco
4676db126a Remove BEAST_CATCH_UNHANDLED_EXCEPTIONS 2013-09-09 13:34:18 -07:00
Vinnie Falco
d8ea4f9b06 Make UnsignedInteger HashFunction a unary function object 2013-09-09 10:50:35 -07:00
Vinnie Falco
d2d946204c Improvements to BuffersType 2013-09-09 10:50:35 -07:00
Vinnie Falco
2b132ae892 Tune HashMap parameters 2013-09-09 10:28:10 -07:00
Vinnie Falco
34b7599df6 Rename to IsCond<> 2013-09-09 10:28:09 -07:00
Vinnie Falco
270ceb7ceb Defer DeadlineTimer callback until the lock is released 2013-09-07 21:20:13 -07:00
Vinnie Falco
200c935228 Disable gcc warning for KeyvaDB 2013-09-07 11:57:53 -07:00
Vinnie Falco
f0c57cf95c Add HTTPClientType and HTTPMessage related helpers 2013-09-07 11:53:38 -07:00
Vinnie Falco
19d05b8024 Tidy up contract checks in InterruptibleThread 2013-09-07 11:53:38 -07:00
Vinnie Falco
2a362a99da Disable exception catching in unit tests 2013-09-07 11:53:37 -07:00
Vinnie Falco
497c8aeabf Add ContentBodyBuffer 2013-09-07 11:53:37 -07:00
Vinnie Falco
c35843fda5 Add SharedFunction to replace boost::function 2013-09-07 11:53:36 -07:00
Vinnie Falco
88af355028 Update programming by contract macros 2013-09-07 11:53:36 -07:00
Vinnie Falco
10958459a3 Add BEAST_MOVE_* macros 2013-09-07 11:53:35 -07:00
Vinnie Falco
5f6e2ee026 Add Debug unit test to check bassert behavior 2013-09-07 11:53:35 -07:00
Vinnie Falco
7a7514fa0c Add StringPairArray::swapWith 2013-09-07 11:53:34 -07:00
Vinnie Falco
637eafedee Add UniformResourceLocator and ParsedURL 2013-09-07 11:53:34 -07:00
Vinnie Falco
3f74cb76e9 Rename boost_asio files 2013-09-07 11:53:34 -07:00
Vinnie Falco
f79b34b2c9 Add http-parser to boost_asio 2013-09-07 11:53:33 -07:00
Vinnie Falco
85ced3dbf7 Use destroy() override instead of ContainerDeletePolicy for SharedObject 2013-09-07 11:53:32 -07:00
Vinnie Falco
718569d6a1 Fix DeadlineTimer for InterruptibleThread::wait timeout 2013-09-06 21:45:41 -07:00
Vinnie Falco
a56c01d044 Fix DeadlineTimer for InterruptibleThread::wait timeout 2013-09-06 21:44:53 -07:00
Vinnie Falco
04a4219a75 Make bassert fatal 2013-09-06 21:29:16 -07:00
Vinnie Falco
16113e783f Fix SharedPtr commit bug again 2013-09-06 21:25:55 -07:00
Vinnie Falco
63b0a1c9e0 Fix reference count bug in SharedPtr container 2013-09-06 20:18:25 -07:00
Vinnie Falco
a386b458fb Merge commit '60d5ca452314e0131993e1adcc004394fb64eed2' as 'Subtrees/beast/modules/beast_asio/parsehttp' 2013-09-06 12:46:39 -07:00
Vinnie Falco
8017b18039 Remove incorrect parsehttp subtree path 2013-09-06 12:46:23 -07:00
Vinnie Falco
981f6a8972 Merge commit 'ef544b108f8979e4622bd27657c9e93271b461fc' as 'Subtrees/beast/beast_asio/parsehttp' 2013-09-06 12:44:36 -07:00
Vinnie Falco
429deb959c Fix compile error on configs with c++11 move support 2013-09-05 05:08:41 -07:00
Vinnie Falco
86793468de Replace obsolete OncePerSecond with DeadlineTimer 2013-09-05 04:38:18 -07:00
Vinnie Falco
04d039eddd New ContainerTest generic templates 2013-09-05 04:22:27 -07:00
Vinnie Falco
201221253d Refactor SharedPtr and fix ContainerDeletePolicy bug 2013-09-05 04:22:26 -07:00
Vinnie Falco
aa2773e483 Add HashMap unit test 2013-09-05 04:22:25 -07:00
Vinnie Falco
25f29a2287 Add new-styled Intrusive and MPL modules 2013-09-05 04:22:25 -07:00
Vinnie Falco
b0503691c5 Fix bug and tidy up DeadlineTimer 2013-09-04 15:17:22 -07:00
Vinnie Falco
457c3262d7 Fix String from number conversions 2013-09-04 13:24:41 -07:00
Vinnie Falco
de2c4cc7b8 Added DynamicArray, DynamicList, and HashMap 2013-09-03 08:31:16 -07:00
Vinnie Falco
81e5b59060 Update TODO Files 2013-09-02 18:03:44 -07:00
Vinnie Falco
96587dc68c Add BeforeBoost.h and tidy up beast system headers 2013-09-01 12:22:08 -07:00
Vinnie Falco
d9d291abcb Tidy up includes and header material 2013-08-30 17:33:33 -07:00
Vinnie Falco
38516ef793 Tidy up beast project files 2013-08-30 17:24:32 -07:00
JoelKatz
5acd433080 Fix another regression. 2013-08-27 01:49:46 -07:00
Vinnie Falco
5c2da08c13 Fix warnings 2013-08-26 18:59:57 -07:00
Vinnie Falco
3c79ebda17 Add toString for IPv4Address 2013-08-25 01:57:50 -07:00
Vinnie Falco
46e5dc2f5c Add SSLContext 2013-08-25 01:57:50 -07:00
Vinnie Falco
0aa7e871d1 Improvements to Socket and SocketWrapper 2013-08-24 20:06:17 -07:00
Vinnie Falco
34527fbbe4 Add SocketWrapperStrand 2013-08-24 20:06:16 -07:00
Vinnie Falco
9fcab37445 Fix PrefilledReadStream::close to use lowest_layer 2013-08-24 20:06:16 -07:00
Vinnie Falco
5c0ee3d9a8 Make asio Socket unit tests run automatically 2013-08-24 20:06:16 -07:00
Vinnie Falco
f3327e6dca Update to SQLite 3.8.0 Pre-release (as of 2013-08-22 02:56 UTC) 2013-08-24 20:06:15 -07:00
Vinnie Falco
0e6e22ac3d Update sqlite to 3.7.17 (2013-05-20) 2013-08-24 18:48:08 -07:00
Vinnie Falco
5002ab2169 Merge beast_basics to beast_core 2013-08-24 10:18:24 -07:00
Vinnie Falco
db05b9ff04 Add TracketMutex unit test 2013-08-23 17:49:29 -07:00
Vinnie Falco
04f9270772 Add TrackedMutex and measureFunctionCallTime 2013-08-23 15:00:04 -07:00
Vinnie Falco
29feaba22f Fix KeyvaDB warnings 2013-08-23 07:01:37 -07:00
Vinnie Falco
dd3fc7a084 Fix #ifdef for pragma 2013-08-22 18:43:55 -07:00
Vinnie Falco
c5130e3eb3 Add String::fromNumber<> template for disambiguation 2013-08-22 18:10:01 -07:00
Vinnie Falco
b4855b6ac9 New beast Socket, SharedHandler, ComposedAsyncOperation APIs 2013-08-21 19:41:22 -07:00
Vinnie Falco
b09e975b4c Fix DirectoryIterator when multiple wildcards are used. 2013-08-20 15:24:02 -07:00
Vinnie Falco
ac9c02f73b Fix ProtectedCall default handler 2013-08-20 15:22:21 -07:00
Vinnie Falco
52ff45549d Make HandlerCall operator() const 2013-08-18 17:21:59 -07:00
Vinnie Falco
325a265a33 Add explicit checking for OpenSSL multithreading support 2013-08-18 13:09:09 -07:00
Vinnie Falco
918950ba49 Move destroy to the .cpp 2013-08-18 13:09:09 -07:00
Vinnie Falco
34dfcee2e8 Fix pure virtual stubs for future returns 2013-08-18 13:08:34 -07:00
Vinnie Falco
95cb192209 Clean up combinations of buffered handshaking and future returns 2013-08-18 03:20:57 -07:00
Vinnie Falco
c1bef9b35c Tidy up argument types for all wrappers and call sites 2013-08-18 03:07:12 -07:00
Vinnie Falco
005672e8af Remove obsolete handler wrappers 2013-08-18 02:35:53 -07:00
Vinnie Falco
e52e7d15dc New Context object for composed operations and continuation hooks 2013-08-18 01:53:43 -07:00
Vinnie Falco
dda53a96cc Fix clang compile error 2013-08-17 22:54:43 -07:00
Vinnie Falco
35f53516c7 Refactor Handler wrapper to meet the safety assurances of the original Handler 2013-08-17 21:10:03 -07:00
Vinnie Falco
14f8ed8dd2 Fatal error if a Thread is destroyed while running 2013-08-17 21:10:02 -07:00
Vinnie Falco
21b78adfee Add ContainerDeletePolicy for ownership containers 2013-08-17 21:10:01 -07:00
Vinnie Falco
503b8047b1 Fix thread destruction in TestPeer and better exception reporting 2013-08-17 21:10:00 -07:00
Vinnie Falco
d959af430e Fixes to handshake and socket wrapper 2013-08-17 21:09:59 -07:00
Vinnie Falco
4e908d3e96 Fix incorrect future returns for pure virtuals 2013-08-17 21:09:59 -07:00
Vinnie Falco
3db2b7d6a6 Fix gcc compile 2013-08-17 21:09:59 -07:00
Vinnie Falco
4615297b00 Refactor handshake parsing and logic classes 2013-08-17 21:09:58 -07:00
Vinnie Falco
6108aca055 Add TestPeerLogicProxyClient 2013-08-17 21:09:57 -07:00
Vinnie Falco
068cb83803 Generic HandshakeDetectStream and HandshakeDetectLogic 2013-08-17 21:09:57 -07:00
Vinnie Falco
22b4e17fad Allow selective enabling of async future returns 2013-08-17 21:09:56 -07:00
Vinnie Falco
7333d13dd4 Rename to max_needed for clarity 2013-08-17 21:09:55 -07:00
Vinnie Falco
77268845a6 Add class PrefilledReadStream 2013-08-17 21:09:55 -07:00
Vinnie Falco
93d490bc8f Fix async_result returns and handler copying 2013-08-17 21:09:55 -07:00
Vinnie Falco
e1d0bc83f4 Add default construction and isNull for Call handlers 2013-08-17 21:09:54 -07:00
Vinnie Falco
0ac3f826e1 Add 1-arity and 2-arity binding to CompletionCall 2013-08-17 21:09:54 -07:00
Vinnie Falco
2ef937a9dc Add this_layer and this_layer_type to SocketWrapper 2013-08-17 21:09:53 -07:00
Vinnie Falco
52b0f65bb3 Check for macro before setting it 2013-08-17 21:09:53 -07:00
Vinnie Falco
0c92204927 Tidy up move obsolete and deprecated files 2013-08-17 21:09:53 -07:00
Vinnie Falco
8632d43748 Fix missing return value 2013-08-16 10:43:31 -07:00
Vinnie Falco
9bf8c3765b Fix server to block until listening 2013-08-15 19:00:19 -07:00
Vinnie Falco
5b691224f0 Fix rvalue move arguments 2013-08-15 19:00:19 -07:00
Vinnie Falco
9cdf27cbf5 Make KeyvaDB unit tests run manually 2013-08-15 16:57:49 -07:00
Vinnie Falco
d1621692dc Report notes for issue #1 2013-08-15 16:57:46 -07:00
Vinnie Falco
cc133ccc4c Refactor SocketWrapper 2013-08-15 16:57:46 -07:00
Vinnie Falco
69f0eb109f Add BEAST_DEFINE_IS_CALL_POSSIBLE metaprogramming macro 2013-08-15 16:57:45 -07:00
Vinnie Falco
a3ab23a36a Improvements to TestPeer and PeerTest classes 2013-08-15 16:57:45 -07:00
Vinnie Falco
5e5b49d4e2 Consolidate Process::terminate code 2013-08-15 15:45:18 -07:00
Vinnie Falco
377c983ecb Remove spaces from unit test package and class names 2013-08-15 15:45:17 -07:00
Vinnie Falco
69b20b52cc Handshake detection wrappers 2013-08-15 15:45:17 -07:00
Vinnie Falco
e4a68d9962 Infinite PeerTest timeout when debugger attached 2013-08-15 15:45:17 -07:00
Vinnie Falco
21f0d63507 Add uint24 and network byte order conversions 2013-08-15 15:45:16 -07:00
Vinnie Falco
e7b008c6d5 Add some missing ByteOrder functions and templates 2013-08-15 15:45:16 -07:00
Vinnie Falco
7735187d36 Move PeerRole to its own file 2013-08-15 15:45:15 -07:00
Vinnie Falco
85f4d7d025 Move some classes into their own files 2013-08-15 15:45:15 -07:00
Vinnie Falco
e0eaa08597 Add PROXY TestPeer client 2013-08-15 15:45:15 -07:00
Vinnie Falco
43c065c5b6 Robust method for extracting the underlying template type 2013-08-15 15:45:14 -07:00
Vinnie Falco
df154e43b1 Import ProxyHandshake into beast 2013-08-15 15:45:14 -07:00
Vinnie Falco
ba21367b40 Fix unused variable warning 2013-08-15 08:31:13 -07:00
Vinnie Falco
c420f60259 Fix Workers warning 2013-08-15 08:28:51 -07:00
Vinnie Falco
b13f35645a Call _exit from Process::terminate() 2013-08-12 13:29:24 -07:00
Vinnie Falco
68560c9ea7 Add thread naming to Workers 2013-08-12 11:00:55 -07:00
Vinnie Falco
1a9019f5f5 Add numberOfCurrentlyRunningTasks to Workers 2013-08-12 11:00:47 -07:00
Vinnie Falco
969eeec717 Add programming by contract support 2013-08-12 11:00:37 -07:00
Vinnie Falco
1f59e38dc7 Use std::ostream for double to String conversions 2013-08-10 03:12:53 -07:00
Vinnie Falco
b202b82f5a Disable failing TestPeer unit test 2013-08-10 00:46:33 -07:00
Vinnie Falco
d0bdafff71 Fix c++0x errors 2013-08-10 00:45:40 -07:00
Vinnie Falco
685af493a4 Use deadline_timer to handle async logic properly 2013-08-09 23:14:58 -07:00
Vinnie Falco
e8ad5a0e6b Tidy up beast_asio 2013-08-09 20:53:49 -07:00
Vinnie Falco
000b5a2b7c Fix gcc warnings and errors 2013-08-09 19:59:59 -07:00
Vinnie Falco
88ffd3cdfb TestPeer boost::asio Socket and UnitTest framework 2013-08-09 19:47:12 -07:00
Vinnie Falco
98352429c2 Update .gitignore for beast_boost module 2013-08-09 19:23:40 -07:00
Vinnie Falco
5171a00569 Clean up rvalues in arguments and call sites 2013-08-09 19:23:40 -07:00
Vinnie Falco
01af51308e Add SslContext abstraction 2013-08-09 19:23:40 -07:00
Vinnie Falco
65d4440d0d Fix using BOOST_ASIO_MOVE_CAST for passing rvalue references 2013-08-07 19:14:21 -07:00
Vinnie Falco
37276f357c Fix use sites of BOOST_ASIO_MOVE_ARG 2013-08-07 18:42:19 -07:00
Vinnie Falco
e0b6620df2 More match options for unit test selection string 2013-08-07 17:31:48 -07:00
Vinnie Falco
ebabeb6fbd Add 'print' unit test which prints the list of tests 2013-08-07 15:34:13 -07:00
Vinnie Falco
ab6c138a7c Set __WIN32_WINNT in properties 2013-08-07 15:16:43 -07:00
Vinnie Falco
33e7c124a3 Fix gcc compile errors 2013-08-07 15:16:43 -07:00
Vinnie Falco
11ff62e120 Revise all Socket function signatures and return values 2013-08-07 15:16:42 -07:00
Vinnie Falco
155a6a09b6 Tidy up beast_asio 2013-08-07 15:16:41 -07:00
Vinnie Falco
74156b6b89 Add beast_asio module 2013-08-07 15:16:40 -07:00
Vinnie Falco
9387e7dd2d Tweak fatal_error macro to remove warning 2013-08-07 15:16:40 -07:00
Vinnie Falco
9aaaa6aef0 Make Uncopyable derivations public 2013-08-07 15:16:38 -07:00
Vinnie Falco
cc9358ee95 Adjust access-specifier 2013-08-07 15:16:38 -07:00
Vinnie Falco
06ed133ae3 Add fatal_error() macro 2013-08-07 15:16:37 -07:00
Vinnie Falco
75b778924f Change to fatal_assert() 2013-08-07 15:16:37 -07:00
Vinnie Falco
fe902db322 Update beast vcxproj 2013-08-07 15:16:36 -07:00
Vinnie Falco
0c00335627 Fatal error in ~Thread if thread still running (undefined behavior) 2013-08-07 15:16:36 -07:00
Vinnie Falco
5e3548fc00 Add fatal_require and improved FatalError reporting interfaces 2013-08-07 15:16:35 -07:00
Vinnie Falco
c8837d07e7 Add bool return to stopThread 2013-08-07 15:16:35 -07:00
Vinnie Falco
fd14957072 Return results of expect in UnitTest 2013-08-07 15:16:35 -07:00
Vinnie Falco
1df03b67e7 Add RelativeTime::seconds() ctor 2013-08-07 15:16:34 -07:00
Vinnie Falco
6d9131084f Add default to UnitTest::fail() and tidy up 2013-08-07 15:16:34 -07:00
Vinnie Falco
66b96b90d5 Generate a fatal error if a running Thread object is destroyed 2013-08-07 15:16:33 -07:00
Vinnie Falco
03baeccda5 Add getConstData for MemoryBlock 2013-08-07 15:16:33 -07:00
Vinnie Falco
91b0c1cd0e Add Random::fillBitsRandomly 2013-08-07 15:16:32 -07:00
Vinnie Falco
6d974daaf2 Add default value to Semaphore ctor 2013-08-07 15:16:32 -07:00
Vinnie Falco
849d0c1c34 Return popped element in List 2013-08-07 15:16:31 -07:00
Vinnie Falco
63dc75fb81 Add std container compatibility to MemoryBlock 2013-08-07 15:16:31 -07:00
Vinnie Falco
f07732a9ca Fix clang warnings 2013-08-07 15:16:31 -07:00
Alex Dupre
9702446d91 Comment out a quite useless test case if platform is not Windows, since getcwd()
return the canonical path (resolving symlinks), while HOME may contains symlinks.
2013-08-05 09:39:41 -07:00
Alex Dupre
d3a07234cd Fix retrieval of CPU info (number of CPUs, speed, flags, vendor) on FreeBSD,
using 'dmesg' and 'sysctl' instead of /proc/cpuinfo that is Linux-specific.
2013-08-05 09:39:34 -07:00
Vinnie Falco
cf2c43e7ab Fix clang compile 2013-08-01 15:54:24 -07:00
Vinnie Falco
83c3beb2ed Run startup unit tests from Main 2013-08-01 15:27:18 -07:00
Vinnie Falco
52133569f5 Add runStartup category to UnitTest 2013-08-01 15:27:18 -07:00
Vinnie Falco
1c39721ff7 Add SemanticVersion 2013-08-01 15:27:18 -07:00
Vinnie Falco
57b2c3c2e4 Add overloaded translate() that takes CharPointer_UTF8 2013-08-01 11:36:13 -07:00
Vinnie Falco
ed82643faf Fix mutex scope and storage duration 2013-07-31 18:41:59 -07:00
Vinnie Falco
5131752402 Add return value to some InputStream methods 2013-07-31 16:40:28 -07:00
Vinnie Falco
1b44479311 Default parameter to false 2013-07-31 16:40:28 -07:00
Vinnie Falco
4c987d04d6 Add tests for SSE3 capability 2013-07-31 16:35:52 -07:00
Vinnie Falco
728ace79c5 Fix Android warnings 2013-07-31 16:29:34 -07:00
Vinnie Falco
a937b97a61 Add FatalError 2013-07-30 21:05:11 -07:00
Vinnie Falco
35d2ea862b Fix clang compile 2013-07-29 16:33:09 -07:00
Vinnie Falco
1c502948f5 Add ProtectedCallTests 2013-07-29 15:35:27 -07:00
Vinnie Falco
45f321a3a2 Fix summary stats for unit test results 2013-07-29 14:54:54 -07:00
Vinnie Falco
85f5672280 Fix UnitTest doc 2013-07-29 14:38:58 -07:00
Vinnie Falco
62c1b02eb1 Clarify behavior of pauseAllThreadsAndWait 2013-07-29 14:00:45 -07:00
Vinnie Falco
67af5ccda8 Fix KeyvaDB unit test package name 2013-07-29 13:43:39 -07:00
Vinnie Falco
bd49b0edf8 Add class Workers 2013-07-29 13:31:50 -07:00
Vinnie Falco
3126654d33 Add timeout to Semaphore::wait 2013-07-29 13:31:11 -07:00
Vinnie Falco
1b55d39997 Fix integer to String conversions 2013-07-29 13:31:10 -07:00
Vinnie Falco
51372c01f2 Make expectEquals more generic 2013-07-29 13:31:10 -07:00
Vinnie Falco
7008db7dda Add initiallySignaled parameter to WaitableEvent 2013-07-29 13:31:10 -07:00
Vinnie Falco
47456a1723 Add class Workers 2013-07-29 13:30:06 -07:00
Vinnie Falco
933ba3c7d6 Make timeouts default to infinity in Thread 2013-07-29 13:30:06 -07:00
Vinnie Falco
08ff5f02b1 Tidy up String conversions 2013-07-29 13:30:05 -07:00
Vinnie Falco
2bf39203e8 Add infinite wait default to waitForThreadToExit 2013-07-29 13:30:04 -07:00
Vinnie Falco
d323a84dd9 Remove unused function 2013-07-29 13:30:04 -07:00
Vinnie Falco
2e402ba654 Add lexicalCast 2013-07-28 21:27:04 -07:00
Vinnie Falco
f0afa04037 Fix numberToString for limit cases 2013-07-28 21:04:20 -07:00
Vinnie Falco
b9290acb85 Update TODO 2013-07-28 14:58:20 -07:00
Vinnie Falco
cb47146b3b Add classes ProtectedCall and Main 2013-07-28 14:58:19 -07:00
Vinnie Falco
04fadc84a6 Rename to swapWith and use a template parameter 2013-07-28 14:58:19 -07:00
Vinnie Falco
18333eac29 Remove unnecessary .mm files 2013-07-28 14:58:18 -07:00
Vinnie Falco
abd3668b65 Upgrade UnitTest and provide JUnit XML output formatting 2013-07-28 02:44:26 -07:00
Vinnie Falco
9064af3b1c Call pass() in AbstractFifo unit test 2013-07-28 02:41:09 -07:00
Vinnie Falco
2f7b42b13b Return index in Array::add() 2013-07-28 02:41:09 -07:00
Vinnie Falco
56755c278b Add UnitTest::anyTestsFailed() 2013-07-27 14:57:38 -07:00
Vinnie Falco
7266111b68 Generalize swapWithArray
Conflicts:
	Subtrees/beast/TODO.txt
2013-07-27 11:00:21 -07:00
Vinnie Falco
810954014b Add hardened HashFunction to UnsignedInteger 2013-07-27 10:47:32 -07:00
Vinnie Falco
3248a1b57f HashMap ctor stores an instance of the hash function 2013-07-27 10:47:32 -07:00
Vinnie Falco
4edf1fd8fa Add OwnedArray::clearQuick() 2013-07-27 10:47:32 -07:00
Vinnie Falco
67f22e602e Update TODO 2013-07-24 11:51:39 -07:00
Vinnie Falco
114012fab2 Add pass and fail to UnitTest 2013-07-24 11:47:43 -07:00
Vinnie Falco
c50fc88827 Update TODO 2013-07-24 11:47:42 -07:00
Vinnie Falco
f5e4b3aeb3 Use beast_sqlite and beast_sqdb 2013-07-24 11:47:42 -07:00
Vinnie Falco
76e0d4c770 Add beast_sqdb module 2013-07-24 11:47:42 -07:00
Vinnie Falco
ed8d9b1ed3 Add beast_sqlite module 2013-07-24 11:47:41 -07:00
Vinnie Falco
c825fce0cf Put unit test in 'beast' group 2013-07-23 14:06:06 -07:00
Vinnie Falco
0f5b35f408 Import KeyvaDB to Beast 2013-07-23 13:23:07 -07:00
Vinnie Falco
ae0cd50840 Optimised Result::ok() 2013-07-23 13:04:52 -07:00
Vinnie Falco
9a7c5b02d4 Allow external buffers in MemoryOutputStream 2013-07-22 13:20:52 -07:00
Vinnie Falco
66c5b4ed01 Add identity import tests to NodeStoreTests 2013-07-21 14:02:23 -07:00
Vinnie Falco
f125c3a3c8 Add template I/O for streams 2013-07-21 12:56:27 -07:00
Vinnie Falco
e36f027a9a Clean up RandomAccessFile 2013-07-21 12:56:26 -07:00
Vinnie Falco
dc7035ed19 Update RandomAccessFile unit test 2013-07-21 12:55:47 -07:00
Vinnie Falco
d25fe19d87 Add group and run type to UnitTest 2013-07-21 12:55:47 -07:00
Vinnie Falco
dc52a31814 Add RecycledObjectPool 2013-07-21 12:54:14 -07:00
Vinnie Falco
2f45613017 Hack to fix Random 2013-07-21 12:54:13 -07:00
Vinnie Falco
8d881d3b6f Add Random::nextBlob 2013-07-21 12:54:13 -07:00
Vinnie Falco
ce6f051551 Fix compare() 2013-07-21 12:54:11 -07:00
Vinnie Falco
b3b188061a Fix POSIX RandomAccessFile 2013-07-21 12:54:11 -07:00
Vinnie Falco
49f70c083d Add POSIX RandomAccessFile native routines 2013-07-21 12:54:11 -07:00
Vinnie Falco
ed392300b4 Fix RandomAccessFile read 2013-07-21 12:54:10 -07:00
Vinnie Falco
a3af6404b0 RandomAccessFile unit tests 2013-07-21 12:54:09 -07:00
Vinnie Falco
312b7352b2 Run an individual unit test 2013-07-21 12:54:08 -07:00
Vinnie Falco
23e4bc4f9a Run a named unit test 2013-07-21 12:54:08 -07:00
Vinnie Falco
8208bb25ba Add RandomAccessFile 2013-07-21 12:54:07 -07:00
Vinnie Falco
a90ea340d2 Add return values to OutputStream methods 2013-07-21 12:54:07 -07:00
Vinnie Falco
e2fd51c282 Assert on type size invariant 2013-07-21 12:54:05 -07:00
Vinnie Falco
0008193a20 Fix gcc compile 2013-07-15 09:38:12 -07:00
Vinnie Falco
5c691c0883 Rename to SharedObjectArray
Conflicts:
	Builds/VisualStudio2012/RippleD.vcxproj.filters
2013-07-15 09:38:11 -07:00
Vinnie Falco
e363cbe542 Add UnsignedInteger class and tests 2013-07-15 09:38:11 -07:00
Vinnie Falco
d8bec0a43c Add module beast_crypto 2013-07-15 09:38:11 -07:00
Vinnie Falco
e1c176ceb7 Added StringArray::ensureStorageAllocated 2013-07-15 09:38:09 -07:00
Vinnie Falco
a1289eb502 Use template for UnitTest 2013-07-15 09:38:09 -07:00
Vinnie Falco
4a00e8feed Adjust UnitTest output 2013-07-15 09:38:08 -07:00
Vinnie Falco
60e0e5c38f Move UnitTest to diagnostic 2013-07-15 09:38:07 -07:00
Vinnie Falco
93ef4f2301 Rename to SharedObject 2013-07-15 09:38:07 -07:00
Vinnie Falco
ccda3068ef Remove deprecated SharedObject 2013-07-15 09:38:06 -07:00
Vinnie Falco
ebad05a9df Add DeadlineTimer member docs 2013-07-15 09:38:06 -07:00
Vinnie Falco
4f19ea4a8e Fix warning 2013-07-12 14:43:06 -07:00
Vinnie Falco
8e2722da95 Improve DeadlineTimer 2013-07-10 09:51:32 -07:00
Vinnie Falco
b5fbcfaa8e Replace deprecated GetVersionEx Win32 call 2013-07-10 09:51:32 -07:00
Vinnie Falco
d0ea813515 Add timer parameter to DeadlineTimer callback 2013-07-10 09:51:31 -07:00
Vinnie Falco
932bc382dc Update TODO 2013-07-10 09:51:29 -07:00
Vinnie Falco
bdfb19fe38 Add DeadlineTimer class 2013-07-10 09:51:28 -07:00
Vinnie Falco
d798330f44 Update documentation for member 2013-07-10 09:51:27 -07:00
Vinnie Falco
caa3a5d0bb Replace calls to deprecated siginterrupt() 2013-07-10 09:51:26 -07:00
Vinnie Falco
d54a5c49c1 Fix warnings and errors 2013-07-10 09:51:25 -07:00
Vinnie Falco
9e75075dc4 Adjust a comment 2013-07-10 09:51:24 -07:00
Vinnie Falco
6a833e19aa Add Objective C++ beast_basics compile unit 2013-07-10 09:51:23 -07:00
Vinnie Falco
941ac2ae5e Fix compile error for two phase lookup 2013-07-10 09:51:23 -07:00
JoelKatz
34f4b3cad4 beast, not BEAST 2013-07-03 18:39:49 -07:00
Vinnie Falco
03948cd685 Various beast cleanups 2013-07-03 10:07:46 -07:00
Vinnie Falco
3c993884cd Fix beast macro calls 2013-07-03 10:05:43 -07:00
Vinnie Falco
9e99aed182 Add neverDestroyed lifetime for SharedSingleton 2013-07-03 09:41:46 -07:00
Vinnie Falco
66edf2822c Fix for atomic aliasing in Clang or GCC builds 2013-07-03 09:41:46 -07:00
Vinnie Falco
9c9ba18619 constness fix in OwnedArray 2013-07-03 09:41:46 -07:00
Vinnie Falco
485d048415 Update some beast container code 2013-07-03 09:41:44 -07:00
Alex Dupre
10a0db9160 Linux implementation of isRunningUnderDebugger using ptrace() doesn't work on FreeBSD.
(I doubt it'll work on Linux, too, but I'm not sure)
2013-07-03 09:41:43 -07:00
Alex Dupre
8260b75586 FreeBSD tuning. 2013-07-03 09:41:43 -07:00
Vinnie Falco
8365ed7408 Remove ConcurrentObject and rename to SharedData 2013-07-01 09:32:08 -07:00
Vinnie Falco
d4298d1bd2 Tidy up List documentation 2013-07-01 09:32:07 -07:00
Vinnie Falco
75736f547a Tidy up LeakChecked and configuration macro 2013-07-01 09:32:07 -07:00
Vinnie Falco
e84b524fc4 Default MSVC CRT Debug heap leak checks to ON 2013-07-01 09:32:07 -07:00
Vinnie Falco
7eb80615c7 Tidy up project file 2013-07-01 09:32:06 -07:00
Vinnie Falco
030c763549 Remove beast::Singleton 2013-07-01 09:32:05 -07:00
Vinnie Falco
57d0e556d8 Fix File::nonexistent false leak using SharedSingleton 2013-07-01 09:32:05 -07:00
Vinnie Falco
3fea8a4202 Rename SharedSingleton and move files around 2013-07-01 09:32:05 -07:00
Vinnie Falco
ca1eda2df1 Use LeakChecked throughout Beast 2013-07-01 09:32:04 -07:00
Vinnie Falco
386fea5e71 Tidy up and activate the MSVC Debug Heap 2013-07-01 09:32:03 -07:00
Vinnie Falco
e7bda30506 Large tidying up of Beast
- Move key classes into beast_core
- Tidy up various macros and files
- Disable leaking FifoFreeStoreWithTLS
2013-07-01 09:32:03 -07:00
Vinnie Falco
6dcf61669c Return object in OwnedArray add routines 2013-07-01 09:32:02 -07:00
Alex Dupre
1832463010 Implement MACAddress::findAllAddresses as in MacOSX. 2013-06-29 10:04:27 +02:00
Alex Dupre
a0baaeafd1 Use nanosleep on FreeBSD, instead of failing because clock_nanosleep is missing. 2013-06-29 10:02:51 +02:00
Vinnie Falco
c5a113ca80 Put boost placeholders in a namespace (hack) 2013-06-28 17:01:04 -07:00
Vinnie Falco
e6b3ded33f Lift cref into beast namespace 2013-06-28 17:01:03 -07:00
Vinnie Falco
aa66af151a Roll back 7 commits 2013-06-28 11:48:43 -07:00
Vinnie Falco
ab57495e29 Hack to put boost placeholders in a namespace 2013-06-28 10:19:40 -07:00
Vinnie Falco
afb5d161e3 Annotate bind 2013-06-28 08:11:04 -07:00
Vinnie Falco
1fdaafb30b Lift cref into beast namespace 2013-06-28 07:02:48 -07:00
Vinnie Falco
9328e6fdec Improve bind, placeholder, and function support 2013-06-28 07:02:47 -07:00
Vinnie Falco
98ac0697a9 Add default EntryPoints 2013-06-28 07:02:47 -07:00
Vinnie Falco
b658f82510 Fix for UTF32 strings 2013-06-27 11:52:09 -07:00
Vinnie Falco
b50894fa70 Fix UTF32 string creation 2013-06-27 07:23:45 -07:00
Vinnie Falco
e002000764 Fix assertion 2013-06-26 17:42:48 -07:00
Vinnie Falco
9182c1558c Update Beast ReadMe 2013-06-26 17:42:47 -07:00
Vinnie Falco
ded7eca60f Fix false assertion 2013-06-26 17:42:47 -07:00
Vinnie Falco
74e8c881f7 Add missing native BSD support for Beast 2013-06-26 09:24:44 -07:00
Alex Dupre
f1eac72d20 Fix compilation on FreeBSD. 2013-06-26 12:02:22 +02:00
Vinnie Falco
6d13ddd43a Fix Clang static analysis warnings 2013-06-26 00:19:41 -07:00
Vinnie Falco
94e9632234 Add override specifier to some Beast functions 2013-06-24 15:51:32 -07:00
Vinnie Falco
3699b74ebb Alternate thread naming for older GLIBC 2013-06-24 15:07:09 -07:00
Vinnie Falco
4eeab3bc3e Remove unused Beast configuration macros 2013-06-24 09:40:17 -07:00
Vinnie Falco
0d1ded5278 Avoid using pthread_setname_np on older linux distros 2013-06-23 11:09:53 -07:00
Vinnie Falco
86142ecdf1 Add BEAST_ARM macro to detect ARM platforms 2013-06-23 09:18:58 -07:00
Vinnie Falco
8cdc00230d Add BEAST_FILEANDLINE_ macro for warning pragmas 2013-06-23 09:18:58 -07:00
Vinnie Falco
d3d674ba4b Beast fixes for FreeBSD 2013-06-20 13:38:44 -07:00
Vinnie Falco
6d961d87f8 Add beast_basics and remove unused modules from build 2013-06-17 09:38:16 -07:00
Vinnie Falco
5a28c54505 Update Beast copyright and various tidying 2013-06-17 09:28:43 -07:00
Vinnie Falco
9968101d96 Add Doxyfile 2013-06-17 07:09:34 -07:00
Vinnie Falco
d0a309e6da Add beast_basics module 2013-06-17 07:09:33 -07:00
Vinnie Falco
f2d84f0a90 Add Beast fork from JUCE commit 265fb0e8ebc26e1469d6edcc68d2ca9acefeb508 2013-06-16 16:57:52 -07:00
Vinnie Falco
d81345d8f6 Update CodingStyle document 2013-06-06 21:43:22 -07:00
Vinnie Falco
97b6260c9a Use beast::ScopedPointer to hold IFeeVote in Application 2013-06-02 08:55:07 -07:00
Vinnie Falco
48cf78af68 Beast initial commit 2013-06-02 08:55:07 -07:00
4645 changed files with 862953 additions and 531247 deletions

2
.gitattributes vendored
View File

@@ -1,5 +1,5 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
#* text=auto
# These annoying files
rippled.1 binary

29
.gitignore vendored
View File

@@ -1,5 +1,9 @@
# .gitignore
bin/boostbook_catalog.xml
bin/config.log
bin/project-cache.jam
# Ignore vim swap files.
*.swp
@@ -19,10 +23,16 @@
*.o
build
tags
TAGS
bin/rippled
Debug/*.*
Release/*.*
# Ignore coverage files.
*.gcno
*.gcda
*.gcov
# Ignore locally installed node_modules
/node_modules
@@ -30,6 +40,7 @@ Release/*.*
tmp
# Ignore database directory.
db/
db/*.db
db/*.db-*
@@ -66,12 +77,20 @@ DerivedData
# Intel Parallel Studio 2013 XE
My Amplifier XE Results - RippleD
# KeyvaDB files
*.key
*.val
# Compiler intermediate output
/out.txt
# Build Log
rippled-build.log
rippled-build.log
# Profiling data
gmon.out
Builds/VisualStudio2015/*.db
Builds/VisualStudio2015/*.user
Builds/VisualStudio2015/*.opendb
Builds/VisualStudio2015/*.sdf
# MSVC
*.pdb
.vs/

12
.gitmodules vendored Normal file
View File

@@ -0,0 +1,12 @@
[submodule "docs/docca"]
path = docs/docca
url = https://github.com/vinniefalco/docca.git
[submodule "src/nudb/extras/beast"]
path = src/nudb/extras/beast
url = https://github.com/vinniefalco/Beast.git
[submodule "src/nudb/extras/rocksdb"]
path = src/nudb/extras/rocksdb
url = https://github.com/facebook/rocksdb.git
[submodule "src/nudb/doc/docca"]
path = src/nudb/doc/docca
url = https://github.com/vinniefalco/docca.git

View File

@@ -1,50 +1,68 @@
sudo: false
language: cpp
compiler:
- clang
- gcc
env:
global:
- LLVM_VERSION=3.8.0
# Maintenance note: to move to a new version
# of boost, update both BOOST_ROOT and BOOST_URL.
# Note that for simplicity, BOOST_ROOT's final
# namepart must match the folder name internal
# to boost's .tar.gz.
- LCOV_ROOT=$HOME/lcov
- BOOST_ROOT=$HOME/boost_1_60_0
- BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz'
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- gcc-5
- g++-5
- python-software-properties
- protobuf-compiler
- libprotobuf-dev
- libssl-dev
- libstdc++6
- binutils-gold
# Provides a backtrace if the unittests crash
- gdb
matrix:
include:
# Default BUILD is "scons".
- compiler: gcc
env: GCC_VER=5 BUILD=cmake TARGET=debug.nounity PATH=$PWD/cmake/bin:$PATH
- compiler: gcc
env: GCC_VER=5 TARGET=coverage
- compiler: clang
env: GCC_VER=5 TARGET=debug CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
- compiler: clang
env: GCC_VER=5 TARGET=debug.nounity CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
# The clang cmake builds do not link.
# - compiler: clang
# env: GCC_VER=5 BUILD=cmake TARGET=debug CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PWD/cmake/bin:$PATH
# - compiler: clang
# env: GCC_VER=5 BUILD=cmake TARGET=debug.nounity CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PWD/cmake/bin:$PATH
cache:
directories:
- $BOOST_ROOT
- llvm-$LLVM_VERSION
- cmake
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python-software-properties
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository -y ppa:boost-latest/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq g++-4.8
- sudo apt-get install -qq libboost1.55-all-dev
# We want debug symbols for boost as we install gdb later
- sudo apt-get install -qq libboost1.55-dbg
- sudo apt-get install -qq mlocate
- sudo updatedb
- sudo locate libboost | grep /lib | grep -e ".a$"
- sudo apt-get install -qq protobuf-compiler libprotobuf-dev libssl-dev exuberant-ctags
# We need gcc >= 4.8 for some c++11 features
- sudo apt-get install -qq gcc-4.8
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
- sudo update-alternatives --set gcc /usr/bin/gcc-4.8
# Stuff is gold. Nuff said ;)
- sudo apt-get -y install binutils-gold
# We can get a backtrace if the guy crashes
- sudo apt-get -y install gdb
# What versions are we ACTUALLY running?
- g++ -v
- clang -v
- bin/ci/ubuntu/install-dependencies.sh
script:
# Set so any failing command will abort the build
- set -e
# If only we could do -j12 ;)
- scons
# See what we've actually built
- ldd ./build/rippled
# Run unittests (under gdb)
- | # create gdb script
echo "set env MALLOC_CHECK_=3" > script.gdb
echo "run" >> script.gdb
echo "backtrace full" >> script.gdb
# gdb --help
- cat script.gdb | gdb --ex 'set print thread-events off' --return-child-result --args ./build/rippled --unittest
# Run integration tests
- npm install
- npm test
- travis_retry bin/ci/ubuntu/build-and-test.sh
notifications:
email:
false

View File

@@ -1,4 +1,4 @@
# Maintainer: Roberto Catini <roberto.catini@gmail.com>
# Maintainer: Roberto Catini <roberto.catini@gmail.com>
pkgname=rippled
pkgrel=1
@@ -9,7 +9,6 @@ url="https://github.com/ripple/rippled"
license=('custom:ISC')
depends=('protobuf' 'openssl' 'boost-libs')
makedepends=('git' 'scons' 'boost')
checkdepends=('nodejs')
backup=("etc/$pkgname/rippled.cfg")
source=("git://github.com/ripple/rippled.git#branch=master")
sha512sums=('SKIP')
@@ -21,13 +20,11 @@ pkgver() {
build() {
cd "$srcdir/$pkgname"
scons build/rippled
scons
}
check() {
cd "$srcdir/$pkgname"
npm install
npm test
build/rippled --unittest
}

View File

@@ -0,0 +1,658 @@
# This is a set of common functions and settings for rippled
# and derived products.
############################################################
cmake_minimum_required(VERSION 3.1.0)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(WARNING "Builds are strongly discouraged in "
"${CMAKE_SOURCE_DIR}.")
endif()
macro(parse_target)
if (NOT target AND NOT CMAKE_BUILD_TYPE)
if (APPLE)
set(target clang.debug)
elseif(WIN32)
set(target msvc)
else()
set(target gcc.debug)
endif()
endif()
if (target)
# Parse the target
set(remaining ${target})
while (remaining)
# get the component up to the next dot or end
string(REGEX REPLACE "^\\.?([^\\.]+).*$" "\\1" cur_component ${remaining})
string(REGEX REPLACE "^\\.?[^\\.]+(.*$)" "\\1" remaining ${remaining})
if (${cur_component} STREQUAL gcc)
if (DEFINED ENV{GNU_CC})
set(CMAKE_C_COMPILER $ENV{GNU_CC})
elseif ($ENV{CXX} MATCHES .*gcc.*)
set(CMAKE_CXX_COMPILER $ENV{CC})
else()
find_program(CMAKE_C_COMPILER gcc)
endif()
if (DEFINED ENV{GNU_CXX})
set(CMAKE_C_COMPILER $ENV{GNU_CXX})
elseif ($ENV{CXX} MATCHES .*g\\+\\+.*)
set(CMAKE_C_COMPILER $ENV{CC})
else()
find_program(CMAKE_CXX_COMPILER g++)
endif()
endif()
if (${cur_component} STREQUAL clang)
if (DEFINED ENV{CLANG_CC})
set(CMAKE_C_COMPILER $ENV{CLANG_CC})
elseif ($ENV{CXX} MATCHES .*clang.*)
set(CMAKE_CXX_COMPILER $ENV{CC})
else()
find_program(CMAKE_C_COMPILER clang)
endif()
if (DEFINED ENV{CLANG_CXX})
set(CMAKE_C_COMPILER $ENV{CLANG_CXX})
elseif ($ENV{CXX} MATCHES .*clang.*)
set(CMAKE_C_COMPILER $ENV{CC})
else()
find_program(CMAKE_CXX_COMPILER clang++)
endif()
endif()
if (${cur_component} STREQUAL msvc)
# TBD
endif()
if (${cur_component} STREQUAL unity)
set(unity true)
set(nonunity false)
endif()
if (${cur_component} STREQUAL nounity)
set(unity false)
set(nonunity true)
endif()
if (${cur_component} STREQUAL debug)
set(release false)
endif()
if (${cur_component} STREQUAL release)
set(release true)
endif()
if (${cur_component} STREQUAL coverage)
set(coverage true)
set(debug true)
endif()
if (${cur_component} STREQUAL profile)
set(profile true)
endif()
if (${cur_component} STREQUAL ci)
# Workarounds that make various CI builds work, but that
# we don't want in the general case.
set(ci true)
set(openssl_min 1.0.1)
endif()
endwhile()
if (release)
set(CMAKE_BUILD_TYPE Release)
else()
set(CMAKE_BUILD_TYPE Debug)
endif()
if (NOT unity)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}Classic)
endif()
endif()
endmacro()
############################################################
macro(setup_build_cache)
set(san "" CACHE STRING "On gcc & clang, add sanitizer
instrumentation")
set_property(CACHE san PROPERTY STRINGS ";address;thread")
set(assert false CACHE BOOL "Enables asserts, even in release builds")
set(static false CACHE BOOL
"On linux, link protobuf, openssl, libc++, and boost statically")
if (static AND (WIN32 OR APPLE))
message(FATAL_ERROR "Static linking is only supported on linux.")
endif()
if (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
# Can't exclude files from configurations, so can't support both
# unity and nonunity configurations at the same time
if (NOT DEFINED unity OR unity)
set(CMAKE_CONFIGURATION_TYPES
Debug
Release)
else()
set(CMAKE_CONFIGURATION_TYPES
DebugClassic
ReleaseClassic)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_BUILD_TYPE DebugClassic)
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release")
set(CMAKE_BUILD_TYPE ReleaseClassic)
endif()
endif()
set(CMAKE_CONFIGURATION_TYPES
${CMAKE_CONFIGURATION_TYPES} CACHE STRING "" FORCE)
endmacro()
############################################################
function(prepend var prefix)
set(listVar "")
foreach(f ${ARGN})
list(APPEND listVar "${prefix}${f}")
endforeach(f)
set(${var} "${listVar}" PARENT_SCOPE)
endfunction()
macro(append_flags name)
foreach (arg ${ARGN})
set(${name} "${${name}} ${arg}")
endforeach()
endmacro()
macro(group_sources curdir)
file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir}
${PROJECT_SOURCE_DIR}/${curdir}/*)
foreach (child ${children})
if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
group_sources(${curdir}/${child})
else()
string(REPLACE "/" "\\" groupname ${curdir})
source_group(${groupname} FILES
${PROJECT_SOURCE_DIR}/${curdir}/${child})
endif()
endforeach()
endmacro()
macro(add_with_props src_var files)
list(APPEND ${src_var} ${files})
foreach (arg ${ARGN})
set(props "${props} ${arg}")
endforeach()
set_source_files_properties(
${files}
PROPERTIES COMPILE_FLAGS
${props})
endmacro()
############################################################
macro(determine_build_type)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang") # both Clang and AppleClang
set(is_clang true)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(is_gcc true)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(is_msvc true)
endif()
if (${CMAKE_GENERATOR} STREQUAL "Xcode")
set(is_xcode true)
else()
set(is_xcode false)
endif()
if (NOT is_gcc AND NOT is_clang AND NOT is_msvc)
message("Current compiler is ${CMAKE_CXX_COMPILER_ID}")
message(FATAL_ERROR "Missing compiler. Must be GNU, Clang, or MSVC")
endif()
endmacro()
############################################################
macro(check_gcc4_abi)
# Check if should use gcc4's ABI
set(gcc4_abi false)
if ($ENV{RIPPLED_OLD_GCC_ABI})
set(gcc4_abi true)
endif()
if (is_gcc AND NOT gcc4_abi)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5)
execute_process(COMMAND lsb_release -si OUTPUT_VARIABLE lsb)
string(STRIP "${lsb}" lsb)
if ("${lsb}" STREQUAL "Ubuntu")
execute_process(COMMAND lsb_release -sr OUTPUT_VARIABLE lsb)
string(STRIP ${lsb} lsb)
if (${lsb} VERSION_LESS 15.1)
set(gcc4_abi true)
endif()
endif()
endif()
endif()
if (gcc4_abi)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
endif()
endmacro()
############################################################
macro(special_build_flags)
if (coverage)
add_compile_options(-fprofile-arcs -ftest-coverage)
append_flags(CMAKE_EXE_LINKER_FLAGS -fprofile-arcs -ftest-coverage)
endif()
if (profile)
add_compile_options(-p -pg)
append_flags(CMAKE_EXE_LINKER_FLAGS -p -pg)
endif()
endmacro()
############################################################
# Params: Boost components to search for.
macro(use_boost)
if ((NOT DEFINED BOOST_ROOT) AND (DEFINED ENV{BOOST_ROOT}))
set(BOOST_ROOT $ENV{BOOST_ROOT})
endif()
if(WIN32 OR CYGWIN)
# Workaround for MSVC having two boost versions - x86 and x64 on same PC in stage folders
if(DEFINED BOOST_ROOT)
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND IS_DIRECTORY ${BOOST_ROOT}/stage64/lib)
set(Boost_LIBRARY_DIR ${BOOST_ROOT}/stage64/lib)
else()
set(Boost_LIBRARY_DIR ${BOOST_ROOT}/stage/lib)
endif()
endif()
endif()
if (is_clang AND DEFINED ENV{CLANG_BOOST_ROOT})
set(BOOST_ROOT $ENV{CLANG_BOOST_ROOT})
endif()
set(Boost_USE_STATIC_LIBS on)
set(Boost_USE_MULTITHREADED on)
set(Boost_USE_STATIC_RUNTIME off)
find_package(Boost COMPONENTS
${ARGN})
if (Boost_FOUND OR
((CYGWIN OR WIN32) AND Boost_INCLUDE_DIRS AND Boost_LIBRARY_DIRS))
if(NOT Boost_FOUND)
message(WARNING "Boost directory found, but not all components. May not be able to build.")
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
else()
message(FATAL_ERROR "Boost not found")
endif()
endmacro()
macro(use_pthread)
if (NOT WIN32)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
add_compile_options(${CMAKE_THREAD_LIBS_INIT})
endif()
endmacro()
macro(use_openssl openssl_min)
if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR})
find_program(HOMEBREW brew)
if (NOT HOMEBREW STREQUAL "HOMEBREW-NOTFOUND")
execute_process(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
if (WIN32)
if (DEFINED ENV{OPENSSL_ROOT})
include_directories($ENV{OPENSSL_ROOT}/include)
link_directories($ENV{OPENSSL_ROOT}/lib)
endif()
else()
if (static)
set(tmp CMAKE_FIND_LIBRARY_SUFFIXES)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
find_package(OpenSSL)
if (static)
set(CMAKE_FIND_LIBRARY_SUFFIXES tmp)
endif()
if (OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})
else()
message(FATAL_ERROR "OpenSSL not found")
endif()
if (UNIX AND NOT APPLE AND ${OPENSSL_VERSION} VERSION_LESS ${openssl_min})
message(FATAL_ERROR
"Your openssl is Version: ${OPENSSL_VERSION}, ${openssl_min} or better is required.")
endif()
endif()
endmacro()
macro(use_protobuf)
if (WIN32)
if (DEFINED ENV{PROTOBUF_ROOT})
include_directories($ENV{PROTOBUF_ROOT}/src)
link_directories($ENV{PROTOBUF_ROOT}/src/.libs)
endif()
# Modified from FindProtobuf.cmake
FUNCTION(PROTOBUF_GENERATE_CPP SRCS HDRS PROTOFILES)
# argument parsing
IF(NOT PROTOFILES)
MESSAGE(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
RETURN()
ENDIF()
SET(OUTPATH ${CMAKE_CURRENT_BINARY_DIR})
SET(PROTOROOT ${CMAKE_CURRENT_SOURCE_DIR})
# the real logic
SET(${SRCS})
SET(${HDRS})
FOREACH(PROTOFILE ${PROTOFILES})
# ensure that the file ends with .proto
STRING(REGEX MATCH "\\.proto$$" PROTOEND ${PROTOFILE})
IF(NOT PROTOEND)
MESSAGE(SEND_ERROR "Proto file '${PROTOFILE}' does not end with .proto")
ENDIF()
GET_FILENAME_COMPONENT(PROTO_PATH ${PROTOFILE} PATH)
GET_FILENAME_COMPONENT(ABS_FILE ${PROTOFILE} ABSOLUTE)
GET_FILENAME_COMPONENT(FILE_WE ${PROTOFILE} NAME_WE)
STRING(REGEX MATCH "^${PROTOROOT}" IN_ROOT_PATH ${PROTOFILE})
STRING(REGEX MATCH "^${PROTOROOT}" IN_ROOT_ABS_FILE ${ABS_FILE})
IF(IN_ROOT_PATH)
SET(MATCH_PATH ${PROTOFILE})
ELSEIF(IN_ROOT_ABS_FILE)
SET(MATCH_PATH ${ABS_FILE})
ELSE()
MESSAGE(SEND_ERROR "Proto file '${PROTOFILE}' is not in protoroot '${PROTOROOT}'")
ENDIF()
# build the result file name
STRING(REGEX REPLACE "^${PROTOROOT}(/?)" "" ROOT_CLEANED_FILE ${MATCH_PATH})
STRING(REGEX REPLACE "\\.proto$$" "" EXT_CLEANED_FILE ${ROOT_CLEANED_FILE})
SET(CPP_FILE "${OUTPATH}/${EXT_CLEANED_FILE}.pb.cc")
SET(H_FILE "${OUTPATH}/${EXT_CLEANED_FILE}.pb.h")
LIST(APPEND ${SRCS} "${CPP_FILE}")
LIST(APPEND ${HDRS} "${H_FILE}")
ADD_CUSTOM_COMMAND(
OUTPUT "${CPP_FILE}" "${H_FILE}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPATH}
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS "--cpp_out=${OUTPATH}" --proto_path "${PROTOROOT}" "${MATCH_PATH}"
DEPENDS ${ABS_FILE}
COMMENT "Running C++ protocol buffer compiler on ${MATCH_PATH} with root ${PROTOROOT}, generating: ${CPP_FILE}"
VERBATIM)
ENDFOREACH()
SET_SOURCE_FILES_PROPERTIES(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
SET(${SRCS} ${${SRCS}} PARENT_SCOPE)
SET(${HDRS} ${${HDRS}} PARENT_SCOPE)
ENDFUNCTION()
set(PROTOBUF_PROTOC_EXECUTABLE Protoc) # must be on path
else()
if (static)
set(tmp CMAKE_FIND_LIBRARY_SUFFIXES)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
find_package(Protobuf REQUIRED)
if (static)
set(CMAKE_FIND_LIBRARY_SUFFIXES tmp)
endif()
if (is_clang AND DEFINED ENV{CLANG_PROTOBUF_ROOT})
link_directories($ENV{CLANG_PROTOBUF_ROOT}/src/.libs)
include_directories($ENV{CLANG_PROTOBUF_ROOT}/src)
else()
include_directories(${PROTOBUF_INCLUDE_DIRS})
endif()
endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR})
file(GLOB ripple_proto src/ripple/proto/*.proto)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${ripple_proto})
if (WIN32)
include_directories(src/protobuf/src
src/protobuf/vsprojects
${CMAKE_CURRENT_BINARY_DIR}/src/ripple/proto)
endif()
endmacro()
############################################################
macro(setup_build_boilerplate)
if (NOT WIN32 AND san)
add_compile_options(-fsanitize=${san} -fno-omit-frame-pointer)
append_flags(CMAKE_EXE_LINKER_FLAGS
-fsanitize=${san})
string(TOLOWER ${san} ci_san)
if (${ci_san} STREQUAL address)
set(SANITIZER_LIBRARIES asan)
add_definitions(-DSANITIZER=ASAN)
endif()
if (${ci_san} STREQUAL thread)
set(SANITIZER_LIBRARIES tsan)
add_definitions(-DSANITIZER=TSAN)
endif()
endif()
############################################################
add_definitions(
-DOPENSSL_NO_SSL2
-DDEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
-DHAVE_USLEEP=1
-DSOCI_CXX_C11=1
-D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
-DBOOST_NO_AUTO_PTR
)
if (is_gcc)
add_compile_options(-Wno-unused-but-set-variable -Wno-deprecated)
endif()
# Generator expressions are not supported in add_definitions, use set_property instead
set_property(
DIRECTORY
APPEND
PROPERTY COMPILE_DEFINITIONS
$<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:DEBUG _DEBUG>)
if (NOT assert)
set_property(
DIRECTORY
APPEND
PROPERTY COMPILE_DEFINITIONS
$<$<OR:$<BOOL:${profile}>,$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:NDEBUG>)
endif()
if (NOT WIN32)
add_definitions(-D_FILE_OFFSET_BITS=64)
append_flags(CMAKE_CXX_FLAGS -frtti -std=c++14 -Wno-invalid-offsetof
-DBOOST_COROUTINE_NO_DEPRECATION_WARNING -DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
add_compile_options(-Wall -Wno-sign-compare -Wno-char-subscripts -Wno-format
-Wno-unused-local-typedefs -g)
# There seems to be an issue using generator experssions with multiple values,
# split the expression
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:-O3>)
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:-fno-strict-aliasing>)
append_flags(CMAKE_EXE_LINKER_FLAGS -rdynamic -g)
if (is_clang)
add_compile_options(
-Wno-redeclared-class-member -Wno-mismatched-tags -Wno-deprecated-register)
add_definitions(-DBOOST_ASIO_HAS_STD_ARRAY)
endif()
if (APPLE)
add_definitions(-DBEAST_COMPILE_OBJECTIVE_CPP=1
-DNO_LOG_UNHANDLED_EXCEPTIONS)
add_compile_options(
-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-variable -Wno-unused-function)
endif()
if (is_gcc)
add_compile_options(-Wno-unused-but-set-variable -Wno-unused-local-typedefs)
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:-O0>)
endif (is_gcc)
else(NOT WIN32)
add_compile_options(
/bigobj # Increase object file max size
/EHa # ExceptionHandling all
/fp:precise # Floating point behavior
/Gd # __cdecl calling convention
/Gm- # Minimal rebuild: disabled
/GR # Enable RTTI
/Gy- # Function level linking: disabled
/FS
/MP # Multiprocessor compilation
/openmp- # pragma omp: disabled
/Zc:forScope # Language extension: for scope
/Zi # Generate complete debug info
/errorReport:none # No error reporting to Internet
/nologo # Suppress login banner
/W3 # Warning level 3
/WX- # Disable warnings as errors
/wd"4018"
/wd"4244"
/wd"4267"
/wd"4800" # Disable C4800(int to bool performance)
/wd"4503" # Decorated name length exceeded, name was truncated
)
add_definitions(
-D_WIN32_WINNT=0x6000
-D_SCL_SECURE_NO_WARNINGS
-D_CRT_SECURE_NO_WARNINGS
-DWIN32_CONSOLE
-DNOMINMAX
-DBOOST_COROUTINE_NO_DEPRECATION_WARNING
-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
append_flags(CMAKE_EXE_LINKER_FLAGS
/DEBUG
/DYNAMICBASE
/ERRORREPORT:NONE
/MACHINE:X64
/MANIFEST
/nologo
/NXCOMPAT
/SUBSYSTEM:CONSOLE
/TLBID:1)
# There seems to be an issue using generator experssions with multiple values,
# split the expression
# /GS Buffers security check: enable
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:/GS>)
# /MTd Language: Multi-threaded Debug CRT
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:/MTd>)
# /Od Optimization: Disabled
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:/Od>)
# /RTC1 Run-time error checks:
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:/RTC1>)
# Generator expressions are not supported in add_definitions, use set_property instead
set_property(
DIRECTORY
APPEND
PROPERTY COMPILE_DEFINITIONS
$<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:_CRTDBG_MAP_ALLOC>)
# /MT Language: Multi-threaded CRT
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:/MT>)
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:/Ox>)
# /Ox Optimization: Full
endif (NOT WIN32)
if (static)
append_flags(CMAKE_EXE_LINKER_FLAGS -static-libstdc++)
# set_target_properties(ripple-libpp PROPERTIES LINK_SEARCH_START_STATIC 1)
# set_target_properties(ripple-libpp PROPERTIES LINK_SEARCH_END_STATIC 1)
endif()
endmacro()
############################################################
macro(create_build_folder cur_project)
if (NOT WIN32)
ADD_CUSTOM_TARGET(build_folder ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Creating build output folder")
add_dependencies(${cur_project} build_folder)
endif()
endmacro()
macro(set_startup_project cur_project)
if (WIN32 AND NOT ci)
if (CMAKE_VERSION VERSION_LESS 3.6)
message(WARNING
"Setting the VS startup project requires cmake 3.6 or later. Please upgrade.")
endif()
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY
VS_STARTUP_PROJECT ${cur_project})
endif()
endmacro()
macro(link_common_libraries cur_project)
if (NOT MSVC)
target_link_libraries(${cur_project} ${Boost_LIBRARIES})
target_link_libraries(${cur_project} dl)
target_link_libraries(${cur_project} Threads::Threads)
if (APPLE)
find_library(app_kit AppKit)
find_library(foundation Foundation)
target_link_libraries(${cur_project}
crypto ssl ${app_kit} ${foundation})
else()
target_link_libraries(${cur_project} rt)
endif()
else(NOT MSVC)
target_link_libraries(${cur_project}
$<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:VC/static/ssleay32MTd>
$<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:VC/static/libeay32MTd>)
target_link_libraries(${cur_project}
$<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:VC/static/ssleay32MT>
$<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:VC/static/libeay32MT>)
target_link_libraries(${cur_project}
legacy_stdio_definitions.lib Shlwapi kernel32 user32 gdi32 winspool comdlg32
advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32)
endif (NOT MSVC)
endmacro()

30
Builds/Docker/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# rippled
# use the ubuntu base image
FROM ubuntu
MAINTAINER Roberto Catini roberto.catini@gmail.com
# make sure the package repository is up to date
RUN apt-get update
RUN apt-get -y upgrade
# install the dependencies
RUN apt-get -y install git scons pkg-config protobuf-compiler libprotobuf-dev libssl-dev libboost1.55-all-dev
# download source code from official repository
RUN git clone https://github.com/ripple/rippled.git src; cd src/; git checkout master
# compile
RUN cd src/; scons build/rippled
# move to root directory and strip
RUN cp src/build/rippled rippled; strip rippled
# copy default config
RUN cp src/doc/rippled-example.cfg rippled.cfg
# clean source
RUN rm -r src
# launch rippled when launching the container
ENTRYPOINT ./rippled

View File

@@ -0,0 +1,23 @@
FROM ubuntu
MAINTAINER Torrie Fischer <torrie@ripple.com>
RUN apt-get update -qq &&\
apt-get install -qq software-properties-common &&\
apt-add-repository -y ppa:ubuntu-toolchain-r/test &&\
apt-add-repository -y ppa:afrank/boost &&\
apt-get update -qq
RUN apt-get purge -qq libboost1.48-dev &&\
apt-get install -qq libprotobuf8 libboost1.57-all-dev
RUN mkdir -p /srv/rippled/data
VOLUME /srv/rippled/data/
ENTRYPOINT ["/srv/rippled/bin/rippled"]
CMD ["--conf", "/srv/rippled/data/rippled.cfg"]
EXPOSE 51235/udp
EXPOSE 5005/tcp
ADD ./rippled.cfg /srv/rippled/data/rippled.cfg
ADD ./rippled /srv/rippled/bin/

13
Builds/Docker/build-ci.sh Executable file
View File

@@ -0,0 +1,13 @@
set -e
mkdir -p build/docker/
cp doc/rippled-example.cfg build/clang.debug/rippled build/docker/
cp Builds/Docker/Dockerfile-testnet build/docker/Dockerfile
mv build/docker/rippled-example.cfg build/docker/rippled.cfg
strip build/docker/rippled
docker build -t ripple/rippled:$CIRCLE_SHA1 build/docker/
docker tag ripple/rippled:$CIRCLE_SHA1 ripple/rippled:latest
if [ -z "$CIRCLE_PR_NUMBER" ]; then
docker tag ripple/rippled:$CIRCLE_SHA1 ripple/rippled:$CIRCLE_BRANCH
fi

16
Builds/Docker/push-to-hub.sh Executable file
View File

@@ -0,0 +1,16 @@
set -e
if [ -z "$DOCKER_EMAIL" -o -z "$DOCKER_USERNAME" -o -z "$DOCKER_PASSWORD" ];then
echo "Docker credentials are not set. Can't login to docker, no containers will be pushed."
exit 0
fi
if [ -n "$CIRCLE_PR_NUMBER" ]; then
echo "Not pushing results of a pull request build."
exit 0
fi
docker login -e $DOCKER_EMAIL -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push ripple/rippled:$CIRCLE_SHA1
docker push ripple/rippled:$CIRCLE_BRANCH
docker push ripple/rippled:latest

31
Builds/Eclipse/README.md Normal file
View File

@@ -0,0 +1,31 @@
**Requirements**
1. Java Runtime Environment (JRE)
2. Eclipse with CDT (tested on Luna):
http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunasr2
3. Eclipse SCons plugin: http://sconsolidator.com/
**WARNING**: by default the SCons plugin uses 16 threads. Go to
*Window->Preferences->SCons->Build Settings* in Eclipse and make it
use only 4-8 jobs(threads) or whatever you feel confortable with. It will
positively freeze your system if you run with 16 threads/jobs.
![scons](scons.png)
**Getting Started**
After setting up Eclipse just do a File->New->Other...
Select: C/C++ / New SCons project from existing source
Point the importer to the folder where the SConstruct resides (the root
folder of your git workspace normally)
**Build**
Just hit Project->Build All in Eclipse to get started. And remember to not
let it run 16 threads!
**Debug**
Start a new Eclipse debug configuration and set binary to run to build/rippled
(assuming you have built it).
![debug](debug.png)

BIN
Builds/Eclipse/debug.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
Builds/Eclipse/scons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# This scripts installs the dependencies needed by rippled. It should be run
# with sudo.
#
if [ ! -f /etc/fedora-release ]; then
echo "This script is meant to be run on fedora"
exit 1
fi
fedora_release=$(grep -o '[0-9]*' /etc/fedora-release)
if (( $(bc <<< "${fedora_release} < 22") )); then
echo "This script is meant to run on fedora 22 or greater"
exit 1
fi
yum -y update
yum -y group install "Development Tools"
yum -y install gcc-c++ scons openssl-devel openssl-static protobuf-devel protobuf-static boost-devel boost-static libstdc++-static

View File

@@ -62,42 +62,42 @@ UI_HEADERS_DIR += ../../src/ripple_basics
# New style
#
SOURCES += \
../../src/ripple/beast/ripple_beast.cpp \
../../src/ripple/beast/ripple_beast.unity.cpp \
../../src/ripple/beast/ripple_beastc.c \
../../src/ripple/common/ripple_common.cpp \
../../src/ripple/http/ripple_http.cpp \
../../src/ripple/json/ripple_json.cpp \
../../src/ripple/peerfinder/ripple_peerfinder.cpp \
../../src/ripple/radmap/ripple_radmap.cpp \
../../src/ripple/resource/ripple_resource.cpp \
../../src/ripple/sitefiles/ripple_sitefiles.cpp \
../../src/ripple/sslutil/ripple_sslutil.cpp \
../../src/ripple/testoverlay/ripple_testoverlay.cpp \
../../src/ripple/types/ripple_types.cpp \
../../src/ripple/validators/ripple_validators.cpp
../../src/ripple/common/ripple_common.unity.cpp \
../../src/ripple/http/ripple_http.unity.cpp \
../../src/ripple/json/ripple_json.unity.cpp \
../../src/ripple/peerfinder/ripple_peerfinder.unity.cpp \
../../src/ripple/radmap/ripple_radmap.unity.cpp \
../../src/ripple/resource/ripple_resource.unity.cpp \
../../src/ripple/sitefiles/ripple_sitefiles.unity.cpp \
../../src/ripple/sslutil/ripple_sslutil.unity.cpp \
../../src/ripple/testoverlay/ripple_testoverlay.unity.cpp \
../../src/ripple/types/ripple_types.unity.cpp \
../../src/ripple/validators/ripple_validators.unity.cpp
# ---------
# Old style
#
SOURCES += \
../../src/ripple_app/ripple_app.cpp \
../../src/ripple_app/ripple_app_pt1.cpp \
../../src/ripple_app/ripple_app_pt2.cpp \
../../src/ripple_app/ripple_app_pt3.cpp \
../../src/ripple_app/ripple_app_pt4.cpp \
../../src/ripple_app/ripple_app_pt5.cpp \
../../src/ripple_app/ripple_app_pt6.cpp \
../../src/ripple_app/ripple_app_pt7.cpp \
../../src/ripple_app/ripple_app_pt8.cpp \
../../src/ripple_basics/ripple_basics.cpp \
../../src/ripple_core/ripple_core.cpp \
../../src/ripple_data/ripple_data.cpp \
../../src/ripple_hyperleveldb/ripple_hyperleveldb.cpp \
../../src/ripple_leveldb/ripple_leveldb.cpp \
../../src/ripple_net/ripple_net.cpp \
../../src/ripple_overlay/ripple_overlay.cpp \
../../src/ripple_rpc/ripple_rpc.cpp \
../../src/ripple_websocket/ripple_websocket.cpp
../../src/ripple_app/ripple_app.unity.cpp \
../../src/ripple_app/ripple_app_pt1.unity.cpp \
../../src/ripple_app/ripple_app_pt2.unity.cpp \
../../src/ripple_app/ripple_app_pt3.unity.cpp \
../../src/ripple_app/ripple_app_pt4.unity.cpp \
../../src/ripple_app/ripple_app_pt5.unity.cpp \
../../src/ripple_app/ripple_app_pt6.unity.cpp \
../../src/ripple_app/ripple_app_pt7.unity.cpp \
../../src/ripple_app/ripple_app_pt8.unity.cpp \
../../src/ripple_basics/ripple_basics.unity.cpp \
../../src/ripple_core/ripple_core.unity.cpp \
../../src/ripple_data/ripple_data.unity.cpp \
../../src/ripple_hyperleveldb/ripple_hyperleveldb.unity.cpp \
../../src/ripple_leveldb/ripple_leveldb.unity.cpp \
../../src/ripple_net/ripple_net.unity.cpp \
../../src/ripple_overlay/ripple_overlay.unity.cpp \
../../src/ripple_rpc/ripple_rpc.unity.cpp \
../../src/ripple_websocket/ripple_websocket.unity.cpp
LIBS += \
-lboost_date_time-mt\

266
Builds/Test.py Executable file
View File

@@ -0,0 +1,266 @@
#!/usr/bin/env python
# This file is part of rippled: https://github.com/ripple/rippled
# Copyright (c) 2012 - 2015 Ripple Labs Inc.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""
Invocation:
./Builds/Test.py - builds and tests all configurations
The build must succeed without shell aliases for this to work.
To pass flags to scons, put them at the very end of the command line, after
the -- flag - like this:
./Builds/Test.py -- -j4 # Pass -j4 to scons.
Common problems:
1) Boost not found. Solution: export BOOST_ROOT=[path to boost folder]
2) OpenSSL not found. Solution: export OPENSSL_ROOT=[path to OpenSSL folder]
3) scons is an alias. Solution: Create a script named "scons" somewhere in
your $PATH (eg. ~/bin/scons will often work).
#!/bin/sh
python /C/Python27/Scripts/scons.py "${@}"
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import itertools
import os
import platform
import re
import shutil
import sys
import subprocess
def powerset(iterable):
"""powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"""
s = list(iterable)
return itertools.chain.from_iterable(itertools.combinations(s, r) for r in range(len(s) + 1))
IS_WINDOWS = platform.system().lower() == 'windows'
IS_OS_X = platform.system().lower() == 'darwin'
if IS_WINDOWS or IS_OS_X:
ALL_TARGETS = [('debug',), ('release',)]
else:
ALL_TARGETS = [(cc + "." + target,)
for cc in ['gcc', 'clang']
for target in ['debug', 'release', 'coverage', 'profile',
'debug.nounity', 'release.nounity', 'coverage.nounity', 'profile.nounity']]
# list of tuples of all possible options
if IS_WINDOWS or IS_OS_X:
ALL_OPTIONS = [tuple(x) for x in powerset(['--assert'])]
else:
ALL_OPTIONS = list(set(
[tuple(x) for x in powerset(['--ninja', '--static', '--assert', '--sanitize=address'])] +
[tuple(x) for x in powerset(['--ninja', '--static', '--assert', '--sanitize=thread'])]))
# list of tuples of all possible options + all possible targets
ALL_BUILDS = [options + target
for target in ALL_TARGETS
for options in ALL_OPTIONS]
parser = argparse.ArgumentParser(
description='Test.py - run ripple tests'
)
parser.add_argument(
'--all', '-a',
action='store_true',
help='Build all configurations.',
)
parser.add_argument(
'--keep_going', '-k',
action='store_true',
help='Keep going after one configuration has failed.',
)
parser.add_argument(
'--silent', '-s',
action='store_true',
help='Silence all messages except errors',
)
parser.add_argument(
'--verbose', '-v',
action='store_true',
help=('Report more information about which commands are executed and the '
'results.'),
)
parser.add_argument(
'--test', '-t',
default='',
help='Add a prefix for unit tests',
)
parser.add_argument(
'--clean', '-c',
action='store_true',
help='delete all build artifacts after testing',
)
parser.add_argument(
'scons_args',
default=(),
nargs='*'
)
ARGS = parser.parse_args()
def shell(cmd, args=(), silent=False):
""""Execute a shell command and return the output."""
silent = ARGS.silent or silent
verbose = not silent and ARGS.verbose
if verbose:
print('$' + cmd, *args)
command = (cmd,) + args
process = subprocess.Popen(
command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=IS_WINDOWS)
lines = []
count = 0
for line in process.stdout:
# Python 2 vs. Python 3
if isinstance(line, str):
decoded = line
else:
decoded = line.decode()
lines.append(decoded)
if verbose:
print(decoded, end='')
elif not silent:
count += 1
if count >= 80:
print()
count = 0
else:
print('.', end='')
if not verbose and count:
print()
process.wait()
return process.returncode, lines
def run_tests(args):
failed = []
if IS_WINDOWS:
binary_re = re.compile(r'build\\([^\\]+)\\rippled.exe')
else:
binary_re = re.compile(r'build/([^/]+)/rippled')
_, lines = shell('scons', ('-n', '--tree=derived',) + args, silent=True)
for line in lines:
match = binary_re.search(line)
if match:
executable, target = match.group(0, 1)
print('Unit tests for', target)
testflag = '--unittest'
if ARGS.test:
testflag += ('=' + ARGS.test)
resultcode, lines = shell(executable, (testflag,))
if resultcode:
if not ARGS.verbose:
print('ERROR:', *lines, sep='')
failed.append([target, 'unittest'])
if not ARGS.keep_going:
break
return failed
def run_build(args=None):
print('Building:', *args or ('(default)',))
resultcode, lines = shell('scons', args)
if resultcode:
print('Build FAILED:')
if not ARGS.verbose:
print(*lines, sep='')
sys.exit(1)
if '--ninja' in args:
resultcode, lines = shell('ninja')
if resultcode:
print('Ninja build FAILED:')
if not ARGS.verbose:
print(*lines, sep='')
sys.exit(1)
def main():
if ARGS.all:
to_build = ALL_BUILDS
else:
to_build = [tuple(ARGS.scons_args)]
all_failed = []
for build in to_build:
args = ()
# additional arguments come first
for arg in list(ARGS.scons_args):
if arg not in build:
args += (arg,)
args += build
run_build(args)
failed = run_tests(args)
if failed:
print('FAILED:', *(':'.join(f) for f in failed))
if not ARGS.keep_going:
sys.exit(1)
else:
all_failed.extend([','.join(build), ':'.join(f)]
for f in failed)
else:
print('Success')
if ARGS.clean:
shutil.rmtree('build')
if '--ninja' in args:
os.remove('build.ninja')
os.remove('.ninja_deps')
os.remove('.ninja_log')
if all_failed:
if len(to_build) > 1:
print()
print('FAILED:', *(':'.join(f) for f in all_failed))
sys.exit(1)
if __name__ == '__main__':
main()
sys.exit(0)

View File

@@ -0,0 +1,82 @@
#!/usr/bin/env bash
#
# This scripts installs boost and protobuf built with clang. This is needed on
# ubuntu 15.10 when building with clang
# It will build these in a 'clang' subdirectory that it creates below the directory
# this script is run from. If a clang directory already exists the script will refuse
# to run.
if hash lsb_release 2>/dev/null; then
if [ $(lsb_release -si) == "Ubuntu" ]; then
ubuntu_release=$(lsb_release -sr)
fi
fi
if [ -z "${ubuntu_release}" ]; then
echo "System not supported"
exit 1
fi
if ! hash clang 2>/dev/null; then
clang_version=3.7
if [ ${ubuntu_release} == "16.04" ]; then
clang_version=3.8
fi
sudo apt-get -y install clang-${clang_version}
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${clang_version} 99 clang++
hash -r
if ! hash clang 2>/dev/null; then
echo "Please install clang"
exit 1
fi
fi
if [ ${ubuntu_release} != "16.04" ] && [ ${ubuntu_release} != "15.10" ]; then
echo "clang specific boost and protobuf not needed"
exit 0
fi
if [ -d clang ]; then
echo "clang directory already exists. Cowardly refusing to run"
exit 1
fi
if ! hash wget 2>/dev/null; then
sudo apt-get -y install wget
hash -r
if ! hash wget 2>/dev/null; then
echo "Please install wget"
exit 1
fi
fi
num_procs=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l) # pysical cores
mkdir clang
pushd clang > /dev/null
# Install protobuf
pb=protobuf-2.6.1
pb_tar=${pb}.tar.gz
wget -O ${pb_tar} https://github.com/google/protobuf/releases/download/v2.6.1/${pb_tar}
tar xf ${pb_tar}
rm ${pb_tar}
pushd ${pb} > /dev/null
./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++14 -O3 -g'
make -j${num_procs}
popd > /dev/null
# Install boost
boost_ver=1.60.0
bd=boost_${boost_ver//./_}
bd_tar=${bd}.tar.gz
wget -O ${bd_tar} http://sourceforge.net/projects/boost/files/boost/${boost_ver}/${bd_tar}
tar xf ${bd_tar}
rm ${bd_tar}
pushd ${bd} > /dev/null
./bootstrap.sh
./b2 toolset=clang -j${num_procs}
popd > /dev/null
popd > /dev/null

39
Builds/Ubuntu/install_boost.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# This script builds boost with the correct ABI flags for ubuntu
#
version=59
patch=0
if hash lsb_release 2>/dev/null; then
if [ $(lsb_release -si) == "Ubuntu" ]; then
ubuntu_release=$(lsb_release -sr)
fi
fi
if [ -z "${ubuntu_release}" ]; then
echo "System not supported"
exit 1
fi
extra_defines=""
if (( $(bc <<< "${ubuntu_release} < 15.1") )); then
extra_defines="define=_GLIBCXX_USE_CXX11_ABI=0"
fi
num_procs=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l) # pysical cores
printf "\nBuild command will be: ./b2 -j${num_procs} ${extra_defines}\n\n"
boost_dir="boost_1_${version}_${patch}"
boost_tag="boost-1.${version}.${patch}"
git clone -b "${boost_tag}" --recursive https://github.com/boostorg/boost.git "${boost_dir}"
cd ${boost_dir}
git checkout --force ${boost_tag}
git submodule foreach git checkout --force ${boost_tag}
./bootstrap.sh
./b2 headers
./b2 -j${num_procs} ${extra_defines}
echo "Build command was: ./b2 -j${num_procs} ${extra_defines}"
echo "Don't forget to set BOOST_ROOT!"

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
#
# This scripts installs the dependencies needed by rippled. It should be run
# with sudo. For ubuntu < 15.10, it installs gcc 5 as the default compiler. gcc
# 5 is ABI incompatable with gcc 4. If needed, the following will switch back to
# gcc-4: `sudo update-alternatives --config gcc` and choosing the gcc-4
# option.
#
if hash lsb_release 2>/dev/null; then
if [ $(lsb_release -si) == "Ubuntu" ]; then
ubuntu_release=$(lsb_release -sr)
fi
fi
if [ -z "${ubuntu_release}" ]; then
echo "System not supported"
exit 1
fi
if [ ${ubuntu_release} == "12.04" ]; then
apt-get install python-software-properties
add-apt-repository ppa:afrank/boost
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get -y upgrade
apt-get -y install curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties boost1.57-all-dev g++-5 g++-4.9
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 99 --slave /usr/bin/g++ g++ /usr/bin/g++-5
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 99 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
exit 0
fi
if [ ${ubuntu_release} == "14.04" ] || [ ${ubuntu_release} == "15.04" ]; then
apt-get install python-software-properties
echo "deb [arch=amd64] https://mirrors.ripple.com/ubuntu/ trusty stable contrib" | sudo tee /etc/apt/sources.list.d/ripple.list
wget -O- -q https://mirrors.ripple.com/mirrors.ripple.com.gpg.key | sudo apt-key add -
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get -y upgrade
apt-get -y install curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties boost-all-dev g++-5 g++-4.9
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 99 --slave /usr/bin/g++ g++ /usr/bin/g++-5
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 99 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
exit 0
fi
if [ ${ubuntu_release} == "16.04" ] || [ ${ubuntu_release} == "15.10" ]; then
apt-get update
apt-get -y upgrade
apt-get -y install python-software-properties curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties libboost-all-dev
exit 0
fi
echo "System not supported"
exit 1

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<RepoDir>..\..</RepoDir>
</PropertyGroup>
<PropertyGroup>
<OutDir>$(RepoDir)\build\VisualStudio2013\$(Configuration).$(Platform)\</OutDir>
<IntDir>$(RepoDir)\build\obj\VisualStudio2013\$(Configuration).$(Platform)\</IntDir>
<TargetName>rippled</TargetName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_VARIADIC_MAX=10;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(RepoDir)\src\protobuf\src;$(RepoDir)\src\protobuf\vsprojects;$(RepoDir)\src\leveldb;$(RepoDir)\src\leveldb\include;$(RepoDir)\build\proto;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4018;4244</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SpecifySectionAttributes>
</SpecifySectionAttributes>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="RepoDir">
<Value>$(RepoDir)</Value>
</BuildMacro>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup />
<ItemGroup />
</Project>

View File

@@ -1,38 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "beast", "..\..\src\beast\Builds\VisualStudio2013\beast.vcxproj", "{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{B7F39ECD-473C-484D-BC34-31F8362506A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.ActiveCfg = Debug|Win32
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.Build.0 = Debug|Win32
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.ActiveCfg = Debug|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.Build.0 = Debug|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|Win32.ActiveCfg = Release|Win32
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|Win32.Build.0 = Release|Win32
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|x64.ActiveCfg = Release|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|x64.Build.0 = Release|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.ActiveCfg = Debug|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.Build.0 = Debug|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.ActiveCfg = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.Build.0 = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.ActiveCfg = Release|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.Build.0 = Release|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.ActiveCfg = Release|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<DisableSpecificWarnings>4018;4244;4267</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -0,0 +1,4 @@
RippleD.vcxproj -text
RippleD.vcxproj.filters -text

View File

@@ -0,0 +1,255 @@
# Visual Studio 2015 Build Instructions
## Important
We do not recommend Windows for rippled production use at this time. Currently, the Ubuntu
platform has received the highest level of quality assurance, testing, and support.
Additionally, 32-bit Windows versions are not supported.
## Prerequisites
To clone the source code repository, create branches for inspection or modification,
build rippled under Visual Studio, and run the unit tests you will need these
software components:
* [Visual Studio 2015](README.md#install-visual-studio-2015)
* [Git for Windows](README.md#install-git-for-windows)
* [Google Protocol Buffers Compiler](README.md#install-google-protocol-buffers-compiler)
* (Optional) [Python and Scons](README.md#optional-install-python-and-scons)
* [OpenSSL Library](README.md#install-openssl)
* [Boost library](README.md#build-boost)
## Install Software
### Install Visual Studio 2015
If not already installed on your system, download your choice of installer from the
[Visual Studio 2015 Download](https://www.visualstudio.com/downloads/download-visual-studio-vs)
page, run the installer, and follow the directions. You may need to choose a "Custom"
installation and ensure that "Visual C++" is selected under "Programming Languages".
Any version of Visual Studio 2015 may be used to build rippled.
The **Visual Studio 2015 Community** edition is available free of charge (see
[the product page](https://www.visualstudio.com/products/visual-studio-community-vs)
for licensing details), while paid editions may be used for an free initial trial period.
### Install Git for Windows
Git is a distributed revision control system. The Windows version also provides the
bash shell and many Windows versions of Unix commands. While there are other
varieties of Git (such as TortoiseGit, which has a native Windows interface and
integrates with the Explorer shell), we recommend installing
[Git for Windows](https://git-scm.com/) since
it provides a Unix-like command line environment useful for running shell scripts.
Use of the bash shell under Windows is mandatory for running the unit tests.
* NOTE: To gain full featured access to the
[git-subtree](https://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/)
functionality used in the rippled repository we suggest Git version 2.6.2 or later.
### Install Google Protocol Buffers Compiler
Building rippled requires **protoc.exe** version 2.5.1 or later. At your option you
may build it yourself from the sources in the
[Google Protocol Buffers](https://github.com/google/protobuf) repository,
or you may download a
[protoc.exe](https://ripple.github.io/Downloads/protoc/2.5.1/protoc.exe)
([alternate link](https://github.com/ripple/Downloads/raw/gh-pages/protoc/2.5.1/protoc.exe))
precompiled Windows executable from the
[Ripple Organization](https://github.com/ripple).
Either way, once you have the required version of **protoc.exe**, copy it into
a folder in your command line `%PATH%`.
* **NOTE:** If you use an older version of the compiler, the build will
fail with errors related to a mismatch of the version of protocol
buffer headers versus the compiler.
### (Optional) Install Python and Scons
[Python](https://www.python.org/downloads/) and
[Scons](http://scons.org/download.php) are not required to build
rippled with Visual Studio, but can be used to build from the
command line and in scripts, and are required to properly update
the `RippleD.vcxproj` file.
If you wish to build with scons, a version after 2.3.5 is required
for Visual Studio 2015 support.
## Configure Dependencies
### Install OpenSSL
[Download OpenSSL.](http://slproweb.com/products/Win32OpenSSL.html)
There will be four variants available:
1. 64-bit. Use this if you are running 64-bit windows. As of this writing, the link is called: "Win64 OpenSSL v1.0.2j".
2. 64-bit light - Don't use this. It is missing files needed to build rippled. As of this writing, the link is called: "Win64 OpenSSL v1.0.2j Light"
Run the installer, and choose an appropriate location for your OpenSSL
installation. In this guide we use **C:\lib\OpenSSL-Win64** as the
destination location.
You may be informed on running the installer that "Visual C++ 2008
Redistributables" must first be installed first. If so, download it
from the [same page](http://slproweb.com/products/Win32OpenSSL.html),
again making sure to get the correct 32-/64-bit variant.
* NOTE: Since rippled links statically to OpenSSL, it does not matter
where the OpenSSL .DLL files are placed, or what version they are.
rippled does not use or require any external .DLL files to run
other than the standard operating system ones.
### Build Boost
After [downloading boost](http://www.boost.org/users/download/) and
unpacking it, open a **Developer Command Prompt** for
Visual Studio, change to the directory containing boost, then
bootstrap the build tools:
(As of this writing, the most recent version of boost is 1.62.0, which
will unpack into a directory named `boost_1_62_0`. For higher versions
of boost, adjust the directories provided in these examples as
appropriate.)
```powershell
cd C:\lib\boost_1_62_0
bootstrap
```
The rippled application is linked statically to the standard runtimes and external
dependencies on Windows, to ensure that the behavior of the executable is not
affected by changes in outside files. Therefore, it is necessary to build the
required boost static libraries using this command:
```powershell
bjam --toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared,static stage --stagedir=stage64
```
Building the boost libraries may take considerable time. When the build process
is completed, take note of both the reported compiler include paths and linker
library paths as they will be required later.
* NOTE: If older versions of Visual Studio are also installed, the build may fail.
If this happens, make sure that only Visual Studio 2015 is installed. Due to
defects in the uninstallation procedures of these Microsoft products, it may
be necessary to start with a fresh install of the operating system with only
the necessary development environment components installed to have a successful build.
### Clone the rippled repository
If you are familiar with cloning github repositories, just follow your normal process
and clone `git@github.com:ripple/rippled.git`. Otherwise follow this section for instructions.
1. If you don't have a github account, sign up for one at
[github.com](https://github.com/).
2. Make sure you have Github ssh keys. For help see
[generating-ssh-keys](https://help.github.com/articles/generating-ssh-keys).
Open the "Git Bash" shell that was installed with "Git for Windows" in the
step above. Navigate to the directory where you want to clone rippled (git
bash uses `/c` for windows's `C:` and forward slash where windows uses
backslash, so `C:\Users\joe\projs` would be `/c/Users/joe/projs` in git bash).
Now clone the repository and optionally switch to the *master* branch.
Type the following at the bash prompt:
```powershell
git clone git@github.com:ripple/rippled.git
cd rippled
git checkout master
```
* If you receive an error about not having the "correct access rights"
make sure you have Github ssh keys, as described above.
### Configure Library Paths
Open the solution file located at **Builds/Visual Studio 2015/ripple.sln**
and select the "View->Property Manager" to bring up the Property Manager.
Expand the *debug | x64* section and
double click the *Microsoft.Cpp.x64.user* property sheet to bring up the
*Property Pages* dialog. These are global properties applied to all
64-bit build targets:
![Visual Studio 2015 Global Properties](images/VS2015x64Properties.png)
Go to *C/C++, General, Additional Include Directories* and add the
location of the boost installation:
![Visual Studio 2015 Include Directories](images/VS2015x64IncludeDirs.png)
Then, go to *Linker, General, Additional Library Directories* and add
the location of the compiled boost libraries reported at the completion
of building the boost libraries:
![Visual Studio 2015 Library Directories](images/VS2015x64LibraryDirs.png)
Follow the same procedure for adding the `Additional Include Directories`
and `Additional Library Directories` required for OpenSSL. In our example
these directories are **C:\lib\OpenSSL-Win64\include** and
**C:\lib\OpenSSL-Win64\lib** respectively.
# Setup Environment
## Create a working directory for rippled.cfg
The rippled server uses the [Rippled.cfg](https://wiki.ripple.com/Rippled.cfg)
file to read its configuration parameters. This section describes setting up
a directory to hold the config file. The next sections describe how to tell
the rippled server where that file is.
1. Create a directory to hold the configuration file. In this example, the
ripple config directory was created in `C:\Users\joe\ripple\config`.
2. Copy the example config file located in `doc\rippled-example.cfg` to the
new directory and rename it "rippled.cfg".
3. Read the rippled.cfg file and edit as appropriate.
## Change the Visual Studio Projects Debugging Properties
1. If not already open, open the solution file located at **Builds/Visual Studio 2015/Ripple.sln**
2. Select the correct solution platform in the solution platform dropdown (either *x64*
or *Win32* depending on machine type).
3. Select the "Project->Properties" menu item to bring up RippleD's Properties Pages
4. In "Configuration Properties" select "Debugging".
5. In the upper-left Configurations drop down, select "All Configurations".
6. In "Debugger to Launch" select "Local Windows Debugger".
### Tell rippled where to find the configuration file.
The `--conf` command-line switch to tell rippled where to find this file.
In the "Command Arguments" field in the properties dialog (that you opened
in the above section), add: `--conf="C:/Users/joe/ripple/config/rippled.cfg"`
(of course replacing that path with the path you set up above).
![Visual Studio 2013 Command Args Prop Page](images/VSCommandArgsPropPage.png)
### Set the _NO_DEBUG_HEAP Environment Variable
Rippled can run very slowly in the debugger when using the Windows Debug Heap.
Set the `_NO_DEBUG_HEAP` environment variable to one to disable the debug heap.
In the "Environment" field (that you opened in the above section), add:
`_NO_DEBUG_HEAP=1`
![Visual Studio 2013 No Debug Heap Prop Page](images/NoDebugHeapPropPage.png)
# Build
After these steps are complete, rippled should be ready to build. Simply
set rippled as the startup project by right clicking on it in the
Visual Studio Solution Explorer, choose **Set as Startup Project**,
and then choose the **Build->Build Solution** menu item.
# Unit Tests (Recommended)
The rippled unit tests are written in C++ and are part
of the rippled executable.
From a Windows console, run the unit tests:
```
./build/msvc.debug/rippled.exe --unittest
```
Substitute the correct path to the executable to test different builds.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,36 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug.classic|x64 = debug.classic|x64
debug.classic|x86 = debug.classic|x86
debug|x64 = debug|x64
debug|x86 = debug|x86
release.classic|x64 = release.classic|x64
release.classic|x86 = release.classic|x86
release|x64 = release|x64
release|x86 = release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug.classic|x64.ActiveCfg = debug.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug.classic|x64.Build.0 = debug.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug.classic|x86.ActiveCfg = debug.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug|x64.ActiveCfg = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug|x64.Build.0 = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug|x86.ActiveCfg = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release.classic|x64.ActiveCfg = release.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release.classic|x64.Build.0 = release.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release.classic|x86.ActiveCfg = release.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release|x64.ActiveCfg = release|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release|x64.Build.0 = release|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release|x86.ActiveCfg = release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

177
Builds/XCode/README.md Normal file
View File

@@ -0,0 +1,177 @@
# macos Build Instructions
## Important
We don't recommend OS X for rippled production use at this time. Currently, the
Ubuntu platform has received the highest level of quality assurance and
testing.
## Prerequisites
You'll need OSX 10.8 or later
To clone the source code repository, create branches for inspection or
modification, build rippled using clang, and run the system tests you will need
these software components:
* [XCode](https://developer.apple.com/xcode/)
* [Homebrew](http://brew.sh/)
* [Git](http://git-scm.com/)
* [Scons](http://www.scons.org/)
## Install Software
### Install XCode
If not already installed on your system, download and install XCode using the
appstore or by using [this link](https://developer.apple.com/xcode/).
For more info, see "Step 1: Download and Install the Command Line Tools"
[here](http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac)
The command line tools can be installed through the terminal with the command:
```
xcode-select --install
```
### Install Homebrew
> "[Homebrew](http://brew.sh/) installs the stuff you need that Apple didnt."
Open a terminal and type:
```
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
For more info, see "Step 3: Install Homebrew"
[here](http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac)
### Install Git
```
brew update brew install git
```
For more info, see "Step 4: Install Git"
[here](http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac)
**NOTE**: To gain full featured access to the
[git-subtree](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/)
functionality used in the rippled repository, we suggest Git version 1.8.3.2 or
later.
### Install Scons
Requires version 2.3.0 or later
```
brew install scons
```
`brew` will generally install the latest stable version of any package, which
will satisfy the scons minimum version requirement for rippled.
### Install Package Config
```
brew install pkg-config
```
## Install/Build/Configure Dependencies
### Build Google Protocol Buffers Compiler
Building rippled on osx requires `protoc` version 2.5.x or 2.6.x (later versions
do not work with rippled at this time).
Download [this](https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.bz2)
We want to compile protocol buffers with clang/libc++:
```
tar xfvj protobuf-2.6.1.tar.bz2
cd protobuf-2.6.1
./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
make -j 4
sudo make install
```
If you have installed `protobuf` via brew - either directly or indirectly as a
dependency of some other package - this is likely to conflict with our specific
version requirements. The simplest way to avoid conflicts is to uninstall it.
`brew ls --versions protobuf` will list any versions of protobuf
you currently have installed.
### Install OpenSSL
```
brew install openssl
```
### Build Boost
We want to compile boost with clang/libc++
Download [a release](https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2)
Extract it to a folder, making note of where, open a terminal, then:
```
./bootstrap.sh ./b2 toolset=clang threading=multi runtime-link=static link=static cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" address-model=64
```
Create an environment variable `BOOST_ROOT` in one of your `rc` files, pointing
to the root of the extracted directory.
### Clone the rippled repository
From the terminal
```
git clone git@github.com:ripple/rippled.git
cd rippled
```
Choose the master branch or one of the tagged releases listed on
[GitHub](https://github.com/ripple/rippled/releases GitHub).
```
git checkout master
```
or to test the latest release candidate, choose the `release` branch.
```
git checkout release
```
### Configure Library Paths
If you didn't persistently set the `BOOST_ROOT` environment variable to the
root of the extracted directory above, then you should set it temporarily.
For example, assuming your username were `Abigail` and you extracted Boost
1.61.0 in `/Users/Abigail/Downloads/boost_1_61_0`, you would do for any
shell in which you want to build:
```
export BOOST_ROOT=/Users/Abigail/Downloads/boost_1_61_0
```
## Build
```
scons
```
See: [here](https://ripple.com/wiki/Rippled_build_instructions#Building)
## Unit Tests (Recommended)
rippled builds a set of unit tests into the server executable. To run these unit
tests after building, pass the `--unittest` option to the compiled `rippled`
executable. The executable will exit after running the unit tests.

View File

@@ -1 +0,0 @@
Place XCode project file here!

6
Builds/build_all.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
num_procs=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l) # number of physical cores
cd ..
./Builds/Test.py -a -c -- -j${num_procs}

View File

@@ -1,53 +0,0 @@
Name: rippled
Version: 0.23.0
Release: 1%{?dist}
Summary: Ripple peer-to-peer network daemon
Group: Applications/Internet
License: ISC
URL: https://github.com/ripple/rippled
# curl -L -o SOURCES/rippled-release.zip https://github.com/ripple/rippled/archive/release.zip
Source0: rippled-release.zip
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: gcc-c++ scons openssl-devel protobuf-devel
Requires: protobuf openssl
%description
Rippled is the server component of the Ripple network.
%prep
%setup -n rippled-release
%build
# Assume boost is manually installed
export RIPPLED_BOOST_HOME=/usr/local/boost_1_55_0
scons -j `grep -c processor /proc/cpuinfo` build/rippled
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/usr/share/%{name}
cp LICENSE %{buildroot}/usr/share/%{name}/
mkdir -p %{buildroot}/usr/bin
cp build/rippled %{buildroot}/usr/bin/rippled
mkdir -p %{buildroot}/etc/%{name}
cp doc/rippled-example.cfg %{buildroot}/etc/%{name}/rippled.cfg
mkdir -p %{buildroot}/var/lib/%{name}/db
mkdir -p %{buildroot}/var/log/%{name}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
/usr/bin/rippled
/usr/share/rippled/LICENSE
/etc/rippled/rippled-example.cfg

View File

@@ -0,0 +1,13 @@
--- /usr/include/boost/config/compiler/clang.hpp 2013-07-20 13:17:10.000000000 -0400
+++ /usr/include/boost/config/compiler/clang.rippled.hpp 2014-03-11 16:40:51.000000000 -0400
@@ -39,6 +39,10 @@
// Clang supports "long long" in all compilation modes.
#define BOOST_HAS_LONG_LONG
+#if defined(__SIZEOF_INT128__)
+# define BOOST_HAS_INT128
+#endif
+
//
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
//

View File

@@ -0,0 +1,10 @@
--- /usr/include/boost/bimap/detail/debug/static_error.hpp 2008-03-22 17:45:55.000000000 -0400
+++ /usr/include/boost/bimap/detail/debug/static_error.rippled.hpp 2014-03-12 19:40:05.000000000 -0400
@@ -25,7 +25,6 @@
// a static error.
/*===========================================================================*/
#define BOOST_BIMAP_STATIC_ERROR(MESSAGE,VARIABLES) \
- struct BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE) {}; \
BOOST_MPL_ASSERT_MSG(false, \
BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE), \
VARIABLES)

517
CMakeLists.txt Normal file
View File

@@ -0,0 +1,517 @@
# !!! The official build system is SConstruct !!!
# This is an experimental cmake build file for rippled
#
# cmake support in rippled. Currently supports:
#
# * unity/nounity debug/release
# * running protobuf
# * sanitizer builds
# * optional release build with assert turned on
# * `target` variable to easily set compiler/debug/unity
# (i.e. -Dtarget=gcc.debug.nounity)
# * gcc/clang/visual studio/xcode
# * linux/mac/win
# * gcc 4 ABI, when needed
# * ninja builds
# * check openssl version on linux
# * static builds (swd TBD: needs to be tested by building & deploying on different systems)
#
# TBD:
# * jemalloc support
# * count
# * Windows protobuf compiler puts generated file in src directory instead of build directory.
#
# Notes:
# * Use the -G"Visual Studio 14 2015 Win64" generator on Windows. Without this
# a 32-bit project will be created. There is no way to set the generator or
# force a 64-bit build in CMakeLists.txt (setting CMAKE_GENERATOR_PLATFORM won't work).
# The best solution may be to wrap cmake with a script.
#
# * It is not possible to generate a visual studio project on linux or
# mac. The visual studio generator is only available on windows.
#
# * The visual studio project can be _either_ unity or
# non-unity (selected at generation time). It does not appear possible
# to disable compilation based on configuration.
#
# * Language is _much_ worse than python, poor documentation and "quirky"
# language support (for example, generator expressions can only be used
# in limited contexts and seem to work differently based on
# context (set_property can set multiple values, add_compile_options
# can not/or is buggy)
#
# * Could not call out to `sed` because cmake messed with the regular
# expression before calling the external command. I did not see a way
# around this.
#
# * Makefile generators want to be single target. It wants a separate
# directory for each target type. I saw some mentions on the web for
# ways around this bug haven't look into it. The visual studio project
# does support debug/release configurations in the same project (but
# not unity/non-unity).
############################################################
cmake_minimum_required(VERSION 3.1.0)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
set(dir "build")
set(cmd "cmake")
if (target)
set(dir "${dir}/${target}")
set(cmd "${cmd} -Dtarget=${target}")
elseif(CMAKE_BUILD_TYPE)
set(dir "${dir}/${CMAKE_BUILD_TYPE}")
set(cmd "${cmd} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
else()
set(dir "${dir}/default")
endif()
set(cmd "${cmd} ${CMAKE_SOURCE_DIR}")
message(FATAL_ERROR "Builds are not allowed in ${CMAKE_SOURCE_DIR}.\n"
"Instead:\n"
"1) Remove the CMakeCache.txt file and CMakeFiles directory "
"from ${CMAKE_SOURCE_DIR}.\n"
"2) Create a directory to hold your build files, for example: ${dir}.\n"
"3) Change to that directory.\n"
"4) Run cmake targetting ${CMAKE_SOURCE_DIR}, for example: ${cmd}")
endif()
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND
NOT ("${CMAKE_GENERATOR}" MATCHES .*Win64.*))
message(FATAL_ERROR "Visual Studio 32-bit build is unsupported. Use
-G\"${CMAKE_GENERATOR} Win64\"")
endif()
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Builds/CMake")
include(CMakeFuncs)
set(openssl_min 1.0.2)
parse_target()
if (NOT DEFINED unity)
set(unity true)
set(nonunity false)
endif()
setup_build_cache()
project(rippled)
if(nonunity)
get_cmake_property(allvars VARIABLES)
string(REGEX MATCHALL "[^;]*(DEBUG|RELEASE)[^;]*" matchvars "${allvars}")
foreach(var IN LISTS matchvars)
string(REGEX REPLACE "(DEBUG|RELEASE)" "\\1CLASSIC" newvar ${var})
set(${newvar} ${${var}})
endforeach()
get_cmake_property(allvars CACHE_VARIABLES)
string(REGEX MATCHALL "[^;]*(DEBUG|RELEASE)[^;]*" matchvars "${allvars}")
foreach(var IN LISTS matchvars)
string(REGEX REPLACE "(DEBUG|RELEASE)" "\\1CLASSIC" newvar ${var})
set(${newvar} ${${var}} CACHE STRING "Copied from ${var}")
endforeach()
endif()
determine_build_type()
check_gcc4_abi()
############################################################
include_directories(
src
src/beast
src/beast/include
src/beast/extras
src/nudb/include
src/soci/src
src/soci/include)
special_build_flags()
############################################################
use_boost(
# resist the temptation to alphabetize these. coroutine
# must come before context.
chrono
coroutine
context
date_time
filesystem
program_options
regex
system
thread)
use_pthread()
use_openssl(${openssl_min})
use_protobuf()
setup_build_boilerplate()
############################################################
if (is_clang)
set(rocks_db_system_header --system-header-prefix=rocksdb2)
else()
unset(rocks_db_system_header)
endif()
set(soci_extra_includes
-I"${CMAKE_SOURCE_DIR}/"src/soci/src/core
-I"${CMAKE_SOURCE_DIR}/"src/soci/include/private
-I"${CMAKE_SOURCE_DIR}/"src/sqlite)
############################################################
# Unity sources
prepend(beast_unity_srcs
src/ripple/beast/unity/
beast_insight_unity.cpp
beast_net_unity.cpp
beast_utility_unity.cpp)
prepend(ripple_unity_srcs
src/ripple/unity/
app_ledger.cpp
app_main.cpp
app_misc.cpp
app_paths.cpp
app_tx.cpp
conditions.cpp
core.cpp
basics.cpp
crypto.cpp
ledger.cpp
net.cpp
overlay.cpp
peerfinder.cpp
json.cpp
protocol.cpp
rpcx.cpp
shamap.cpp
server.cpp)
prepend(test_unity_srcs
src/test/unity/
app_test_unity.cpp
basics_test_unity.cpp
beast_test_unity.cpp
conditions_test_unity.cpp
core_test_unity.cpp
json_test_unity.cpp
ledger_test_unity.cpp
overlay_test_unity.cpp
peerfinder_test_unity.cpp
protocol_test_unity.cpp
resource_test_unity.cpp
rpc_test_unity.cpp
server_test_unity.cpp
shamap_test_unity.cpp
support_unity.cpp)
list(APPEND rippled_src_unity ${beast_unity_srcs} ${ripple_unity_srcs} ${test_unity_srcs})
add_with_props(rippled_src_unity src/test/unity/nodestore_test_unity.cpp
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${rocks_db_system_header})
add_with_props(rippled_src_unity src/ripple/unity/nodestore.cpp
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${rocks_db_system_header})
add_with_props(rippled_src_unity src/ripple/unity/soci_ripple.cpp ${soci_extra_includes})
list(APPEND ripple_unity_srcs ${beast_unity_srcs} ${test_unity_srcs}
src/ripple/unity/nodestore.cpp
src/ripple/unity/soci_ripple.cpp
src/test/unity/nodestore_test_unity.cpp)
############################################################
# Non-unity sources
file(GLOB_RECURSE core_srcs src/ripple/core/*.cpp)
add_with_props(rippled_src_nonunity "${core_srcs}"
-I"${CMAKE_SOURCE_DIR}/"src/soci/src/core
-I"${CMAKE_SOURCE_DIR}/"src/sqlite)
set(non_unity_srcs ${core_srcs})
foreach(curdir
beast/clock
beast/container
beast/insight
beast/net
beast/utility
app
basics
conditions
crypto
json
ledger
legacy
net
overlay
peerfinder
protocol
rpc
server
shamap)
file(GLOB_RECURSE cursrcs src/ripple/${curdir}/*.cpp)
list(APPEND rippled_src_nonunity "${cursrcs}")
list(APPEND non_unity_srcs "${cursrcs}")
endforeach()
file(GLOB_RECURSE nodestore_srcs src/ripple/nodestore/*.cpp
src/test/nodestore/*.cpp)
add_with_props(rippled_src_nonunity "${nodestore_srcs}"
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${rocks_db_system_header})
list(APPEND non_unity_srcs "${nodestore_srcs}")
# unit test sources
foreach(curdir
app
basics
beast
conditions
core
json
ledger
nodestore
overlay
peerfinder
protocol
resource
rpc
server
shamap
jtx)
file(GLOB_RECURSE cursrcs src/test/${curdir}/*.cpp)
list(APPEND test_srcs "${cursrcs}")
endforeach()
add_with_props(rippled_src_nonunity "${test_srcs}"
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${rocks_db_system_header})
list(APPEND non_unity_srcs "${test_srcs}")
if(WIN32 OR is_xcode)
# Rippled headers. Only needed for IDEs.
file(GLOB_RECURSE rippled_headers src/*.h src/*.hpp)
list(APPEND rippled_headers Builds/CMake/CMakeFuncs.cmake)
foreach(curdir
beast/asio
beast/core
beast/crypto
beast/cxx17
beast/hash
proto
resource
validators
websocket)
file(GLOB_RECURSE cursrcs src/ripple/${curdir}/*.cpp)
list(APPEND rippled_headers "${cursrcs}")
endforeach()
list(APPEND rippled_src_nonunity "${rippled_headers}")
set_property(
SOURCE ${rippled_headers}
APPEND
PROPERTY HEADER_FILE_ONLY
true)
# Doesn't work
# $<OR:$<CONFIG:Debug>,$<CONFIG:Release>>)
endif()
if (WIN32 OR is_xcode)
# Documentation sources. Only needed for IDEs.
prepend(doc_srcs
docs/
Jamfile.v2
boostbook.dtd
index.xml
main.qbk
quickref.xml
reference.xsl
source.dox)
set_property(
SOURCE ${doc_srcs}
APPEND
PROPERTY HEADER_FILE_ONLY
true)
# Doesn't work
# $<OR:$<CONFIG:Debug>,$<CONFIG:Release>>)
endif()
############################################################
add_with_props(rippled_src_all src/ripple/unity/soci.cpp
${soci_extra_includes})
if (NOT is_msvc)
set(no_unused_w -Wno-unused-function)
else()
unset(no_unused_w)
endif()
add_with_props(rippled_src_all src/ripple/unity/secp256k1.cpp
-I"${CMAKE_SOURCE_DIR}/"src/secp256k1
${no_unused_w}
)
foreach(cursrc
src/ripple/beast/unity/beast_hash_unity.cpp
src/ripple/unity/beast.cpp
src/ripple/unity/lz4.c
src/ripple/unity/protobuf.cpp
src/ripple/unity/ripple.proto.cpp
src/ripple/unity/resource.cpp)
add_with_props(rippled_src_all ${cursrc}
${rocks_db_system_header}
)
endforeach()
if (NOT is_msvc)
set(extra_props -Wno-array-bounds)
else()
unset(extra_props)
endif()
add_with_props(rippled_src_all src/sqlite/sqlite_unity.c
${extra_props})
add_with_props(rippled_src_all src/ripple/unity/ed25519_donna.c
-I"${CMAKE_SOURCE_DIR}/"src/ed25519-donna)
if (is_gcc)
set(no_init_w -Wno-maybe-uninitialized)
else()
unset(no_init_w)
endif()
add_with_props(rippled_src_all src/ripple/unity/rocksdb.cpp
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${no_init_w} ${rocks_db_system_header})
if (NOT is_msvc)
set(no_unused_w -Wno-unused-function)
endif()
add_with_props(rippled_src_all src/ripple/unity/snappy.cpp
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${no_unused_w})
if (APPLE AND is_clang)
list(APPEND rippled_src_all src/ripple/unity/beastobjc.mm)
endif()
list(APPEND rippled_src_unity "${rippled_src_all}")
list(APPEND rippled_src_nonunity "${rippled_src_all}")
############################################################
if (WIN32 OR is_xcode)
group_sources(src)
group_sources(docs)
group_sources(Builds)
endif()
if(unity)
add_executable(rippled ${rippled_src_unity} ${PROTO_HDRS})
add_executable(rippled_classic EXCLUDE_FROM_ALL ${rippled_src_nonunity} ${PROTO_HDRS})
set(other_target rippled_classic)
else()
add_executable(rippled ${rippled_src_nonunity} ${PROTO_HDRS})
add_executable(rippled_unity EXCLUDE_FROM_ALL ${rippled_src_unity} ${PROTO_HDRS})
set(other_target rippled_unity)
endif()
list(APPEND targets "rippled")
list(APPEND targets ${other_target})
# Not the same as EXCLUDE_FROM_ALL. Prevents Visual Studio from building the
# other_target when the user builds the solution (default when pressing <F7>)
set_property(TARGET ${other_target} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD true)
find_program(
B2_EXE
NAMES b2
HINTS ${BOOST_ROOT}
PATHS ${BOOST_ROOT}
DOC "Location of the b2 build executable from Boost")
if(${B2_EXE} STREQUAL "B2_EXE-NOTFOUND")
message(WARNING
"Boost b2 executable not found. docs target will not be buildable")
elseif(NOT BOOST_ROOT)
if(Boost_INCLUDE_DIRS)
set(BOOST_ROOT ${Boost_INCLUDE_DIRS})
else()
get_filename_component(BOOST_ROOT ${B2_EXE} DIRECTORY)
endif()
endif()
# The value for BOOST_ROOT will be determined based on
# 1) The environment BOOST_ROOT
# 2) The Boost_INCLUDE_DIRS found by `get_boost`
# 3) The folder the `b2` executable is found in.
# If those checks don't yield the correct path, BOOST_ROOT
# can be defined on the cmake command line:
# cmake <path> -DBOOST_ROOT=<boost_path>
if(BOOST_ROOT)
set(B2_PARAMS "-sBOOST_ROOT=${BOOST_ROOT}")
endif()
# Find bash to help Windows avoid file association problems
find_program(
BASH_EXE
NAMES bash sh
DOC "Location of the bash shell executable"
)
if(${BASH_EXE} STREQUAL "BASH_EXE-NOTFOUND")
message(WARNING
"Unable to find bash executable. docs target may not be buildable")
set(BASH_EXE "")
endif()
add_custom_target(docs
COMMAND ${CMAKE_COMMAND} -E env "PATH=$ENV{PATH} " ${BASH_EXE} ./makeqbk.sh
COMMAND ${B2_EXE} ${B2_PARAMS}
BYPRODUCTS "${CMAKE_SOURCE_DIR}/docs/html/index.html"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/docs"
SOURCES "${doc_srcs}"
)
set_startup_project(rippled)
foreach(target IN LISTS targets)
target_link_libraries(${target}
${OPENSSL_LIBRARIES} ${PROTOBUF_LIBRARIES} ${SANITIZER_LIBRARIES})
link_common_libraries(${target})
endforeach()
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(WARNING "Rippled requires a 64 bit target architecture.\n"
"The most likely cause of this warning is trying to build rippled with a 32-bit OS.")
endif()

11
Jamroot Normal file
View File

@@ -0,0 +1,11 @@
#
# Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
import boost ;
boost.use-project ;

106
README.md
View File

@@ -1,41 +1,91 @@
#rippled - Ripple P2P server
![Ripple](/images/ripple.png)
##[![Build Status](https://travis-ci.org/ripple/rippled.png?branch=develop)](https://travis-ci.org/ripple/rippled)
# What is Ripple?
Ripple is a network of computers which use the [Ripple consensus algorithm]
(https://www.youtube.com/watch?v=pj1QVb1vlC0) to atomically settle and record
transactions on a secure distributed database, the Ripple Consensus Ledger
(RCL). Because of its distributed nature, the RCL offers transaction immutability
without a central operator. The RCL contains a built-in currency exchange and its
path-finding algorithm finds competitive exchange rates across order books
and currency pairs.
This is the repository for Ripple's `rippled`, reference P2P server.
### Key Features
- **Distributed**
- Direct account-to-account settlement with no central operator
- Decentralized global market for competitive FX
- **Secure**
- Transactions are cryptographically signed using ECDSA or Ed25519
- Multi-signing capabilities
- **Scalable**
- Capacity to process the worlds cross-border payments volume
- Easy access to liquidity through a competitive FX marketplace
###Build instructions:
* https://ripple.com/wiki/Rippled_build_instructions
## Cross-border payments
Ripple enables banks to settle cross-border payments in real-time, with
end-to-end transparency, and at lower costs. Banks can provide liquidity
for FX themselves or source it from third parties.
###Setup instructions:
* https://ripple.com/wiki/Rippled_setup_instructions
As Ripple adoption grows, so do the number of currencies and counterparties.
Liquidity providers need to maintain accounts with each counterparty for
each currency a capital- and time-intensive endeavor that spreads liquidity
thin. Further, some transactions, such as exotic currency trades, will require
multiple trading parties, who each layer costs to the transaction. Thin
liquidity and many intermediary trading parties make competitive pricing
challenging.
### Repository Contents
![Flow - Direct](images/flow1.png)
#### ./bin
Scripts and data files for Ripple integrators.
### XRP as a Bridge Currency
Ripple can bridge even exotic currency pairs directly through XRP. Similar to
USD in todays currency market, XRP allows liquidity providers to focus on
offering competitive FX rates on fewer pairs and adding depth to order books.
Unlike USD, trading through XRP does not require bank accounts, service fees,
counterparty risk, or additional operational costs. By using XRP, liquidity
providers can specialize in certain currency corridors, reduce operational
costs, and ultimately, offer more competitive FX pricing.
#### ./build
Intermediate and final build outputs.
![Flow - Bridged over XRP](images/flow2.png)
#### ./Builds
Platform or IDE-specific project files.
# rippled - Ripple server
`rippled` is the reference server implementation of the Ripple
protocol. To learn more about how to build and run a `rippled`
server, visit https://ripple.com/build/rippled-setup/
#### ./doc
Documentation and example configuration files.
[![travis-ci.org: Build Status](https://travis-ci.org/ripple/rippled.png?branch=develop)](https://travis-ci.org/ripple/rippled)
[![codecov.io: Code Coverage](https://codecov.io/gh/ripple/rippled/branch/develop/graph/badge.svg)](https://codecov.io/gh/ripple/rippled)
#### ./src
Source code directory. Some of the directories contained here are
external repositories inlined via git-subtree, see the corresponding
README for more details.
### License
`rippled` is open source and permissively licensed under the
ISC license. See the LICENSE file for more details.
#### ./test
Javascript / Mocha tests.
#### Repository Contents
## License
Ripple is open source and permissively licensed under the ISC license. See the
LICENSE file for more details.
| Folder | Contents |
|---------|----------|
| ./bin | Scripts and data files for Ripple integrators. |
| ./build | Intermediate and final build outputs. |
| ./Builds| Platform or IDE-specific project files. |
| ./doc | Documentation and example configuration files. |
| ./src | Source code. |
###For more information:
* https://ripple.com
* https://ripple.com/wiki
Some of the directories under `src` are external repositories inlined via
git-subtree. See the corresponding README for more details.
##For more information:
* [Ripple Knowledge Center](https://ripple.com/learn/)
* [Ripple Developer Center](https://ripple.com/build/)
* [Ripple Whitepapers & Reports](https://ripple.com/whitepapers-reports/)
* [Ripple Consensus Whitepaper](https://ripple.com/consensus-whitepaper/)
* [Ripple Solutions Guide](https://ripple.com/files/ripple_solutions_guide.pdf)
To learn about how Ripple is transforming global payments visit
[https://ripple.com/contact/](https://ripple.com/contact/)
- - -
Copyright © 2015, Ripple Labs. All rights reserved.
Portions of this document, including but not limited to the Ripple logo,
images and image templates are the property of Ripple Labs and cannot be
copied or used without permission.

2401
RELEASENOTES.md Normal file

File diff suppressed because it is too large Load Diff

1627
SConstruct

File diff suppressed because it is too large Load Diff

134
appveyor.yml Normal file
View File

@@ -0,0 +1,134 @@
# Set environment variables.
environment:
PYTHON: C:/Python27-x64
# We bundle up protoc.exe and only the parts of boost and openssl we need so
# that it's a small download. We also use appveyor's free cache, avoiding fees
# downloading from S3 each time.
# TODO: script to create this package.
RIPPLED_DEPS_PATH: rippled_deps15.02
RIPPLED_DEPS_URL: https://ripple.github.io/Downloads/appveyor/%RIPPLED_DEPS_PATH%.zip
# Other dependencies we just download each time.
PIP_PATH: get-pip.py
PIP_URL: https://bootstrap.pypa.io/%PIP_PATH%
# The % in this URL messes up variable substition, so any updates will
# need to update both PYWIN32_PATH and PYWIN32_URL
PYWIN32_PATH: pywin32-220.win-amd64-py2.7.exe
PYWIN32_URL: https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win-amd64-py2.7.exe
# Scons honours these environment variables, setting the include/lib paths.
BOOST_ROOT: C:/%RIPPLED_DEPS_PATH%/boost
OPENSSL_ROOT: C:/%RIPPLED_DEPS_PATH%/openssl
matrix:
# This build works, but our current Appveyor config runs matrix builds
# sequentially, and the one build is already slow enough.
# - build: scons
# target: msvc.debug
- build: cmake
target: msvc.debug
buildconfig: Debug
os: Visual Studio 2015
# At the end of each successful build we cache this directory.
# https://www.appveyor.com/docs/build-cache/
# Resulting archive should not exceed 100 MB.
cache:
- 'C:\%RIPPLED_DEPS_PATH%'
- '%PIP_PATH%'
- '%PYWIN32_PATH%'
# This means we'll download a zip of the branch we want, rather than the full
# history.
shallow_clone: true
install:
# We want easy_install, python and protoc.exe on PATH.
- SET PATH=%PYTHON%;%PYTHON%/Scripts;C:/%RIPPLED_DEPS_PATH%;%PATH%
# `ps` prefix means the command is executed by powershell.
- ps: |
if ($env:build -eq "scons") {
if(-not(Test-Path $env:PIP_PATH)) {
echo "Download from $env:PIP_URL"
Start-FileDownload $env:PIP_URL
}
if(-not(Test-Path $env:PYWIN32_PATH)) {
echo "Download from $env:PYWIN32_URL"
Start-FileDownload $env:PYWIN32_URL
}
}
- bin/ci/windows/install-dependencies.bat
# Download dependencies if appveyor didn't restore them from the cache.
# Use 7zip to unzip.
- ps: |
if (-not(Test-Path 'C:/$env:RIPPLED_DEPS_PATH')) {
echo "Download from $env:RIPPLED_DEPS_URL"
Start-FileDownload "$env:RIPPLED_DEPS_URL"
7z x "$($env:RIPPLED_DEPS_PATH).zip" -oC:\ -y > $null
if ($LastExitCode -ne 0) { throw "7z failed" }
}
# Newer DEPS include a versions file.
# Dump it so we can verify correct behavior.
- ps: |
if (Test-Path "C:/$env:RIPPLED_DEPS_PATH/versions.txt") {
cat "C:/$env:RIPPLED_DEPS_PATH/versions.txt"
}
# TODO: This is giving me grief
# artifacts:
# # Save rippled.exe in the cloud after each build.
# - path: "build\\rippled.exe"
build_script:
# We set the environment variables needed to put compilers on the PATH.
- '"%VS140COMNTOOLS%../../VC/vcvarsall.bat" x86_amd64'
# Show which version of the compiler we are using.
- cl
- ps: |
if ($env:build -eq "scons") {
# Build with scons
scons $env:target -j%NUMBER_OF_PROCESSORS%
if ($LastExitCode -ne 0) { throw "scons build failed" }
}
else
{
# Build with cmake
cmake --version
$cmake_target="$($env:target).ci"
"$cmake_target"
New-Item -ItemType Directory -Force -Path "build/$cmake_target"
Push-Location "build/$cmake_target"
cmake -G"Visual Studio 14 2015 Win64" -Dtarget="$cmake_target" ../..
if ($LastExitCode -ne 0) { throw "CMake failed" }
cmake --build . --config $env:buildconfig -- -m
if ($LastExitCode -ne 0) { throw "CMake build failed" }
Pop-Location
}
after_build:
- ps: |
if ($env:build -eq "scons") {
cp build/$($env:target)/rippled.exe build
ls build
$exe="build/rippled"
}
else
{
$exe="build/$cmake_target/$env:buildconfig/rippled"
}
"Exe is at $exe"
test_script:
- ps: |
& {
# Run the rippled unit tests
& $exe --unittest
# https://connect.microsoft.com/PowerShell/feedback/details/751703/option-to-stop-script-if-command-line-exe-fails
if ($LastExitCode -ne 0) { throw "Unit tests failed" }
}

1
bin/LT Symbolic link
View File

@@ -0,0 +1 @@
python/LedgerTool.py

92
bin/ci/ubuntu/build-and-test.sh Executable file
View File

@@ -0,0 +1,92 @@
#!/bin/bash -u
# We use set -e and bash with -u to bail on first non zero exit code of any
# processes launched or upon any unbound variable.
# We use set -x to print commands before running them to help with
# debugging.
set -ex
__dirname=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
echo "using CC: $CC"
echo "using TARGET: $TARGET"
# Ensure APP defaults to rippled if it's not set.
: ${APP:=rippled}
if [[ ${BUILD:-scons} == "cmake" ]]; then
echo "cmake building ${APP}"
CMAKE_TARGET=$CC.$TARGET
if [[ ${CI:-} == true ]]; then
CMAKE_TARGET=$CMAKE_TARGET.ci
fi
mkdir -p "build/${CMAKE_TARGET}"
pushd "build/${CMAKE_TARGET}"
cmake ../.. -Dtarget=$CMAKE_TARGET
cmake --build . -- -j${NUM_PROCESSORS:-2}
popd
export APP_PATH="$PWD/build/${CMAKE_TARGET}/${APP}"
echo "using APP_PATH: $APP_PATH"
else
export APP_PATH="$PWD/build/$CC.$TARGET/${APP}"
echo "using APP_PATH: $APP_PATH"
# Make sure vcxproj is up to date
scons vcxproj
git diff --exit-code
# $CC will be either `clang` or `gcc`
# http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade
# indicates that 2 cores are available to containers.
scons -j${NUM_PROCESSORS:-2} $CC.$TARGET
fi
# We can be sure we're using the build/$CC.$TARGET variant
# (-f so never err)
rm -f build/${APP}
# See what we've actually built
ldd $APP_PATH
if [[ ${APP} == "rippled" ]]; then
export APP_ARGS="--unittest"
# Only report on src/ripple files
export LCOV_FILES="*/src/ripple/*"
# Nothing to explicitly exclude
export LCOV_EXCLUDE_FILES="LCOV_NO_EXCLUDE"
else
: ${APP_ARGS:=}
: ${LCOV_FILES:="*/src/*"}
# Don't exclude anything
: ${LCOV_EXCLUDE_FILES:="LCOV_NO_EXCLUDE"}
fi
if [[ $TARGET == "coverage" ]]; then
export PATH=$PATH:$LCOV_ROOT/usr/bin
# Create baseline coverage data file
lcov --no-external -c -i -d . -o baseline.info
fi
# Execute unit tests under gdb, printing a call stack
# if we get a crash.
gdb -return-child-result -quiet -batch \
-ex "set env MALLOC_CHECK_=3" \
-ex "set print thread-events off" \
-ex run \
-ex "thread apply all backtrace full" \
-ex "quit" \
--args $APP_PATH --unittest
if [[ $TARGET == "coverage" ]]; then
# Create test coverage data file
lcov --no-external -c -d . -o tests.info
# Combine baseline and test coverage data
lcov -a baseline.info -a tests.info -o lcov-all.info
# Included files
lcov -e "lcov-all.info" "${LCOV_FILES}" -o lcov.pre.info
# Excluded files
lcov --remove lcov.pre.info "${LCOV_EXCLUDE_FILES}" -o lcov.info
# Push the results (lcov.info) to codecov
codecov -X gcov # don't even try and look for .gcov files ;)
fi

View File

@@ -0,0 +1,67 @@
#!/bin/bash -u
# Exit if anything fails. Echo commands to aid debugging.
set -ex
# Target working dir - defaults to current dir.
# Can be set from caller, or in the first parameter
TWD=$( cd ${TWD:-${1:-${PWD:-$( pwd )}}}; pwd )
echo "Target path is: $TWD"
# Override gcc version to $GCC_VER.
# Put an appropriate symlink at the front of the path.
mkdir -v $HOME/bin
for g in gcc g++ gcov gcc-ar gcc-nm gcc-ranlib
do
test -x $( type -p ${g}-$GCC_VER )
ln -sv $(type -p ${g}-$GCC_VER) $HOME/bin/${g}
done
if [[ -n ${CLANG_VER:-} ]]; then
# There are cases where the directory exists, but the exe is not available.
# Use this workaround for now.
if [[ ! -x ${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config && -d ${TWD}/llvm-${LLVM_VERSION} ]]; then
rm -fr ${TWD}/llvm-${LLVM_VERSION}
fi
if [[ ! -d ${TWD}/llvm-${LLVM_VERSION} ]]; then
mkdir ${TWD}/llvm-${LLVM_VERSION}
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
wget -O - ${LLVM_URL} | tar -Jxvf - --strip 1 -C ${TWD}/llvm-${LLVM_VERSION}
fi
${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config --version;
export LLVM_CONFIG="${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config";
fi
if [[ ${BUILD:-} == cmake ]]; then
# There are cases where the directory exists, but the exe is not available.
# Use this workaround for now.
if [[ ! -x ${TWD}/cmake/bin/cmake && -d ${TWD}/cmake ]]; then
rm -fr ${TWD}/cmake
fi
if [[ ! -d ${TWD}/cmake ]]; then
CMAKE_URL="https://www.cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.tar.gz"
wget --version
# wget version 1.13.4 thinks this certificate is invalid, even though it's fine.
# "ERROR: no certificate subject alternative name matches"
# See also: https://github.com/travis-ci/travis-ci/issues/5059
mkdir ${TWD}/cmake &&
wget -O - --no-check-certificate ${CMAKE_URL} | tar --strip-components=1 -xz -C ${TWD}/cmake
cmake --version
fi
fi
# What versions are we ACTUALLY running?
if [ -x $HOME/bin/g++ ]; then
$HOME/bin/g++ -v
fi
pip install --user https://github.com/codecov/codecov-python/archive/master.zip
bash bin/sh/install-boost.sh
# Install lcov
# Download the archive
wget https://github.com/linux-test-project/lcov/releases/download/v1.12/lcov-1.12.tar.gz
# Extract to ~/lcov-1.12
tar xfvz lcov-1.12.tar.gz -C $HOME
# Set install path
mkdir -p $LCOV_ROOT
cd $HOME/lcov-1.12 && make install PREFIX=$LCOV_ROOT

View File

@@ -0,0 +1,13 @@
if "%build%" == "scons" (
rem Installing pip will install setuptools/easy_install.
python "%PIP_PATH%"
rem Pip has some problems installing scons on windows so we use easy install.
rem - easy_install scons
rem Workaround
easy_install https://pypi.python.org/packages/source/S/SCons/scons-2.5.0.tar.gz#md5=bda5530a70a41a7831d83c8b191c021e
rem Scons has problems with parallel builds on windows without pywin32.
easy_install "%PYWIN32_PATH%"
rem (easy_install can do headless installs of .exe wizards)
)

84
bin/getInfoRippled.sh Normal file
View File

@@ -0,0 +1,84 @@
#!/usr/bin/env bash
rippled_exe=/opt/ripple/bin/rippled
conf_file=/etc/opt/ripple/rippled.cfg
while getopts ":e:c:" opt; do
case $opt in
e)
rippled_exe=${OPTARG}
;;
c)
conf_file=${OPTARG}
;;
\?)
echo "Invalid option: -$OPTARG"
esac
done
tmp_loc=$(mktemp -d --tmpdir ripple_info.XXXX)
cd /tmp
chmod 751 ripple_info.*
cd ~
echo ${tmp_loc}
cleaned_conf=${tmp_loc}/cleaned_rippled_cfg.txt
if [[ -f ${conf_file} ]]
then
db=$(sed -r -e 's/\<s[a-zA-Z0-9]{28}\>/secretsecretsecretsecretmaybe/g' ${conf_file} |\
awk -v OUT_FILE=${cleaned_conf} '
BEGIN {skip=0; db_path="";print > OUT_FILE}
/^\[validation_seed\]/ {skip=1; next}
/^\[node_seed\]/ {skip=1; next}
/^\[.*\]/ {skip=0}
skip==1 {next}
save==1 {save=0;db_path=$0}
/^\[database_path\]/ {save=1}
{print >> OUT_FILE}
END {print db_path}
')
fi
echo "database_path: ${db}"
df ${db} > ${tmp_loc}/db_path_df.txt
echo
# Send output from this script to a log file
## this captures any messages
## or errors from the script itself
log_file=${tmp_loc}/get_info.log
exec 3>&1 1>>${log_file} 2>&1
## Send all stdout files to /tmp
if [[ -x ${rippled_exe} ]]
then
pgrep rippled && \
${rippled_exe} --conf ${conf_file} \
-- server_info > ${tmp_loc}/server_info.txt
fi
df -h > ${tmp_loc}/free_disk_space.txt
cat /proc/meminfo > ${tmp_loc}/amount_mem.txt
cat /proc/swaps > ${tmp_loc}/swap_space.txt
ulimit -a > ${tmp_loc}/reported_current_limits.txt
for dev_path in $(df | awk '$1 ~ /^\/dev\// {print $1}'); do
# strip numbers from end and remove '/dev/'
dev=$(basename ${dev_path%%[0-9]})
if [[ "$(cat /sys/block/${dev}/queue/rotational)" = 0 ]]
then
echo "${dev} : SSD" >> ${tmp_loc}/is_ssd.txt
else
echo "${dev} : NO SSD" >> ${tmp_loc}/is_ssd.txt
fi
done
pushd ${tmp_loc}
tar -czvf info-package.tar.gz *.txt *.log
popd
echo "Use the following command on your local machine to download from your rippled instance: scp <remote_rippled_username>@<remote_host>:${tmp_loc}/info-package.tar.gz <path/to/local_machine/directory>"| tee /dev/fd/3

1
bin/manifest Symbolic link
View File

@@ -0,0 +1 @@
python/Manifest.py

24
bin/python/LedgerTool.py Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import traceback
from ripple.ledger import Server
from ripple.ledger.commands import Cache, Info, Print
from ripple.ledger.Args import ARGS
from ripple.util import Log
from ripple.util.CommandList import CommandList
_COMMANDS = CommandList(Cache, Info, Print)
if __name__ == '__main__':
try:
server = Server.Server()
args = list(ARGS.command)
_COMMANDS.run_safe(args.pop(0), server, *args)
except Exception as e:
if ARGS.verbose:
print(traceback.format_exc(), sys.stderr)
Log.error(e)

7
bin/python/Manifest.py Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env python
import sys
from ripple.util import Sign
result = Sign.run_command(sys.argv[1:])
sys.exit(0 if result else -1)

15
bin/python/README.md Normal file
View File

@@ -0,0 +1,15 @@
Unit Tests
==========
To run the Python unit tests, execute:
python -m unittest discover
from this directory.
To run Python unit tests from a particular file (such as
`ripple/util/test_Sign.py`), execute:
python -m unittest ripple.util.test_Sign
Add `-v` to run tests in verbose mode.

251
bin/python/decorator.py Normal file
View File

@@ -0,0 +1,251 @@
########################## LICENCE ###############################
# Copyright (c) 2005-2012, Michele Simionato
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# Redistributions in bytecode form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
"""
Decorator module, see http://pypi.python.org/pypi/decorator
for the documentation.
"""
__version__ = '3.4.0'
__all__ = ["decorator", "FunctionMaker", "contextmanager"]
import sys, re, inspect
if sys.version >= '3':
from inspect import getfullargspec
def get_init(cls):
return cls.__init__
else:
class getfullargspec(object):
"A quick and dirty replacement for getfullargspec for Python 2.X"
def __init__(self, f):
self.args, self.varargs, self.varkw, self.defaults = \
inspect.getargspec(f)
self.kwonlyargs = []
self.kwonlydefaults = None
def __iter__(self):
yield self.args
yield self.varargs
yield self.varkw
yield self.defaults
def get_init(cls):
return cls.__init__.im_func
DEF = re.compile('\s*def\s*([_\w][_\w\d]*)\s*\(')
# basic functionality
class FunctionMaker(object):
"""
An object with the ability to create functions with a given signature.
It has attributes name, doc, module, signature, defaults, dict and
methods update and make.
"""
def __init__(self, func=None, name=None, signature=None,
defaults=None, doc=None, module=None, funcdict=None):
self.shortsignature = signature
if func:
# func can be a class or a callable, but not an instance method
self.name = func.__name__
if self.name == '<lambda>': # small hack for lambda functions
self.name = '_lambda_'
self.doc = func.__doc__
self.module = func.__module__
if inspect.isfunction(func):
argspec = getfullargspec(func)
self.annotations = getattr(func, '__annotations__', {})
for a in ('args', 'varargs', 'varkw', 'defaults', 'kwonlyargs',
'kwonlydefaults'):
setattr(self, a, getattr(argspec, a))
for i, arg in enumerate(self.args):
setattr(self, 'arg%d' % i, arg)
if sys.version < '3': # easy way
self.shortsignature = self.signature = \
inspect.formatargspec(
formatvalue=lambda val: "", *argspec)[1:-1]
else: # Python 3 way
allargs = list(self.args)
allshortargs = list(self.args)
if self.varargs:
allargs.append('*' + self.varargs)
allshortargs.append('*' + self.varargs)
elif self.kwonlyargs:
allargs.append('*') # single star syntax
for a in self.kwonlyargs:
allargs.append('%s=None' % a)
allshortargs.append('%s=%s' % (a, a))
if self.varkw:
allargs.append('**' + self.varkw)
allshortargs.append('**' + self.varkw)
self.signature = ', '.join(allargs)
self.shortsignature = ', '.join(allshortargs)
self.dict = func.__dict__.copy()
# func=None happens when decorating a caller
if name:
self.name = name
if signature is not None:
self.signature = signature
if defaults:
self.defaults = defaults
if doc:
self.doc = doc
if module:
self.module = module
if funcdict:
self.dict = funcdict
# check existence required attributes
assert hasattr(self, 'name')
if not hasattr(self, 'signature'):
raise TypeError('You are decorating a non function: %s' % func)
def update(self, func, **kw):
"Update the signature of func with the data in self"
func.__name__ = self.name
func.__doc__ = getattr(self, 'doc', None)
func.__dict__ = getattr(self, 'dict', {})
func.func_defaults = getattr(self, 'defaults', ())
func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None)
func.__annotations__ = getattr(self, 'annotations', None)
callermodule = sys._getframe(3).f_globals.get('__name__', '?')
func.__module__ = getattr(self, 'module', callermodule)
func.__dict__.update(kw)
def make(self, src_templ, evaldict=None, addsource=False, **attrs):
"Make a new function from a given template and update the signature"
src = src_templ % vars(self) # expand name and signature
evaldict = evaldict or {}
mo = DEF.match(src)
if mo is None:
raise SyntaxError('not a valid function template\n%s' % src)
name = mo.group(1) # extract the function name
names = set([name] + [arg.strip(' *') for arg in
self.shortsignature.split(',')])
for n in names:
if n in ('_func_', '_call_'):
raise NameError('%s is overridden in\n%s' % (n, src))
if not src.endswith('\n'): # add a newline just for safety
src += '\n' # this is needed in old versions of Python
try:
code = compile(src, '<string>', 'single')
# print >> sys.stderr, 'Compiling %s' % src
exec code in evaldict
except:
print >> sys.stderr, 'Error in generated code:'
print >> sys.stderr, src
raise
func = evaldict[name]
if addsource:
attrs['__source__'] = src
self.update(func, **attrs)
return func
@classmethod
def create(cls, obj, body, evaldict, defaults=None,
doc=None, module=None, addsource=True, **attrs):
"""
Create a function from the strings name, signature and body.
evaldict is the evaluation dictionary. If addsource is true an attribute
__source__ is added to the result. The attributes attrs are added,
if any.
"""
if isinstance(obj, str): # "name(signature)"
name, rest = obj.strip().split('(', 1)
signature = rest[:-1] #strip a right parens
func = None
else: # a function
name = None
signature = None
func = obj
self = cls(func, name, signature, defaults, doc, module)
ibody = '\n'.join(' ' + line for line in body.splitlines())
return self.make('def %(name)s(%(signature)s):\n' + ibody,
evaldict, addsource, **attrs)
def decorator(caller, func=None):
"""
decorator(caller) converts a caller function into a decorator;
decorator(caller, func) decorates a function using a caller.
"""
if func is not None: # returns a decorated function
evaldict = func.func_globals.copy()
evaldict['_call_'] = caller
evaldict['_func_'] = func
return FunctionMaker.create(
func, "return _call_(_func_, %(shortsignature)s)",
evaldict, undecorated=func, __wrapped__=func)
else: # returns a decorator
if inspect.isclass(caller):
name = caller.__name__.lower()
callerfunc = get_init(caller)
doc = 'decorator(%s) converts functions/generators into ' \
'factories of %s objects' % (caller.__name__, caller.__name__)
fun = getfullargspec(callerfunc).args[1] # second arg
elif inspect.isfunction(caller):
name = '_lambda_' if caller.__name__ == '<lambda>' \
else caller.__name__
callerfunc = caller
doc = caller.__doc__
fun = getfullargspec(callerfunc).args[0] # first arg
else: # assume caller is an object with a __call__ method
name = caller.__class__.__name__.lower()
callerfunc = caller.__call__.im_func
doc = caller.__call__.__doc__
fun = getfullargspec(callerfunc).args[1] # second arg
evaldict = callerfunc.func_globals.copy()
evaldict['_call_'] = caller
evaldict['decorator'] = decorator
return FunctionMaker.create(
'%s(%s)' % (name, fun),
'return decorator(_call_, %s)' % fun,
evaldict, undecorated=caller, __wrapped__=caller,
doc=doc, module=caller.__module__)
######################### contextmanager ########################
def __call__(self, func):
'Context manager decorator'
return FunctionMaker.create(
func, "with _self_: return _func_(%(shortsignature)s)",
dict(_self_=self, _func_=func), __wrapped__=func)
try: # Python >= 3.2
from contextlib import _GeneratorContextManager
ContextManager = type(
'ContextManager', (_GeneratorContextManager,), dict(__call__=__call__))
except ImportError: # Python >= 2.5
from contextlib import GeneratorContextManager
def __init__(self, f, *a, **k):
return GeneratorContextManager.__init__(self, f(*a, **k))
ContextManager = type(
'ContextManager', (GeneratorContextManager,),
dict(__call__=__call__, __init__=__init__))
contextmanager = decorator(ContextManager)

View File

@@ -0,0 +1,14 @@
__all__ = ["curves", "der", "ecdsa", "ellipticcurve", "keys", "numbertheory",
"test_pyecdsa", "util", "six"]
from .keys import SigningKey, VerifyingKey, BadSignatureError, BadDigestError
from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1
_hush_pyflakes = [SigningKey, VerifyingKey, BadSignatureError, BadDigestError,
NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1]
del _hush_pyflakes
# This code comes from http://github.com/warner/python-ecdsa
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions

View File

@@ -0,0 +1,183 @@
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains the computed version number.
# This file is released into the public domain. Generated by
# versioneer-0.12 (https://github.com/warner/python-versioneer)
# these strings will be replaced by git during git-archive
git_refnames = " (HEAD, master)"
git_full = "e7a6daff51221b8edd888cff404596ef90432869"
# these strings are filled in when 'setup.py versioneer' creates _version.py
tag_prefix = "python-ecdsa-"
parentdir_prefix = "ecdsa-"
versionfile_source = "ecdsa/_version.py"
import os, sys, re, subprocess, errno
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
assert isinstance(commands, list)
p = None
for c in commands:
try:
# remember shell=False, so use git.cmd on windows, not just git
p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr
else None))
break
except EnvironmentError:
e = sys.exc_info()[1]
if e.errno == errno.ENOENT:
continue
if verbose:
print("unable to run %s" % args[0])
print(e)
return None
else:
if verbose:
print("unable to find command, tried %s" % (commands,))
return None
stdout = p.communicate()[0].strip()
if sys.version >= '3':
stdout = stdout.decode()
if p.returncode != 0:
if verbose:
print("unable to run %s (error)" % args[0])
return None
return stdout
def versions_from_parentdir(parentdir_prefix, root, verbose=False):
# Source tarballs conventionally unpack into a directory that includes
# both the project name and a version string.
dirname = os.path.basename(root)
if not dirname.startswith(parentdir_prefix):
if verbose:
print("guessing rootdir is '%s', but '%s' doesn't start with prefix '%s'" %
(root, dirname, parentdir_prefix))
return None
return {"version": dirname[len(parentdir_prefix):], "full": ""}
def git_get_keywords(versionfile_abs):
# the code embedded in _version.py can just fetch the value of these
# keywords. When used from setup.py, we don't want to import _version.py,
# so we do it with a regexp instead. This function is not used from
# _version.py.
keywords = {}
try:
f = open(versionfile_abs,"r")
for line in f.readlines():
if line.strip().startswith("git_refnames ="):
mo = re.search(r'=\s*"(.*)"', line)
if mo:
keywords["refnames"] = mo.group(1)
if line.strip().startswith("git_full ="):
mo = re.search(r'=\s*"(.*)"', line)
if mo:
keywords["full"] = mo.group(1)
f.close()
except EnvironmentError:
pass
return keywords
def git_versions_from_keywords(keywords, tag_prefix, verbose=False):
if not keywords:
return {} # keyword-finding function failed to find keywords
refnames = keywords["refnames"].strip()
if refnames.startswith("$Format"):
if verbose:
print("keywords are unexpanded, not using")
return {} # unexpanded, so not in an unpacked git-archive tarball
refs = set([r.strip() for r in refnames.strip("()").split(",")])
# starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
# just "foo-1.0". If we see a "tag: " prefix, prefer those.
TAG = "tag: "
tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
if not tags:
# Either we're using git < 1.8.3, or there really are no tags. We use
# a heuristic: assume all version tags have a digit. The old git %d
# expansion behaves like git log --decorate=short and strips out the
# refs/heads/ and refs/tags/ prefixes that would let us distinguish
# between branches and tags. By ignoring refnames without digits, we
# filter out many common branch names like "release" and
# "stabilization", as well as "HEAD" and "master".
tags = set([r for r in refs if re.search(r'\d', r)])
if verbose:
print("discarding '%s', no digits" % ",".join(refs-tags))
if verbose:
print("likely tags: %s" % ",".join(sorted(tags)))
for ref in sorted(tags):
# sorting will prefer e.g. "2.0" over "2.0rc1"
if ref.startswith(tag_prefix):
r = ref[len(tag_prefix):]
if verbose:
print("picking %s" % r)
return { "version": r,
"full": keywords["full"].strip() }
# no suitable tags, so we use the full revision id
if verbose:
print("no suitable tags, using full revision id")
return { "version": keywords["full"].strip(),
"full": keywords["full"].strip() }
def git_versions_from_vcs(tag_prefix, root, verbose=False):
# this runs 'git' from the root of the source tree. This only gets called
# if the git-archive 'subst' keywords were *not* expanded, and
# _version.py hasn't already been rewritten with a short version string,
# meaning we're inside a checked out source tree.
if not os.path.exists(os.path.join(root, ".git")):
if verbose:
print("no .git in %s" % root)
return {}
GITS = ["git"]
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
stdout = run_command(GITS, ["describe", "--tags", "--dirty", "--always"],
cwd=root)
if stdout is None:
return {}
if not stdout.startswith(tag_prefix):
if verbose:
print("tag '%s' doesn't start with prefix '%s'" % (stdout, tag_prefix))
return {}
tag = stdout[len(tag_prefix):]
stdout = run_command(GITS, ["rev-parse", "HEAD"], cwd=root)
if stdout is None:
return {}
full = stdout.strip()
if tag.endswith("-dirty"):
full += "-dirty"
return {"version": tag, "full": full}
def get_versions(default={"version": "unknown", "full": ""}, verbose=False):
# I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
# __file__, we can work backwards from there to the root. Some
# py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
# case we can only use expanded keywords.
keywords = { "refnames": git_refnames, "full": git_full }
ver = git_versions_from_keywords(keywords, tag_prefix, verbose)
if ver:
return ver
try:
root = os.path.abspath(__file__)
# versionfile_source is the relative path from the top of the source
# tree (where the .git directory might live) to this file. Invert
# this to find the root from __file__.
for i in range(len(versionfile_source.split(os.sep))):
root = os.path.dirname(root)
except NameError:
return default
return (git_versions_from_vcs(tag_prefix, root, verbose)
or versions_from_parentdir(parentdir_prefix, root, verbose)
or default)

View File

@@ -0,0 +1,53 @@
from __future__ import division
from . import der, ecdsa
class UnknownCurveError(Exception):
pass
def orderlen(order):
return (1+len("%x"%order))//2 # bytes
# the NIST curves
class Curve:
def __init__(self, name, openssl_name,
curve, generator, oid):
self.name = name
self.openssl_name = openssl_name # maybe None
self.curve = curve
self.generator = generator
self.order = generator.order()
self.baselen = orderlen(self.order)
self.verifying_key_length = 2*self.baselen
self.signature_length = 2*self.baselen
self.oid = oid
self.encoded_oid = der.encode_oid(*oid)
NIST192p = Curve("NIST192p", "prime192v1",
ecdsa.curve_192, ecdsa.generator_192,
(1, 2, 840, 10045, 3, 1, 1))
NIST224p = Curve("NIST224p", "secp224r1",
ecdsa.curve_224, ecdsa.generator_224,
(1, 3, 132, 0, 33))
NIST256p = Curve("NIST256p", "prime256v1",
ecdsa.curve_256, ecdsa.generator_256,
(1, 2, 840, 10045, 3, 1, 7))
NIST384p = Curve("NIST384p", "secp384r1",
ecdsa.curve_384, ecdsa.generator_384,
(1, 3, 132, 0, 34))
NIST521p = Curve("NIST521p", "secp521r1",
ecdsa.curve_521, ecdsa.generator_521,
(1, 3, 132, 0, 35))
SECP256k1 = Curve("SECP256k1", "secp256k1",
ecdsa.curve_secp256k1, ecdsa.generator_secp256k1,
(1, 3, 132, 0, 10))
curves = [NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1]
def find_curve(oid_curve):
for c in curves:
if c.oid == oid_curve:
return c
raise UnknownCurveError("I don't know about the curve with oid %s."
"I only know about these: %s" %
(oid_curve, [c.name for c in curves]))

199
bin/python/ecdsa/der.py Normal file
View File

@@ -0,0 +1,199 @@
from __future__ import division
import binascii
import base64
from .six import int2byte, b, integer_types, text_type
class UnexpectedDER(Exception):
pass
def encode_constructed(tag, value):
return int2byte(0xa0+tag) + encode_length(len(value)) + value
def encode_integer(r):
assert r >= 0 # can't support negative numbers yet
h = ("%x" % r).encode()
if len(h) % 2:
h = b("0") + h
s = binascii.unhexlify(h)
num = s[0] if isinstance(s[0], integer_types) else ord(s[0])
if num <= 0x7f:
return b("\x02") + int2byte(len(s)) + s
else:
# DER integers are two's complement, so if the first byte is
# 0x80-0xff then we need an extra 0x00 byte to prevent it from
# looking negative.
return b("\x02") + int2byte(len(s)+1) + b("\x00") + s
def encode_bitstring(s):
return b("\x03") + encode_length(len(s)) + s
def encode_octet_string(s):
return b("\x04") + encode_length(len(s)) + s
def encode_oid(first, second, *pieces):
assert first <= 2
assert second <= 39
encoded_pieces = [int2byte(40*first+second)] + [encode_number(p)
for p in pieces]
body = b('').join(encoded_pieces)
return b('\x06') + encode_length(len(body)) + body
def encode_sequence(*encoded_pieces):
total_len = sum([len(p) for p in encoded_pieces])
return b('\x30') + encode_length(total_len) + b('').join(encoded_pieces)
def encode_number(n):
b128_digits = []
while n:
b128_digits.insert(0, (n & 0x7f) | 0x80)
n = n >> 7
if not b128_digits:
b128_digits.append(0)
b128_digits[-1] &= 0x7f
return b('').join([int2byte(d) for d in b128_digits])
def remove_constructed(string):
s0 = string[0] if isinstance(string[0], integer_types) else ord(string[0])
if (s0 & 0xe0) != 0xa0:
raise UnexpectedDER("wanted constructed tag (0xa0-0xbf), got 0x%02x"
% s0)
tag = s0 & 0x1f
length, llen = read_length(string[1:])
body = string[1+llen:1+llen+length]
rest = string[1+llen+length:]
return tag, body, rest
def remove_sequence(string):
if not string.startswith(b("\x30")):
n = string[0] if isinstance(string[0], integer_types) else ord(string[0])
raise UnexpectedDER("wanted sequence (0x30), got 0x%02x" % n)
length, lengthlength = read_length(string[1:])
endseq = 1+lengthlength+length
return string[1+lengthlength:endseq], string[endseq:]
def remove_octet_string(string):
if not string.startswith(b("\x04")):
n = string[0] if isinstance(string[0], integer_types) else ord(string[0])
raise UnexpectedDER("wanted octetstring (0x04), got 0x%02x" % n)
length, llen = read_length(string[1:])
body = string[1+llen:1+llen+length]
rest = string[1+llen+length:]
return body, rest
def remove_object(string):
if not string.startswith(b("\x06")):
n = string[0] if isinstance(string[0], integer_types) else ord(string[0])
raise UnexpectedDER("wanted object (0x06), got 0x%02x" % n)
length, lengthlength = read_length(string[1:])
body = string[1+lengthlength:1+lengthlength+length]
rest = string[1+lengthlength+length:]
numbers = []
while body:
n, ll = read_number(body)
numbers.append(n)
body = body[ll:]
n0 = numbers.pop(0)
first = n0//40
second = n0-(40*first)
numbers.insert(0, first)
numbers.insert(1, second)
return tuple(numbers), rest
def remove_integer(string):
if not string.startswith(b("\x02")):
n = string[0] if isinstance(string[0], integer_types) else ord(string[0])
raise UnexpectedDER("wanted integer (0x02), got 0x%02x" % n)
length, llen = read_length(string[1:])
numberbytes = string[1+llen:1+llen+length]
rest = string[1+llen+length:]
nbytes = numberbytes[0] if isinstance(numberbytes[0], integer_types) else ord(numberbytes[0])
assert nbytes < 0x80 # can't support negative numbers yet
return int(binascii.hexlify(numberbytes), 16), rest
def read_number(string):
number = 0
llen = 0
# base-128 big endian, with b7 set in all but the last byte
while True:
if llen > len(string):
raise UnexpectedDER("ran out of length bytes")
number = number << 7
d = string[llen] if isinstance(string[llen], integer_types) else ord(string[llen])
number += (d & 0x7f)
llen += 1
if not d & 0x80:
break
return number, llen
def encode_length(l):
assert l >= 0
if l < 0x80:
return int2byte(l)
s = ("%x" % l).encode()
if len(s)%2:
s = b("0")+s
s = binascii.unhexlify(s)
llen = len(s)
return int2byte(0x80|llen) + s
def read_length(string):
num = string[0] if isinstance(string[0], integer_types) else ord(string[0])
if not (num & 0x80):
# short form
return (num & 0x7f), 1
# else long-form: b0&0x7f is number of additional base256 length bytes,
# big-endian
llen = num & 0x7f
if llen > len(string)-1:
raise UnexpectedDER("ran out of length bytes")
return int(binascii.hexlify(string[1:1+llen]), 16), 1+llen
def remove_bitstring(string):
num = string[0] if isinstance(string[0], integer_types) else ord(string[0])
if not string.startswith(b("\x03")):
raise UnexpectedDER("wanted bitstring (0x03), got 0x%02x" % num)
length, llen = read_length(string[1:])
body = string[1+llen:1+llen+length]
rest = string[1+llen+length:]
return body, rest
# SEQUENCE([1, STRING(secexp), cont[0], OBJECT(curvename), cont[1], BINTSTRING)
# signatures: (from RFC3279)
# ansi-X9-62 OBJECT IDENTIFIER ::= {
# iso(1) member-body(2) us(840) 10045 }
#
# id-ecSigType OBJECT IDENTIFIER ::= {
# ansi-X9-62 signatures(4) }
# ecdsa-with-SHA1 OBJECT IDENTIFIER ::= {
# id-ecSigType 1 }
## so 1,2,840,10045,4,1
## so 0x42, .. ..
# Ecdsa-Sig-Value ::= SEQUENCE {
# r INTEGER,
# s INTEGER }
# id-public-key-type OBJECT IDENTIFIER ::= { ansi-X9.62 2 }
#
# id-ecPublicKey OBJECT IDENTIFIER ::= { id-publicKeyType 1 }
# I think the secp224r1 identifier is (t=06,l=05,v=2b81040021)
# secp224r1 OBJECT IDENTIFIER ::= {
# iso(1) identified-organization(3) certicom(132) curve(0) 33 }
# and the secp384r1 is (t=06,l=05,v=2b81040022)
# secp384r1 OBJECT IDENTIFIER ::= {
# iso(1) identified-organization(3) certicom(132) curve(0) 34 }
def unpem(pem):
if isinstance(pem, text_type):
pem = pem.encode()
d = b("").join([l.strip() for l in pem.split(b("\n"))
if l and not l.startswith(b("-----"))])
return base64.b64decode(d)
def topem(der, name):
b64 = base64.b64encode(der)
lines = [("-----BEGIN %s-----\n" % name).encode()]
lines.extend([b64[start:start+64]+b("\n")
for start in range(0, len(b64), 64)])
lines.append(("-----END %s-----\n" % name).encode())
return b("").join(lines)

576
bin/python/ecdsa/ecdsa.py Normal file
View File

@@ -0,0 +1,576 @@
#! /usr/bin/env python
"""
Implementation of Elliptic-Curve Digital Signatures.
Classes and methods for elliptic-curve signatures:
private keys, public keys, signatures,
NIST prime-modulus curves with modulus lengths of
192, 224, 256, 384, and 521 bits.
Example:
# (In real-life applications, you would probably want to
# protect against defects in SystemRandom.)
from random import SystemRandom
randrange = SystemRandom().randrange
# Generate a public/private key pair using the NIST Curve P-192:
g = generator_192
n = g.order()
secret = randrange( 1, n )
pubkey = Public_key( g, g * secret )
privkey = Private_key( pubkey, secret )
# Signing a hash value:
hash = randrange( 1, n )
signature = privkey.sign( hash, randrange( 1, n ) )
# Verifying a signature for a hash value:
if pubkey.verifies( hash, signature ):
print_("Demo verification succeeded.")
else:
print_("*** Demo verification failed.")
# Verification fails if the hash value is modified:
if pubkey.verifies( hash-1, signature ):
print_("**** Demo verification failed to reject tampered hash.")
else:
print_("Demo verification correctly rejected tampered hash.")
Version of 2009.05.16.
Revision history:
2005.12.31 - Initial version.
2008.11.25 - Substantial revisions introducing new classes.
2009.05.16 - Warn against using random.randrange in real applications.
2009.05.17 - Use random.SystemRandom by default.
Written in 2005 by Peter Pearson and placed in the public domain.
"""
from .six import int2byte, b, print_
from . import ellipticcurve
from . import numbertheory
import random
class Signature( object ):
"""ECDSA signature.
"""
def __init__( self, r, s ):
self.r = r
self.s = s
class Public_key( object ):
"""Public key for ECDSA.
"""
def __init__( self, generator, point ):
"""generator is the Point that generates the group,
point is the Point that defines the public key.
"""
self.curve = generator.curve()
self.generator = generator
self.point = point
n = generator.order()
if not n:
raise RuntimeError("Generator point must have order.")
if not n * point == ellipticcurve.INFINITY:
raise RuntimeError("Generator point order is bad.")
if point.x() < 0 or n <= point.x() or point.y() < 0 or n <= point.y():
raise RuntimeError("Generator point has x or y out of range.")
def verifies( self, hash, signature ):
"""Verify that signature is a valid signature of hash.
Return True if the signature is valid.
"""
# From X9.62 J.3.1.
G = self.generator
n = G.order()
r = signature.r
s = signature.s
if r < 1 or r > n-1: return False
if s < 1 or s > n-1: return False
c = numbertheory.inverse_mod( s, n )
u1 = ( hash * c ) % n
u2 = ( r * c ) % n
xy = u1 * G + u2 * self.point
v = xy.x() % n
return v == r
class Private_key( object ):
"""Private key for ECDSA.
"""
def __init__( self, public_key, secret_multiplier ):
"""public_key is of class Public_key;
secret_multiplier is a large integer.
"""
self.public_key = public_key
self.secret_multiplier = secret_multiplier
def sign( self, hash, random_k ):
"""Return a signature for the provided hash, using the provided
random nonce. It is absolutely vital that random_k be an unpredictable
number in the range [1, self.public_key.point.order()-1]. If
an attacker can guess random_k, he can compute our private key from a
single signature. Also, if an attacker knows a few high-order
bits (or a few low-order bits) of random_k, he can compute our private
key from many signatures. The generation of nonces with adequate
cryptographic strength is very difficult and far beyond the scope
of this comment.
May raise RuntimeError, in which case retrying with a new
random value k is in order.
"""
G = self.public_key.generator
n = G.order()
k = random_k % n
p1 = k * G
r = p1.x()
if r == 0: raise RuntimeError("amazingly unlucky random number r")
s = ( numbertheory.inverse_mod( k, n ) * \
( hash + ( self.secret_multiplier * r ) % n ) ) % n
if s == 0: raise RuntimeError("amazingly unlucky random number s")
return Signature( r, s )
def int_to_string( x ):
"""Convert integer x into a string of bytes, as per X9.62."""
assert x >= 0
if x == 0: return b('\0')
result = []
while x:
ordinal = x & 0xFF
result.append(int2byte(ordinal))
x >>= 8
result.reverse()
return b('').join(result)
def string_to_int( s ):
"""Convert a string of bytes into an integer, as per X9.62."""
result = 0
for c in s:
if not isinstance(c, int): c = ord( c )
result = 256 * result + c
return result
def digest_integer( m ):
"""Convert an integer into a string of bytes, compute
its SHA-1 hash, and convert the result to an integer."""
#
# I don't expect this function to be used much. I wrote
# it in order to be able to duplicate the examples
# in ECDSAVS.
#
from hashlib import sha1
return string_to_int( sha1( int_to_string( m ) ).digest() )
def point_is_valid( generator, x, y ):
"""Is (x,y) a valid public key based on the specified generator?"""
# These are the tests specified in X9.62.
n = generator.order()
curve = generator.curve()
if x < 0 or n <= x or y < 0 or n <= y:
return False
if not curve.contains_point( x, y ):
return False
if not n*ellipticcurve.Point( curve, x, y ) == \
ellipticcurve.INFINITY:
return False
return True
# NIST Curve P-192:
_p = 6277101735386680763835789423207666416083908700390324961279
_r = 6277101735386680763835789423176059013767194773182842284081
# s = 0x3045ae6fc8422f64ed579528d38120eae12196d5L
# c = 0x3099d2bbbfcb2538542dcd5fb078b6ef5f3d6fe2c745de65L
_b = 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1
_Gx = 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012
_Gy = 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811
curve_192 = ellipticcurve.CurveFp( _p, -3, _b )
generator_192 = ellipticcurve.Point( curve_192, _Gx, _Gy, _r )
# NIST Curve P-224:
_p = 26959946667150639794667015087019630673557916260026308143510066298881
_r = 26959946667150639794667015087019625940457807714424391721682722368061
# s = 0xbd71344799d5c7fcdc45b59fa3b9ab8f6a948bc5L
# c = 0x5b056c7e11dd68f40469ee7f3c7a7d74f7d121116506d031218291fbL
_b = 0xb4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4
_Gx =0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21
_Gy = 0xbd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34
curve_224 = ellipticcurve.CurveFp( _p, -3, _b )
generator_224 = ellipticcurve.Point( curve_224, _Gx, _Gy, _r )
# NIST Curve P-256:
_p = 115792089210356248762697446949407573530086143415290314195533631308867097853951
_r = 115792089210356248762697446949407573529996955224135760342422259061068512044369
# s = 0xc49d360886e704936a6678e1139d26b7819f7e90L
# c = 0x7efba1662985be9403cb055c75d4f7e0ce8d84a9c5114abcaf3177680104fa0dL
_b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b
_Gx = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296
_Gy = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5
curve_256 = ellipticcurve.CurveFp( _p, -3, _b )
generator_256 = ellipticcurve.Point( curve_256, _Gx, _Gy, _r )
# NIST Curve P-384:
_p = 39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319
_r = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643
# s = 0xa335926aa319a27a1d00896a6773a4827acdac73L
# c = 0x79d1e655f868f02fff48dcdee14151ddb80643c1406d0ca10dfe6fc52009540a495e8042ea5f744f6e184667cc722483L
_b = 0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef
_Gx = 0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7
_Gy = 0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f
curve_384 = ellipticcurve.CurveFp( _p, -3, _b )
generator_384 = ellipticcurve.Point( curve_384, _Gx, _Gy, _r )
# NIST Curve P-521:
_p = 6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151
_r = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449
# s = 0xd09e8800291cb85396cc6717393284aaa0da64baL
# c = 0x0b48bfa5f420a34949539d2bdfc264eeeeb077688e44fbf0ad8f6d0edb37bd6b533281000518e19f1b9ffbe0fe9ed8a3c2200b8f875e523868c70c1e5bf55bad637L
_b = 0x051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00
_Gx = 0xc6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66
_Gy = 0x11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650
curve_521 = ellipticcurve.CurveFp( _p, -3, _b )
generator_521 = ellipticcurve.Point( curve_521, _Gx, _Gy, _r )
# Certicom secp256-k1
_a = 0x0000000000000000000000000000000000000000000000000000000000000000
_b = 0x0000000000000000000000000000000000000000000000000000000000000007
_p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
_Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
_Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
_r = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
curve_secp256k1 = ellipticcurve.CurveFp( _p, _a, _b)
generator_secp256k1 = ellipticcurve.Point( curve_secp256k1, _Gx, _Gy, _r)
def __main__():
class TestFailure(Exception): pass
def test_point_validity( generator, x, y, expected ):
"""generator defines the curve; is (x,y) a point on
this curve? "expected" is True if the right answer is Yes."""
if point_is_valid( generator, x, y ) == expected:
print_("Point validity tested as expected.")
else:
raise TestFailure("*** Point validity test gave wrong result.")
def test_signature_validity( Msg, Qx, Qy, R, S, expected ):
"""Msg = message, Qx and Qy represent the base point on
elliptic curve c192, R and S are the signature, and
"expected" is True iff the signature is expected to be valid."""
pubk = Public_key( generator_192,
ellipticcurve.Point( curve_192, Qx, Qy ) )
got = pubk.verifies( digest_integer( Msg ), Signature( R, S ) )
if got == expected:
print_("Signature tested as expected: got %s, expected %s." % \
( got, expected ))
else:
raise TestFailure("*** Signature test failed: got %s, expected %s." % \
( got, expected ))
print_("NIST Curve P-192:")
p192 = generator_192
# From X9.62:
d = 651056770906015076056810763456358567190100156695615665659
Q = d * p192
if Q.x() != 0x62B12D60690CDCF330BABAB6E69763B471F994DD702D16A5:
raise TestFailure("*** p192 * d came out wrong.")
else:
print_("p192 * d came out right.")
k = 6140507067065001063065065565667405560006161556565665656654
R = k * p192
if R.x() != 0x885052380FF147B734C330C43D39B2C4A89F29B0F749FEAD \
or R.y() != 0x9CF9FA1CBEFEFB917747A3BB29C072B9289C2547884FD835:
raise TestFailure("*** k * p192 came out wrong.")
else:
print_("k * p192 came out right.")
u1 = 2563697409189434185194736134579731015366492496392189760599
u2 = 6266643813348617967186477710235785849136406323338782220568
temp = u1 * p192 + u2 * Q
if temp.x() != 0x885052380FF147B734C330C43D39B2C4A89F29B0F749FEAD \
or temp.y() != 0x9CF9FA1CBEFEFB917747A3BB29C072B9289C2547884FD835:
raise TestFailure("*** u1 * p192 + u2 * Q came out wrong.")
else:
print_("u1 * p192 + u2 * Q came out right.")
e = 968236873715988614170569073515315707566766479517
pubk = Public_key( generator_192, generator_192 * d )
privk = Private_key( pubk, d )
sig = privk.sign( e, k )
r, s = sig.r, sig.s
if r != 3342403536405981729393488334694600415596881826869351677613 \
or s != 5735822328888155254683894997897571951568553642892029982342:
raise TestFailure("*** r or s came out wrong.")
else:
print_("r and s came out right.")
valid = pubk.verifies( e, sig )
if valid: print_("Signature verified OK.")
else: raise TestFailure("*** Signature failed verification.")
valid = pubk.verifies( e-1, sig )
if not valid: print_("Forgery was correctly rejected.")
else: raise TestFailure("*** Forgery was erroneously accepted.")
print_("Testing point validity, as per ECDSAVS.pdf B.2.2:")
test_point_validity( \
p192, \
0xcd6d0f029a023e9aaca429615b8f577abee685d8257cc83a, \
0x00019c410987680e9fb6c0b6ecc01d9a2647c8bae27721bacdfc, \
False )
test_point_validity(
p192, \
0x00017f2fce203639e9eaf9fb50b81fc32776b30e3b02af16c73b, \
0x95da95c5e72dd48e229d4748d4eee658a9a54111b23b2adb, \
False )
test_point_validity(
p192, \
0x4f77f8bc7fccbadd5760f4938746d5f253ee2168c1cf2792, \
0x000147156ff824d131629739817edb197717c41aab5c2a70f0f6, \
False )
test_point_validity(
p192, \
0xc58d61f88d905293bcd4cd0080bcb1b7f811f2ffa41979f6, \
0x8804dc7a7c4c7f8b5d437f5156f3312ca7d6de8a0e11867f, \
True )
test_point_validity(
p192, \
0xcdf56c1aa3d8afc53c521adf3ffb96734a6a630a4a5b5a70, \
0x97c1c44a5fb229007b5ec5d25f7413d170068ffd023caa4e, \
True )
test_point_validity(
p192, \
0x89009c0dc361c81e99280c8e91df578df88cdf4b0cdedced, \
0x27be44a529b7513e727251f128b34262a0fd4d8ec82377b9, \
True )
test_point_validity(
p192, \
0x6a223d00bd22c52833409a163e057e5b5da1def2a197dd15, \
0x7b482604199367f1f303f9ef627f922f97023e90eae08abf, \
True )
test_point_validity(
p192, \
0x6dccbde75c0948c98dab32ea0bc59fe125cf0fb1a3798eda, \
0x0001171a3e0fa60cf3096f4e116b556198de430e1fbd330c8835, \
False )
test_point_validity(
p192, \
0xd266b39e1f491fc4acbbbc7d098430931cfa66d55015af12, \
0x193782eb909e391a3148b7764e6b234aa94e48d30a16dbb2, \
False )
test_point_validity(
p192, \
0x9d6ddbcd439baa0c6b80a654091680e462a7d1d3f1ffeb43, \
0x6ad8efc4d133ccf167c44eb4691c80abffb9f82b932b8caa, \
False )
test_point_validity(
p192, \
0x146479d944e6bda87e5b35818aa666a4c998a71f4e95edbc, \
0xa86d6fe62bc8fbd88139693f842635f687f132255858e7f6, \
False )
test_point_validity(
p192, \
0xe594d4a598046f3598243f50fd2c7bd7d380edb055802253, \
0x509014c0c4d6b536e3ca750ec09066af39b4c8616a53a923, \
False )
print_("Trying signature-verification tests from ECDSAVS.pdf B.2.4:")
print_("P-192:")
Msg = 0x84ce72aa8699df436059f052ac51b6398d2511e49631bcb7e71f89c499b9ee425dfbc13a5f6d408471b054f2655617cbbaf7937b7c80cd8865cf02c8487d30d2b0fbd8b2c4e102e16d828374bbc47b93852f212d5043c3ea720f086178ff798cc4f63f787b9c2e419efa033e7644ea7936f54462dc21a6c4580725f7f0e7d158
Qx = 0xd9dbfb332aa8e5ff091e8ce535857c37c73f6250ffb2e7ac
Qy = 0x282102e364feded3ad15ddf968f88d8321aa268dd483ebc4
R = 0x64dca58a20787c488d11d6dd96313f1b766f2d8efe122916
S = 0x1ecba28141e84ab4ecad92f56720e2cc83eb3d22dec72479
test_signature_validity( Msg, Qx, Qy, R, S, True )
Msg = 0x94bb5bacd5f8ea765810024db87f4224ad71362a3c28284b2b9f39fab86db12e8beb94aae899768229be8fdb6c4f12f28912bb604703a79ccff769c1607f5a91450f30ba0460d359d9126cbd6296be6d9c4bb96c0ee74cbb44197c207f6db326ab6f5a659113a9034e54be7b041ced9dcf6458d7fb9cbfb2744d999f7dfd63f4
Qx = 0x3e53ef8d3112af3285c0e74842090712cd324832d4277ae7
Qy = 0xcc75f8952d30aec2cbb719fc6aa9934590b5d0ff5a83adb7
R = 0x8285261607283ba18f335026130bab31840dcfd9c3e555af
S = 0x356d89e1b04541afc9704a45e9c535ce4a50929e33d7e06c
test_signature_validity( Msg, Qx, Qy, R, S, True )
Msg = 0xf6227a8eeb34afed1621dcc89a91d72ea212cb2f476839d9b4243c66877911b37b4ad6f4448792a7bbba76c63bdd63414b6facab7dc71c3396a73bd7ee14cdd41a659c61c99b779cecf07bc51ab391aa3252386242b9853ea7da67fd768d303f1b9b513d401565b6f1eb722dfdb96b519fe4f9bd5de67ae131e64b40e78c42dd
Qx = 0x16335dbe95f8e8254a4e04575d736befb258b8657f773cb7
Qy = 0x421b13379c59bc9dce38a1099ca79bbd06d647c7f6242336
R = 0x4141bd5d64ea36c5b0bd21ef28c02da216ed9d04522b1e91
S = 0x159a6aa852bcc579e821b7bb0994c0861fb08280c38daa09
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0x16b5f93afd0d02246f662761ed8e0dd9504681ed02a253006eb36736b563097ba39f81c8e1bce7a16c1339e345efabbc6baa3efb0612948ae51103382a8ee8bc448e3ef71e9f6f7a9676694831d7f5dd0db5446f179bcb737d4a526367a447bfe2c857521c7f40b6d7d7e01a180d92431fb0bbd29c04a0c420a57b3ed26ccd8a
Qx = 0xfd14cdf1607f5efb7b1793037b15bdf4baa6f7c16341ab0b
Qy = 0x83fa0795cc6c4795b9016dac928fd6bac32f3229a96312c4
R = 0x8dfdb832951e0167c5d762a473c0416c5c15bc1195667dc1
S = 0x1720288a2dc13fa1ec78f763f8fe2ff7354a7e6fdde44520
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0x08a2024b61b79d260e3bb43ef15659aec89e5b560199bc82cf7c65c77d39192e03b9a895d766655105edd9188242b91fbde4167f7862d4ddd61e5d4ab55196683d4f13ceb90d87aea6e07eb50a874e33086c4a7cb0273a8e1c4408f4b846bceae1ebaac1b2b2ea851a9b09de322efe34cebe601653efd6ddc876ce8c2f2072fb
Qx = 0x674f941dc1a1f8b763c9334d726172d527b90ca324db8828
Qy = 0x65adfa32e8b236cb33a3e84cf59bfb9417ae7e8ede57a7ff
R = 0x9508b9fdd7daf0d8126f9e2bc5a35e4c6d800b5b804d7796
S = 0x36f2bf6b21b987c77b53bb801b3435a577e3d493744bfab0
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0x1843aba74b0789d4ac6b0b8923848023a644a7b70afa23b1191829bbe4397ce15b629bf21a8838298653ed0c19222b95fa4f7390d1b4c844d96e645537e0aae98afb5c0ac3bd0e4c37f8daaff25556c64e98c319c52687c904c4de7240a1cc55cd9756b7edaef184e6e23b385726e9ffcba8001b8f574987c1a3fedaaa83ca6d
Qx = 0x10ecca1aad7220b56a62008b35170bfd5e35885c4014a19f
Qy = 0x04eb61984c6c12ade3bc47f3c629ece7aa0a033b9948d686
R = 0x82bfa4e82c0dfe9274169b86694e76ce993fd83b5c60f325
S = 0xa97685676c59a65dbde002fe9d613431fb183e8006d05633
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0x5a478f4084ddd1a7fea038aa9732a822106385797d02311aeef4d0264f824f698df7a48cfb6b578cf3da416bc0799425bb491be5b5ecc37995b85b03420a98f2c4dc5c31a69a379e9e322fbe706bbcaf0f77175e05cbb4fa162e0da82010a278461e3e974d137bc746d1880d6eb02aa95216014b37480d84b87f717bb13f76e1
Qx = 0x6636653cb5b894ca65c448277b29da3ad101c4c2300f7c04
Qy = 0xfdf1cbb3fc3fd6a4f890b59e554544175fa77dbdbeb656c1
R = 0xeac2ddecddfb79931a9c3d49c08de0645c783a24cb365e1c
S = 0x3549fee3cfa7e5f93bc47d92d8ba100e881a2a93c22f8d50
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0xc598774259a058fa65212ac57eaa4f52240e629ef4c310722088292d1d4af6c39b49ce06ba77e4247b20637174d0bd67c9723feb57b5ead232b47ea452d5d7a089f17c00b8b6767e434a5e16c231ba0efa718a340bf41d67ea2d295812ff1b9277daacb8bc27b50ea5e6443bcf95ef4e9f5468fe78485236313d53d1c68f6ba2
Qx = 0xa82bd718d01d354001148cd5f69b9ebf38ff6f21898f8aaa
Qy = 0xe67ceede07fc2ebfafd62462a51e4b6c6b3d5b537b7caf3e
R = 0x4d292486c620c3de20856e57d3bb72fcde4a73ad26376955
S = 0xa85289591a6081d5728825520e62ff1c64f94235c04c7f95
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0xca98ed9db081a07b7557f24ced6c7b9891269a95d2026747add9e9eb80638a961cf9c71a1b9f2c29744180bd4c3d3db60f2243c5c0b7cc8a8d40a3f9a7fc910250f2187136ee6413ffc67f1a25e1c4c204fa9635312252ac0e0481d89b6d53808f0c496ba87631803f6c572c1f61fa049737fdacce4adff757afed4f05beb658
Qx = 0x7d3b016b57758b160c4fca73d48df07ae3b6b30225126c2f
Qy = 0x4af3790d9775742bde46f8da876711be1b65244b2b39e7ec
R = 0x95f778f5f656511a5ab49a5d69ddd0929563c29cbc3a9e62
S = 0x75c87fc358c251b4c83d2dd979faad496b539f9f2ee7a289
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0x31dd9a54c8338bea06b87eca813d555ad1850fac9742ef0bbe40dad400e10288acc9c11ea7dac79eb16378ebea9490e09536099f1b993e2653cd50240014c90a9c987f64545abc6a536b9bd2435eb5e911fdfde2f13be96ea36ad38df4ae9ea387b29cced599af777338af2794820c9cce43b51d2112380a35802ab7e396c97a
Qx = 0x9362f28c4ef96453d8a2f849f21e881cd7566887da8beb4a
Qy = 0xe64d26d8d74c48a024ae85d982ee74cd16046f4ee5333905
R = 0xf3923476a296c88287e8de914b0b324ad5a963319a4fe73b
S = 0xf0baeed7624ed00d15244d8ba2aede085517dbdec8ac65f5
test_signature_validity( Msg, Qx, Qy, R, S, True )
Msg = 0xb2b94e4432267c92f9fdb9dc6040c95ffa477652761290d3c7de312283f6450d89cc4aabe748554dfb6056b2d8e99c7aeaad9cdddebdee9dbc099839562d9064e68e7bb5f3a6bba0749ca9a538181fc785553a4000785d73cc207922f63e8ce1112768cb1de7b673aed83a1e4a74592f1268d8e2a4e9e63d414b5d442bd0456d
Qx = 0xcc6fc032a846aaac25533eb033522824f94e670fa997ecef
Qy = 0xe25463ef77a029eccda8b294fd63dd694e38d223d30862f1
R = 0x066b1d07f3a40e679b620eda7f550842a35c18b80c5ebe06
S = 0xa0b0fb201e8f2df65e2c4508ef303bdc90d934016f16b2dc
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0x4366fcadf10d30d086911de30143da6f579527036937007b337f7282460eae5678b15cccda853193ea5fc4bc0a6b9d7a31128f27e1214988592827520b214eed5052f7775b750b0c6b15f145453ba3fee24a085d65287e10509eb5d5f602c440341376b95c24e5c4727d4b859bfe1483d20538acdd92c7997fa9c614f0f839d7
Qx = 0x955c908fe900a996f7e2089bee2f6376830f76a19135e753
Qy = 0xba0c42a91d3847de4a592a46dc3fdaf45a7cc709b90de520
R = 0x1f58ad77fc04c782815a1405b0925e72095d906cbf52a668
S = 0xf2e93758b3af75edf784f05a6761c9b9a6043c66b845b599
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0x543f8af57d750e33aa8565e0cae92bfa7a1ff78833093421c2942cadf9986670a5ff3244c02a8225e790fbf30ea84c74720abf99cfd10d02d34377c3d3b41269bea763384f372bb786b5846f58932defa68023136cd571863b304886e95e52e7877f445b9364b3f06f3c28da12707673fecb4b8071de06b6e0a3c87da160cef3
Qx = 0x31f7fa05576d78a949b24812d4383107a9a45bb5fccdd835
Qy = 0x8dc0eb65994a90f02b5e19bd18b32d61150746c09107e76b
R = 0xbe26d59e4e883dde7c286614a767b31e49ad88789d3a78ff
S = 0x8762ca831c1ce42df77893c9b03119428e7a9b819b619068
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0xd2e8454143ce281e609a9d748014dcebb9d0bc53adb02443a6aac2ffe6cb009f387c346ecb051791404f79e902ee333ad65e5c8cb38dc0d1d39a8dc90add5023572720e5b94b190d43dd0d7873397504c0c7aef2727e628eb6a74411f2e400c65670716cb4a815dc91cbbfeb7cfe8c929e93184c938af2c078584da045e8f8d1
Qx = 0x66aa8edbbdb5cf8e28ceb51b5bda891cae2df84819fe25c0
Qy = 0x0c6bc2f69030a7ce58d4a00e3b3349844784a13b8936f8da
R = 0xa4661e69b1734f4a71b788410a464b71e7ffe42334484f23
S = 0x738421cf5e049159d69c57a915143e226cac8355e149afe9
test_signature_validity( Msg, Qx, Qy, R, S, False )
Msg = 0x6660717144040f3e2f95a4e25b08a7079c702a8b29babad5a19a87654bc5c5afa261512a11b998a4fb36b5d8fe8bd942792ff0324b108120de86d63f65855e5461184fc96a0a8ffd2ce6d5dfb0230cbbdd98f8543e361b3205f5da3d500fdc8bac6db377d75ebef3cb8f4d1ff738071ad0938917889250b41dd1d98896ca06fb
Qx = 0xbcfacf45139b6f5f690a4c35a5fffa498794136a2353fc77
Qy = 0x6f4a6c906316a6afc6d98fe1f0399d056f128fe0270b0f22
R = 0x9db679a3dafe48f7ccad122933acfe9da0970b71c94c21c1
S = 0x984c2db99827576c0a41a5da41e07d8cc768bc82f18c9da9
test_signature_validity( Msg, Qx, Qy, R, S, False )
print_("Testing the example code:")
# Building a public/private key pair from the NIST Curve P-192:
g = generator_192
n = g.order()
# (random.SystemRandom is supposed to provide
# crypto-quality random numbers, but as Debian recently
# illustrated, a systems programmer can accidentally
# demolish this security, so in serious applications
# further precautions are appropriate.)
randrange = random.SystemRandom().randrange
secret = randrange( 1, n )
pubkey = Public_key( g, g * secret )
privkey = Private_key( pubkey, secret )
# Signing a hash value:
hash = randrange( 1, n )
signature = privkey.sign( hash, randrange( 1, n ) )
# Verifying a signature for a hash value:
if pubkey.verifies( hash, signature ):
print_("Demo verification succeeded.")
else:
raise TestFailure("*** Demo verification failed.")
if pubkey.verifies( hash-1, signature ):
raise TestFailure( "**** Demo verification failed to reject tampered hash.")
else:
print_("Demo verification correctly rejected tampered hash.")
if __name__ == "__main__":
__main__()

View File

@@ -0,0 +1,293 @@
#! /usr/bin/env python
#
# Implementation of elliptic curves, for cryptographic applications.
#
# This module doesn't provide any way to choose a random elliptic
# curve, nor to verify that an elliptic curve was chosen randomly,
# because one can simply use NIST's standard curves.
#
# Notes from X9.62-1998 (draft):
# Nomenclature:
# - Q is a public key.
# The "Elliptic Curve Domain Parameters" include:
# - q is the "field size", which in our case equals p.
# - p is a big prime.
# - G is a point of prime order (5.1.1.1).
# - n is the order of G (5.1.1.1).
# Public-key validation (5.2.2):
# - Verify that Q is not the point at infinity.
# - Verify that X_Q and Y_Q are in [0,p-1].
# - Verify that Q is on the curve.
# - Verify that nQ is the point at infinity.
# Signature generation (5.3):
# - Pick random k from [1,n-1].
# Signature checking (5.4.2):
# - Verify that r and s are in [1,n-1].
#
# Version of 2008.11.25.
#
# Revision history:
# 2005.12.31 - Initial version.
# 2008.11.25 - Change CurveFp.is_on to contains_point.
#
# Written in 2005 by Peter Pearson and placed in the public domain.
from __future__ import division
from .six import print_
from . import numbertheory
class CurveFp( object ):
"""Elliptic Curve over the field of integers modulo a prime."""
def __init__( self, p, a, b ):
"""The curve of points satisfying y^2 = x^3 + a*x + b (mod p)."""
self.__p = p
self.__a = a
self.__b = b
def p( self ):
return self.__p
def a( self ):
return self.__a
def b( self ):
return self.__b
def contains_point( self, x, y ):
"""Is the point (x,y) on this curve?"""
return ( y * y - ( x * x * x + self.__a * x + self.__b ) ) % self.__p == 0
class Point( object ):
"""A point on an elliptic curve. Altering x and y is forbidding,
but they can be read by the x() and y() methods."""
def __init__( self, curve, x, y, order = None ):
"""curve, x, y, order; order (optional) is the order of this point."""
self.__curve = curve
self.__x = x
self.__y = y
self.__order = order
# self.curve is allowed to be None only for INFINITY:
if self.__curve: assert self.__curve.contains_point( x, y )
if order: assert self * order == INFINITY
def __eq__( self, other ):
"""Return True if the points are identical, False otherwise."""
if self.__curve == other.__curve \
and self.__x == other.__x \
and self.__y == other.__y:
return True
else:
return False
def __add__( self, other ):
"""Add one point to another point."""
# X9.62 B.3:
if other == INFINITY: return self
if self == INFINITY: return other
assert self.__curve == other.__curve
if self.__x == other.__x:
if ( self.__y + other.__y ) % self.__curve.p() == 0:
return INFINITY
else:
return self.double()
p = self.__curve.p()
l = ( ( other.__y - self.__y ) * \
numbertheory.inverse_mod( other.__x - self.__x, p ) ) % p
x3 = ( l * l - self.__x - other.__x ) % p
y3 = ( l * ( self.__x - x3 ) - self.__y ) % p
return Point( self.__curve, x3, y3 )
def __mul__( self, other ):
"""Multiply a point by an integer."""
def leftmost_bit( x ):
assert x > 0
result = 1
while result <= x: result = 2 * result
return result // 2
e = other
if self.__order: e = e % self.__order
if e == 0: return INFINITY
if self == INFINITY: return INFINITY
assert e > 0
# From X9.62 D.3.2:
e3 = 3 * e
negative_self = Point( self.__curve, self.__x, -self.__y, self.__order )
i = leftmost_bit( e3 ) // 2
result = self
# print_("Multiplying %s by %d (e3 = %d):" % ( self, other, e3 ))
while i > 1:
result = result.double()
if ( e3 & i ) != 0 and ( e & i ) == 0: result = result + self
if ( e3 & i ) == 0 and ( e & i ) != 0: result = result + negative_self
# print_(". . . i = %d, result = %s" % ( i, result ))
i = i // 2
return result
def __rmul__( self, other ):
"""Multiply a point by an integer."""
return self * other
def __str__( self ):
if self == INFINITY: return "infinity"
return "(%d,%d)" % ( self.__x, self.__y )
def double( self ):
"""Return a new point that is twice the old."""
if self == INFINITY:
return INFINITY
# X9.62 B.3:
p = self.__curve.p()
a = self.__curve.a()
l = ( ( 3 * self.__x * self.__x + a ) * \
numbertheory.inverse_mod( 2 * self.__y, p ) ) % p
x3 = ( l * l - 2 * self.__x ) % p
y3 = ( l * ( self.__x - x3 ) - self.__y ) % p
return Point( self.__curve, x3, y3 )
def x( self ):
return self.__x
def y( self ):
return self.__y
def curve( self ):
return self.__curve
def order( self ):
return self.__order
# This one point is the Point At Infinity for all purposes:
INFINITY = Point( None, None, None )
def __main__():
class FailedTest(Exception): pass
def test_add( c, x1, y1, x2, y2, x3, y3 ):
"""We expect that on curve c, (x1,y1) + (x2, y2 ) = (x3, y3)."""
p1 = Point( c, x1, y1 )
p2 = Point( c, x2, y2 )
p3 = p1 + p2
print_("%s + %s = %s" % ( p1, p2, p3 ), end=' ')
if p3.x() != x3 or p3.y() != y3:
raise FailedTest("Failure: should give (%d,%d)." % ( x3, y3 ))
else:
print_(" Good.")
def test_double( c, x1, y1, x3, y3 ):
"""We expect that on curve c, 2*(x1,y1) = (x3, y3)."""
p1 = Point( c, x1, y1 )
p3 = p1.double()
print_("%s doubled = %s" % ( p1, p3 ), end=' ')
if p3.x() != x3 or p3.y() != y3:
raise FailedTest("Failure: should give (%d,%d)." % ( x3, y3 ))
else:
print_(" Good.")
def test_double_infinity( c ):
"""We expect that on curve c, 2*INFINITY = INFINITY."""
p1 = INFINITY
p3 = p1.double()
print_("%s doubled = %s" % ( p1, p3 ), end=' ')
if p3.x() != INFINITY.x() or p3.y() != INFINITY.y():
raise FailedTest("Failure: should give (%d,%d)." % ( INFINITY.x(), INFINITY.y() ))
else:
print_(" Good.")
def test_multiply( c, x1, y1, m, x3, y3 ):
"""We expect that on curve c, m*(x1,y1) = (x3,y3)."""
p1 = Point( c, x1, y1 )
p3 = p1 * m
print_("%s * %d = %s" % ( p1, m, p3 ), end=' ')
if p3.x() != x3 or p3.y() != y3:
raise FailedTest("Failure: should give (%d,%d)." % ( x3, y3 ))
else:
print_(" Good.")
# A few tests from X9.62 B.3:
c = CurveFp( 23, 1, 1 )
test_add( c, 3, 10, 9, 7, 17, 20 )
test_double( c, 3, 10, 7, 12 )
test_add( c, 3, 10, 3, 10, 7, 12 ) # (Should just invoke double.)
test_multiply( c, 3, 10, 2, 7, 12 )
test_double_infinity(c)
# From X9.62 I.1 (p. 96):
g = Point( c, 13, 7, 7 )
check = INFINITY
for i in range( 7 + 1 ):
p = ( i % 7 ) * g
print_("%s * %d = %s, expected %s . . ." % ( g, i, p, check ), end=' ')
if p == check:
print_(" Good.")
else:
raise FailedTest("Bad.")
check = check + g
# NIST Curve P-192:
p = 6277101735386680763835789423207666416083908700390324961279
r = 6277101735386680763835789423176059013767194773182842284081
#s = 0x3045ae6fc8422f64ed579528d38120eae12196d5L
c = 0x3099d2bbbfcb2538542dcd5fb078b6ef5f3d6fe2c745de65
b = 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1
Gx = 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012
Gy = 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811
c192 = CurveFp( p, -3, b )
p192 = Point( c192, Gx, Gy, r )
# Checking against some sample computations presented
# in X9.62:
d = 651056770906015076056810763456358567190100156695615665659
Q = d * p192
if Q.x() != 0x62B12D60690CDCF330BABAB6E69763B471F994DD702D16A5:
raise FailedTest("p192 * d came out wrong.")
else:
print_("p192 * d came out right.")
k = 6140507067065001063065065565667405560006161556565665656654
R = k * p192
if R.x() != 0x885052380FF147B734C330C43D39B2C4A89F29B0F749FEAD \
or R.y() != 0x9CF9FA1CBEFEFB917747A3BB29C072B9289C2547884FD835:
raise FailedTest("k * p192 came out wrong.")
else:
print_("k * p192 came out right.")
u1 = 2563697409189434185194736134579731015366492496392189760599
u2 = 6266643813348617967186477710235785849136406323338782220568
temp = u1 * p192 + u2 * Q
if temp.x() != 0x885052380FF147B734C330C43D39B2C4A89F29B0F749FEAD \
or temp.y() != 0x9CF9FA1CBEFEFB917747A3BB29C072B9289C2547884FD835:
raise FailedTest("u1 * p192 + u2 * Q came out wrong.")
else:
print_("u1 * p192 + u2 * Q came out right.")
if __name__ == "__main__":
__main__()

283
bin/python/ecdsa/keys.py Normal file
View File

@@ -0,0 +1,283 @@
import binascii
from . import ecdsa
from . import der
from . import rfc6979
from .curves import NIST192p, find_curve
from .util import string_to_number, number_to_string, randrange
from .util import sigencode_string, sigdecode_string
from .util import oid_ecPublicKey, encoded_oid_ecPublicKey
from .six import PY3, b
from hashlib import sha1
class BadSignatureError(Exception):
pass
class BadDigestError(Exception):
pass
class VerifyingKey:
def __init__(self, _error__please_use_generate=None):
if not _error__please_use_generate:
raise TypeError("Please use SigningKey.generate() to construct me")
@classmethod
def from_public_point(klass, point, curve=NIST192p, hashfunc=sha1):
self = klass(_error__please_use_generate=True)
self.curve = curve
self.default_hashfunc = hashfunc
self.pubkey = ecdsa.Public_key(curve.generator, point)
self.pubkey.order = curve.order
return self
@classmethod
def from_string(klass, string, curve=NIST192p, hashfunc=sha1,
validate_point=True):
order = curve.order
assert len(string) == curve.verifying_key_length, \
(len(string), curve.verifying_key_length)
xs = string[:curve.baselen]
ys = string[curve.baselen:]
assert len(xs) == curve.baselen, (len(xs), curve.baselen)
assert len(ys) == curve.baselen, (len(ys), curve.baselen)
x = string_to_number(xs)
y = string_to_number(ys)
if validate_point:
assert ecdsa.point_is_valid(curve.generator, x, y)
from . import ellipticcurve
point = ellipticcurve.Point(curve.curve, x, y, order)
return klass.from_public_point(point, curve, hashfunc)
@classmethod
def from_pem(klass, string):
return klass.from_der(der.unpem(string))
@classmethod
def from_der(klass, string):
# [[oid_ecPublicKey,oid_curve], point_str_bitstring]
s1,empty = der.remove_sequence(string)
if empty != b(""):
raise der.UnexpectedDER("trailing junk after DER pubkey: %s" %
binascii.hexlify(empty))
s2,point_str_bitstring = der.remove_sequence(s1)
# s2 = oid_ecPublicKey,oid_curve
oid_pk, rest = der.remove_object(s2)
oid_curve, empty = der.remove_object(rest)
if empty != b(""):
raise der.UnexpectedDER("trailing junk after DER pubkey objects: %s" %
binascii.hexlify(empty))
assert oid_pk == oid_ecPublicKey, (oid_pk, oid_ecPublicKey)
curve = find_curve(oid_curve)
point_str, empty = der.remove_bitstring(point_str_bitstring)
if empty != b(""):
raise der.UnexpectedDER("trailing junk after pubkey pointstring: %s" %
binascii.hexlify(empty))
assert point_str.startswith(b("\x00\x04"))
return klass.from_string(point_str[2:], curve)
def to_string(self):
# VerifyingKey.from_string(vk.to_string()) == vk as long as the
# curves are the same: the curve itself is not included in the
# serialized form
order = self.pubkey.order
x_str = number_to_string(self.pubkey.point.x(), order)
y_str = number_to_string(self.pubkey.point.y(), order)
return x_str + y_str
def to_pem(self):
return der.topem(self.to_der(), "PUBLIC KEY")
def to_der(self):
order = self.pubkey.order
x_str = number_to_string(self.pubkey.point.x(), order)
y_str = number_to_string(self.pubkey.point.y(), order)
point_str = b("\x00\x04") + x_str + y_str
return der.encode_sequence(der.encode_sequence(encoded_oid_ecPublicKey,
self.curve.encoded_oid),
der.encode_bitstring(point_str))
def verify(self, signature, data, hashfunc=None, sigdecode=sigdecode_string):
hashfunc = hashfunc or self.default_hashfunc
digest = hashfunc(data).digest()
return self.verify_digest(signature, digest, sigdecode)
def verify_digest(self, signature, digest, sigdecode=sigdecode_string):
if len(digest) > self.curve.baselen:
raise BadDigestError("this curve (%s) is too short "
"for your digest (%d)" % (self.curve.name,
8*len(digest)))
number = string_to_number(digest)
r, s = sigdecode(signature, self.pubkey.order)
sig = ecdsa.Signature(r, s)
if self.pubkey.verifies(number, sig):
return True
raise BadSignatureError
class SigningKey:
def __init__(self, _error__please_use_generate=None):
if not _error__please_use_generate:
raise TypeError("Please use SigningKey.generate() to construct me")
@classmethod
def generate(klass, curve=NIST192p, entropy=None, hashfunc=sha1):
secexp = randrange(curve.order, entropy)
return klass.from_secret_exponent(secexp, curve, hashfunc)
# to create a signing key from a short (arbitrary-length) seed, convert
# that seed into an integer with something like
# secexp=util.randrange_from_seed__X(seed, curve.order), and then pass
# that integer into SigningKey.from_secret_exponent(secexp, curve)
@classmethod
def from_secret_exponent(klass, secexp, curve=NIST192p, hashfunc=sha1):
self = klass(_error__please_use_generate=True)
self.curve = curve
self.default_hashfunc = hashfunc
self.baselen = curve.baselen
n = curve.order
assert 1 <= secexp < n
pubkey_point = curve.generator*secexp
pubkey = ecdsa.Public_key(curve.generator, pubkey_point)
pubkey.order = n
self.verifying_key = VerifyingKey.from_public_point(pubkey_point, curve,
hashfunc)
self.privkey = ecdsa.Private_key(pubkey, secexp)
self.privkey.order = n
return self
@classmethod
def from_string(klass, string, curve=NIST192p, hashfunc=sha1):
assert len(string) == curve.baselen, (len(string), curve.baselen)
secexp = string_to_number(string)
return klass.from_secret_exponent(secexp, curve, hashfunc)
@classmethod
def from_pem(klass, string, hashfunc=sha1):
# the privkey pem file has two sections: "EC PARAMETERS" and "EC
# PRIVATE KEY". The first is redundant.
if PY3 and isinstance(string, str):
string = string.encode()
privkey_pem = string[string.index(b("-----BEGIN EC PRIVATE KEY-----")):]
return klass.from_der(der.unpem(privkey_pem), hashfunc)
@classmethod
def from_der(klass, string, hashfunc=sha1):
# SEQ([int(1), octetstring(privkey),cont[0], oid(secp224r1),
# cont[1],bitstring])
s, empty = der.remove_sequence(string)
if empty != b(""):
raise der.UnexpectedDER("trailing junk after DER privkey: %s" %
binascii.hexlify(empty))
one, s = der.remove_integer(s)
if one != 1:
raise der.UnexpectedDER("expected '1' at start of DER privkey,"
" got %d" % one)
privkey_str, s = der.remove_octet_string(s)
tag, curve_oid_str, s = der.remove_constructed(s)
if tag != 0:
raise der.UnexpectedDER("expected tag 0 in DER privkey,"
" got %d" % tag)
curve_oid, empty = der.remove_object(curve_oid_str)
if empty != b(""):
raise der.UnexpectedDER("trailing junk after DER privkey "
"curve_oid: %s" % binascii.hexlify(empty))
curve = find_curve(curve_oid)
# we don't actually care about the following fields
#
#tag, pubkey_bitstring, s = der.remove_constructed(s)
#if tag != 1:
# raise der.UnexpectedDER("expected tag 1 in DER privkey, got %d"
# % tag)
#pubkey_str = der.remove_bitstring(pubkey_bitstring)
#if empty != "":
# raise der.UnexpectedDER("trailing junk after DER privkey "
# "pubkeystr: %s" % binascii.hexlify(empty))
# our from_string method likes fixed-length privkey strings
if len(privkey_str) < curve.baselen:
privkey_str = b("\x00")*(curve.baselen-len(privkey_str)) + privkey_str
return klass.from_string(privkey_str, curve, hashfunc)
def to_string(self):
secexp = self.privkey.secret_multiplier
s = number_to_string(secexp, self.privkey.order)
return s
def to_pem(self):
# TODO: "BEGIN ECPARAMETERS"
return der.topem(self.to_der(), "EC PRIVATE KEY")
def to_der(self):
# SEQ([int(1), octetstring(privkey),cont[0], oid(secp224r1),
# cont[1],bitstring])
encoded_vk = b("\x00\x04") + self.get_verifying_key().to_string()
return der.encode_sequence(der.encode_integer(1),
der.encode_octet_string(self.to_string()),
der.encode_constructed(0, self.curve.encoded_oid),
der.encode_constructed(1, der.encode_bitstring(encoded_vk)),
)
def get_verifying_key(self):
return self.verifying_key
def sign_deterministic(self, data, hashfunc=None, sigencode=sigencode_string):
hashfunc = hashfunc or self.default_hashfunc
digest = hashfunc(data).digest()
return self.sign_digest_deterministic(digest, hashfunc=hashfunc, sigencode=sigencode)
def sign_digest_deterministic(self, digest, hashfunc=None, sigencode=sigencode_string):
"""
Calculates 'k' from data itself, removing the need for strong
random generator and producing deterministic (reproducible) signatures.
See RFC 6979 for more details.
"""
secexp = self.privkey.secret_multiplier
k = rfc6979.generate_k(
self.curve.generator.order(), secexp, hashfunc, digest)
return self.sign_digest(digest, sigencode=sigencode, k=k)
def sign(self, data, entropy=None, hashfunc=None, sigencode=sigencode_string, k=None):
"""
hashfunc= should behave like hashlib.sha1 . The output length of the
hash (in bytes) must not be longer than the length of the curve order
(rounded up to the nearest byte), so using SHA256 with nist256p is
ok, but SHA256 with nist192p is not. (In the 2**-96ish unlikely event
of a hash output larger than the curve order, the hash will
effectively be wrapped mod n).
Use hashfunc=hashlib.sha1 to match openssl's -ecdsa-with-SHA1 mode,
or hashfunc=hashlib.sha256 for openssl-1.0.0's -ecdsa-with-SHA256.
"""
hashfunc = hashfunc or self.default_hashfunc
h = hashfunc(data).digest()
return self.sign_digest(h, entropy, sigencode, k)
def sign_digest(self, digest, entropy=None, sigencode=sigencode_string, k=None):
if len(digest) > self.curve.baselen:
raise BadDigestError("this curve (%s) is too short "
"for your digest (%d)" % (self.curve.name,
8*len(digest)))
number = string_to_number(digest)
r, s = self.sign_number(number, entropy, k)
return sigencode(r, s, self.privkey.order)
def sign_number(self, number, entropy=None, k=None):
# returns a pair of numbers
order = self.privkey.order
# privkey.sign() may raise RuntimeError in the amazingly unlikely
# (2**-192) event that r=0 or s=0, because that would leak the key.
# We could re-try with a different 'k', but we couldn't test that
# code, so I choose to allow the signature to fail instead.
# If k is set, it is used directly. In other cases
# it is generated using entropy function
if k is not None:
_k = k
else:
_k = randrange(order, entropy)
assert 1 <= _k < order
sig = self.privkey.sign(number, _k)
return sig.r, sig.s

View File

@@ -0,0 +1,613 @@
#! /usr/bin/env python
#
# Provide some simple capabilities from number theory.
#
# Version of 2008.11.14.
#
# Written in 2005 and 2006 by Peter Pearson and placed in the public domain.
# Revision history:
# 2008.11.14: Use pow( base, exponent, modulus ) for modular_exp.
# Make gcd and lcm accept arbitrarly many arguments.
from __future__ import division
from .six import print_, integer_types
from .six.moves import reduce
import math
class Error( Exception ):
"""Base class for exceptions in this module."""
pass
class SquareRootError( Error ):
pass
class NegativeExponentError( Error ):
pass
def modular_exp( base, exponent, modulus ):
"Raise base to exponent, reducing by modulus"
if exponent < 0:
raise NegativeExponentError( "Negative exponents (%d) not allowed" \
% exponent )
return pow( base, exponent, modulus )
# result = 1L
# x = exponent
# b = base + 0L
# while x > 0:
# if x % 2 > 0: result = (result * b) % modulus
# x = x // 2
# b = ( b * b ) % modulus
# return result
def polynomial_reduce_mod( poly, polymod, p ):
"""Reduce poly by polymod, integer arithmetic modulo p.
Polynomials are represented as lists of coefficients
of increasing powers of x."""
# This module has been tested only by extensive use
# in calculating modular square roots.
# Just to make this easy, require a monic polynomial:
assert polymod[-1] == 1
assert len( polymod ) > 1
while len( poly ) >= len( polymod ):
if poly[-1] != 0:
for i in range( 2, len( polymod ) + 1 ):
poly[-i] = ( poly[-i] - poly[-1] * polymod[-i] ) % p
poly = poly[0:-1]
return poly
def polynomial_multiply_mod( m1, m2, polymod, p ):
"""Polynomial multiplication modulo a polynomial over ints mod p.
Polynomials are represented as lists of coefficients
of increasing powers of x."""
# This is just a seat-of-the-pants implementation.
# This module has been tested only by extensive use
# in calculating modular square roots.
# Initialize the product to zero:
prod = ( len( m1 ) + len( m2 ) - 1 ) * [0]
# Add together all the cross-terms:
for i in range( len( m1 ) ):
for j in range( len( m2 ) ):
prod[i+j] = ( prod[i+j] + m1[i] * m2[j] ) % p
return polynomial_reduce_mod( prod, polymod, p )
def polynomial_exp_mod( base, exponent, polymod, p ):
"""Polynomial exponentiation modulo a polynomial over ints mod p.
Polynomials are represented as lists of coefficients
of increasing powers of x."""
# Based on the Handbook of Applied Cryptography, algorithm 2.227.
# This module has been tested only by extensive use
# in calculating modular square roots.
assert exponent < p
if exponent == 0: return [ 1 ]
G = base
k = exponent
if k%2 == 1: s = G
else: s = [ 1 ]
while k > 1:
k = k // 2
G = polynomial_multiply_mod( G, G, polymod, p )
if k%2 == 1: s = polynomial_multiply_mod( G, s, polymod, p )
return s
def jacobi( a, n ):
"""Jacobi symbol"""
# Based on the Handbook of Applied Cryptography (HAC), algorithm 2.149.
# This function has been tested by comparison with a small
# table printed in HAC, and by extensive use in calculating
# modular square roots.
assert n >= 3
assert n%2 == 1
a = a % n
if a == 0: return 0
if a == 1: return 1
a1, e = a, 0
while a1%2 == 0:
a1, e = a1//2, e+1
if e%2 == 0 or n%8 == 1 or n%8 == 7: s = 1
else: s = -1
if a1 == 1: return s
if n%4 == 3 and a1%4 == 3: s = -s
return s * jacobi( n % a1, a1 )
def square_root_mod_prime( a, p ):
"""Modular square root of a, mod p, p prime."""
# Based on the Handbook of Applied Cryptography, algorithms 3.34 to 3.39.
# This module has been tested for all values in [0,p-1] for
# every prime p from 3 to 1229.
assert 0 <= a < p
assert 1 < p
if a == 0: return 0
if p == 2: return a
jac = jacobi( a, p )
if jac == -1: raise SquareRootError( "%d has no square root modulo %d" \
% ( a, p ) )
if p % 4 == 3: return modular_exp( a, (p+1)//4, p )
if p % 8 == 5:
d = modular_exp( a, (p-1)//4, p )
if d == 1: return modular_exp( a, (p+3)//8, p )
if d == p-1: return ( 2 * a * modular_exp( 4*a, (p-5)//8, p ) ) % p
raise RuntimeError("Shouldn't get here.")
for b in range( 2, p ):
if jacobi( b*b-4*a, p ) == -1:
f = ( a, -b, 1 )
ff = polynomial_exp_mod( ( 0, 1 ), (p+1)//2, f, p )
assert ff[1] == 0
return ff[0]
raise RuntimeError("No b found.")
def inverse_mod( a, m ):
"""Inverse of a mod m."""
if a < 0 or m <= a: a = a % m
# From Ferguson and Schneier, roughly:
c, d = a, m
uc, vc, ud, vd = 1, 0, 0, 1
while c != 0:
q, c, d = divmod( d, c ) + ( c, )
uc, vc, ud, vd = ud - q*uc, vd - q*vc, uc, vc
# At this point, d is the GCD, and ud*a+vd*m = d.
# If d == 1, this means that ud is a inverse.
assert d == 1
if ud > 0: return ud
else: return ud + m
def gcd2(a, b):
"""Greatest common divisor using Euclid's algorithm."""
while a:
a, b = b%a, a
return b
def gcd( *a ):
"""Greatest common divisor.
Usage: gcd( [ 2, 4, 6 ] )
or: gcd( 2, 4, 6 )
"""
if len( a ) > 1: return reduce( gcd2, a )
if hasattr( a[0], "__iter__" ): return reduce( gcd2, a[0] )
return a[0]
def lcm2(a,b):
"""Least common multiple of two integers."""
return (a*b)//gcd(a,b)
def lcm( *a ):
"""Least common multiple.
Usage: lcm( [ 3, 4, 5 ] )
or: lcm( 3, 4, 5 )
"""
if len( a ) > 1: return reduce( lcm2, a )
if hasattr( a[0], "__iter__" ): return reduce( lcm2, a[0] )
return a[0]
def factorization( n ):
"""Decompose n into a list of (prime,exponent) pairs."""
assert isinstance( n, integer_types )
if n < 2: return []
result = []
d = 2
# Test the small primes:
for d in smallprimes:
if d > n: break
q, r = divmod( n, d )
if r == 0:
count = 1
while d <= n:
n = q
q, r = divmod( n, d )
if r != 0: break
count = count + 1
result.append( ( d, count ) )
# If n is still greater than the last of our small primes,
# it may require further work:
if n > smallprimes[-1]:
if is_prime( n ): # If what's left is prime, it's easy:
result.append( ( n, 1 ) )
else: # Ugh. Search stupidly for a divisor:
d = smallprimes[-1]
while 1:
d = d + 2 # Try the next divisor.
q, r = divmod( n, d )
if q < d: break # n < d*d means we're done, n = 1 or prime.
if r == 0: # d divides n. How many times?
count = 1
n = q
while d <= n: # As long as d might still divide n,
q, r = divmod( n, d ) # see if it does.
if r != 0: break
n = q # It does. Reduce n, increase count.
count = count + 1
result.append( ( d, count ) )
if n > 1: result.append( ( n, 1 ) )
return result
def phi( n ):
"""Return the Euler totient function of n."""
assert isinstance( n, integer_types )
if n < 3: return 1
result = 1
ff = factorization( n )
for f in ff:
e = f[1]
if e > 1:
result = result * f[0] ** (e-1) * ( f[0] - 1 )
else:
result = result * ( f[0] - 1 )
return result
def carmichael( n ):
"""Return Carmichael function of n.
Carmichael(n) is the smallest integer x such that
m**x = 1 mod n for all m relatively prime to n.
"""
return carmichael_of_factorized( factorization( n ) )
def carmichael_of_factorized( f_list ):
"""Return the Carmichael function of a number that is
represented as a list of (prime,exponent) pairs.
"""
if len( f_list ) < 1: return 1
result = carmichael_of_ppower( f_list[0] )
for i in range( 1, len( f_list ) ):
result = lcm( result, carmichael_of_ppower( f_list[i] ) )
return result
def carmichael_of_ppower( pp ):
"""Carmichael function of the given power of the given prime.
"""
p, a = pp
if p == 2 and a > 2: return 2**(a-2)
else: return (p-1) * p**(a-1)
def order_mod( x, m ):
"""Return the order of x in the multiplicative group mod m.
"""
# Warning: this implementation is not very clever, and will
# take a long time if m is very large.
if m <= 1: return 0
assert gcd( x, m ) == 1
z = x
result = 1
while z != 1:
z = ( z * x ) % m
result = result + 1
return result
def largest_factor_relatively_prime( a, b ):
"""Return the largest factor of a relatively prime to b.
"""
while 1:
d = gcd( a, b )
if d <= 1: break
b = d
while 1:
q, r = divmod( a, d )
if r > 0:
break
a = q
return a
def kinda_order_mod( x, m ):
"""Return the order of x in the multiplicative group mod m',
where m' is the largest factor of m relatively prime to x.
"""
return order_mod( x, largest_factor_relatively_prime( m, x ) )
def is_prime( n ):
"""Return True if x is prime, False otherwise.
We use the Miller-Rabin test, as given in Menezes et al. p. 138.
This test is not exact: there are composite values n for which
it returns True.
In testing the odd numbers from 10000001 to 19999999,
about 66 composites got past the first test,
5 got past the second test, and none got past the third.
Since factors of 2, 3, 5, 7, and 11 were detected during
preliminary screening, the number of numbers tested by
Miller-Rabin was (19999999 - 10000001)*(2/3)*(4/5)*(6/7)
= 4.57 million.
"""
# (This is used to study the risk of false positives:)
global miller_rabin_test_count
miller_rabin_test_count = 0
if n <= smallprimes[-1]:
if n in smallprimes: return True
else: return False
if gcd( n, 2*3*5*7*11 ) != 1: return False
# Choose a number of iterations sufficient to reduce the
# probability of accepting a composite below 2**-80
# (from Menezes et al. Table 4.4):
t = 40
n_bits = 1 + int( math.log( n, 2 ) )
for k, tt in ( ( 100, 27 ),
( 150, 18 ),
( 200, 15 ),
( 250, 12 ),
( 300, 9 ),
( 350, 8 ),
( 400, 7 ),
( 450, 6 ),
( 550, 5 ),
( 650, 4 ),
( 850, 3 ),
( 1300, 2 ),
):
if n_bits < k: break
t = tt
# Run the test t times:
s = 0
r = n - 1
while ( r % 2 ) == 0:
s = s + 1
r = r // 2
for i in range( t ):
a = smallprimes[ i ]
y = modular_exp( a, r, n )
if y != 1 and y != n-1:
j = 1
while j <= s - 1 and y != n - 1:
y = modular_exp( y, 2, n )
if y == 1:
miller_rabin_test_count = i + 1
return False
j = j + 1
if y != n-1:
miller_rabin_test_count = i + 1
return False
return True
def next_prime( starting_value ):
"Return the smallest prime larger than the starting value."
if starting_value < 2: return 2
result = ( starting_value + 1 ) | 1
while not is_prime( result ): result = result + 2
return result
smallprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
101, 103, 107, 109, 113, 127, 131, 137, 139, 149,
151, 157, 163, 167, 173, 179, 181, 191, 193, 197,
199, 211, 223, 227, 229, 233, 239, 241, 251, 257,
263, 269, 271, 277, 281, 283, 293, 307, 311, 313,
317, 331, 337, 347, 349, 353, 359, 367, 373, 379,
383, 389, 397, 401, 409, 419, 421, 431, 433, 439,
443, 449, 457, 461, 463, 467, 479, 487, 491, 499,
503, 509, 521, 523, 541, 547, 557, 563, 569, 571,
577, 587, 593, 599, 601, 607, 613, 617, 619, 631,
641, 643, 647, 653, 659, 661, 673, 677, 683, 691,
701, 709, 719, 727, 733, 739, 743, 751, 757, 761,
769, 773, 787, 797, 809, 811, 821, 823, 827, 829,
839, 853, 857, 859, 863, 877, 881, 883, 887, 907,
911, 919, 929, 937, 941, 947, 953, 967, 971, 977,
983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033,
1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093,
1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163,
1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229]
miller_rabin_test_count = 0
def __main__():
# Making sure locally defined exceptions work:
# p = modular_exp( 2, -2, 3 )
# p = square_root_mod_prime( 2, 3 )
print_("Testing gcd...")
assert gcd( 3*5*7, 3*5*11, 3*5*13 ) == 3*5
assert gcd( [ 3*5*7, 3*5*11, 3*5*13 ] ) == 3*5
assert gcd( 3 ) == 3
print_("Testing lcm...")
assert lcm( 3, 5*3, 7*3 ) == 3*5*7
assert lcm( [ 3, 5*3, 7*3 ] ) == 3*5*7
assert lcm( 3 ) == 3
print_("Testing next_prime...")
bigprimes = ( 999671,
999683,
999721,
999727,
999749,
999763,
999769,
999773,
999809,
999853,
999863,
999883,
999907,
999917,
999931,
999953,
999959,
999961,
999979,
999983 )
for i in range( len( bigprimes ) - 1 ):
assert next_prime( bigprimes[i] ) == bigprimes[ i+1 ]
error_tally = 0
# Test the square_root_mod_prime function:
for p in smallprimes:
print_("Testing square_root_mod_prime for modulus p = %d." % p)
squares = []
for root in range( 0, 1+p//2 ):
sq = ( root * root ) % p
squares.append( sq )
calculated = square_root_mod_prime( sq, p )
if ( calculated * calculated ) % p != sq:
error_tally = error_tally + 1
print_("Failed to find %d as sqrt( %d ) mod %d. Said %d." % \
( root, sq, p, calculated ))
for nonsquare in range( 0, p ):
if nonsquare not in squares:
try:
calculated = square_root_mod_prime( nonsquare, p )
except SquareRootError:
pass
else:
error_tally = error_tally + 1
print_("Failed to report no root for sqrt( %d ) mod %d." % \
( nonsquare, p ))
# Test the jacobi function:
for m in range( 3, 400, 2 ):
print_("Testing jacobi for modulus m = %d." % m)
if is_prime( m ):
squares = []
for root in range( 1, m ):
if jacobi( root * root, m ) != 1:
error_tally = error_tally + 1
print_("jacobi( %d * %d, %d ) != 1" % ( root, root, m ))
squares.append( root * root % m )
for i in range( 1, m ):
if not i in squares:
if jacobi( i, m ) != -1:
error_tally = error_tally + 1
print_("jacobi( %d, %d ) != -1" % ( i, m ))
else: # m is not prime.
f = factorization( m )
for a in range( 1, m ):
c = 1
for i in f:
c = c * jacobi( a, i[0] ) ** i[1]
if c != jacobi( a, m ):
error_tally = error_tally + 1
print_("%d != jacobi( %d, %d )" % ( c, a, m ))
# Test the inverse_mod function:
print_("Testing inverse_mod . . .")
import random
n_tests = 0
for i in range( 100 ):
m = random.randint( 20, 10000 )
for j in range( 100 ):
a = random.randint( 1, m-1 )
if gcd( a, m ) == 1:
n_tests = n_tests + 1
inv = inverse_mod( a, m )
if inv <= 0 or inv >= m or ( a * inv ) % m != 1:
error_tally = error_tally + 1
print_("%d = inverse_mod( %d, %d ) is wrong." % ( inv, a, m ))
assert n_tests > 1000
print_(n_tests, " tests of inverse_mod completed.")
class FailedTest(Exception): pass
print_(error_tally, "errors detected.")
if error_tally != 0:
raise FailedTest("%d errors detected" % error_tally)
if __name__ == '__main__':
__main__()

103
bin/python/ecdsa/rfc6979.py Normal file
View File

@@ -0,0 +1,103 @@
'''
RFC 6979:
Deterministic Usage of the Digital Signature Algorithm (DSA) and
Elliptic Curve Digital Signature Algorithm (ECDSA)
http://tools.ietf.org/html/rfc6979
Many thanks to Coda Hale for his implementation in Go language:
https://github.com/codahale/rfc6979
'''
import hmac
from binascii import hexlify
from .util import number_to_string, number_to_string_crop
from .six import b
try:
bin(0)
except NameError:
binmap = {"0": "0000", "1": "0001", "2": "0010", "3": "0011",
"4": "0100", "5": "0101", "6": "0110", "7": "0111",
"8": "1000", "9": "1001", "a": "1010", "b": "1011",
"c": "1100", "d": "1101", "e": "1110", "f": "1111"}
def bin(value): # for python2.5
v = "".join(binmap[x] for x in "%x"%abs(value)).lstrip("0")
if value < 0:
return "-0b" + v
return "0b" + v
def bit_length(num):
# http://docs.python.org/dev/library/stdtypes.html#int.bit_length
s = bin(num) # binary representation: bin(-37) --> '-0b100101'
s = s.lstrip('-0b') # remove leading zeros and minus sign
return len(s) # len('100101') --> 6
def bits2int(data, qlen):
x = int(hexlify(data), 16)
l = len(data) * 8
if l > qlen:
return x >> (l-qlen)
return x
def bits2octets(data, order):
z1 = bits2int(data, bit_length(order))
z2 = z1 - order
if z2 < 0:
z2 = z1
return number_to_string_crop(z2, order)
# https://tools.ietf.org/html/rfc6979#section-3.2
def generate_k(order, secexp, hash_func, data):
'''
generator - order of the DSA generator used in the signature
secexp - secure exponent (private key) in numeric form
hash_func - reference to the same hash function used for generating hash
data - hash in binary form of the signing data
'''
qlen = bit_length(order)
holen = hash_func().digest_size
rolen = (qlen + 7) / 8
bx = number_to_string(secexp, order) + bits2octets(data, order)
# Step B
v = b('\x01') * holen
# Step C
k = b('\x00') * holen
# Step D
k = hmac.new(k, v+b('\x00')+bx, hash_func).digest()
# Step E
v = hmac.new(k, v, hash_func).digest()
# Step F
k = hmac.new(k, v+b('\x01')+bx, hash_func).digest()
# Step G
v = hmac.new(k, v, hash_func).digest()
# Step H
while True:
# Step H1
t = b('')
# Step H2
while len(t) < rolen:
v = hmac.new(k, v, hash_func).digest()
t += v
# Step H3
secret = bits2int(t, qlen)
if secret >= 1 and secret < order:
return secret
k = hmac.new(k, v+b('\x00'), hash_func).digest()
v = hmac.new(k, v, hash_func).digest()

394
bin/python/ecdsa/six.py Normal file
View File

@@ -0,0 +1,394 @@
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2012 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import operator
import sys
import types
__author__ = "Benjamin Peterson <benjamin@python.org>"
__version__ = "1.2.0"
# True if we are running on Python 3.
PY3 = sys.version_info[0] == 3
if PY3:
string_types = str,
integer_types = int,
class_types = type,
text_type = str
binary_type = bytes
MAXSIZE = sys.maxsize
else:
string_types = basestring,
integer_types = (int, long)
class_types = (type, types.ClassType)
text_type = unicode
binary_type = str
if sys.platform.startswith("java"):
# Jython always uses 32 bits.
MAXSIZE = int((1 << 31) - 1)
else:
# It's possible to have sizeof(long) != sizeof(Py_ssize_t).
class X(object):
def __len__(self):
return 1 << 31
try:
len(X())
except OverflowError:
# 32-bit
MAXSIZE = int((1 << 31) - 1)
else:
# 64-bit
MAXSIZE = int((1 << 63) - 1)
del X
def _add_doc(func, doc):
"""Add documentation to a function."""
func.__doc__ = doc
def _import_module(name):
"""Import module, returning the module after the last dot."""
__import__(name)
return sys.modules[name]
class _LazyDescr(object):
def __init__(self, name):
self.name = name
def __get__(self, obj, tp):
result = self._resolve()
setattr(obj, self.name, result)
# This is a bit ugly, but it avoids running this again.
delattr(tp, self.name)
return result
class MovedModule(_LazyDescr):
def __init__(self, name, old, new=None):
super(MovedModule, self).__init__(name)
if PY3:
if new is None:
new = name
self.mod = new
else:
self.mod = old
def _resolve(self):
return _import_module(self.mod)
class MovedAttribute(_LazyDescr):
def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
super(MovedAttribute, self).__init__(name)
if PY3:
if new_mod is None:
new_mod = name
self.mod = new_mod
if new_attr is None:
if old_attr is None:
new_attr = name
else:
new_attr = old_attr
self.attr = new_attr
else:
self.mod = old_mod
if old_attr is None:
old_attr = name
self.attr = old_attr
def _resolve(self):
module = _import_module(self.mod)
return getattr(module, self.attr)
class _MovedItems(types.ModuleType):
"""Lazy loading of moved objects"""
_moved_attributes = [
MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
MovedAttribute("map", "itertools", "builtins", "imap", "map"),
MovedAttribute("reload_module", "__builtin__", "imp", "reload"),
MovedAttribute("reduce", "__builtin__", "functools"),
MovedAttribute("StringIO", "StringIO", "io"),
MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
MovedAttribute("zip", "itertools", "builtins", "izip", "zip"),
MovedModule("builtins", "__builtin__"),
MovedModule("configparser", "ConfigParser"),
MovedModule("copyreg", "copy_reg"),
MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
MovedModule("http_cookies", "Cookie", "http.cookies"),
MovedModule("html_entities", "htmlentitydefs", "html.entities"),
MovedModule("html_parser", "HTMLParser", "html.parser"),
MovedModule("http_client", "httplib", "http.client"),
MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
MovedModule("cPickle", "cPickle", "pickle"),
MovedModule("queue", "Queue"),
MovedModule("reprlib", "repr"),
MovedModule("socketserver", "SocketServer"),
MovedModule("tkinter", "Tkinter"),
MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
MovedModule("tkinter_colorchooser", "tkColorChooser",
"tkinter.colorchooser"),
MovedModule("tkinter_commondialog", "tkCommonDialog",
"tkinter.commondialog"),
MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"),
MovedModule("tkinter_font", "tkFont", "tkinter.font"),
MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"),
MovedModule("tkinter_tksimpledialog", "tkSimpleDialog",
"tkinter.simpledialog"),
MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"),
MovedModule("winreg", "_winreg"),
]
for attr in _moved_attributes:
setattr(_MovedItems, attr.name, attr)
del attr
moves = sys.modules[__name__ + ".moves"] = _MovedItems("moves")
def add_move(move):
"""Add an item to six.moves."""
setattr(_MovedItems, move.name, move)
def remove_move(name):
"""Remove item from six.moves."""
try:
delattr(_MovedItems, name)
except AttributeError:
try:
del moves.__dict__[name]
except KeyError:
raise AttributeError("no such move, %r" % (name,))
if PY3:
_meth_func = "__func__"
_meth_self = "__self__"
_func_code = "__code__"
_func_defaults = "__defaults__"
_iterkeys = "keys"
_itervalues = "values"
_iteritems = "items"
else:
_meth_func = "im_func"
_meth_self = "im_self"
_func_code = "func_code"
_func_defaults = "func_defaults"
_iterkeys = "iterkeys"
_itervalues = "itervalues"
_iteritems = "iteritems"
try:
advance_iterator = next
except NameError:
def advance_iterator(it):
return it.next()
next = advance_iterator
try:
callable = callable
except NameError:
def callable(obj):
return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
if PY3:
def get_unbound_function(unbound):
return unbound
Iterator = object
else:
def get_unbound_function(unbound):
return unbound.im_func
class Iterator(object):
def next(self):
return type(self).__next__(self)
callable = callable
_add_doc(get_unbound_function,
"""Get the function out of a possibly unbound function""")
get_method_function = operator.attrgetter(_meth_func)
get_method_self = operator.attrgetter(_meth_self)
get_function_code = operator.attrgetter(_func_code)
get_function_defaults = operator.attrgetter(_func_defaults)
def iterkeys(d):
"""Return an iterator over the keys of a dictionary."""
return iter(getattr(d, _iterkeys)())
def itervalues(d):
"""Return an iterator over the values of a dictionary."""
return iter(getattr(d, _itervalues)())
def iteritems(d):
"""Return an iterator over the (key, value) pairs of a dictionary."""
return iter(getattr(d, _iteritems)())
if PY3:
def b(s):
return s.encode("latin-1")
def u(s):
return s
if sys.version_info[1] <= 1:
def int2byte(i):
return bytes((i,))
else:
# This is about 2x faster than the implementation above on 3.2+
int2byte = operator.methodcaller("to_bytes", 1, "big")
import io
StringIO = io.StringIO
BytesIO = io.BytesIO
else:
def b(s):
return s
def u(s):
if isinstance(s, unicode):
return s
return unicode(s, "unicode_escape")
int2byte = chr
import StringIO
StringIO = BytesIO = StringIO.StringIO
_add_doc(b, """Byte literal""")
_add_doc(u, """Text literal""")
if PY3:
import builtins
exec_ = getattr(builtins, "exec")
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
print_ = getattr(builtins, "print")
del builtins
else:
def exec_(_code_, _globs_=None, _locs_=None):
"""Execute code in a namespace."""
if _globs_ is None:
frame = sys._getframe(1)
_globs_ = frame.f_globals
if _locs_ is None:
_locs_ = frame.f_locals
del frame
elif _locs_ is None:
_locs_ = _globs_
exec("""exec _code_ in _globs_, _locs_""")
exec_("""def reraise(tp, value, tb=None):
raise tp, value, tb
""")
def print_(*args, **kwargs):
"""The new-style print function."""
fp = kwargs.pop("file", sys.stdout)
if fp is None:
return
def write(data):
if not isinstance(data, basestring):
data = str(data)
fp.write(data)
want_unicode = False
sep = kwargs.pop("sep", None)
if sep is not None:
if isinstance(sep, unicode):
want_unicode = True
elif not isinstance(sep, str):
raise TypeError("sep must be None or a string")
end = kwargs.pop("end", None)
if end is not None:
if isinstance(end, unicode):
want_unicode = True
elif not isinstance(end, str):
raise TypeError("end must be None or a string")
if kwargs:
raise TypeError("invalid keyword arguments to print()")
if not want_unicode:
for arg in args:
if isinstance(arg, unicode):
want_unicode = True
break
if want_unicode:
newline = unicode("\n")
space = unicode(" ")
else:
newline = "\n"
space = " "
if sep is None:
sep = space
if end is None:
end = newline
for i, arg in enumerate(args):
if i:
write(sep)
write(arg)
write(end)
_add_doc(reraise, """Reraise an exception.""")
def with_metaclass(meta, base=object):
"""Create a base class with a metaclass."""
return meta("NewBase", (base,), {})

View File

@@ -0,0 +1,663 @@
from __future__ import with_statement, division
import unittest
import os
import time
import shutil
import subprocess
from binascii import hexlify, unhexlify
from hashlib import sha1, sha256, sha512
from .six import b, print_, binary_type
from .keys import SigningKey, VerifyingKey
from .keys import BadSignatureError
from . import util
from .util import sigencode_der, sigencode_strings
from .util import sigdecode_der, sigdecode_strings
from .curves import Curve, UnknownCurveError
from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1
from .ellipticcurve import Point
from . import der
from . import rfc6979
class SubprocessError(Exception):
pass
def run_openssl(cmd):
OPENSSL = "openssl"
p = subprocess.Popen([OPENSSL] + cmd.split(),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout, ignored = p.communicate()
if p.returncode != 0:
raise SubprocessError("cmd '%s %s' failed: rc=%s, stdout/err was %s" %
(OPENSSL, cmd, p.returncode, stdout))
return stdout.decode()
BENCH = False
class ECDSA(unittest.TestCase):
def test_basic(self):
priv = SigningKey.generate()
pub = priv.get_verifying_key()
data = b("blahblah")
sig = priv.sign(data)
self.assertTrue(pub.verify(sig, data))
self.assertRaises(BadSignatureError, pub.verify, sig, data+b("bad"))
pub2 = VerifyingKey.from_string(pub.to_string())
self.assertTrue(pub2.verify(sig, data))
def test_deterministic(self):
data = b("blahblah")
secexp = int("9d0219792467d7d37b4d43298a7d0c05", 16)
priv = SigningKey.from_secret_exponent(secexp, SECP256k1, sha256)
pub = priv.get_verifying_key()
k = rfc6979.generate_k(
SECP256k1.generator.order(), secexp, sha256, sha256(data).digest())
sig1 = priv.sign(data, k=k)
self.assertTrue(pub.verify(sig1, data))
sig2 = priv.sign(data, k=k)
self.assertTrue(pub.verify(sig2, data))
sig3 = priv.sign_deterministic(data, sha256)
self.assertTrue(pub.verify(sig3, data))
self.assertEqual(sig1, sig2)
self.assertEqual(sig1, sig3)
def test_bad_usage(self):
# sk=SigningKey() is wrong
self.assertRaises(TypeError, SigningKey)
self.assertRaises(TypeError, VerifyingKey)
def test_lengths(self):
default = NIST192p
priv = SigningKey.generate()
pub = priv.get_verifying_key()
self.assertEqual(len(pub.to_string()), default.verifying_key_length)
sig = priv.sign(b("data"))
self.assertEqual(len(sig), default.signature_length)
if BENCH:
print_()
for curve in (NIST192p, NIST224p, NIST256p, NIST384p, NIST521p):
start = time.time()
priv = SigningKey.generate(curve=curve)
pub1 = priv.get_verifying_key()
keygen_time = time.time() - start
pub2 = VerifyingKey.from_string(pub1.to_string(), curve)
self.assertEqual(pub1.to_string(), pub2.to_string())
self.assertEqual(len(pub1.to_string()),
curve.verifying_key_length)
start = time.time()
sig = priv.sign(b("data"))
sign_time = time.time() - start
self.assertEqual(len(sig), curve.signature_length)
if BENCH:
start = time.time()
pub1.verify(sig, b("data"))
verify_time = time.time() - start
print_("%s: siglen=%d, keygen=%0.3fs, sign=%0.3f, verify=%0.3f" \
% (curve.name, curve.signature_length,
keygen_time, sign_time, verify_time))
def test_serialize(self):
seed = b("secret")
curve = NIST192p
secexp1 = util.randrange_from_seed__trytryagain(seed, curve.order)
secexp2 = util.randrange_from_seed__trytryagain(seed, curve.order)
self.assertEqual(secexp1, secexp2)
priv1 = SigningKey.from_secret_exponent(secexp1, curve)
priv2 = SigningKey.from_secret_exponent(secexp2, curve)
self.assertEqual(hexlify(priv1.to_string()),
hexlify(priv2.to_string()))
self.assertEqual(priv1.to_pem(), priv2.to_pem())
pub1 = priv1.get_verifying_key()
pub2 = priv2.get_verifying_key()
data = b("data")
sig1 = priv1.sign(data)
sig2 = priv2.sign(data)
self.assertTrue(pub1.verify(sig1, data))
self.assertTrue(pub2.verify(sig1, data))
self.assertTrue(pub1.verify(sig2, data))
self.assertTrue(pub2.verify(sig2, data))
self.assertEqual(hexlify(pub1.to_string()),
hexlify(pub2.to_string()))
def test_nonrandom(self):
s = b("all the entropy in the entire world, compressed into one line")
def not_much_entropy(numbytes):
return s[:numbytes]
# we control the entropy source, these two keys should be identical:
priv1 = SigningKey.generate(entropy=not_much_entropy)
priv2 = SigningKey.generate(entropy=not_much_entropy)
self.assertEqual(hexlify(priv1.get_verifying_key().to_string()),
hexlify(priv2.get_verifying_key().to_string()))
# likewise, signatures should be identical. Obviously you'd never
# want to do this with keys you care about, because the secrecy of
# the private key depends upon using different random numbers for
# each signature
sig1 = priv1.sign(b("data"), entropy=not_much_entropy)
sig2 = priv2.sign(b("data"), entropy=not_much_entropy)
self.assertEqual(hexlify(sig1), hexlify(sig2))
def assertTruePrivkeysEqual(self, priv1, priv2):
self.assertEqual(priv1.privkey.secret_multiplier,
priv2.privkey.secret_multiplier)
self.assertEqual(priv1.privkey.public_key.generator,
priv2.privkey.public_key.generator)
def failIfPrivkeysEqual(self, priv1, priv2):
self.failIfEqual(priv1.privkey.secret_multiplier,
priv2.privkey.secret_multiplier)
def test_privkey_creation(self):
s = b("all the entropy in the entire world, compressed into one line")
def not_much_entropy(numbytes):
return s[:numbytes]
priv1 = SigningKey.generate()
self.assertEqual(priv1.baselen, NIST192p.baselen)
priv1 = SigningKey.generate(curve=NIST224p)
self.assertEqual(priv1.baselen, NIST224p.baselen)
priv1 = SigningKey.generate(entropy=not_much_entropy)
self.assertEqual(priv1.baselen, NIST192p.baselen)
priv2 = SigningKey.generate(entropy=not_much_entropy)
self.assertEqual(priv2.baselen, NIST192p.baselen)
self.assertTruePrivkeysEqual(priv1, priv2)
priv1 = SigningKey.from_secret_exponent(secexp=3)
self.assertEqual(priv1.baselen, NIST192p.baselen)
priv2 = SigningKey.from_secret_exponent(secexp=3)
self.assertTruePrivkeysEqual(priv1, priv2)
priv1 = SigningKey.from_secret_exponent(secexp=4, curve=NIST224p)
self.assertEqual(priv1.baselen, NIST224p.baselen)
def test_privkey_strings(self):
priv1 = SigningKey.generate()
s1 = priv1.to_string()
self.assertEqual(type(s1), binary_type)
self.assertEqual(len(s1), NIST192p.baselen)
priv2 = SigningKey.from_string(s1)
self.assertTruePrivkeysEqual(priv1, priv2)
s1 = priv1.to_pem()
self.assertEqual(type(s1), binary_type)
self.assertTrue(s1.startswith(b("-----BEGIN EC PRIVATE KEY-----")))
self.assertTrue(s1.strip().endswith(b("-----END EC PRIVATE KEY-----")))
priv2 = SigningKey.from_pem(s1)
self.assertTruePrivkeysEqual(priv1, priv2)
s1 = priv1.to_der()
self.assertEqual(type(s1), binary_type)
priv2 = SigningKey.from_der(s1)
self.assertTruePrivkeysEqual(priv1, priv2)
priv1 = SigningKey.generate(curve=NIST256p)
s1 = priv1.to_pem()
self.assertEqual(type(s1), binary_type)
self.assertTrue(s1.startswith(b("-----BEGIN EC PRIVATE KEY-----")))
self.assertTrue(s1.strip().endswith(b("-----END EC PRIVATE KEY-----")))
priv2 = SigningKey.from_pem(s1)
self.assertTruePrivkeysEqual(priv1, priv2)
s1 = priv1.to_der()
self.assertEqual(type(s1), binary_type)
priv2 = SigningKey.from_der(s1)
self.assertTruePrivkeysEqual(priv1, priv2)
def assertTruePubkeysEqual(self, pub1, pub2):
self.assertEqual(pub1.pubkey.point, pub2.pubkey.point)
self.assertEqual(pub1.pubkey.generator, pub2.pubkey.generator)
self.assertEqual(pub1.curve, pub2.curve)
def test_pubkey_strings(self):
priv1 = SigningKey.generate()
pub1 = priv1.get_verifying_key()
s1 = pub1.to_string()
self.assertEqual(type(s1), binary_type)
self.assertEqual(len(s1), NIST192p.verifying_key_length)
pub2 = VerifyingKey.from_string(s1)
self.assertTruePubkeysEqual(pub1, pub2)
priv1 = SigningKey.generate(curve=NIST256p)
pub1 = priv1.get_verifying_key()
s1 = pub1.to_string()
self.assertEqual(type(s1), binary_type)
self.assertEqual(len(s1), NIST256p.verifying_key_length)
pub2 = VerifyingKey.from_string(s1, curve=NIST256p)
self.assertTruePubkeysEqual(pub1, pub2)
pub1_der = pub1.to_der()
self.assertEqual(type(pub1_der), binary_type)
pub2 = VerifyingKey.from_der(pub1_der)
self.assertTruePubkeysEqual(pub1, pub2)
self.assertRaises(der.UnexpectedDER,
VerifyingKey.from_der, pub1_der+b("junk"))
badpub = VerifyingKey.from_der(pub1_der)
class FakeGenerator:
def order(self): return 123456789
badcurve = Curve("unknown", None, None, FakeGenerator(), (1,2,3,4,5,6))
badpub.curve = badcurve
badder = badpub.to_der()
self.assertRaises(UnknownCurveError, VerifyingKey.from_der, badder)
pem = pub1.to_pem()
self.assertEqual(type(pem), binary_type)
self.assertTrue(pem.startswith(b("-----BEGIN PUBLIC KEY-----")), pem)
self.assertTrue(pem.strip().endswith(b("-----END PUBLIC KEY-----")), pem)
pub2 = VerifyingKey.from_pem(pem)
self.assertTruePubkeysEqual(pub1, pub2)
def test_signature_strings(self):
priv1 = SigningKey.generate()
pub1 = priv1.get_verifying_key()
data = b("data")
sig = priv1.sign(data)
self.assertEqual(type(sig), binary_type)
self.assertEqual(len(sig), NIST192p.signature_length)
self.assertTrue(pub1.verify(sig, data))
sig = priv1.sign(data, sigencode=sigencode_strings)
self.assertEqual(type(sig), tuple)
self.assertEqual(len(sig), 2)
self.assertEqual(type(sig[0]), binary_type)
self.assertEqual(type(sig[1]), binary_type)
self.assertEqual(len(sig[0]), NIST192p.baselen)
self.assertEqual(len(sig[1]), NIST192p.baselen)
self.assertTrue(pub1.verify(sig, data, sigdecode=sigdecode_strings))
sig_der = priv1.sign(data, sigencode=sigencode_der)
self.assertEqual(type(sig_der), binary_type)
self.assertTrue(pub1.verify(sig_der, data, sigdecode=sigdecode_der))
def test_hashfunc(self):
sk = SigningKey.generate(curve=NIST256p, hashfunc=sha256)
data = b("security level is 128 bits")
sig = sk.sign(data)
vk = VerifyingKey.from_string(sk.get_verifying_key().to_string(),
curve=NIST256p, hashfunc=sha256)
self.assertTrue(vk.verify(sig, data))
sk2 = SigningKey.generate(curve=NIST256p)
sig2 = sk2.sign(data, hashfunc=sha256)
vk2 = VerifyingKey.from_string(sk2.get_verifying_key().to_string(),
curve=NIST256p, hashfunc=sha256)
self.assertTrue(vk2.verify(sig2, data))
vk3 = VerifyingKey.from_string(sk.get_verifying_key().to_string(),
curve=NIST256p)
self.assertTrue(vk3.verify(sig, data, hashfunc=sha256))
class OpenSSL(unittest.TestCase):
# test interoperability with OpenSSL tools. Note that openssl's ECDSA
# sign/verify arguments changed between 0.9.8 and 1.0.0: the early
# versions require "-ecdsa-with-SHA1", the later versions want just
# "-SHA1" (or to leave out that argument entirely, which means the
# signature will use some default digest algorithm, probably determined
# by the key, probably always SHA1).
#
# openssl ecparam -name secp224r1 -genkey -out privkey.pem
# openssl ec -in privkey.pem -text -noout # get the priv/pub keys
# openssl dgst -ecdsa-with-SHA1 -sign privkey.pem -out data.sig data.txt
# openssl asn1parse -in data.sig -inform DER
# data.sig is 64 bytes, probably 56b plus ASN1 overhead
# openssl dgst -ecdsa-with-SHA1 -prverify privkey.pem -signature data.sig data.txt ; echo $?
# openssl ec -in privkey.pem -pubout -out pubkey.pem
# openssl ec -in privkey.pem -pubout -outform DER -out pubkey.der
def get_openssl_messagedigest_arg(self):
v = run_openssl("version")
# e.g. "OpenSSL 1.0.0 29 Mar 2010", or "OpenSSL 1.0.0a 1 Jun 2010",
# or "OpenSSL 0.9.8o 01 Jun 2010"
vs = v.split()[1].split(".")
if vs >= ["1","0","0"]:
return "-SHA1"
else:
return "-ecdsa-with-SHA1"
# sk: 1:OpenSSL->python 2:python->OpenSSL
# vk: 3:OpenSSL->python 4:python->OpenSSL
# sig: 5:OpenSSL->python 6:python->OpenSSL
def test_from_openssl_nist192p(self):
return self.do_test_from_openssl(NIST192p)
def test_from_openssl_nist224p(self):
return self.do_test_from_openssl(NIST224p)
def test_from_openssl_nist256p(self):
return self.do_test_from_openssl(NIST256p)
def test_from_openssl_nist384p(self):
return self.do_test_from_openssl(NIST384p)
def test_from_openssl_nist521p(self):
return self.do_test_from_openssl(NIST521p)
def test_from_openssl_secp256k1(self):
return self.do_test_from_openssl(SECP256k1)
def do_test_from_openssl(self, curve):
curvename = curve.openssl_name
assert curvename
# OpenSSL: create sk, vk, sign.
# Python: read vk(3), checksig(5), read sk(1), sign, check
mdarg = self.get_openssl_messagedigest_arg()
if os.path.isdir("t"):
shutil.rmtree("t")
os.mkdir("t")
run_openssl("ecparam -name %s -genkey -out t/privkey.pem" % curvename)
run_openssl("ec -in t/privkey.pem -pubout -out t/pubkey.pem")
data = b("data")
with open("t/data.txt","wb") as e: e.write(data)
run_openssl("dgst %s -sign t/privkey.pem -out t/data.sig t/data.txt" % mdarg)
run_openssl("dgst %s -verify t/pubkey.pem -signature t/data.sig t/data.txt" % mdarg)
with open("t/pubkey.pem","rb") as e: pubkey_pem = e.read()
vk = VerifyingKey.from_pem(pubkey_pem) # 3
with open("t/data.sig","rb") as e: sig_der = e.read()
self.assertTrue(vk.verify(sig_der, data, # 5
hashfunc=sha1, sigdecode=sigdecode_der))
with open("t/privkey.pem") as e: fp = e.read()
sk = SigningKey.from_pem(fp) # 1
sig = sk.sign(data)
self.assertTrue(vk.verify(sig, data))
def test_to_openssl_nist192p(self):
self.do_test_to_openssl(NIST192p)
def test_to_openssl_nist224p(self):
self.do_test_to_openssl(NIST224p)
def test_to_openssl_nist256p(self):
self.do_test_to_openssl(NIST256p)
def test_to_openssl_nist384p(self):
self.do_test_to_openssl(NIST384p)
def test_to_openssl_nist521p(self):
self.do_test_to_openssl(NIST521p)
def test_to_openssl_secp256k1(self):
self.do_test_to_openssl(SECP256k1)
def do_test_to_openssl(self, curve):
curvename = curve.openssl_name
assert curvename
# Python: create sk, vk, sign.
# OpenSSL: read vk(4), checksig(6), read sk(2), sign, check
mdarg = self.get_openssl_messagedigest_arg()
if os.path.isdir("t"):
shutil.rmtree("t")
os.mkdir("t")
sk = SigningKey.generate(curve=curve)
vk = sk.get_verifying_key()
data = b("data")
with open("t/pubkey.der","wb") as e: e.write(vk.to_der()) # 4
with open("t/pubkey.pem","wb") as e: e.write(vk.to_pem()) # 4
sig_der = sk.sign(data, hashfunc=sha1, sigencode=sigencode_der)
with open("t/data.sig","wb") as e: e.write(sig_der) # 6
with open("t/data.txt","wb") as e: e.write(data)
with open("t/baddata.txt","wb") as e: e.write(data+b("corrupt"))
self.assertRaises(SubprocessError, run_openssl,
"dgst %s -verify t/pubkey.der -keyform DER -signature t/data.sig t/baddata.txt" % mdarg)
run_openssl("dgst %s -verify t/pubkey.der -keyform DER -signature t/data.sig t/data.txt" % mdarg)
with open("t/privkey.pem","wb") as e: e.write(sk.to_pem()) # 2
run_openssl("dgst %s -sign t/privkey.pem -out t/data.sig2 t/data.txt" % mdarg)
run_openssl("dgst %s -verify t/pubkey.pem -signature t/data.sig2 t/data.txt" % mdarg)
class DER(unittest.TestCase):
def test_oids(self):
oid_ecPublicKey = der.encode_oid(1, 2, 840, 10045, 2, 1)
self.assertEqual(hexlify(oid_ecPublicKey), b("06072a8648ce3d0201"))
self.assertEqual(hexlify(NIST224p.encoded_oid), b("06052b81040021"))
self.assertEqual(hexlify(NIST256p.encoded_oid),
b("06082a8648ce3d030107"))
x = oid_ecPublicKey + b("more")
x1, rest = der.remove_object(x)
self.assertEqual(x1, (1, 2, 840, 10045, 2, 1))
self.assertEqual(rest, b("more"))
def test_integer(self):
self.assertEqual(der.encode_integer(0), b("\x02\x01\x00"))
self.assertEqual(der.encode_integer(1), b("\x02\x01\x01"))
self.assertEqual(der.encode_integer(127), b("\x02\x01\x7f"))
self.assertEqual(der.encode_integer(128), b("\x02\x02\x00\x80"))
self.assertEqual(der.encode_integer(256), b("\x02\x02\x01\x00"))
#self.assertEqual(der.encode_integer(-1), b("\x02\x01\xff"))
def s(n): return der.remove_integer(der.encode_integer(n) + b("junk"))
self.assertEqual(s(0), (0, b("junk")))
self.assertEqual(s(1), (1, b("junk")))
self.assertEqual(s(127), (127, b("junk")))
self.assertEqual(s(128), (128, b("junk")))
self.assertEqual(s(256), (256, b("junk")))
self.assertEqual(s(1234567890123456789012345678901234567890),
(1234567890123456789012345678901234567890,b("junk")))
def test_number(self):
self.assertEqual(der.encode_number(0), b("\x00"))
self.assertEqual(der.encode_number(127), b("\x7f"))
self.assertEqual(der.encode_number(128), b("\x81\x00"))
self.assertEqual(der.encode_number(3*128+7), b("\x83\x07"))
#self.assertEqual(der.read_number("\x81\x9b"+"more"), (155, 2))
#self.assertEqual(der.encode_number(155), b("\x81\x9b"))
for n in (0, 1, 2, 127, 128, 3*128+7, 840, 10045): #, 155):
x = der.encode_number(n) + b("more")
n1, llen = der.read_number(x)
self.assertEqual(n1, n)
self.assertEqual(x[llen:], b("more"))
def test_length(self):
self.assertEqual(der.encode_length(0), b("\x00"))
self.assertEqual(der.encode_length(127), b("\x7f"))
self.assertEqual(der.encode_length(128), b("\x81\x80"))
self.assertEqual(der.encode_length(255), b("\x81\xff"))
self.assertEqual(der.encode_length(256), b("\x82\x01\x00"))
self.assertEqual(der.encode_length(3*256+7), b("\x82\x03\x07"))
self.assertEqual(der.read_length(b("\x81\x9b")+b("more")), (155, 2))
self.assertEqual(der.encode_length(155), b("\x81\x9b"))
for n in (0, 1, 2, 127, 128, 255, 256, 3*256+7, 155):
x = der.encode_length(n) + b("more")
n1, llen = der.read_length(x)
self.assertEqual(n1, n)
self.assertEqual(x[llen:], b("more"))
def test_sequence(self):
x = der.encode_sequence(b("ABC"), b("DEF")) + b("GHI")
self.assertEqual(x, b("\x30\x06ABCDEFGHI"))
x1, rest = der.remove_sequence(x)
self.assertEqual(x1, b("ABCDEF"))
self.assertEqual(rest, b("GHI"))
def test_constructed(self):
x = der.encode_constructed(0, NIST224p.encoded_oid)
self.assertEqual(hexlify(x), b("a007") + b("06052b81040021"))
x = der.encode_constructed(1, unhexlify(b("0102030a0b0c")))
self.assertEqual(hexlify(x), b("a106") + b("0102030a0b0c"))
class Util(unittest.TestCase):
def test_trytryagain(self):
tta = util.randrange_from_seed__trytryagain
for i in range(1000):
seed = "seed-%d" % i
for order in (2**8-2, 2**8-1, 2**8, 2**8+1, 2**8+2,
2**16-1, 2**16+1):
n = tta(seed, order)
self.assertTrue(1 <= n < order, (1, n, order))
# this trytryagain *does* provide long-term stability
self.assertEqual(("%x"%(tta("seed", NIST224p.order))).encode(),
b("6fa59d73bf0446ae8743cf748fc5ac11d5585a90356417e97155c3bc"))
def test_randrange(self):
# util.randrange does not provide long-term stability: we might
# change the algorithm in the future.
for i in range(1000):
entropy = util.PRNG("seed-%d" % i)
for order in (2**8-2, 2**8-1, 2**8,
2**16-1, 2**16+1,
):
# that oddball 2**16+1 takes half our runtime
n = util.randrange(order, entropy=entropy)
self.assertTrue(1 <= n < order, (1, n, order))
def OFF_test_prove_uniformity(self):
order = 2**8-2
counts = dict([(i, 0) for i in range(1, order)])
assert 0 not in counts
assert order not in counts
for i in range(1000000):
seed = "seed-%d" % i
n = util.randrange_from_seed__trytryagain(seed, order)
counts[n] += 1
# this technique should use the full range
self.assertTrue(counts[order-1])
for i in range(1, order):
print_("%3d: %s" % (i, "*"*(counts[i]//100)))
class RFC6979(unittest.TestCase):
# https://tools.ietf.org/html/rfc6979#appendix-A.1
def _do(self, generator, secexp, hsh, hash_func, expected):
actual = rfc6979.generate_k(generator.order(), secexp, hash_func, hsh)
self.assertEqual(expected, actual)
def test_SECP256k1(self):
'''RFC doesn't contain test vectors for SECP256k1 used in bitcoin.
This vector has been computed by Golang reference implementation instead.'''
self._do(
generator = SECP256k1.generator,
secexp = int("9d0219792467d7d37b4d43298a7d0c05", 16),
hsh = sha256(b("sample")).digest(),
hash_func = sha256,
expected = int("8fa1f95d514760e498f28957b824ee6ec39ed64826ff4fecc2b5739ec45b91cd", 16))
def test_SECP256k1_2(self):
self._do(
generator=SECP256k1.generator,
secexp=int("cca9fbcc1b41e5a95d369eaa6ddcff73b61a4efaa279cfc6567e8daa39cbaf50", 16),
hsh=sha256(b("sample")).digest(),
hash_func=sha256,
expected=int("2df40ca70e639d89528a6b670d9d48d9165fdc0febc0974056bdce192b8e16a3", 16))
def test_SECP256k1_3(self):
self._do(
generator=SECP256k1.generator,
secexp=0x1,
hsh=sha256(b("Satoshi Nakamoto")).digest(),
hash_func=sha256,
expected=0x8F8A276C19F4149656B280621E358CCE24F5F52542772691EE69063B74F15D15)
def test_SECP256k1_4(self):
self._do(
generator=SECP256k1.generator,
secexp=0x1,
hsh=sha256(b("All those moments will be lost in time, like tears in rain. Time to die...")).digest(),
hash_func=sha256,
expected=0x38AA22D72376B4DBC472E06C3BA403EE0A394DA63FC58D88686C611ABA98D6B3)
def test_SECP256k1_5(self):
self._do(
generator=SECP256k1.generator,
secexp=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140,
hsh=sha256(b("Satoshi Nakamoto")).digest(),
hash_func=sha256,
expected=0x33A19B60E25FB6F4435AF53A3D42D493644827367E6453928554F43E49AA6F90)
def test_SECP256k1_6(self):
self._do(
generator=SECP256k1.generator,
secexp=0xf8b8af8ce3c7cca5e300d33939540c10d45ce001b8f252bfbc57ba0342904181,
hsh=sha256(b("Alan Turing")).digest(),
hash_func=sha256,
expected=0x525A82B70E67874398067543FD84C83D30C175FDC45FDEEE082FE13B1D7CFDF1)
def test_1(self):
# Basic example of the RFC, it also tests 'try-try-again' from Step H of rfc6979
self._do(
generator = Point(None, 0, 0, int("4000000000000000000020108A2E0CC0D99F8A5EF", 16)),
secexp = int("09A4D6792295A7F730FC3F2B49CBC0F62E862272F", 16),
hsh = unhexlify(b("AF2BDBE1AA9B6EC1E2ADE1D694F41FC71A831D0268E9891562113D8A62ADD1BF")),
hash_func = sha256,
expected = int("23AF4074C90A02B3FE61D286D5C87F425E6BDD81B", 16))
def test_2(self):
self._do(
generator=NIST192p.generator,
secexp = int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16),
hsh = sha1(b("sample")).digest(),
hash_func = sha1,
expected = int("37D7CA00D2C7B0E5E412AC03BD44BA837FDD5B28CD3B0021", 16))
def test_3(self):
self._do(
generator=NIST192p.generator,
secexp = int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16),
hsh = sha256(b("sample")).digest(),
hash_func = sha256,
expected = int("32B1B6D7D42A05CB449065727A84804FB1A3E34D8F261496", 16))
def test_4(self):
self._do(
generator=NIST192p.generator,
secexp = int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16),
hsh = sha512(b("sample")).digest(),
hash_func = sha512,
expected = int("A2AC7AB055E4F20692D49209544C203A7D1F2C0BFBC75DB1", 16))
def test_5(self):
self._do(
generator=NIST192p.generator,
secexp = int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16),
hsh = sha1(b("test")).digest(),
hash_func = sha1,
expected = int("D9CF9C3D3297D3260773A1DA7418DB5537AB8DD93DE7FA25", 16))
def test_6(self):
self._do(
generator=NIST192p.generator,
secexp = int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16),
hsh = sha256(b("test")).digest(),
hash_func = sha256,
expected = int("5C4CE89CF56D9E7C77C8585339B006B97B5F0680B4306C6C", 16))
def test_7(self):
self._do(
generator=NIST192p.generator,
secexp = int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16),
hsh = sha512(b("test")).digest(),
hash_func = sha512,
expected = int("0758753A5254759C7CFBAD2E2D9B0792EEE44136C9480527", 16))
def test_8(self):
self._do(
generator=NIST521p.generator,
secexp = int("0FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538", 16),
hsh = sha1(b("sample")).digest(),
hash_func = sha1,
expected = int("089C071B419E1C2820962321787258469511958E80582E95D8378E0C2CCDB3CB42BEDE42F50E3FA3C71F5A76724281D31D9C89F0F91FC1BE4918DB1C03A5838D0F9", 16))
def test_9(self):
self._do(
generator=NIST521p.generator,
secexp = int("0FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538", 16),
hsh = sha256(b("sample")).digest(),
hash_func = sha256,
expected = int("0EDF38AFCAAECAB4383358B34D67C9F2216C8382AAEA44A3DAD5FDC9C32575761793FEF24EB0FC276DFC4F6E3EC476752F043CF01415387470BCBD8678ED2C7E1A0", 16))
def test_10(self):
self._do(
generator=NIST521p.generator,
secexp = int("0FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538", 16),
hsh = sha512(b("test")).digest(),
hash_func = sha512,
expected = int("16200813020EC986863BEDFC1B121F605C1215645018AEA1A7B215A564DE9EB1B38A67AA1128B80CE391C4FB71187654AAA3431027BFC7F395766CA988C964DC56D", 16))
def __main__():
unittest.main()
if __name__ == "__main__":
__main__()

247
bin/python/ecdsa/util.py Normal file
View File

@@ -0,0 +1,247 @@
from __future__ import division
import os
import math
import binascii
from hashlib import sha256
from . import der
from .curves import orderlen
from .six import PY3, int2byte, b, next
# RFC5480:
# The "unrestricted" algorithm identifier is:
# id-ecPublicKey OBJECT IDENTIFIER ::= {
# iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 }
oid_ecPublicKey = (1, 2, 840, 10045, 2, 1)
encoded_oid_ecPublicKey = der.encode_oid(*oid_ecPublicKey)
def randrange(order, entropy=None):
"""Return a random integer k such that 1 <= k < order, uniformly
distributed across that range. For simplicity, this only behaves well if
'order' is fairly close (but below) a power of 256. The try-try-again
algorithm we use takes longer and longer time (on average) to complete as
'order' falls, rising to a maximum of avg=512 loops for the worst-case
(256**k)+1 . All of the standard curves behave well. There is a cutoff at
10k loops (which raises RuntimeError) to prevent an infinite loop when
something is really broken like the entropy function not working.
Note that this function is not declared to be forwards-compatible: we may
change the behavior in future releases. The entropy= argument (which
should get a callable that behaves like os.urandom) can be used to
achieve stability within a given release (for repeatable unit tests), but
should not be used as a long-term-compatible key generation algorithm.
"""
# we could handle arbitrary orders (even 256**k+1) better if we created
# candidates bit-wise instead of byte-wise, which would reduce the
# worst-case behavior to avg=2 loops, but that would be more complex. The
# change would be to round the order up to a power of 256, subtract one
# (to get 0xffff..), use that to get a byte-long mask for the top byte,
# generate the len-1 entropy bytes, generate one extra byte and mask off
# the top bits, then combine it with the rest. Requires jumping back and
# forth between strings and integers a lot.
if entropy is None:
entropy = os.urandom
assert order > 1
bytes = orderlen(order)
dont_try_forever = 10000 # gives about 2**-60 failures for worst case
while dont_try_forever > 0:
dont_try_forever -= 1
candidate = string_to_number(entropy(bytes)) + 1
if 1 <= candidate < order:
return candidate
continue
raise RuntimeError("randrange() tried hard but gave up, either something"
" is very wrong or you got realllly unlucky. Order was"
" %x" % order)
class PRNG:
# this returns a callable which, when invoked with an integer N, will
# return N pseudorandom bytes. Note: this is a short-term PRNG, meant
# primarily for the needs of randrange_from_seed__trytryagain(), which
# only needs to run it a few times per seed. It does not provide
# protection against state compromise (forward security).
def __init__(self, seed):
self.generator = self.block_generator(seed)
def __call__(self, numbytes):
a = [next(self.generator) for i in range(numbytes)]
if PY3:
return bytes(a)
else:
return "".join(a)
def block_generator(self, seed):
counter = 0
while True:
for byte in sha256(("prng-%d-%s" % (counter, seed)).encode()).digest():
yield byte
counter += 1
def randrange_from_seed__overshoot_modulo(seed, order):
# hash the data, then turn the digest into a number in [1,order).
#
# We use David-Sarah Hopwood's suggestion: turn it into a number that's
# sufficiently larger than the group order, then modulo it down to fit.
# This should give adequate (but not perfect) uniformity, and simple
# code. There are other choices: try-try-again is the main one.
base = PRNG(seed)(2*orderlen(order))
number = (int(binascii.hexlify(base), 16) % (order-1)) + 1
assert 1 <= number < order, (1, number, order)
return number
def lsb_of_ones(numbits):
return (1 << numbits) - 1
def bits_and_bytes(order):
bits = int(math.log(order-1, 2)+1)
bytes = bits // 8
extrabits = bits % 8
return bits, bytes, extrabits
# the following randrange_from_seed__METHOD() functions take an
# arbitrarily-sized secret seed and turn it into a number that obeys the same
# range limits as randrange() above. They are meant for deriving consistent
# signing keys from a secret rather than generating them randomly, for
# example a protocol in which three signing keys are derived from a master
# secret. You should use a uniformly-distributed unguessable seed with about
# curve.baselen bytes of entropy. To use one, do this:
# seed = os.urandom(curve.baselen) # or other starting point
# secexp = ecdsa.util.randrange_from_seed__trytryagain(sed, curve.order)
# sk = SigningKey.from_secret_exponent(secexp, curve)
def randrange_from_seed__truncate_bytes(seed, order, hashmod=sha256):
# hash the seed, then turn the digest into a number in [1,order), but
# don't worry about trying to uniformly fill the range. This will lose,
# on average, four bits of entropy.
bits, bytes, extrabits = bits_and_bytes(order)
if extrabits:
bytes += 1
base = hashmod(seed).digest()[:bytes]
base = "\x00"*(bytes-len(base)) + base
number = 1+int(binascii.hexlify(base), 16)
assert 1 <= number < order
return number
def randrange_from_seed__truncate_bits(seed, order, hashmod=sha256):
# like string_to_randrange_truncate_bytes, but only lose an average of
# half a bit
bits = int(math.log(order-1, 2)+1)
maxbytes = (bits+7) // 8
base = hashmod(seed).digest()[:maxbytes]
base = "\x00"*(maxbytes-len(base)) + base
topbits = 8*maxbytes - bits
if topbits:
base = int2byte(ord(base[0]) & lsb_of_ones(topbits)) + base[1:]
number = 1+int(binascii.hexlify(base), 16)
assert 1 <= number < order
return number
def randrange_from_seed__trytryagain(seed, order):
# figure out exactly how many bits we need (rounded up to the nearest
# bit), so we can reduce the chance of looping to less than 0.5 . This is
# specified to feed from a byte-oriented PRNG, and discards the
# high-order bits of the first byte as necessary to get the right number
# of bits. The average number of loops will range from 1.0 (when
# order=2**k-1) to 2.0 (when order=2**k+1).
assert order > 1
bits, bytes, extrabits = bits_and_bytes(order)
generate = PRNG(seed)
while True:
extrabyte = b("")
if extrabits:
extrabyte = int2byte(ord(generate(1)) & lsb_of_ones(extrabits))
guess = string_to_number(extrabyte + generate(bytes)) + 1
if 1 <= guess < order:
return guess
def number_to_string(num, order):
l = orderlen(order)
fmt_str = "%0" + str(2*l) + "x"
string = binascii.unhexlify((fmt_str % num).encode())
assert len(string) == l, (len(string), l)
return string
def number_to_string_crop(num, order):
l = orderlen(order)
fmt_str = "%0" + str(2*l) + "x"
string = binascii.unhexlify((fmt_str % num).encode())
return string[:l]
def string_to_number(string):
return int(binascii.hexlify(string), 16)
def string_to_number_fixedlen(string, order):
l = orderlen(order)
assert len(string) == l, (len(string), l)
return int(binascii.hexlify(string), 16)
# these methods are useful for the sigencode= argument to SK.sign() and the
# sigdecode= argument to VK.verify(), and control how the signature is packed
# or unpacked.
def sigencode_strings(r, s, order):
r_str = number_to_string(r, order)
s_str = number_to_string(s, order)
return (r_str, s_str)
def sigencode_string(r, s, order):
# for any given curve, the size of the signature numbers is
# fixed, so just use simple concatenation
r_str, s_str = sigencode_strings(r, s, order)
return r_str + s_str
def sigencode_der(r, s, order):
return der.encode_sequence(der.encode_integer(r), der.encode_integer(s))
# canonical versions of sigencode methods
# these enforce low S values, by negating the value (modulo the order) if above order/2
# see CECKey::Sign() https://github.com/bitcoin/bitcoin/blob/master/src/key.cpp#L214
def sigencode_strings_canonize(r, s, order):
if s > order / 2:
s = order - s
return sigencode_strings(r, s, order)
def sigencode_string_canonize(r, s, order):
if s > order / 2:
s = order - s
return sigencode_string(r, s, order)
def sigencode_der_canonize(r, s, order):
if s > order / 2:
s = order - s
return sigencode_der(r, s, order)
def sigdecode_string(signature, order):
l = orderlen(order)
assert len(signature) == 2*l, (len(signature), 2*l)
r = string_to_number_fixedlen(signature[:l], order)
s = string_to_number_fixedlen(signature[l:], order)
return r, s
def sigdecode_strings(rs_strings, order):
(r_str, s_str) = rs_strings
l = orderlen(order)
assert len(r_str) == l, (len(r_str), l)
assert len(s_str) == l, (len(s_str), l)
r = string_to_number_fixedlen(r_str, order)
s = string_to_number_fixedlen(s_str, order)
return r, s
def sigdecode_der(sig_der, order):
#return der.encode_sequence(der.encode_integer(r), der.encode_integer(s))
rs_strings, empty = der.remove_sequence(sig_der)
if empty != b(""):
raise der.UnexpectedDER("trailing junk after DER sig: %s" %
binascii.hexlify(empty))
r, rest = der.remove_integer(rs_strings)
s, empty = der.remove_integer(rest)
if empty != b(""):
raise der.UnexpectedDER("trailing junk after DER numbers: %s" %
binascii.hexlify(empty))
return r, s

105
bin/python/ed25519.py Normal file
View File

@@ -0,0 +1,105 @@
import hashlib
b = 256
q = 2**255 - 19
l = 2**252 + 27742317777372353535851937790883648493
def H(m):
return hashlib.sha512(m).digest()
def expmod(b,e,m):
if e == 0: return 1
t = expmod(b,e/2,m)**2 % m
if e & 1: t = (t*b) % m
return t
def inv(x):
return expmod(x,q-2,q)
d = -121665 * inv(121666)
I = expmod(2,(q-1)/4,q)
def xrecover(y):
xx = (y*y-1) * inv(d*y*y+1)
x = expmod(xx,(q+3)/8,q)
if (x*x - xx) % q != 0: x = (x*I) % q
if x % 2 != 0: x = q-x
return x
By = 4 * inv(5)
Bx = xrecover(By)
B = [Bx % q,By % q]
def edwards(P,Q):
x1 = P[0]
y1 = P[1]
x2 = Q[0]
y2 = Q[1]
x3 = (x1*y2+x2*y1) * inv(1+d*x1*x2*y1*y2)
y3 = (y1*y2+x1*x2) * inv(1-d*x1*x2*y1*y2)
return [x3 % q,y3 % q]
def scalarmult(P,e):
if e == 0: return [0,1]
Q = scalarmult(P,e/2)
Q = edwards(Q,Q)
if e & 1: Q = edwards(Q,P)
return Q
def encodeint(y):
bits = [(y >> i) & 1 for i in range(b)]
return ''.join([chr(sum([bits[i * 8 + j] << j for j in range(8)])) for i in range(b/8)])
def encodepoint(P):
x = P[0]
y = P[1]
bits = [(y >> i) & 1 for i in range(b - 1)] + [x & 1]
return ''.join([chr(sum([bits[i * 8 + j] << j for j in range(8)])) for i in range(b/8)])
def bit(h,i):
return (ord(h[i/8]) >> (i%8)) & 1
def publickey(sk):
h = H(sk)
a = 2**(b-2) + sum(2**i * bit(h,i) for i in range(3,b-2))
A = scalarmult(B,a)
return encodepoint(A)
def Hint(m):
h = H(m)
return sum(2**i * bit(h,i) for i in range(2*b))
def signature(m,sk,pk):
h = H(sk)
a = 2**(b-2) + sum(2**i * bit(h,i) for i in range(3,b-2))
r = Hint(''.join([h[i] for i in range(b/8,b/4)]) + m)
R = scalarmult(B,r)
S = (r + Hint(encodepoint(R) + pk + m) * a) % l
return encodepoint(R) + encodeint(S)
def isoncurve(P):
x = P[0]
y = P[1]
return (-x*x + y*y - 1 - d*x*x*y*y) % q == 0
def decodeint(s):
return sum(2**i * bit(s,i) for i in range(0,b))
def decodepoint(s):
y = sum(2**i * bit(s,i) for i in range(0,b-1))
x = xrecover(y)
if x & 1 != bit(s,b-1): x = q-x
P = [x,y]
if not isoncurve(P): raise Exception("decoding point that is not on curve")
return P
def checkvalid(s,m,pk):
if len(s) != b/4: raise Exception("signature length is wrong")
if len(pk) != b/8: raise Exception("public-key length is wrong")
R = decodepoint(s[0:b/8])
A = decodepoint(pk)
S = decodeint(s[b/8:b/4])
h = Hint(encodepoint(R) + pk + m)
if scalarmult(B,S) != edwards(R,scalarmult(A,h)):
raise Exception("signature does not pass verification")

View File

@@ -0,0 +1,4 @@
from .jsonpath import *
from .parser import parse
__version__ = '1.3.0'

View File

@@ -0,0 +1,510 @@
from __future__ import unicode_literals, print_function, absolute_import, division, generators, nested_scopes
import logging
import six
from six.moves import xrange
from itertools import *
logger = logging.getLogger(__name__)
# Turn on/off the automatic creation of id attributes
# ... could be a kwarg pervasively but uses are rare and simple today
auto_id_field = None
class JSONPath(object):
"""
The base class for JSONPath abstract syntax; those
methods stubbed here are the interface to supported
JSONPath semantics.
"""
def find(self, data):
"""
All `JSONPath` types support `find()`, which returns an iterable of `DatumInContext`s.
They keep track of the path followed to the current location, so if the calling code
has some opinion about that, it can be passed in here as a starting point.
"""
raise NotImplementedError()
def update(self, data, val):
"Returns `data` with the specified path replaced by `val`"
raise NotImplementedError()
def child(self, child):
"""
Equivalent to Child(self, next) but with some canonicalization
"""
if isinstance(self, This) or isinstance(self, Root):
return child
elif isinstance(child, This):
return self
elif isinstance(child, Root):
return child
else:
return Child(self, child)
def make_datum(self, value):
if isinstance(value, DatumInContext):
return value
else:
return DatumInContext(value, path=Root(), context=None)
class DatumInContext(object):
"""
Represents a datum along a path from a context.
Essentially a zipper but with a structure represented by JSONPath,
and where the context is more of a parent pointer than a proper
representation of the context.
For quick-and-dirty work, this proxies any non-special attributes
to the underlying datum, but the actual datum can (and usually should)
be retrieved via the `value` attribute.
To place `datum` within another, use `datum.in_context(context=..., path=...)`
which extends the path. If the datum already has a context, it places the entire
context within that passed in, so an object can be built from the inside
out.
"""
@classmethod
def wrap(cls, data):
if isinstance(data, cls):
return data
else:
return cls(data)
def __init__(self, value, path=None, context=None):
self.value = value
self.path = path or This()
self.context = None if context is None else DatumInContext.wrap(context)
def in_context(self, context, path):
context = DatumInContext.wrap(context)
if self.context:
return DatumInContext(value=self.value, path=self.path, context=context.in_context(path=path, context=context))
else:
return DatumInContext(value=self.value, path=path, context=context)
@property
def full_path(self):
return self.path if self.context is None else self.context.full_path.child(self.path)
@property
def id_pseudopath(self):
"""
Looks like a path, but with ids stuck in when available
"""
try:
pseudopath = Fields(str(self.value[auto_id_field]))
except (TypeError, AttributeError, KeyError): # This may not be all the interesting exceptions
pseudopath = self.path
if self.context:
return self.context.id_pseudopath.child(pseudopath)
else:
return pseudopath
def __repr__(self):
return '%s(value=%r, path=%r, context=%r)' % (self.__class__.__name__, self.value, self.path, self.context)
def __eq__(self, other):
return isinstance(other, DatumInContext) and other.value == self.value and other.path == self.path and self.context == other.context
class AutoIdForDatum(DatumInContext):
"""
This behaves like a DatumInContext, but the value is
always the path leading up to it, not including the "id",
and with any "id" fields along the way replacing the prior
segment of the path
For example, it will make "foo.bar.id" return a datum
that behaves like DatumInContext(value="foo.bar", path="foo.bar.id").
This is disabled by default; it can be turned on by
settings the `auto_id_field` global to a value other
than `None`.
"""
def __init__(self, datum, id_field=None):
"""
Invariant is that datum.path is the path from context to datum. The auto id
will either be the id in the datum (if present) or the id of the context
followed by the path to the datum.
The path to this datum is always the path to the context, the path to the
datum, and then the auto id field.
"""
self.datum = datum
self.id_field = id_field or auto_id_field
@property
def value(self):
return str(self.datum.id_pseudopath)
@property
def path(self):
return self.id_field
@property
def context(self):
return self.datum
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__, self.datum)
def in_context(self, context, path):
return AutoIdForDatum(self.datum.in_context(context=context, path=path))
def __eq__(self, other):
return isinstance(other, AutoIdForDatum) and other.datum == self.datum and self.id_field == other.id_field
class Root(JSONPath):
"""
The JSONPath referring to the "root" object. Concrete syntax is '$'.
The root is the topmost datum without any context attached.
"""
def find(self, data):
if not isinstance(data, DatumInContext):
return [DatumInContext(data, path=Root(), context=None)]
else:
if data.context is None:
return [DatumInContext(data.value, context=None, path=Root())]
else:
return Root().find(data.context)
def update(self, data, val):
return val
def __str__(self):
return '$'
def __repr__(self):
return 'Root()'
def __eq__(self, other):
return isinstance(other, Root)
class This(JSONPath):
"""
The JSONPath referring to the current datum. Concrete syntax is '@'.
"""
def find(self, datum):
return [DatumInContext.wrap(datum)]
def update(self, data, val):
return val
def __str__(self):
return '`this`'
def __repr__(self):
return 'This()'
def __eq__(self, other):
return isinstance(other, This)
class Child(JSONPath):
"""
JSONPath that first matches the left, then the right.
Concrete syntax is <left> '.' <right>
"""
def __init__(self, left, right):
self.left = left
self.right = right
def find(self, datum):
"""
Extra special case: auto ids do not have children,
so cut it off right now rather than auto id the auto id
"""
return [submatch
for subdata in self.left.find(datum)
if not isinstance(subdata, AutoIdForDatum)
for submatch in self.right.find(subdata)]
def __eq__(self, other):
return isinstance(other, Child) and self.left == other.left and self.right == other.right
def __str__(self):
return '%s.%s' % (self.left, self.right)
def __repr__(self):
return '%s(%r, %r)' % (self.__class__.__name__, self.left, self.right)
class Parent(JSONPath):
"""
JSONPath that matches the parent node of the current match.
Will crash if no such parent exists.
Available via named operator `parent`.
"""
def find(self, datum):
datum = DatumInContext.wrap(datum)
return [datum.context]
def __eq__(self, other):
return isinstance(other, Parent)
def __str__(self):
return '`parent`'
def __repr__(self):
return 'Parent()'
class Where(JSONPath):
"""
JSONPath that first matches the left, and then
filters for only those nodes that have
a match on the right.
WARNING: Subject to change. May want to have "contains"
or some other better word for it.
"""
def __init__(self, left, right):
self.left = left
self.right = right
def find(self, data):
return [subdata for subdata in self.left.find(data) if self.right.find(data)]
def __str__(self):
return '%s where %s' % (self.left, self.right)
def __eq__(self, other):
return isinstance(other, Where) and other.left == self.left and other.right == self.right
class Descendants(JSONPath):
"""
JSONPath that matches first the left expression then any descendant
of it which matches the right expression.
"""
def __init__(self, left, right):
self.left = left
self.right = right
def find(self, datum):
# <left> .. <right> ==> <left> . (<right> | *..<right> | [*]..<right>)
#
# With with a wonky caveat that since Slice() has funky coercions
# we cannot just delegate to that equivalence or we'll hit an
# infinite loop. So right here we implement the coercion-free version.
# Get all left matches into a list
left_matches = self.left.find(datum)
if not isinstance(left_matches, list):
left_matches = [left_matches]
def match_recursively(datum):
right_matches = self.right.find(datum)
# Manually do the * or [*] to avoid coercion and recurse just the right-hand pattern
if isinstance(datum.value, list):
recursive_matches = [submatch
for i in range(0, len(datum.value))
for submatch in match_recursively(DatumInContext(datum.value[i], context=datum, path=Index(i)))]
elif isinstance(datum.value, dict):
recursive_matches = [submatch
for field in datum.value.keys()
for submatch in match_recursively(DatumInContext(datum.value[field], context=datum, path=Fields(field)))]
else:
recursive_matches = []
return right_matches + list(recursive_matches)
# TODO: repeatable iterator instead of list?
return [submatch
for left_match in left_matches
for submatch in match_recursively(left_match)]
def is_singular():
return False
def __str__(self):
return '%s..%s' % (self.left, self.right)
def __eq__(self, other):
return isinstance(other, Descendants) and self.left == other.left and self.right == other.right
class Union(JSONPath):
"""
JSONPath that returns the union of the results of each match.
This is pretty shoddily implemented for now. The nicest semantics
in case of mismatched bits (list vs atomic) is to put
them all in a list, but I haven't done that yet.
WARNING: Any appearance of this being the _concatenation_ is
coincidence. It may even be a bug! (or laziness)
"""
def __init__(self, left, right):
self.left = left
self.right = right
def is_singular(self):
return False
def find(self, data):
return self.left.find(data) + self.right.find(data)
class Intersect(JSONPath):
"""
JSONPath for bits that match *both* patterns.
This can be accomplished a couple of ways. The most
efficient is to actually build the intersected
AST as in building a state machine for matching the
intersection of regular languages. The next
idea is to build a filtered data and match against
that.
"""
def __init__(self, left, right):
self.left = left
self.right = right
def is_singular(self):
return False
def find(self, data):
raise NotImplementedError()
class Fields(JSONPath):
"""
JSONPath referring to some field of the current object.
Concrete syntax ix comma-separated field names.
WARNING: If '*' is any of the field names, then they will
all be returned.
"""
def __init__(self, *fields):
self.fields = fields
def get_field_datum(self, datum, field):
if field == auto_id_field:
return AutoIdForDatum(datum)
else:
try:
field_value = datum.value[field] # Do NOT use `val.get(field)` since that confuses None as a value and None due to `get`
return DatumInContext(value=field_value, path=Fields(field), context=datum)
except (TypeError, KeyError, AttributeError):
return None
def reified_fields(self, datum):
if '*' not in self.fields:
return self.fields
else:
try:
fields = tuple(datum.value.keys())
return fields if auto_id_field is None else fields + (auto_id_field,)
except AttributeError:
return ()
def find(self, datum):
datum = DatumInContext.wrap(datum)
return [field_datum
for field_datum in [self.get_field_datum(datum, field) for field in self.reified_fields(datum)]
if field_datum is not None]
def __str__(self):
return ','.join(self.fields)
def __repr__(self):
return '%s(%s)' % (self.__class__.__name__, ','.join(map(repr, self.fields)))
def __eq__(self, other):
return isinstance(other, Fields) and tuple(self.fields) == tuple(other.fields)
class Index(JSONPath):
"""
JSONPath that matches indices of the current datum, or none if not large enough.
Concrete syntax is brackets.
WARNING: If the datum is not long enough, it will not crash but will not match anything.
NOTE: For the concrete syntax of `[*]`, the abstract syntax is a Slice() with no parameters (equiv to `[:]`
"""
def __init__(self, index):
self.index = index
def find(self, datum):
datum = DatumInContext.wrap(datum)
if len(datum.value) > self.index:
return [DatumInContext(datum.value[self.index], path=self, context=datum)]
else:
return []
def __eq__(self, other):
return isinstance(other, Index) and self.index == other.index
def __str__(self):
return '[%i]' % self.index
class Slice(JSONPath):
"""
JSONPath matching a slice of an array.
Because of a mismatch between JSON and XML when schema-unaware,
this always returns an iterable; if the incoming data
was not a list, then it returns a one element list _containing_ that
data.
Consider these two docs, and their schema-unaware translation to JSON:
<a><b>hello</b></a> ==> {"a": {"b": "hello"}}
<a><b>hello</b><b>goodbye</b></a> ==> {"a": {"b": ["hello", "goodbye"]}}
If there were a schema, it would be known that "b" should always be an
array (unless the schema were wonky, but that is too much to fix here)
so when querying with JSON if the one writing the JSON knows that it
should be an array, they can write a slice operator and it will coerce
a non-array value to an array.
This may be a bit unfortunate because it would be nice to always have
an iterator, but dictionaries and other objects may also be iterable,
so this is the compromise.
"""
def __init__(self, start=None, end=None, step=None):
self.start = start
self.end = end
self.step = step
def find(self, datum):
datum = DatumInContext.wrap(datum)
# Here's the hack. If it is a dictionary or some kind of constant,
# put it in a single-element list
if (isinstance(datum.value, dict) or isinstance(datum.value, six.integer_types) or isinstance(datum.value, six.string_types)):
return self.find(DatumInContext([datum.value], path=datum.path, context=datum.context))
# Some iterators do not support slicing but we can still
# at least work for '*'
if self.start == None and self.end == None and self.step == None:
return [DatumInContext(datum.value[i], path=Index(i), context=datum) for i in xrange(0, len(datum.value))]
else:
return [DatumInContext(datum.value[i], path=Index(i), context=datum) for i in range(0, len(datum.value))[self.start:self.end:self.step]]
def __str__(self):
if self.start == None and self.end == None and self.step == None:
return '[*]'
else:
return '[%s%s%s]' % (self.start or '',
':%d'%self.end if self.end else '',
':%d'%self.step if self.step else '')
def __repr__(self):
return '%s(start=%r,end=%r,step=%r)' % (self.__class__.__name__, self.start, self.end, self.step)
def __eq__(self, other):
return isinstance(other, Slice) and other.start == self.start and self.end == other.end and other.step == self.step

View File

@@ -0,0 +1,171 @@
from __future__ import unicode_literals, print_function, absolute_import, division, generators, nested_scopes
import sys
import logging
import ply.lex
logger = logging.getLogger(__name__)
class JsonPathLexerError(Exception):
pass
class JsonPathLexer(object):
'''
A Lexical analyzer for JsonPath.
'''
def __init__(self, debug=False):
self.debug = debug
if self.__doc__ == None:
raise JsonPathLexerError('Docstrings have been removed! By design of PLY, jsonpath-rw requires docstrings. You must not use PYTHONOPTIMIZE=2 or python -OO.')
def tokenize(self, string):
'''
Maps a string to an iterator over tokens. In other words: [char] -> [token]
'''
new_lexer = ply.lex.lex(module=self, debug=self.debug, errorlog=logger)
new_lexer.latest_newline = 0
new_lexer.string_value = None
new_lexer.input(string)
while True:
t = new_lexer.token()
if t is None: break
t.col = t.lexpos - new_lexer.latest_newline
yield t
if new_lexer.string_value is not None:
raise JsonPathLexerError('Unexpected EOF in string literal or identifier')
# ============== PLY Lexer specification ==================
#
# This probably should be private but:
# - the parser requires access to `tokens` (perhaps they should be defined in a third, shared dependency)
# - things like `literals` might be a legitimate part of the public interface.
#
# Anyhow, it is pythonic to give some rope to hang oneself with :-)
literals = ['*', '.', '[', ']', '(', ')', '$', ',', ':', '|', '&']
reserved_words = { 'where': 'WHERE' }
tokens = ['DOUBLEDOT', 'NUMBER', 'ID', 'NAMED_OPERATOR'] + list(reserved_words.values())
states = [ ('singlequote', 'exclusive'),
('doublequote', 'exclusive'),
('backquote', 'exclusive') ]
# Normal lexing, rather easy
t_DOUBLEDOT = r'\.\.'
t_ignore = ' \t'
def t_ID(self, t):
r'[a-zA-Z_@][a-zA-Z0-9_@\-]*'
t.type = self.reserved_words.get(t.value, 'ID')
return t
def t_NUMBER(self, t):
r'-?\d+'
t.value = int(t.value)
return t
# Single-quoted strings
t_singlequote_ignore = ''
def t_singlequote(self, t):
r"'"
t.lexer.string_start = t.lexer.lexpos
t.lexer.string_value = ''
t.lexer.push_state('singlequote')
def t_singlequote_content(self, t):
r"[^'\\]+"
t.lexer.string_value += t.value
def t_singlequote_escape(self, t):
r'\\.'
t.lexer.string_value += t.value[1]
def t_singlequote_end(self, t):
r"'"
t.value = t.lexer.string_value
t.type = 'ID'
t.lexer.string_value = None
t.lexer.pop_state()
return t
def t_singlequote_error(self, t):
raise JsonPathLexerError('Error on line %s, col %s while lexing singlequoted field: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.lexer.latest_newline, t.value[0]))
# Double-quoted strings
t_doublequote_ignore = ''
def t_doublequote(self, t):
r'"'
t.lexer.string_start = t.lexer.lexpos
t.lexer.string_value = ''
t.lexer.push_state('doublequote')
def t_doublequote_content(self, t):
r'[^"\\]+'
t.lexer.string_value += t.value
def t_doublequote_escape(self, t):
r'\\.'
t.lexer.string_value += t.value[1]
def t_doublequote_end(self, t):
r'"'
t.value = t.lexer.string_value
t.type = 'ID'
t.lexer.string_value = None
t.lexer.pop_state()
return t
def t_doublequote_error(self, t):
raise JsonPathLexerError('Error on line %s, col %s while lexing doublequoted field: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.lexer.latest_newline, t.value[0]))
# Back-quoted "magic" operators
t_backquote_ignore = ''
def t_backquote(self, t):
r'`'
t.lexer.string_start = t.lexer.lexpos
t.lexer.string_value = ''
t.lexer.push_state('backquote')
def t_backquote_escape(self, t):
r'\\.'
t.lexer.string_value += t.value[1]
def t_backquote_content(self, t):
r"[^`\\]+"
t.lexer.string_value += t.value
def t_backquote_end(self, t):
r'`'
t.value = t.lexer.string_value
t.type = 'NAMED_OPERATOR'
t.lexer.string_value = None
t.lexer.pop_state()
return t
def t_backquote_error(self, t):
raise JsonPathLexerError('Error on line %s, col %s while lexing backquoted operator: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.lexer.latest_newline, t.value[0]))
# Counting lines, handling errors
def t_newline(self, t):
r'\n'
t.lexer.lineno += 1
t.lexer.latest_newline = t.lexpos
def t_error(self, t):
raise JsonPathLexerError('Error on line %s, col %s: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.lexer.latest_newline, t.value[0]))
if __name__ == '__main__':
logging.basicConfig()
lexer = JsonPathLexer(debug=True)
for token in lexer.tokenize(sys.stdin.read()):
print('%-20s%s' % (token.value, token.type))

View File

@@ -0,0 +1,187 @@
from __future__ import print_function, absolute_import, division, generators, nested_scopes
import sys
import os.path
import logging
import ply.yacc
from jsonpath_rw.jsonpath import *
from jsonpath_rw.lexer import JsonPathLexer
logger = logging.getLogger(__name__)
def parse(string):
return JsonPathParser().parse(string)
class JsonPathParser(object):
'''
An LALR-parser for JsonPath
'''
tokens = JsonPathLexer.tokens
def __init__(self, debug=False, lexer_class=None):
if self.__doc__ == None:
raise Exception('Docstrings have been removed! By design of PLY, jsonpath-rw requires docstrings. You must not use PYTHONOPTIMIZE=2 or python -OO.')
self.debug = debug
self.lexer_class = lexer_class or JsonPathLexer # Crufty but works around statefulness in PLY
def parse(self, string, lexer = None):
lexer = lexer or self.lexer_class()
return self.parse_token_stream(lexer.tokenize(string))
def parse_token_stream(self, token_iterator, start_symbol='jsonpath'):
# Since PLY has some crufty aspects and dumps files, we try to keep them local
# However, we need to derive the name of the output Python file :-/
output_directory = os.path.dirname(__file__)
try:
module_name = os.path.splitext(os.path.split(__file__)[1])[0]
except:
module_name = __name__
parsing_table_module = '_'.join([module_name, start_symbol, 'parsetab'])
# And we regenerate the parse table every time; it doesn't actually take that long!
new_parser = ply.yacc.yacc(module=self,
debug=self.debug,
tabmodule = parsing_table_module,
outputdir = output_directory,
write_tables=0,
start = start_symbol,
errorlog = logger)
return new_parser.parse(lexer = IteratorToTokenStream(token_iterator))
# ===================== PLY Parser specification =====================
precedence = [
('left', ','),
('left', 'DOUBLEDOT'),
('left', '.'),
('left', '|'),
('left', '&'),
('left', 'WHERE'),
]
def p_error(self, t):
raise Exception('Parse error at %s:%s near token %s (%s)' % (t.lineno, t.col, t.value, t.type))
def p_jsonpath_binop(self, p):
"""jsonpath : jsonpath '.' jsonpath
| jsonpath DOUBLEDOT jsonpath
| jsonpath WHERE jsonpath
| jsonpath '|' jsonpath
| jsonpath '&' jsonpath"""
op = p[2]
if op == '.':
p[0] = Child(p[1], p[3])
elif op == '..':
p[0] = Descendants(p[1], p[3])
elif op == 'where':
p[0] = Where(p[1], p[3])
elif op == '|':
p[0] = Union(p[1], p[3])
elif op == '&':
p[0] = Intersect(p[1], p[3])
def p_jsonpath_fields(self, p):
"jsonpath : fields_or_any"
p[0] = Fields(*p[1])
def p_jsonpath_named_operator(self, p):
"jsonpath : NAMED_OPERATOR"
if p[1] == 'this':
p[0] = This()
elif p[1] == 'parent':
p[0] = Parent()
else:
raise Exception('Unknown named operator `%s` at %s:%s' % (p[1], p.lineno(1), p.lexpos(1)))
def p_jsonpath_root(self, p):
"jsonpath : '$'"
p[0] = Root()
def p_jsonpath_idx(self, p):
"jsonpath : '[' idx ']'"
p[0] = p[2]
def p_jsonpath_slice(self, p):
"jsonpath : '[' slice ']'"
p[0] = p[2]
def p_jsonpath_fieldbrackets(self, p):
"jsonpath : '[' fields ']'"
p[0] = Fields(*p[2])
def p_jsonpath_child_fieldbrackets(self, p):
"jsonpath : jsonpath '[' fields ']'"
p[0] = Child(p[1], Fields(*p[3]))
def p_jsonpath_child_idxbrackets(self, p):
"jsonpath : jsonpath '[' idx ']'"
p[0] = Child(p[1], p[3])
def p_jsonpath_child_slicebrackets(self, p):
"jsonpath : jsonpath '[' slice ']'"
p[0] = Child(p[1], p[3])
def p_jsonpath_parens(self, p):
"jsonpath : '(' jsonpath ')'"
p[0] = p[2]
# Because fields in brackets cannot be '*' - that is reserved for array indices
def p_fields_or_any(self, p):
"""fields_or_any : fields
| '*' """
if p[1] == '*':
p[0] = ['*']
else:
p[0] = p[1]
def p_fields_id(self, p):
"fields : ID"
p[0] = [p[1]]
def p_fields_comma(self, p):
"fields : fields ',' fields"
p[0] = p[1] + p[3]
def p_idx(self, p):
"idx : NUMBER"
p[0] = Index(p[1])
def p_slice_any(self, p):
"slice : '*'"
p[0] = Slice()
def p_slice(self, p): # Currently does not support `step`
"slice : maybe_int ':' maybe_int"
p[0] = Slice(start=p[1], end=p[3])
def p_maybe_int(self, p):
"""maybe_int : NUMBER
| empty"""
p[0] = p[1]
def p_empty(self, p):
'empty :'
p[0] = None
class IteratorToTokenStream(object):
def __init__(self, iterator):
self.iterator = iterator
def token(self):
try:
return next(self.iterator)
except StopIteration:
return None
if __name__ == '__main__':
logging.basicConfig()
parser = JsonPathParser(debug=True)
print(parser.parse(sys.stdin.read()))

View File

@@ -0,0 +1,4 @@
# PLY package
# Author: David Beazley (dave@dabeaz.com)
__all__ = ['lex','yacc']

898
bin/python/ply/cpp.py Normal file
View File

@@ -0,0 +1,898 @@
# -----------------------------------------------------------------------------
# cpp.py
#
# Author: David Beazley (http://www.dabeaz.com)
# Copyright (C) 2007
# All rights reserved
#
# This module implements an ANSI-C style lexical preprocessor for PLY.
# -----------------------------------------------------------------------------
from __future__ import generators
# -----------------------------------------------------------------------------
# Default preprocessor lexer definitions. These tokens are enough to get
# a basic preprocessor working. Other modules may import these if they want
# -----------------------------------------------------------------------------
tokens = (
'CPP_ID','CPP_INTEGER', 'CPP_FLOAT', 'CPP_STRING', 'CPP_CHAR', 'CPP_WS', 'CPP_COMMENT', 'CPP_POUND','CPP_DPOUND'
)
literals = "+-*/%|&~^<>=!?()[]{}.,;:\\\'\""
# Whitespace
def t_CPP_WS(t):
r'\s+'
t.lexer.lineno += t.value.count("\n")
return t
t_CPP_POUND = r'\#'
t_CPP_DPOUND = r'\#\#'
# Identifier
t_CPP_ID = r'[A-Za-z_][\w_]*'
# Integer literal
def CPP_INTEGER(t):
r'(((((0x)|(0X))[0-9a-fA-F]+)|(\d+))([uU]|[lL]|[uU][lL]|[lL][uU])?)'
return t
t_CPP_INTEGER = CPP_INTEGER
# Floating literal
t_CPP_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?'
# String literal
def t_CPP_STRING(t):
r'\"([^\\\n]|(\\(.|\n)))*?\"'
t.lexer.lineno += t.value.count("\n")
return t
# Character constant 'c' or L'c'
def t_CPP_CHAR(t):
r'(L)?\'([^\\\n]|(\\(.|\n)))*?\''
t.lexer.lineno += t.value.count("\n")
return t
# Comment
def t_CPP_COMMENT(t):
r'(/\*(.|\n)*?\*/)|(//.*?\n)'
t.lexer.lineno += t.value.count("\n")
return t
def t_error(t):
t.type = t.value[0]
t.value = t.value[0]
t.lexer.skip(1)
return t
import re
import copy
import time
import os.path
# -----------------------------------------------------------------------------
# trigraph()
#
# Given an input string, this function replaces all trigraph sequences.
# The following mapping is used:
#
# ??= #
# ??/ \
# ??' ^
# ??( [
# ??) ]
# ??! |
# ??< {
# ??> }
# ??- ~
# -----------------------------------------------------------------------------
_trigraph_pat = re.compile(r'''\?\?[=/\'\(\)\!<>\-]''')
_trigraph_rep = {
'=':'#',
'/':'\\',
"'":'^',
'(':'[',
')':']',
'!':'|',
'<':'{',
'>':'}',
'-':'~'
}
def trigraph(input):
return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input)
# ------------------------------------------------------------------
# Macro object
#
# This object holds information about preprocessor macros
#
# .name - Macro name (string)
# .value - Macro value (a list of tokens)
# .arglist - List of argument names
# .variadic - Boolean indicating whether or not variadic macro
# .vararg - Name of the variadic parameter
#
# When a macro is created, the macro replacement token sequence is
# pre-scanned and used to create patch lists that are later used
# during macro expansion
# ------------------------------------------------------------------
class Macro(object):
def __init__(self,name,value,arglist=None,variadic=False):
self.name = name
self.value = value
self.arglist = arglist
self.variadic = variadic
if variadic:
self.vararg = arglist[-1]
self.source = None
# ------------------------------------------------------------------
# Preprocessor object
#
# Object representing a preprocessor. Contains macro definitions,
# include directories, and other information
# ------------------------------------------------------------------
class Preprocessor(object):
def __init__(self,lexer=None):
if lexer is None:
lexer = lex.lexer
self.lexer = lexer
self.macros = { }
self.path = []
self.temp_path = []
# Probe the lexer for selected tokens
self.lexprobe()
tm = time.localtime()
self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm))
self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm))
self.parser = None
# -----------------------------------------------------------------------------
# tokenize()
#
# Utility function. Given a string of text, tokenize into a list of tokens
# -----------------------------------------------------------------------------
def tokenize(self,text):
tokens = []
self.lexer.input(text)
while True:
tok = self.lexer.token()
if not tok: break
tokens.append(tok)
return tokens
# ---------------------------------------------------------------------
# error()
#
# Report a preprocessor error/warning of some kind
# ----------------------------------------------------------------------
def error(self,file,line,msg):
print("%s:%d %s" % (file,line,msg))
# ----------------------------------------------------------------------
# lexprobe()
#
# This method probes the preprocessor lexer object to discover
# the token types of symbols that are important to the preprocessor.
# If this works right, the preprocessor will simply "work"
# with any suitable lexer regardless of how tokens have been named.
# ----------------------------------------------------------------------
def lexprobe(self):
# Determine the token type for identifiers
self.lexer.input("identifier")
tok = self.lexer.token()
if not tok or tok.value != "identifier":
print("Couldn't determine identifier type")
else:
self.t_ID = tok.type
# Determine the token type for integers
self.lexer.input("12345")
tok = self.lexer.token()
if not tok or int(tok.value) != 12345:
print("Couldn't determine integer type")
else:
self.t_INTEGER = tok.type
self.t_INTEGER_TYPE = type(tok.value)
# Determine the token type for strings enclosed in double quotes
self.lexer.input("\"filename\"")
tok = self.lexer.token()
if not tok or tok.value != "\"filename\"":
print("Couldn't determine string type")
else:
self.t_STRING = tok.type
# Determine the token type for whitespace--if any
self.lexer.input(" ")
tok = self.lexer.token()
if not tok or tok.value != " ":
self.t_SPACE = None
else:
self.t_SPACE = tok.type
# Determine the token type for newlines
self.lexer.input("\n")
tok = self.lexer.token()
if not tok or tok.value != "\n":
self.t_NEWLINE = None
print("Couldn't determine token for newlines")
else:
self.t_NEWLINE = tok.type
self.t_WS = (self.t_SPACE, self.t_NEWLINE)
# Check for other characters used by the preprocessor
chars = [ '<','>','#','##','\\','(',')',',','.']
for c in chars:
self.lexer.input(c)
tok = self.lexer.token()
if not tok or tok.value != c:
print("Unable to lex '%s' required for preprocessor" % c)
# ----------------------------------------------------------------------
# add_path()
#
# Adds a search path to the preprocessor.
# ----------------------------------------------------------------------
def add_path(self,path):
self.path.append(path)
# ----------------------------------------------------------------------
# group_lines()
#
# Given an input string, this function splits it into lines. Trailing whitespace
# is removed. Any line ending with \ is grouped with the next line. This
# function forms the lowest level of the preprocessor---grouping into text into
# a line-by-line format.
# ----------------------------------------------------------------------
def group_lines(self,input):
lex = self.lexer.clone()
lines = [x.rstrip() for x in input.splitlines()]
for i in xrange(len(lines)):
j = i+1
while lines[i].endswith('\\') and (j < len(lines)):
lines[i] = lines[i][:-1]+lines[j]
lines[j] = ""
j += 1
input = "\n".join(lines)
lex.input(input)
lex.lineno = 1
current_line = []
while True:
tok = lex.token()
if not tok:
break
current_line.append(tok)
if tok.type in self.t_WS and '\n' in tok.value:
yield current_line
current_line = []
if current_line:
yield current_line
# ----------------------------------------------------------------------
# tokenstrip()
#
# Remove leading/trailing whitespace tokens from a token list
# ----------------------------------------------------------------------
def tokenstrip(self,tokens):
i = 0
while i < len(tokens) and tokens[i].type in self.t_WS:
i += 1
del tokens[:i]
i = len(tokens)-1
while i >= 0 and tokens[i].type in self.t_WS:
i -= 1
del tokens[i+1:]
return tokens
# ----------------------------------------------------------------------
# collect_args()
#
# Collects comma separated arguments from a list of tokens. The arguments
# must be enclosed in parenthesis. Returns a tuple (tokencount,args,positions)
# where tokencount is the number of tokens consumed, args is a list of arguments,
# and positions is a list of integers containing the starting index of each
# argument. Each argument is represented by a list of tokens.
#
# When collecting arguments, leading and trailing whitespace is removed
# from each argument.
#
# This function properly handles nested parenthesis and commas---these do not
# define new arguments.
# ----------------------------------------------------------------------
def collect_args(self,tokenlist):
args = []
positions = []
current_arg = []
nesting = 1
tokenlen = len(tokenlist)
# Search for the opening '('.
i = 0
while (i < tokenlen) and (tokenlist[i].type in self.t_WS):
i += 1
if (i < tokenlen) and (tokenlist[i].value == '('):
positions.append(i+1)
else:
self.error(self.source,tokenlist[0].lineno,"Missing '(' in macro arguments")
return 0, [], []
i += 1
while i < tokenlen:
t = tokenlist[i]
if t.value == '(':
current_arg.append(t)
nesting += 1
elif t.value == ')':
nesting -= 1
if nesting == 0:
if current_arg:
args.append(self.tokenstrip(current_arg))
positions.append(i)
return i+1,args,positions
current_arg.append(t)
elif t.value == ',' and nesting == 1:
args.append(self.tokenstrip(current_arg))
positions.append(i+1)
current_arg = []
else:
current_arg.append(t)
i += 1
# Missing end argument
self.error(self.source,tokenlist[-1].lineno,"Missing ')' in macro arguments")
return 0, [],[]
# ----------------------------------------------------------------------
# macro_prescan()
#
# Examine the macro value (token sequence) and identify patch points
# This is used to speed up macro expansion later on---we'll know
# right away where to apply patches to the value to form the expansion
# ----------------------------------------------------------------------
def macro_prescan(self,macro):
macro.patch = [] # Standard macro arguments
macro.str_patch = [] # String conversion expansion
macro.var_comma_patch = [] # Variadic macro comma patch
i = 0
while i < len(macro.value):
if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist:
argnum = macro.arglist.index(macro.value[i].value)
# Conversion of argument to a string
if i > 0 and macro.value[i-1].value == '#':
macro.value[i] = copy.copy(macro.value[i])
macro.value[i].type = self.t_STRING
del macro.value[i-1]
macro.str_patch.append((argnum,i-1))
continue
# Concatenation
elif (i > 0 and macro.value[i-1].value == '##'):
macro.patch.append(('c',argnum,i-1))
del macro.value[i-1]
continue
elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'):
macro.patch.append(('c',argnum,i))
i += 1
continue
# Standard expansion
else:
macro.patch.append(('e',argnum,i))
elif macro.value[i].value == '##':
if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \
((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \
(macro.value[i+1].value == macro.vararg):
macro.var_comma_patch.append(i-1)
i += 1
macro.patch.sort(key=lambda x: x[2],reverse=True)
# ----------------------------------------------------------------------
# macro_expand_args()
#
# Given a Macro and list of arguments (each a token list), this method
# returns an expanded version of a macro. The return value is a token sequence
# representing the replacement macro tokens
# ----------------------------------------------------------------------
def macro_expand_args(self,macro,args):
# Make a copy of the macro token sequence
rep = [copy.copy(_x) for _x in macro.value]
# Make string expansion patches. These do not alter the length of the replacement sequence
str_expansion = {}
for argnum, i in macro.str_patch:
if argnum not in str_expansion:
str_expansion[argnum] = ('"%s"' % "".join([x.value for x in args[argnum]])).replace("\\","\\\\")
rep[i] = copy.copy(rep[i])
rep[i].value = str_expansion[argnum]
# Make the variadic macro comma patch. If the variadic macro argument is empty, we get rid
comma_patch = False
if macro.variadic and not args[-1]:
for i in macro.var_comma_patch:
rep[i] = None
comma_patch = True
# Make all other patches. The order of these matters. It is assumed that the patch list
# has been sorted in reverse order of patch location since replacements will cause the
# size of the replacement sequence to expand from the patch point.
expanded = { }
for ptype, argnum, i in macro.patch:
# Concatenation. Argument is left unexpanded
if ptype == 'c':
rep[i:i+1] = args[argnum]
# Normal expansion. Argument is macro expanded first
elif ptype == 'e':
if argnum not in expanded:
expanded[argnum] = self.expand_macros(args[argnum])
rep[i:i+1] = expanded[argnum]
# Get rid of removed comma if necessary
if comma_patch:
rep = [_i for _i in rep if _i]
return rep
# ----------------------------------------------------------------------
# expand_macros()
#
# Given a list of tokens, this function performs macro expansion.
# The expanded argument is a dictionary that contains macros already
# expanded. This is used to prevent infinite recursion.
# ----------------------------------------------------------------------
def expand_macros(self,tokens,expanded=None):
if expanded is None:
expanded = {}
i = 0
while i < len(tokens):
t = tokens[i]
if t.type == self.t_ID:
if t.value in self.macros and t.value not in expanded:
# Yes, we found a macro match
expanded[t.value] = True
m = self.macros[t.value]
if not m.arglist:
# A simple macro
ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded)
for e in ex:
e.lineno = t.lineno
tokens[i:i+1] = ex
i += len(ex)
else:
# A macro with arguments
j = i + 1
while j < len(tokens) and tokens[j].type in self.t_WS:
j += 1
if tokens[j].value == '(':
tokcount,args,positions = self.collect_args(tokens[j:])
if not m.variadic and len(args) != len(m.arglist):
self.error(self.source,t.lineno,"Macro %s requires %d arguments" % (t.value,len(m.arglist)))
i = j + tokcount
elif m.variadic and len(args) < len(m.arglist)-1:
if len(m.arglist) > 2:
self.error(self.source,t.lineno,"Macro %s must have at least %d arguments" % (t.value, len(m.arglist)-1))
else:
self.error(self.source,t.lineno,"Macro %s must have at least %d argument" % (t.value, len(m.arglist)-1))
i = j + tokcount
else:
if m.variadic:
if len(args) == len(m.arglist)-1:
args.append([])
else:
args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1]
del args[len(m.arglist):]
# Get macro replacement text
rep = self.macro_expand_args(m,args)
rep = self.expand_macros(rep,expanded)
for r in rep:
r.lineno = t.lineno
tokens[i:j+tokcount] = rep
i += len(rep)
del expanded[t.value]
continue
elif t.value == '__LINE__':
t.type = self.t_INTEGER
t.value = self.t_INTEGER_TYPE(t.lineno)
i += 1
return tokens
# ----------------------------------------------------------------------
# evalexpr()
#
# Evaluate an expression token sequence for the purposes of evaluating
# integral expressions.
# ----------------------------------------------------------------------
def evalexpr(self,tokens):
# tokens = tokenize(line)
# Search for defined macros
i = 0
while i < len(tokens):
if tokens[i].type == self.t_ID and tokens[i].value == 'defined':
j = i + 1
needparen = False
result = "0L"
while j < len(tokens):
if tokens[j].type in self.t_WS:
j += 1
continue
elif tokens[j].type == self.t_ID:
if tokens[j].value in self.macros:
result = "1L"
else:
result = "0L"
if not needparen: break
elif tokens[j].value == '(':
needparen = True
elif tokens[j].value == ')':
break
else:
self.error(self.source,tokens[i].lineno,"Malformed defined()")
j += 1
tokens[i].type = self.t_INTEGER
tokens[i].value = self.t_INTEGER_TYPE(result)
del tokens[i+1:j+1]
i += 1
tokens = self.expand_macros(tokens)
for i,t in enumerate(tokens):
if t.type == self.t_ID:
tokens[i] = copy.copy(t)
tokens[i].type = self.t_INTEGER
tokens[i].value = self.t_INTEGER_TYPE("0L")
elif t.type == self.t_INTEGER:
tokens[i] = copy.copy(t)
# Strip off any trailing suffixes
tokens[i].value = str(tokens[i].value)
while tokens[i].value[-1] not in "0123456789abcdefABCDEF":
tokens[i].value = tokens[i].value[:-1]
expr = "".join([str(x.value) for x in tokens])
expr = expr.replace("&&"," and ")
expr = expr.replace("||"," or ")
expr = expr.replace("!"," not ")
try:
result = eval(expr)
except StandardError:
self.error(self.source,tokens[0].lineno,"Couldn't evaluate expression")
result = 0
return result
# ----------------------------------------------------------------------
# parsegen()
#
# Parse an input string/
# ----------------------------------------------------------------------
def parsegen(self,input,source=None):
# Replace trigraph sequences
t = trigraph(input)
lines = self.group_lines(t)
if not source:
source = ""
self.define("__FILE__ \"%s\"" % source)
self.source = source
chunk = []
enable = True
iftrigger = False
ifstack = []
for x in lines:
for i,tok in enumerate(x):
if tok.type not in self.t_WS: break
if tok.value == '#':
# Preprocessor directive
for tok in x:
if tok in self.t_WS and '\n' in tok.value:
chunk.append(tok)
dirtokens = self.tokenstrip(x[i+1:])
if dirtokens:
name = dirtokens[0].value
args = self.tokenstrip(dirtokens[1:])
else:
name = ""
args = []
if name == 'define':
if enable:
for tok in self.expand_macros(chunk):
yield tok
chunk = []
self.define(args)
elif name == 'include':
if enable:
for tok in self.expand_macros(chunk):
yield tok
chunk = []
oldfile = self.macros['__FILE__']
for tok in self.include(args):
yield tok
self.macros['__FILE__'] = oldfile
self.source = source
elif name == 'undef':
if enable:
for tok in self.expand_macros(chunk):
yield tok
chunk = []
self.undef(args)
elif name == 'ifdef':
ifstack.append((enable,iftrigger))
if enable:
if not args[0].value in self.macros:
enable = False
iftrigger = False
else:
iftrigger = True
elif name == 'ifndef':
ifstack.append((enable,iftrigger))
if enable:
if args[0].value in self.macros:
enable = False
iftrigger = False
else:
iftrigger = True
elif name == 'if':
ifstack.append((enable,iftrigger))
if enable:
result = self.evalexpr(args)
if not result:
enable = False
iftrigger = False
else:
iftrigger = True
elif name == 'elif':
if ifstack:
if ifstack[-1][0]: # We only pay attention if outer "if" allows this
if enable: # If already true, we flip enable False
enable = False
elif not iftrigger: # If False, but not triggered yet, we'll check expression
result = self.evalexpr(args)
if result:
enable = True
iftrigger = True
else:
self.error(self.source,dirtokens[0].lineno,"Misplaced #elif")
elif name == 'else':
if ifstack:
if ifstack[-1][0]:
if enable:
enable = False
elif not iftrigger:
enable = True
iftrigger = True
else:
self.error(self.source,dirtokens[0].lineno,"Misplaced #else")
elif name == 'endif':
if ifstack:
enable,iftrigger = ifstack.pop()
else:
self.error(self.source,dirtokens[0].lineno,"Misplaced #endif")
else:
# Unknown preprocessor directive
pass
else:
# Normal text
if enable:
chunk.extend(x)
for tok in self.expand_macros(chunk):
yield tok
chunk = []
# ----------------------------------------------------------------------
# include()
#
# Implementation of file-inclusion
# ----------------------------------------------------------------------
def include(self,tokens):
# Try to extract the filename and then process an include file
if not tokens:
return
if tokens:
if tokens[0].value != '<' and tokens[0].type != self.t_STRING:
tokens = self.expand_macros(tokens)
if tokens[0].value == '<':
# Include <...>
i = 1
while i < len(tokens):
if tokens[i].value == '>':
break
i += 1
else:
print("Malformed #include <...>")
return
filename = "".join([x.value for x in tokens[1:i]])
path = self.path + [""] + self.temp_path
elif tokens[0].type == self.t_STRING:
filename = tokens[0].value[1:-1]
path = self.temp_path + [""] + self.path
else:
print("Malformed #include statement")
return
for p in path:
iname = os.path.join(p,filename)
try:
data = open(iname,"r").read()
dname = os.path.dirname(iname)
if dname:
self.temp_path.insert(0,dname)
for tok in self.parsegen(data,filename):
yield tok
if dname:
del self.temp_path[0]
break
except IOError:
pass
else:
print("Couldn't find '%s'" % filename)
# ----------------------------------------------------------------------
# define()
#
# Define a new macro
# ----------------------------------------------------------------------
def define(self,tokens):
if isinstance(tokens,(str,unicode)):
tokens = self.tokenize(tokens)
linetok = tokens
try:
name = linetok[0]
if len(linetok) > 1:
mtype = linetok[1]
else:
mtype = None
if not mtype:
m = Macro(name.value,[])
self.macros[name.value] = m
elif mtype.type in self.t_WS:
# A normal macro
m = Macro(name.value,self.tokenstrip(linetok[2:]))
self.macros[name.value] = m
elif mtype.value == '(':
# A macro with arguments
tokcount, args, positions = self.collect_args(linetok[1:])
variadic = False
for a in args:
if variadic:
print("No more arguments may follow a variadic argument")
break
astr = "".join([str(_i.value) for _i in a])
if astr == "...":
variadic = True
a[0].type = self.t_ID
a[0].value = '__VA_ARGS__'
variadic = True
del a[1:]
continue
elif astr[-3:] == "..." and a[0].type == self.t_ID:
variadic = True
del a[1:]
# If, for some reason, "." is part of the identifier, strip off the name for the purposes
# of macro expansion
if a[0].value[-3:] == '...':
a[0].value = a[0].value[:-3]
continue
if len(a) > 1 or a[0].type != self.t_ID:
print("Invalid macro argument")
break
else:
mvalue = self.tokenstrip(linetok[1+tokcount:])
i = 0
while i < len(mvalue):
if i+1 < len(mvalue):
if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##':
del mvalue[i]
continue
elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS:
del mvalue[i+1]
i += 1
m = Macro(name.value,mvalue,[x[0].value for x in args],variadic)
self.macro_prescan(m)
self.macros[name.value] = m
else:
print("Bad macro definition")
except LookupError:
print("Bad macro definition")
# ----------------------------------------------------------------------
# undef()
#
# Undefine a macro
# ----------------------------------------------------------------------
def undef(self,tokens):
id = tokens[0].value
try:
del self.macros[id]
except LookupError:
pass
# ----------------------------------------------------------------------
# parse()
#
# Parse input text.
# ----------------------------------------------------------------------
def parse(self,input,source=None,ignore={}):
self.ignore = ignore
self.parser = self.parsegen(input,source)
# ----------------------------------------------------------------------
# token()
#
# Method to return individual tokens
# ----------------------------------------------------------------------
def token(self):
try:
while True:
tok = next(self.parser)
if tok.type not in self.ignore: return tok
except StopIteration:
self.parser = None
return None
if __name__ == '__main__':
import ply.lex as lex
lexer = lex.lex()
# Run a preprocessor
import sys
f = open(sys.argv[1])
input = f.read()
p = Preprocessor(lexer)
p.parse(input,sys.argv[1])
while True:
tok = p.token()
if not tok: break
print(p.source, tok)

133
bin/python/ply/ctokens.py Normal file
View File

@@ -0,0 +1,133 @@
# ----------------------------------------------------------------------
# ctokens.py
#
# Token specifications for symbols in ANSI C and C++. This file is
# meant to be used as a library in other tokenizers.
# ----------------------------------------------------------------------
# Reserved words
tokens = [
# Literals (identifier, integer constant, float constant, string constant, char const)
'ID', 'TYPEID', 'ICONST', 'FCONST', 'SCONST', 'CCONST',
# Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=)
'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD',
'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT',
'LOR', 'LAND', 'LNOT',
'LT', 'LE', 'GT', 'GE', 'EQ', 'NE',
# Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=)
'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL',
'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL',
# Increment/decrement (++,--)
'PLUSPLUS', 'MINUSMINUS',
# Structure dereference (->)
'ARROW',
# Ternary operator (?)
'TERNARY',
# Delimeters ( ) [ ] { } , . ; :
'LPAREN', 'RPAREN',
'LBRACKET', 'RBRACKET',
'LBRACE', 'RBRACE',
'COMMA', 'PERIOD', 'SEMI', 'COLON',
# Ellipsis (...)
'ELLIPSIS',
]
# Operators
t_PLUS = r'\+'
t_MINUS = r'-'
t_TIMES = r'\*'
t_DIVIDE = r'/'
t_MODULO = r'%'
t_OR = r'\|'
t_AND = r'&'
t_NOT = r'~'
t_XOR = r'\^'
t_LSHIFT = r'<<'
t_RSHIFT = r'>>'
t_LOR = r'\|\|'
t_LAND = r'&&'
t_LNOT = r'!'
t_LT = r'<'
t_GT = r'>'
t_LE = r'<='
t_GE = r'>='
t_EQ = r'=='
t_NE = r'!='
# Assignment operators
t_EQUALS = r'='
t_TIMESEQUAL = r'\*='
t_DIVEQUAL = r'/='
t_MODEQUAL = r'%='
t_PLUSEQUAL = r'\+='
t_MINUSEQUAL = r'-='
t_LSHIFTEQUAL = r'<<='
t_RSHIFTEQUAL = r'>>='
t_ANDEQUAL = r'&='
t_OREQUAL = r'\|='
t_XOREQUAL = r'^='
# Increment/decrement
t_INCREMENT = r'\+\+'
t_DECREMENT = r'--'
# ->
t_ARROW = r'->'
# ?
t_TERNARY = r'\?'
# Delimeters
t_LPAREN = r'\('
t_RPAREN = r'\)'
t_LBRACKET = r'\['
t_RBRACKET = r'\]'
t_LBRACE = r'\{'
t_RBRACE = r'\}'
t_COMMA = r','
t_PERIOD = r'\.'
t_SEMI = r';'
t_COLON = r':'
t_ELLIPSIS = r'\.\.\.'
# Identifiers
t_ID = r'[A-Za-z_][A-Za-z0-9_]*'
# Integer literal
t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?'
# Floating literal
t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?'
# String literal
t_STRING = r'\"([^\\\n]|(\\.))*?\"'
# Character constant 'c' or L'c'
t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\''
# Comment (C-Style)
def t_COMMENT(t):
r'/\*(.|\n)*?\*/'
t.lexer.lineno += t.value.count('\n')
return t
# Comment (C++-Style)
def t_CPPCOMMENT(t):
r'//.*\n'
t.lexer.lineno += 1
return t

1058
bin/python/ply/lex.py Normal file

File diff suppressed because it is too large Load Diff

3276
bin/python/ply/yacc.py Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,187 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import importlib
import os
from ripple.ledger import LedgerNumber
from ripple.util import File
from ripple.util import Log
from ripple.util import PrettyPrint
from ripple.util import Range
from ripple.util.Function import Function
NAME = 'LedgerTool'
VERSION = '0.1'
NONE = '(none)'
_parser = argparse.ArgumentParser(
prog=NAME,
description='Retrieve and process Ripple ledgers.',
epilog=LedgerNumber.HELP,
)
# Positional arguments.
_parser.add_argument(
'command',
nargs='*',
help='Command to execute.'
)
# Flag arguments.
_parser.add_argument(
'--binary',
action='store_true',
help='If true, searches are binary - by default linear search is used.',
)
_parser.add_argument(
'--cache',
default='~/.local/share/ripple/ledger',
help='The cache directory.',
)
_parser.add_argument(
'--complete',
action='store_true',
help='If set, only match complete ledgers.',
)
_parser.add_argument(
'--condition', '-c',
help='The name of a condition function used to match ledgers.',
)
_parser.add_argument(
'--config',
help='The rippled configuration file name.',
)
_parser.add_argument(
'--database', '-d',
nargs='*',
default=NONE,
help='Specify a database.',
)
_parser.add_argument(
'--display',
help='Specify a function to display ledgers.',
)
_parser.add_argument(
'--full', '-f',
action='store_true',
help='If true, request full ledgers.',
)
_parser.add_argument(
'--indent', '-i',
type=int,
default=2,
help='How many spaces to indent when display in JSON.',
)
_parser.add_argument(
'--offline', '-o',
action='store_true',
help='If true, work entirely from cache, do not try to contact the server.',
)
_parser.add_argument(
'--position', '-p',
choices=['all', 'first', 'last'],
default='last',
help='Select which ledgers to display.',
)
_parser.add_argument(
'--rippled', '-r',
help='The filename of a rippled binary for retrieving ledgers.',
)
_parser.add_argument(
'--server', '-s',
help='IP address of a rippled JSON server.',
)
_parser.add_argument(
'--utc', '-u',
action='store_true',
help='If true, display times in UTC rather than local time.',
)
_parser.add_argument(
'--validations',
default=3,
help='The number of validations needed before considering a ledger valid.',
)
_parser.add_argument(
'--version',
action='version',
version='%(prog)s ' + VERSION,
help='Print the current version of %(prog)s',
)
_parser.add_argument(
'--verbose', '-v',
action='store_true',
help='If true, give status messages on stderr.',
)
_parser.add_argument(
'--window', '-w',
type=int,
default=0,
help='How many ledgers to display around the matching ledger.',
)
_parser.add_argument(
'--yes', '-y',
action='store_true',
help='If true, don\'t ask for confirmation on large commands.',
)
# Read the arguments from the command line.
ARGS = _parser.parse_args()
ARGS.NONE = NONE
Log.VERBOSE = ARGS.verbose
# Now remove any items that look like ledger numbers from the command line.
_command = ARGS.command
_parts = (ARGS.command, ARGS.ledgers) = ([], [])
for c in _command:
_parts[Range.is_range(c, *LedgerNumber.LEDGERS)].append(c)
ARGS.command = ARGS.command or ['print' if ARGS.ledgers else 'info']
ARGS.cache = File.normalize(ARGS.cache)
if not ARGS.ledgers:
if ARGS.condition:
Log.warn('--condition needs a range of ledgers')
if ARGS.display:
Log.warn('--display needs a range of ledgers')
ARGS.condition = Function(
ARGS.condition or 'all_ledgers', 'ripple.ledger.conditions')
ARGS.display = Function(
ARGS.display or 'ledger_number', 'ripple.ledger.displays')
if ARGS.window < 0:
raise ValueError('Window cannot be negative: --window=%d' %
ARGS.window)
PrettyPrint.INDENT = (ARGS.indent * ' ')
_loaders = (ARGS.database != NONE) + bool(ARGS.rippled) + bool(ARGS.server)
if not _loaders:
ARGS.rippled = 'rippled'
elif _loaders > 1:
raise ValueError('At most one of --database, --rippled and --server '
'may be specified')

View File

@@ -0,0 +1,78 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import os
import subprocess
from ripple.ledger.Args import ARGS
from ripple.util import ConfigFile
from ripple.util import Database
from ripple.util import File
from ripple.util import Log
from ripple.util import Range
LEDGER_QUERY = """
SELECT
L.*, count(1) validations
FROM
(select LedgerHash, LedgerSeq from Ledgers ORDER BY LedgerSeq DESC) L
JOIN Validations V
ON (V.LedgerHash = L.LedgerHash)
GROUP BY L.LedgerHash
HAVING validations >= {validation_quorum}
ORDER BY 2;
"""
COMPLETE_QUERY = """
SELECT
L.LedgerSeq, count(*) validations
FROM
(select LedgerHash, LedgerSeq from Ledgers ORDER BY LedgerSeq) L
JOIN Validations V
ON (V.LedgerHash = L.LedgerHash)
GROUP BY L.LedgerHash
HAVING validations >= :validation_quorum
ORDER BY 2;
"""
_DATABASE_NAME = 'ledger.db'
USE_PLACEHOLDERS = False
class DatabaseReader(object):
def __init__(self, config):
assert ARGS.database != ARGS.NONE
database = ARGS.database or config['database_path']
if not database.endswith(_DATABASE_NAME):
database = os.path.join(database, _DATABASE_NAME)
if USE_PLACEHOLDERS:
cursor = Database.fetchall(
database, COMPLETE_QUERY, config)
else:
cursor = Database.fetchall(
database, LEDGER_QUERY.format(**config), {})
self.complete = [c[1] for c in cursor]
def name_to_ledger_index(self, ledger_name, is_full=False):
if not self.complete:
return None
if ledger_name == 'closed':
return self.complete[-1]
if ledger_name == 'current':
return None
if ledger_name == 'validated':
return self.complete[-1]
def get_ledger(self, name, is_full=False):
cmd = ['ledger', str(name)]
if is_full:
cmd.append('full')
response = self._command(*cmd)
result = response.get('ledger')
if result:
return result
error = response['error']
etext = _ERROR_TEXT.get(error)
if etext:
error = '%s (%s)' % (etext, error)
Log.fatal(_ERROR_TEXT.get(error, error))

View File

@@ -0,0 +1,18 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from ripple.util import Range
FIRST_EVER = 32570
LEDGERS = {
'closed': 'the most recently closed ledger',
'current': 'the current ledger',
'first': 'the first complete ledger on this server',
'last': 'the last complete ledger on this server',
'validated': 'the most recently validated ledger',
}
HELP = """
Ledgers are either represented by a number, or one of the special ledgers;
""" + ',\n'.join('%s, %s' % (k, v) for k, v in sorted(LEDGERS.items())
)

View File

@@ -0,0 +1,68 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import os
import subprocess
from ripple.ledger.Args import ARGS
from ripple.util import File
from ripple.util import Log
from ripple.util import Range
_ERROR_CODE_REASON = {
62: 'No rippled server is running.',
}
_ERROR_TEXT = {
'lgrNotFound': 'The ledger you requested was not found.',
'noCurrent': 'The server has no current ledger.',
'noNetwork': 'The server did not respond to your request.',
}
_DEFAULT_ERROR_ = "Couldn't connect to server."
class RippledReader(object):
def __init__(self, config):
fname = File.normalize(ARGS.rippled)
if not os.path.exists(fname):
raise Exception('No rippled found at %s.' % fname)
self.cmd = [fname]
if ARGS.config:
self.cmd.extend(['--conf', File.normalize(ARGS.config)])
self.info = self._command('server_info')['info']
c = self.info.get('complete_ledgers')
if c == 'empty':
self.complete = []
else:
self.complete = sorted(Range.from_string(c))
def name_to_ledger_index(self, ledger_name, is_full=False):
return self.get_ledger(ledger_name, is_full)['ledger_index']
def get_ledger(self, name, is_full=False):
cmd = ['ledger', str(name)]
if is_full:
cmd.append('full')
response = self._command(*cmd)
result = response.get('ledger')
if result:
return result
error = response['error']
etext = _ERROR_TEXT.get(error)
if etext:
error = '%s (%s)' % (etext, error)
Log.fatal(_ERROR_TEXT.get(error, error))
def _command(self, *cmds):
cmd = self.cmd + list(cmds)
try:
data = subprocess.check_output(cmd, stderr=subprocess.PIPE)
except subprocess.CalledProcessError as e:
raise Exception(_ERROR_CODE_REASON.get(
e.returncode, _DEFAULT_ERROR_))
part = json.loads(data)
try:
return part['result']
except:
raise ValueError(part.get('error', 'unknown error'))

View File

@@ -0,0 +1,52 @@
# Constants from ripple/protocol/SField.h
# special types
STI_UNKNOWN = -2
STI_DONE = -1
STI_NOTPRESENT = 0
# # types (common)
STI_UINT16 = 1
STI_UINT32 = 2
STI_UINT64 = 3
STI_HASH128 = 4
STI_HASH256 = 5
STI_AMOUNT = 6
STI_VL = 7
STI_ACCOUNT = 8
# 9-13 are reserved
STI_OBJECT = 14
STI_ARRAY = 15
# types (uncommon)
STI_UINT8 = 16
STI_HASH160 = 17
STI_PATHSET = 18
STI_VECTOR256 = 19
# high level types
# cannot be serialized inside other types
STI_TRANSACTION = 10001
STI_LEDGERENTRY = 10002
STI_VALIDATION = 10003
STI_METADATA = 10004
def field_code(sti, name):
if sti < 16:
if name < 16:
bytes = [(sti << 4) + name]
else:
bytes = [sti << 4, name]
elif name < 16:
bytes = [name, sti]
else:
bytes = [0, sti, name]
return ''.join(chr(i) for i in bytes)
# Selected constants from SField.cpp
sfSequence = field_code(STI_UINT32, 4)
sfPublicKey = field_code(STI_VL, 1)
sfSigningPubKey = field_code(STI_VL, 3)
sfSignature = field_code(STI_VL, 6)
sfMasterSignature = field_code(STI_VL, 18)

View File

@@ -0,0 +1,24 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from ripple.ledger.Args import ARGS
from ripple.util import Log
from ripple.util import Range
from ripple.util import Search
def search(server):
"""Yields a stream of ledger numbers that match the given condition."""
condition = lambda number: ARGS.condition(server, number)
ledgers = server.ledgers
if ARGS.binary:
try:
position = Search.FIRST if ARGS.position == 'first' else Search.LAST
yield Search.binary_search(
ledgers[0], ledgers[-1], condition, position)
except:
Log.fatal('No ledgers matching condition "%s".' % condition,
file=sys.stderr)
else:
for x in Search.linear_search(ledgers, condition):
yield x

View File

@@ -0,0 +1,55 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import os
from ripple.ledger import DatabaseReader, RippledReader
from ripple.ledger.Args import ARGS
from ripple.util.FileCache import FileCache
from ripple.util import ConfigFile
from ripple.util import File
from ripple.util import Range
class Server(object):
def __init__(self):
cfg_file = File.normalize(ARGS.config or 'rippled.cfg')
self.config = ConfigFile.read(open(cfg_file))
if ARGS.database != ARGS.NONE:
reader = DatabaseReader.DatabaseReader(self.config)
else:
reader = RippledReader.RippledReader(self.config)
self.reader = reader
self.complete = reader.complete
names = {
'closed': reader.name_to_ledger_index('closed'),
'current': reader.name_to_ledger_index('current'),
'validated': reader.name_to_ledger_index('validated'),
'first': self.complete[0] if self.complete else None,
'last': self.complete[-1] if self.complete else None,
}
self.__dict__.update(names)
self.ledgers = sorted(Range.join_ranges(*ARGS.ledgers, **names))
def make_cache(is_full):
name = 'full' if is_full else 'summary'
filepath = os.path.join(ARGS.cache, name)
creator = lambda n: reader.get_ledger(n, is_full)
return FileCache(filepath, creator)
self._caches = [make_cache(False), make_cache(True)]
def info(self):
return self.reader.info
def cache(self, is_full):
return self._caches[is_full]
def get_ledger(self, number, is_full=False):
num = int(number)
save_in_cache = num in self.complete
can_create = (not ARGS.offline and
self.complete and
self.complete[0] <= num - 1)
cache = self.cache(is_full)
return cache.get_data(number, save_in_cache, can_create)

View File

@@ -0,0 +1,5 @@
from __future__ import absolute_import, division, print_function, unicode_literals
class ServerReader(object):
def __init__(self, config):
raise ValueError('Direct server connections are not yet implemented.')

View File

@@ -0,0 +1,34 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from ripple.ledger.Args import ARGS
from ripple.util import Log
from ripple.util import Range
from ripple.util.PrettyPrint import pretty_print
SAFE = True
HELP = """cache
return server_info"""
def cache(server, clear=False):
cache = server.cache(ARGS.full)
name = ['summary', 'full'][ARGS.full]
files = cache.file_count()
if not files:
Log.error('No files in %s cache.' % name)
elif clear:
if not clear.strip() == 'clear':
raise Exception("Don't understand 'clear %s'." % clear)
if not ARGS.yes:
yes = raw_input('OK to clear %s cache? (y/N) ' % name)
if not yes.lower().startswith('y'):
Log.out('Cancelled.')
return
cache.clear(ARGS.full)
Log.out('%s cache cleared - %d file%s deleted.' %
(name.capitalize(), files, '' if files == 1 else 's'))
else:
caches = (int(c) for c in cache.cache_list())
Log.out(Range.to_string(caches))

View File

@@ -0,0 +1,21 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from ripple.ledger.Args import ARGS
from ripple.util import Log
from ripple.util import Range
from ripple.util.PrettyPrint import pretty_print
SAFE = True
HELP = 'info - return server_info'
def info(server):
Log.out('first =', server.first)
Log.out('last =', server.last)
Log.out('closed =', server.closed)
Log.out('current =', server.current)
Log.out('validated =', server.validated)
Log.out('complete =', Range.to_string(server.complete))
if ARGS.full:
Log.out(pretty_print(server.info()))

View File

@@ -0,0 +1,15 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from ripple.ledger.Args import ARGS
from ripple.ledger import SearchLedgers
import json
SAFE = True
HELP = """print
Print the ledgers to stdout. The default command."""
def run_print(server):
ARGS.display(print, server, SearchLedgers.search(server))

View File

@@ -0,0 +1,4 @@
from __future__ import absolute_import, division, print_function, unicode_literals
def all_ledgers(server, ledger_number):
return True

View File

@@ -0,0 +1,89 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from functools import wraps
import jsonpath_rw
from ripple.ledger.Args import ARGS
from ripple.util import Dict
from ripple.util import Log
from ripple.util import Range
from ripple.util.Decimal import Decimal
from ripple.util.PrettyPrint import pretty_print, Streamer
TRANSACT_FIELDS = (
'accepted',
'close_time_human',
'closed',
'ledger_index',
'total_coins',
'transactions',
)
LEDGER_FIELDS = (
'accepted',
'accountState',
'close_time_human',
'closed',
'ledger_index',
'total_coins',
'transactions',
)
def _dict_filter(d, keys):
return dict((k, v) for (k, v) in d.items() if k in keys)
def ledger_number(print, server, numbers):
print(Range.to_string(numbers))
def display(f):
@wraps(f)
def wrapper(printer, server, numbers, *args):
streamer = Streamer(printer=printer)
for number in numbers:
ledger = server.get_ledger(number, ARGS.full)
if ledger:
streamer.add(number, f(ledger, *args))
streamer.finish()
return wrapper
def extractor(f):
@wraps(f)
def wrapper(printer, server, numbers, *paths):
try:
find = jsonpath_rw.parse('|'.join(paths)).find
except:
raise ValueError("Can't understand jsonpath '%s'." % path)
def fn(ledger, *args):
return f(find(ledger), *args)
display(fn)(printer, server, numbers)
return wrapper
@display
def ledger(ledger, full=False):
if ARGS.full:
if full:
return ledger
ledger = Dict.prune(ledger, 1, False)
return _dict_filter(ledger, LEDGER_FIELDS)
@display
def prune(ledger, level=1):
return Dict.prune(ledger, level, False)
@display
def transact(ledger):
return _dict_filter(ledger, TRANSACT_FIELDS)
@extractor
def extract(finds):
return dict((str(f.full_path), str(f.value)) for f in finds)
@extractor
def sum(finds):
d = Decimal()
for f in finds:
d.accumulate(f.value)
return [str(d), len(finds)]

View File

@@ -0,0 +1,94 @@
#!/usr/bin/env python
from hashlib import sha256
#
# Human strings are base-58 with a
# version prefix and a checksum suffix.
#
# Copied from ripple/protocol/RippleAddress.h
#
VER_NONE = 1
VER_NODE_PUBLIC = 28
VER_NODE_PRIVATE = 32
VER_ACCOUNT_ID = 0
VER_ACCOUNT_PUBLIC = 35
VER_ACCOUNT_PRIVATE = 34
VER_FAMILY_GENERATOR = 41
VER_FAMILY_SEED = 33
ALPHABET = 'rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz'
VERSION_NAME = {
VER_NONE: 'VER_NONE',
VER_NODE_PUBLIC: 'VER_NODE_PUBLIC',
VER_NODE_PRIVATE: 'VER_NODE_PRIVATE',
VER_ACCOUNT_ID: 'VER_ACCOUNT_ID',
VER_ACCOUNT_PUBLIC: 'VER_ACCOUNT_PUBLIC',
VER_ACCOUNT_PRIVATE: 'VER_ACCOUNT_PRIVATE',
VER_FAMILY_GENERATOR: 'VER_FAMILY_GENERATOR',
VER_FAMILY_SEED: 'VER_FAMILY_SEED'
}
class Alphabet(object):
def __init__(self, radix, digit_to_char, char_to_digit):
self.radix = radix
self.digit_to_char = digit_to_char
self.char_to_digit = char_to_digit
def transcode_from(self, s, source_alphabet):
n, zero_count = source_alphabet._digits_to_number(s)
digits = []
while n > 0:
n, digit = divmod(n, self.radix)
digits.append(self.digit_to_char(digit))
s = ''.join(digits)
return self.digit_to_char(0) * zero_count + s[::-1]
def _digits_to_number(self, digits):
stripped = digits.lstrip(self.digit_to_char(0))
n = 0
for d in stripped:
n *= self.radix
n += self.char_to_digit(d)
return n, len(digits) - len(stripped)
_INVERSE_INDEX = dict((c, i) for (i, c) in enumerate(ALPHABET))
# In base 58 encoding, the digits come from the ALPHABET string.
BASE58 = Alphabet(len(ALPHABET), ALPHABET.__getitem__, _INVERSE_INDEX.get)
# In base 256 encoding, each digit is just a character between 0 and 255.
BASE256 = Alphabet(256, chr, ord)
def encode(b):
return BASE58.transcode_from(b, BASE256)
def decode(b):
return BASE256.transcode_from(b, BASE58)
def checksum(b):
"""Returns a 4-byte checksum of a binary."""
return sha256(sha256(b).digest()).digest()[:4]
def encode_version(ver, b):
"""Encodes a version encoding and a binary as human string."""
b = chr(ver) + b
return encode(b + checksum(b))
def decode_version(s):
"""Decodes a human base-58 string into its version encoding and binary."""
b = decode(s)
body, check = b[:-4], b[-4:]
assert check == checksum(body), ('Bad checksum for', s)
return ord(body[0]), body[1:]
def version_name(ver):
return VERSION_NAME.get(ver) or ('(unknown version %s)' % ver)
def check_version(version, expected):
if version != expected:
raise ValueError('Expected version %s but got %s' % (
version_name(version), version_name(expected)))

View File

@@ -0,0 +1,40 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import defaultdict
class Cache(object):
def __init__(self):
self._value_to_index = {}
self._index_to_value = []
def value_to_index(self, value, **kwds):
index = self._value_to_index.get(value, None)
if index is None:
index = len(self._index_to_value)
self._index_to_value.append((value, kwds))
self._value_to_index[value] = index
return index
def index_to_value(self, index):
return self._index_to_value[index]
def NamedCache():
return defaultdict(Cache)
def cache_by_key(d, keyfunc=None, exclude=None):
cache = defaultdict(Cache)
exclude = exclude or None
keyfunc = keyfunc or (lambda x: x)
def visit(item):
if isinstance(item, list):
for i, x in enumerate(item):
item[i] = visit(x)
elif isinstance(item, dict):
for k, v in item.items():
item[k] = visit(v)
return item
return cache

View File

@@ -0,0 +1,77 @@
from __future__ import absolute_import, division, print_function, unicode_literals
# Code taken from github/rec/grit.
import os
import sys
from collections import namedtuple
from ripple.ledger.Args import ARGS
from ripple.util import Log
Command = namedtuple('Command', 'function help safe')
def make_command(module):
name = module.__name__.split('.')[-1].lower()
return name, Command(getattr(module, name, None) or
getattr(module, 'run_' + name),
getattr(module, 'HELP'),
getattr(module, 'SAFE', False))
class CommandList(object):
def __init__(self, *args, **kwds):
self.registry = {}
self.register(*args, **kwds)
def register(self, *modules, **kwds):
for module in modules:
name, command = make_command(module)
self.registry[name] = command
for k, v in kwds.items():
if not isinstance(v, (list, tuple)):
v = [v]
self.register_one(k, *v)
def keys(self):
return self.registry.keys()
def register_one(self, name, function, help='', safe=False):
assert name not in self.registry
self.registry[name] = Command(function, help, safe)
def _get(self, command):
command = command.lower()
c = self.registry.get(command)
if c:
return command, c
commands = [c for c in self.registry if c.startswith(command)]
if len(commands) == 1:
command = commands[0]
return command, self.registry[command]
if not commands:
raise ValueError('No such command: %s. Commands are %s.' %
(command, ', '.join(sorted(self.registry))))
if len(commands) > 1:
raise ValueError('Command %s was ambiguous: %s.' %
(command, ', '.join(commands)))
def get(self, command):
return self._get(command)[1]
def run(self, command, *args):
return self.get(command).function(*args)
def run_safe(self, command, *args):
name, cmd = self._get(command)
if not (ARGS.yes or cmd.safe):
confirm = raw_input('OK to execute "rl %s %s"? (y/N) ' %
(name, ' '.join(args)))
if not confirm.lower().startswith('y'):
Log.error('Cancelled.')
return
cmd.function(*args)
def help(self, command):
return self.get(command).help()

View File

@@ -0,0 +1,54 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import json
"""Ripple has a proprietary format for their .cfg files, so we need a reader for
them."""
def read(lines):
sections = []
section = []
for line in lines:
line = line.strip()
if (not line) or line[0] == '#':
continue
if line.startswith('['):
if section:
sections.append(section)
section = []
section.append(line)
if section:
sections.append(section)
result = {}
for section in sections:
option = section.pop(0)
assert section, ('No value for option "%s".' % option)
assert option.startswith('[') and option.endswith(']'), (
'No option name in block "%s"' % p[0])
option = option[1:-1]
assert option not in result, 'Duplicate option "%s".' % option
subdict = {}
items = []
for part in section:
if '=' in part:
assert not items, 'Dictionary mixed with list.'
k, v = part.split('=', 1)
assert k not in subdict, 'Repeated dictionary entry ' + k
subdict[k] = v
else:
assert not subdict, 'List mixed with dictionary.'
if part.startswith('{'):
items.append(json.loads(part))
else:
words = part.split()
if len(words) > 1:
items.append(words)
else:
items.append(part)
if len(items) == 1:
result[option] = items[0]
else:
result[option] = items or subdict
return result

View File

@@ -0,0 +1,12 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import sqlite3
def fetchall(database, query, kwds):
conn = sqlite3.connect(database)
try:
cursor = conn.execute(query, kwds)
return cursor.fetchall()
finally:
conn.close()

Some files were not shown because too many files have changed in this diff Show More