Duplicate signer_lists in account_info (#870)

Fix #871
This commit is contained in:
cyan317
2023-09-25 13:24:16 +01:00
committed by GitHub
parent 44527140f0
commit e36545058d
3 changed files with 61 additions and 24 deletions

View File

@@ -67,7 +67,7 @@ jobs:
continue-on-error: true
runs-on: [self-hosted, Linux]
container:
image: conanio/gcc11:1.60.2
image: thejohnfreeman/rippled-build-ubuntu:12e19cd9034b
options: --user root
steps:
- name: Get Clio
@@ -94,22 +94,22 @@ jobs:
needs: build_mac
runs-on: [self-hosted, macOS]
steps:
- uses: actions/download-artifact@v3
with:
name: clio_tests_mac
- name: Run clio_tests
run: |
chmod +x ./clio_tests
./clio_tests --gtest_filter="-BackendCassandraBaseTest*:BackendCassandraTest*:BackendCassandraFactoryTestWithDB*"
- uses: actions/download-artifact@v3
with:
name: clio_tests_mac
- name: Run clio_tests
run: |
chmod +x ./clio_tests
./clio_tests --gtest_filter="-BackendCassandraBaseTest*:BackendCassandraTest*:BackendCassandraFactoryTestWithDB*"
test_linux:
needs: build_linux
runs-on: [self-hosted, x-heavy]
steps:
- uses: actions/download-artifact@v3
with:
name: clio_tests_linux
- name: Run clio_tests
run: |
chmod +x ./clio_tests
./clio_tests --gtest_filter="-BackendCassandraBaseTest*:BackendCassandraTest*:BackendCassandraFactoryTestWithDB*"
- uses: actions/download-artifact@v3
with:
name: clio_tests_linux
- name: Run clio_tests
run: |
chmod +x ./clio_tests
./clio_tests --gtest_filter="-BackendCassandraBaseTest*:BackendCassandraTest*:BackendCassandraFactoryTestWithDB*"

View File

@@ -128,8 +128,7 @@ tag_invoke(boost::json::value_from_tag, boost::json::value& jv, AccountInfoHandl
for (auto const& lsf : lsFlags)
acctFlags[lsf.first.data()] = output.accountData.isFlag(lsf.second);
// wait for conan integration-> jss::account_flags
jv.as_object()["account_flags"] = std::move(acctFlags);
jv.as_object()[JS(account_flags)] = std::move(acctFlags);
if (output.signerLists)
{
@@ -140,7 +139,11 @@ tag_invoke(boost::json::value_from_tag, boost::json::value& jv, AccountInfoHandl
std::back_inserter(signers),
[](auto const& signerList) { return toJson(signerList); });
// version 2 puts the signer_lists out of the account_data
jv.as_object()[JS(signer_lists)] = std::move(signers);
jv.as_object()[JS(signer_lists)] = signers;
// this is a temporary fix to support the clients that still expect v1 api(the signer_lists under
// account_data)
// TODO: we need to deprecate the duplicate later
jv.as_object()[JS(account_data)].as_object()[JS(signer_lists)] = std::move(signers);
}
}

View File

@@ -289,7 +289,8 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsTrue)
{
auto const expectedOutput = fmt::format(
R"({{
"account_data": {{
"account_data":
{{
"Account": "{}",
"Balance": "200",
"Flags": 0,
@@ -299,9 +300,8 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsTrue)
"PreviousTxnLgrSeq": 2,
"Sequence": 2,
"TransferRate": 0,
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8"
}},
"signer_lists":
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
"signer_lists":
[
{{
"Flags": 0,
@@ -330,8 +330,40 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsTrue)
"SignerQuorum": 2,
"index": "A9C28A28B85CD533217F5C0A0C7767666B093FA58A0F2D80026FCC4CD932DDC7"
}}
],
"account_flags": {{
]
}},
"signer_lists":
[
{{
"Flags": 0,
"LedgerEntryType": "SignerList",
"OwnerNode": "0",
"PreviousTxnID": "0000000000000000000000000000000000000000000000000000000000000000",
"PreviousTxnLgrSeq": 0,
"SignerEntries":
[
{{
"SignerEntry":
{{
"Account": "{}",
"SignerWeight": 1
}}
}},
{{
"SignerEntry":
{{
"Account": "{}",
"SignerWeight": 1
}}
}}
],
"SignerListID": 0,
"SignerQuorum": 2,
"index": "A9C28A28B85CD533217F5C0A0C7767666B093FA58A0F2D80026FCC4CD932DDC7"
}}
],
"account_flags":
{{
"defaultRipple": false,
"depositAuth": false,
"disableMasterKey": false,
@@ -350,6 +382,8 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsTrue)
INDEX1,
ACCOUNT1,
ACCOUNT2,
ACCOUNT1,
ACCOUNT2,
LEDGERHASH);
auto const rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
mockBackendPtr->updateRange(10); // min