mirror of
https://github.com/XRPLF/clio.git
synced 2026-10-09 21:38:12 +00:00
chore: Conform to rpc-spec 0.1.21 (#3238)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"requires": [
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1782392402.122708",
|
||||
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1782392402.420688",
|
||||
"xrpl-rpc-spec/0.1.19#870b2d3abcfbbf13b61c2d3c69495060%1790348286.187549",
|
||||
"xrpl-rpc-spec/0.1.21#d536f87a2ae7d313452746cfa3ac4404%1790869005.122975",
|
||||
"xrpl/3.4.0#e06b127b3ba92806a43fc7a53fc05fd3%1789577552.219154",
|
||||
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1782392403.185447",
|
||||
"spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c%1782736610.443882",
|
||||
|
||||
@@ -17,7 +17,7 @@ class ClioConan(ConanFile):
|
||||
"fmt/12.1.0",
|
||||
"libbacktrace/cci.20210118",
|
||||
"spdlog/1.17.0",
|
||||
"xrpl-rpc-spec/0.1.19",
|
||||
"xrpl-rpc-spec/0.1.21",
|
||||
"xrpl/3.4.0",
|
||||
]
|
||||
|
||||
|
||||
@@ -18,11 +18,6 @@ struct ClioErrorInfo {
|
||||
std::string_view const message;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A globally available rpc::Status that represents a successful state.
|
||||
*/
|
||||
static Status gOk;
|
||||
|
||||
/**
|
||||
* @brief Get the error info object from an clio-specific error code.
|
||||
*
|
||||
|
||||
@@ -256,10 +256,16 @@ resolveLocator(Input const& input, uint32_t apiVersion)
|
||||
}
|
||||
|
||||
if (input.rippleStateAccount.has_value()) {
|
||||
auto const& state = *input.rippleStateAccount;
|
||||
return Locator{
|
||||
.key = xrpl::keylet::trustLine(state.accounts[0], state.accounts[1], state.currency).key
|
||||
};
|
||||
return locatorFrom(
|
||||
*input.rippleStateAccount, xrpl::ltRIPPLE_STATE, [](le::RippleStateEntry const& entry) {
|
||||
return LocatorOrStatus{Locator{
|
||||
.key = xrpl::keylet::trustLine(
|
||||
entry.accounts[0], entry.accounts[1], entry.currency
|
||||
)
|
||||
.key
|
||||
}};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (input.escrow.has_value()) {
|
||||
|
||||
@@ -40,7 +40,11 @@ TransactionEntryHandler::process(
|
||||
output.apiVersion = ctx.apiVersion;
|
||||
|
||||
output.ledgerHeader = *expectedLgrInfo;
|
||||
auto const dbRet = sharedPtrBackend_->fetchTransaction(input.txHash, ctx.yield);
|
||||
|
||||
// The spec rejects a missing or malformed tx_hash, so the hash is always present here
|
||||
ASSERT(input.txHash.has_value(), "TransactionEntry's tx_hash must be validated by the spec");
|
||||
auto const dbRet = sharedPtrBackend_->fetchTransaction(*input.txHash, ctx.yield);
|
||||
|
||||
// Note: transaction_entry is meant to only search a specified ledger for
|
||||
// the specified transaction. tx searches the entire range of history. For
|
||||
// rippled, having two separate commands made sense, as tx would use SQLite
|
||||
|
||||
@@ -51,7 +51,7 @@ check(
|
||||
TEST(RPCErrorsTest, StatusAsBool)
|
||||
{
|
||||
// Only RpcSuccess status should return false
|
||||
EXPECT_FALSE(Status{XrpldError::RpcSuccess});
|
||||
EXPECT_FALSE(Status{Status::kOK});
|
||||
|
||||
// true should be returned for any error state, we just test a few
|
||||
CombinedError const errors[]{
|
||||
@@ -77,7 +77,7 @@ TEST(RPCErrorsTest, StatusEquals)
|
||||
|
||||
TEST(RPCErrorsTest, SuccessToJSON)
|
||||
{
|
||||
auto const status = Status{XrpldError::RpcSuccess};
|
||||
auto const status = Status{Status::kOK};
|
||||
check(makeError(status), "unknown", XrpldError::RpcSuccess, "An unknown error code.");
|
||||
}
|
||||
|
||||
|
||||
@@ -661,12 +661,12 @@ generateTestValuesForParametersTest()
|
||||
},
|
||||
|
||||
ParamTestCaseBundle{
|
||||
.testName = "InvalidRippleStateType",
|
||||
.testName = "InvalidRippleStateIndex",
|
||||
.testJson = R"JSON({
|
||||
"ripple_state": "123"
|
||||
})JSON",
|
||||
.expectedError = "invalidParams",
|
||||
.expectedErrorMessage = "Invalid parameters."
|
||||
.expectedError = "malformedRequest",
|
||||
.expectedErrorMessage = "Malformed request."
|
||||
},
|
||||
|
||||
ParamTestCaseBundle{
|
||||
|
||||
Reference in New Issue
Block a user