Skip to content

Commit

Permalink
remove ISRs for now (#723)
Browse files Browse the repository at this point in the history
- leave placeholder in proto files
- comment out NID
  • Loading branch information
liamsi authored Apr 15, 2022
1 parent 6f335f6 commit fff2389
Show file tree
Hide file tree
Showing 28 changed files with 224 additions and 555 deletions.
4 changes: 2 additions & 2 deletions blockchain/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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, nil)
block := types.MakeBlock(int64(3), []types.Tx{types.Tx("Hello World")}, nil, nil, nil)
block.Version.Block = 11 // overwrite updated protocol version

bpb, err := block.ToProto()
Expand All @@ -97,7 +97,7 @@ func TestBlockchainMessageVectors(t *testing.T) {
BlockRequest: &bcproto.BlockRequest{Height: math.MaxInt64}}},
"0a0a08ffffffffffffffff7f"},
{"BlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_BlockResponse{
BlockResponse: &bcproto.BlockResponse{Block: bpb}}}, "1a760a740a5b0a02080b1803220b088092b8c398feffffff012a0212003a20269ece38583f42aaf53fdd3abe1f570ab9b0d08284d080900966040a29df504c6a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b85512150a0b48656c6c6f20576f726c6412001a0022002801"},
BlockResponse: &bcproto.BlockResponse{Block: bpb}}}, "1a740a720a5b0a02080b1803220b088092b8c398feffffff012a0212003a20269ece38583f42aaf53fdd3abe1f570ab9b0d08284d080900966040a29df504c6a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b85512130a0b48656c6c6f20576f726c641a0022002801"},
{"NoBlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_NoBlockResponse{
NoBlockResponse: &bcproto.NoBlockResponse{Height: 1}}}, "12020801"},
{"NoBlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_NoBlockResponse{
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v0/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ 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, nil, lastCommit, state.Validators.GetProposer().Address)
block, _ := state.MakeBlock(height, makeTxs(height), nil, nil, lastCommit, state.Validators.GetProposer().Address)
return block
}

Expand Down
2 changes: 1 addition & 1 deletion blockchain/v1/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,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, nil)
return types.MakeBlock(int64(height), []types.Tx{types.Tx("foo")}, nil, nil, nil)
}
12 changes: 6 additions & 6 deletions blockchain/v1/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,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, nil), 100)
_ = bPool.peers[p.id].AddBlock(types.MakeBlock(h, txs, nil, nil, nil), 100)
}
}
return bPool
Expand Down Expand Up @@ -392,7 +392,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, nil),
block: types.MakeBlock(int64(10), txs, nil, nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10, []BpPeer{{ID: "P1", Height: 100}}, map[int64]tPBlocks{}),
Expand All @@ -404,7 +404,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, nil),
block: types.MakeBlock(int64(11), txs, nil, nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -418,7 +418,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, nil),
block: types.MakeBlock(int64(10), txs, nil, nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -432,7 +432,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, nil),
block: types.MakeBlock(int64(10), txs, nil, nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -446,7 +446,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, nil),
block: types.MakeBlock(int64(10), txs, nil, nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand Down
4 changes: 2 additions & 2 deletions blockchain/v1/reactor_fsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,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, nil),
block: types.MakeBlock(height, txs, nil, nil, nil),
length: 100},
wantState: expected,
wantNewBlocks: append(prevBlocks, height),
Expand All @@ -159,7 +159,7 @@ func sBlockRespEvErrored(current, expected string,
data: bReactorEventData{
peerID: peerID,
height: height,
block: types.MakeBlock(height, txs, nil, nil, nil, nil),
block: types.MakeBlock(height, txs, nil, nil, nil),
length: 100},
wantState: expected,
wantErr: wantErr,
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v1/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ 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, nil, lastCommit, state.Validators.GetProposer().Address)
block, _ := state.MakeBlock(height, makeTxs(height), nil, nil, lastCommit, state.Validators.GetProposer().Address)
return block
}

Expand Down
2 changes: 1 addition & 1 deletion blockchain/v2/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ 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, nil, lastCommit, state.Validators.GetProposer().Address)
block, _ := state.MakeBlock(height, makeTxs(height), nil, nil, lastCommit, state.Validators.GetProposer().Address)
return block
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ 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, nil, lastCommit, state.Validators.GetProposer().Address)
return state.MakeBlock(height, []types.Tx{}, nil, nil, lastCommit, state.Validators.GetProposer().Address)
}

type badApp struct {
Expand Down
4 changes: 2 additions & 2 deletions evidence/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func TestEvidencePoolUpdate(t *testing.T) {
ev := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultEvidenceTime.Add(21*time.Minute),
val, evidenceChainID)
lastCommit := makeCommit(height, val.PrivKey.PubKey().Address())
block := types.MakeBlock(height+1, []types.Tx{}, []types.Evidence{ev}, nil, nil, lastCommit)
block := types.MakeBlock(height+1, []types.Tx{}, []types.Evidence{ev}, nil, lastCommit)

// update state (partially)
state.LastBlockHeight = height + 1
Expand Down Expand Up @@ -404,7 +404,7 @@ func initializeBlockStore(db dbm.DB, state sm.State, valAddr []byte) *store.Bloc

for i := int64(1); i <= state.LastBlockHeight; i++ {
lastCommit := makeCommit(i-1, valAddr)
block, _ := state.MakeBlock(i, []types.Tx{}, nil, nil, nil, lastCommit,
block, _ := state.MakeBlock(i, []types.Tx{}, nil, nil, lastCommit,
state.Validators.GetProposer().Address)
block.Header.Time = defaultEvidenceTime.Add(time.Duration(i) * time.Minute)
block.Header.Version = tmversion.Consensus{Block: version.BlockProtocol, App: 1}
Expand Down
6 changes: 4 additions & 2 deletions pkg/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,19 @@ var (
TxNamespaceID = namespace.ID{0, 0, 0, 0, 0, 0, 0, 1}
// IntermediateStateRootsNamespaceID is the namespace reserved for
// intermediate state root data
IntermediateStateRootsNamespaceID = namespace.ID{0, 0, 0, 0, 0, 0, 0, 2}
// TODO(liamsi): code commented out but kept intentionally.
// IntermediateStateRootsNamespaceID = namespace.ID{0, 0, 0, 0, 0, 0, 0, 2}

// EvidenceNamespaceID is the namespace reserved for evidence
EvidenceNamespaceID = namespace.ID{0, 0, 0, 0, 0, 0, 0, 3}

// MaxReservedNamespace is the lexicographically largest namespace that is
// reserved for protocol use. It is derived from NAMESPACE_ID_MAX_RESERVED
// https://github.com/celestiaorg/celestia-specs/blob/master/specs/consensus.md#constants
MaxReservedNamespace = namespace.ID{0, 0, 0, 0, 0, 0, 0, 255}
// TailPaddingNamespaceID is the namespace ID for tail padding. All data
// with this namespace will be ignored
TailPaddingNamespaceID = namespace.ID{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}

// ParitySharesNamespaceID indicates that share contains erasure data
ParitySharesNamespaceID = namespace.ID{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}

Expand Down
5 changes: 0 additions & 5 deletions pkg/prove/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ func genOrigRowShares(data types.Data, originalSquareSize, startRow, endRow uint
return shares[startPos:wantLen].RawShares()
}

shares = append(shares, data.IntermediateStateRoots.SplitIntoShares()...)
if uint(len(shares)) >= wantLen {
return shares[startPos:wantLen].RawShares()
}

shares = append(shares, data.Evidence.SplitIntoShares()...)
if uint(len(shares)) >= wantLen {
return shares[startPos:wantLen].RawShares()
Expand Down
Loading

0 comments on commit fff2389

Please sign in to comment.