Compare commits

..

3 Commits

Author SHA1 Message Date
RichardAH
e26fd326e0 Merge branch 'dev' into fix/rpc-queue-limit 2024-10-25 09:11:19 +10:00
Wietse Wind
6fdb285d48 clang again 2024-10-24 02:32:15 +02:00
Wietse Wind
e2e0186b32 Improve ADMIN HTTP POST RPC notifications: no queue limit, shorter HTTP call TTL 2024-10-24 02:29:02 +02:00
8 changed files with 14 additions and 83 deletions

View File

@@ -3,7 +3,7 @@
"C_Cpp.clang_format_path": ".clang-format", "C_Cpp.clang_format_path": ".clang-format",
"C_Cpp.clang_format_fallbackStyle": "{ ColumnLimit: 0 }", "C_Cpp.clang_format_fallbackStyle": "{ ColumnLimit: 0 }",
"[cpp]":{ "[cpp]":{
"editor.wordBasedSuggestions": "off", "editor.wordBasedSuggestions": false,
"editor.suggest.insertMode": "replace", "editor.suggest.insertMode": "replace",
"editor.semanticHighlighting.enabled": true, "editor.semanticHighlighting.enabled": true,
"editor.tabSize": 4, "editor.tabSize": 4,

View File

@@ -1,29 +0,0 @@
#/bin/bash
RIPPLED_ROOT="../src/ripple"
echo '// For documentation please see: https://xrpl-hooks.readme.io/reference/'
echo '// Generated using generate_sfcodes.sh'
cat $RIPPLED_ROOT/protocol/impl/SField.cpp | grep -E '^CONSTRUCT_' |
sed 's/UINT16/1/g' |
sed 's/UINT32/2/g' |
sed 's/UINT64/3/g' |
sed 's/HASH128/4/g' |
sed 's/HASH256/5/g' |
sed 's/UINT128/4/g' |
sed 's/UINT256/5/g' |
sed 's/AMOUNT/6/g' |
sed 's/VL/7/g' | sed 's/Import7/ImportVL/g' |
sed 's/ACCOUNT/8/g' |
sed 's/OBJECT/14/g' |
sed 's/ARRAY/15/g' |
sed 's/UINT8/16/g' |
sed 's/HASH160/17/g' |
sed 's/UINT160/17/g' |
sed 's/PATHSET/18/g' |
sed 's/VECTOR256/19/g' |
sed 's/UINT96/20/g' |
sed 's/UINT192/21/g' |
sed 's/UINT384/22/g' |
sed 's/UINT512/23/g' |
grep -Eo '"([^"]+)", *([0-9]+), *([0-9]+)' |
sed 's/"//g' | sed 's/ *//g' | sed 's/,/ /g' |
awk '{print ("#define sf"$1" (("$2"U << 16U) + "$3"U)")}'

View File

@@ -1,5 +1,5 @@
/** /**
* These are helper macros for writing hooks, all of them are optional as is including macro.h at all * These are helper macros for writing hooks, all of them are optional as is including hookmacro.h at all
*/ */
#include <stdint.h> #include <stdint.h>

View File

@@ -60,10 +60,7 @@
#define sfBurnedNFTokens ((2U << 16U) + 44U) #define sfBurnedNFTokens ((2U << 16U) + 44U)
#define sfHookStateCount ((2U << 16U) + 45U) #define sfHookStateCount ((2U << 16U) + 45U)
#define sfEmitGeneration ((2U << 16U) + 46U) #define sfEmitGeneration ((2U << 16U) + 46U)
#define sfLockCount ((2U << 16U) + 49U) #define sfLockCount ((2U << 16U) + 47U)
#define sfFirstNFTokenSequence ((2U << 16U) + 50U)
#define sfXahauActivationLgrSeq ((2U << 16U) + 96U)
#define sfImportSequence ((2U << 16U) + 97U)
#define sfRewardTime ((2U << 16U) + 98U) #define sfRewardTime ((2U << 16U) + 98U)
#define sfRewardLgrFirst ((2U << 16U) + 99U) #define sfRewardLgrFirst ((2U << 16U) + 99U)
#define sfRewardLgrLast ((2U << 16U) + 100U) #define sfRewardLgrLast ((2U << 16U) + 100U)
@@ -83,8 +80,6 @@
#define sfHookInstructionCount ((3U << 16U) + 17U) #define sfHookInstructionCount ((3U << 16U) + 17U)
#define sfHookReturnCode ((3U << 16U) + 18U) #define sfHookReturnCode ((3U << 16U) + 18U)
#define sfReferenceCount ((3U << 16U) + 19U) #define sfReferenceCount ((3U << 16U) + 19U)
#define sfAccountIndex ((3U << 16U) + 98U)
#define sfAccountCount ((3U << 16U) + 99U)
#define sfRewardAccumulator ((3U << 16U) + 100U) #define sfRewardAccumulator ((3U << 16U) + 100U)
#define sfEmailHash ((4U << 16U) + 1U) #define sfEmailHash ((4U << 16U) + 1U)
#define sfTakerPaysCurrency ((10U << 16U) + 1U) #define sfTakerPaysCurrency ((10U << 16U) + 1U)
@@ -125,9 +120,6 @@
#define sfOfferID ((5U << 16U) + 34U) #define sfOfferID ((5U << 16U) + 34U)
#define sfEscrowID ((5U << 16U) + 35U) #define sfEscrowID ((5U << 16U) + 35U)
#define sfURITokenID ((5U << 16U) + 36U) #define sfURITokenID ((5U << 16U) + 36U)
#define sfGovernanceFlags ((5U << 16U) + 99U)
#define sfGovernanceMarks ((5U << 16U) + 98U)
#define sfEmittedTxnID ((5U << 16U) + 97U)
#define sfAmount ((6U << 16U) + 1U) #define sfAmount ((6U << 16U) + 1U)
#define sfBalance ((6U << 16U) + 2U) #define sfBalance ((6U << 16U) + 2U)
#define sfLimitAmount ((6U << 16U) + 3U) #define sfLimitAmount ((6U << 16U) + 3U)
@@ -144,9 +136,6 @@
#define sfNFTokenBrokerFee ((6U << 16U) + 19U) #define sfNFTokenBrokerFee ((6U << 16U) + 19U)
#define sfHookCallbackFee ((6U << 16U) + 20U) #define sfHookCallbackFee ((6U << 16U) + 20U)
#define sfLockedBalance ((6U << 16U) + 21U) #define sfLockedBalance ((6U << 16U) + 21U)
#define sfBaseFeeDrops ((6U << 16U) + 22U)
#define sfReserveBaseDrops ((6U << 16U) + 23U)
#define sfReserveIncrementDrops ((6U << 16U) + 24U)
#define sfPublicKey ((7U << 16U) + 1U) #define sfPublicKey ((7U << 16U) + 1U)
#define sfMessageKey ((7U << 16U) + 2U) #define sfMessageKey ((7U << 16U) + 2U)
#define sfSigningPubKey ((7U << 16U) + 3U) #define sfSigningPubKey ((7U << 16U) + 3U)
@@ -182,13 +171,11 @@
#define sfNFTokenMinter ((8U << 16U) + 9U) #define sfNFTokenMinter ((8U << 16U) + 9U)
#define sfEmitCallback ((8U << 16U) + 10U) #define sfEmitCallback ((8U << 16U) + 10U)
#define sfHookAccount ((8U << 16U) + 16U) #define sfHookAccount ((8U << 16U) + 16U)
#define sfInform ((8U << 16U) + 99U)
#define sfIndexes ((19U << 16U) + 1U) #define sfIndexes ((19U << 16U) + 1U)
#define sfHashes ((19U << 16U) + 2U) #define sfHashes ((19U << 16U) + 2U)
#define sfAmendments ((19U << 16U) + 3U) #define sfAmendments ((19U << 16U) + 3U)
#define sfNFTokenOffers ((19U << 16U) + 4U) #define sfNFTokenOffers ((19U << 16U) + 4U)
#define sfHookNamespaces ((19U << 16U) + 5U) #define sfHookNamespaces ((19U << 16U) + 5U)
#define sfURITokenIDs ((19U << 16U) + 99U)
#define sfPaths ((18U << 16U) + 1U) #define sfPaths ((18U << 16U) + 1U)
#define sfTransactionMetaData ((14U << 16U) + 2U) #define sfTransactionMetaData ((14U << 16U) + 2U)
#define sfCreatedNode ((14U << 16U) + 3U) #define sfCreatedNode ((14U << 16U) + 3U)
@@ -211,12 +198,6 @@
#define sfHookDefinition ((14U << 16U) + 22U) #define sfHookDefinition ((14U << 16U) + 22U)
#define sfHookParameter ((14U << 16U) + 23U) #define sfHookParameter ((14U << 16U) + 23U)
#define sfHookGrant ((14U << 16U) + 24U) #define sfHookGrant ((14U << 16U) + 24U)
#define sfGenesisMint ((14U << 16U) + 96U)
#define sfActiveValidator ((14U << 16U) + 95U)
#define sfImportVLKey ((14U << 16U) + 94U)
#define sfHookEmission ((14U << 16U) + 93U)
#define sfMintURIToken ((14U << 16U) + 92U)
#define sfAmountEntry ((14U << 16U) + 91U)
#define sfSigners ((15U << 16U) + 3U) #define sfSigners ((15U << 16U) + 3U)
#define sfSignerEntries ((15U << 16U) + 4U) #define sfSignerEntries ((15U << 16U) + 4U)
#define sfTemplate ((15U << 16U) + 5U) #define sfTemplate ((15U << 16U) + 5U)
@@ -231,8 +212,4 @@
#define sfHookExecutions ((15U << 16U) + 18U) #define sfHookExecutions ((15U << 16U) + 18U)
#define sfHookParameters ((15U << 16U) + 19U) #define sfHookParameters ((15U << 16U) + 19U)
#define sfHookGrants ((15U << 16U) + 20U) #define sfHookGrants ((15U << 16U) + 20U)
#define sfGenesisMints ((15U << 16U) + 96U)
#define sfActiveValidators ((15U << 16U) + 95U) #define sfActiveValidators ((15U << 16U) + 95U)
#define sfImportVLKeys ((15U << 16U) + 94U)
#define sfHookEmissions ((15U << 16U) + 93U)
#define sfAmounts ((15U << 16U) + 92U)

View File

@@ -4617,8 +4617,6 @@ DEFINE_HOOK_FUNCTION(
} }
catch (std::exception& e) catch (std::exception& e)
{ {
JLOG(j.trace()) << "HookInfo[" << HC_ACC()
<< "]: etxn_fee_base exception: " << e.what();
return INVALID_TXN; return INVALID_TXN;
} }
@@ -5404,7 +5402,7 @@ DEFINE_HOOK_FUNCTION(
const int64_t float_one_internal = make_float(1000000000000000ull, -15, false); const int64_t float_one_internal = make_float(1000000000000000ull, -15, false);
inline int64_t inline int64_t
float_divide_internal(int64_t float1, int64_t float2, bool hasFix) float_divide_internal(int64_t float1, int64_t float2)
{ {
RETURN_IF_INVALID_FLOAT(float1); RETURN_IF_INVALID_FLOAT(float1);
RETURN_IF_INVALID_FLOAT(float2); RETURN_IF_INVALID_FLOAT(float2);
@@ -5457,16 +5455,8 @@ float_divide_internal(int64_t float1, int64_t float2, bool hasFix)
while (man2 > 0) while (man2 > 0)
{ {
int i = 0; int i = 0;
if (hasFix) for (; man1 > man2; man1 -= man2, ++i)
{ ;
for (; man1 >= man2; man1 -= man2, ++i)
;
}
else
{
for (; man1 > man2; man1 -= man2, ++i)
;
}
man3 *= 10; man3 *= 10;
man3 += i; man3 += i;
@@ -5486,8 +5476,7 @@ DEFINE_HOOK_FUNCTION(int64_t, float_divide, int64_t float1, int64_t float2)
HOOK_SETUP(); // populates memory_ctx, memory, memory_length, applyCtx, HOOK_SETUP(); // populates memory_ctx, memory, memory_length, applyCtx,
// hookCtx on current stack // hookCtx on current stack
bool const hasFix = view.rules().enabled(fixFloatDivide); return float_divide_internal(float1, float2);
return float_divide_internal(float1, float2, hasFix);
HOOK_TEARDOWN(); HOOK_TEARDOWN();
} }
@@ -5506,9 +5495,7 @@ DEFINE_HOOK_FUNCTION(int64_t, float_invert, int64_t float1)
return DIVISION_BY_ZERO; return DIVISION_BY_ZERO;
if (float1 == float_one_internal) if (float1 == float_one_internal)
return float_one_internal; return float_one_internal;
return float_divide_internal(float_one_internal, float1);
bool const fixV3 = view.rules().enabled(fixFloatDivide);
return float_divide_internal(float_one_internal, float1, fixV3);
HOOK_TEARDOWN(); HOOK_TEARDOWN();
} }

View File

@@ -1132,7 +1132,7 @@ accountTxPage(
{ {
sql = boost::str( sql = boost::str(
boost::format( boost::format(
prefix + (R"(AccountTransactions.LedgerSeq BETWEEN %u AND %u prefix + (R"(AccountTransactions.LedgerSeq BETWEEN '%u' AND '%u'
ORDER BY AccountTransactions.LedgerSeq %s, ORDER BY AccountTransactions.LedgerSeq %s,
AccountTransactions.TxnSeq %s AccountTransactions.TxnSeq %s
LIMIT %u;)")) % LIMIT %u;)")) %
@@ -1155,14 +1155,12 @@ accountTxPage(
FROM AccountTransactions, Transactions WHERE FROM AccountTransactions, Transactions WHERE
(AccountTransactions.TransID = Transactions.TransID AND (AccountTransactions.TransID = Transactions.TransID AND
AccountTransactions.Account = '%s' AND AccountTransactions.Account = '%s' AND
AccountTransactions.LedgerSeq BETWEEN %u AND %u) AccountTransactions.LedgerSeq BETWEEN '%u' AND '%u')
UNION OR
SELECT AccountTransactions.LedgerSeq,AccountTransactions.TxnSeq,Status,RawTxn,TxnMeta
FROM AccountTransactions, Transactions WHERE
(AccountTransactions.TransID = Transactions.TransID AND (AccountTransactions.TransID = Transactions.TransID AND
AccountTransactions.Account = '%s' AND AccountTransactions.Account = '%s' AND
AccountTransactions.LedgerSeq = %u AND AccountTransactions.LedgerSeq = '%u' AND
AccountTransactions.TxnSeq %s %u) AccountTransactions.TxnSeq %s '%u')
ORDER BY AccountTransactions.LedgerSeq %s, ORDER BY AccountTransactions.LedgerSeq %s,
AccountTransactions.TxnSeq %s AccountTransactions.TxnSeq %s
LIMIT %u; LIMIT %u;

View File

@@ -74,7 +74,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how // Feature.cpp. Because it's only used to reserve storage, and determine how
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than // large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
// the actual number of amendments. A LogicError on startup will verify this. // the actual number of amendments. A LogicError on startup will verify this.
static constexpr std::size_t numFeatures = 74; static constexpr std::size_t numFeatures = 73;
/** Amendments that this server supports and the default voting behavior. /** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated Whether they are enabled depends on the Rules defined in the validated
@@ -361,7 +361,6 @@ extern uint256 const fixNSDelete;
extern uint256 const fix240819; extern uint256 const fix240819;
extern uint256 const fixPageCap; extern uint256 const fixPageCap;
extern uint256 const fix240911; extern uint256 const fix240911;
extern uint256 const fixFloatDivide;
} // namespace ripple } // namespace ripple

View File

@@ -467,7 +467,6 @@ REGISTER_FIX (fixNSDelete, Supported::yes, VoteBehavior::De
REGISTER_FIX (fix240819, Supported::yes, VoteBehavior::DefaultYes); REGISTER_FIX (fix240819, Supported::yes, VoteBehavior::DefaultYes);
REGISTER_FIX (fixPageCap, Supported::yes, VoteBehavior::DefaultYes); REGISTER_FIX (fixPageCap, Supported::yes, VoteBehavior::DefaultYes);
REGISTER_FIX (fix240911, Supported::yes, VoteBehavior::DefaultYes); REGISTER_FIX (fix240911, Supported::yes, VoteBehavior::DefaultYes);
REGISTER_FIX (fixFloatDivide, Supported::yes, VoteBehavior::DefaultYes);
// The following amendments are obsolete, but must remain supported // The following amendments are obsolete, but must remain supported
// because they could potentially get enabled. // because they could potentially get enabled.