mirror of
https://github.com/Xahau/xahaud.git
synced 2026-01-15 04:05:15 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b49032436 | ||
|
|
7a62559da9 | ||
|
|
d7dd6196e8 | ||
|
|
d3cfd46af3 | ||
|
|
94fab7d58b | ||
|
|
53b3b543a7 | ||
|
|
69e72ecb91 | ||
|
|
98a33d11e0 | ||
|
|
c908018647 | ||
|
|
c6ddd6d2c4 | ||
|
|
78906ee086 | ||
|
|
987247ddc1 | ||
|
|
a5e2fd0699 | ||
|
|
d92403ce35 | ||
|
|
6fb8fef883 | ||
|
|
a8a4774232 | ||
|
|
eaec08471b | ||
|
|
caffeea6fc | ||
|
|
23d49d0548 | ||
|
|
519ab34e4f | ||
|
|
bdc59ac4ec | ||
|
|
96bb67bfe5 | ||
|
|
798212f87c | ||
|
|
a3d61c0fbf | ||
|
|
3e926c9946 | ||
|
|
4392342c99 | ||
|
|
f4fe7b7d9a | ||
|
|
d268638a39 | ||
|
|
b1447afcc0 | ||
|
|
f40621c662 | ||
|
|
36ff48474a | ||
|
|
2adc234bf1 | ||
|
|
89bcacca5b | ||
|
|
6d496cc16f | ||
|
|
63b0245d06 | ||
|
|
fdf02a3853 | ||
|
|
9edf7ae67a | ||
|
|
533ba7ab75 | ||
|
|
4e10d7d61f | ||
|
|
01e7caa0d6 | ||
|
|
349f4d2d68 | ||
|
|
24ac5d5f51 | ||
|
|
8522c6684b | ||
|
|
7efc26a8b1 |
31
.github/workflows/clang-format.yml
vendored
31
.github/workflows/clang-format.yml
vendored
@@ -4,32 +4,21 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CLANG_VERSION: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# - name: Install clang-format
|
||||
# run: |
|
||||
# codename=$( lsb_release --codename --short )
|
||||
# sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
|
||||
# deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
# deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
# EOF
|
||||
# wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
|
||||
# sudo apt-get update -y
|
||||
# sudo apt-get install -y clang-format-${CLANG_VERSION}
|
||||
|
||||
# Temporary fix until this commit is merged
|
||||
# https://github.com/XRPLF/rippled/commit/552377c76f55b403a1c876df873a23d780fcc81c
|
||||
- name: Download and install clang-format
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y libtinfo5
|
||||
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.1/clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
||||
tar -xf clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
||||
sudo mv clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04 /opt/clang-10
|
||||
sudo ln -s /opt/clang-10/bin/clang-format /usr/local/bin/clang-format-10
|
||||
codename=$( lsb_release --codename --short )
|
||||
sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
|
||||
deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
EOF
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
|
||||
sudo apt-get update
|
||||
sudo apt-get install clang-format-${CLANG_VERSION}
|
||||
- name: Format src/ripple
|
||||
run: find src/ripple -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -print0 | xargs -0 clang-format-${CLANG_VERSION} -i
|
||||
- name: Format src/test
|
||||
|
||||
@@ -498,11 +498,15 @@ RCLConsensus::Adaptor::doAccept(
|
||||
|
||||
for (auto const& item : *result.txns.map_)
|
||||
{
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
retriableTxs.insert(
|
||||
std::make_shared<STTx const>(SerialIter{item.slice()}));
|
||||
JLOG(j_.debug()) << " Tx: " << item.key();
|
||||
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
@@ -510,6 +514,7 @@ RCLConsensus::Adaptor::doAccept(
|
||||
JLOG(j_.warn())
|
||||
<< " Tx: " << item.key() << " throws: " << ex.what();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
auto built = buildLCL(
|
||||
|
||||
@@ -116,8 +116,10 @@ applyTransactions(
|
||||
{
|
||||
auto const txid = it->first.getTXID();
|
||||
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
if (pass == 0 && built->txExists(txid))
|
||||
{
|
||||
it = txns.erase(it);
|
||||
@@ -140,6 +142,7 @@ applyTransactions(
|
||||
case ApplyResult::Retry:
|
||||
++it;
|
||||
}
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
@@ -148,6 +151,7 @@ applyTransactions(
|
||||
failed.insert(txid);
|
||||
it = txns.erase(it);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
JLOG(j.debug()) << (certainRetry ? "Pass: " : "Final pass: ") << pass
|
||||
|
||||
@@ -44,7 +44,8 @@ convertBlobsToTxResult(
|
||||
|
||||
auto tr = std::make_shared<Transaction>(txn, reason, app);
|
||||
|
||||
auto metaset = std::make_shared<TxMeta>(tr->getID(), ledger_index, rawMeta);
|
||||
auto metaset =
|
||||
std::make_shared<TxMeta>(tr->getID(), tr->getLedger(), rawMeta);
|
||||
|
||||
// if properly formed meta is available we can use it to generate ctid
|
||||
if (metaset->getAsObject().isFieldPresent(sfTransactionIndex))
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/PublicKey.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/protocol/st.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -314,21 +313,22 @@ SetRemarks::preclaim(PreclaimContext const& ctx)
|
||||
TER
|
||||
SetRemarks::doApply()
|
||||
{
|
||||
auto j = ctx_.journal;
|
||||
Sandbox sb(&ctx_.view());
|
||||
|
||||
auto const sle = sb.read(keylet::account(account_));
|
||||
if (!sle)
|
||||
return tefINTERNAL;
|
||||
return terNO_ACCOUNT;
|
||||
|
||||
auto const objID = ctx_.tx[sfObjectID];
|
||||
auto sleO = sb.peek(keylet::unchecked(objID));
|
||||
if (!sleO)
|
||||
return tefINTERNAL;
|
||||
return terNO_ACCOUNT;
|
||||
|
||||
std::optional<AccountID> issuer = getRemarksIssuer(sleO);
|
||||
|
||||
if (!issuer || *issuer != account_)
|
||||
return tefINTERNAL;
|
||||
return tecNO_PERMISSION;
|
||||
|
||||
auto const& remarksTxn = ctx_.tx.getFieldArray(sfRemarks);
|
||||
|
||||
@@ -400,7 +400,7 @@ SetRemarks::doApply()
|
||||
}
|
||||
|
||||
if (newRemarks.size() > 32)
|
||||
return tefINTERNAL;
|
||||
return tecTOO_MANY_REMARKS;
|
||||
|
||||
if (newRemarks.empty() && sleO->isFieldPresent(sfRemarks))
|
||||
sleO->makeFieldAbsent(sfRemarks);
|
||||
|
||||
@@ -1506,13 +1506,15 @@ Transactor::addWeakTSHFromSandbox(detail::ApplyViewBase const& pv)
|
||||
TER
|
||||
Transactor::doTSH(
|
||||
bool strong, // only strong iff true, only weak iff false
|
||||
std::vector<std::pair<AccountID, bool>> tsh,
|
||||
hook::HookStateMap& stateMap,
|
||||
std::vector<hook::HookResult>& results,
|
||||
std::shared_ptr<STObject const> const& provisionalMeta)
|
||||
{
|
||||
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)
|
||||
if (!strong)
|
||||
for (auto& weakTsh : additionalWeakTSH_)
|
||||
@@ -1770,9 +1772,6 @@ Transactor::operator()()
|
||||
// application to the ledger
|
||||
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
|
||||
// These TSH have the right to rollback.
|
||||
// Weak TSH and callback are executed post-application.
|
||||
@@ -1801,7 +1800,7 @@ Transactor::operator()()
|
||||
// (who have the right to rollback the txn), any weak TSH will be
|
||||
// executed after doApply has been successful (callback as well)
|
||||
|
||||
result = doTSH(true, tsh, stateMap, hookResults, {});
|
||||
result = doTSH(true, stateMap, hookResults, {});
|
||||
}
|
||||
|
||||
// write state if all chains executed successfully
|
||||
@@ -2055,7 +2054,7 @@ Transactor::operator()()
|
||||
hook::HookStateMap stateMap;
|
||||
std::vector<hook::HookResult> weakResults;
|
||||
|
||||
doTSH(false, tsh, stateMap, weakResults, proMeta);
|
||||
doTSH(false, stateMap, weakResults, proMeta);
|
||||
|
||||
// execute any hooks that nominated for 'again as weak'
|
||||
for (auto const& [accID, hookHashes] : aawMap)
|
||||
|
||||
@@ -188,7 +188,6 @@ protected:
|
||||
TER
|
||||
doTSH(
|
||||
bool strong, // only do strong TSH iff true, otheriwse only weak
|
||||
std::vector<std::pair<AccountID, bool>> tsh,
|
||||
hook::HookStateMap& stateMap,
|
||||
std::vector<hook::HookResult>& result,
|
||||
std::shared_ptr<STObject const> const& provisionalMeta);
|
||||
|
||||
@@ -168,8 +168,10 @@ applyTransaction(
|
||||
JLOG(j.debug()) << "TXN " << txn.getTransactionID()
|
||||
<< (retryAssured ? "/retry" : "/final");
|
||||
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
auto const result = apply(app, view, txn, flags, j);
|
||||
if (result.second)
|
||||
{
|
||||
@@ -189,12 +191,14 @@ applyTransaction(
|
||||
|
||||
JLOG(j.debug()) << "Transaction retry: " << transHuman(result.first);
|
||||
return ApplyResult::Retry;
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j.warn()) << "Throws: " << ex.what();
|
||||
return ApplyResult::Fail;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -591,15 +591,19 @@ preflight(
|
||||
{
|
||||
PreflightContext const pfctx(app, tx, rules, flags, j);
|
||||
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
return {pfctx, invoke_preflight(pfctx)};
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
JLOG(j.fatal()) << "apply: " << e.what();
|
||||
return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PreclaimResult
|
||||
@@ -636,17 +640,21 @@ preclaim(
|
||||
preflightResult.j);
|
||||
}
|
||||
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
if (!isTesSuccess(ctx->preflightResult))
|
||||
return {*ctx, ctx->preflightResult};
|
||||
return {*ctx, invoke_preclaim(*ctx)};
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
JLOG(ctx->j.fatal()) << "apply: " << e.what();
|
||||
return {*ctx, tefEXCEPTION};
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
XRPAmount
|
||||
@@ -670,8 +678,10 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
|
||||
// info to recover.
|
||||
return {tefEXCEPTION, false};
|
||||
}
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
if (!preclaimResult.likelyToClaimFee)
|
||||
return {preclaimResult.ter, false};
|
||||
|
||||
@@ -684,12 +694,14 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
|
||||
preclaimResult.flags,
|
||||
preclaimResult.j);
|
||||
return invoke_apply(ctx);
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
|
||||
return {tefEXCEPTION, false};
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -396,8 +396,6 @@ private:
|
||||
return "SetRegularKey";
|
||||
if (inp == "HookSet")
|
||||
return "SetHook";
|
||||
if (inp == "RemarksSet")
|
||||
return "SetRemarks";
|
||||
return inp;
|
||||
};
|
||||
|
||||
|
||||
@@ -5469,11 +5469,7 @@ class Import_test : public beast::unit_test::suite
|
||||
// burn 100'000 coins
|
||||
{
|
||||
test::jtx::Env env{
|
||||
*this,
|
||||
network::makeNetworkVLConfig(21337, keys),
|
||||
nullptr,
|
||||
beast::severities::kDisabled,
|
||||
};
|
||||
*this, network::makeNetworkVLConfig(21337, keys)};
|
||||
|
||||
auto const envCoins = env.current()->info().drops;
|
||||
BEAST_EXPECT(envCoins == 100'000'000'000'000'000);
|
||||
@@ -5513,11 +5509,7 @@ class Import_test : public beast::unit_test::suite
|
||||
// burn all coins
|
||||
{
|
||||
test::jtx::Env env{
|
||||
*this,
|
||||
network::makeNetworkVLConfig(21337, keys),
|
||||
nullptr,
|
||||
beast::severities::kDisabled,
|
||||
};
|
||||
*this, network::makeNetworkVLConfig(21337, keys)};
|
||||
|
||||
auto const envCoins = env.current()->info().drops;
|
||||
BEAST_EXPECT(envCoins == 100'000'000'000'000'000);
|
||||
@@ -5557,11 +5549,7 @@ class Import_test : public beast::unit_test::suite
|
||||
// burn no coins
|
||||
{
|
||||
test::jtx::Env env{
|
||||
*this,
|
||||
network::makeNetworkVLConfig(21337, keys),
|
||||
nullptr,
|
||||
beast::severities::kDisabled,
|
||||
};
|
||||
*this, network::makeNetworkVLConfig(21337, keys)};
|
||||
|
||||
auto const envCoins = env.current()->info().drops;
|
||||
BEAST_EXPECT(envCoins == 100'000'000'000'000'000);
|
||||
|
||||
@@ -377,8 +377,10 @@ struct SetRemarks_test : public beast::unit_test::suite
|
||||
//----------------------------------------------------------------------
|
||||
// doApply
|
||||
|
||||
// All checks in doApply are done in preclaim.
|
||||
BEAST_EXPECT(1);
|
||||
// terNO_ACCOUNT
|
||||
// tecNO_TARGET
|
||||
// tecNO_PERMISSION
|
||||
// tecTOO_MANY_REMARKS
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -101,7 +101,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
{
|
||||
testcase("catalogue_create: Invalid parameters");
|
||||
using namespace test::jtx;
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{
|
||||
*this, envconfig(), features, nullptr, beast::severities::kInfo};
|
||||
|
||||
// No parameters
|
||||
{
|
||||
@@ -176,7 +177,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
|
||||
// Create environment and some test ledgers
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{
|
||||
*this, envconfig(), features, nullptr, beast::severities::kInfo};
|
||||
prepareLedgerData(env, 5);
|
||||
|
||||
boost::filesystem::path tempDir =
|
||||
@@ -215,7 +217,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
{
|
||||
testcase("catalogue_load: Invalid parameters");
|
||||
using namespace test::jtx;
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{
|
||||
*this, envconfig(), features, nullptr, beast::severities::kInfo};
|
||||
|
||||
// No parameters
|
||||
{
|
||||
@@ -262,7 +265,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
|
||||
// Create environment and test data
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{
|
||||
*this, envconfig(), features, nullptr, beast::severities::kInfo};
|
||||
prepareLedgerData(env, 5);
|
||||
|
||||
// Store some key state information before catalogue creation
|
||||
@@ -318,7 +322,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
*this,
|
||||
test::jtx::envconfig(test::jtx::port_increment, 3),
|
||||
features,
|
||||
};
|
||||
nullptr,
|
||||
beast::severities::kInfo};
|
||||
|
||||
// Now load the catalogue
|
||||
Json::Value params{Json::objectValue};
|
||||
@@ -513,7 +518,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
return cfg;
|
||||
}),
|
||||
features,
|
||||
};
|
||||
nullptr,
|
||||
beast::severities::kInfo};
|
||||
prepareLedgerData(env1, 5);
|
||||
|
||||
// Create catalogue with network ID 123
|
||||
@@ -538,7 +544,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
return cfg;
|
||||
}),
|
||||
features,
|
||||
};
|
||||
nullptr,
|
||||
beast::severities::kInfo};
|
||||
|
||||
{
|
||||
Json::Value params{Json::objectValue};
|
||||
@@ -561,7 +568,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
|
||||
// Create environment and test data
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{
|
||||
*this, envconfig(), features, nullptr, beast::severities::kInfo};
|
||||
prepareLedgerData(env, 3);
|
||||
|
||||
boost::filesystem::path tempDir =
|
||||
@@ -652,7 +660,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
|
||||
// Create environment and test data
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{
|
||||
*this, envconfig(), features, nullptr, beast::severities::kInfo};
|
||||
prepareLedgerData(env, 3);
|
||||
|
||||
boost::filesystem::path tempDir =
|
||||
@@ -727,7 +736,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
|
||||
// Create environment and test data
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{
|
||||
*this, envconfig(), features, nullptr, beast::severities::kInfo};
|
||||
prepareLedgerData(env, 5);
|
||||
|
||||
boost::filesystem::path tempDir =
|
||||
@@ -816,7 +826,8 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
|
||||
// Create environment
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{
|
||||
*this, envconfig(), features, nullptr, beast::severities::kInfo};
|
||||
|
||||
boost::filesystem::path tempDir =
|
||||
boost::filesystem::temp_directory_path() /
|
||||
|
||||
Reference in New Issue
Block a user