mirror of
https://github.com/Xahau/xahaud.git
synced 2026-08-25 01:10:52 +00:00
Compare commits
2 Commits
reduce-mag
...
request-id
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65c6ad4ba3 | ||
|
|
7ef50e4114 |
@@ -95,16 +95,8 @@ if [[ "$4" == "" ]]; then
|
||||
echo "Non GH, local building, no Action runner magic"
|
||||
else
|
||||
# GH Action, runner
|
||||
if [[ "$(git rev-parse --abbrev-ref HEAD)" == "release" ]]; then
|
||||
echo "building on the release branch... placing it in builds/candidate"
|
||||
mkdir /data/builds/candidate
|
||||
cp /io/release-build/xahaud /data/builds/candidate/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
|
||||
cp /io/release-build/release.info /data/builds/candidate/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
|
||||
else
|
||||
echo "building non-release branch, placing it in builds root"
|
||||
cp /io/release-build/xahaud /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
|
||||
cp /io/release-build/release.info /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
|
||||
fi
|
||||
cp /io/release-build/xahaud /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
|
||||
cp /io/release-build/release.info /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
|
||||
echo "Published build to: http://build.xahau.tech/"
|
||||
echo $(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
|
||||
fi
|
||||
|
||||
@@ -116,6 +116,11 @@ message TMTransaction
|
||||
message TMTransactions
|
||||
{
|
||||
repeated TMTransaction transactions = 1;
|
||||
// Optional opaque request/response correlation ID. If present on the
|
||||
// TMGetObjectByHash(otTRANSACTIONS) request, the responder copies it
|
||||
// unchanged. This field is not routing state and does not affect message
|
||||
// processing, resource charging, duplicate suppression, or consensus.
|
||||
optional uint64 requestId = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -267,6 +272,10 @@ message TMGetObjectByHash
|
||||
optional bytes ledgerHash = 4; // the hash of the ledger these queries are for
|
||||
optional bool fat = 5; // return related nodes
|
||||
repeated TMIndexedObject objects = 6; // the specific objects requested
|
||||
// Optional opaque request/response correlation ID. Responders copy this
|
||||
// value unchanged when forming a reply. This is distinct from the existing
|
||||
// uint32 seq field and has no protocol meaning beyond correlation.
|
||||
optional uint64 requestId = 7;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,6 +315,10 @@ message TMGetLedger
|
||||
optional uint64 requestCookie = 6;
|
||||
optional TMQueryType queryType = 7;
|
||||
optional uint32 queryDepth = 8; // How deep to go, number of extra levels
|
||||
// Optional opaque request/response correlation ID. Responders copy this
|
||||
// value unchanged into TMLedgerData. This is separate from requestCookie:
|
||||
// requestCookie is relay routing state; requestId is only correlation.
|
||||
optional uint64 requestId = 9;
|
||||
}
|
||||
|
||||
enum TMReplyError
|
||||
@@ -323,6 +336,9 @@ message TMLedgerData
|
||||
repeated TMLedgerNode nodes = 4;
|
||||
optional uint32 requestCookie = 5;
|
||||
optional TMReplyError error = 6;
|
||||
// Optional opaque request/response correlation ID copied from TMGetLedger.
|
||||
// Receivers must not use it for relay routing or data validation.
|
||||
optional uint64 requestId = 7;
|
||||
}
|
||||
|
||||
message TMPing
|
||||
@@ -335,6 +351,9 @@ message TMPing
|
||||
optional uint32 seq = 2; // detect stale replies, ensure other side is reading
|
||||
optional uint64 pingTime = 3; // know when we think we sent the ping
|
||||
optional uint64 netTime = 4;
|
||||
// Optional opaque request/response correlation ID copied from ptPING to
|
||||
// ptPONG. The existing seq field remains the ping liveness cookie.
|
||||
optional uint64 requestId = 5;
|
||||
}
|
||||
|
||||
message TMSquelch
|
||||
@@ -355,6 +374,8 @@ message TMProofPathRequest
|
||||
required bytes key = 1;
|
||||
required bytes ledgerHash = 2;
|
||||
required TMLedgerMapType type = 3;
|
||||
// Optional opaque request/response correlation ID copied into the response.
|
||||
optional uint64 requestId = 4;
|
||||
}
|
||||
|
||||
message TMProofPathResponse
|
||||
@@ -365,11 +386,15 @@ message TMProofPathResponse
|
||||
optional bytes ledgerHeader = 4;
|
||||
repeated bytes path = 5;
|
||||
optional TMReplyError error = 6;
|
||||
// Optional opaque request/response correlation ID copied from the request.
|
||||
optional uint64 requestId = 7;
|
||||
}
|
||||
|
||||
message TMReplayDeltaRequest
|
||||
{
|
||||
required bytes ledgerHash = 1;
|
||||
// Optional opaque request/response correlation ID copied into the response.
|
||||
optional uint64 requestId = 2;
|
||||
}
|
||||
|
||||
message TMReplayDeltaResponse
|
||||
@@ -378,6 +403,8 @@ message TMReplayDeltaResponse
|
||||
optional bytes ledgerHeader = 2;
|
||||
repeated bytes transaction = 3;
|
||||
optional TMReplyError error = 4;
|
||||
// Optional opaque request/response correlation ID copied from the request.
|
||||
optional uint64 requestId = 5;
|
||||
}
|
||||
|
||||
message TMHaveTransactions
|
||||
|
||||
@@ -2405,6 +2405,9 @@ LedgerMaster::makeFetchPack(
|
||||
if (request->has_seq())
|
||||
reply.set_seq(request->seq());
|
||||
|
||||
if (request->has_requestid())
|
||||
reply.set_requestid(request->requestid());
|
||||
|
||||
reply.set_ledgerhash(request->ledgerhash());
|
||||
reply.set_type(protocol::TMGetObjectByHash::otFETCH_PACK);
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ LedgerReplayMsgHandler::processProofPathRequest(
|
||||
protocol::TMProofPathRequest& packet = *msg;
|
||||
protocol::TMProofPathResponse reply;
|
||||
|
||||
if (packet.has_requestid())
|
||||
reply.set_requestid(packet.requestid());
|
||||
|
||||
if (!packet.has_key() || !packet.has_ledgerhash() || !packet.has_type() ||
|
||||
packet.ledgerhash().size() != uint256::size() ||
|
||||
packet.key().size() != uint256::size() ||
|
||||
@@ -182,6 +185,9 @@ LedgerReplayMsgHandler::processReplayDeltaRequest(
|
||||
protocol::TMReplayDeltaRequest& packet = *msg;
|
||||
protocol::TMReplayDeltaResponse reply;
|
||||
|
||||
if (packet.has_requestid())
|
||||
reply.set_requestid(packet.requestid());
|
||||
|
||||
if (!packet.has_ledgerhash() ||
|
||||
packet.ledgerhash().size() != uint256::size())
|
||||
{
|
||||
|
||||
@@ -2436,6 +2436,9 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMGetObjectByHash> const& m)
|
||||
if (packet.has_seq())
|
||||
reply.set_seq(packet.seq());
|
||||
|
||||
if (packet.has_requestid())
|
||||
reply.set_requestid(packet.requestid());
|
||||
|
||||
reply.set_type(packet.type());
|
||||
|
||||
if (packet.has_ledgerhash())
|
||||
@@ -2748,6 +2751,9 @@ PeerImp::doTransactions(
|
||||
{
|
||||
protocol::TMTransactions reply;
|
||||
|
||||
if (packet->has_requestid())
|
||||
reply.set_requestid(packet->requestid());
|
||||
|
||||
JLOG(p_journal_.trace()) << "received TMGetObjectByHash requesting tx "
|
||||
<< packet->objects_size();
|
||||
|
||||
@@ -3249,6 +3255,12 @@ PeerImp::processLedgerRequest(std::shared_ptr<protocol::TMGetLedger> const& m)
|
||||
protocol::TMLedgerData ledgerData;
|
||||
bool fatLeaves{true};
|
||||
auto const itype{m->itype()};
|
||||
auto const copyRequestMetadata = [&] {
|
||||
if (m->has_requestcookie())
|
||||
ledgerData.set_requestcookie(m->requestcookie());
|
||||
if (m->has_requestid())
|
||||
ledgerData.set_requestid(m->requestid());
|
||||
};
|
||||
|
||||
if (itype == protocol::liTS_CANDIDATE)
|
||||
{
|
||||
@@ -3260,8 +3272,7 @@ PeerImp::processLedgerRequest(std::shared_ptr<protocol::TMGetLedger> const& m)
|
||||
ledgerData.set_ledgerseq(0);
|
||||
ledgerData.set_ledgerhash(m->ledgerhash());
|
||||
ledgerData.set_type(protocol::liTS_CANDIDATE);
|
||||
if (m->has_requestcookie())
|
||||
ledgerData.set_requestcookie(m->requestcookie());
|
||||
copyRequestMetadata();
|
||||
|
||||
// We'll already have most transactions
|
||||
fatLeaves = false;
|
||||
@@ -3288,8 +3299,7 @@ PeerImp::processLedgerRequest(std::shared_ptr<protocol::TMGetLedger> const& m)
|
||||
ledgerData.set_ledgerhash(ledgerHash.begin(), ledgerHash.size());
|
||||
ledgerData.set_ledgerseq(ledger->info().seq);
|
||||
ledgerData.set_type(itype);
|
||||
if (m->has_requestcookie())
|
||||
ledgerData.set_requestcookie(m->requestcookie());
|
||||
copyRequestMetadata();
|
||||
|
||||
switch (itype)
|
||||
{
|
||||
|
||||
@@ -22,8 +22,12 @@
|
||||
#include <xrpld/app/main/Application.h>
|
||||
#include <xrpld/app/misc/AmendmentTable.h>
|
||||
#include <xrpld/app/misc/NetworkOPs.h>
|
||||
#include <xrpld/rpc/detail/TransactionSign.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
#include <xrpl/json/json_writer.h>
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
#include <xrpl/protocol/RPCErr.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/TxFlags.h>
|
||||
#include <xrpl/protocol/digest.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
@@ -31,6 +35,14 @@
|
||||
#include <magic_enum.hpp>
|
||||
#include <sstream>
|
||||
|
||||
#define MAGIC_ENUM(x, _min, _max) \
|
||||
template <> \
|
||||
struct magic_enum::customize::enum_range<x> \
|
||||
{ \
|
||||
static constexpr int min = _min; \
|
||||
static constexpr int max = _max; \
|
||||
};
|
||||
|
||||
#define MAGIC_ENUM_16(x) \
|
||||
template <> \
|
||||
struct magic_enum::customize::enum_range<x> \
|
||||
@@ -46,6 +58,15 @@
|
||||
static constexpr bool is_flags = true; \
|
||||
};
|
||||
|
||||
MAGIC_ENUM(ripple::SerializedTypeID, -2, 10004);
|
||||
MAGIC_ENUM(ripple::LedgerEntryType, 0, 255);
|
||||
MAGIC_ENUM(ripple::TELcodes, -399, 300);
|
||||
MAGIC_ENUM(ripple::TEMcodes, -299, -200);
|
||||
MAGIC_ENUM(ripple::TEFcodes, -199, -100);
|
||||
MAGIC_ENUM(ripple::TERcodes, -99, -1);
|
||||
MAGIC_ENUM(ripple::TEScodes, 0, 1);
|
||||
MAGIC_ENUM(ripple::TECcodes, 100, 255);
|
||||
MAGIC_ENUM_16(ripple::TxType);
|
||||
MAGIC_ENUM_FLAG(ripple::UniversalFlags);
|
||||
MAGIC_ENUM_FLAG(ripple::AccountSetFlags);
|
||||
MAGIC_ENUM_FLAG(ripple::OfferCreateFlags);
|
||||
@@ -171,19 +192,24 @@ private:
|
||||
|
||||
ret[jss::TYPES]["Done"] = -1;
|
||||
std::map<int32_t, std::string> type_map{{-1, "Done"}};
|
||||
for (auto const& [rawName, typeValue] : sTypeMap)
|
||||
for (auto const& entry : magic_enum::enum_entries<SerializedTypeID>())
|
||||
{
|
||||
std::string typeName =
|
||||
translate(std::string(rawName).substr(4) /* remove STI_ */);
|
||||
ret[jss::TYPES][typeName] = typeValue;
|
||||
type_map[typeValue] = typeName;
|
||||
const auto name = entry.second;
|
||||
std::string type_name =
|
||||
translate(name.data() + 4 /* remove STI_ */);
|
||||
int32_t type_value = static_cast<int32_t>(entry.first);
|
||||
ret[jss::TYPES][type_name] = type_value;
|
||||
type_map[type_value] = type_name;
|
||||
}
|
||||
|
||||
ret[jss::LEDGER_ENTRY_TYPES] = Json::objectValue;
|
||||
ret[jss::LEDGER_ENTRY_TYPES][jss::Invalid] = -1;
|
||||
for (auto const& f : LedgerFormats::getInstance())
|
||||
for (auto const& entry : magic_enum::enum_entries<LedgerEntryType>())
|
||||
{
|
||||
ret[jss::LEDGER_ENTRY_TYPES][f.getName()] = f.getType();
|
||||
const auto name = entry.second;
|
||||
std::string type_name = translate(name.data() + 2 /* remove lt_ */);
|
||||
int32_t type_value = static_cast<int32_t>(entry.first);
|
||||
ret[jss::LEDGER_ENTRY_TYPES][type_name] = type_value;
|
||||
}
|
||||
|
||||
ret[jss::FIELDS] = Json::arrayValue;
|
||||
@@ -300,16 +326,71 @@ private:
|
||||
}
|
||||
|
||||
ret[jss::TRANSACTION_RESULTS] = Json::objectValue;
|
||||
for (auto const& [code, terInfo] : transResults())
|
||||
for (auto const& entry : magic_enum::enum_entries<TELcodes>())
|
||||
{
|
||||
ret[jss::TRANSACTION_RESULTS][terInfo.first] = code;
|
||||
const auto name = entry.second;
|
||||
ret[jss::TRANSACTION_RESULTS][STR(name)] =
|
||||
static_cast<int32_t>(entry.first);
|
||||
}
|
||||
for (auto const& entry : magic_enum::enum_entries<TEMcodes>())
|
||||
{
|
||||
const auto name = entry.second;
|
||||
ret[jss::TRANSACTION_RESULTS][STR(name)] =
|
||||
static_cast<int32_t>(entry.first);
|
||||
}
|
||||
for (auto const& entry : magic_enum::enum_entries<TEFcodes>())
|
||||
{
|
||||
const auto name = entry.second;
|
||||
ret[jss::TRANSACTION_RESULTS][STR(name)] =
|
||||
static_cast<int32_t>(entry.first);
|
||||
}
|
||||
for (auto const& entry : magic_enum::enum_entries<TERcodes>())
|
||||
{
|
||||
const auto name = entry.second;
|
||||
ret[jss::TRANSACTION_RESULTS][STR(name)] =
|
||||
static_cast<int32_t>(entry.first);
|
||||
}
|
||||
for (auto const& entry : magic_enum::enum_entries<TEScodes>())
|
||||
{
|
||||
const auto name = entry.second;
|
||||
ret[jss::TRANSACTION_RESULTS][STR(name)] =
|
||||
static_cast<int32_t>(entry.first);
|
||||
}
|
||||
for (auto const& entry : magic_enum::enum_entries<TECcodes>())
|
||||
{
|
||||
const auto name = entry.second;
|
||||
ret[jss::TRANSACTION_RESULTS][STR(name)] =
|
||||
static_cast<int32_t>(entry.first);
|
||||
}
|
||||
|
||||
auto const translate_tt = [](std::string inp) -> std::string {
|
||||
if (inp == "Amendment")
|
||||
return "EnableAmendment";
|
||||
if (inp == "Fee")
|
||||
return "SetFee";
|
||||
if (inp == "PaychanClaim")
|
||||
return "PaymentChannelClaim";
|
||||
if (inp == "PaychanCreate")
|
||||
return "PaymentChannelCreate";
|
||||
if (inp == "PaychanFund")
|
||||
return "PaymentChannelFund";
|
||||
if (inp == "RegularKeySet")
|
||||
return "SetRegularKey";
|
||||
if (inp == "HookSet")
|
||||
return "SetHook";
|
||||
if (inp == "RemarksSet")
|
||||
return "SetRemarks";
|
||||
return inp;
|
||||
};
|
||||
|
||||
ret[jss::TRANSACTION_TYPES] = Json::objectValue;
|
||||
ret[jss::TRANSACTION_TYPES][jss::Invalid] = -1;
|
||||
for (auto const& f : TxFormats::getInstance())
|
||||
for (auto const& entry : magic_enum::enum_entries<TxType>())
|
||||
{
|
||||
ret[jss::TRANSACTION_TYPES][f.getName()] = f.getType();
|
||||
const auto name = entry.second;
|
||||
std::string type_name = translate_tt(translate(name.data() + 2));
|
||||
int32_t type_value = static_cast<int32_t>(entry.first);
|
||||
ret[jss::TRANSACTION_TYPES][type_name] = type_value;
|
||||
}
|
||||
|
||||
// Transaction Flags:
|
||||
|
||||
Reference in New Issue
Block a user