Increase multisign test coverage

This commit is contained in:
Scott Schurr
2017-10-17 10:21:46 -07:00
committed by seelabs
parent cd19246937
commit db17ae8997

View File

@@ -773,7 +773,7 @@ public:
// R1: The regular key can be removed if there's a signer list.
env(regkey (alice, disabled), sig(alie));
// L0; A lone signer list cannot be removed.
// L0: A lone signer list cannot be removed.
auto const baseFee = env.current()->fees().base;
env(signers(alice, jtx::none), msig(bogie),
fee(2 * baseFee), ter(tecNO_ALTERNATIVE_KEY));
@@ -1068,6 +1068,71 @@ public:
env(noop(alice), msig(becky, demon), fee(3 * baseFee), ter(tefNOT_MULTI_SIGNING));
}
void test_multisigningMultisigner()
{
// Set up a signer list where one of the signers has both the
// master disabled and no regular key (because that signer is
// exclusively multisigning). That signer should no longer be
// able to successfully sign the signer list.
using namespace jtx;
Env env (*this);
Account const alice {"alice", KeyType::ed25519};
Account const becky {"becky", KeyType::secp256k1};
env.fund (XRP(1000), alice, becky);
env.close();
// alice sets up a signer list with becky as a signer.
env (signers (alice, 1, {{becky, 1}}));
env.close();
// becky sets up her signer list.
env (signers (becky, 1, {{bogie, 1}, {demon, 1}}));
env.close();
// Because becky has not (yet) disabled her master key, she can
// multisign a transaction for alice.
auto const baseFee = env.current()->fees().base;
env (noop (alice), msig (becky), fee (2 * baseFee));
env.close();
// Now becky disables her master key.
env (fset (becky, asfDisableMaster));
env.close();
// Since becky's master key is disabled she can no longer
// multisign for alice.
env (noop (alice), msig (becky), fee (2 * baseFee),
ter (tefMASTER_DISABLED));
env.close();
// Becky cannot 2-level multisign for alice. 2-level multisigning
// is not supported.
env (noop (alice), msig (msig::Reg {becky, bogie}), fee (2 * baseFee),
ter (tefBAD_SIGNATURE));
env.close();
// Verify that becky cannot sign with a regular key that she has
// not yet enabled.
Account const beck {"beck", KeyType::ed25519};
env (noop (alice), msig (msig::Reg {becky, beck}), fee (2 * baseFee),
ter (tefBAD_SIGNATURE));
env.close();
// Once becky gives herself the regular key, she can sign for alice
// using that regular key.
env (regkey (becky, beck), msig (demon), fee (2 * baseFee));
env.close();
env (noop (alice), msig (msig::Reg {becky, beck}), fee (2 * baseFee));
env.close();
// The presence of becky's regular key does not influence whether she
// can 2-level multisign; it still won't work.
env (noop (alice), msig (msig::Reg {becky, demon}), fee (2 * baseFee),
ter (tefBAD_SIGNATURE));
env.close();
}
void run() override
{
@@ -1086,6 +1151,7 @@ public:
test_txTypes();
test_badSignatureText();
test_noMultiSigners();
test_multisigningMultisigner();
}
};