Skip to content

Commit 4f91396

Browse files
committed
Merge branch 'master' into ungate-cap-0083-0085
Conflict in src/util/ProtocolVersion.h: stellar#5393 added TX_ED25519_VERIFY_BUDGET_PROTOCOL_VERSION in the same place this branch removed the #ifdef CAP_0085_EXECUTABLE_REF. Resolution keeps both -- the new constant, and EXTERNAL_EXECUTABLE_REF_PROTOCOL_VERSION ungated. Also bumps stellar-quorum-analyzer to 502a354 (stellar#23), which repins its stellar-xdr to the same git rev as the p28 host so their XDR_FILES_SHA256 agree and checkXDRFileIdentity passes.
2 parents fdd1ef1 + 3ccd4ed commit 4f91396

5 files changed

Lines changed: 22 additions & 15 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ optional = true
198198
[dependencies.stellar-quorum-analyzer]
199199
version = "0.1.0"
200200
git = "https://github.com/stellar/stellar-quorum-analyzer"
201-
rev = "b422b366ede667c030c78ffe18b2010194698dbd"
201+
rev = "502a354eb9a31cf86098be84aa1b3081767fa3c7"
202202

203203
[features]
204204

src/transactions/SignatureChecker.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,19 @@ SignatureChecker::SignatureChecker(
2828
: mProtocolVersion{protocolVersion}
2929
, mContentsHash{contentsHash}
3030
, mSignatures{signatures}
31-
, mIsOverlayValidation{isOverlayValidation}
31+
, mEnforceVerifyBudget{
32+
isOverlayValidation ||
33+
protocolVersionStartsFrom(protocolVersion,
34+
TX_ED25519_VERIFY_BUDGET_PROTOCOL_VERSION)}
3235
{
3336
mUsedSignatures.resize(mSignatures.size());
3437
}
3538

36-
bool
37-
SignatureChecker::isOverlayValidation() const
38-
{
39-
return mIsOverlayValidation;
40-
}
41-
4239
bool
4340
SignatureChecker::isOverVerificationBudget() const
4441
{
45-
return mIsOverlayValidation &&
46-
mTxEd25519Verifications >= OVERLAY_TX_ED25519_VERIFY_BUDGET;
42+
return mEnforceVerifyBudget &&
43+
mTxEd25519Verifications >= TX_ED25519_VERIFY_BUDGET;
4744
}
4845

4946
bool

src/transactions/SignatureChecker.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ class SignatureChecker
4343
void disableCacheMetricsTracking();
4444
#endif // BUILD_TESTS
4545

46-
bool isOverlayValidation() const;
47-
static constexpr uint32_t OVERLAY_TX_ED25519_VERIFY_BUDGET = 1000;
46+
// Maximum number of ed25519 signature verifications a single
47+
// SignatureChecker will perform. Enforced during overlay validation at all
48+
// protocol versions, and on all validation and apply paths starting from
49+
// TX_ED25519_VERIFY_BUDGET_PROTOCOL_VERSION.
50+
static constexpr uint32_t TX_ED25519_VERIFY_BUDGET = 1000;
4851

4952
// Reset and return the counts of signature checks performed as part of
5053
// transaction `checkValid` or apply flow. The first element of the pair is
@@ -57,9 +60,13 @@ class SignatureChecker
5760
Hash const& mContentsHash;
5861
xdr::xvector<DecoratedSignature, 20> const& mSignatures;
5962
bool mTrackCacheMetrics{true};
60-
bool mIsOverlayValidation{false};
63+
64+
// Whether this checker enforces TX_ED25519_VERIFY_BUDGET.
65+
bool const mEnforceVerifyBudget;
6166

6267
std::vector<bool> mUsedSignatures;
68+
69+
// Number of ed25519 verifications performed by this checker
6370
uint32_t mTxEd25519Verifications{0};
6471

6572
bool isOverVerificationBudget() const;

src/util/ProtocolVersion.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ constexpr ProtocolVersion EMPTY_TX_SET_PROTOCOL_VERSION = ProtocolVersion::V_28;
7373
constexpr ProtocolVersion INVOKE_HOST_FUNCTION_V2_PROTOCOL_VERSION =
7474
ProtocolVersion::V_28;
7575

76+
constexpr ProtocolVersion TX_ED25519_VERIFY_BUDGET_PROTOCOL_VERSION =
77+
ProtocolVersion::V_28;
78+
7679
constexpr ProtocolVersion EXTERNAL_EXECUTABLE_REF_PROTOCOL_VERSION =
7780
ProtocolVersion::V_28;
7881

0 commit comments

Comments
 (0)