mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-04 11:15:56 +00:00
Disable tx sig checking at the Application level:
* Only skip sig checking on the RPC/Websocket interface. * Used by Env tests which submit unsigned transactions.
This commit is contained in:
committed by
Nik Bougalis
parent
1b378172b6
commit
8e842b5893
@@ -363,6 +363,8 @@ public:
|
||||
boost::asio::signal_set m_signals;
|
||||
beast::WaitableEvent m_stop;
|
||||
|
||||
std::atomic<bool> checkSigs_;
|
||||
|
||||
std::unique_ptr <ResolverAsio> m_resolver;
|
||||
|
||||
io_latency_sampler m_io_latency_sampler;
|
||||
@@ -490,6 +492,8 @@ public:
|
||||
|
||||
, m_signals (get_io_service())
|
||||
|
||||
, checkSigs_(true)
|
||||
|
||||
, m_resolver (ResolverAsio::New (get_io_service(), logs_->journal("Resolver")))
|
||||
|
||||
, m_io_latency_sampler (m_collectorManager->collector()->make_event ("ios_latency"),
|
||||
@@ -526,6 +530,8 @@ public:
|
||||
void run() override;
|
||||
bool isShutdown() override;
|
||||
void signalStop() override;
|
||||
bool checkSigs() const override;
|
||||
void checkSigs(bool) override;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -1171,6 +1177,16 @@ ApplicationImp::isShutdown()
|
||||
return isStopped();
|
||||
}
|
||||
|
||||
bool ApplicationImp::checkSigs() const
|
||||
{
|
||||
return checkSigs_;
|
||||
}
|
||||
|
||||
void ApplicationImp::checkSigs(bool check)
|
||||
{
|
||||
checkSigs_ = check;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
|
||||
@@ -97,6 +97,8 @@ public:
|
||||
virtual void run() = 0;
|
||||
virtual bool isShutdown () = 0;
|
||||
virtual void signalStop () = 0;
|
||||
virtual bool checkSigs() const = 0;
|
||||
virtual void checkSigs(bool) = 0;
|
||||
|
||||
//
|
||||
// ---
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
run()
|
||||
run() override
|
||||
{
|
||||
test(10000);
|
||||
}
|
||||
@@ -64,6 +64,21 @@ BEAST_DEFINE_TESTSUITE_MANUAL(PlumpBook,tx,ripple);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Ensure that unsigned transactions succeed during automatic test runs.
|
||||
class ThinBook_test : public PlumpBook_test
|
||||
{
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
test(1);
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(ThinBook, tx, ripple);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class OversizeMeta_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -82,7 +82,11 @@ Json::Value doSubmit (RPC::Context& context)
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
if (!context.app.checkSigs())
|
||||
forceValidity(context.app.getHashRouter(),
|
||||
stpTrans->getTransactionID(), Validity::SigGoodOnly);
|
||||
auto validity = checkValidity(context.app.getHashRouter(),
|
||||
*stpTrans, context.ledgerMaster.getCurrentLedger()->rules(),
|
||||
context.app.config());
|
||||
|
||||
@@ -546,6 +546,9 @@ transactionConstructImpl (std::shared_ptr<STTx const> const& stpTrans,
|
||||
|
||||
// Check the signature if that's called for.
|
||||
auto sttxNew = std::make_shared<STTx const> (sit);
|
||||
if (!app.checkSigs())
|
||||
forceValidity(app.getHashRouter(),
|
||||
sttxNew->getTransactionID(), Validity::SigGoodOnly);
|
||||
if (checkValidity(app.getHashRouter(),
|
||||
*sttxNew, rules, app.config()).first != Validity::Valid)
|
||||
{
|
||||
|
||||
@@ -301,7 +301,7 @@ public:
|
||||
void
|
||||
disable_sigs()
|
||||
{
|
||||
nosig_ = true;
|
||||
app().checkSigs(false);
|
||||
}
|
||||
|
||||
/** Associate AccountID with account. */
|
||||
@@ -542,7 +542,6 @@ public:
|
||||
protected:
|
||||
int trace_ = 0;
|
||||
bool testing_ = true;
|
||||
bool nosig_ = false;
|
||||
TestStopwatch stopwatch_;
|
||||
uint256 txid_;
|
||||
TER ter_ = tesSUCCESS;
|
||||
@@ -567,9 +566,6 @@ protected:
|
||||
std::shared_ptr<STTx const>
|
||||
st (JTx const& jt);
|
||||
|
||||
ApplyFlags
|
||||
applyFlags() const;
|
||||
|
||||
inline
|
||||
void
|
||||
invoke (STTx& stx)
|
||||
|
||||
@@ -361,7 +361,9 @@ Env::postconditions(JTx const& jt, TER ter, bool didApply)
|
||||
{
|
||||
if (jt.ter && ! test.expect(ter == *jt.ter,
|
||||
"apply: " + transToken(ter) +
|
||||
" (" + transHuman(ter) + ")"))
|
||||
" (" + transHuman(ter) + ") != " +
|
||||
transToken(*jt.ter) + " (" +
|
||||
transHuman(*jt.ter) + ")"))
|
||||
{
|
||||
test.log << pretty(jt.jv);
|
||||
// Don't check postconditions if
|
||||
@@ -396,7 +398,7 @@ Env::autofill_sig (JTx& jt)
|
||||
return;
|
||||
auto const account =
|
||||
lookup(jv[jss::Account].asString());
|
||||
if (nosig_)
|
||||
if (!app().checkSigs())
|
||||
{
|
||||
jv[jss::SigningPubKey] =
|
||||
strHex(account.pk().slice());
|
||||
@@ -462,15 +464,6 @@ Env::st (JTx const& jt)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ApplyFlags
|
||||
Env::applyFlags() const
|
||||
{
|
||||
ApplyFlags flags = tapNONE;
|
||||
if (nosig_)
|
||||
flags = flags | tapNO_CHECK_SIGN;
|
||||
return flags;
|
||||
}
|
||||
|
||||
Json::Value
|
||||
Env::do_rpc(std::vector<std::string> const& args)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user