Skip to content

Commit

Permalink
Remove conditionals for featureTrustSetAuth enabled 19Jul2016
Browse files Browse the repository at this point in the history
  • Loading branch information
scottschurr authored and manojsdoshi committed Jan 30, 2020
1 parent 6e4945c commit 51ed7db
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/ripple/app/tx/impl/SetTrust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ SetTrust::doApply ()
else if (! saLimitAmount && // Setting default limit.
(! bQualityIn || ! uQualityIn) && // Not setting quality in or setting default quality in.
(! bQualityOut || ! uQualityOut) && // Not setting quality out or setting default quality out.
(! (view().rules().enabled(featureTrustSetAuth)) || ! bSetAuth))
(! bSetAuth))
{
JLOG(j_.trace()) <<
"Redundant: Setting non-existent ripple line to defaults.";
Expand Down
3 changes: 1 addition & 2 deletions src/ripple/protocol/Feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FeatureCollections
{
"MultiSign", // Unconditionally supported.
"Tickets",
"TrustSetAuth",
"TrustSetAuth", // Unconditionally supported.
"FeeEscalation", // Unconditionally supported.
"OwnerPaysFee",
"CompareFlowV1V2",
Expand Down Expand Up @@ -340,7 +340,6 @@ foreachFeature(FeatureBitset bs, F&& f)
}

extern uint256 const featureTickets;
extern uint256 const featureTrustSetAuth;
extern uint256 const featureOwnerPaysFee;
extern uint256 const featureCompareFlowV1V2;
extern uint256 const featurePayChan;
Expand Down
3 changes: 1 addition & 2 deletions src/ripple/protocol/impl/Feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ detail::supportedAmendments ()
{
"MultiSign", // Unconditionally supported.
// "Tickets",
"TrustSetAuth",
"TrustSetAuth", // Unconditionally supported.
"FeeEscalation", // Unconditionally supported.
// "OwnerPaysFee",
"PayChan",
Expand Down Expand Up @@ -152,7 +152,6 @@ uint256 bitsetIndexToFeature(size_t i)


uint256 const featureTickets = *getRegisteredFeature("Tickets");
uint256 const featureTrustSetAuth = *getRegisteredFeature("TrustSetAuth");
uint256 const featureOwnerPaysFee = *getRegisteredFeature("OwnerPaysFee");
uint256 const featureCompareFlowV1V2 = *getRegisteredFeature("CompareFlowV1V2");
uint256 const featurePayChan = *getRegisteredFeature("PayChan");
Expand Down
44 changes: 17 additions & 27 deletions src/test/app/SetAuth_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,33 @@ struct SetAuth_test : public beast::unit_test::suite

void testAuth(FeatureBitset features)
{
// featureTrustSetAuth should always be reset by the caller.
BEAST_EXPECT(!features[featureTrustSetAuth]);

using namespace jtx;
auto const gw = Account("gw");
auto const USD = gw["USD"];
{
Env env(*this, features);
env.fund(XRP(100000), "alice", gw);
env(fset(gw, asfRequireAuth));
env(auth(gw, "alice", "USD"), ter(tecNO_LINE_REDUNDANT));
}
{
Env env(*this, features | featureTrustSetAuth);

env.fund(XRP(100000), "alice", "bob", gw);
env(fset(gw, asfRequireAuth));
env(auth(gw, "alice", "USD"));
BEAST_EXPECT(env.le(
keylet::line(Account("alice").id(),
gw.id(), USD.currency)));
env(trust("alice", USD(1000)));
env(trust("bob", USD(1000)));
env(pay(gw, "alice", USD(100)));
env(pay(gw, "bob", USD(100)), ter(tecPATH_DRY)); // Should be terNO_AUTH
env(pay("alice", "bob", USD(50)), ter(tecPATH_DRY)); // Should be terNO_AUTH
}
Env env(*this);

env.fund(XRP(100000), "alice", "bob", gw);
env(fset(gw, asfRequireAuth));
env(auth(gw, "alice", "USD"));
BEAST_EXPECT(env.le(
keylet::line(Account("alice").id(),
gw.id(), USD.currency)));
env(trust("alice", USD(1000)));
env(trust("bob", USD(1000)));
env(pay(gw, "alice", USD(100)));
env(pay(gw, "bob", USD(100)), ter(tecPATH_DRY)); // Should be terNO_AUTH
env(pay("alice", "bob", USD(50)), ter(tecPATH_DRY)); // Should be terNO_AUTH
}

void run() override
{
using namespace jtx;
auto const sa = supported_amendments();
testAuth(sa - featureTrustSetAuth - featureFlow - fix1373 - featureFlowCross);
testAuth(sa - featureTrustSetAuth - fix1373 - featureFlowCross);
testAuth(sa - featureTrustSetAuth - featureFlowCross);
testAuth(sa - featureTrustSetAuth);
testAuth(sa - featureFlow - fix1373 - featureFlowCross);
testAuth(sa - fix1373 - featureFlowCross);
testAuth(sa - featureFlowCross);
testAuth(sa);
}
};

Expand Down

0 comments on commit 51ed7db

Please sign in to comment.