Skip to content
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

feat: tiasync: add support for vote extensions #18

Merged
merged 16 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions docs/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,43 @@ func AddCommands(
}
```

## `root.go` wiring

In your application root file, typically named `cmd/$APP/root.go`, incorporate the following to wire up tiasync.

1. Imports

Within the imported packages, add the `tiasync` dependency.

```golang
import (
// ...
"github.com/rollchains/tiablob/tiasync"
)
```

2. Tiasync PersistentPreRunE command

```golang
func NewRootCmd() *cobra.Command {
// ...
rootCmd := &cobra.Command{
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// ...
if err := server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig); err != nil {
return err
}

srvCtx := server.GetServerContextFromCmd(cmd)
tiasync.TiasyncPrerunRoutine(version.AppName, cmd, srvCtx)

return nil
},
}
// ...
}
```

## Existing chains

Existing chains will have an additional step. An upgrade handler will be needed to set the proven height to the upgrade height.
Expand Down
33 changes: 2 additions & 31 deletions docs/tiasync.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,17 @@
# Overview

Tiasync allows a fullnode to sync and execute blocks from Celestia instead of the validator network. It is a cometbft p2p proxy that sits between the fullnode's cometbft p2p network and validator network. Individual blocks come from Celestia, state sync snapshots/chunks come from the validator network, and transactions are propagated to the validator network.
Tiasync allows a fullnode to sync and execute blocks from Celestia instead of the validator network. It is a Cometbft p2p proxy that sits between the fullnode's Cometbft p2p network and validator network. Individual blocks come from Celestia, state sync snapshots/chunks come from the validator network, and transactions are propagated to the validator network.

## Configuration

The minimum configurations for tiasync are below. These are in addition to the required Celestia/tiablob configurations. When tiasync is enabled, these minimum configurations will be verified so that the fullnode cannot connect to the validator network directly.

config.toml
```toml
[p2p]
# Listen address must be localhost only, port can be changed
laddr = "tcp://127.0.0.1:26777"

# Must have no seeds
seeds = ""

# Must have no persistent peers
persistent_peers = ""

# Address book must not be strict
addr_book_strict = false

# Duplicate ips should be allowed (local fullnode and tiasync)
allow_duplicate_ip = true

# Pex must be false/disabled
pex = false
```
The minimum configuration for tiasync is below, but other default values can be overridden. This is in addition to the required Celestia/tiablob configurations. Tiasync will use Cometbft's p2p configurations to peer with the validator network while the fullnode will only peer with tiasync.

app.toml
```toml
[tiasync]
# turns on tiasync
enable = true

# Address for tiasync to listen for incoming connection from the validator network
laddr = "tcp://0.0.0.0:26656"

# Peers that are upstream from this fullnode and on the validator network
# optional when only syncing from genesis, but necessary for state sync and transaction propagation
upstream-peers = "upstream-node1-id@ip:port,upstream-node2-id@ip:port"

```

## Block sync
Expand Down
2 changes: 1 addition & 1 deletion interchaintest/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// TestBasicChain starts a rollchain chain and restores a celestia account in tiablob
func TestBasicChain(t *testing.T) {
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
setup.RollchainChainSpec(t.Name(), 1, 0, "rc_demo", 0),
setup.RollchainChainSpec(t.Name(), 1, 0, "rc_demo", 0, "0"),
})

chains, err := cf.Chains(t.Name())
Expand Down
2 changes: 1 addition & 1 deletion interchaintest/feegrant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var FundsAmount = sdkmath.NewInt(1000_000000) // 1k tokens
// TestFeegrant verifies that validators can set up fee grant
func TestFeegrant(t *testing.T) {
nv := 4
rollchainCs := setup.RollchainChainSpec(t.Name(), nv, 0, "rc_demo", 0)
rollchainCs := setup.RollchainChainSpec(t.Name(), nv, 0, "rc_demo", 0, "0")
celestiaCs := setup.CelestiaChainSpec()
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
rollchainCs,
Expand Down
92 changes: 45 additions & 47 deletions interchaintest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,32 @@ replace (
require (
cosmossdk.io/math v1.3.0
cosmossdk.io/x/upgrade v0.1.1
github.com/cometbft/cometbft v0.38.5
github.com/cosmos/cosmos-sdk v0.50.4
github.com/docker/docker v24.0.7+incompatible
github.com/cometbft/cometbft v0.38.7
github.com/cosmos/cosmos-sdk v0.50.6
github.com/docker/docker v24.0.9+incompatible
github.com/rollchains/tiablob v0.0.0-20240425203245-3063be3fdb53
github.com/strangelove-ventures/globalfee v0.50.0
github.com/strangelove-ventures/interchaintest/v8 v8.2.0
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.27.0
golang.org/x/sync v0.7.0
)

require (
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.36.0 // indirect
cosmossdk.io/api v0.7.3 // indirect
cloud.google.com/go/storage v1.37.0 // indirect
cosmossdk.io/api v0.7.4 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.12.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/log v1.3.1 // indirect
cosmossdk.io/store v1.0.2 // indirect
cosmossdk.io/store v1.1.0 // indirect
cosmossdk.io/x/feegrant v0.1.0 // indirect
cosmossdk.io/x/tx v0.13.1 // indirect
cosmossdk.io/x/tx v0.13.2 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
Expand All @@ -73,23 +74,23 @@ require (
github.com/celestiaorg/rsmt2d v0.12.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.9.1 // indirect
github.com/cometbft/cometbft-db v0.10.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.0.2 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/gogoproto v1.4.11 // indirect
github.com/cosmos/iavl v1.0.1 // indirect
github.com/cosmos/gogoproto v1.4.12 // indirect
github.com/cosmos/iavl v1.1.2 // indirect
github.com/cosmos/ibc-go/modules/capability v1.0.0 // indirect
github.com/cosmos/ibc-go/v8 v8.1.0 // indirect
github.com/cosmos/ibc-go/v8 v8.2.1 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
Expand All @@ -110,7 +111,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/emicklei/dot v1.6.1 // indirect
github.com/ethereum/go-ethereum v1.13.14 // indirect
github.com/ethereum/go-ethereum v1.14.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
Expand Down Expand Up @@ -144,14 +145,15 @@ require (
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.3 // indirect
github.com/hashicorp/go-getter v1.7.4 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.2 // indirect
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-plugin v1.5.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
Expand All @@ -164,24 +166,23 @@ require (
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/klauspost/reedsolomon v1.12.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.32.0 // indirect
github.com/linxGnu/grocksdb v1.8.12 // indirect
github.com/linxGnu/grocksdb v1.8.14 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20230913220906-b988ea7da0c2 // indirect
github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20240603204351-26b456ae3afe // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -194,20 +195,21 @@ require (
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect
github.com/pierrec/xxHash v0.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.47.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.52.2 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
Expand All @@ -228,6 +230,7 @@ require (
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tendermint/tendermint v0.34.29 // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/tidwall/gjson v1.17.1 // indirect
github.com/tyler-smith/go-bip32 v1.0.0 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
Expand All @@ -241,38 +244,33 @@ require (
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.18.0 // indirect
golang.org/x/tools v0.20.0 // indirect
google.golang.org/api v0.162.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect
google.golang.org/grpc v1.62.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
lukechampine.com/uint128 v1.3.0 // indirect
modernc.org/cc/v3 v3.41.0 // indirect
modernc.org/ccgo/v3 v3.16.15 // indirect
modernc.org/libc v1.29.0 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.49.3 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.7.2 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.28.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.29.9 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
nhooyr.io/websocket v1.8.10 // indirect
Expand Down
Loading