-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from dmkozh/high_traffic_mission
Add new missions that trigger surge pricing/limiter at high volume traffic
- Loading branch information
Showing
14 changed files
with
211 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2022 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 MissionLoadGenerationWithTxSetLimit | ||
|
||
open StellarCoreSet | ||
open StellarMissionContext | ||
open StellarFormation | ||
open StellarStatefulSets | ||
open StellarSupercluster | ||
open StellarCoreHTTP | ||
|
||
let loadGenerationWithTxSetLimit (context: MissionContext) = | ||
let coreSet = | ||
MakeLiveCoreSet | ||
"core" | ||
{ CoreSetOptions.GetDefault context.image with | ||
invariantChecks = AllInvariantsExceptBucketConsistencyChecks | ||
dumpDatabase = false } | ||
|
||
let context = | ||
{ context with | ||
numAccounts = 200 | ||
numTxs = 50000 | ||
txRate = 1000 | ||
skipLowFeeTxs = true } | ||
|
||
context.Execute | ||
[ coreSet ] | ||
None | ||
(fun (formation: StellarFormation) -> | ||
formation.WaitUntilSynced [ coreSet ] | ||
formation.UpgradeProtocolToLatest [ coreSet ] | ||
formation.UpgradeMaxTxSetSize [ coreSet ] 1000 | ||
|
||
formation.RunLoadgen coreSet context.GenerateAccountCreationLoad | ||
formation.RunLoadgen coreSet context.GeneratePaymentLoad) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright 2022 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 MissionMixedImageLoadGeneration | ||
|
||
open stellar_dotnet_sdk | ||
open StellarCoreSet | ||
open StellarMissionContext | ||
open StellarFormation | ||
open StellarStatefulSets | ||
open StellarSupercluster | ||
open StellarCoreHTTP | ||
|
||
let mixedImageLoadGeneration (oldImageNodeCount: int) (context: MissionContext) = | ||
let oldNodeCount = oldImageNodeCount | ||
let newNodeCount = 3 - oldImageNodeCount | ||
|
||
let newImage = context.image | ||
let oldImage = GetOrDefault context.oldImage newImage | ||
|
||
let oldName = "core-old" | ||
let newName = "core-new" | ||
|
||
// Allow 2/3 nodes consensus, so that one image version could fork the network | ||
// in case of bugs. | ||
let qSet = | ||
CoreSetQuorumListWithThreshold(([ CoreSetName oldName; CoreSetName newName ], 51)) | ||
|
||
let oldCoreSet = | ||
MakeLiveCoreSet | ||
oldName | ||
{ CoreSetOptions.GetDefault oldImage with | ||
nodeCount = oldNodeCount | ||
invariantChecks = AllInvariantsExceptBucketConsistencyChecks | ||
dumpDatabase = false | ||
quorumSet = qSet } | ||
|
||
let newCoreSet = | ||
MakeLiveCoreSet | ||
newName | ||
{ CoreSetOptions.GetDefault newImage with | ||
nodeCount = newNodeCount | ||
invariantChecks = AllInvariantsExceptBucketConsistencyChecks | ||
dumpDatabase = false | ||
quorumSet = qSet } | ||
|
||
let context = | ||
{ context with | ||
numAccounts = 200 | ||
numTxs = 50000 | ||
txRate = 1000 | ||
skipLowFeeTxs = true } | ||
|
||
// Put the version with majority of nodes in front of the set to let it generate | ||
// the load and possibly leave the minority of nodes out of consensus in case of bugs. | ||
let coreSets = | ||
if oldNodeCount > newNodeCount then | ||
[ oldCoreSet; newCoreSet ] | ||
else | ||
[ newCoreSet; oldCoreSet ] | ||
|
||
context.Execute | ||
coreSets | ||
None | ||
(fun (formation: StellarFormation) -> | ||
formation.WaitUntilSynced coreSets | ||
formation.UpgradeProtocolToLatest coreSets | ||
formation.UpgradeMaxTxSetSize coreSets 1000 | ||
|
||
formation.RunLoadgen oldCoreSet context.GenerateAccountCreationLoad | ||
formation.RunLoadgen oldCoreSet context.GeneratePaymentLoad) | ||
|
||
let mixedImageLoadGenerationWithOldImageMajority (context: MissionContext) = mixedImageLoadGeneration 2 context | ||
|
||
let mixedImageLoadGenerationWithNewImageMajority (context: MissionContext) = mixedImageLoadGeneration 1 context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2022 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 MissionProtocolUpgradeWithLoad | ||
|
||
open StellarCorePeer | ||
open StellarCoreSet | ||
open StellarMissionContext | ||
open StellarFormation | ||
open StellarStatefulSets | ||
open StellarSupercluster | ||
open StellarCoreHTTP | ||
|
||
let protocolUpgradeWithLoad (context: MissionContext) = | ||
let coreSet = | ||
MakeLiveCoreSet | ||
"core" | ||
{ CoreSetOptions.GetDefault context.image with | ||
invariantChecks = AllInvariantsExceptBucketConsistencyChecks | ||
dumpDatabase = false } | ||
|
||
let context = | ||
{ context with | ||
numAccounts = 200 | ||
numTxs = 50000 | ||
txRate = 1000 | ||
skipLowFeeTxs = true } | ||
|
||
context.Execute | ||
[ coreSet ] | ||
None | ||
(fun (formation: StellarFormation) -> | ||
formation.WaitUntilSynced [ coreSet ] | ||
let networkCfg = formation.NetworkCfg | ||
let peer = networkCfg.GetPeer coreSet 0 | ||
let latestProtocol = peer.GetSupportedProtocolVersion() | ||
|
||
formation.UpgradeProtocol [ coreSet ] (latestProtocol - 1) | ||
formation.UpgradeMaxTxSetSize [ coreSet ] 1000 | ||
formation.RunLoadgen coreSet context.GenerateAccountCreationLoad | ||
|
||
formation.ScheduleProtocolUpgrade [ coreSet ] latestProtocol (System.DateTime.Now.AddSeconds(20.0)) | ||
formation.RunLoadgen coreSet context.GeneratePaymentLoad) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters