Skip to content

Commit

Permalink
Move signer_list in JSON response for api_version 2
Browse files Browse the repository at this point in the history
See XRPLF/xrpl-dev-portal#938 for context.
  • Loading branch information
Frassle committed Feb 13, 2021
1 parent 735b8b7 commit 2146c2e
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 13 deletions.
24 changes: 13 additions & 11 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@

This document contains the release notes for `rippled`, the reference server implementation of the Ripple protocol. To learn more about how to build, run or update a `rippled` server, visit https://xrpl.org/install-rippled.html


Have new ideas? Need help with setting up your node? Come visit us [here](https://github.com/ripple/rippled/issues/new/choose)

# Change Log

- Work on a version 2 of the XRP Network API has begun. The new API returns the code `notSynced` in place of `noClosed`, `noCurrent`, and `noNetwork`. And `invalidLgrRange` is returned in place of `lgrIdxInvalid`.
- Work on a version 2 of the XRP Network API has begun.
- The new API returns the code `notSynced` in place of `noClosed`, `noCurrent`, and `noNetwork`. And `invalidLgrRange` is returned in place of `lgrIdxInvalid`.
- `signer_list` is returned in the root of the `account_lines` response, no longer nested under `account_data`.
- The version 2 API can be specified by adding "api_version" : 2 to your json request. The default version remains 1 (if unspecified), except for the command line interface which always uses the latest verison.

# Releases

## Version 1.6.0

This release introduces several new features including changes to the XRP Ledger's consensus mechanism to make it even more robust in
This release introduces several new features including changes to the XRP Ledger's consensus mechanism to make it even more robust in
adverse conditions, as well as numerous bug fixes and optimizations.

### New and Improved Features
Expand Down Expand Up @@ -56,11 +58,11 @@ The `rippled` 1.5.0 release introduces several improvements and new features, in

This release also introduces two new amendments: `fixQualityUpperBound` and `RequireFullyCanonicalSig`.

Several improvements to the sharding system are currently being evaluated for inclusion into the upcoming 1.6 release of `rippled`. These changes are incompatible with shards generated by previous versions of the code.
Additionally, an issue with the existing sharding engine can result in a server running versions 1.4 or 1.5 of the software to experience a deadlock and automatically restart when running with the sharding feature enabled.
Several improvements to the sharding system are currently being evaluated for inclusion into the upcoming 1.6 release of `rippled`. These changes are incompatible with shards generated by previous versions of the code.
Additionally, an issue with the existing sharding engine can result in a server running versions 1.4 or 1.5 of the software to experience a deadlock and automatically restart when running with the sharding feature enabled.
At this time, the developers recommend running with sharding disabled, pending the improvements scheduled to be introduced with 1.6. For more information on how to disable sharding, please visit https://xrpl.org/configure-history-sharding.html


**New and Updated Features**
- The `RequireFullyCanonicalSig` amendment which changes the signature requirements for the XRP Ledger protocol so that non-fully-canonical signatures are no longer valid. This protects against transaction malleability on all transactions, instead of just transactions with the tfFullyCanonicalSig flag enabled. Without this amendment, a transaction is malleable if it uses a secp256k1 signature and does not have tfFullyCanonicalSig enabled. Most signing utilities enable tfFullyCanonicalSig by default, but there are exceptions. With this amendment, no single-signed transactions are malleable. (Multi-signed transactions may still be malleable if signers provide more signatures than are necessary.) All transactions must use the fully canonical form of the signature, regardless of the tfFullyCanonicalSig flag. Signing utilities that do not create fully canonical signatures are not supported. All of Ripple's signing utilities have been providing fully-canonical signatures exclusively since at least 2014. For more information. [`ec137044a`](https://github.com/ripple/rippled/commit/ec137044a014530263cd3309d81643a5a3c1fdab)
- Native [gRPC API](https://grpc.io/) support. Currently, this API provides a subset of the full `rippled` [API](https://xrpl.org/rippled-api.html). You can enable the gRPC API on your server with a new configuration stanza. [`7d867b806`](https://github.com/ripple/rippled/commit/7d867b806d70fc41fb45e3e61b719397033b272c)
Expand All @@ -85,11 +87,11 @@ At this time, the developers recommend running with sharding disabled, pending t
## Version 1.4.0

The `rippled` 1.4.0 release introduces several improvements and new features, including support for deleting accounts, improved peer slot management, improved CI integration and package building and support for [C++17](https://en.wikipedia.org/wiki/C%2B%2B17) and [Boost 1.71](https://www.boost.org/users/history/version_1_71_0.html). Finally, this release removes the code for the `SHAMapV2` amendment which failed to gain majority support and has been obsoleted by other improvements.

**New and Updated Features**
- The `DeletableAccounts` amendment which, if enabled, will make it possible for users to delete unused or unneeded accounts, recovering the account's reserve.
- Support for improved management of peer slots and the ability to add and removed reserved connections without requiring a restart of the server.
- Tracking and reporting of cumulative and instantaneous peer bandwidth usage.
- Tracking and reporting of cumulative and instantaneous peer bandwidth usage.
- Preliminary support for post-processing historical shards after downloading to index their contents.
- Reporting the master public key alongside the ephemeral public key in the `validation` stream [subscriptions](https://xrpl.org/subscribe.html).
- Reporting consensus phase changes in the `server` stream [subscription](https://xrpl.org/subscribe.html).
Expand Down Expand Up @@ -213,12 +215,12 @@ consensus.
- Make the FeeEscalation Amendment permanent (58f786c)
- Remove undocumented experimental options from RPC sign (a96cb8f)
- Improve RPC error message for fee command (af1697c)
- Improve ledger_entry command’s inconsistent behavior (63e167b)
- Improve ledger_entry command’s inconsistent behavior (63e167b)

**Bug Fixes**

- Accept redirects from validator list sites (7fe1d4b)
- Implement missing string conversions for JSON (c0e9418)
- Implement missing string conversions for JSON (c0e9418)
- Eliminate potential undefined behavior (c71eb45)
- Add safe_cast to sure no overflow in casts between enums and integral types (a7e4541)

Expand Down Expand Up @@ -265,7 +267,7 @@ Ripple recommends that all server operators upgrade to XRP Ledger version 1.1.0

**New and Updated Features**

- Add `DepositPreAuth` ledger type and transaction (#2513)
- Add `DepositPreAuth` ledger type and transaction (#2513)
- Increase fault tolerance and raise validation quorum to 80%, which fixes issue 2604 (#2613)
- Support ipv6 for peer and RPC comms (#2321)
- Refactor ledger replay logic (#2477)
Expand Down
10 changes: 8 additions & 2 deletions src/ripple/rpc/handlers/AccountInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,14 @@ doAccountInfo(RPC::JsonContext& context)
if (sleSigners)
jvSignerList.append(sleSigners->getJson(JsonOptions::none));

result[jss::account_data][jss::signer_lists] =
std::move(jvSignerList);
// Documentation states this is returned as part of the account_info response,
// but previously the code put it under account_data. We can move this to the
// documentated location from apiVersion 2 onwards.
if (context.apiVersion == 1) {
result[jss::account_data][jss::signer_lists] = std::move(jvSignerList);
} else {
result[jss::signer_lists] = std::move(jvSignerList);
}
}
// Return queue info if that is requested
if (queue)
Expand Down
121 changes: 121 additions & 0 deletions src/test/rpc/AccountInfo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,127 @@ class AccountInfo_test : public beast::unit_test::suite
}
}

// Test the "signer_lists" argument in account_info, with api_version 2.
void
testSignerListsApiVersion2()
{
using namespace jtx;
Env env(*this);
Account const alice{"alice"};
env.fund(XRP(1000), alice);

auto const withoutSigners =
std::string("{ ") + "\"api_version\": 2, \"account\": \"" + alice.human() + "\"}";

auto const withSigners = std::string("{ ") + "\"api_version\": 2, \"account\": \"" +
alice.human() + "\", " + "\"signer_lists\": true }";

// Alice has no SignerList yet.
{
// account_info without the "signer_lists" argument.
auto const info = env.rpc("json", "account_info", withoutSigners);
BEAST_EXPECT(
info.isMember(jss::result) &&
info[jss::result].isMember(jss::account_data));
BEAST_EXPECT(!info[jss::result][jss::account_data].isMember(
jss::signer_lists));
}
{
// account_info with the "signer_lists" argument.
auto const info = env.rpc("json", "account_info", withSigners);
BEAST_EXPECT(
info.isMember(jss::result) &&
info[jss::result].isMember(jss::account_data));
auto const& data = info[jss::result][jss::account_data];
BEAST_EXPECT(data.isMember(jss::signer_lists));
auto const& signerLists = data[jss::signer_lists];
BEAST_EXPECT(signerLists.isArray());
BEAST_EXPECT(signerLists.size() == 0);
}

// Give alice a SignerList.
Account const bogie{"bogie"};

Json::Value const smallSigners = signers(alice, 2, {{bogie, 3}});
env(smallSigners);
{
// account_info without the "signer_lists" argument.
auto const info = env.rpc("json", "account_info", withoutSigners);
BEAST_EXPECT(
info.isMember(jss::result) &&
info[jss::result].isMember(jss::account_data));
BEAST_EXPECT(!info[jss::result][jss::account_data].isMember(
jss::signer_lists));
}
{
// account_info with the "signer_lists" argument.
auto const info = env.rpc("json", "account_info", withSigners);
BEAST_EXPECT(
info.isMember(jss::result) &&
info[jss::result].isMember(jss::account_data));
auto const& data = info[jss::result][jss::account_data];
BEAST_EXPECT(data.isMember(jss::signer_lists));
auto const& signerLists = data[jss::signer_lists];
BEAST_EXPECT(signerLists.isArray());
BEAST_EXPECT(signerLists.size() == 1);
auto const& signers = signerLists[0u];
BEAST_EXPECT(signers.isObject());
BEAST_EXPECT(signers[sfSignerQuorum.jsonName] == 2);
auto const& signerEntries = signers[sfSignerEntries.jsonName];
BEAST_EXPECT(signerEntries.size() == 1);
auto const& entry0 = signerEntries[0u][sfSignerEntry.jsonName];
BEAST_EXPECT(entry0[sfSignerWeight.jsonName] == 3);
}

// Give alice a big signer list
Account const demon{"demon"};
Account const ghost{"ghost"};
Account const haunt{"haunt"};
Account const jinni{"jinni"};
Account const phase{"phase"};
Account const shade{"shade"};
Account const spook{"spook"};

Json::Value const bigSigners = signers(
alice,
4,
{
{bogie, 1},
{demon, 1},
{ghost, 1},
{haunt, 1},
{jinni, 1},
{phase, 1},
{shade, 1},
{spook, 1},
});
env(bigSigners);
{
// account_info with the "signer_lists" argument.
auto const info = env.rpc("json", "account_info", withSigners);
BEAST_EXPECT(
info.isMember(jss::result) &&
info[jss::result].isMember(jss::account_data));
auto const& data = info[jss::result][jss::account_data];
BEAST_EXPECT(data.isMember(jss::signer_lists));
auto const& signerLists = data[jss::signer_lists];
BEAST_EXPECT(signerLists.isArray());
BEAST_EXPECT(signerLists.size() == 1);
auto const& signers = signerLists[0u];
BEAST_EXPECT(signers.isObject());
BEAST_EXPECT(signers[sfSignerQuorum.jsonName] == 4);
auto const& signerEntries = signers[sfSignerEntries.jsonName];
BEAST_EXPECT(signerEntries.size() == 8);
for (unsigned i = 0u; i < 8; ++i)
{
auto const& entry = signerEntries[i][sfSignerEntry.jsonName];
BEAST_EXPECT(entry.size() == 2);
BEAST_EXPECT(entry.isMember(sfAccount.jsonName));
BEAST_EXPECT(entry[sfSignerWeight.jsonName] == 1);
}
}
}

// Test the "signer_lists" argument in account_info, version 2 API.
void
testSignerListsV2()
Expand Down

0 comments on commit 2146c2e

Please sign in to comment.