-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shardstore Unittest Fix #3855
Shardstore Unittest Fix #3855
Conversation
Typically, an RPC response contains a `result` field, which contains details about the operation performed. For ease of parsing, forwarded responses must look like a non-forwarded response. In some instances the response was incorrectly composed, so that the actual `result` object would be encapsulated by an outer `result` object, breaking existing code. This commit, addresses this issue and correctly "folds" the `result` field, ensuring a consistent schema for responses.
The `tx` command supports output in both "text" and "binary" modes, controlled by the binary flag. For more details on the command and the possible arguments, please see: https://xrpl.org/tx.html. The existing handler would incorrectly deal with metadata when in binary mode. This commit corrects this issue, ensuring that the metadata is properly encoded, depending on the mode.
In order to effectively mitigate CVE-2021-3499 even when compiling against versions of OpenSSL prior to 1.1.1k, this commit: 1) requires use of TLS 1.2 or later. Note that both TLS 1.0 and TLS 1.1 have been officially deprecated for over a year. 2) disables renegotiation support for TLS 1.2 connections. Lastly, this commit also changes the default list of ciphers that the server offers, limiting it only to ciphers that are part of TLS 1.2.
* load_factor was missing from server_info when the server was running in reporting mode. Now, the reporting mode server calls server_info on the p2p node, and propagates the load_factor back to the client.
Substantial reductions in an offer's effective quality from its initial quality may clog offer books.
* The std::less and std::equal_to comparators have [[nodiscard]], which conflicts with boost::bimap validations.
🎉 |
BEAST_EXPECT( | ||
ripemd160File((path / "nudb.key").string()) == ripemd160Key); | ||
BEAST_EXPECT( | ||
ripemd160File((path / "nudb.dat").string()) == ripemd160Dat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these two checks are necessary here as we perform them at the end of the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1140,6 +1135,20 @@ class DatabaseShard_test : public TestBase | |||
if (createShard(data, *db) < 0) | |||
return; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The createShard call should be
if (!BEAST_EXPECT(createShard(data, *db) != std::nullopt))
return;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change anything, but this could also be written as
if (!BEAST_EXPECT(createShard(data, *db)))
return;
or
if (!BEAST_EXPECT(createShard(data, *db).has_value()))
return;
ripemd160File((path / "nudb.key").string()) == ripemd160Key); | ||
BEAST_EXPECT( | ||
ripemd160File((path / "nudb.dat").string()) == ripemd160Dat); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The waitShard call below should be
if (!BEAST_EXPECT(waitShard(*db, 1) != std::nullopt))
return;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1246,22 +1254,28 @@ class DatabaseShard_test : public TestBase | |||
Database& ndb = env.app().getNodeStore(); | |||
BEAST_EXPECT(db); | |||
|
|||
auto const shardCount = 4; | |||
// Create some ledgers for the shard store to | |||
// import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. This comment can be a single line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
auto& store = env.app().getSHAMapStore(); | ||
auto lastRotated = store.getLastRotated(); | ||
// Enable online deletion now that the import has | ||
// started |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. This comment can be a single line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1273,6 +1287,7 @@ class DatabaseShard_test : public TestBase | |||
{ | |||
// A rotation occurred during shard import. Not | |||
// necessarily an error | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: sequence can be renamed to ledgerSeq and be const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1281,7 +1296,8 @@ class DatabaseShard_test : public TestBase | |||
} | |||
}); | |||
|
|||
data = TestData(seedValue * 2, 4, shardCount); | |||
// Create more ledgers to trigger online deletion | |||
data = TestData(seedValue * 2, 4, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the defaults, can also be
TestData(seedValue * 2);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some nit comments but otherwise looks good. 👍
* Run the import process in a background thread * Prevent online_delete from removing ledgers pending import
* Create SQLite database for mapping transaction IDs to shard indexes * Create SQLite database for mapping ledger hashes to shard indexes * Create additional test cases for the shard database
* resolves XRPLF#3782 * gcc 8 is required for the charconv include file
a13cd9b
to
0e7d5cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is already merged, but I did look through it and everything looks good.
@@ -1140,6 +1135,20 @@ class DatabaseShard_test : public TestBase | |||
if (createShard(data, *db) < 0) | |||
return; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change anything, but this could also be written as
if (!BEAST_EXPECT(createShard(data, *db)))
return;
or
if (!BEAST_EXPECT(createShard(data, *db).has_value()))
return;
High Level Overview of Change
This fixes some recent failures in the shard database unit tests.
Context of Change
The unit test functions
testDeterministicShard
andtestImportWithOnlineDelete
were modified to fix test case failures. Please limit the review to 7778710 as this fix is stacked onto several unmerged PRs.Type of Change