rippled
SetSignerList.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2014 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_TX_SETSIGNERLIST_H_INCLUDED
21 #define RIPPLE_TX_SETSIGNERLIST_H_INCLUDED
22 
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/app/tx/impl/SignerEntries.h>
25 #include <ripple/app/tx/impl/Transactor.h>
26 #include <ripple/basics/Log.h>
27 #include <ripple/protocol/Indexes.h>
28 #include <ripple/protocol/Rules.h>
29 #include <ripple/protocol/STArray.h>
30 #include <ripple/protocol/STObject.h>
31 #include <ripple/protocol/STTx.h>
32 #include <algorithm>
33 #include <cstdint>
34 #include <vector>
35 
36 namespace ripple {
37 
42 class SetSignerList : public Transactor
43 {
44 private:
45  // Values determined during preCompute for use later.
50 
51 public:
53 
54  explicit SetSignerList(ApplyContext& ctx) : Transactor(ctx)
55  {
56  }
57 
58  static NotTEC
59  preflight(PreflightContext const& ctx);
60 
61  TER
62  doApply() override;
63  void
64  preCompute() override;
65 
66  // Interface used by DeleteAccount
67  static TER
69  Application& app,
70  ApplyView& view,
71  AccountID const& account,
72  beast::Journal j);
73 
74 private:
75  static std::tuple<
76  NotTEC,
79  Operation>
80  determineOperation(STTx const& tx, ApplyFlags flags, beast::Journal j);
81 
82  static NotTEC
84  std::uint32_t quorum,
86  AccountID const& account,
88  Rules const&);
89 
90  TER
92  TER
94 
95  void
96  writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t flags)
97  const;
98 };
99 
100 } // namespace ripple
101 
102 #endif
ripple::SetSignerList::SetSignerList
SetSignerList(ApplyContext &ctx)
Definition: SetSignerList.h:54
ripple::SetSignerList::validateQuorumAndSignerEntries
static NotTEC validateQuorumAndSignerEntries(std::uint32_t quorum, std::vector< SignerEntries::SignerEntry > const &signers, AccountID const &account, beast::Journal j, Rules const &)
Definition: SetSignerList.cpp:244
ripple::Application
Definition: Application.h:115
ripple::Transactor::Blocker
@ Blocker
Definition: Transactor.h:101
std::shared_ptr< STLedgerEntry >
ripple::Transactor
Definition: Transactor.h:85
ripple::SetSignerList::destroySignerList
TER destroySignerList()
Definition: SetSignerList.cpp:382
vector
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:29
std::tuple
ripple::SetSignerList::Operation
Operation
Definition: SetSignerList.h:46
ripple::SetSignerList::set
@ set
Definition: SetSignerList.h:46
algorithm
ripple::ApplyView
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:134
ripple::SetSignerList
See the README.md for an overview of the SetSignerList transaction that this class implements.
Definition: SetSignerList.h:42
ripple::SetSignerList::ConsequencesFactory
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition: SetSignerList.h:52
ripple::base_uint
Integers of any length that is a multiple of 32-bits.
Definition: base_uint.h:82
ripple::Transactor::ConsequencesFactoryType
ConsequencesFactoryType
Definition: Transactor.h:101
ripple::SetSignerList::do_
Operation do_
Definition: SetSignerList.h:47
ripple::TERSubset
Definition: TER.h:340
ripple::SetSignerList::unknown
@ unknown
Definition: SetSignerList.h:46
cstdint
ripple::STTx
Definition: STTx.h:45
ripple::SetSignerList::removeFromLedger
static TER removeFromLedger(Application &app, ApplyView &view, AccountID const &account, beast::Journal j)
Definition: SetSignerList.cpp:229
ripple::ApplyContext
State information when applying a tx.
Definition: ApplyContext.h:35
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::SetSignerList::determineOperation
static std::tuple< NotTEC, std::uint32_t, std::vector< SignerEntries::SignerEntry >, Operation > determineOperation(STTx const &tx, ApplyFlags flags, beast::Journal j)
Definition: SetSignerList.cpp:45
ripple::SetSignerList::doApply
TER doApply() override
Definition: SetSignerList.cpp:117
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::SetSignerList::destroy
@ destroy
Definition: SetSignerList.h:46
ripple::SetSignerList::signers_
std::vector< SignerEntries::SignerEntry > signers_
Definition: SetSignerList.h:49
ripple::Transactor::view
ApplyView & view()
Definition: Transactor.h:107
ripple::SetSignerList::preCompute
void preCompute() override
Definition: SetSignerList.cpp:136
ripple::Rules
Rules controlling protocol behavior.
Definition: Rules.h:33
ripple::SetSignerList::replaceSignerList
TER replaceSignerList()
Definition: SetSignerList.cpp:313
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:31
ripple::SetSignerList::writeSignersToSLE
void writeSignersToSLE(SLE::pointer const &ledgerEntry, std::uint32_t flags) const
Definition: SetSignerList.cpp:402
ripple::SetSignerList::quorum_
std::uint32_t quorum_
Definition: SetSignerList.h:48
ripple::SetSignerList::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: SetSignerList.cpp:79
ripple::NotTEC
TERSubset< CanCvtToNotTEC > NotTEC
Definition: TER.h:528