Skip to content

Commit

Permalink
Fix issue with modifySorobanNetworkConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTyson committed Dec 18, 2024
1 parent 0e19194 commit 35517f2
Show file tree
Hide file tree
Showing 8 changed files with 392 additions and 373 deletions.
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
targetSeq += 2;
}

auto root = TestAccount::createRoot(*app);
Expand Down
19 changes: 19 additions & 0 deletions src/test/TestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,25 @@ 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))
{
if (app.getConfig().isUsingBucketListDB())
{
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

0 comments on commit 35517f2

Please sign in to comment.