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/STArray.h>
29 #include <ripple/protocol/STObject.h>
30 #include <ripple/protocol/STTx.h>
31 #include <algorithm>
32 #include <cstdint>
33 #include <vector>
34 
35 namespace ripple {
36 
41 class SetSignerList : public Transactor
42 {
43 private:
44  // Values determined during preCompute for use later.
49 
50 public:
52 
53  explicit SetSignerList(ApplyContext& ctx) : Transactor(ctx)
54  {
55  }
56 
57  static NotTEC
58  preflight(PreflightContext const& ctx);
59 
60  TER
61  doApply() override;
62  void
63  preCompute() override;
64 
65  // Interface used by DeleteAccount
66  static TER
68  Application& app,
69  ApplyView& view,
70  AccountID const& account,
71  beast::Journal j);
72 
73 private:
74  static std::tuple<
75  NotTEC,
78  Operation>
79  determineOperation(STTx const& tx, ApplyFlags flags, beast::Journal j);
80 
81  static NotTEC
83  std::uint32_t quorum,
85  AccountID const& account,
86  beast::Journal j);
87 
88  TER
90  TER
92 
93  void
94  writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t flags)
95  const;
96 };
97 
98 } // namespace ripple
99 
100 #endif
ripple::SetSignerList::SetSignerList
SetSignerList(ApplyContext &ctx)
Definition: SetSignerList.h:53
ripple::Application
Definition: Application.h:101
ripple::Transactor::Blocker
@ Blocker
Definition: Transactor.h:102
std::shared_ptr< STLedgerEntry >
ripple::Transactor
Definition: Transactor.h:86
ripple::SetSignerList::destroySignerList
TER destroySignerList()
Definition: SetSignerList.cpp:368
vector
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:30
std::tuple
ripple::SetSignerList::Operation
Operation
Definition: SetSignerList.h:45
ripple::SetSignerList::set
@ set
Definition: SetSignerList.h:45
ripple::SetSignerList::validateQuorumAndSignerEntries
static NotTEC validateQuorumAndSignerEntries(std::uint32_t quorum, std::vector< SignerEntries::SignerEntry > const &signers, AccountID const &account, beast::Journal j)
Definition: SetSignerList.cpp:238
algorithm
ripple::ApplyView
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:140
ripple::SetSignerList
See the README.md for an overview of the SetSignerList transaction that this class implements.
Definition: SetSignerList.h:41
ripple::SetSignerList::ConsequencesFactory
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition: SetSignerList.h:51
ripple::base_uint< 160, detail::AccountIDTag >
ripple::Transactor::ConsequencesFactoryType
ConsequencesFactoryType
Definition: Transactor.h:102
ripple::SetSignerList::do_
Operation do_
Definition: SetSignerList.h:46
ripple::TERSubset
Definition: TER.h:326
ripple::SetSignerList::unknown
@ unknown
Definition: SetSignerList.h:45
cstdint
ripple::STTx
Definition: STTx.h:42
ripple::SetSignerList::removeFromLedger
static TER removeFromLedger(Application &app, ApplyView &view, AccountID const &account, beast::Journal j)
Definition: SetSignerList.cpp:223
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:113
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:45
ripple::SetSignerList::signers_
std::vector< SignerEntries::SignerEntry > signers_
Definition: SetSignerList.h:48
ripple::Transactor::view
ApplyView & view()
Definition: Transactor.h:108
ripple::SetSignerList::preCompute
void preCompute() override
Definition: SetSignerList.cpp:132
ripple::SetSignerList::replaceSignerList
TER replaceSignerList()
Definition: SetSignerList.cpp:295
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:32
ripple::SetSignerList::writeSignersToSLE
void writeSignersToSLE(SLE::pointer const &ledgerEntry, std::uint32_t flags) const
Definition: SetSignerList.cpp:388
ripple::SetSignerList::quorum_
std::uint32_t quorum_
Definition: SetSignerList.h:47
ripple::SetSignerList::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: SetSignerList.cpp:79
ripple::NotTEC
TERSubset< CanCvtToNotTEC > NotTEC
Definition: TER.h:511