Skip to content

Commit

Permalink
Merge pull request #130 from sisuresh/prev-curr
Browse files Browse the repository at this point in the history
Add new mission for using both host versions
  • Loading branch information
sisuresh committed Jan 5, 2024
2 parents b6457d4 + 4cdb96d commit d2613e6
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/FSLibrary/FSLibrary.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<Compile Include="MissionSorobanLoadGeneration.fs" />
<Compile Include="MissionSorobanConfigUpgrades.fs" />
<Compile Include="MissionSorobanInvokeHostLoad.fs" />
<Compile Include="MissionSorobanCatchupWithPrevAndCurr.fs" />
<Compile Include="MissionVersionNewCatchupToOld.fs" />
<Compile Include="MissionVersionOldCatchupToNew.fs" />
<Compile Include="MissionProtocolUpgradeTestnet.fs" />
Expand Down
78 changes: 78 additions & 0 deletions src/FSLibrary/MissionSorobanCatchupWithPrevAndCurr.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Copyright 2024 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0

module MissionSorobanCatchupWithPrevAndCurr

open StellarCoreHTTP
open StellarCorePeer
open StellarCoreSet
open StellarMissionContext
open StellarFormation
open StellarStatefulSets
open StellarDataDump
open StellarSupercluster

let sorobanCatchupWithPrevAndCurr (context: MissionContext) =
let coreSet =
MakeLiveCoreSet
"core"
{ CoreSetOptions.GetDefault context.image with
invariantChecks = AllInvariantsExceptBucketConsistencyChecks
emptyDirType = DiskBackedEmptyDir }

let quorumSet = CoreSetQuorum(CoreSetName("core"))

// This coreset has catchup complete
let afterUpgradeCoreSet =
MakeDeferredCoreSet
"after-upgrade"
{ CoreSetOptions.GetDefault context.image with
nodeCount = 1
quorumSet = quorumSet
catchupMode = CatchupComplete }

let context =
{ context with
numAccounts = 100
numTxs = 100
txRate = 1
coreResources = MediumTestResources }

context.Execute
[ coreSet; afterUpgradeCoreSet ]
None
(fun (formation: StellarFormation) ->
formation.WaitUntilSynced [ coreSet ]

let supportedProtocol = (formation.NetworkCfg.GetPeer coreSet 0).GetSupportedProtocolVersion()

// We want to test against a protocol boundary that has Soroban enabled on both sides,
// so the image must be on the protocol version after Soroban was introduced.
// This check can be removed once we're on v21 for good and not just on vnext.
if supportedProtocol >= 21 then
formation.UpgradeProtocol [ coreSet ] (supportedProtocol - 1)
formation.UpgradeMaxTxSetSize [ coreSet ] 100000

formation.RunLoadgen coreSet context.GenerateAccountCreationLoad
formation.UpgradeSorobanLedgerLimitsWithMultiplier [ coreSet ] 1000
formation.UpgradeSorobanTxLimitsWithMultiplier [ coreSet ] 100
formation.RunLoadgen coreSet context.SetupSorobanInvoke
formation.RunLoadgen coreSet context.GenerateSorobanInvokeLoad

formation.UpgradeProtocol [ coreSet ] (supportedProtocol)

formation.RunLoadgen coreSet context.SetupSorobanInvoke
formation.RunLoadgen coreSet context.GenerateSorobanInvokeLoad

// Start the second coreset that will replay all ledgers
formation.Start afterUpgradeCoreSet.name

let afterUpgradeCoreSetLive = formation.NetworkCfg.FindCoreSet afterUpgradeCoreSet.name
formation.WaitUntilSynced [ afterUpgradeCoreSetLive ]

let peer = formation.NetworkCfg.GetPeer coreSet 0
let ledgerNum = peer.GetLedgerNum()

let catchupPeer = formation.NetworkCfg.GetPeer afterUpgradeCoreSetLive 0
catchupPeer.WaitForLedgerNum(ledgerNum + 64))
4 changes: 3 additions & 1 deletion src/FSLibrary/StellarMission.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ open StellarMissionContext
open MissionSorobanLoadGeneration
open MissionSorobanConfigUpgrades
open MissionSorobanInvokeHostLoad
open MissionSorobanCatchupWithPrevAndCurr

type Mission = (MissionContext -> unit)

Expand Down Expand Up @@ -76,4 +77,5 @@ let allMissions : Map<string, Mission> =
("SimulatePubnetTier1Perf", simulatePubnetTier1Perf)
("SorobanLoadGeneration", sorobanLoadGeneration)
("SorobanConfigUpgrades", sorobanConfigUpgrades)
("SorobanInvokeHostLoad", sorobanInvokeHostLoad) |]
("SorobanInvokeHostLoad", sorobanInvokeHostLoad)
("SorobanCatchupWithPrevAndCurr", sorobanCatchupWithPrevAndCurr) |]

0 comments on commit d2613e6

Please sign in to comment.