-
Notifications
You must be signed in to change notification settings - Fork 297
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
test: adding big block tests to the main branch #3612
Changes from all commits
f786710
f522545
5f69e38
e40282a
21ae2b4
29bd8fd
39ea235
006c047
ec16b8f
32ff915
7df7375
0ccce39
bef7743
1e267d2
cd68725
b725abc
afb65e2
7ed141a
08eaad4
ca311f0
b09af7e
3d9ac3e
24c9475
d13014a
c120d6e
3674afe
0296951
2d4e991
aa83908
72525d7
e2a3074
07cd982
d157862
16d9bad
bf23951
f62e6bc
abf2fd5
73632ee
eccbc46
40187d6
cda3035
8b5ff94
66a5bf7
1cac853
3bb91cc
57a9b5e
9293571
ab54060
c8e065a
f84e805
7a5a3cd
10dd879
d0cc39c
6da8cd6
fbbd488
7aa56b8
1364730
9a53cfc
584d1bd
ba54a85
5ecdc5f
fea9b1b
f9f1d00
113db47
51b05e0
a54791a
e31ae70
04261a1
640ac4d
265b7fe
6e780f5
16f694b
187ec04
e8b5dfd
9fbb325
e158a07
06af840
77042f8
de0b76f
6fe58f7
d93c2aa
599f718
0a4fdc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,26 +1,65 @@ | ||||||
package main | ||||||
|
||||||
import ( | ||||||
"context" | ||||||
"fmt" | ||||||
"log" | ||||||
"time" | ||||||
|
||||||
"github.com/celestiaorg/celestia-app/v2/pkg/appconsts" | ||||||
"github.com/celestiaorg/celestia-app/v2/test/e2e/testnet" | ||||||
"github.com/celestiaorg/celestia-app/v2/test/util/testnode" | ||||||
"github.com/tendermint/tendermint/pkg/trace" | ||||||
) | ||||||
|
||||||
const ( | ||||||
seed = 42 | ||||||
) | ||||||
|
||||||
var bigBlockManifest = Manifest{ | ||||||
ChainID: "test", | ||||||
Validators: 2, | ||||||
TxClients: 2, | ||||||
ValidatorResource: testnet.Resources{ | ||||||
MemoryRequest: "12Gi", | ||||||
MemoryLimit: "12Gi", | ||||||
CPU: "8", | ||||||
Volume: "20Gi", | ||||||
}, | ||||||
TxClientsResource: testnet.Resources{ | ||||||
MemoryRequest: "1Gi", | ||||||
MemoryLimit: "3Gi", | ||||||
CPU: "2", | ||||||
Volume: "1Gi", | ||||||
}, | ||||||
SelfDelegation: 10000000, | ||||||
// @TODO Update the CelestiaAppVersion and TxClientVersion to the latest | ||||||
// version of the main branch once the PR#3261 is merged by addressing this | ||||||
// issue https://github.com/celestiaorg/celestia-app/issues/3603. | ||||||
CelestiaAppVersion: "pr-3261", | ||||||
TxClientVersion: "pr-3261", | ||||||
EnableLatency: false, | ||||||
LatencyParams: LatencyParams{70, 0}, // in milliseconds | ||||||
BlobSequences: 60, | ||||||
BlobsPerSeq: 6, | ||||||
BlobSizes: "200000", | ||||||
PerPeerBandwidth: 5 * testnet.MB, | ||||||
UpgradeHeight: 0, | ||||||
TimeoutCommit: 11 * time.Second, | ||||||
TimeoutPropose: 80 * time.Second, | ||||||
Mempool: "v1", // ineffective as it always defaults to v1 | ||||||
BroadcastTxs: true, | ||||||
Prometheus: false, | ||||||
GovMaxSquareSize: 512, | ||||||
MaxBlockBytes: 7800000, | ||||||
TestDuration: 5 * time.Minute, | ||||||
LocalTracingType: "local", | ||||||
PushTrace: true, | ||||||
} | ||||||
|
||||||
func TwoNodeSimple(logger *log.Logger) error { | ||||||
latestVersion, err := testnet.GetLatestVersion() | ||||||
testnet.NoError("failed to get latest version", err) | ||||||
|
||||||
logger.Println("=== RUN TwoNodeSimple", "version:", latestVersion) | ||||||
testName := "TwoNodeSimple" | ||||||
logger.Printf("Running %s\n", testName) | ||||||
logger.Println("version", latestVersion) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this missing a formatting directive?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They both indeed work identically:
Their implementation is just inconsistent, which I can fix in a follow-up PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see #3670 |
||||||
|
||||||
manifest := Manifest{ | ||||||
ChainID: "test-e2e-two-node-simple", | ||||||
|
@@ -31,11 +70,11 @@ func TwoNodeSimple(logger *log.Logger) error { | |||||
CelestiaAppVersion: latestVersion, | ||||||
TxClientVersion: testnet.TxsimVersion, | ||||||
EnableLatency: false, | ||||||
LatencyParams: LatencyParams{100, 10}, // in milliseconds | ||||||
LatencyParams: LatencyParams{70, 0}, // in milliseconds | ||||||
BlobsPerSeq: 6, | ||||||
BlobSequences: 50, | ||||||
BlobSequences: 60, | ||||||
BlobSizes: "200000", | ||||||
PerPeerBandwidth: 5 * 1024 * 1024, | ||||||
PerPeerBandwidth: 5 * testnet.MB, | ||||||
UpgradeHeight: 0, | ||||||
TimeoutCommit: 1 * time.Second, | ||||||
TimeoutPropose: 1 * time.Second, | ||||||
|
@@ -47,11 +86,11 @@ func TwoNodeSimple(logger *log.Logger) error { | |||||
LocalTracingType: "local", | ||||||
PushTrace: false, | ||||||
DownloadTraces: false, | ||||||
TestDuration: 2 * time.Minute, | ||||||
TestDuration: 3 * time.Minute, | ||||||
TxClients: 2, | ||||||
} | ||||||
|
||||||
benchTest, err := NewBenchmarkTest("E2EThroughput", &manifest) | ||||||
benchTest, err := NewBenchmarkTest(testName, &manifest) | ||||||
testnet.NoError("failed to create benchmark test", err) | ||||||
|
||||||
defer func() { | ||||||
|
@@ -63,42 +102,80 @@ func TwoNodeSimple(logger *log.Logger) error { | |||||
|
||||||
testnet.NoError("failed to run the benchmark test", benchTest.Run()) | ||||||
|
||||||
// post test data collection and validation | ||||||
testnet.NoError("failed to check results", benchTest.CheckResults(1*testnet.MB)) | ||||||
|
||||||
// if local tracing is enabled, | ||||||
// pull round state traces to confirm tracing is working as expected. | ||||||
if benchTest.manifest.LocalTracingType == "local" { | ||||||
if _, err := benchTest.Node(0).PullRoundStateTraces("."); err != nil { | ||||||
return fmt.Errorf("failed to pull round state traces: %w", err) | ||||||
} | ||||||
} | ||||||
return nil | ||||||
} | ||||||
|
||||||
// download traces from S3, if enabled | ||||||
if benchTest.manifest.PushTrace && benchTest.manifest.DownloadTraces { | ||||||
// download traces from S3 | ||||||
pushConfig, _ := trace.GetPushConfigFromEnv() | ||||||
err := trace.S3Download("./traces/", benchTest.manifest.ChainID, | ||||||
pushConfig) | ||||||
if err != nil { | ||||||
return fmt.Errorf("failed to download traces from S3: %w", err) | ||||||
} | ||||||
} | ||||||
func runBenchmarkTest(logger *log.Logger, testName string, manifest Manifest) error { | ||||||
logger.Printf("Running %s\n", testName) | ||||||
manifest.ChainID = manifest.summary() | ||||||
log.Println("ChainID: ", manifest.ChainID) | ||||||
benchTest, err := NewBenchmarkTest(testName, &manifest) | ||||||
testnet.NoError("failed to create benchmark test", err) | ||||||
|
||||||
log.Println("Reading blockchain") | ||||||
blockchain, err := testnode.ReadBlockchain(context.Background(), | ||||||
benchTest.Node(0).AddressRPC()) | ||||||
testnet.NoError("failed to read blockchain", err) | ||||||
|
||||||
totalTxs := 0 | ||||||
for _, block := range blockchain { | ||||||
if appconsts.LatestVersion != block.Version.App { | ||||||
return fmt.Errorf("expected app version %d, got %d", appconsts.LatestVersion, block.Version.App) | ||||||
} | ||||||
totalTxs += len(block.Data.Txs) | ||||||
} | ||||||
if totalTxs < 10 { | ||||||
return fmt.Errorf("expected at least 10 transactions, got %d", totalTxs) | ||||||
} | ||||||
defer func() { | ||||||
log.Print("Cleaning up testnet") | ||||||
benchTest.Cleanup() | ||||||
}() | ||||||
|
||||||
testnet.NoError("failed to setup nodes", benchTest.SetupNodes()) | ||||||
testnet.NoError("failed to run the benchmark test", benchTest.Run()) | ||||||
expectedBlockSize := int64(0.90 * float64(manifest.MaxBlockBytes)) | ||||||
testnet.NoError("failed to check results", benchTest.CheckResults(expectedBlockSize)) | ||||||
|
||||||
return nil | ||||||
} | ||||||
|
||||||
func TwoNodeBigBlock8MB(logger *log.Logger) error { | ||||||
manifest := bigBlockManifest | ||||||
manifest.MaxBlockBytes = 8 * testnet.MB | ||||||
return runBenchmarkTest(logger, "TwoNodeBigBlock8MB", manifest) | ||||||
} | ||||||
|
||||||
func TwoNodeBigBlock8MBLatency(logger *log.Logger) error { | ||||||
manifest := bigBlockManifest | ||||||
manifest.MaxBlockBytes = 8 * testnet.MB | ||||||
manifest.EnableLatency = true | ||||||
manifest.LatencyParams = LatencyParams{70, 0} | ||||||
return runBenchmarkTest(logger, "TwoNodeBigBlock8MBLatency", manifest) | ||||||
} | ||||||
|
||||||
func TwoNodeBigBlock32MB(logger *log.Logger) error { | ||||||
manifest := bigBlockManifest | ||||||
manifest.MaxBlockBytes = 32 * testnet.MB | ||||||
return runBenchmarkTest(logger, "TwoNodeBigBlock32MB", manifest) | ||||||
} | ||||||
|
||||||
func TwoNodeBigBlock64MB(logger *log.Logger) error { | ||||||
manifest := bigBlockManifest | ||||||
manifest.MaxBlockBytes = 64 * testnet.MB | ||||||
return runBenchmarkTest(logger, "TwoNodeBigBlock64MB", manifest) | ||||||
} | ||||||
|
||||||
func LargeNetworkBigBlock8MB(logger *log.Logger) error { | ||||||
manifest := bigBlockManifest | ||||||
manifest.MaxBlockBytes = 8 * testnet.MB | ||||||
manifest.Validators = 50 | ||||||
manifest.TxClients = 50 | ||||||
manifest.BlobSequences = 2 | ||||||
return runBenchmarkTest(logger, "LargeNetworkBigBlock8MB", manifest) | ||||||
} | ||||||
|
||||||
func LargeNetworkBigBlock32MB(logger *log.Logger) error { | ||||||
manifest := bigBlockManifest | ||||||
manifest.MaxBlockBytes = 32 * testnet.MB | ||||||
manifest.Validators = 50 | ||||||
manifest.TxClients = 50 | ||||||
manifest.BlobSequences = 2 | ||||||
return runBenchmarkTest(logger, "LargeNetworkBigBlock32MB", manifest) | ||||||
} | ||||||
|
||||||
func LargeNetworkBigBlock64MB(logger *log.Logger) error { | ||||||
manifest := bigBlockManifest | ||||||
manifest.MaxBlockBytes = 64 * testnet.MB | ||||||
manifest.Validators = 50 | ||||||
manifest.TxClients = 50 | ||||||
manifest.BlobSequences = 2 | ||||||
return runBenchmarkTest(logger, "LargeNetworkBigBlock64MB", manifest) | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I don't think these lines will be executed if the previous conditional evaluates to
true
b/c thebreak
so consider re-ordering this above the previous conditional so thatmaxBlockSize
accounts for the block that actually exceeds >= expectedBlockSizeBytesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current version is correct as well. I see what causes confusion here: the value of
maxBlockSize
is only used when the target size is not reached. That is,if size >= expectedBlockSizeBytes
is never hit, and if that condition is never met, thenmaxBlockSize
correctly reflects the most recent maximum size observed. If we do hit theexpectedBlockSizeBytes
condition andif size >= expectedBlockSizeBytes
evaluates to true, then the value ofmaxBlockSize
does not matter. Nevertheless, to resolve future confusion, I will apply your suggestion in a follow up PR, thanks!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see #3670