Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with modifySorobanNetworkConfig #4583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ledger/test/LedgerCloseMetaStreamTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ TEST_CASE_VERSIONS("meta stream contains reasonable meta", "[ledgerclosemeta]")
.bucketListWindowSamplePeriod = 1;
});

// Modify Soroban network config closes a ledger
++targetSeq;
// Modify Soroban network config closes 2 ledgers
sisuresh marked this conversation as resolved.
Show resolved Hide resolved
targetSeq += 2;
}

auto root = TestAccount::createRoot(*app);
Expand Down
16 changes: 16 additions & 0 deletions src/test/TestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,22 @@ modifySorobanNetworkConfig(Application& app,
{
return;
}

// In this upgrade path, cfg.writeAllSettings will call addBatch with and
// artificial ledgerSeq of lcl + 1. In order to properly refresh cached
// config setting state, we then close a "real" ledger with ledgerSeq == lcl
// + 1. This is usually fine. However, if lcl + 1 is a ledgerSeq that causes
// a Bucket merge event, we will erroneously merge the same level twice.
// This causes the BucketList to lose data.
// To prevent this, we check if lcl + 1 will cause a merge. If it does, we
// simply close a ledger to move on to lcl + 2. Note that if level 0 does
// not spill, no other level will spill.
if (LiveBucketList::levelShouldSpill(
app.getLedgerManager().getLastClosedLedgerNum() + 1, 0))
{
txtest::closeLedger(app);
}

LedgerTxn ltx(app.getLedgerTxnRoot());
app.getLedgerManager().updateNetworkConfig(ltx);
auto& cfg = app.getLedgerManager().getMutableSorobanNetworkConfig();
Expand Down
174 changes: 87 additions & 87 deletions src/testdata/ledger-close-meta-v1-protocol-20.json

Large diffs are not rendered by default.

174 changes: 87 additions & 87 deletions src/testdata/ledger-close-meta-v1-protocol-21.json

Large diffs are not rendered by default.

174 changes: 87 additions & 87 deletions src/testdata/ledger-close-meta-v1-protocol-22.json

Large diffs are not rendered by default.

174 changes: 87 additions & 87 deletions src/testdata/ledger-close-meta-v1-protocol-23.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions test-tx-meta-baseline-current/InvokeHostFunctionTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@
"bKDF6V5IzTo=",
"bKDF6V5IzTo="
],
"contract storage|footprint|unused readWrite key" : [ "VzQb0aWq2bE=" ],
"contract storage|footprint|unused readWrite key" : [ "7docDsgLbB4=" ],
"failure diagnostics" : [ "bKDF6V5IzTo=" ],
"ledger entry size limit enforced" : [ "bKDF6V5IzTo=", "bKDF6V5IzTo=" ],
"loadgen Wasm executes properly" : [ "bKDF6V5IzTo=" ],
Expand All @@ -1340,15 +1340,15 @@
"bKDF6V5IzTo="
],
"refund account merged" : [ "bKDF6V5IzTo=", "398Rd+u+jdE=", "b4KxXJCxvM0=", "7/h1q7KjqKA=" ],
"refund is sent to fee-bump source|protocol version 20" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund is sent to fee-bump source|protocol version 21" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund is sent to fee-bump source|protocol version 22" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund still happens on bad auth|protocol version 20" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund still happens on bad auth|protocol version 21" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund still happens on bad auth|protocol version 22" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund test with closeLedger|protocol version 20" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=" ],
"refund test with closeLedger|protocol version 21" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=" ],
"refund test with closeLedger|protocol version 22" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=" ],
"refund is sent to fee-bump source|protocol version 20" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund is sent to fee-bump source|protocol version 21" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund is sent to fee-bump source|protocol version 22" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund still happens on bad auth|protocol version 20" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund still happens on bad auth|protocol version 21" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund still happens on bad auth|protocol version 22" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund test with closeLedger|protocol version 20" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=" ],
"refund test with closeLedger|protocol version 21" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=" ],
"refund test with closeLedger|protocol version 22" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=" ],
"settings upgrade" : [ "bKDF6V5IzTo=", "bKDF6V5IzTo=" ],
"settings upgrade command line utils" :
[
Expand Down
26 changes: 13 additions & 13 deletions test-tx-meta-baseline-next/InvokeHostFunctionTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@
"bKDF6V5IzTo=",
"bKDF6V5IzTo="
],
"contract storage|footprint|unused readWrite key" : [ "VzQb0aWq2bE=" ],
"contract storage|footprint|unused readWrite key" : [ "7docDsgLbB4=" ],
"failure diagnostics" : [ "bKDF6V5IzTo=" ],
"ledger entry size limit enforced" : [ "bKDF6V5IzTo=", "bKDF6V5IzTo=" ],
"loadgen Wasm executes properly" : [ "bKDF6V5IzTo=" ],
Expand All @@ -1341,18 +1341,18 @@
"bKDF6V5IzTo="
],
"refund account merged" : [ "bKDF6V5IzTo=", "398Rd+u+jdE=", "b4KxXJCxvM0=", "7/h1q7KjqKA=" ],
"refund is sent to fee-bump source|protocol version 20" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund is sent to fee-bump source|protocol version 21" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund is sent to fee-bump source|protocol version 22" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund is sent to fee-bump source|protocol version 23" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund still happens on bad auth|protocol version 20" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund still happens on bad auth|protocol version 21" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund still happens on bad auth|protocol version 22" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund still happens on bad auth|protocol version 23" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=", "LyDINL0VaLk=" ],
"refund test with closeLedger|protocol version 20" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=" ],
"refund test with closeLedger|protocol version 21" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=" ],
"refund test with closeLedger|protocol version 22" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=" ],
"refund test with closeLedger|protocol version 23" : [ "bKDF6V5IzTo=", "JRiUwIP1h2Q=" ],
"refund is sent to fee-bump source|protocol version 20" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund is sent to fee-bump source|protocol version 21" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund is sent to fee-bump source|protocol version 22" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund is sent to fee-bump source|protocol version 23" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund still happens on bad auth|protocol version 20" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund still happens on bad auth|protocol version 21" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund still happens on bad auth|protocol version 22" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund still happens on bad auth|protocol version 23" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=", "X9SMBpriL1M=" ],
"refund test with closeLedger|protocol version 20" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=" ],
"refund test with closeLedger|protocol version 21" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=" ],
"refund test with closeLedger|protocol version 22" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=" ],
"refund test with closeLedger|protocol version 23" : [ "bKDF6V5IzTo=", "aP2GN4F3Jm8=" ],
"settings upgrade" : [ "bKDF6V5IzTo=", "bKDF6V5IzTo=" ],
"settings upgrade command line utils" :
[
Expand Down
Loading