From 4674b8b542dba4cf20973c2a998ce4c0a531e142 Mon Sep 17 00:00:00 2001 From: ximinez Date: Mon, 29 Sep 2025 15:15:00 -0700 Subject: [PATCH] deploy: 550f90a75ec54a12ad340a4fec24ce5698cdfe3a --- Batch_8cpp_source.html | 4 +- Transactor_8cpp_source.html | 1397 +++++++++-------- Transactor_8h_source.html | 279 ++-- classripple_1_1AMMBid-members.html | 75 +- classripple_1_1AMMBid.html | 124 +- classripple_1_1AMMClawback-members.html | 77 +- classripple_1_1AMMClawback.html | 126 +- classripple_1_1AMMCreate-members.html | 75 +- classripple_1_1AMMCreate.html | 124 +- classripple_1_1AMMDelete-members.html | 75 +- classripple_1_1AMMDelete.html | 124 +- classripple_1_1AMMDeposit-members.html | 89 +- classripple_1_1AMMDeposit.html | 124 +- classripple_1_1AMMVote-members.html | 75 +- classripple_1_1AMMVote.html | 124 +- classripple_1_1AMMWithdraw-members.html | 95 +- classripple_1_1AMMWithdraw.html | 124 +- classripple_1_1Batch-members.html | 75 +- classripple_1_1Batch.html | 126 +- classripple_1_1BridgeModify-members.html | 75 +- classripple_1_1BridgeModify.html | 126 +- classripple_1_1CancelCheck-members.html | 75 +- classripple_1_1CancelCheck.html | 126 +- classripple_1_1CancelOffer-members.html | 75 +- classripple_1_1CancelOffer.html | 126 +- classripple_1_1CashCheck-members.html | 75 +- classripple_1_1CashCheck.html | 126 +- classripple_1_1Change-members.html | 73 +- classripple_1_1Change.html | 126 +- classripple_1_1Clawback-members.html | 77 +- classripple_1_1Clawback.html | 126 +- classripple_1_1CreateCheck-members.html | 77 +- classripple_1_1CreateCheck.html | 126 +- classripple_1_1CreateOffer-members.html | 83 +- classripple_1_1CreateOffer.html | 124 +- classripple_1_1CreateTicket-members.html | 85 +- classripple_1_1CreateTicket.html | 126 +- classripple_1_1CredentialAccept-members.html | 77 +- classripple_1_1CredentialAccept.html | 126 +- classripple_1_1CredentialCreate-members.html | 77 +- classripple_1_1CredentialCreate.html | 126 +- classripple_1_1CredentialDelete-members.html | 77 +- classripple_1_1CredentialDelete.html | 126 +- classripple_1_1DIDDelete-members.html | 81 +- classripple_1_1DIDDelete.html | 126 +- classripple_1_1DIDSet-members.html | 77 +- classripple_1_1DIDSet.html | 126 +- classripple_1_1DelegateSet-members.html | 79 +- classripple_1_1DelegateSet.html | 126 +- classripple_1_1DeleteAccount-members.html | 77 +- classripple_1_1DeleteAccount.html | 124 +- classripple_1_1DeleteOracle-members.html | 79 +- classripple_1_1DeleteOracle.html | 126 +- classripple_1_1DepositPreauth-members.html | 79 +- classripple_1_1DepositPreauth.html | 124 +- classripple_1_1EscrowCancel-members.html | 77 +- classripple_1_1EscrowCancel.html | 126 +- classripple_1_1EscrowCreate-members.html | 79 +- classripple_1_1EscrowCreate.html | 126 +- classripple_1_1EscrowFinish-members.html | 77 +- classripple_1_1EscrowFinish.html | 124 +- classripple_1_1LedgerStateFix-members.html | 81 +- classripple_1_1LedgerStateFix.html | 126 +- classripple_1_1MPTokenAuthorize-members.html | 79 +- classripple_1_1MPTokenAuthorize.html | 126 +- ...pple_1_1MPTokenIssuanceCreate-members.html | 79 +- classripple_1_1MPTokenIssuanceCreate.html | 124 +- ...ple_1_1MPTokenIssuanceDestroy-members.html | 77 +- classripple_1_1MPTokenIssuanceDestroy.html | 126 +- ...sripple_1_1MPTokenIssuanceSet-members.html | 77 +- classripple_1_1MPTokenIssuanceSet.html | 124 +- ...sripple_1_1NFTokenAcceptOffer-members.html | 81 +- classripple_1_1NFTokenAcceptOffer.html | 126 +- classripple_1_1NFTokenBurn-members.html | 77 +- classripple_1_1NFTokenBurn.html | 126 +- ...sripple_1_1NFTokenCancelOffer-members.html | 77 +- classripple_1_1NFTokenCancelOffer.html | 126 +- ...sripple_1_1NFTokenCreateOffer-members.html | 77 +- classripple_1_1NFTokenCreateOffer.html | 126 +- classripple_1_1NFTokenMint-members.html | 79 +- classripple_1_1NFTokenMint.html | 124 +- classripple_1_1NFTokenModify-members.html | 77 +- classripple_1_1NFTokenModify.html | 124 +- classripple_1_1PayChanClaim-members.html | 77 +- classripple_1_1PayChanClaim.html | 124 +- classripple_1_1PayChanCreate-members.html | 79 +- classripple_1_1PayChanCreate.html | 126 +- classripple_1_1PayChanFund-members.html | 79 +- classripple_1_1PayChanFund.html | 126 +- classripple_1_1Payment-members.html | 83 +- classripple_1_1Payment.html | 124 +- ...e_1_1PermissionedDomainDelete-members.html | 77 +- classripple_1_1PermissionedDomainDelete.html | 126 +- ...pple_1_1PermissionedDomainSet-members.html | 77 +- classripple_1_1PermissionedDomainSet.html | 124 +- classripple_1_1SetAccount-members.html | 79 +- classripple_1_1SetAccount.html | 126 +- classripple_1_1SetOracle-members.html | 77 +- classripple_1_1SetOracle.html | 126 +- classripple_1_1SetRegularKey-members.html | 77 +- classripple_1_1SetRegularKey.html | 126 +- classripple_1_1SetSignerList-members.html | 103 +- classripple_1_1SetSignerList.html | 126 +- classripple_1_1SetTrust-members.html | 77 +- classripple_1_1SetTrust.html | 126 +- classripple_1_1Transactor-members.html | 71 +- classripple_1_1Transactor.html | 128 +- classripple_1_1VaultClawback-members.html | 77 +- classripple_1_1VaultClawback.html | 126 +- classripple_1_1VaultCreate-members.html | 77 +- classripple_1_1VaultCreate.html | 124 +- classripple_1_1VaultDelete-members.html | 77 +- classripple_1_1VaultDelete.html | 126 +- classripple_1_1VaultDeposit-members.html | 77 +- classripple_1_1VaultDeposit.html | 126 +- classripple_1_1VaultSet-members.html | 77 +- classripple_1_1VaultSet.html | 124 +- classripple_1_1VaultWithdraw-members.html | 77 +- classripple_1_1VaultWithdraw.html | 126 +- ...inAddAccountCreateAttestation-members.html | 77 +- ..._1_1XChainAddAccountCreateAttestation.html | 126 +- ..._1_1XChainAddClaimAttestation-members.html | 77 +- classripple_1_1XChainAddClaimAttestation.html | 126 +- classripple_1_1XChainClaim-members.html | 77 +- classripple_1_1XChainClaim.html | 126 +- classripple_1_1XChainCommit-members.html | 79 +- classripple_1_1XChainCommit.html | 126 +- ..._1_1XChainCreateAccountCommit-members.html | 77 +- classripple_1_1XChainCreateAccountCommit.html | 126 +- ...sripple_1_1XChainCreateBridge-members.html | 77 +- classripple_1_1XChainCreateBridge.html | 126 +- ...ripple_1_1XChainCreateClaimID-members.html | 77 +- classripple_1_1XChainCreateClaimID.html | 126 +- functions_c.html | 4 +- functions_func_c.html | 8 +- namespaceripple.html | 8 +- search/all_a.js | 56 +- search/functions_3.js | 8 +- 138 files changed, 8450 insertions(+), 6555 deletions(-) diff --git a/Batch_8cpp_source.html b/Batch_8cpp_source.html index 520946bc36..2f89f546c8 100644 --- a/Batch_8cpp_source.html +++ b/Batch_8cpp_source.html @@ -544,9 +544,9 @@ $(document).ready(function() { init_codefold(0); });
Expected< void, std::string > checkBatchSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const &rules) const
Definition STTx.cpp:269
Definition TER.h:411
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
-
static NotTEC checkSign(PreclaimContext const &ctx)
+
static NotTEC checkSign(PreclaimContext const &ctx)
ApplyView & view()
Definition Transactor.h:163
-
static NotTEC checkBatchSign(PreclaimContext const &ctx)
+
static NotTEC checkBatchSign(PreclaimContext const &ctx)
Definition XRPAmount.h:43
T emplace(T... args)
diff --git a/Transactor_8cpp_source.html b/Transactor_8cpp_source.html index 70775dbdb0..c5b216c135 100644 --- a/Transactor_8cpp_source.html +++ b/Transactor_8cpp_source.html @@ -778,51 +778,51 @@ $(document).ready(function() { init_codefold(0); });
660
661NotTEC
- -
663{
-
664 auto const pkSigner = ctx.tx.getSigningPubKey();
-
665 // Ignore signature check on batch inner transactions
-
666 if (ctx.tx.isFlag(tfInnerBatchTxn) &&
-
667 ctx.view.rules().enabled(featureBatch))
-
668 {
-
669 // Defensive Check: These values are also checked in Batch::preflight
-
670 if (ctx.tx.isFieldPresent(sfTxnSignature) || !pkSigner.empty() ||
-
671 ctx.tx.isFieldPresent(sfSigners))
-
672 {
-
673 return temINVALID_FLAG; // LCOV_EXCL_LINE
-
674 }
-
675 return tesSUCCESS;
-
676 }
-
677
-
678 if ((ctx.flags & tapDRY_RUN) && pkSigner.empty() &&
-
679 !ctx.tx.isFieldPresent(sfSigners))
-
680 {
-
681 // simulate: skip signature validation when neither SigningPubKey nor
-
682 // Signers are provided
-
683 return tesSUCCESS;
-
684 }
-
685
-
686 auto const idAccount = ctx.tx[~sfDelegate].value_or(ctx.tx[sfAccount]);
-
687
-
688 // If the pk is empty and not simulate or simulate and signers,
-
689 // then we must be multi-signing.
-
690 if (ctx.tx.isFieldPresent(sfSigners))
-
691 {
-
692 STArray const& txSigners(ctx.tx.getFieldArray(sfSigners));
-
693 return checkMultiSign(ctx.view, idAccount, txSigners, ctx.flags, ctx.j);
+ +
663 PreclaimContext const& ctx,
+
664 AccountID const& idAccount,
+
665 STObject const& sigObject)
+
666{
+
667 auto const pkSigner = sigObject.getFieldVL(sfSigningPubKey);
+
668 // Ignore signature check on batch inner transactions
+
669 if (sigObject.isFlag(tfInnerBatchTxn) &&
+
670 ctx.view.rules().enabled(featureBatch))
+
671 {
+
672 // Defensive Check: These values are also checked in Batch::preflight
+
673 if (sigObject.isFieldPresent(sfTxnSignature) || !pkSigner.empty() ||
+
674 sigObject.isFieldPresent(sfSigners))
+
675 {
+
676 return temINVALID_FLAG; // LCOV_EXCL_LINE
+
677 }
+
678 return tesSUCCESS;
+
679 }
+
680
+
681 if ((ctx.flags & tapDRY_RUN) && pkSigner.empty() &&
+
682 !sigObject.isFieldPresent(sfSigners))
+
683 {
+
684 // simulate: skip signature validation when neither SigningPubKey nor
+
685 // Signers are provided
+
686 return tesSUCCESS;
+
687 }
+
688
+
689 // If the pk is empty and not simulate or simulate and signers,
+
690 // then we must be multi-signing.
+
691 if (ctx.tx.isFieldPresent(sfSigners))
+
692 {
+
693 return checkMultiSign(ctx, idAccount, sigObject);
694 }
695
696 // Check Single Sign
697 XRPL_ASSERT(
-
698 !pkSigner.empty(),
-
699 "ripple::Transactor::checkSingleSign : non-empty signer or simulation");
-
700
-
701 if (!publicKeyType(makeSlice(pkSigner)))
-
702 {
-
703 JLOG(ctx.j.trace())
-
704 << "checkSingleSign: signing public key type is unknown";
-
705 return tefBAD_AUTH; // FIXME: should be better error!
-
706 }
+
698 !pkSigner.empty(), "ripple::Transactor::checkSign : non-empty signer");
+
699
+
700 if (!publicKeyType(makeSlice(pkSigner)))
+
701 {
+
702 JLOG(ctx.j.trace()) << "checkSign: signing public key type is unknown";
+
703 return tefBAD_AUTH; // FIXME: should be better error!
+
704 }
+
705
+
706 // Look up the account.
707 auto const idSigner = pkSigner.empty()
708 ? idAccount
709 : calcAccountID(PublicKey(makeSlice(pkSigner)));
@@ -830,673 +830,682 @@ $(document).ready(function() { init_codefold(0); });
711 if (!sleAccount)
712 return terNO_ACCOUNT;
713
-
714 return checkSingleSign(
-
715 idSigner, idAccount, sleAccount, ctx.view.rules(), ctx.j);
-
716}
+
714 return checkSingleSign(ctx, idSigner, idAccount, sleAccount);
+
715}
-
717
-
718NotTEC
-
- -
720{
-
721 NotTEC ret = tesSUCCESS;
-
722 STArray const& signers{ctx.tx.getFieldArray(sfBatchSigners)};
-
723 for (auto const& signer : signers)
-
724 {
-
725 auto const idAccount = signer.getAccountID(sfAccount);
-
726
-
727 Blob const& pkSigner = signer.getFieldVL(sfSigningPubKey);
-
728 if (pkSigner.empty())
-
729 {
-
730 STArray const& txSigners(signer.getFieldArray(sfSigners));
-
731 if (ret = checkMultiSign(
-
732 ctx.view, idAccount, txSigners, ctx.flags, ctx.j);
-
733 !isTesSuccess(ret))
-
734 return ret;
-
735 }
-
736 else
+
716
+
717NotTEC
+
+ +
719{
+
720 auto const idAccount = ctx.tx.isFieldPresent(sfDelegate)
+
721 ? ctx.tx.getAccountID(sfDelegate)
+
722 : ctx.tx.getAccountID(sfAccount);
+
723 return checkSign(ctx, idAccount, ctx.tx);
+
724}
+
+
725
+
726NotTEC
+
+ +
728{
+
729 NotTEC ret = tesSUCCESS;
+
730 STArray const& signers{ctx.tx.getFieldArray(sfBatchSigners)};
+
731 for (auto const& signer : signers)
+
732 {
+
733 auto const idAccount = signer.getAccountID(sfAccount);
+
734
+
735 Blob const& pkSigner = signer.getFieldVL(sfSigningPubKey);
+
736 if (pkSigner.empty())
737 {
-
738 // LCOV_EXCL_START
-
739 if (!publicKeyType(makeSlice(pkSigner)))
-
740 return tefBAD_AUTH;
-
741 // LCOV_EXCL_STOP
-
742
-
743 auto const idSigner = calcAccountID(PublicKey(makeSlice(pkSigner)));
-
744 auto const sleAccount = ctx.view.read(keylet::account(idAccount));
-
745
-
746 // A batch can include transactions from an un-created account ONLY
-
747 // when the account master key is the signer
-
748 if (!sleAccount)
-
749 {
-
750 if (idAccount != idSigner)
-
751 return tefBAD_AUTH;
-
752
-
753 return tesSUCCESS;
-
754 }
-
755
-
756 if (ret = checkSingleSign(
-
757 idSigner, idAccount, sleAccount, ctx.view.rules(), ctx.j);
-
758 !isTesSuccess(ret))
-
759 return ret;
-
760 }
-
761 }
-
762 return ret;
-
763}
+
738 if (ret = checkMultiSign(ctx, idAccount, signer);
+
739 !isTesSuccess(ret))
+
740 return ret;
+
741 }
+
742 else
+
743 {
+
744 // LCOV_EXCL_START
+
745 if (!publicKeyType(makeSlice(pkSigner)))
+
746 return tefBAD_AUTH;
+
747 // LCOV_EXCL_STOP
+
748
+
749 auto const idSigner = calcAccountID(PublicKey(makeSlice(pkSigner)));
+
750 auto const sleAccount = ctx.view.read(keylet::account(idAccount));
+
751
+
752 // A batch can include transactions from an un-created account ONLY
+
753 // when the account master key is the signer
+
754 if (!sleAccount)
+
755 {
+
756 if (idAccount != idSigner)
+
757 return tefBAD_AUTH;
+
758
+
759 return tesSUCCESS;
+
760 }
+
761
+
762 if (ret = checkSingleSign(ctx, idSigner, idAccount, sleAccount);
+
763 !isTesSuccess(ret))
+
764 return ret;
+
765 }
+
766 }
+
767 return ret;
+
768}
-
764
-
765NotTEC
-
- -
767 AccountID const& idSigner,
-
768 AccountID const& idAccount,
- -
770 Rules const& rules,
- -
772{
-
773 bool const isMasterDisabled = sleAccount->isFlag(lsfDisableMaster);
-
774
-
775 if (rules.enabled(fixMasterKeyAsRegularKey))
-
776 {
-
777 // Signed with regular key.
-
778 if ((*sleAccount)[~sfRegularKey] == idSigner)
-
779 {
-
780 return tesSUCCESS;
-
781 }
-
782
-
783 // Signed with enabled mater key.
-
784 if (!isMasterDisabled && idAccount == idSigner)
-
785 {
-
786 return tesSUCCESS;
-
787 }
-
788
-
789 // Signed with disabled master key.
-
790 if (isMasterDisabled && idAccount == idSigner)
-
791 {
-
792 return tefMASTER_DISABLED;
-
793 }
-
794
-
795 // Signed with any other key.
-
796 return tefBAD_AUTH;
-
797 }
+
769
+
770NotTEC
+
+ +
772 PreclaimContext const& ctx,
+
773 AccountID const& idSigner,
+
774 AccountID const& idAccount,
+ +
776{
+
777 bool const isMasterDisabled = sleAccount->isFlag(lsfDisableMaster);
+
778
+
779 if (ctx.view.rules().enabled(fixMasterKeyAsRegularKey))
+
780 {
+
781 // Signed with regular key.
+
782 if ((*sleAccount)[~sfRegularKey] == idSigner)
+
783 {
+
784 return tesSUCCESS;
+
785 }
+
786
+
787 // Signed with enabled mater key.
+
788 if (!isMasterDisabled && idAccount == idSigner)
+
789 {
+
790 return tesSUCCESS;
+
791 }
+
792
+
793 // Signed with disabled master key.
+
794 if (isMasterDisabled && idAccount == idSigner)
+
795 {
+
796 return tefMASTER_DISABLED;
+
797 }
798
-
799 if (idSigner == idAccount)
-
800 {
-
801 // Signing with the master key. Continue if it is not disabled.
-
802 if (isMasterDisabled)
-
803 return tefMASTER_DISABLED;
-
804 }
-
805 else if ((*sleAccount)[~sfRegularKey] == idSigner)
-
806 {
-
807 // Signing with the regular key. Continue.
+
799 // Signed with any other key.
+
800 return tefBAD_AUTH;
+
801 }
+
802
+
803 if (idSigner == idAccount)
+
804 {
+
805 // Signing with the master key. Continue if it is not disabled.
+
806 if (isMasterDisabled)
+
807 return tefMASTER_DISABLED;
808 }
-
809 else if (sleAccount->isFieldPresent(sfRegularKey))
+
809 else if ((*sleAccount)[~sfRegularKey] == idSigner)
810 {
-
811 // Signing key does not match master or regular key.
-
812 JLOG(j.trace()) << "checkSingleSign: Not authorized to use account.";
-
813 return tefBAD_AUTH;
-
814 }
-
815 else
-
816 {
-
817 // No regular key on account and signing key does not match master key.
-
818 // FIXME: Why differentiate this case from tefBAD_AUTH?
-
819 JLOG(j.trace()) << "checkSingleSign: Not authorized to use account.";
-
820 return tefBAD_AUTH_MASTER;
-
821 }
-
822
-
823 return tesSUCCESS;
-
824}
+
811 // Signing with the regular key. Continue.
+
812 }
+
813 else if (sleAccount->isFieldPresent(sfRegularKey))
+
814 {
+
815 // Signing key does not match master or regular key.
+
816 JLOG(ctx.j.trace())
+
817 << "checkSingleSign: Not authorized to use account.";
+
818 return tefBAD_AUTH;
+
819 }
+
820 else
+
821 {
+
822 // No regular key on account and signing key does not match master key.
+
823 // FIXME: Why differentiate this case from tefBAD_AUTH?
+
824 JLOG(ctx.j.trace())
+
825 << "checkSingleSign: Not authorized to use account.";
+
826 return tefBAD_AUTH_MASTER;
+
827 }
+
828
+
829 return tesSUCCESS;
+
830}
-
825
-
826NotTEC
-
- -
828 ReadView const& view,
-
829 AccountID const& id,
-
830 STArray const& txSigners,
-
831 ApplyFlags const& flags,
- -
833{
-
834 // Get mTxnAccountID's SignerList and Quorum.
-
835 std::shared_ptr<STLedgerEntry const> sleAccountSigners =
- -
837 // If the signer list doesn't exist the account is not multi-signing.
-
838 if (!sleAccountSigners)
-
839 {
-
840 JLOG(j.trace())
-
841 << "applyTransaction: Invalid: Not a multi-signing account.";
- -
843 }
-
844
-
845 // We have plans to support multiple SignerLists in the future. The
-
846 // presence and defaulted value of the SignerListID field will enable that.
-
847 XRPL_ASSERT(
-
848 sleAccountSigners->isFieldPresent(sfSignerListID),
-
849 "ripple::Transactor::checkMultiSign : has signer list ID");
-
850 XRPL_ASSERT(
-
851 sleAccountSigners->getFieldU32(sfSignerListID) == 0,
-
852 "ripple::Transactor::checkMultiSign : signer list ID is 0");
-
853
-
854 auto accountSigners =
-
855 SignerEntries::deserialize(*sleAccountSigners, j, "ledger");
-
856 if (!accountSigners)
-
857 return accountSigners.error();
-
858
-
859 // Get the array of transaction signers.
-
860
-
861 // Walk the accountSigners performing a variety of checks and see if
-
862 // the quorum is met.
-
863
-
864 // Both the multiSigners and accountSigners are sorted by account. So
-
865 // matching multi-signers to account signers should be a simple
-
866 // linear walk. *All* signers must be valid or the transaction fails.
-
867 std::uint32_t weightSum = 0;
-
868 auto iter = accountSigners->begin();
-
869 for (auto const& txSigner : txSigners)
-
870 {
-
871 AccountID const txSignerAcctID = txSigner.getAccountID(sfAccount);
-
872
-
873 // Attempt to match the SignerEntry with a Signer;
-
874 while (iter->account < txSignerAcctID)
-
875 {
-
876 if (++iter == accountSigners->end())
-
877 {
-
878 JLOG(j.trace())
-
879 << "applyTransaction: Invalid SigningAccount.Account.";
-
880 return tefBAD_SIGNATURE;
-
881 }
-
882 }
-
883 if (iter->account != txSignerAcctID)
-
884 {
-
885 // The SigningAccount is not in the SignerEntries.
-
886 JLOG(j.trace())
-
887 << "applyTransaction: Invalid SigningAccount.Account.";
-
888 return tefBAD_SIGNATURE;
-
889 }
-
890
-
891 // We found the SigningAccount in the list of valid signers. Now we
-
892 // need to compute the accountID that is associated with the signer's
-
893 // public key.
-
894 auto const spk = txSigner.getFieldVL(sfSigningPubKey);
+
831
+
832NotTEC
+
+ +
834 PreclaimContext const& ctx,
+
835 AccountID const& id,
+
836 STObject const& sigObject)
+
837{
+
838 // Get id's SignerList and Quorum.
+
839 std::shared_ptr<STLedgerEntry const> sleAccountSigners =
+
840 ctx.view.read(keylet::signers(id));
+
841 // If the signer list doesn't exist the account is not multi-signing.
+
842 if (!sleAccountSigners)
+
843 {
+
844 JLOG(ctx.j.trace())
+
845 << "applyTransaction: Invalid: Not a multi-signing account.";
+ +
847 }
+
848
+
849 // We have plans to support multiple SignerLists in the future. The
+
850 // presence and defaulted value of the SignerListID field will enable that.
+
851 XRPL_ASSERT(
+
852 sleAccountSigners->isFieldPresent(sfSignerListID),
+
853 "ripple::Transactor::checkMultiSign : has signer list ID");
+
854 XRPL_ASSERT(
+
855 sleAccountSigners->getFieldU32(sfSignerListID) == 0,
+
856 "ripple::Transactor::checkMultiSign : signer list ID is 0");
+
857
+
858 auto accountSigners =
+
859 SignerEntries::deserialize(*sleAccountSigners, ctx.j, "ledger");
+
860 if (!accountSigners)
+
861 return accountSigners.error();
+
862
+
863 // Get the array of transaction signers.
+
864 STArray const& txSigners(sigObject.getFieldArray(sfSigners));
+
865
+
866 // Walk the accountSigners performing a variety of checks and see if
+
867 // the quorum is met.
+
868
+
869 // Both the multiSigners and accountSigners are sorted by account. So
+
870 // matching multi-signers to account signers should be a simple
+
871 // linear walk. *All* signers must be valid or the transaction fails.
+
872 std::uint32_t weightSum = 0;
+
873 auto iter = accountSigners->begin();
+
874 for (auto const& txSigner : txSigners)
+
875 {
+
876 AccountID const txSignerAcctID = txSigner.getAccountID(sfAccount);
+
877
+
878 // Attempt to match the SignerEntry with a Signer;
+
879 while (iter->account < txSignerAcctID)
+
880 {
+
881 if (++iter == accountSigners->end())
+
882 {
+
883 JLOG(ctx.j.trace())
+
884 << "applyTransaction: Invalid SigningAccount.Account.";
+
885 return tefBAD_SIGNATURE;
+
886 }
+
887 }
+
888 if (iter->account != txSignerAcctID)
+
889 {
+
890 // The SigningAccount is not in the SignerEntries.
+
891 JLOG(ctx.j.trace())
+
892 << "applyTransaction: Invalid SigningAccount.Account.";
+
893 return tefBAD_SIGNATURE;
+
894 }
895
-
896 // spk being non-empty in non-simulate is checked in
-
897 // STTx::checkMultiSign
-
898 if (!spk.empty() && !publicKeyType(makeSlice(spk)))
-
899 {
-
900 JLOG(j.trace())
-
901 << "checkMultiSign: signing public key type is unknown";
-
902 return tefBAD_SIGNATURE;
-
903 }
-
904
-
905 XRPL_ASSERT(
-
906 (flags & tapDRY_RUN) || !spk.empty(),
-
907 "ripple::Transactor::checkMultiSign : non-empty signer or "
-
908 "simulation");
-
909 AccountID const signingAcctIDFromPubKey = spk.empty()
-
910 ? txSignerAcctID
- -
912
-
913 // Verify that the signingAcctID and the signingAcctIDFromPubKey
-
914 // belong together. Here are the rules:
-
915 //
-
916 // 1. "Phantom account": an account that is not in the ledger
-
917 // A. If signingAcctID == signingAcctIDFromPubKey and the
-
918 // signingAcctID is not in the ledger then we have a phantom
-
919 // account.
-
920 // B. Phantom accounts are always allowed as multi-signers.
-
921 //
-
922 // 2. "Master Key"
-
923 // A. signingAcctID == signingAcctIDFromPubKey, and signingAcctID
-
924 // is in the ledger.
-
925 // B. If the signingAcctID in the ledger does not have the
-
926 // asfDisableMaster flag set, then the signature is allowed.
-
927 //
-
928 // 3. "Regular Key"
-
929 // A. signingAcctID != signingAcctIDFromPubKey, and signingAcctID
-
930 // is in the ledger.
-
931 // B. If signingAcctIDFromPubKey == signingAcctID.RegularKey (from
-
932 // ledger) then the signature is allowed.
-
933 //
-
934 // No other signatures are allowed. (January 2015)
-
935
-
936 // In any of these cases we need to know whether the account is in
-
937 // the ledger. Determine that now.
-
938 auto const sleTxSignerRoot = view.read(keylet::account(txSignerAcctID));
-
939
-
940 if (signingAcctIDFromPubKey == txSignerAcctID)
-
941 {
-
942 // Either Phantom or Master. Phantoms automatically pass.
-
943 if (sleTxSignerRoot)
-
944 {
-
945 // Master Key. Account may not have asfDisableMaster set.
-
946 std::uint32_t const signerAccountFlags =
-
947 sleTxSignerRoot->getFieldU32(sfFlags);
-
948
-
949 if (signerAccountFlags & lsfDisableMaster)
-
950 {
-
951 JLOG(j.trace())
-
952 << "applyTransaction: Signer:Account lsfDisableMaster.";
-
953 return tefMASTER_DISABLED;
-
954 }
-
955 }
-
956 }
-
957 else
-
958 {
-
959 // May be a Regular Key. Let's find out.
-
960 // Public key must hash to the account's regular key.
-
961 if (!sleTxSignerRoot)
-
962 {
-
963 JLOG(j.trace()) << "applyTransaction: Non-phantom signer "
-
964 "lacks account root.";
-
965 return tefBAD_SIGNATURE;
-
966 }
-
967
-
968 if (!sleTxSignerRoot->isFieldPresent(sfRegularKey))
-
969 {
-
970 JLOG(j.trace())
-
971 << "applyTransaction: Account lacks RegularKey.";
-
972 return tefBAD_SIGNATURE;
-
973 }
-
974 if (signingAcctIDFromPubKey !=
-
975 sleTxSignerRoot->getAccountID(sfRegularKey))
-
976 {
-
977 JLOG(j.trace())
-
978 << "applyTransaction: Account doesn't match RegularKey.";
-
979 return tefBAD_SIGNATURE;
-
980 }
-
981 }
-
982 // The signer is legitimate. Add their weight toward the quorum.
-
983 weightSum += iter->weight;
-
984 }
-
985
-
986 // Cannot perform transaction if quorum is not met.
-
987 if (weightSum < sleAccountSigners->getFieldU32(sfSignerQuorum))
-
988 {
-
989 JLOG(j.trace()) << "applyTransaction: Signers failed to meet quorum.";
-
990 return tefBAD_QUORUM;
-
991 }
-
992
-
993 // Met the quorum. Continue.
-
994 return tesSUCCESS;
-
995}
+
896 // We found the SigningAccount in the list of valid signers. Now we
+
897 // need to compute the accountID that is associated with the signer's
+
898 // public key.
+
899 auto const spk = txSigner.getFieldVL(sfSigningPubKey);
+
900
+
901 // spk being non-empty in non-simulate is checked in
+
902 // STTx::checkMultiSign
+
903 if (!spk.empty() && !publicKeyType(makeSlice(spk)))
+
904 {
+
905 JLOG(ctx.j.trace())
+
906 << "checkMultiSign: signing public key type is unknown";
+
907 return tefBAD_SIGNATURE;
+
908 }
+
909
+
910 XRPL_ASSERT(
+
911 (ctx.flags & tapDRY_RUN) || !spk.empty(),
+
912 "ripple::Transactor::checkMultiSign : non-empty signer or "
+
913 "simulation");
+
914 AccountID const signingAcctIDFromPubKey = spk.empty()
+
915 ? txSignerAcctID
+ +
917
+
918 // Verify that the signingAcctID and the signingAcctIDFromPubKey
+
919 // belong together. Here are the rules:
+
920 //
+
921 // 1. "Phantom account": an account that is not in the ledger
+
922 // A. If signingAcctID == signingAcctIDFromPubKey and the
+
923 // signingAcctID is not in the ledger then we have a phantom
+
924 // account.
+
925 // B. Phantom accounts are always allowed as multi-signers.
+
926 //
+
927 // 2. "Master Key"
+
928 // A. signingAcctID == signingAcctIDFromPubKey, and signingAcctID
+
929 // is in the ledger.
+
930 // B. If the signingAcctID in the ledger does not have the
+
931 // asfDisableMaster flag set, then the signature is allowed.
+
932 //
+
933 // 3. "Regular Key"
+
934 // A. signingAcctID != signingAcctIDFromPubKey, and signingAcctID
+
935 // is in the ledger.
+
936 // B. If signingAcctIDFromPubKey == signingAcctID.RegularKey (from
+
937 // ledger) then the signature is allowed.
+
938 //
+
939 // No other signatures are allowed. (January 2015)
+
940
+
941 // In any of these cases we need to know whether the account is in
+
942 // the ledger. Determine that now.
+
943 auto const sleTxSignerRoot =
+
944 ctx.view.read(keylet::account(txSignerAcctID));
+
945
+
946 if (signingAcctIDFromPubKey == txSignerAcctID)
+
947 {
+
948 // Either Phantom or Master. Phantoms automatically pass.
+
949 if (sleTxSignerRoot)
+
950 {
+
951 // Master Key. Account may not have asfDisableMaster set.
+
952 std::uint32_t const signerAccountFlags =
+
953 sleTxSignerRoot->getFieldU32(sfFlags);
+
954
+
955 if (signerAccountFlags & lsfDisableMaster)
+
956 {
+
957 JLOG(ctx.j.trace())
+
958 << "applyTransaction: Signer:Account lsfDisableMaster.";
+
959 return tefMASTER_DISABLED;
+
960 }
+
961 }
+
962 }
+
963 else
+
964 {
+
965 // May be a Regular Key. Let's find out.
+
966 // Public key must hash to the account's regular key.
+
967 if (!sleTxSignerRoot)
+
968 {
+
969 JLOG(ctx.j.trace()) << "applyTransaction: Non-phantom signer "
+
970 "lacks account root.";
+
971 return tefBAD_SIGNATURE;
+
972 }
+
973
+
974 if (!sleTxSignerRoot->isFieldPresent(sfRegularKey))
+
975 {
+
976 JLOG(ctx.j.trace())
+
977 << "applyTransaction: Account lacks RegularKey.";
+
978 return tefBAD_SIGNATURE;
+
979 }
+
980 if (signingAcctIDFromPubKey !=
+
981 sleTxSignerRoot->getAccountID(sfRegularKey))
+
982 {
+
983 JLOG(ctx.j.trace())
+
984 << "applyTransaction: Account doesn't match RegularKey.";
+
985 return tefBAD_SIGNATURE;
+
986 }
+
987 }
+
988 // The signer is legitimate. Add their weight toward the quorum.
+
989 weightSum += iter->weight;
+
990 }
+
991
+
992 // Cannot perform transaction if quorum is not met.
+
993 if (weightSum < sleAccountSigners->getFieldU32(sfSignerQuorum))
+
994 {
+
995 JLOG(ctx.j.trace())
+
996 << "applyTransaction: Signers failed to meet quorum.";
+
997 return tefBAD_QUORUM;
+
998 }
+
999
+
1000 // Met the quorum. Continue.
+
1001 return tesSUCCESS;
+
1002}
-
996
-
997//------------------------------------------------------------------------------
-
998
-
999static void
-
- -
1001 ApplyView& view,
-
1002 std::vector<uint256> const& offers,
-
1003 beast::Journal viewJ)
-
1004{
-
1005 int removed = 0;
-
1006
-
1007 for (auto const& index : offers)
-
1008 {
-
1009 if (auto const sleOffer = view.peek(keylet::offer(index)))
-
1010 {
-
1011 // offer is unfunded
-
1012 offerDelete(view, sleOffer, viewJ);
-
1013 if (++removed == unfundedOfferRemoveLimit)
-
1014 return;
-
1015 }
-
1016 }
-
1017}
+
1003
+
1004//------------------------------------------------------------------------------
+
1005
+
1006static void
+
+ +
1008 ApplyView& view,
+
1009 std::vector<uint256> const& offers,
+
1010 beast::Journal viewJ)
+
1011{
+
1012 int removed = 0;
+
1013
+
1014 for (auto const& index : offers)
+
1015 {
+
1016 if (auto const sleOffer = view.peek(keylet::offer(index)))
+
1017 {
+
1018 // offer is unfunded
+
1019 offerDelete(view, sleOffer, viewJ);
+
1020 if (++removed == unfundedOfferRemoveLimit)
+
1021 return;
+
1022 }
+
1023 }
+
1024}
-
1018
-
1019static void
-
- -
1021 ApplyView& view,
-
1022 std::vector<uint256> const& offers,
-
1023 beast::Journal viewJ)
-
1024{
-
1025 std::size_t removed = 0;
-
1026
-
1027 for (auto const& index : offers)
-
1028 {
-
1029 if (auto const offer = view.peek(keylet::nftoffer(index)))
-
1030 {
-
1031 nft::deleteTokenOffer(view, offer);
-
1032 if (++removed == expiredOfferRemoveLimit)
-
1033 return;
-
1034 }
-
1035 }
-
1036}
+
1025
+
1026static void
+
+ +
1028 ApplyView& view,
+
1029 std::vector<uint256> const& offers,
+
1030 beast::Journal viewJ)
+
1031{
+
1032 std::size_t removed = 0;
+
1033
+
1034 for (auto const& index : offers)
+
1035 {
+
1036 if (auto const offer = view.peek(keylet::nftoffer(index)))
+
1037 {
+
1038 nft::deleteTokenOffer(view, offer);
+
1039 if (++removed == expiredOfferRemoveLimit)
+
1040 return;
+
1041 }
+
1042 }
+
1043}
-
1037
-
1038static void
-
- -
1040 ApplyView& view,
-
1041 std::vector<uint256> const& creds,
-
1042 beast::Journal viewJ)
-
1043{
-
1044 for (auto const& index : creds)
-
1045 {
-
1046 if (auto const sle = view.peek(keylet::credential(index)))
-
1047 credentials::deleteSLE(view, sle, viewJ);
-
1048 }
-
1049}
+
1044
+
1045static void
+
+ +
1047 ApplyView& view,
+
1048 std::vector<uint256> const& creds,
+
1049 beast::Journal viewJ)
+
1050{
+
1051 for (auto const& index : creds)
+
1052 {
+
1053 if (auto const sle = view.peek(keylet::credential(index)))
+
1054 credentials::deleteSLE(view, sle, viewJ);
+
1055 }
+
1056}
-
1050
-
1051static void
-
- -
1053 ApplyView& view,
-
1054 std::vector<uint256> const& trustLines,
-
1055 beast::Journal viewJ)
-
1056{
-
1057 if (trustLines.size() > maxDeletableAMMTrustLines)
-
1058 {
-
1059 JLOG(viewJ.error())
-
1060 << "removeDeletedTrustLines: deleted trustlines exceed max "
-
1061 << trustLines.size();
-
1062 return;
-
1063 }
-
1064
-
1065 for (auto const& index : trustLines)
-
1066 {
-
1067 if (auto const sleState = view.peek({ltRIPPLE_STATE, index});
-
1068 deleteAMMTrustLine(view, sleState, std::nullopt, viewJ) !=
-
1069 tesSUCCESS)
-
1070 {
-
1071 JLOG(viewJ.error())
-
1072 << "removeDeletedTrustLines: failed to delete AMM trustline";
-
1073 }
-
1074 }
-
1075}
+
1057
+
1058static void
+
+ +
1060 ApplyView& view,
+
1061 std::vector<uint256> const& trustLines,
+
1062 beast::Journal viewJ)
+
1063{
+
1064 if (trustLines.size() > maxDeletableAMMTrustLines)
+
1065 {
+
1066 JLOG(viewJ.error())
+
1067 << "removeDeletedTrustLines: deleted trustlines exceed max "
+
1068 << trustLines.size();
+
1069 return;
+
1070 }
+
1071
+
1072 for (auto const& index : trustLines)
+
1073 {
+
1074 if (auto const sleState = view.peek({ltRIPPLE_STATE, index});
+
1075 deleteAMMTrustLine(view, sleState, std::nullopt, viewJ) !=
+
1076 tesSUCCESS)
+
1077 {
+
1078 JLOG(viewJ.error())
+
1079 << "removeDeletedTrustLines: failed to delete AMM trustline";
+
1080 }
+
1081 }
+
1082}
-
1076
- -
- -
1084{
-
1085 ctx_.discard();
-
1086
-
1087 auto const txnAcct =
- -
1089
-
1090 // The account should never be missing from the ledger. But if it
-
1091 // is missing then we can't very well charge it a fee, can we?
-
1092 if (!txnAcct)
-
1093 return {tefINTERNAL, beast::zero};
-
1094
-
1095 auto const payerSle = ctx_.tx.isFieldPresent(sfDelegate)
-
1096 ? view().peek(keylet::account(ctx_.tx.getAccountID(sfDelegate)))
-
1097 : txnAcct;
-
1098 if (!payerSle)
-
1099 return {tefINTERNAL, beast::zero}; // LCOV_EXCL_LINE
-
1100
-
1101 auto const balance = payerSle->getFieldAmount(sfBalance).xrp();
-
1102
-
1103 // balance should have already been checked in checkFee / preFlight.
-
1104 XRPL_ASSERT(
-
1105 balance != beast::zero && (!view().open() || balance >= fee),
-
1106 "ripple::Transactor::reset : valid balance");
+
1083
+ +
+ +
1091{
+
1092 ctx_.discard();
+
1093
+
1094 auto const txnAcct =
+ +
1096
+
1097 // The account should never be missing from the ledger. But if it
+
1098 // is missing then we can't very well charge it a fee, can we?
+
1099 if (!txnAcct)
+
1100 return {tefINTERNAL, beast::zero};
+
1101
+
1102 auto const payerSle = ctx_.tx.isFieldPresent(sfDelegate)
+
1103 ? view().peek(keylet::account(ctx_.tx.getAccountID(sfDelegate)))
+
1104 : txnAcct;
+
1105 if (!payerSle)
+
1106 return {tefINTERNAL, beast::zero}; // LCOV_EXCL_LINE
1107
-
1108 // We retry/reject the transaction if the account balance is zero or
-
1109 // we're applying against an open ledger and the balance is less than
-
1110 // the fee
-
1111 if (fee > balance)
-
1112 fee = balance;
-
1113
-
1114 // Since we reset the context, we need to charge the fee and update
-
1115 // the account's sequence number (or consume the Ticket) again.
-
1116 //
-
1117 // If for some reason we are unable to consume the ticket or sequence
-
1118 // then the ledger is corrupted. Rather than make things worse we
-
1119 // reject the transaction.
-
1120 payerSle->setFieldAmount(sfBalance, balance - fee);
-
1121 TER const ter{consumeSeqProxy(txnAcct)};
-
1122 XRPL_ASSERT(
-
1123 isTesSuccess(ter), "ripple::Transactor::reset : result is tesSUCCESS");
-
1124
-
1125 if (isTesSuccess(ter))
-
1126 {
-
1127 view().update(txnAcct);
-
1128 if (payerSle != txnAcct)
-
1129 view().update(payerSle);
-
1130 }
+
1108 auto const balance = payerSle->getFieldAmount(sfBalance).xrp();
+
1109
+
1110 // balance should have already been checked in checkFee / preFlight.
+
1111 XRPL_ASSERT(
+
1112 balance != beast::zero && (!view().open() || balance >= fee),
+
1113 "ripple::Transactor::reset : valid balance");
+
1114
+
1115 // We retry/reject the transaction if the account balance is zero or
+
1116 // we're applying against an open ledger and the balance is less than
+
1117 // the fee
+
1118 if (fee > balance)
+
1119 fee = balance;
+
1120
+
1121 // Since we reset the context, we need to charge the fee and update
+
1122 // the account's sequence number (or consume the Ticket) again.
+
1123 //
+
1124 // If for some reason we are unable to consume the ticket or sequence
+
1125 // then the ledger is corrupted. Rather than make things worse we
+
1126 // reject the transaction.
+
1127 payerSle->setFieldAmount(sfBalance, balance - fee);
+
1128 TER const ter{consumeSeqProxy(txnAcct)};
+
1129 XRPL_ASSERT(
+
1130 isTesSuccess(ter), "ripple::Transactor::reset : result is tesSUCCESS");
1131
-
1132 return {ter, fee};
-
1133}
+
1132 if (isTesSuccess(ter))
+
1133 {
+
1134 view().update(txnAcct);
+
1135 if (payerSle != txnAcct)
+
1136 view().update(payerSle);
+
1137 }
+
1138
+
1139 return {ter, fee};
+
1140}
-
1134
-
1135// The sole purpose of this function is to provide a convenient, named
-
1136// location to set a breakpoint, to be used when replaying transactions.
-
1137void
-
- -
1139{
-
1140 JLOG(j_.debug()) << "Transaction trapped: " << txHash;
-
1141}
-
-
1142
-
1143//------------------------------------------------------------------------------
- +
1141
+
1142// The sole purpose of this function is to provide a convenient, named
+
1143// location to set a breakpoint, to be used when replaying transactions.
+
1144void
- -
1146{
-
1147 JLOG(j_.trace()) << "apply: " << ctx_.tx.getTransactionID();
-
1148
-
1149 // raii classes for the current ledger rules. fixSTAmountCanonicalize and
-
1150 // fixSTAmountCanonicalize predate the rulesGuard and should be replaced.
-
1151 STAmountSO stAmountSO{view().rules().enabled(fixSTAmountCanonicalize)};
-
1152 NumberSO stNumberSO{view().rules().enabled(fixUniversalNumber)};
-
1153 CurrentTransactionRulesGuard currentTransctionRulesGuard(view().rules());
-
1154
-
1155#ifdef DEBUG
-
1156 {
-
1157 Serializer ser;
-
1158 ctx_.tx.add(ser);
-
1159 SerialIter sit(ser.slice());
-
1160 STTx s2(sit);
+ +
1146{
+
1147 JLOG(j_.debug()) << "Transaction trapped: " << txHash;
+
1148}
+
+
1149
+
1150//------------------------------------------------------------------------------
+ +
+ +
1153{
+
1154 JLOG(j_.trace()) << "apply: " << ctx_.tx.getTransactionID();
+
1155
+
1156 // raii classes for the current ledger rules. fixSTAmountCanonicalize and
+
1157 // fixSTAmountCanonicalize predate the rulesGuard and should be replaced.
+
1158 STAmountSO stAmountSO{view().rules().enabled(fixSTAmountCanonicalize)};
+
1159 NumberSO stNumberSO{view().rules().enabled(fixUniversalNumber)};
+
1160 CurrentTransactionRulesGuard currentTransctionRulesGuard(view().rules());
1161
-
1162 if (!s2.isEquivalent(ctx_.tx))
-
1163 {
-
1164 JLOG(j_.fatal()) << "Transaction serdes mismatch";
- -
1166 JLOG(j_.fatal()) << s2.getJson(JsonOptions::none);
-
1167 UNREACHABLE(
-
1168 "ripple::Transactor::operator() : transaction serdes mismatch");
-
1169 }
-
1170 }
-
1171#endif
-
1172
-
1173 if (auto const& trap = ctx_.app.trapTxID();
-
1174 trap && *trap == ctx_.tx.getTransactionID())
-
1175 {
-
1176 trapTransaction(*trap);
+
1162#ifdef DEBUG
+
1163 {
+
1164 Serializer ser;
+
1165 ctx_.tx.add(ser);
+
1166 SerialIter sit(ser.slice());
+
1167 STTx s2(sit);
+
1168
+
1169 if (!s2.isEquivalent(ctx_.tx))
+
1170 {
+
1171 JLOG(j_.fatal()) << "Transaction serdes mismatch";
+ +
1173 JLOG(j_.fatal()) << s2.getJson(JsonOptions::none);
+
1174 UNREACHABLE(
+
1175 "ripple::Transactor::operator() : transaction serdes mismatch");
+
1176 }
1177 }
-
1178
-
1179 auto result = ctx_.preclaimResult;
-
1180 if (result == tesSUCCESS)
-
1181 result = apply();
-
1182
-
1183 // No transaction can return temUNKNOWN from apply,
-
1184 // and it can't be passed in from a preclaim.
-
1185 XRPL_ASSERT(
-
1186 result != temUNKNOWN,
-
1187 "ripple::Transactor::operator() : result is not temUNKNOWN");
-
1188
-
1189 if (auto stream = j_.trace())
-
1190 stream << "preclaim result: " << transToken(result);
-
1191
-
1192 bool applied = isTesSuccess(result);
-
1193 auto fee = ctx_.tx.getFieldAmount(sfFee).xrp();
-
1194
- -
1196 result = tecOVERSIZE;
-
1197
-
1198 if (isTecClaim(result) && (view().flags() & tapFAIL_HARD))
-
1199 {
-
1200 // If the tapFAIL_HARD flag is set, a tec result
-
1201 // must not do anything
-
1202 ctx_.discard();
-
1203 applied = false;
-
1204 }
-
1205 else if (
-
1206 (result == tecOVERSIZE) || (result == tecKILLED) ||
-
1207 (result == tecINCOMPLETE) || (result == tecEXPIRED) ||
-
1208 (isTecClaimHardFail(result, view().flags())))
-
1209 {
-
1210 JLOG(j_.trace()) << "reapplying because of " << transToken(result);
-
1211
-
1212 // FIXME: This mechanism for doing work while returning a `tec` is
-
1213 // awkward and very limiting. A more general purpose approach
-
1214 // should be used, making it possible to do more useful work
-
1215 // when transactions fail with a `tec` code.
-
1216 std::vector<uint256> removedOffers;
-
1217 std::vector<uint256> removedTrustLines;
-
1218 std::vector<uint256> expiredNFTokenOffers;
-
1219 std::vector<uint256> expiredCredentials;
-
1220
-
1221 bool const doOffers =
-
1222 ((result == tecOVERSIZE) || (result == tecKILLED));
-
1223 bool const doLines = (result == tecINCOMPLETE);
-
1224 bool const doNFTokenOffers = (result == tecEXPIRED);
-
1225 bool const doCredentials = (result == tecEXPIRED);
-
1226 if (doOffers || doLines || doNFTokenOffers || doCredentials)
-
1227 {
-
1228 ctx_.visit([doOffers,
-
1229 &removedOffers,
-
1230 doLines,
-
1231 &removedTrustLines,
-
1232 doNFTokenOffers,
-
1233 &expiredNFTokenOffers,
-
1234 doCredentials,
-
1235 &expiredCredentials](
-
1236 uint256 const& index,
-
1237 bool isDelete,
-
1238 std::shared_ptr<SLE const> const& before,
- -
1240 if (isDelete)
-
1241 {
-
1242 XRPL_ASSERT(
-
1243 before && after,
-
1244 "ripple::Transactor::operator()::visit : non-null SLE "
-
1245 "inputs");
-
1246 if (doOffers && before && after &&
-
1247 (before->getType() == ltOFFER) &&
-
1248 (before->getFieldAmount(sfTakerPays) ==
-
1249 after->getFieldAmount(sfTakerPays)))
-
1250 {
-
1251 // Removal of offer found or made unfunded
-
1252 removedOffers.push_back(index);
-
1253 }
-
1254
-
1255 if (doLines && before && after &&
-
1256 (before->getType() == ltRIPPLE_STATE))
+
1178#endif
+
1179
+
1180 if (auto const& trap = ctx_.app.trapTxID();
+
1181 trap && *trap == ctx_.tx.getTransactionID())
+
1182 {
+
1183 trapTransaction(*trap);
+
1184 }
+
1185
+
1186 auto result = ctx_.preclaimResult;
+
1187 if (result == tesSUCCESS)
+
1188 result = apply();
+
1189
+
1190 // No transaction can return temUNKNOWN from apply,
+
1191 // and it can't be passed in from a preclaim.
+
1192 XRPL_ASSERT(
+
1193 result != temUNKNOWN,
+
1194 "ripple::Transactor::operator() : result is not temUNKNOWN");
+
1195
+
1196 if (auto stream = j_.trace())
+
1197 stream << "preclaim result: " << transToken(result);
+
1198
+
1199 bool applied = isTesSuccess(result);
+
1200 auto fee = ctx_.tx.getFieldAmount(sfFee).xrp();
+
1201
+ +
1203 result = tecOVERSIZE;
+
1204
+
1205 if (isTecClaim(result) && (view().flags() & tapFAIL_HARD))
+
1206 {
+
1207 // If the tapFAIL_HARD flag is set, a tec result
+
1208 // must not do anything
+
1209 ctx_.discard();
+
1210 applied = false;
+
1211 }
+
1212 else if (
+
1213 (result == tecOVERSIZE) || (result == tecKILLED) ||
+
1214 (result == tecINCOMPLETE) || (result == tecEXPIRED) ||
+
1215 (isTecClaimHardFail(result, view().flags())))
+
1216 {
+
1217 JLOG(j_.trace()) << "reapplying because of " << transToken(result);
+
1218
+
1219 // FIXME: This mechanism for doing work while returning a `tec` is
+
1220 // awkward and very limiting. A more general purpose approach
+
1221 // should be used, making it possible to do more useful work
+
1222 // when transactions fail with a `tec` code.
+
1223 std::vector<uint256> removedOffers;
+
1224 std::vector<uint256> removedTrustLines;
+
1225 std::vector<uint256> expiredNFTokenOffers;
+
1226 std::vector<uint256> expiredCredentials;
+
1227
+
1228 bool const doOffers =
+
1229 ((result == tecOVERSIZE) || (result == tecKILLED));
+
1230 bool const doLines = (result == tecINCOMPLETE);
+
1231 bool const doNFTokenOffers = (result == tecEXPIRED);
+
1232 bool const doCredentials = (result == tecEXPIRED);
+
1233 if (doOffers || doLines || doNFTokenOffers || doCredentials)
+
1234 {
+
1235 ctx_.visit([doOffers,
+
1236 &removedOffers,
+
1237 doLines,
+
1238 &removedTrustLines,
+
1239 doNFTokenOffers,
+
1240 &expiredNFTokenOffers,
+
1241 doCredentials,
+
1242 &expiredCredentials](
+
1243 uint256 const& index,
+
1244 bool isDelete,
+
1245 std::shared_ptr<SLE const> const& before,
+ +
1247 if (isDelete)
+
1248 {
+
1249 XRPL_ASSERT(
+
1250 before && after,
+
1251 "ripple::Transactor::operator()::visit : non-null SLE "
+
1252 "inputs");
+
1253 if (doOffers && before && after &&
+
1254 (before->getType() == ltOFFER) &&
+
1255 (before->getFieldAmount(sfTakerPays) ==
+
1256 after->getFieldAmount(sfTakerPays)))
1257 {
-
1258 // Removal of obsolete AMM trust line
-
1259 removedTrustLines.push_back(index);
+
1258 // Removal of offer found or made unfunded
+
1259 removedOffers.push_back(index);
1260 }
1261
-
1262 if (doNFTokenOffers && before && after &&
-
1263 (before->getType() == ltNFTOKEN_OFFER))
-
1264 expiredNFTokenOffers.push_back(index);
-
1265
-
1266 if (doCredentials && before && after &&
-
1267 (before->getType() == ltCREDENTIAL))
-
1268 expiredCredentials.push_back(index);
-
1269 }
-
1270 });
-
1271 }
+
1262 if (doLines && before && after &&
+
1263 (before->getType() == ltRIPPLE_STATE))
+
1264 {
+
1265 // Removal of obsolete AMM trust line
+
1266 removedTrustLines.push_back(index);
+
1267 }
+
1268
+
1269 if (doNFTokenOffers && before && after &&
+
1270 (before->getType() == ltNFTOKEN_OFFER))
+
1271 expiredNFTokenOffers.push_back(index);
1272
-
1273 // Reset the context, potentially adjusting the fee.
-
1274 {
-
1275 auto const resetResult = reset(fee);
-
1276 if (!isTesSuccess(resetResult.first))
-
1277 result = resetResult.first;
-
1278
-
1279 fee = resetResult.second;
-
1280 }
-
1281
-
1282 // If necessary, remove any offers found unfunded during processing
-
1283 if ((result == tecOVERSIZE) || (result == tecKILLED))
- -
1285 view(), removedOffers, ctx_.app.journal("View"));
-
1286
-
1287 if (result == tecEXPIRED)
- -
1289 view(), expiredNFTokenOffers, ctx_.app.journal("View"));
-
1290
-
1291 if (result == tecINCOMPLETE)
- -
1293 view(), removedTrustLines, ctx_.app.journal("View"));
-
1294
-
1295 if (result == tecEXPIRED)
- -
1297 view(), expiredCredentials, ctx_.app.journal("View"));
-
1298
-
1299 applied = isTecClaim(result);
-
1300 }
+
1273 if (doCredentials && before && after &&
+
1274 (before->getType() == ltCREDENTIAL))
+
1275 expiredCredentials.push_back(index);
+
1276 }
+
1277 });
+
1278 }
+
1279
+
1280 // Reset the context, potentially adjusting the fee.
+
1281 {
+
1282 auto const resetResult = reset(fee);
+
1283 if (!isTesSuccess(resetResult.first))
+
1284 result = resetResult.first;
+
1285
+
1286 fee = resetResult.second;
+
1287 }
+
1288
+
1289 // If necessary, remove any offers found unfunded during processing
+
1290 if ((result == tecOVERSIZE) || (result == tecKILLED))
+ +
1292 view(), removedOffers, ctx_.app.journal("View"));
+
1293
+
1294 if (result == tecEXPIRED)
+ +
1296 view(), expiredNFTokenOffers, ctx_.app.journal("View"));
+
1297
+
1298 if (result == tecINCOMPLETE)
+ +
1300 view(), removedTrustLines, ctx_.app.journal("View"));
1301
-
1302 if (applied)
-
1303 {
-
1304 // Check invariants: if `tecINVARIANT_FAILED` is not returned, we can
-
1305 // proceed to apply the tx
-
1306 result = ctx_.checkInvariants(result, fee);
-
1307
-
1308 if (result == tecINVARIANT_FAILED)
-
1309 {
-
1310 // if invariants checking failed again, reset the context and
-
1311 // attempt to only claim a fee.
-
1312 auto const resetResult = reset(fee);
-
1313 if (!isTesSuccess(resetResult.first))
-
1314 result = resetResult.first;
-
1315
-
1316 fee = resetResult.second;
-
1317
-
1318 // Check invariants again to ensure the fee claiming doesn't
-
1319 // violate invariants.
-
1320 if (isTesSuccess(result) || isTecClaim(result))
-
1321 result = ctx_.checkInvariants(result, fee);
-
1322 }
-
1323
-
1324 // We ran through the invariant checker, which can, in some cases,
-
1325 // return a tef error code. Don't apply the transaction in that case.
-
1326 if (!isTecClaim(result) && !isTesSuccess(result))
-
1327 applied = false;
-
1328 }
-
1329
-
1330 std::optional<TxMeta> metadata;
-
1331 if (applied)
-
1332 {
-
1333 // Transaction succeeded fully or (retries are not allowed and the
-
1334 // transaction could claim a fee)
-
1335
-
1336 // The transactor and invariant checkers guarantee that this will
-
1337 // *never* trigger but if it, somehow, happens, don't allow a tx
-
1338 // that charges a negative fee.
-
1339 if (fee < beast::zero)
-
1340 Throw<std::logic_error>("fee charged is negative!");
-
1341
-
1342 // Charge whatever fee they specified. The fee has already been
-
1343 // deducted from the balance of the account that issued the
-
1344 // transaction. We just need to account for it in the ledger
-
1345 // header.
-
1346 if (!view().open() && fee != beast::zero)
-
1347 ctx_.destroyXRP(fee);
+
1302 if (result == tecEXPIRED)
+ +
1304 view(), expiredCredentials, ctx_.app.journal("View"));
+
1305
+
1306 applied = isTecClaim(result);
+
1307 }
+
1308
+
1309 if (applied)
+
1310 {
+
1311 // Check invariants: if `tecINVARIANT_FAILED` is not returned, we can
+
1312 // proceed to apply the tx
+
1313 result = ctx_.checkInvariants(result, fee);
+
1314
+
1315 if (result == tecINVARIANT_FAILED)
+
1316 {
+
1317 // if invariants checking failed again, reset the context and
+
1318 // attempt to only claim a fee.
+
1319 auto const resetResult = reset(fee);
+
1320 if (!isTesSuccess(resetResult.first))
+
1321 result = resetResult.first;
+
1322
+
1323 fee = resetResult.second;
+
1324
+
1325 // Check invariants again to ensure the fee claiming doesn't
+
1326 // violate invariants.
+
1327 if (isTesSuccess(result) || isTecClaim(result))
+
1328 result = ctx_.checkInvariants(result, fee);
+
1329 }
+
1330
+
1331 // We ran through the invariant checker, which can, in some cases,
+
1332 // return a tef error code. Don't apply the transaction in that case.
+
1333 if (!isTecClaim(result) && !isTesSuccess(result))
+
1334 applied = false;
+
1335 }
+
1336
+
1337 std::optional<TxMeta> metadata;
+
1338 if (applied)
+
1339 {
+
1340 // Transaction succeeded fully or (retries are not allowed and the
+
1341 // transaction could claim a fee)
+
1342
+
1343 // The transactor and invariant checkers guarantee that this will
+
1344 // *never* trigger but if it, somehow, happens, don't allow a tx
+
1345 // that charges a negative fee.
+
1346 if (fee < beast::zero)
+
1347 Throw<std::logic_error>("fee charged is negative!");
1348
-
1349 // Once we call apply, we will no longer be able to look at view()
-
1350 metadata = ctx_.apply(result);
-
1351 }
-
1352
-
1353 if (ctx_.flags() & tapDRY_RUN)
-
1354 {
-
1355 applied = false;
-
1356 }
-
1357
-
1358 JLOG(j_.trace()) << (applied ? "applied " : "not applied ")
-
1359 << transToken(result);
-
1360
-
1361 return {result, applied, metadata};
-
1362}
+
1349 // Charge whatever fee they specified. The fee has already been
+
1350 // deducted from the balance of the account that issued the
+
1351 // transaction. We just need to account for it in the ledger
+
1352 // header.
+
1353 if (!view().open() && fee != beast::zero)
+
1354 ctx_.destroyXRP(fee);
+
1355
+
1356 // Once we call apply, we will no longer be able to look at view()
+
1357 metadata = ctx_.apply(result);
+
1358 }
+
1359
+
1360 if (ctx_.flags() & tapDRY_RUN)
+
1361 {
+
1362 applied = false;
+
1363 }
+
1364
+
1365 JLOG(j_.trace()) << (applied ? "applied " : "not applied ")
+
1366 << transToken(result);
+
1367
+
1368 return {result, applied, metadata};
+
1369}
-
1363
-
1364} // namespace ripple
+
1370
+
1371} // namespace ripple
A generic endpoint for log messages.
Definition Journal.h:60
Stream fatal() const
Definition Journal.h:352
Stream error() const
Definition Journal.h:346
@@ -1538,7 +1547,6 @@ $(document).ready(function() { init_codefold(0); });
LedgerIndex seq() const
Returns the sequence number of the base ledger.
Definition ReadView.h:118
virtual Rules const & rules() const =0
Returns the tx processing rules.
virtual bool txExists(key_type const &key) const =0
Returns true if a tx exists in the tx map.
-
Rules controlling protocol behavior.
Definition Rules.h:38
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Definition Rules.cpp:130
RAII class to set and restore the STAmount canonicalize switchover.
Definition STAmount.h:727
@@ -1562,7 +1570,6 @@ $(document).ready(function() { init_codefold(0); });
SeqProxy getSeqProxy() const
Definition STTx.cpp:216
Json::Value getJson(JsonOptions options) const override
Definition STTx.cpp:305
-
Blob getSigningPubKey() const
Definition STTx.h:213
uint256 getTransactionID() const
Definition STTx.h:219
A type that represents either a sequence value or a ticket value.
Definition SeqProxy.h:56
static constexpr SeqProxy sequence(std::uint32_t v)
Factory function to return a sequence-based SeqProxy.
Definition SeqProxy.h:76
@@ -1577,24 +1584,24 @@ $(document).ready(function() { init_codefold(0); });
bool empty() const noexcept
Return true if the byte range is empty.
Definition Slice.h:70
+
static NotTEC checkMultiSign(PreclaimContext const &ctx, AccountID const &id, STObject const &sigObject)
TER consumeSeqProxy(SLE::pointer const &sleAccount)
-
ApplyResult operator()()
Process the transaction.
+
ApplyResult operator()()
Process the transaction.
static NotTEC preflightSigValidated(PreflightContext const &ctx)
static NotTEC checkPriorTxAndLastLedger(PreclaimContext const &ctx)
static TER checkFee(PreclaimContext const &ctx, XRPAmount baseFee)
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
static NotTEC checkSeqProxy(ReadView const &view, STTx const &tx, beast::Journal j)
-
static NotTEC checkSign(PreclaimContext const &ctx)
-
void trapTransaction(uint256) const
+
static NotTEC checkSign(PreclaimContext const &ctx)
+
void trapTransaction(uint256) const
static XRPAmount minimumFee(Application &app, XRPAmount baseFee, Fees const &fees, ApplyFlags flags)
Compute the minimum fee required to process a transaction with a given baseFee based on the current s...
-
static NotTEC checkSingleSign(AccountID const &idSigner, AccountID const &idAccount, std::shared_ptr< SLE const > sleAccount, Rules const &rules, beast::Journal j)
static NotTEC preflight1(PreflightContext const &ctx, std::uint32_t flagMask)
Performs early sanity checks on the account and fee fields.
AccountID const account_
Definition Transactor.h:147
-
static NotTEC checkMultiSign(ReadView const &view, AccountID const &idAccount, STArray const &txSigners, ApplyFlags const &flags, beast::Journal j)
static TER checkPermission(ReadView const &view, STTx const &tx)
static NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
ApplyView & view()
Definition Transactor.h:163
-
static NotTEC checkBatchSign(PreclaimContext const &ctx)
+
static NotTEC checkSingleSign(PreclaimContext const &ctx, AccountID const &idSigner, AccountID const &idAccount, std::shared_ptr< SLE const > sleAccount)
+
static NotTEC checkBatchSign(PreclaimContext const &ctx)
static XRPAmount calculateOwnerReserveFee(ReadView const &view, STTx const &tx)
beast::Journal const j_
Definition Transactor.h:145
XRPAmount mPriorBalance
Definition Transactor.h:148
@@ -1606,7 +1613,7 @@ $(document).ready(function() { init_codefold(0); });
static bool validDataLength(std::optional< Slice > const &slice, std::size_t maxLength)
ApplyContext & ctx_
Definition Transactor.h:143
virtual TER doApply()=0
-
std::pair< TER, XRPAmount > reset(XRPAmount fee)
Reset the context, discarding any changes made and adjust the fee.
+
std::pair< TER, XRPAmount > reset(XRPAmount fee)
Reset the context, discarding any changes made and adjust the fee.
Transactor(Transactor const &)=delete
@@ -1640,7 +1647,7 @@ $(document).ready(function() { init_codefold(0); });
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
Definition View.cpp:1029
std::size_t constexpr oversizeMetaDataCap
The maximum number of metadata entries allowed in one transaction.
Definition Protocol.h:53
AccountID calcAccountID(PublicKey const &pk)
-
static void removeUnfundedOffers(ApplyView &view, std::vector< uint256 > const &offers, beast::Journal viewJ)
+
static void removeUnfundedOffers(ApplyView &view, std::vector< uint256 > const &offers, beast::Journal viewJ)
@ tefNOT_MULTI_SIGNING
Definition TER.h:181
@ tefPAST_SEQ
Definition TER.h:175
@ tefNO_TICKET
Definition TER.h:185
@@ -1656,9 +1663,9 @@ $(document).ready(function() { init_codefold(0); });
@ tefINTERNAL
Definition TER.h:173
@ open
We haven't closed our ledger yet, but others might have.
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
-
static void removeExpiredCredentials(ApplyView &view, std::vector< uint256 > const &creds, beast::Journal viewJ)
+
static void removeExpiredCredentials(ApplyView &view, std::vector< uint256 > const &creds, beast::Journal viewJ)
std::string transToken(TER code)
Definition TER.cpp:264
-
static void removeExpiredNFTokenOffers(ApplyView &view, std::vector< uint256 > const &offers, beast::Journal viewJ)
+
static void removeExpiredNFTokenOffers(ApplyView &view, std::vector< uint256 > const &offers, beast::Journal viewJ)
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition Slice.h:244
TER checkTxPermission(std::shared_ptr< SLE const > const &delegate, STTx const &tx)
Check if the delegate account has permission to execute the transaction.
@ tecNO_DELEGATE_PERMISSION
Definition TER.h:364
@@ -1674,7 +1681,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
Definition TER.h:674
@ SigBad
Signature is bad. Didn't do local checks.
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
-
static void removeDeletedTrustLines(ApplyView &view, std::vector< uint256 > const &trustLines, beast::Journal viewJ)
+
static void removeDeletedTrustLines(ApplyView &view, std::vector< uint256 > const &trustLines, beast::Journal viewJ)
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3239
constexpr std::uint32_t tfUniversalMask
Definition TxFlags.h:63
XRPAmount scaleFeeLoad(XRPAmount fee, LoadFeeTrack const &feeTrack, Fees const &fees, bool bUnlimited)
diff --git a/Transactor_8h_source.html b/Transactor_8h_source.html index 376d2dcf76..f3d5dd11b3 100644 --- a/Transactor_8h_source.html +++ b/Transactor_8h_source.html @@ -369,148 +369,151 @@ $(document).ready(function() { init_codefold(0); });
281 static XRPAmount
282 calculateOwnerReserveFee(ReadView const& view, STTx const& tx);
283
-
284 // Base class always returns true
-
285 static bool
- -
287
-
288 // Base class always returns tfUniversalMask
-
289 static std::uint32_t
-
290 getFlagsMask(PreflightContext const& ctx);
-
291
-
292 // Base class always returns tesSUCCESS
-
293 static NotTEC
- -
295
-
296 static bool
-
297 validDataLength(std::optional<Slice> const& slice, std::size_t maxLength);
-
298
-
299 template <class T>
-
300 static bool
-
301 validNumericRange(std::optional<T> value, T max, T min = {});
-
302
-
303 template <class T, class Unit>
-
304 static bool
- -
306 std::optional<T> value,
- -
308 unit::ValueUnit<Unit, T> min = {});
-
309
-
310private:
- -
312 reset(XRPAmount fee);
-
313
-
314 TER
-
315 consumeSeqProxy(SLE::pointer const& sleAccount);
-
316 TER
-
317 payFee();
-
318 static NotTEC
- -
320 AccountID const& idSigner,
-
321 AccountID const& idAccount,
- -
323 Rules const& rules,
- -
325 static NotTEC
- -
327 ReadView const& view,
+
284 static NotTEC
+
285 checkSign(
+
286 PreclaimContext const& ctx,
+
287 AccountID const& id,
+
288 STObject const& sigObject);
+
289
+
290 // Base class always returns true
+
291 static bool
+ +
293
+
294 // Base class always returns tfUniversalMask
+
295 static std::uint32_t
+
296 getFlagsMask(PreflightContext const& ctx);
+
297
+
298 // Base class always returns tesSUCCESS
+
299 static NotTEC
+ +
301
+
302 static bool
+
303 validDataLength(std::optional<Slice> const& slice, std::size_t maxLength);
+
304
+
305 template <class T>
+
306 static bool
+
307 validNumericRange(std::optional<T> value, T max, T min = {});
+
308
+
309 template <class T, class Unit>
+
310 static bool
+ +
312 std::optional<T> value,
+ +
314 unit::ValueUnit<Unit, T> min = {});
+
315
+
316private:
+ +
318 reset(XRPAmount fee);
+
319
+
320 TER
+
321 consumeSeqProxy(SLE::pointer const& sleAccount);
+
322 TER
+
323 payFee();
+
324 static NotTEC
+ +
326 PreclaimContext const& ctx,
+
327 AccountID const& idSigner,
328 AccountID const& idAccount,
-
329 STArray const& txSigners,
-
330 ApplyFlags const& flags,
- -
332
-
333 void trapTransaction(uint256) const;
-
334
-
342 static NotTEC
-
343 preflight1(PreflightContext const& ctx, std::uint32_t flagMask);
-
344
-
350 static NotTEC
-
351 preflight2(PreflightContext const& ctx);
-
352};
+
329 std::shared_ptr<SLE const> sleAccount);
+
330 static NotTEC
+ +
332 PreclaimContext const& ctx,
+
333 AccountID const& id,
+
334 STObject const& sigObject);
+
335
+
336 void trapTransaction(uint256) const;
+
337
+
345 static NotTEC
+
346 preflight1(PreflightContext const& ctx, std::uint32_t flagMask);
+
347
+
353 static NotTEC
+
354 preflight2(PreflightContext const& ctx);
+
355};
-
353
-
354inline bool
-
- -
356{
-
357 return true;
-
358}
+
356
+
357inline bool
+
+ +
359{
+
360 return true;
+
361}
-
359
-
361NotTEC
-
362preflight0(PreflightContext const& ctx, std::uint32_t flagMask);
-
363
-
364namespace detail {
-
365
-
370NotTEC
- -
372
- - -
379 ApplyFlags flags,
-
380 STObject const& sigObject,
- -
382} // namespace detail
-
383
-
384// Defined in Change.cpp
-
385template <>
- -
387Transactor::invokePreflight<Change>(PreflightContext const& ctx);
-
388
-
389template <class T>
-
390NotTEC
-
- -
392{
-
393 // Using this lookup does NOT require checking the fixDelegateV1_1. The data
-
394 // exists regardless of whether it is enabled.
-
395 auto const feature =
- -
397
-
398 if (feature && !ctx.rules.enabled(*feature))
-
399 return temDISABLED;
+
362
+
364NotTEC
+
365preflight0(PreflightContext const& ctx, std::uint32_t flagMask);
+
366
+
367namespace detail {
+
368
+
373NotTEC
+ +
375
+ + +
382 ApplyFlags flags,
+
383 STObject const& sigObject,
+ +
385} // namespace detail
+
386
+
387// Defined in Change.cpp
+
388template <>
+ +
390Transactor::invokePreflight<Change>(PreflightContext const& ctx);
+
391
+
392template <class T>
+
393NotTEC
+
+ +
395{
+
396 // Using this lookup does NOT require checking the fixDelegateV1_1. The data
+
397 // exists regardless of whether it is enabled.
+
398 auto const feature =
+
400
-
401 if (!T::checkExtraFeatures(ctx))
+
401 if (feature && !ctx.rules.enabled(*feature))
402 return temDISABLED;
403
-
404 if (auto const ret = preflight1(ctx, T::getFlagsMask(ctx)))
-
405 return ret;
+
404 if (!T::checkExtraFeatures(ctx))
+
405 return temDISABLED;
406
-
407 if (auto const ret = T::preflight(ctx))
+
407 if (auto const ret = preflight1(ctx, T::getFlagsMask(ctx)))
408 return ret;
409
-
410 if (auto const ret = preflight2(ctx))
+
410 if (auto const ret = T::preflight(ctx))
411 return ret;
412
-
413 return T::preflightSigValidated(ctx);
-
414}
-
+
413 if (auto const ret = preflight2(ctx))
+
414 return ret;
415
-
416template <class T>
-
417bool
-
- -
419{
-
420 if (!value)
-
421 return true;
-
422 return value >= min && value <= max;
-
423}
+
416 return T::preflightSigValidated(ctx);
+
417}
-
424
-
425template <class T, class Unit>
-
426bool
-
- -
428 std::optional<T> value,
- - -
431{
-
432 return validNumericRange(value, max.value(), min.value());
-
433}
+
418
+
419template <class T>
+
420bool
+
+ +
422{
+
423 if (!value)
+
424 return true;
+
425 return value >= min && value <= max;
+
426}
-
434
-
435} // namespace ripple
-
436
-
437#endif
+
427
+
428template <class T, class Unit>
+
429bool
+
+ +
431 std::optional<T> value,
+ + +
434{
+
435 return validNumericRange(value, max.value(), min.value());
+
436}
+
+
437
+
438} // namespace ripple
+
439
+
440#endif
A generic endpoint for log messages.
Definition Journal.h:60
static Sink & getNullSink()
Returns a Sink which does nothing.
Wraps a Journal::Sink to prefix its output with a string.
Definition WrappedSink.h:34
@@ -531,35 +534,35 @@ $(document).ready(function() { init_codefold(0); }); +
static NotTEC checkMultiSign(PreclaimContext const &ctx, AccountID const &id, STObject const &sigObject)
TER consumeSeqProxy(SLE::pointer const &sleAccount)
-
ApplyResult operator()()
Process the transaction.
+
ApplyResult operator()()
Process the transaction.
static NotTEC preflightSigValidated(PreflightContext const &ctx)
Transactor & operator=(Transactor const &)=delete
static NotTEC checkPriorTxAndLastLedger(PreclaimContext const &ctx)
static TER checkFee(PreclaimContext const &ctx, XRPAmount baseFee)
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
static NotTEC checkSeqProxy(ReadView const &view, STTx const &tx, beast::Journal j)
-
static NotTEC checkSign(PreclaimContext const &ctx)
-
void trapTransaction(uint256) const
+
static NotTEC checkSign(PreclaimContext const &ctx)
+
void trapTransaction(uint256) const
static XRPAmount minimumFee(Application &app, XRPAmount baseFee, Fees const &fees, ApplyFlags flags)
Compute the minimum fee required to process a transaction with a given baseFee based on the current s...
virtual ~Transactor()=default
-
static bool checkExtraFeatures(PreflightContext const &ctx)
Definition Transactor.h:355
-
static NotTEC checkSingleSign(AccountID const &idSigner, AccountID const &idAccount, std::shared_ptr< SLE const > sleAccount, Rules const &rules, beast::Journal j)
+
static bool checkExtraFeatures(PreflightContext const &ctx)
Definition Transactor.h:358
static NotTEC preflight1(PreflightContext const &ctx, std::uint32_t flagMask)
Performs early sanity checks on the account and fee fields.
AccountID const account_
Definition Transactor.h:147
-
static NotTEC checkMultiSign(ReadView const &view, AccountID const &idAccount, STArray const &txSigners, ApplyFlags const &flags, beast::Journal j)
static TER checkPermission(ReadView const &view, STTx const &tx)
static NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
ApplyView & view()
Definition Transactor.h:163
beast::WrappedSink sink_
Definition Transactor.h:144
static TER preclaim(PreclaimContext const &ctx)
Definition Transactor.h:233
-
static NotTEC checkBatchSign(PreclaimContext const &ctx)
+
static NotTEC checkSingleSign(PreclaimContext const &ctx, AccountID const &idSigner, AccountID const &idAccount, std::shared_ptr< SLE const > sleAccount)
+
static NotTEC checkBatchSign(PreclaimContext const &ctx)
static XRPAmount calculateOwnerReserveFee(ReadView const &view, STTx const &tx)
-
static bool validNumericRange(std::optional< T > value, T max, T min={})
Definition Transactor.h:418
+
static bool validNumericRange(std::optional< T > value, T max, T min={})
Definition Transactor.h:421
beast::Journal const j_
Definition Transactor.h:145
XRPAmount mPriorBalance
Definition Transactor.h:148
virtual void preCompute()
@@ -570,10 +573,10 @@ $(document).ready(function() { init_codefold(0); });
static bool validDataLength(std::optional< Slice > const &slice, std::size_t maxLength)
ApplyContext & ctx_
Definition Transactor.h:143
virtual TER doApply()=0
-
std::pair< TER, XRPAmount > reset(XRPAmount fee)
Reset the context, discarding any changes made and adjust the fee.
+
std::pair< TER, XRPAmount > reset(XRPAmount fee)
Reset the context, discarding any changes made and adjust the fee.
Transactor(Transactor const &)=delete
ApplyView const & view() const
Definition Transactor.h:169
-
static NotTEC invokePreflight(PreflightContext const &ctx)
Definition Transactor.h:391
+
static NotTEC invokePreflight(PreflightContext const &ctx)
Definition Transactor.h:394
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition applySteps.h:58
diff --git a/classripple_1_1AMMBid-members.html b/classripple_1_1AMMBid-members.html index 3e6d786d0a..15013d0cbb 100644 --- a/classripple_1_1AMMBid-members.html +++ b/classripple_1_1AMMBid-members.html @@ -88,48 +88,49 @@ $(function() { checkBatchSign(PreclaimContext const &ctx)ripple::Transactorstatic checkExtraFeatures(PreflightContext const &ctx)ripple::AMMBidstatic checkFee(PreclaimContext const &ctx, XRPAmount baseFee)ripple::Transactorstatic - checkMultiSign(ReadView const &view, AccountID const &idAccount, STArray const &txSigners, ApplyFlags const &flags, beast::Journal j)ripple::Transactorprivatestatic + checkMultiSign(PreclaimContext const &ctx, AccountID const &id, STObject const &sigObject)ripple::Transactorprivatestatic checkPermission(ReadView const &view, STTx const &tx)ripple::Transactorstatic checkPriorTxAndLastLedger(PreclaimContext const &ctx)ripple::Transactorstatic checkSeqProxy(ReadView const &view, STTx const &tx, beast::Journal j)ripple::Transactorstatic checkSign(PreclaimContext const &ctx)ripple::Transactorstatic - checkSingleSign(AccountID const &idSigner, AccountID const &idAccount, std::shared_ptr< SLE const > sleAccount, Rules const &rules, beast::Journal j)ripple::Transactorprivatestatic - ConsequencesFactoryripple::AMMBidstatic - ConsequencesFactoryType enum nameripple::Transactor - consumeSeqProxy(SLE::pointer const &sleAccount)ripple::Transactorprivate - ctx_ripple::Transactorprotected - Custom enum valueripple::Transactor - doApply() overrideripple::AMMBidvirtual - getFlagsMask(PreflightContext const &ctx)ripple::Transactorprotectedstatic - invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic - invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic + checkSign(PreclaimContext const &ctx, AccountID const &id, STObject const &sigObject)ripple::Transactorprotectedstatic + checkSingleSign(PreclaimContext const &ctx, AccountID const &idSigner, AccountID const &idAccount, std::shared_ptr< SLE const > sleAccount)ripple::Transactorprivatestatic + ConsequencesFactoryripple::AMMBidstatic + ConsequencesFactoryType enum nameripple::Transactor + consumeSeqProxy(SLE::pointer const &sleAccount)ripple::Transactorprivate + ctx_ripple::Transactorprotected + Custom enum valueripple::Transactor + doApply() overrideripple::AMMBidvirtual + getFlagsMask(PreflightContext const &ctx)ripple::Transactorprotectedstatic + invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic - j_ripple::Transactorprotected - minimumFee(Application &app, XRPAmount baseFee, Fees const &fees, ApplyFlags flags)ripple::Transactorprotectedstatic - mPriorBalanceripple::Transactorprotected - mSourceBalanceripple::Transactorprotected - Normal enum valueripple::Transactor - operator()()ripple::Transactor - operator=(Transactor const &)=deleteripple::Transactorprotected - payFee()ripple::Transactorprivate - preclaim(PreclaimContext const &ctx)ripple::AMMBidstatic - preCompute()ripple::Transactorprotectedvirtual - preflight(PreflightContext const &ctx)ripple::AMMBidstatic - preflight1(PreflightContext const &ctx, std::uint32_t flagMask)ripple::Transactorprivatestatic - preflight2(PreflightContext const &ctx)ripple::Transactorprivatestatic - preflightSigValidated(PreflightContext const &ctx)ripple::Transactorprotectedstatic - reset(XRPAmount fee)ripple::Transactorprivate - sink_ripple::Transactorprotected - ticketDelete(ApplyView &view, AccountID const &account, uint256 const &ticketIndex, beast::Journal j)ripple::Transactorstatic - Transactor(Transactor const &)=deleteripple::Transactorprotected - Transactor(ApplyContext &ctx)ripple::Transactorexplicitprotected - trapTransaction(uint256) constripple::Transactorprivate - validDataLength(std::optional< Slice > const &slice, std::size_t maxLength)ripple::Transactorprotectedstatic - validNumericRange(std::optional< T > value, T max, T min={})ripple::Transactorprotectedstatic - validNumericRange(std::optional< T > value, unit::ValueUnit< Unit, T > max, unit::ValueUnit< Unit, T > min={})ripple::Transactorprotectedstatic - view()ripple::Transactor - view() constripple::Transactor - ~Transactor()=defaultripple::Transactorprotectedvirtual + invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic + j_ripple::Transactorprotected + minimumFee(Application &app, XRPAmount baseFee, Fees const &fees, ApplyFlags flags)ripple::Transactorprotectedstatic + mPriorBalanceripple::Transactorprotected + mSourceBalanceripple::Transactorprotected + Normal enum valueripple::Transactor + operator()()ripple::Transactor + operator=(Transactor const &)=deleteripple::Transactorprotected + payFee()ripple::Transactorprivate + preclaim(PreclaimContext const &ctx)ripple::AMMBidstatic + preCompute()ripple::Transactorprotectedvirtual + preflight(PreflightContext const &ctx)ripple::AMMBidstatic + preflight1(PreflightContext const &ctx, std::uint32_t flagMask)ripple::Transactorprivatestatic + preflight2(PreflightContext const &ctx)ripple::Transactorprivatestatic + preflightSigValidated(PreflightContext const &ctx)ripple::Transactorprotectedstatic + reset(XRPAmount fee)ripple::Transactorprivate + sink_ripple::Transactorprotected + ticketDelete(ApplyView &view, AccountID const &account, uint256 const &ticketIndex, beast::Journal j)ripple::Transactorstatic + Transactor(Transactor const &)=deleteripple::Transactorprotected + Transactor(ApplyContext &ctx)ripple::Transactorexplicitprotected + trapTransaction(uint256) constripple::Transactorprivate + validDataLength(std::optional< Slice > const &slice, std::size_t maxLength)ripple::Transactorprotectedstatic + validNumericRange(std::optional< T > value, T max, T min={})ripple::Transactorprotectedstatic + validNumericRange(std::optional< T > value, unit::ValueUnit< Unit, T > max, unit::ValueUnit< Unit, T > min={})ripple::Transactorprotectedstatic + view()ripple::Transactor + view() constripple::Transactor + ~Transactor()=defaultripple::Transactorprotectedvirtual
+

Definition at line 718 of file Transactor.cpp.

+ +
+
+ +

◆ checkSign() [2/2]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
NotTEC ripple::Transactor::checkSign (PreclaimContext const & ctx,
AccountID const & id,
STObject const & sigObject 
)
+
+staticprotectedinherited
+
+

Definition at line 662 of file Transactor.cpp.

@@ -784,7 +830,7 @@ Static Private Member Functions
-

Definition at line 719 of file Transactor.cpp.

+

Definition at line 727 of file Transactor.cpp.

@@ -852,7 +898,7 @@ template<class T >
-

Definition at line 391 of file Transactor.h.

+

Definition at line 394 of file Transactor.h.

@@ -1299,7 +1345,7 @@ template<class T >
-

Definition at line 418 of file Transactor.h.

+

Definition at line 421 of file Transactor.h.

@@ -1345,7 +1391,7 @@ template<class T , class Unit >
-

Definition at line 427 of file Transactor.h.

+

Definition at line 430 of file Transactor.h.

@@ -1382,7 +1428,7 @@ template<class T , class Unit >
Returns
A pair containing the transaction result and the actual fee charged.
-

Definition at line 1083 of file Transactor.cpp.

+

Definition at line 1090 of file Transactor.cpp.

@@ -1441,8 +1487,8 @@ template<class T , class Unit > - -

◆ checkSingleSign()

+ +

◆ checkSingleSign()

@@ -1453,6 +1499,12 @@ template<class T , class Unit >
NotTEC ripple::Transactor::checkSingleSign ( + PreclaimContext const &  + ctx, + + + + AccountID const &  idSigner, @@ -1466,19 +1518,7 @@ template<class T , class Unit >
std::shared_ptr< SLE const >  - sleAccount, - - - - - Rules const &  - rules, - - - - - beast::Journal  - j  + sleAccount  @@ -1493,12 +1533,12 @@ template<class T , class Unit >
-

Definition at line 766 of file Transactor.cpp.

+

Definition at line 771 of file Transactor.cpp.

- -

◆ checkMultiSign()

+ +

◆ checkMultiSign()

@@ -1509,32 +1549,20 @@ template<class T , class Unit >
NotTEC ripple::Transactor::checkMultiSign ( - ReadView const &  - view, + PreclaimContext const &  + ctx, AccountID const &  - idAccount, + id, - STArray const &  - txSigners, - - - - - ApplyFlags const &  - flags, - - - - - beast::Journal  - j  + STObject const &  + sigObject  @@ -1549,7 +1577,7 @@ template<class T , class Unit >
-

Definition at line 827 of file Transactor.cpp.

+

Definition at line 833 of file Transactor.cpp.

@@ -1577,7 +1605,7 @@ template<class T , class Unit >
-

Definition at line 1138 of file Transactor.cpp.

+

Definition at line 1145 of file Transactor.cpp.

diff --git a/classripple_1_1AMMClawback-members.html b/classripple_1_1AMMClawback-members.html index 41069aedfd..f83afdf3d8 100644 --- a/classripple_1_1AMMClawback-members.html +++ b/classripple_1_1AMMClawback-members.html @@ -89,49 +89,50 @@ $(function() { checkBatchSign(PreclaimContext const &ctx)ripple::Transactorstatic checkExtraFeatures(PreflightContext const &ctx)ripple::Transactorprotectedstatic checkFee(PreclaimContext const &ctx, XRPAmount baseFee)ripple::Transactorstatic - checkMultiSign(ReadView const &view, AccountID const &idAccount, STArray const &txSigners, ApplyFlags const &flags, beast::Journal j)ripple::Transactorprivatestatic + checkMultiSign(PreclaimContext const &ctx, AccountID const &id, STObject const &sigObject)ripple::Transactorprivatestatic checkPermission(ReadView const &view, STTx const &tx)ripple::Transactorstatic checkPriorTxAndLastLedger(PreclaimContext const &ctx)ripple::Transactorstatic checkSeqProxy(ReadView const &view, STTx const &tx, beast::Journal j)ripple::Transactorstatic checkSign(PreclaimContext const &ctx)ripple::Transactorstatic - checkSingleSign(AccountID const &idSigner, AccountID const &idAccount, std::shared_ptr< SLE const > sleAccount, Rules const &rules, beast::Journal j)ripple::Transactorprivatestatic - ConsequencesFactoryripple::AMMClawbackstatic - ConsequencesFactoryType enum nameripple::Transactor - consumeSeqProxy(SLE::pointer const &sleAccount)ripple::Transactorprivate - ctx_ripple::Transactorprotected - Custom enum valueripple::Transactor - doApply() overrideripple::AMMClawbackvirtual - equalWithdrawMatchingOneAmount(Sandbox &view, SLE const &ammSle, AccountID const &holder, AccountID const &ammAccount, STAmount const &amountBalance, STAmount const &amount2Balance, STAmount const &lptAMMBalance, STAmount const &holdLPtokens, STAmount const &amount)ripple::AMMClawbackprivate - getFlagsMask(PreflightContext const &ctx)ripple::AMMClawbackstatic - invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic - invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic + checkSign(PreclaimContext const &ctx, AccountID const &id, STObject const &sigObject)ripple::Transactorprotectedstatic + checkSingleSign(PreclaimContext const &ctx, AccountID const &idSigner, AccountID const &idAccount, std::shared_ptr< SLE const > sleAccount)ripple::Transactorprivatestatic + ConsequencesFactoryripple::AMMClawbackstatic + ConsequencesFactoryType enum nameripple::Transactor + consumeSeqProxy(SLE::pointer const &sleAccount)ripple::Transactorprivate + ctx_ripple::Transactorprotected + Custom enum valueripple::Transactor + doApply() overrideripple::AMMClawbackvirtual + equalWithdrawMatchingOneAmount(Sandbox &view, SLE const &ammSle, AccountID const &holder, AccountID const &ammAccount, STAmount const &amountBalance, STAmount const &amount2Balance, STAmount const &lptAMMBalance, STAmount const &holdLPtokens, STAmount const &amount)ripple::AMMClawbackprivate + getFlagsMask(PreflightContext const &ctx)ripple::AMMClawbackstatic + invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic - j_ripple::Transactorprotected - minimumFee(Application &app, XRPAmount baseFee, Fees const &fees, ApplyFlags flags)ripple::Transactorprotectedstatic - mPriorBalanceripple::Transactorprotected - mSourceBalanceripple::Transactorprotected - Normal enum valueripple::Transactor - operator()()ripple::Transactor - operator=(Transactor const &)=deleteripple::Transactorprotected - payFee()ripple::Transactorprivate - preclaim(PreclaimContext const &ctx)ripple::AMMClawbackstatic - preCompute()ripple::Transactorprotectedvirtual - preflight(PreflightContext const &ctx)ripple::AMMClawbackstatic - preflight1(PreflightContext const &ctx, std::uint32_t flagMask)ripple::Transactorprivatestatic - preflight2(PreflightContext const &ctx)ripple::Transactorprivatestatic - preflightSigValidated(PreflightContext const &ctx)ripple::Transactorprotectedstatic - reset(XRPAmount fee)ripple::Transactorprivate - sink_ripple::Transactorprotected - ticketDelete(ApplyView &view, AccountID const &account, uint256 const &ticketIndex, beast::Journal j)ripple::Transactorstatic - Transactor(Transactor const &)=deleteripple::Transactorprotected - Transactor(ApplyContext &ctx)ripple::Transactorexplicitprotected - trapTransaction(uint256) constripple::Transactorprivate - validDataLength(std::optional< Slice > const &slice, std::size_t maxLength)ripple::Transactorprotectedstatic - validNumericRange(std::optional< T > value, T max, T min={})ripple::Transactorprotectedstatic - validNumericRange(std::optional< T > value, unit::ValueUnit< Unit, T > max, unit::ValueUnit< Unit, T > min={})ripple::Transactorprotectedstatic - view()ripple::Transactor - view() constripple::Transactor - ~Transactor()=defaultripple::Transactorprotectedvirtual + invokePreflight(PreflightContext const &ctx)ripple::Transactorstatic + j_ripple::Transactorprotected + minimumFee(Application &app, XRPAmount baseFee, Fees const &fees, ApplyFlags flags)ripple::Transactorprotectedstatic + mPriorBalanceripple::Transactorprotected + mSourceBalanceripple::Transactorprotected + Normal enum valueripple::Transactor + operator()()ripple::Transactor + operator=(Transactor const &)=deleteripple::Transactorprotected + payFee()ripple::Transactorprivate + preclaim(PreclaimContext const &ctx)ripple::AMMClawbackstatic + preCompute()ripple::Transactorprotectedvirtual + preflight(PreflightContext const &ctx)ripple::AMMClawbackstatic + preflight1(PreflightContext const &ctx, std::uint32_t flagMask)ripple::Transactorprivatestatic + preflight2(PreflightContext const &ctx)ripple::Transactorprivatestatic + preflightSigValidated(PreflightContext const &ctx)ripple::Transactorprotectedstatic + reset(XRPAmount fee)ripple::Transactorprivate + sink_ripple::Transactorprotected + ticketDelete(ApplyView &view, AccountID const &account, uint256 const &ticketIndex, beast::Journal j)ripple::Transactorstatic + Transactor(Transactor const &)=deleteripple::Transactorprotected + Transactor(ApplyContext &ctx)ripple::Transactorexplicitprotected + trapTransaction(uint256) constripple::Transactorprivate + validDataLength(std::optional< Slice > const &slice, std::size_t maxLength)ripple::Transactorprotectedstatic + validNumericRange(std::optional< T > value, T max, T min={})ripple::Transactorprotectedstatic + validNumericRange(std::optional< T > value, unit::ValueUnit< Unit, T > max, unit::ValueUnit< Unit, T > min={})ripple::Transactorprotectedstatic + view()ripple::Transactor + view() constripple::Transactor + ~Transactor()=defaultripple::Transactorprotectedvirtual