Skip to content

Commit

Permalink
Merge pull request #802 from celestiaorg/evan/backport-old-v0.35.x-ch…
Browse files Browse the repository at this point in the history
…anges

Backport v0.35.x changes to v0.34.x
  • Loading branch information
evan-forbes authored Aug 1, 2022
2 parents e5a89b7 + e499d0f commit 69b91f0
Show file tree
Hide file tree
Showing 48 changed files with 1,854 additions and 162 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- T:dependencies
allow:
- dependency-name: "*/celestiaorg/*"
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,4 @@ Additional tooling can be found in [/docs/tools](/docs/tools).

### Research

- [The latest gossip on BFT consensus](https://arxiv.org/abs/1807.04938)
- [Master's Thesis on Tendermint](https://atrium.lib.uoguelph.ca/xmlui/handle/10214/9769)
- [Original Whitepaper: "Tendermint: Consensus Without Mining"](https://tendermint.com/static/docs/tendermint.pdf)
- [Blog](https://blog.cosmos.network/tendermint/home)
We are hiring Go engineers! Join us in building the future of blockchain scaling and interoperability. [Apply here](https://jobs.lever.co/celestia).
3 changes: 2 additions & 1 deletion blockchain/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"

bcproto "github.com/tendermint/tendermint/proto/tendermint/blockchain"
"github.com/tendermint/tendermint/state/test/factory"
"github.com/tendermint/tendermint/types"
)

Expand Down Expand Up @@ -80,7 +81,7 @@ func TestBcStatusResponseMessageValidateBasic(t *testing.T) {

// nolint:lll // ignore line length in tests
func TestBlockchainMessageVectors(t *testing.T) {
block := types.MakeBlock(int64(3), []types.Tx{types.Tx("Hello World")}, nil, nil, nil)
block := types.MakeBlock(int64(3), factory.MakeData([]types.Tx{types.Tx("Hello World")}, nil, nil), nil)
block.Version.Block = 11 // overwrite updated protocol version

bpb, err := block.ToProto()
Expand Down
8 changes: 7 additions & 1 deletion blockchain/v0/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/test/factory"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
)
Expand Down Expand Up @@ -289,7 +290,12 @@ func makeTxs(height int64) (txs []types.Tx) {
}

func makeBlock(height int64, state sm.State, lastCommit *types.Commit) *types.Block {
block, _ := state.MakeBlock(height, makeTxs(height), nil, nil, lastCommit, state.Validators.GetProposer().Address)
block, _ := state.MakeBlock(
height,
factory.MakeData(makeTxs(height), nil, nil),
lastCommit,
state.Validators.GetProposer().Address,
)
return block
}

Expand Down
3 changes: 2 additions & 1 deletion blockchain/v1/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/tendermint/tendermint/libs/log"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/state/test/factory"
"github.com/tendermint/tendermint/types"
)

Expand Down Expand Up @@ -276,5 +277,5 @@ func checkByStoppingPeerTimer(t *testing.T, peer *BpPeer, running bool) {
}

func makeSmallBlock(height int) *types.Block {
return types.MakeBlock(int64(height), []types.Tx{types.Tx("foo")}, nil, nil, nil)
return types.MakeBlock(int64(height), factory.MakeDataFromTxs([]types.Tx{types.Tx("foo")}), nil)
}
13 changes: 7 additions & 6 deletions blockchain/v1/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/state/test/factory"
"github.com/tendermint/tendermint/types"
)

Expand Down Expand Up @@ -81,7 +82,7 @@ func makeBlockPool(bcr *testBcR, height int64, peers []BpPeer, blocks map[int64]
bPool.peers[p.id].RequestSent(h)
if p.create {
// simulate that a block at height h has been received
_ = bPool.peers[p.id].AddBlock(types.MakeBlock(h, txs, nil, nil, nil), 100)
_ = bPool.peers[p.id].AddBlock(types.MakeBlock(h, factory.MakeDataFromTxs(txs), nil), 100)
}
}
return bPool
Expand Down Expand Up @@ -392,7 +393,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
pool: makeBlockPool(testBcR, 10, []BpPeer{{ID: "P1", Height: 100}}, map[int64]tPBlocks{}),
args: args{
peerID: "P2",
block: types.MakeBlock(int64(10), txs, nil, nil, nil),
block: types.MakeBlock(int64(10), factory.MakeDataFromTxs(txs), nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10, []BpPeer{{ID: "P1", Height: 100}}, map[int64]tPBlocks{}),
Expand All @@ -404,7 +405,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
map[int64]tPBlocks{10: {"P1", false}}),
args: args{
peerID: "P1",
block: types.MakeBlock(int64(11), txs, nil, nil, nil),
block: types.MakeBlock(int64(11), factory.MakeDataFromTxs(txs), nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -418,7 +419,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
map[int64]tPBlocks{10: {"P1", true}, 11: {"P1", false}}),
args: args{
peerID: "P1",
block: types.MakeBlock(int64(10), txs, nil, nil, nil),
block: types.MakeBlock(int64(10), factory.MakeDataFromTxs(txs), nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -432,7 +433,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
map[int64]tPBlocks{10: {"P1", false}}),
args: args{
peerID: "P2",
block: types.MakeBlock(int64(10), txs, nil, nil, nil),
block: types.MakeBlock(int64(10), factory.MakeDataFromTxs(txs), nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -446,7 +447,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
map[int64]tPBlocks{10: {"P1", false}}),
args: args{
peerID: "P1",
block: types.MakeBlock(int64(10), txs, nil, nil, nil),
block: types.MakeBlock(int64(10), factory.MakeDataFromTxs(txs), nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand Down
5 changes: 3 additions & 2 deletions blockchain/v1/reactor_fsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
tmmath "github.com/tendermint/tendermint/libs/math"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/state/test/factory"
"github.com/tendermint/tendermint/types"
)

Expand Down Expand Up @@ -142,7 +143,7 @@ func sBlockRespEv(current, expected string, peerID p2p.ID, height int64, prevBlo
data: bReactorEventData{
peerID: peerID,
height: height,
block: types.MakeBlock(height, txs, nil, nil, nil),
block: types.MakeBlock(height, factory.MakeDataFromTxs(txs), nil),
length: 100},
wantState: expected,
wantNewBlocks: append(prevBlocks, height),
Expand All @@ -159,7 +160,7 @@ func sBlockRespEvErrored(current, expected string,
data: bReactorEventData{
peerID: peerID,
height: height,
block: types.MakeBlock(height, txs, nil, nil, nil),
block: types.MakeBlock(height, factory.MakeDataFromTxs(txs), nil),
length: 100},
wantState: expected,
wantErr: wantErr,
Expand Down
8 changes: 7 additions & 1 deletion blockchain/v1/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/state/test/factory"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
Expand Down Expand Up @@ -356,7 +357,12 @@ func makeTxs(height int64) (txs []types.Tx) {
}

func makeBlock(height int64, state sm.State, lastCommit *types.Commit) *types.Block {
block, _ := state.MakeBlock(height, makeTxs(height), nil, nil, lastCommit, state.Validators.GetProposer().Address)
block, _ := state.MakeBlock(
height,
factory.MakeDataFromTxs(makeTxs(height)),
lastCommit,
state.Validators.GetProposer().Address,
)
return block
}

Expand Down
8 changes: 7 additions & 1 deletion blockchain/v2/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
bcproto "github.com/tendermint/tendermint/proto/tendermint/blockchain"
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/state/test/factory"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
Expand Down Expand Up @@ -456,7 +457,12 @@ func makeTxs(height int64) (txs []types.Tx) {
}

func makeBlock(height int64, state sm.State, lastCommit *types.Commit) *types.Block {
block, _ := state.MakeBlock(height, makeTxs(height), nil, nil, lastCommit, state.Validators.GetProposer().Address)
block, _ := state.MakeBlock(
height,
factory.MakeDataFromTxs(makeTxs(height)),
lastCommit,
state.Validators.GetProposer().Address,
)
return block
}

Expand Down
8 changes: 7 additions & 1 deletion consensus/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/state/test/factory"
"github.com/tendermint/tendermint/types"
)

Expand Down Expand Up @@ -990,7 +991,12 @@ func makeBlock(state sm.State, lastBlock *types.Block, lastBlockMeta *types.Bloc
lastBlockMeta.BlockID, []types.CommitSig{vote.CommitSig()})
}

return state.MakeBlock(height, []types.Tx{}, nil, nil, lastCommit, state.Validators.GetProposer().Address)
return state.MakeBlock(
height,
factory.MakeDataFromTxs([]types.Tx{}),
lastCommit,
state.Validators.GetProposer().Address,
)
}

type badApp struct {
Expand Down
63 changes: 63 additions & 0 deletions docs/celestia-architecture/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
order: 1
parent:
order: false
---

# Tendermint and Celestia

celestia-core is not meant to be used as a general purpose framework.
Instead, its main purpose is to provide certain components (mainly consensus but also a p2p layer for Tx gossiping) for the Celestia main chain.
Hence, we do not provide any extensive documentation here.

Instead of keeping a copy of the Tendermint documentation, we refer to the existing extensive and maintained documentation and specification:

- <https://docs.tendermint.com/>
- <https://github.com/tendermint/tendermint/tree/master/docs/>
- <https://github.com/tendermint/spec>

Reading these will give you a lot of background and context on Tendermint which will also help you understand how celestia-core and [celestia-app](https://github.com/celestiaorg/celestia-app) interact with each other.

## Celestia

As mentioned above, celestia-core aims to be more focused on the Celestia use-case than vanilla Tendermint.
Moving forward we might provide a clear overview on the changes we incorporated.
For now, we refer to the Celestia specific ADRs in this repository as well as to the Celestia specification:

- [celestia-specs](https://github.com/celestiaorg/celestia-specs)

## Architecture Decision Records (ADR)

This is a location to record all high-level architecture decisions in this repository.

You can read more about the ADR concept in this [blog post](https://product.reverb.com/documenting-architecture-decisions-the-reverb-way-a3563bb24bd0#.78xhdix6t).

An ADR should provide:

- Context on the relevant goals and the current state
- Proposed changes to achieve the goals
- Summary of pros and cons
- References
- Changelog

Note the distinction between an ADR and a spec. The ADR provides the context, intuition, reasoning, and
justification for a change in architecture, or for the architecture of something
new. The spec is much more compressed and streamlined summary of everything as
it stands today.

If recorded decisions turned out to be lacking, convene a discussion, record the new decisions here, and then modify the code to match.

Note the context/background should be written in the present tense.

To start a new ADR, you can use this template: [adr-template.md](./adr-template.md)

### Table of Contents

- [ADR 001: Erasure Coding Block Propagation](./adr-001-block-propagation.md)
- [ADR 002: Sampling erasure coded Block chunks](./adr-002-ipld-da-sampling.md)
- [ADR 003: Retrieving Application messages](./adr-003-application-data-retrieval.md)
- [ADR 004: Data Availability Sampling Light Client](./adr-004-mvp-light-client.md)
- [ADR 005: Decouple BlockID and PartSetHeader](./adr-005-decouple-blockid-and-partsetheader.md)
- [ADR 006: Row Propagation](./adr-006-row-propagation.md)
- [ADR 007: Minimal Changes to Tendermint](./adr-007-minimal-changes-to-tendermint.md)
- [ADR 008: Updating to Tendermint v0.35.x](./adr-008-updating-to-tendermint-v0.35.x.md)
Loading

0 comments on commit 69b91f0

Please sign in to comment.