Skip to content

Commit

Permalink
Merge pull request #125 from marta-lokhova/remove_network_config_over…
Browse files Browse the repository at this point in the history
…ride_flag

Remove network config override flag
  • Loading branch information
marta-lokhova committed Dec 22, 2023
2 parents aee84d3 + 50c3a60 commit 959d455
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/FSLibrary/MissionCatchupHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ let doCatchupForVersion
formation.RunLoadgen
catchupSets.generatorSet
(if doSoroban then
formation.UpgradeSorobanLedgerLimitsWithMultiplier [ catchupSets.generatorSet ] 100
context.GenerateSorobanUploadLoad
else
context.GeneratePaymentLoad)
Expand Down
1 change: 1 addition & 0 deletions src/FSLibrary/MissionInMemoryMode.fs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ let runInMemoryMode (context: MissionContext) =

formation.RunLoadgen coreSet context.GenerateAccountCreationLoad
formation.RunLoadgen coreSet context.GeneratePaymentLoad
formation.UpgradeSorobanLedgerLimitsWithMultiplier [ coreSet ] 100
formation.RunLoadgen coreSet { context.GenerateSorobanUploadLoad with txrate = 1 })
1 change: 1 addition & 0 deletions src/FSLibrary/MissionLoadGenerationWithTxSetLimit.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ let loadGenerationWithTxSetLimit (context: MissionContext) =

formation.RunLoadgen coreSet context.GenerateAccountCreationLoad
formation.RunLoadgen coreSet context.GeneratePaymentLoad
formation.UpgradeSorobanLedgerLimitsWithMultiplier [ coreSet ] 100
formation.RunLoadgen coreSet { context.GenerateSorobanUploadLoad with txrate = 1; txs = 200 })
1 change: 1 addition & 0 deletions src/FSLibrary/MissionMixedImageLoadGeneration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ let mixedImageLoadGeneration (oldImageNodeCount: int) (context: MissionContext)
let majorityPeer = formation.NetworkCfg.GetPeer loadgenCoreSet 0

if majorityPeer.GetLedgerProtocolVersion() >= 20 then
formation.UpgradeSorobanLedgerLimitsWithMultiplier coreSets 100
formation.RunLoadgen loadgenCoreSet { context.GenerateSorobanUploadLoad with txrate = 1; txs = 200 })

let mixedImageLoadGenerationWithOldImageMajority (context: MissionContext) = mixedImageLoadGeneration 2 context
Expand Down
1 change: 1 addition & 0 deletions src/FSLibrary/MissionProtocolUpgradeWithLoad.fs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ let protocolUpgradeWithLoad (context: MissionContext) =

formation.ScheduleProtocolUpgrade [ coreSet ] latestProtocol (System.DateTime.Now.AddSeconds(20.0))
formation.RunLoadgen coreSet context.GeneratePaymentLoad
formation.UpgradeSorobanLedgerLimitsWithMultiplier [ coreSet ] 100
formation.RunLoadgen coreSet { context.GenerateSorobanUploadLoad with txrate = 1; txs = 200 })
23 changes: 16 additions & 7 deletions src/FSLibrary/MissionSorobanConfigUpgrades.fs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let sorobanConfigUpgrades (context: MissionContext) =
formation.UpgradeProtocolToLatest [ coreSet ]

// will wait until loadgen is done and contract is uploaded
formation.SetupUpgradeContract coreSet
formation.UpgradeSorobanLedgerLimitsWithMultiplier [ coreSet ] 100

// kill-switch
formation.UpgradeSorobanMaxTxSetSize [ coreSet ] 0
Expand All @@ -69,33 +69,42 @@ let sorobanConfigUpgrades (context: MissionContext) =

// Slightly increase the limit while generating load
formation.DeployUpgradeEntriesAndArm
coreSet
[ coreSet ]
{ LoadGen.GetDefault() with
mode = CreateSorobanUpgrade
txMaxSizeBytes = Some(150000) }
txMaxSizeBytes = Some(150000)
ledgerMaxTransactionsSizeBytes = Some(150000 * 100)
maxContractSizeBytes = Some(100000)
txMaxWriteBytes = Some(150000 * 2)
ledgerMaxWriteBytes = Some(150000 * 2 * 100) }
(System.DateTime.UtcNow.AddSeconds(20.0))

formation.RunLoadgen coreSet context.GenerateSorobanUploadLoad
peer.WaitForMaxTxSize 150000

// Further increase the limit while generating load
formation.DeployUpgradeEntriesAndArm
coreSet
[ coreSet ]
{ LoadGen.GetDefault() with
mode = CreateSorobanUpgrade
txMaxSizeBytes = Some(500000) }
txMaxSizeBytes = Some(500000)
ledgerMaxTransactionsSizeBytes = Some(500000 * 100)
maxContractSizeBytes = Some(400000)
txMaxWriteBytes = Some(500000 * 2)
ledgerMaxWriteBytes = Some(500000 * 2 * 100) }
(System.DateTime.UtcNow.AddSeconds(20.0))

formation.RunLoadgen coreSet context.GenerateSorobanUploadLoad
peer.WaitForMaxTxSize 500000

// Decrease max tx size to be below classic limit, everything should still work as expected
formation.DeployUpgradeEntriesAndArm
coreSet
[ coreSet ]
{ LoadGen.GetDefault() with
mode = CreateSorobanUpgrade
txMaxSizeBytes = Some(50000)
maxContractSizeBytes = Some(10000) }
maxContractSizeBytes = Some(10000)
txMaxWriteBytes = Some(50000 * 2) }
(System.DateTime.UtcNow.AddSeconds(20.0))

formation.RunLoadgen coreSet context.GenerateSorobanUploadLoad
Expand Down
1 change: 1 addition & 0 deletions src/FSLibrary/MissionSorobanLoadGeneration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ let sorobanLoadGeneration (context: MissionContext) =
formation.UpgradeMaxTxSetSize tier1 1000000

formation.RunLoadgen sdf context.GenerateAccountCreationLoad
formation.UpgradeSorobanLedgerLimitsWithMultiplier tier1 100
formation.RunLoadgen sdf context.GenerateSorobanUploadLoad
formation.EnsureAllNodesInSync fullCoreSet)
8 changes: 0 additions & 8 deletions src/FSLibrary/StellarCoreCfg.fs
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,6 @@ type StellarCoreCfg =
t.Add("COMMANDS", logLevelCommands) |> ignore
t.Add("CATCHUP_COMPLETE", self.catchupMode = CatchupComplete) |> ignore

// only latest images support Soroban configs
let latestCoreVersion (input: string) =
let pattern = @"stellar-core:(19\.14\.1|20\.\d\.\d)-\d{4}"
Regex.IsMatch(input, pattern)

if latestCoreVersion self.image then
t.Add("TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE", true) |> ignore

match self.network.missionContext.peerReadingCapacity, self.network.missionContext.peerFloodCapacity with
| None, None -> ()
| Some read, Some flood ->
Expand Down
17 changes: 17 additions & 0 deletions src/FSLibrary/StellarCoreHTTP.fs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,18 @@ type Peer with

member self.GetSorobanMaxTxSetSize() : int = self.GetInfo().Ledger.MaxSorobanTxSetSize.Value

member self.GetLedgerMaxInstructions() : int64 = self.GetSorobanInfo().Ledger.MaxInstructions

member self.GetLedgerReadBytes() : int = self.GetSorobanInfo().Ledger.MaxReadBytes

member self.GetLedgerWriteBytes() : int = self.GetSorobanInfo().Ledger.MaxWriteBytes

member self.GetLedgerReadEntries() : int = self.GetSorobanInfo().Ledger.MaxReadLedgerEntries

member self.GetLedgerWriteEntries() : int = self.GetSorobanInfo().Ledger.MaxWriteLedgerEntries

member self.GetLedgerMaxTransactionsSizeBytes() : int = self.GetSorobanInfo().Ledger.MaxTxSizeBytes

member self.GetMaxTxSize() : int = self.GetSorobanInfo().Tx.MaxSizeBytes

member self.GetLedgerProtocolVersion() : int = self.GetInfo().Ledger.Version
Expand Down Expand Up @@ -489,6 +501,11 @@ type Peer with
(fun _ -> self.GetSorobanMaxTxSetSize() = n)
(fun _ -> LogInfo "Waiting for SorobanMaxTxSetSize=%d on %s" n self.ShortName.StringName)

member self.WaitForLedgerMaxInstructions(n: int64) =
RetryUntilTrue
(fun _ -> self.GetLedgerMaxInstructions() = n)
(fun _ -> LogInfo "Waiting for LedgerMaxInstructions=%d on %s" n self.ShortName.StringName)

member self.WaitForMaxTxSize(n: int) =
RetryUntilTrue
(fun _ -> self.GetMaxTxSize() = n)
Expand Down
33 changes: 30 additions & 3 deletions src/FSLibrary/StellarStatefulSets.fs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,27 @@ type StellarFormation with
let peer = self.NetworkCfg.GetPeer coreSetList.[0] 0
peer.WaitForSorobanMaxTxSetSize maxTxSetSize |> ignore

member self.UpgradeSorobanLedgerLimitsWithMultiplier (coreSetList: CoreSet list) (multiplier: int) =
self.SetupUpgradeContract coreSetList.[0]
let peer = self.NetworkCfg.GetPeer coreSetList.[0] 0

let expectedInstructions = peer.GetLedgerMaxInstructions() * int64 (multiplier)

self.DeployUpgradeEntriesAndArm
coreSetList
{ LoadGen.GetDefault() with
mode = CreateSorobanUpgrade
ledgerMaxInstructions = Some(expectedInstructions)
ledgerMaxReadBytes = Some(peer.GetLedgerReadBytes() * multiplier)
ledgerMaxWriteBytes = Some(peer.GetLedgerWriteBytes() * multiplier)
ledgerMaxTxCount = Some(peer.GetSorobanMaxTxSetSize() * multiplier)
ledgerMaxReadLedgerEntries = Some(peer.GetLedgerReadBytes() * multiplier)
ledgerMaxWriteLedgerEntries = Some(peer.GetLedgerWriteBytes() * multiplier)
ledgerMaxTransactionsSizeBytes = Some(peer.GetLedgerMaxTransactionsSizeBytes() * multiplier) }
(System.DateTime.UtcNow)

peer.WaitForLedgerMaxInstructions expectedInstructions |> ignore

member self.ReportStatus() = ReportAllPeerStatus self.NetworkCfg

member self.CreateAccount (coreSet: CoreSet) (u: Username) =
Expand Down Expand Up @@ -231,8 +252,12 @@ type StellarFormation with
let loadgen = { LoadGen.GetDefault() with mode = SetupSorobanUpgrade }
self.RunLoadgen coreSet loadgen

member self.DeployUpgradeEntriesAndArm (coreSet: CoreSet) (loadGen: LoadGen) (upgradeTime: System.DateTime) =
let peer = self.NetworkCfg.GetPeer coreSet 0
member self.DeployUpgradeEntriesAndArm
(coreSetList: CoreSet list)
(loadGen: LoadGen)
(upgradeTime: System.DateTime)
=
let peer = self.NetworkCfg.GetPeer coreSetList.[0] 0
let resStr = peer.GenerateLoad loadGen

let contractKey = Loadgen.Parse(resStr).ConfigUpgradeSetKey
Expand All @@ -242,7 +267,9 @@ type StellarFormation with
if peer.IsLoadGenComplete() <> Success then failwith "Loadgen failed!"

// Arm upgrades on each peer in the core set
self.NetworkCfg.EachPeerInSets([| coreSet |]) (fun peer -> peer.UpgradeNetworkSetting contractKey upgradeTime)
self.NetworkCfg.EachPeerInSets
(List.toArray coreSetList)
(fun peer -> peer.UpgradeNetworkSetting contractKey upgradeTime)

member self.clearMetrics(coreSets: CoreSet list) =
self.NetworkCfg.EachPeerInSets(coreSets |> List.toArray) (fun peer -> peer.ClearMetrics())
Expand Down

0 comments on commit 959d455

Please sign in to comment.