Compare commits

...

5 Commits

Author SHA1 Message Date
Denis Angell
2965d3d96c fix tsh 2025-04-28 12:32:44 +02:00
tequ
5400f43359 Supress logs for Catalogue_test, Import_test (#495) 2025-04-24 17:46:09 +10:00
Denis Angell
8cf7d485ab fix: ledger_index (#498) 2025-04-24 16:45:01 +10:00
tequ
372f25d09b Remove #ifndef DEBUG guards and exception handling wrappers (#496) 2025-04-24 16:38:14 +10:00
Denis Angell
401395a204 patch remarks (#497) 2025-04-24 16:36:57 +10:00
10 changed files with 36 additions and 57 deletions

View File

@@ -498,15 +498,11 @@ RCLConsensus::Adaptor::doAccept(
for (auto const& item : *result.txns.map_) for (auto const& item : *result.txns.map_)
{ {
#ifndef DEBUG
try try
{ {
#endif
retriableTxs.insert( retriableTxs.insert(
std::make_shared<STTx const>(SerialIter{item.slice()})); std::make_shared<STTx const>(SerialIter{item.slice()}));
JLOG(j_.debug()) << " Tx: " << item.key(); JLOG(j_.debug()) << " Tx: " << item.key();
#ifndef DEBUG
} }
catch (std::exception const& ex) catch (std::exception const& ex)
{ {
@@ -514,7 +510,6 @@ RCLConsensus::Adaptor::doAccept(
JLOG(j_.warn()) JLOG(j_.warn())
<< " Tx: " << item.key() << " throws: " << ex.what(); << " Tx: " << item.key() << " throws: " << ex.what();
} }
#endif
} }
auto built = buildLCL( auto built = buildLCL(

View File

@@ -116,10 +116,8 @@ applyTransactions(
{ {
auto const txid = it->first.getTXID(); auto const txid = it->first.getTXID();
#ifndef DEBUG
try try
{ {
#endif
if (pass == 0 && built->txExists(txid)) if (pass == 0 && built->txExists(txid))
{ {
it = txns.erase(it); it = txns.erase(it);
@@ -142,7 +140,6 @@ applyTransactions(
case ApplyResult::Retry: case ApplyResult::Retry:
++it; ++it;
} }
#ifndef DEBUG
} }
catch (std::exception const& ex) catch (std::exception const& ex)
{ {
@@ -151,7 +148,6 @@ applyTransactions(
failed.insert(txid); failed.insert(txid);
it = txns.erase(it); it = txns.erase(it);
} }
#endif
} }
JLOG(j.debug()) << (certainRetry ? "Pass: " : "Final pass: ") << pass JLOG(j.debug()) << (certainRetry ? "Pass: " : "Final pass: ") << pass

View File

@@ -44,8 +44,7 @@ convertBlobsToTxResult(
auto tr = std::make_shared<Transaction>(txn, reason, app); auto tr = std::make_shared<Transaction>(txn, reason, app);
auto metaset = auto metaset = std::make_shared<TxMeta>(tr->getID(), ledger_index, rawMeta);
std::make_shared<TxMeta>(tr->getID(), tr->getLedger(), rawMeta);
// if properly formed meta is available we can use it to generate ctid // if properly formed meta is available we can use it to generate ctid
if (metaset->getAsObject().isFieldPresent(sfTransactionIndex)) if (metaset->getAsObject().isFieldPresent(sfTransactionIndex))

View File

@@ -1506,15 +1506,13 @@ Transactor::addWeakTSHFromSandbox(detail::ApplyViewBase const& pv)
TER TER
Transactor::doTSH( Transactor::doTSH(
bool strong, // only strong iff true, only weak iff false bool strong, // only strong iff true, only weak iff false
std::vector<std::pair<AccountID, bool>> tsh,
hook::HookStateMap& stateMap, hook::HookStateMap& stateMap,
std::vector<hook::HookResult>& results, std::vector<hook::HookResult>& results,
std::shared_ptr<STObject const> const& provisionalMeta) std::shared_ptr<STObject const> const& provisionalMeta)
{ {
auto& view = ctx_.view(); auto& view = ctx_.view();
std::vector<std::pair<AccountID, bool>> tsh =
hook::getTransactionalStakeHolders(ctx_.tx, view);
// add the extra TSH marked out by the specific transactor (if applicable) // add the extra TSH marked out by the specific transactor (if applicable)
if (!strong) if (!strong)
for (auto& weakTsh : additionalWeakTSH_) for (auto& weakTsh : additionalWeakTSH_)
@@ -1772,6 +1770,9 @@ Transactor::operator()()
// application to the ledger // application to the ledger
std::map<AccountID, std::set<uint256>> aawMap; std::map<AccountID, std::set<uint256>> aawMap;
std::vector<std::pair<AccountID, bool>> tsh =
hook::getTransactionalStakeHolders(ctx_.tx, ctx_.view());
// Pre-application (Strong TSH) Hooks are executed here // Pre-application (Strong TSH) Hooks are executed here
// These TSH have the right to rollback. // These TSH have the right to rollback.
// Weak TSH and callback are executed post-application. // Weak TSH and callback are executed post-application.
@@ -1800,7 +1801,7 @@ Transactor::operator()()
// (who have the right to rollback the txn), any weak TSH will be // (who have the right to rollback the txn), any weak TSH will be
// executed after doApply has been successful (callback as well) // executed after doApply has been successful (callback as well)
result = doTSH(true, stateMap, hookResults, {}); result = doTSH(true, tsh, stateMap, hookResults, {});
} }
// write state if all chains executed successfully // write state if all chains executed successfully
@@ -2054,7 +2055,7 @@ Transactor::operator()()
hook::HookStateMap stateMap; hook::HookStateMap stateMap;
std::vector<hook::HookResult> weakResults; std::vector<hook::HookResult> weakResults;
doTSH(false, stateMap, weakResults, proMeta); doTSH(false, tsh, stateMap, weakResults, proMeta);
// execute any hooks that nominated for 'again as weak' // execute any hooks that nominated for 'again as weak'
for (auto const& [accID, hookHashes] : aawMap) for (auto const& [accID, hookHashes] : aawMap)

View File

@@ -188,6 +188,7 @@ protected:
TER TER
doTSH( doTSH(
bool strong, // only do strong TSH iff true, otheriwse only weak bool strong, // only do strong TSH iff true, otheriwse only weak
std::vector<std::pair<AccountID, bool>> tsh,
hook::HookStateMap& stateMap, hook::HookStateMap& stateMap,
std::vector<hook::HookResult>& result, std::vector<hook::HookResult>& result,
std::shared_ptr<STObject const> const& provisionalMeta); std::shared_ptr<STObject const> const& provisionalMeta);

View File

@@ -168,10 +168,8 @@ applyTransaction(
JLOG(j.debug()) << "TXN " << txn.getTransactionID() JLOG(j.debug()) << "TXN " << txn.getTransactionID()
<< (retryAssured ? "/retry" : "/final"); << (retryAssured ? "/retry" : "/final");
#ifndef DEBUG
try try
{ {
#endif
auto const result = apply(app, view, txn, flags, j); auto const result = apply(app, view, txn, flags, j);
if (result.second) if (result.second)
{ {
@@ -191,14 +189,12 @@ applyTransaction(
JLOG(j.debug()) << "Transaction retry: " << transHuman(result.first); JLOG(j.debug()) << "Transaction retry: " << transHuman(result.first);
return ApplyResult::Retry; return ApplyResult::Retry;
#ifndef DEBUG
} }
catch (std::exception const& ex) catch (std::exception const& ex)
{ {
JLOG(j.warn()) << "Throws: " << ex.what(); JLOG(j.warn()) << "Throws: " << ex.what();
return ApplyResult::Fail; return ApplyResult::Fail;
} }
#endif
} }
} // namespace ripple } // namespace ripple

View File

@@ -591,19 +591,15 @@ preflight(
{ {
PreflightContext const pfctx(app, tx, rules, flags, j); PreflightContext const pfctx(app, tx, rules, flags, j);
#ifndef DEBUG
try try
{ {
#endif
return {pfctx, invoke_preflight(pfctx)}; return {pfctx, invoke_preflight(pfctx)};
#ifndef DEBUG
} }
catch (std::exception const& e) catch (std::exception const& e)
{ {
JLOG(j.fatal()) << "apply: " << e.what(); JLOG(j.fatal()) << "apply: " << e.what();
return {pfctx, {tefEXCEPTION, TxConsequences{tx}}}; return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
} }
#endif
} }
PreclaimResult PreclaimResult
@@ -640,21 +636,17 @@ preclaim(
preflightResult.j); preflightResult.j);
} }
#ifndef DEBUG
try try
{ {
#endif
if (!isTesSuccess(ctx->preflightResult)) if (!isTesSuccess(ctx->preflightResult))
return {*ctx, ctx->preflightResult}; return {*ctx, ctx->preflightResult};
return {*ctx, invoke_preclaim(*ctx)}; return {*ctx, invoke_preclaim(*ctx)};
#ifndef DEBUG
} }
catch (std::exception const& e) catch (std::exception const& e)
{ {
JLOG(ctx->j.fatal()) << "apply: " << e.what(); JLOG(ctx->j.fatal()) << "apply: " << e.what();
return {*ctx, tefEXCEPTION}; return {*ctx, tefEXCEPTION};
} }
#endif
} }
XRPAmount XRPAmount
@@ -678,10 +670,8 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
// info to recover. // info to recover.
return {tefEXCEPTION, false}; return {tefEXCEPTION, false};
} }
#ifndef DEBUG
try try
{ {
#endif
if (!preclaimResult.likelyToClaimFee) if (!preclaimResult.likelyToClaimFee)
return {preclaimResult.ter, false}; return {preclaimResult.ter, false};
@@ -694,14 +684,12 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
preclaimResult.flags, preclaimResult.flags,
preclaimResult.j); preclaimResult.j);
return invoke_apply(ctx); return invoke_apply(ctx);
#ifndef DEBUG
} }
catch (std::exception const& e) catch (std::exception const& e)
{ {
JLOG(preclaimResult.j.fatal()) << "apply: " << e.what(); JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
return {tefEXCEPTION, false}; return {tefEXCEPTION, false};
} }
#endif
} }
} // namespace ripple } // namespace ripple

View File

@@ -396,6 +396,8 @@ private:
return "SetRegularKey"; return "SetRegularKey";
if (inp == "HookSet") if (inp == "HookSet")
return "SetHook"; return "SetHook";
if (inp == "RemarksSet")
return "SetRemarks";
return inp; return inp;
}; };

View File

@@ -5469,7 +5469,11 @@ class Import_test : public beast::unit_test::suite
// burn 100'000 coins // burn 100'000 coins
{ {
test::jtx::Env env{ test::jtx::Env env{
*this, network::makeNetworkVLConfig(21337, keys)}; *this,
network::makeNetworkVLConfig(21337, keys),
nullptr,
beast::severities::kDisabled,
};
auto const envCoins = env.current()->info().drops; auto const envCoins = env.current()->info().drops;
BEAST_EXPECT(envCoins == 100'000'000'000'000'000); BEAST_EXPECT(envCoins == 100'000'000'000'000'000);
@@ -5509,7 +5513,11 @@ class Import_test : public beast::unit_test::suite
// burn all coins // burn all coins
{ {
test::jtx::Env env{ test::jtx::Env env{
*this, network::makeNetworkVLConfig(21337, keys)}; *this,
network::makeNetworkVLConfig(21337, keys),
nullptr,
beast::severities::kDisabled,
};
auto const envCoins = env.current()->info().drops; auto const envCoins = env.current()->info().drops;
BEAST_EXPECT(envCoins == 100'000'000'000'000'000); BEAST_EXPECT(envCoins == 100'000'000'000'000'000);
@@ -5549,7 +5557,11 @@ class Import_test : public beast::unit_test::suite
// burn no coins // burn no coins
{ {
test::jtx::Env env{ test::jtx::Env env{
*this, network::makeNetworkVLConfig(21337, keys)}; *this,
network::makeNetworkVLConfig(21337, keys),
nullptr,
beast::severities::kDisabled,
};
auto const envCoins = env.current()->info().drops; auto const envCoins = env.current()->info().drops;
BEAST_EXPECT(envCoins == 100'000'000'000'000'000); BEAST_EXPECT(envCoins == 100'000'000'000'000'000);

View File

@@ -101,8 +101,7 @@ class Catalogue_test : public beast::unit_test::suite
{ {
testcase("catalogue_create: Invalid parameters"); testcase("catalogue_create: Invalid parameters");
using namespace test::jtx; using namespace test::jtx;
Env env{ Env env{*this, envconfig(), features};
*this, envconfig(), features, nullptr, beast::severities::kInfo};
// No parameters // No parameters
{ {
@@ -177,8 +176,7 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx; using namespace test::jtx;
// Create environment and some test ledgers // Create environment and some test ledgers
Env env{ Env env{*this, envconfig(), features};
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 5); prepareLedgerData(env, 5);
boost::filesystem::path tempDir = boost::filesystem::path tempDir =
@@ -217,8 +215,7 @@ class Catalogue_test : public beast::unit_test::suite
{ {
testcase("catalogue_load: Invalid parameters"); testcase("catalogue_load: Invalid parameters");
using namespace test::jtx; using namespace test::jtx;
Env env{ Env env{*this, envconfig(), features};
*this, envconfig(), features, nullptr, beast::severities::kInfo};
// No parameters // No parameters
{ {
@@ -265,8 +262,7 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx; using namespace test::jtx;
// Create environment and test data // Create environment and test data
Env env{ Env env{*this, envconfig(), features};
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 5); prepareLedgerData(env, 5);
// Store some key state information before catalogue creation // Store some key state information before catalogue creation
@@ -322,8 +318,7 @@ class Catalogue_test : public beast::unit_test::suite
*this, *this,
test::jtx::envconfig(test::jtx::port_increment, 3), test::jtx::envconfig(test::jtx::port_increment, 3),
features, features,
nullptr, };
beast::severities::kInfo};
// Now load the catalogue // Now load the catalogue
Json::Value params{Json::objectValue}; Json::Value params{Json::objectValue};
@@ -518,8 +513,7 @@ class Catalogue_test : public beast::unit_test::suite
return cfg; return cfg;
}), }),
features, features,
nullptr, };
beast::severities::kInfo};
prepareLedgerData(env1, 5); prepareLedgerData(env1, 5);
// Create catalogue with network ID 123 // Create catalogue with network ID 123
@@ -544,8 +538,7 @@ class Catalogue_test : public beast::unit_test::suite
return cfg; return cfg;
}), }),
features, features,
nullptr, };
beast::severities::kInfo};
{ {
Json::Value params{Json::objectValue}; Json::Value params{Json::objectValue};
@@ -568,8 +561,7 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx; using namespace test::jtx;
// Create environment and test data // Create environment and test data
Env env{ Env env{*this, envconfig(), features};
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 3); prepareLedgerData(env, 3);
boost::filesystem::path tempDir = boost::filesystem::path tempDir =
@@ -660,8 +652,7 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx; using namespace test::jtx;
// Create environment and test data // Create environment and test data
Env env{ Env env{*this, envconfig(), features};
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 3); prepareLedgerData(env, 3);
boost::filesystem::path tempDir = boost::filesystem::path tempDir =
@@ -736,8 +727,7 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx; using namespace test::jtx;
// Create environment and test data // Create environment and test data
Env env{ Env env{*this, envconfig(), features};
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 5); prepareLedgerData(env, 5);
boost::filesystem::path tempDir = boost::filesystem::path tempDir =
@@ -826,8 +816,7 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx; using namespace test::jtx;
// Create environment // Create environment
Env env{ Env env{*this, envconfig(), features};
*this, envconfig(), features, nullptr, beast::severities::kInfo};
boost::filesystem::path tempDir = boost::filesystem::path tempDir =
boost::filesystem::temp_directory_path() / boost::filesystem::temp_directory_path() /