Skip to content

Commit

Permalink
Merge branch 'main' into rp/improve-single-node
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp authored Nov 25, 2024
2 parents 7481ec5 + 0bfd074 commit f7be64c
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ pull_request_rules:
backport:
branches:
- v2.x
- name: backport patches to v3.x branch
conditions:
- base=main
- label=backport:v3.x
actions:
backport:
branches:
- v3.x
- name: forward-port patches to main branch (v1.x)
conditions:
- base=v1.x
Expand Down
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ goreleaser-check:
fi
docker run \
--rm \
-e CGO_ENABLED=1 \
--env CGO_ENABLED=1 \
--env GORELEASER_CURRENT_TAG=${GIT_TAG} \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
Expand All @@ -239,7 +240,8 @@ prebuilt-binary:
fi
docker run \
--rm \
-e CGO_ENABLED=1 \
--env CGO_ENABLED=1 \
--env GORELEASER_CURRENT_TAG=${GIT_TAG} \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
Expand Down Expand Up @@ -274,6 +276,22 @@ enable-bbr:
fi
.PHONY: enable-bbr

## disable-bbr: Disable BBR congestion control algorithm and revert to default.
disable-bbr:
@echo "Disabling BBR and reverting to default congestion control algorithm..."
@if [ "$$(sysctl net.ipv4.tcp_congestion_control | awk '{print $$3}')" = "bbr" ]; then \
echo "BBR is currently enabled. Reverting to Cubic..."; \
sudo sed -i '/^net.core.default_qdisc=fq/d' /etc/sysctl.conf; \
sudo sed -i '/^net.ipv4.tcp_congestion_control=bbr/d' /etc/sysctl.conf; \
sudo modprobe -r tcp_bbr; \
echo "net.ipv4.tcp_congestion_control=cubic" | sudo tee -a /etc/sysctl.conf; \
sudo sysctl -p; \
echo "BBR has been disabled, and Cubic is now the default congestion control algorithm."; \
else \
echo "BBR is not enabled. No changes made."; \
fi
.PHONY: disable-bbr

## enable-mptcp: Enable mptcp over multiple ports (not interfaces). Only works on Linux Kernel 5.6 and above.
enable-mptcp:
@echo "Configuring system to use mptcp..."
Expand All @@ -285,7 +303,7 @@ enable-mptcp:
@echo "net.mptcp.mptcp_path_manager=ndiffports" | sudo tee -a /etc/sysctl.conf
@echo "net.mptcp.mptcp_ndiffports=16" | sudo tee -a /etc/sysctl.conf
@echo "MPTCP configuration complete and persistent!"

.PHONY: enable-mptcp

## disable-mptcp: Disables mptcp over multiple ports. Only works on Linux Kernel 5.6 and above.
Expand Down Expand Up @@ -315,7 +333,6 @@ configure-v3:
sed -i "s/^send_rate = .*/send_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \
sed -i "s/ttl-num-blocks = .*/ttl-num-blocks = 12/" $(CONFIG_FILE); \
fi

.PHONY: configure-v3


Expand All @@ -324,4 +341,3 @@ debug-version:
@echo "GIT_TAG: $(GIT_TAG)"
@echo "VERSION: $(VERSION)"
.PHONY: debug-version

2 changes: 1 addition & 1 deletion docs/maintainers/release-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Follow the [creating a release candidate](#creating-a-release-candidate) section
- The version tag should not include the `-rc` suffix.
- If the release targets a testnet, suffix the release with `-arabica` or `-mocha`.
- The release notes should contain an **Upgrade Notice** section with notable changes for node operators or library consumers.
- The release notes section should contain a link to https://github.com/celestiaorg/celestia-app/blob/main/docs/release-notes/release-notes.md where we capture breaking changes
- The release notes section should contain a link to <https://github.com/celestiaorg/celestia-app/blob/main/docs/release-notes/release-notes.md> where we capture breaking changes

After creating the release:

Expand Down
6 changes: 3 additions & 3 deletions docs/release-notes/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ This guide provides notes for major version releases. These notes may be helpful
#### Enabling BBR and MCTCP

Consensus node operators must enable the BBR (Bottleneck Bandwidth and Round-trip propagation time) congestion control algorithm. See [#3774](https://github.com/celestiaorg/celestia-app/pull/3774).
if using linux in docker, kubernetes, a vm or baremetal, this can be done by calling
if using linux in docker, kubernetes, a vm or baremetal, this can be done by calling

```sh
make enable-bbr
make enable-bbr
```

command on the host machine.
Expand Down Expand Up @@ -54,7 +54,7 @@ You can track the tally of signalling by validators using the following query
celestia-appd query signal tally 3
```

Once 5/6+ of the voting power have signalled, the upgrade will be ready. There is a hard coded delay between confirmation of the upgrade and execution to the new state machine.
Once 5/6+ of the voting power have signalled, the upgrade will be ready. There is a hard coded delay between confirmation of the upgrade and execution to the new state machine.

To view the upcoming upgrade height use the following query:

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.23.1

require (
cosmossdk.io/errors v1.0.1
cosmossdk.io/math v1.3.0
cosmossdk.io/math v1.4.0
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0
github.com/celestiaorg/go-square v1.1.1
github.com/celestiaorg/go-square/v2 v2.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS
collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE=
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U=
cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ=
cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
Expand Down
10 changes: 10 additions & 0 deletions x/signal/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ func TestUpgradeIntegration(t *testing.T) {
_, err = app.SignalKeeper.TryUpgrade(ctx, nil)
require.NoError(t, err)

// Verify that if a user queries the version tally, it still works after a
// successful try upgrade.
res, err = app.SignalKeeper.VersionTally(ctx, &types.QueryVersionTallyRequest{
Version: 3,
})
require.NoError(t, err)
require.EqualValues(t, 1, res.VotingPower)
require.EqualValues(t, 1, res.ThresholdPower)
require.EqualValues(t, 1, res.TotalVotingPower)

// Verify that if a subsequent call to TryUpgrade is made, it returns an
// error because an upgrade is already pending.
_, err = app.SignalKeeper.TryUpgrade(ctx, nil)
Expand Down
7 changes: 7 additions & 0 deletions x/signal/keeper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package signal

import (
"bytes"
"context"
"encoding/binary"

Expand Down Expand Up @@ -122,6 +123,9 @@ func (k Keeper) VersionTally(ctx context.Context, req *types.QueryVersionTallyRe
iterator := store.Iterator(types.FirstSignalKey, nil)
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
if bytes.Equal(iterator.Key(), types.UpgradeKey) {
continue
}
valAddress := sdk.ValAddress(iterator.Key())
power := k.stakingKeeper.GetLastValidatorPower(sdkCtx, valAddress)
version := VersionFromBytes(iterator.Value())
Expand Down Expand Up @@ -158,6 +162,9 @@ func (k Keeper) TallyVotingPower(ctx sdk.Context, threshold int64) (bool, uint64
iterator := store.Iterator(types.FirstSignalKey, nil)
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
if bytes.Equal(iterator.Key(), types.UpgradeKey) {
continue
}
valAddress := sdk.ValAddress(iterator.Key())
// check that the validator is still part of the bonded set
val, found := k.stakingKeeper.GetValidator(ctx, valAddress)
Expand Down
36 changes: 36 additions & 0 deletions x/signal/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,42 @@ func TestGetUpgrade(t *testing.T) {
})
}

func TestTallyAfterTryUpgrade(t *testing.T) {
upgradeKeeper, ctx, _ := setup(t)
goCtx := sdk.WrapSDKContext(ctx)

_, err := upgradeKeeper.SignalVersion(goCtx, &types.MsgSignalVersion{
ValidatorAddress: testutil.ValAddrs[0].String(),
Version: 3,
})
require.NoError(t, err)

_, err = upgradeKeeper.SignalVersion(goCtx, &types.MsgSignalVersion{
ValidatorAddress: testutil.ValAddrs[1].String(),
Version: 3,
})
require.NoError(t, err)

_, err = upgradeKeeper.SignalVersion(goCtx, &types.MsgSignalVersion{
ValidatorAddress: testutil.ValAddrs[2].String(),
Version: 3,
})
require.NoError(t, err)

_, err = upgradeKeeper.TryUpgrade(goCtx, &types.MsgTryUpgrade{})
require.NoError(t, err)

// Previously there was a bug where querying for the version tally after a
// successful try upgrade would result in a panic. See
// https://github.com/celestiaorg/celestia-app/issues/4007
res, err := upgradeKeeper.VersionTally(goCtx, &types.QueryVersionTallyRequest{
Version: 2,
})
require.NoError(t, err)
require.EqualValues(t, 100, res.ThresholdPower)
require.EqualValues(t, 120, res.TotalVotingPower)
}

func setup(t *testing.T) (signal.Keeper, sdk.Context, *mockStakingKeeper) {
signalStore := sdk.NewKVStoreKey(types.StoreKey)
db := tmdb.NewMemDB()
Expand Down

0 comments on commit f7be64c

Please sign in to comment.