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/Transactor.h>
25 #include <ripple/app/tx/impl/SignerEntries.h>
26 #include <ripple/protocol/STObject.h>
27 #include <ripple/protocol/STArray.h>
28 #include <ripple/protocol/STTx.h>
29 #include <ripple/protocol/Indexes.h>
30 #include <ripple/basics/Log.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)
52  : Transactor(ctx)
53  {
54  }
55 
56  static
57  bool
59  {
60  return true;
61  }
62 
63  static
64  NotTEC
65  preflight (PreflightContext const& ctx);
66 
67  TER doApply () override;
68  void preCompute() override;
69 
70  // Interface used by DeleteAccount
71  static
72  TER
74  Application& app, ApplyView& view, AccountID const& account);
75 
76 private:
77  static
80  Operation>
81  determineOperation(STTx const& tx,
82  ApplyFlags flags, beast::Journal j);
83 
84  static
86  std::uint32_t quorum,
88  AccountID const& account,
89  beast::Journal j);
90 
93 
94  void writeSignersToSLE (
95  SLE::pointer const& ledgerEntry, std::uint32_t flags) const;
96 };
97 
98 } // ripple
99 
100 #endif
ripple::SetSignerList::SetSignerList
SetSignerList(ApplyContext &ctx)
Definition: SetSignerList.h:51
ripple::Application
Definition: Application.h:85
std::shared_ptr< STLedgerEntry >
ripple::Transactor
Definition: Transactor.h:78
ripple::SetSignerList::destroySignerList
TER destroySignerList()
Definition: SetSignerList.cpp:346
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:225
algorithm
ripple::ApplyView
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:150
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:65
ripple::SetSignerList::do_
Operation do_
Definition: SetSignerList.h:46
ripple::TERSubset
Definition: TER.h:311
ripple::SetSignerList::unknown
@ unknown
Definition: SetSignerList.h:45
cstdint
ripple::STTx
Definition: STTx.h:43
ripple::ApplyContext
State information when applying a tx.
Definition: ApplyContext.h:35
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:60
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:43
ripple::SetSignerList::doApply
TER doApply() override
Definition: SetSignerList.cpp:110
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:98
ripple::SetSignerList::preCompute
void preCompute() override
Definition: SetSignerList.cpp:129
ripple::SetSignerList::affectsSubsequentTransactionAuth
static bool affectsSubsequentTransactionAuth(STTx const &tx)
Definition: SetSignerList.h:58
ripple::SetSignerList::replaceSignerList
TER replaceSignerList()
Definition: SetSignerList.cpp:283
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:366
ripple::SetSignerList::quorum_
std::uint32_t quorum_
Definition: SetSignerList.h:47
ripple::SetSignerList::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: SetSignerList.cpp:75
ripple::NotTEC
TERSubset< CanCvtToNotTEC > NotTEC
Definition: TER.h:461
ripple::SetSignerList::removeFromLedger
static TER removeFromLedger(Application &app, ApplyView &view, AccountID const &account)
Definition: SetSignerList.cpp:213