Skip to content

Commit

Permalink
Merge branch 'main' into rp/go-1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp authored Sep 16, 2024
2 parents 3ab7627 + 07411e2 commit 9b6980b
Show file tree
Hide file tree
Showing 35 changed files with 69 additions and 65 deletions.
4 changes: 0 additions & 4 deletions .github/auto_request_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ options:
ignored_keywords:
- DO NOT REVIEW
enable_group_assignment: false

# Randomly pick reviewers up to this number.
# Do not set this option if you'd like to assign all matching reviewers.
number_of_reviewers: 2
38 changes: 16 additions & 22 deletions cmd/celestia-appd/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package cmd
// start command flag.

import (
"errors"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -566,37 +565,30 @@ func addCommands(
)
}

// checkBBR checks is bbr is configured to be used as a congestion control algo.
// checkBBR checks if BBR is enabled.
func checkBBR(command *cobra.Command) error {
const (
errorMsg = `
// The BBR congestion control algorithm does not appear to be enabled in this
// system's kernel. This is important for the p2p stack to be performant.
//
// to enable bbr call:
//
warning = `
The BBR (Bottleneck Bandwidth and Round-trip propagation time) congestion control algorithm is not enabled in this system's kernel.
BBR is important for the performance of the p2p stack.
To enable BBR:
sudo modprobe tcp_bbr
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
sudo sysctl -p
//
// and can be verified to be running using
//
Then verify BBR is enabled:
sysctl net.ipv4.tcp_congestion_control
// This might not work for all systems, you might have to search online to
// figure out how to enable bbr for your system.
//
// While this node will get worse performance using something other than bbr,
// If you need to bypass this block use the "--force-no-bbr true" flag.
`
This node will get worse p2p performance using a different congestion control algorithm.
If you need to bypass this check use the --force-no-bbr flag.
`
)

noBBRErr := errors.New(errorMsg)

forceNoBBR, err := command.Flags().GetBool(FlagForceNoBBR)
if err != nil {
return noBBRErr
return err
}
if forceNoBBR {
return nil
Expand All @@ -605,11 +597,13 @@ sysctl net.ipv4.tcp_congestion_control
cmd := exec.Command("sysctl", "net.ipv4.tcp_congestion_control")
output, err := cmd.Output()
if err != nil {
return err
fmt.Print(warning)
return fmt.Errorf("failed to execute 'sysctl net.ipv4.tcp_congestion_control' %w", err)
}

if !strings.Contains(string(output), "bbr") {
return noBBRErr
fmt.Print(warning)
return fmt.Errorf("BBR not enabled because output %v does not contain 'bbr'", string(output))
}

return nil
Expand Down
22 changes: 18 additions & 4 deletions scripts/mainnet.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

# This script starts a consensus node on Mainnet Beta and state syncs to the tip
# of the chain.

# Stop script execution if an error is encountered
set -o errexit
# Stop script execution if an undefined variable is used
Expand All @@ -10,6 +13,7 @@ NODE_NAME="node-name"
SEEDS="e6116822e1a5e283d8a85d3ec38f4d232274eaf3@consensus-full-seed-1.celestia-bootstrap.net:26656,cf7ac8b19ff56a9d47c75551bd4864883d1e24b5@consensus-full-seed-2.celestia-bootstrap.net:26656"
CELESTIA_APP_HOME="${HOME}/.celestia-app"
CELESTIA_APP_VERSION=$(celestia-appd version 2>&1)
RPC="https://celestia-rpc.polkachu.com:443"

echo "celestia-app home: ${CELESTIA_APP_HOME}"
echo "celestia-app version: ${CELESTIA_APP_VERSION}"
Expand All @@ -35,10 +39,20 @@ celestia-appd init ${NODE_NAME} --chain-id ${CHAIN_ID} > /dev/null 2>&1 # Hide o
echo "Settings seeds in config.toml..."
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" $CELESTIA_APP_HOME/config/config.toml

LATEST_HEIGHT=$(curl -s $RPC/block | jq -r .result.block.header.height);
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000)); \
TRUST_HASH=$(curl -s "$RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)

echo "Block height: $BLOCK_HEIGHT"
echo "Trust hash: $TRUST_HASH"
echo "Enabling state sync in config.toml..."
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$RPC,$RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.celestia-app/config/config.toml

echo "Downloading genesis file..."
celestia-appd download-genesis ${CHAIN_ID} > /dev/null 2>&1 # Hide output to reduce terminal noise

echo "Starting celestia-appd in the background and piping logs to mainnet.log"
nohup celestia-appd start > "${HOME}/mainnet.log" 2>&1 &

echo "You can check the node's status via: celestia-appd status"
echo "Starting celestia-appd..."
celestia-appd start --v2-upgrade-height 2371495
1 change: 1 addition & 0 deletions specs/src/parameters_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ hardcoded in the application or they are blocked by the `x/paramfilter` module.
| mint.DisinflationRate | 0.10 (10%) | The rate at which the inflation rate decreases each year. | False |
| mint.InitialInflationRate | 0.08 (8%) | The inflation rate the network starts at. | False |
| mint.TargetInflationRate | 0.015 (1.5%) | The inflation rate that the network aims to stabilize at. | False |
| packetfowardmiddleware.FeePercentage | 0 | % of the forwarded packet amount which will be subtracted and distributed to the community pool. | True |
| slashing.DowntimeJailDuration | 1 min | Duration of time a validator must stay jailed. | True |
| slashing.MinSignedPerWindow | 0.75 (75%) | The percentage of SignedBlocksWindow that must be signed not to get jailed. | True |
| slashing.SignedBlocksWindow | 5000 | The range of blocks used to count for downtime. | True |
Expand Down
1 change: 0 additions & 1 deletion specs/src/specs/ante_handler.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/ante_handler_v1.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/ante_handler_v2.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/block_proposer.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/block_validity_rules.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/cat_pool.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/consensus.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/data_square_layout.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/data_structures.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/fraud_proofs.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/multisig.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/namespace.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/networking.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/parameters.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/parameters_v1.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/parameters_v2.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/public_key_cryptography.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/resource_pricing.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/shares.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/state_machine_modules.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/state_machine_modules_v1.md

This file was deleted.

1 change: 0 additions & 1 deletion specs/src/specs/state_machine_modules_v2.md

This file was deleted.

2 changes: 1 addition & 1 deletion test/e2e/benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (b *BenchmarkTest) SetupNodes() error {
testnet.NoError("failed to create genesis nodes",
b.CreateGenesisNodes(b.manifest.Validators,
b.manifest.CelestiaAppVersion, b.manifest.SelfDelegation,
b.manifest.UpgradeHeight, b.manifest.ValidatorResource))
b.manifest.UpgradeHeight, b.manifest.ValidatorResource, b.manifest.DisableBBR))

// enable latency if specified in the manifest
if b.manifest.EnableLatency {
Expand Down
10 changes: 8 additions & 2 deletions test/e2e/benchmark/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type Manifest struct {

UpgradeHeight int64
GovMaxSquareSize int64

DisableBBR bool
}

func (m *Manifest) GetGenesisModifiers() []genesis.Modifier {
Expand All @@ -103,12 +105,16 @@ func (m *Manifest) summary() string {
if m.EnableLatency {
latency = 1
}
bbr := 1
if m.DisableBBR {
bbr = 0
}
maxBlockMB := m.MaxBlockBytes / testnet.MB
summary := fmt.Sprintf("v%d-t%d-b%d-bw%dmb-tc%d-tp%d-l%d-%s-%dmb",
summary := fmt.Sprintf("v%d-t%d-b%d-bw%dmb-tc%d-tp%d-l%d-%s-br%d-%dmb",
m.Validators, m.TxClients,
m.BlobSequences, m.PerPeerBandwidth/testnet.MB,
m.TimeoutCommit/time.Second, m.TimeoutPropose/time.Second,
latency, m.Mempool, maxBlockMB)
latency, m.Mempool, bbr, maxBlockMB)
if len(summary) > 50 {
return summary[:50]
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/benchmark/throughput.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var bigBlockManifest = Manifest{
TestDuration: 5 * time.Minute,
LocalTracingType: "local",
PushTrace: true,
DisableBBR: true,
}

func TwoNodeSimple(logger *log.Logger) error {
Expand Down Expand Up @@ -88,6 +89,7 @@ func TwoNodeSimple(logger *log.Logger) error {
DownloadTraces: false,
TestDuration: 3 * time.Minute,
TxClients: 2,
DisableBBR: true,
}

benchTest, err := NewBenchmarkTest(testName, &manifest)
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/major_upgrade_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func MajorUpgradeToV2(logger *log.Logger) error {

logger.Println("Creating genesis nodes")
for i := 0; i < numNodes; i++ {
err := testNet.CreateGenesisNode(latestVersion, 10000000, upgradeHeight, testnet.DefaultResources)
err := testNet.CreateGenesisNode(latestVersion, 10000000,
upgradeHeight, testnet.DefaultResources, true)
testnet.NoError("failed to create genesis node", err)
}

Expand Down
4 changes: 3 additions & 1 deletion test/e2e/minor_version_compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ func MinorVersionCompatibility(logger *log.Logger) error {
// each node begins with a random version within the same major version set
v := versions.Random(r).String()
logger.Println("Starting node", "node", i, "version", v)
testnet.NoError("failed to create genesis node", testNet.CreateGenesisNode(v, 10000000, 0, testnet.DefaultResources))
testnet.NoError("failed to create genesis node",
testNet.CreateGenesisNode(v, 10000000, 0,
testnet.DefaultResources, false))
}

logger.Println("Creating txsim")
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func E2ESimple(logger *log.Logger) error {
defer testNet.Cleanup()

logger.Println("Creating testnet validators")
testnet.NoError("failed to create genesis nodes", testNet.CreateGenesisNodes(4, latestVersion, 10000000, 0, testnet.DefaultResources))
testnet.NoError("failed to create genesis nodes",
testNet.CreateGenesisNodes(4, latestVersion, 10000000, 0,
testnet.DefaultResources, true))

logger.Println("Creating txsim")
endpoints, err := testNet.RemoteGRPCEndpoints()
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/testnet/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func NewNode(
upgradeHeight int64,
resources Resources,
grafana *GrafanaInfo,
disableBBR bool,
) (*Node, error) {
instance, err := knuu.NewInstance(name)
if err != nil {
Expand Down Expand Up @@ -148,6 +149,9 @@ func NewNode(
return nil, err
}
args := []string{"start", fmt.Sprintf("--home=%s", remoteRootDir), "--rpc.laddr=tcp://0.0.0.0:26657"}
if disableBBR {
args = append(args, "--force-no-bbr")
}
if upgradeHeight != 0 {
args = append(args, fmt.Sprintf("--v2-upgrade-height=%d", upgradeHeight))
}
Expand Down
16 changes: 10 additions & 6 deletions test/e2e/testnet/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ func (t *Testnet) SetConsensusMaxBlockSize(size int64) {
t.genesis.ConsensusParams.Block.MaxBytes = size
}

func (t *Testnet) CreateGenesisNode(version string, selfDelegation, upgradeHeight int64, resources Resources) error {
func (t *Testnet) CreateGenesisNode(version string, selfDelegation, upgradeHeight int64, resources Resources, disableBBR bool) error {
signerKey := t.keygen.Generate(ed25519Type)
networkKey := t.keygen.Generate(ed25519Type)
node, err := NewNode(fmt.Sprintf("val%d", len(t.nodes)), version, 0,
selfDelegation, nil, signerKey, networkKey, upgradeHeight, resources,
t.grafana)
t.grafana, disableBBR)
if err != nil {
return err
}
Expand All @@ -70,9 +70,9 @@ func (t *Testnet) CreateGenesisNode(version string, selfDelegation, upgradeHeigh
return nil
}

func (t *Testnet) CreateGenesisNodes(num int, version string, selfDelegation, upgradeHeight int64, resources Resources) error {
func (t *Testnet) CreateGenesisNodes(num int, version string, selfDelegation, upgradeHeight int64, resources Resources, disableBBR bool) error {
for i := 0; i < num; i++ {
if err := t.CreateGenesisNode(version, selfDelegation, upgradeHeight, resources); err != nil {
if err := t.CreateGenesisNode(version, selfDelegation, upgradeHeight, resources, disableBBR); err != nil {
return err
}
}
Expand Down Expand Up @@ -232,12 +232,12 @@ func (t *Testnet) CreateAccount(name string, tokens int64, txsimKeyringDir strin
return kr, nil
}

func (t *Testnet) CreateNode(version string, startHeight, upgradeHeight int64, resources Resources) error {
func (t *Testnet) CreateNode(version string, startHeight, upgradeHeight int64, resources Resources, disableBBR bool) error {
signerKey := t.keygen.Generate(ed25519Type)
networkKey := t.keygen.Generate(ed25519Type)
node, err := NewNode(fmt.Sprintf("val%d", len(t.nodes)), version,
startHeight, 0, nil, signerKey, networkKey, upgradeHeight, resources,
t.grafana)
t.grafana, disableBBR)
if err != nil {
return err
}
Expand Down Expand Up @@ -383,8 +383,12 @@ func (t *Testnet) StartNodes() error {
for _, node := range genesisNodes {
err := node.WaitUntilStartedAndForwardPorts()
if err != nil {
log.Err(err).Str("name", node.Name).Str("version",
node.Version).Msg("failed to start and forward ports")
return fmt.Errorf("node %s failed to start: %w", node.Name, err)
}
log.Info().Str("name", node.Name).Str("version",
node.Version).Msg("started and ports forwarded")
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion tools/blocketa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ arrivalTime: 2024-08-28 17:24:23.483542677 +0000 UTC
```

> [!NOTE]
> The block time is currently hard-coded. If you're running this for a network with a different block time, you'll need to update the `blockTime` constant in the main.go file. You can use <https://www.mintscan.io/celestia/block/> or the blocktime tool.
> The block time is currently hard-coded. If you're running this for a network with a different block time, you'll need to update the `blockTime` constant in the main.go file. You can use [https://www.mintscan.io/celestia/block](https://www.mintscan.io/celestia/block/) or the blocktime tool.

0 comments on commit 9b6980b

Please sign in to comment.