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:
51  explicit SetSignerList(ApplyContext& ctx) : Transactor(ctx)
52  {
53  }
54 
55  static bool
57  {
58  return true;
59  }
60 
61  static NotTEC
62  preflight(PreflightContext const& ctx);
63 
64  TER
65  doApply() override;
66  void
67  preCompute() override;
68 
69  // Interface used by DeleteAccount
70  static TER
72  Application& app,
73  ApplyView& view,
74  AccountID const& account);
75 
76 private:
77  static std::tuple<
78  NotTEC,
81  Operation>
82  determineOperation(STTx const& tx, ApplyFlags flags, beast::Journal j);
83 
84  static NotTEC
86  std::uint32_t quorum,
88  AccountID const& account,
89  beast::Journal j);
90 
91  TER
93  TER
95 
96  void
97  writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t flags)
98  const;
99 };
100 
101 } // namespace ripple
102 
103 #endif
ripple::SetSignerList::SetSignerList
SetSignerList(ApplyContext &ctx)
Definition: SetSignerList.h:51
ripple::Application
Definition: Application.h:97
std::shared_ptr< STLedgerEntry >
ripple::Transactor
Definition: Transactor.h:86
ripple::SetSignerList::destroySignerList
TER destroySignerList()
Definition: SetSignerList.cpp:360
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:235
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::base_uint
Definition: base_uint.h:63
ripple::SetSignerList::do_
Operation do_
Definition: SetSignerList.h:46
ripple::TERSubset
Definition: TER.h:322
ripple::SetSignerList::unknown
@ unknown
Definition: SetSignerList.h:45
cstdint
ripple::STTx
Definition: STTx.h:42
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:107
ripple::SetSignerList::preCompute
void preCompute() override
Definition: SetSignerList.cpp:132
ripple::SetSignerList::affectsSubsequentTransactionAuth
static bool affectsSubsequentTransactionAuth(STTx const &tx)
Definition: SetSignerList.h:56
ripple::SetSignerList::replaceSignerList
TER replaceSignerList()
Definition: SetSignerList.cpp:292
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:380
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:507
ripple::SetSignerList::removeFromLedger
static TER removeFromLedger(Application &app, ApplyView &view, AccountID const &account)
Definition: SetSignerList.cpp:221