mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 10:35:50 +00:00
Remove conditionals for featureMultiSign enabled 27Jun2016
This commit is contained in:
committed by
Manoj doshi
parent
c48be14f4f
commit
6e4945c56b
@@ -295,12 +295,7 @@ SetAccount::doApply ()
|
|||||||
(!view().peek (keylet::signers (account_))))
|
(!view().peek (keylet::signers (account_))))
|
||||||
{
|
{
|
||||||
// Account has no regular key or multi-signer signer list.
|
// Account has no regular key or multi-signer signer list.
|
||||||
|
return tecNO_ALTERNATIVE_KEY;
|
||||||
// Prevent transaction changes until we're ready.
|
|
||||||
if (view().rules().enabled(featureMultiSign))
|
|
||||||
return tecNO_ALTERNATIVE_KEY;
|
|
||||||
|
|
||||||
return tecNO_REGULAR_KEY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JLOG(j_.trace()) << "Set lsfDisableMaster.";
|
JLOG(j_.trace()) << "Set lsfDisableMaster.";
|
||||||
|
|||||||
@@ -74,9 +74,6 @@ SetSignerList::determineOperation(STTx const& tx,
|
|||||||
NotTEC
|
NotTEC
|
||||||
SetSignerList::preflight (PreflightContext const& ctx)
|
SetSignerList::preflight (PreflightContext const& ctx)
|
||||||
{
|
{
|
||||||
if (! ctx.rules.enabled(featureMultiSign))
|
|
||||||
return temDISABLED;
|
|
||||||
|
|
||||||
auto const ret = preflight1 (ctx);
|
auto const ret = preflight1 (ctx);
|
||||||
if (!isTesSuccess (ret))
|
if (!isTesSuccess (ret))
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -331,13 +331,9 @@ TER Transactor::apply ()
|
|||||||
NotTEC
|
NotTEC
|
||||||
Transactor::checkSign (PreclaimContext const& ctx)
|
Transactor::checkSign (PreclaimContext const& ctx)
|
||||||
{
|
{
|
||||||
// Make sure multisigning is enabled before we check for multisignatures.
|
// If the pk is empty, then we must be multi-signing.
|
||||||
if (ctx.view.rules().enabled(featureMultiSign))
|
if (ctx.tx.getSigningPubKey().empty ())
|
||||||
{
|
return checkMultiSign (ctx);
|
||||||
// If the pk is empty, then we must be multi-signing.
|
|
||||||
if (ctx.tx.getSigningPubKey().empty ())
|
|
||||||
return checkMultiSign (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
return checkSingleSign (ctx);
|
return checkSingleSign (ctx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ checkValidity(HashRouter& router,
|
|||||||
STTx const& tx, Rules const& rules,
|
STTx const& tx, Rules const& rules,
|
||||||
Config const& config)
|
Config const& config)
|
||||||
{
|
{
|
||||||
auto const allowMultiSign =
|
|
||||||
rules.enabled(featureMultiSign);
|
|
||||||
|
|
||||||
auto const id = tx.getTransactionID();
|
auto const id = tx.getTransactionID();
|
||||||
auto const flags = router.getFlags(id);
|
auto const flags = router.getFlags(id);
|
||||||
if (flags & SF_SIGBAD)
|
if (flags & SF_SIGBAD)
|
||||||
@@ -50,7 +47,7 @@ checkValidity(HashRouter& router,
|
|||||||
if (!(flags & SF_SIGGOOD))
|
if (!(flags & SF_SIGGOOD))
|
||||||
{
|
{
|
||||||
// Don't know signature state. Check it.
|
// Don't know signature state. Check it.
|
||||||
auto const sigVerify = tx.checkSign(allowMultiSign);
|
auto const sigVerify = tx.checkSign();
|
||||||
if (! sigVerify.first)
|
if (! sigVerify.first)
|
||||||
{
|
{
|
||||||
router.setFlags(id, SF_SIGBAD);
|
router.setFlags(id, SF_SIGBAD);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class FeatureCollections
|
|||||||
{
|
{
|
||||||
static constexpr char const* const featureNames[] =
|
static constexpr char const* const featureNames[] =
|
||||||
{
|
{
|
||||||
"MultiSign",
|
"MultiSign", // Unconditionally supported.
|
||||||
"Tickets",
|
"Tickets",
|
||||||
"TrustSetAuth",
|
"TrustSetAuth",
|
||||||
"FeeEscalation", // Unconditionally supported.
|
"FeeEscalation", // Unconditionally supported.
|
||||||
@@ -339,7 +339,6 @@ foreachFeature(FeatureBitset bs, F&& f)
|
|||||||
f(bitsetIndexToFeature(i));
|
f(bitsetIndexToFeature(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint256 const featureMultiSign;
|
|
||||||
extern uint256 const featureTickets;
|
extern uint256 const featureTickets;
|
||||||
extern uint256 const featureTrustSetAuth;
|
extern uint256 const featureTrustSetAuth;
|
||||||
extern uint256 const featureOwnerPaysFee;
|
extern uint256 const featureOwnerPaysFee;
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public:
|
|||||||
@return `true` if valid signature. If invalid, the error message string.
|
@return `true` if valid signature. If invalid, the error message string.
|
||||||
*/
|
*/
|
||||||
std::pair<bool, std::string>
|
std::pair<bool, std::string>
|
||||||
checkSign(bool allowMultiSign) const;
|
checkSign() const;
|
||||||
|
|
||||||
// SQL Functions with metadata.
|
// SQL Functions with metadata.
|
||||||
static
|
static
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ detail::supportedAmendments ()
|
|||||||
// Removing them will cause servers to become amendment blocked.
|
// Removing them will cause servers to become amendment blocked.
|
||||||
static std::vector<std::string> const supported
|
static std::vector<std::string> const supported
|
||||||
{
|
{
|
||||||
"MultiSign",
|
"MultiSign", // Unconditionally supported.
|
||||||
// "Tickets",
|
// "Tickets",
|
||||||
"TrustSetAuth",
|
"TrustSetAuth",
|
||||||
"FeeEscalation", // Unconditionally supported.
|
"FeeEscalation", // Unconditionally supported.
|
||||||
@@ -151,7 +151,6 @@ uint256 bitsetIndexToFeature(size_t i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint256 const featureMultiSign = *getRegisteredFeature("MultiSign");
|
|
||||||
uint256 const featureTickets = *getRegisteredFeature("Tickets");
|
uint256 const featureTickets = *getRegisteredFeature("Tickets");
|
||||||
uint256 const featureTrustSetAuth = *getRegisteredFeature("TrustSetAuth");
|
uint256 const featureTrustSetAuth = *getRegisteredFeature("TrustSetAuth");
|
||||||
uint256 const featureOwnerPaysFee = *getRegisteredFeature("OwnerPaysFee");
|
uint256 const featureOwnerPaysFee = *getRegisteredFeature("OwnerPaysFee");
|
||||||
|
|||||||
@@ -177,24 +177,16 @@ void STTx::sign (
|
|||||||
tid_ = getHash(HashPrefix::transactionID);
|
tid_ = getHash(HashPrefix::transactionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<bool, std::string> STTx::checkSign(bool allowMultiSign) const
|
std::pair<bool, std::string> STTx::checkSign() const
|
||||||
{
|
{
|
||||||
std::pair<bool, std::string> ret {false, ""};
|
std::pair<bool, std::string> ret {false, ""};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (allowMultiSign)
|
// Determine whether we're single- or multi-signing by looking
|
||||||
{
|
// at the SigningPubKey. It it's empty we must be
|
||||||
// Determine whether we're single- or multi-signing by looking
|
// multi-signing. Otherwise we're single-signing.
|
||||||
// at the SigningPubKey. It it's empty we must be
|
Blob const& signingPubKey = getFieldVL (sfSigningPubKey);
|
||||||
// multi-signing. Otherwise we're single-signing.
|
ret = signingPubKey.empty () ? checkMultiSign () : checkSingleSign ();
|
||||||
Blob const& signingPubKey = getFieldVL (sfSigningPubKey);
|
|
||||||
ret = signingPubKey.empty () ?
|
|
||||||
checkMultiSign () : checkSingleSign ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = checkSingleSign ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (std::exception const&)
|
catch (std::exception const&)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,13 +39,6 @@ Json::Value doSignFor (RPC::JsonContext& context)
|
|||||||
"Signing is not supported by this server.");
|
"Signing is not supported by this server.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bail if multisign is not enabled.
|
|
||||||
if (! context.app.getLedgerMaster().getValidatedRules().
|
|
||||||
enabled (featureMultiSign))
|
|
||||||
{
|
|
||||||
RPC::inject_error (rpcNOT_ENABLED, context.params);
|
|
||||||
return context.params;
|
|
||||||
}
|
|
||||||
context.loadType = Resource::feeHighBurdenRPC;
|
context.loadType = Resource::feeHighBurdenRPC;
|
||||||
auto const failHard = context.params[jss::fail_hard].asBool();
|
auto const failHard = context.params[jss::fail_hard].asBool();
|
||||||
auto const failType = NetworkOPs::doFailHard (failHard);
|
auto const failType = NetworkOPs::doFailHard (failHard);
|
||||||
|
|||||||
@@ -32,13 +32,6 @@ namespace ripple {
|
|||||||
// }
|
// }
|
||||||
Json::Value doSubmitMultiSigned (RPC::JsonContext& context)
|
Json::Value doSubmitMultiSigned (RPC::JsonContext& context)
|
||||||
{
|
{
|
||||||
// Bail if multisign is not enabled.
|
|
||||||
if (! context.app.getLedgerMaster().getValidatedRules().
|
|
||||||
enabled (featureMultiSign))
|
|
||||||
{
|
|
||||||
RPC::inject_error (rpcNOT_ENABLED, context.params);
|
|
||||||
return context.params;
|
|
||||||
}
|
|
||||||
context.loadType = Resource::feeHighBurdenRPC;
|
context.loadType = Resource::feeHighBurdenRPC;
|
||||||
auto const failHard = context.params[jss::fail_hard].asBool();
|
auto const failHard = context.params[jss::fail_hard].asBool();
|
||||||
auto const failType = NetworkOPs::doFailHard (failHard);
|
auto const failType = NetworkOPs::doFailHard (failHard);
|
||||||
|
|||||||
@@ -892,7 +892,7 @@ class Check_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use a regular key and also multisign to cash a check.
|
// Use a regular key and also multisign to cash a check.
|
||||||
// featureMultiSign changes the reserve on a SignerList, so
|
// featureMultiSignReserve changes the reserve on a SignerList, so
|
||||||
// check both before and after.
|
// check both before and after.
|
||||||
FeatureBitset const allSupported {supported_amendments()};
|
FeatureBitset const allSupported {supported_amendments()};
|
||||||
for (auto const features :
|
for (auto const features :
|
||||||
@@ -1541,7 +1541,7 @@ class Check_test : public beast::unit_test::suite
|
|||||||
Account const zoe {"zoe"};
|
Account const zoe {"zoe"};
|
||||||
IOU const USD {gw["USD"]};
|
IOU const USD {gw["USD"]};
|
||||||
|
|
||||||
// featureMultiSign changes the reserve on a SignerList, so
|
// featureMultiSignReserve changes the reserve on a SignerList, so
|
||||||
// check both before and after.
|
// check both before and after.
|
||||||
FeatureBitset const allSupported {supported_amendments()};
|
FeatureBitset const allSupported {supported_amendments()};
|
||||||
for (auto const features :
|
for (auto const features :
|
||||||
|
|||||||
@@ -204,56 +204,6 @@ public:
|
|||||||
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
|
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
test_enablement (FeatureBitset features)
|
|
||||||
{
|
|
||||||
testcase ("Enablement");
|
|
||||||
|
|
||||||
using namespace jtx;
|
|
||||||
Env env(*this, envconfig([](std::unique_ptr<Config> cfg)
|
|
||||||
{
|
|
||||||
cfg->loadFromString ("[" SECTION_SIGNING_SUPPORT "]\ntrue");
|
|
||||||
return cfg;
|
|
||||||
}), features - featureMultiSign);
|
|
||||||
|
|
||||||
Account const alice {"alice", KeyType::ed25519};
|
|
||||||
env.fund(XRP(1000), alice);
|
|
||||||
env.close();
|
|
||||||
|
|
||||||
// NOTE: These six tests will fail if multisign is enabled.
|
|
||||||
env(signers(alice, 1, {{bogie, 1}}), ter(temDISABLED));
|
|
||||||
env.close();
|
|
||||||
env.require (owners (alice, 0));
|
|
||||||
|
|
||||||
std::uint32_t aliceSeq = env.seq (alice);
|
|
||||||
auto const baseFee = env.current()->fees().base;
|
|
||||||
env(noop(alice), msig(bogie), fee(2 * baseFee), ter(temINVALID));
|
|
||||||
env.close();
|
|
||||||
BEAST_EXPECT(env.seq(alice) == aliceSeq);
|
|
||||||
|
|
||||||
env(signers(alice, 1, {{bogie, 1}, {demon,1}}), ter(temDISABLED));
|
|
||||||
env.close();
|
|
||||||
BEAST_EXPECT(env.seq(alice) == aliceSeq);
|
|
||||||
|
|
||||||
{
|
|
||||||
Json::Value jvParams;
|
|
||||||
jvParams[jss::account] = alice.human();
|
|
||||||
auto const jsmr = env.rpc("json", "submit_multisigned", to_string(jvParams))[jss::result];
|
|
||||||
BEAST_EXPECT(jsmr[jss::error] == "notEnabled");
|
|
||||||
BEAST_EXPECT(jsmr[jss::status] == "error");
|
|
||||||
BEAST_EXPECT(jsmr[jss::error_message] == "Not enabled in configuration.");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
Json::Value jvParams;
|
|
||||||
jvParams[jss::account] = alice.human();
|
|
||||||
auto const jsmr = env.rpc("json", "sign_for", to_string(jvParams))[jss::result];
|
|
||||||
BEAST_EXPECT(jsmr[jss::error] == "notEnabled");
|
|
||||||
BEAST_EXPECT(jsmr[jss::status] == "error");
|
|
||||||
BEAST_EXPECT(jsmr[jss::error_message] == "Not enabled in configuration.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_fee (FeatureBitset features)
|
void test_fee (FeatureBitset features)
|
||||||
{
|
{
|
||||||
testcase ("Fee");
|
testcase ("Fee");
|
||||||
@@ -1340,7 +1290,6 @@ public:
|
|||||||
test_noReserve (features);
|
test_noReserve (features);
|
||||||
test_signerListSet (features);
|
test_signerListSet (features);
|
||||||
test_phantomSigners (features);
|
test_phantomSigners (features);
|
||||||
test_enablement (features);
|
|
||||||
test_fee (features);
|
test_fee (features);
|
||||||
test_misorderedSigners (features);
|
test_misorderedSigners (features);
|
||||||
test_masterSigners (features);
|
test_masterSigners (features);
|
||||||
|
|||||||
@@ -1478,7 +1478,7 @@ public:
|
|||||||
});
|
});
|
||||||
j.sign (keypair.first, keypair.second);
|
j.sign (keypair.first, keypair.second);
|
||||||
|
|
||||||
unexpected (!j.checkSign (true).first, "Transaction fails signature test");
|
unexpected (!j.checkSign().first, "Transaction fails signature test");
|
||||||
|
|
||||||
Serializer rawTxn;
|
Serializer rawTxn;
|
||||||
j.add (rawTxn);
|
j.add (rawTxn);
|
||||||
|
|||||||
@@ -376,12 +376,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void testBadInputs(bool withFeatures)
|
void testBadInputs()
|
||||||
{
|
{
|
||||||
using namespace test::jtx;
|
using namespace test::jtx;
|
||||||
std::unique_ptr<Env> penv {
|
Env env (*this);
|
||||||
withFeatures ? new Env(*this) : new Env(*this, FeatureBitset{})};
|
|
||||||
Env& env = *penv;
|
|
||||||
Account const alice ("alice");
|
Account const alice ("alice");
|
||||||
env.fund(XRP(10000), alice);
|
env.fund(XRP(10000), alice);
|
||||||
|
|
||||||
@@ -415,7 +413,7 @@ public:
|
|||||||
|
|
||||||
env(fset (alice, asfDisableMaster),
|
env(fset (alice, asfDisableMaster),
|
||||||
sig(alice),
|
sig(alice),
|
||||||
ter(withFeatures ? tecNO_ALTERNATIVE_KEY : tecNO_REGULAR_KEY));
|
ter(tecNO_ALTERNATIVE_KEY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testRequireAuthWithDir()
|
void testRequireAuthWithDir()
|
||||||
@@ -450,13 +448,10 @@ public:
|
|||||||
testMessageKey();
|
testMessageKey();
|
||||||
testWalletID();
|
testWalletID();
|
||||||
testEmailHash();
|
testEmailHash();
|
||||||
testBadInputs(true);
|
testBadInputs();
|
||||||
testBadInputs(false);
|
|
||||||
testRequireAuthWithDir();
|
testRequireAuthWithDir();
|
||||||
testTransferRate();
|
testTransferRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BEAST_DEFINE_TESTSUITE(AccountSet,app,ripple);
|
BEAST_DEFINE_TESTSUITE(AccountSet,app,ripple);
|
||||||
|
|||||||
Reference in New Issue
Block a user