Skip to content

Commit

Permalink
Update base (#28)
Browse files Browse the repository at this point in the history
* Address more concerns highlighted by linters

These changes remove dead code, add error checks, and use assign unused
variables to the unnamed variable `_`.

Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>

* Fixed write_first_app.rst typo

Signed-off-by: pratikpatil024 <pratikspatil024@gmail.com>

* FAB-17840 Ch.Part.API: Join channel REST handler (hyperledger#1305)

* FAB-17840 Ch.Part.API: Join channel REST handler

Implement a handler for a POST request to join a channel.

Here we support requests carrying application/json, support
for additional Content-Type will be added later.

Signed-off-by: Yoav Tock <tock@il.ibm.com>
Change-Id: I8d09e3cba09842f2adc47fb60161eee814e33d31

* Review: simplify code

Signed-off-by: Yoav Tock <tock@il.ibm.com>
Change-Id: Iee1e8b66cb77f64b9762dee8f85304958081e0fe

* Review comments: simplify code

- extract error handling to separate method
- extract channelID extraction to separate method, reuse
- test Accept header allowed range
- better comments

Signed-off-by: Yoav Tock <tock@il.ibm.com>
Change-Id: I11639a3f159694019e521e180e7fd5fadb42cb4f

* Review comments: support for multipart/form-data

Signed-off-by: Yoav Tock <tock@il.ibm.com>
Change-Id: Ic5a0307f56be5561f45910a02892dc7e7b9554d1

* Review comments: remove support for application/json

Signed-off-by: Yoav Tock <tock@il.ibm.com>
Change-Id: I38bb3564a0e6482b7bf9dca25bd8424e6db2ac95

* Spelling: s/chainocde/chaincode/g

Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com>

* Retire dormant Fabric maintainers

Retire maintainers that have been inactive for the last 3 months:
Jonathan Levi
Srinivasan Muralidharan

Note:
"A maintainer removed for inactivity should be restored following a
sustained resumption of contributions and reviews (a month or more)
demonstrating a renewed commitment to the project."

Signed-off-by: David Enyeart <enyeart@us.ibm.com>

* add NOTICE file

recommended per ASF and LF policy

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>

* Add NOTICE to license ignore list

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>

* Fix some typo in docs

This CR fixes the following some typo in docs.
- chainocode -> chaincode
- chainode -> chaincode
- lifecyle -> lifecycle
- Hyperlegder -> Hyperledger
- chanel -> channel
- scructured -> structured
- demostrate -> demonstrate
- certficates -> certificates
- how how -> how
- the the -> the
- a a -> a
- thefollowing -> the following

Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com>

* Remove txmgr interface

This commit removes the interface TxMgr, as there is a single
implementation (i.e., LockbasedTxmgr). All the dependent packages
are able to use this single implementation directly.
The only exception is the validation package that causes a circular
dependency. the validation package uses only a single function from this
interface (NewTxSimulator). The validation package uses this function
for getting accessing to the TxSimulator, in order to allow for the
execution a post-order transaction (only channel config transaction in
the current code). For meeting this need, this commit now defines a
local interface with a single function in the validation package itself.

Signed-off-by: manish <manish.sethi@gmail.com>

* FAB-17841: Ch.Part.API: Remove channel REST handler (hyperledger#1330)

Handle DELETE request to remove a channel.

- Resolve the removeStorage flag from config & query.
- If system-channel exists - reject with StatusMethodNotAllowed and
  Allow header set to GET.
- If channel does not exist - reject with StatusNotFound.
- If successs - respond with StatusNoContent.

Signed-off-by: Yoav Tock <tock@il.ibm.com>
Change-Id: I78581df3c7f0cb99007edddc83eb7a6dca5eba07

* Update commercial paper doc to use enrollUser.js

Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>

* Use protolator from fabric-config

Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com>

* Revert "Bump viper version to the last working commit"

This reverts commit 5ad0a4f.

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>

* _lifecycle ignore previous build failure during install (hyperledger#1280)

When a chaincode build previously failed while installing the
chaincode, _lifecycle should ignore the cached error and attempt
to rebuild the chaincode. This is because we should assume the
end user knows something about why the build may succeed on retry
if they're reattempting an install.

Also, update integration tests to not care about exit status of
chaincode installs (since reinstalls now error).

FAB-17907

Signed-off-by: Will Lahti <wtlahti@us.ibm.com>

* [FAB-17927] Add AllChaincodesInfo to DeployedChaincodeInfoProvider (hyperledger#1331)

Implement AllChaincodesInfo to query ledger and return chaincode info
for all the deployed chaincode (both new lifecycle and legacy chaincodes)
on a channel. This function is needed for ledger checkpointing
and deletion of channel-specific databases in statecouchdb.

Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>

Co-authored-by: Matthew Sykes <sykesmat@us.ibm.com>
Co-authored-by: pratikpatil024 <pratikspatil024@gmail.com>
Co-authored-by: Yoav Tock <tock@il.ibm.com>
Co-authored-by: Matthew Sykes <matthew.sykes@gmail.com>
Co-authored-by: David Enyeart <enyeart@us.ibm.com>
Co-authored-by: Christopher Ferris <chrisfer@us.ibm.com>
Co-authored-by: Brett Logan <brett.t.logan@ibm.com>
Co-authored-by: Nao Nishijima <nao.nishijima.xt@hitachi.com>
Co-authored-by: manish <manish.sethi@gmail.com>
Co-authored-by: NIKHIL E GUPTA <negupta@us.ibm.com>
Co-authored-by: Will Lahti <wtlahti@us.ibm.com>
Co-authored-by: Wenjian Qiao <wenjianq@gmail.com>
  • Loading branch information
13 people committed May 28, 2020
1 parent 80c50eb commit 245c88e
Show file tree
Hide file tree
Showing 319 changed files with 5,708 additions and 21,770 deletions.
4 changes: 2 additions & 2 deletions MAINTAINERS.md
Expand Up @@ -12,11 +12,9 @@ Maintainers
| Chris Ferris | [christo4ferris][christo4ferris] | cbf | <chris.ferris@gmail.com>
| Dave Enyeart | [denyeart][denyeart] | dave.enyeart | <enyeart@us.ibm.com>
| Jay Guo | [guoger][guoger] | guoger | <guojiannan1101@gmail.com>
| Jonathan Levi | [hacera][hacera] |JonathanLevi | <jonathan@hacera.com>
| Jason Yellick | [jyellick][jyellick] | jyellick | <jyellick@us.ibm.com>
| Manish Sethi | [manish-sethi][manish-sethi] | manish-sethi | <manish.sethi@gmail.com>
| Gari Singh | [mastersingh24][mastersingh24] | mastersingh24 | <gari.r.singh@gmail.com>
| Srinivasan Muralidharan | [muralisrini][muralisrini] | muralisr | <srinivasan.muralidharan99@gmail.com>
| Matthew Sykes | [sykesm][sykesm] | sykesm | <sykesmat@us.ibm.com>
| Yacov Manevich | [yacovm][yacovm] | yacovm | <yacovm@il.ibm.com>

Expand Down Expand Up @@ -46,9 +44,11 @@ Maintainers
| Binh Nguyen | [binhn][binhn] | binhn | <binh1010010110@gmail.com>
| Gabor Hosszu | [gabre][gabre] | hgabor | <gabor@digitalasset.com>
| Greg Haskins | [ghaskins][ghaskins] | ghaskins | <gregory.haskins@gmail.com>
| Jonathan Levi | [hacera][hacera] |JonathanLevi | <jonathan@hacera.com>
| Yaoguo Jiang | [jiangyaoguo][jiangyaoguo] | jiangyaoguo | <jiangyaoguo@gmail.com>
| Jim Zhang | [jimthematrix][jimthematrix] | jimthematrix | <jim_the_matrix@hotmail.com>
| Kostas Christidis | [kchristidis][kchristidis] | kostas | <kostas@gmail.com>
| Srinivasan Muralidharan | [muralisrini][muralisrini] | muralisr | <srinivasan.muralidharan99@gmail.com>
| Keith Smith | [smithbk][smithbk] | smithbk | <bksmith@us.ibm.com>
| Sheehan Anderson | [srderson][srderson] | sheehan | <sranderson@gmail.com>
| Tamas Blummer | [tamasblummer][tamasblummer] | tamas | <tamas@digitalasset.com>
Expand Down
5 changes: 5 additions & 0 deletions NOTICE
@@ -0,0 +1,5 @@
Hyperledger Fabric
Copyright [2016-2020] contributors to Hyperledger Fabric

This product includes software developed at
Hyperledger (http://www.hyperledger.org/).
2 changes: 1 addition & 1 deletion bccsp/idemix/bridge/bridge_test.go
Expand Up @@ -258,7 +258,6 @@ var _ = Describe("Idemix Bridge", func() {
})

Context("public nym import", func() {

It("success", func() {
npk := handlers.NewNymPublicKey(&bridge.Ecp{
E: FP256BN.NewECPbigs(FP256BN.NewBIGint(10), FP256BN.NewBIGint(20)),
Expand All @@ -268,6 +267,7 @@ var _ = Describe("Idemix Bridge", func() {
Expect(raw).NotTo(BeNil())

npk2, err := User.NewPublicNymFromBytes(raw)
Expect(err).NotTo(HaveOccurred())
raw2, err := npk2.Bytes()
Expect(err).NotTo(HaveOccurred())
Expect(raw2).NotTo(BeNil())
Expand Down
1 change: 1 addition & 0 deletions cmd/common/signer/signer_test.go
Expand Up @@ -35,6 +35,7 @@ func TestSigner(t *testing.T) {
assert.NoError(t, err)

r, s, err := utils.UnmarshalECDSASignature(sig)
assert.NoError(t, err)
ecdsa.Verify(&signer.key.PublicKey, util.ComputeSHA256(msg), r, s)
}

Expand Down
7 changes: 5 additions & 2 deletions cmd/configtxgen/main.go
Expand Up @@ -15,12 +15,12 @@ import (
"strings"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/protolator"
"github.com/hyperledger/fabric-config/protolator/protoext/ordererext"
cb "github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/common/tools/protolator"
"github.com/hyperledger/fabric/common/tools/protolator/protoext/ordererext"
"github.com/hyperledger/fabric/internal/configtxgen/encoder"
"github.com/hyperledger/fabric/internal/configtxgen/genesisconfig"
"github.com/hyperledger/fabric/internal/configtxgen/metadata"
Expand Down Expand Up @@ -114,6 +114,9 @@ func doOutputAnchorPeersUpdate(conf *genesisconfig.Profile, channelID string, ou
}

updateTx, err := protoutil.CreateSignedEnvelope(cb.HeaderType_CONFIG_UPDATE, channelID, nil, newConfigUpdateEnv, 0, 0)
if err != nil {
return errors.WithMessage(err, "could not create signed envelope")
}

logger.Info("Writing anchor peer update")
err = writeFile(outputAnchorPeersUpdate, protoutil.MarshalOrPanic(updateTx), 0640)
Expand Down
2 changes: 1 addition & 1 deletion cmd/configtxlator/main.go
Expand Up @@ -15,14 +15,14 @@ import (
"reflect"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/protolator"
_ "github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go/common" // Import these to register the proto types
_ "github.com/hyperledger/fabric-protos-go/msp"
_ "github.com/hyperledger/fabric-protos-go/orderer"
_ "github.com/hyperledger/fabric-protos-go/orderer/etcdraft"
_ "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/common/tools/protolator"
"github.com/hyperledger/fabric/internal/configtxlator/metadata"
"github.com/hyperledger/fabric/internal/configtxlator/rest"
"github.com/hyperledger/fabric/internal/configtxlator/update"
Expand Down
3 changes: 3 additions & 0 deletions common/ledger/blkstorage/blockindex.go
Expand Up @@ -310,6 +310,9 @@ func (index *blockIndex) exportUniqueTxIDs(dir string, newHashFunc snapshot.NewH
return nil, err
}
metadataHash, err := metadataFile.Done()
if err != nil {
return nil, err
}

return map[string][]byte{
snapshotDataFileName: dataHash,
Expand Down
8 changes: 7 additions & 1 deletion common/ledger/blkstorage/reset_test.go
Expand Up @@ -73,6 +73,7 @@ func TestResetToGenesisBlkMultipleBlkFiles(t *testing.T) {

ledgerDir := (&Conf{blockStorageDir: blockStoreRootDir}).getLedgerBlockDir("ledger1")
files, err := ioutil.ReadDir(ledgerDir)
require.NoError(t, err)
require.Len(t, files, 5)
resetToGenesisBlk(ledgerDir)
assertBlocksDirOnlyFileWithGenesisBlock(t, ledgerDir, blocks[0])
Expand Down Expand Up @@ -108,6 +109,7 @@ func TestResetBlockStore(t *testing.T) {
// test load and clear preResetHeight for ledger1 and ledger2
ledgerIDs := []string{"ledger1", "ledger2"}
h, err := LoadPreResetHeight(blockStoreRootDir, ledgerIDs)
require.NoError(t, err)
require.Equal(t,
map[string]uint64{
"ledger1": 20,
Expand All @@ -125,6 +127,7 @@ func TestResetBlockStore(t *testing.T) {

require.NoError(t, ClearPreResetHeight(blockStoreRootDir, ledgerIDs))
h, err = LoadPreResetHeight(blockStoreRootDir, ledgerIDs)
require.NoError(t, err)
require.Equal(t,
map[string]uint64{},
h,
Expand All @@ -134,6 +137,7 @@ func TestResetBlockStore(t *testing.T) {
require.NoError(t, ResetBlockStore(blockStoreRootDir))
ledgerIDs = []string{"ledger2"}
h, err = LoadPreResetHeight(blockStoreRootDir, ledgerIDs)
require.NoError(t, err)
require.Equal(t,
map[string]uint64{
"ledger2": 40,
Expand All @@ -143,6 +147,7 @@ func TestResetBlockStore(t *testing.T) {
require.NoError(t, ClearPreResetHeight(blockStoreRootDir, ledgerIDs))
// verify that ledger1 has preResetHeight file is not deleted
h, err = LoadPreResetHeight(blockStoreRootDir, []string{"ledger1", "ledger2"})
require.NoError(t, err)
require.Equal(t,
map[string]uint64{
"ledger1": 20,
Expand Down Expand Up @@ -195,6 +200,7 @@ func TestRecordHeight(t *testing.T) {

func assertBlocksDirOnlyFileWithGenesisBlock(t *testing.T, ledgerDir string, genesisBlock *common.Block) {
files, err := ioutil.ReadDir(ledgerDir)
require.NoError(t, err)
require.Len(t, files, 2)
require.Equal(t, "__backupGenesisBlockBytes", files[0].Name())
require.Equal(t, "blockfile_000000", files[1].Name())
Expand Down Expand Up @@ -225,7 +231,7 @@ func assertBlockStorePostReset(t *testing.T, store *BlockStore, originallyCommit
require.NoError(t, err)
require.Equal(t, originallyCommittedBlocks[0], blk)

blk, err = store.RetrieveBlockByNumber(1)
_, err = store.RetrieveBlockByNumber(1)
require.Error(t, err)
require.Equal(t, err, ErrNotFoundInIndex)

Expand Down
5 changes: 4 additions & 1 deletion common/ledger/snapshot/file_test.go
Expand Up @@ -33,9 +33,9 @@ func TestFileCreateAndRead(t *testing.T) {

// create file and encode some data
fileCreator, err := CreateFile(path.Join(testDir, "dataFile"), byte(5), testNewHashFunc)
require.NoError(t, err)
defer fileCreator.Close()

require.NoError(t, err)
require.NoError(t, fileCreator.EncodeString("Hi there"))
require.NoError(t, fileCreator.EncodeString("How are you?"))
require.NoError(t, fileCreator.EncodeString("")) // zreo length string
Expand All @@ -61,6 +61,7 @@ func TestFileCreateAndRead(t *testing.T) {

// open the file and verify the reads
fileReader, err := OpenFile(path.Join(testDir, "dataFile"), byte(5))
require.NoError(t, err)
defer fileReader.Close()

str, err := fileReader.DecodeString()
Expand Down Expand Up @@ -115,6 +116,7 @@ func TestFileCreatorErrorPropagation(t *testing.T) {
// Mimic the errors by setting the writer to an error returning writer
dataFilePath := path.Join(testPath, "data-file")
fileCreator, err := CreateFile(dataFilePath, byte(1), testNewHashFunc)
require.NoError(t, err)
defer fileCreator.Close()

fileCreator.multiWriter = &errorCausingWriter{err: errors.New("error-from-EncodeUVarint")}
Expand Down Expand Up @@ -160,6 +162,7 @@ func TestFileReaderErrorPropagation(t *testing.T) {
// a file with mismatched format info causes an error
unexpectedFormatFile := path.Join(testPath, "wrong-data-format-file")
fw, err := CreateFile(unexpectedFormatFile, byte(1), testNewHashFunc)
require.NoError(t, err)
require.NoError(t, fw.EncodeString("Hello there"))
_, err = fw.Done()
require.NoError(t, err)
Expand Down
123 changes: 0 additions & 123 deletions common/tools/protolator/dynamic_test.go

This file was deleted.

0 comments on commit 245c88e

Please sign in to comment.