diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf7a60fb..11beb657 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,6 @@ on: tags: - "v*" workflow_dispatch: - env: REGISTRY: ghcr.io IMAGE_NAME: hyperledger-twgc/tape diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2df7f851..b308a775 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -51,12 +51,16 @@ jobs: - job: dockerbuild displayName: dockerbuild + pool: + vmImage: "ubuntu-latest" steps: - script: make docker displayName: build tape docker - job: integrationTest displayName: integrationTest + pool: + vmImage: "ubuntu-latest" dependsOn: - ut - dockerbuild @@ -74,6 +78,9 @@ jobs: FABRIC_2_3_ORLogic: FABRIC_VERSION: "2_3" INTERGATION_CASE: "ORLogic" + FABRIC_2_4_ORLogic: + FABRIC_VERSION: "2_4" + INTERGATION_CASE: "ORLogic" FABRIC_1_4: FABRIC_VERSION: "1_4" INTERGATION_CASE: "ANDLogic" diff --git a/cmd/tape/main.go b/cmd/tape/main.go index 92444a76..11602146 100644 --- a/cmd/tape/main.go +++ b/cmd/tape/main.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "tape/pkg/infra" + "github.com/Hyperledger-TWGC/tape/pkg/infra" "github.com/pkg/errors" log "github.com/sirupsen/logrus" @@ -50,6 +50,7 @@ func main() { if err != nil { logger.Error(err) + logger.Error("Please go to https://github.com/Hyperledger-TWGC/tape/wiki/FAQ find FAQ") os.Exit(1) } os.Exit(0) diff --git a/docs/configfile.md b/docs/configfile.md index 9cc99ea1..7da51908 100644 --- a/docs/configfile.md +++ b/docs/configfile.md @@ -10,25 +10,29 @@ This is a sample: ```yaml # Definition of nodes peer1: &peer1 - addr: localhost:7051 - tls_ca_cert: ./organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem + addr: peer0.org1.example.com:7051 + tls_ca_cert: /config/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem peer2: &peer2 - addr: localhost:9051 - tls_ca_cert: ./organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem + addr: peer0.org2.example.com:9051 + tls_ca_cert: /config/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem orderer1: &orderer1 - addr: localhost:7050 - tls_ca_cert: ./organizations/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem + addr: orderer.example.com:7050 + tls_ca_cert: /config/organizations/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem # Nodes to interact with endorsers: - *peer1 - - *peer2 # we might support multi-committer in the future for more complex test scenario, # i.e. consider tx committed only if it's done on >50% of nodes. But for now, # it seems sufficient to support single committer. -committer: *peer2 +committers: + - *peer1 + - *peer2 + +commitThreshold: 1 + orderer: *orderer1 # Invocation configs @@ -37,11 +41,10 @@ chaincode: basic args: - GetAllAssets mspid: Org1MSP -private_key: ./organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk -sign_cert: ./organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem +private_key: /config/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk +sign_cert: /config/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem num_of_conn: 10 client_per_conn: 10 - ``` 接下来我们将逐一解析该配置文件的含义。 @@ -98,10 +101,14 @@ orderer1: &orderer1 endorsers: - *peer1 - *peer2 -# we might support multi-committer in the future for more complex test scenario, +# we support multi-committer in the future for more complex test scenario, # i.e. consider tx committed only if it's done on >50% of nodes. But for now, # it seems sufficient to support single committer. -committer: *peer2 +committers: + - *peer1 + - *peer2 + +commitThreshold: 1 orderer: *orderer1 ``` @@ -110,8 +117,10 @@ orderer: *orderer1 `endorsers`: 负责为交易提案背书的节点,Tape 会把构造好的已签名的交易提案发送到背书节点进行背书。 - include the addr and tls ca cert of peers. Peer address is in IP:Port format. - You may need to add peer name, i.e. `peer0.org1.example.com,peer0.org2.example.com` to your `/etc/hosts` -`committer`: 负责接收其他节点广播的区块提交成功的信息。 +`committers`: 负责接收其他节点广播的区块提交成功的信息。 - observe tx commitment from these peers. If you want to observe over 50% of peers on your network, you should selected and put them here. +`commitThreshold`: 多少个节点收到消息后认为区块成功 + - mark the block as successe, after how many committer receive the mesage `orderer`: 排序节点,目前 Tape 仅支持向一个排序节点发送交易排序请求。 - include the addr and tls ca cert of orderer. Orderer address is in IP:Port format. It does not support sending traffic to multiple orderers, yet. - You may need to add orderer name, i.e. `orderer.example.com` to your `/etc/hosts` diff --git a/e2e/multi_peer_test.go b/e2e/multi_peer_test.go index ca866525..f163c729 100644 --- a/e2e/multi_peer_test.go +++ b/e2e/multi_peer_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "os/exec" - "tape/e2e/mock" + "github.com/Hyperledger-TWGC/tape/e2e/mock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/e2e/single_peer_test.go b/e2e/single_peer_test.go index c10ac00b..4b9a36c4 100644 --- a/e2e/single_peer_test.go +++ b/e2e/single_peer_test.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "os/exec" - "tape/e2e/mock" + "github.com/Hyperledger-TWGC/tape/e2e/mock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/go.mod b/go.mod index ffed3c78..3c47821c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module tape +module github.com/Hyperledger-TWGC/tape go 1.14 diff --git a/go.sum b/go.sum index 2b766be6..f82f15c6 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= @@ -45,7 +44,6 @@ github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -63,17 +61,14 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hyperledger/fabric-lib-go v1.0.0/go.mod h1:H362nMlunurmHwkYqR5uHL2UDWbQdbfz74n8kbCFsqc= -github.com/hyperledger/fabric-protos-go v0.0.0-20191121202242-f5500d5e3e85 h1:bNgEcCg5NVRWs/T+VUEfhgh5Olx/N4VB+0+ybW+oSuA= github.com/hyperledger/fabric-protos-go v0.0.0-20191121202242-f5500d5e3e85/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e h1:9PS5iezHk/j7XriSlNuSQILyCOfcZ9wZ3/PiucmSE8E= github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= @@ -117,7 +112,6 @@ github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -168,11 +162,8 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -182,7 +173,6 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -192,9 +182,7 @@ golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -216,15 +204,12 @@ golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed h1:J22ig1FUekjjkmZUM7pTKixYm8DvrYsvrBZdunYeIuQ= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -233,20 +218,17 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190327125643-d831d65fe17d h1:XB2jc5XQ9uhizGTS2vWcN01bc4dI6z3C4KY5MQm8SS8= google.golang.org/genproto v0.0.0-20190327125643-d831d65fe17d/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6 h1:UXl+Zk3jqqcbEVV7ace5lrt4YdA4tXiz3f/KbmD29Vo= google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= @@ -263,18 +245,15 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/infra/benchmark_test.go b/pkg/infra/benchmark_test.go index ddbd82d9..5114050e 100644 --- a/pkg/infra/benchmark_test.go +++ b/pkg/infra/benchmark_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "tape/e2e/mock" + "github.com/Hyperledger-TWGC/tape/e2e/mock" "github.com/hyperledger/fabric-protos-go/peer" log "github.com/sirupsen/logrus" diff --git a/pkg/infra/bitmap/bitmap_test.go b/pkg/infra/bitmap/bitmap_test.go index 88fe6a60..bd326ce8 100644 --- a/pkg/infra/bitmap/bitmap_test.go +++ b/pkg/infra/bitmap/bitmap_test.go @@ -1,7 +1,7 @@ package bitmap_test import ( - "tape/pkg/infra/bitmap" + "github.com/Hyperledger-TWGC/tape/pkg/infra/bitmap" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/pkg/infra/block_collector.go b/pkg/infra/block_collector.go index 87a03d35..8c58bc08 100644 --- a/pkg/infra/block_collector.go +++ b/pkg/infra/block_collector.go @@ -4,9 +4,10 @@ import ( "context" "fmt" "sync" - "tape/pkg/infra/bitmap" "time" + "github.com/Hyperledger-TWGC/tape/pkg/infra/bitmap" + "github.com/hyperledger/fabric-protos-go/peer" "github.com/pkg/errors" ) diff --git a/pkg/infra/block_collector_test.go b/pkg/infra/block_collector_test.go index f23bd9f2..ba3678db 100644 --- a/pkg/infra/block_collector_test.go +++ b/pkg/infra/block_collector_test.go @@ -3,9 +3,10 @@ package infra_test import ( "context" "sync" - "tape/pkg/infra" "time" + "github.com/Hyperledger-TWGC/tape/pkg/infra" + "github.com/hyperledger/fabric-protos-go/peer" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/pkg/infra/client.go b/pkg/infra/client.go index 0131132d..2aace0b8 100644 --- a/pkg/infra/client.go +++ b/pkg/infra/client.go @@ -5,7 +5,7 @@ import ( "crypto/tls" "time" - "tape/internal/fabric/core/comm" + "github.com/Hyperledger-TWGC/tape/internal/fabric/core/comm" "github.com/hyperledger/fabric-protos-go/orderer" "github.com/hyperledger/fabric-protos-go/peer" diff --git a/pkg/infra/client_test.go b/pkg/infra/client_test.go index e838b1bb..38bb1ac1 100644 --- a/pkg/infra/client_test.go +++ b/pkg/infra/client_test.go @@ -2,7 +2,8 @@ package infra_test import ( "context" - "tape/pkg/infra" + + "github.com/Hyperledger-TWGC/tape/pkg/infra" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/pkg/infra/config_test.go b/pkg/infra/config_test.go index d1d09fab..30a4cfda 100644 --- a/pkg/infra/config_test.go +++ b/pkg/infra/config_test.go @@ -5,7 +5,7 @@ import ( "os" "text/template" - "tape/pkg/infra" + "github.com/Hyperledger-TWGC/tape/pkg/infra" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/pkg/infra/crypto.go b/pkg/infra/crypto.go index 6b9e7ad2..e3e2eed3 100644 --- a/pkg/infra/crypto.go +++ b/pkg/infra/crypto.go @@ -11,8 +11,8 @@ import ( "io/ioutil" "math/big" - "tape/internal/fabric/bccsp/utils" - "tape/internal/fabric/common/crypto" + "github.com/Hyperledger-TWGC/tape/internal/fabric/bccsp/utils" + "github.com/Hyperledger-TWGC/tape/internal/fabric/common/crypto" "github.com/hyperledger/fabric-protos-go/common" "github.com/pkg/errors" diff --git a/pkg/infra/initiator_test.go b/pkg/infra/initiator_test.go index 823943f7..46e5ba8d 100644 --- a/pkg/infra/initiator_test.go +++ b/pkg/infra/initiator_test.go @@ -5,8 +5,8 @@ import ( "os" "time" - "tape/e2e" - "tape/pkg/infra" + "github.com/Hyperledger-TWGC/tape/e2e" + "github.com/Hyperledger-TWGC/tape/pkg/infra" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/pkg/infra/observer_test.go b/pkg/infra/observer_test.go index 185eb412..16cf7812 100644 --- a/pkg/infra/observer_test.go +++ b/pkg/infra/observer_test.go @@ -4,11 +4,12 @@ import ( "context" "io/ioutil" "os" - "tape/e2e" - "tape/e2e/mock" - "tape/pkg/infra" "time" + "github.com/Hyperledger-TWGC/tape/e2e" + "github.com/Hyperledger-TWGC/tape/e2e/mock" + "github.com/Hyperledger-TWGC/tape/pkg/infra" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" log "github.com/sirupsen/logrus" diff --git a/pkg/infra/proposal.go b/pkg/infra/proposal.go index 4bec270e..17eabc66 100644 --- a/pkg/infra/proposal.go +++ b/pkg/infra/proposal.go @@ -4,7 +4,7 @@ import ( "bytes" "math" - "tape/internal/fabric/protoutil" + "github.com/Hyperledger-TWGC/tape/internal/fabric/protoutil" "github.com/golang/protobuf/proto" "github.com/hyperledger/fabric-protos-go/common" diff --git a/pkg/infra/proposer_test.go b/pkg/infra/proposer_test.go index a3777ff8..dbb5e14a 100644 --- a/pkg/infra/proposer_test.go +++ b/pkg/infra/proposer_test.go @@ -2,8 +2,9 @@ package infra_test import ( "context" - "tape/e2e/mock" - "tape/pkg/infra" + + "github.com/Hyperledger-TWGC/tape/e2e/mock" + "github.com/Hyperledger-TWGC/tape/pkg/infra" "github.com/hyperledger/fabric-protos-go/peer" "github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks" diff --git a/test/bootstraps/bootstrap-v2.4.sh b/test/bootstraps/bootstrap-v2.4.sh new file mode 100755 index 00000000..91d1044c --- /dev/null +++ b/test/bootstraps/bootstrap-v2.4.sh @@ -0,0 +1,198 @@ +#!/bin/bash +# +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# if version not passed in, default to latest released version +VERSION=2.4.1 +# if ca version not passed in, default to latest released version +CA_VERSION=1.5.2 +ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')") +MARCH=$(uname -m) + +printHelp() { + echo "Usage: bootstrap.sh [version [ca_version]] [options]" + echo + echo "options:" + echo "-h : this help" + echo "-d : bypass docker image download" + echo "-s : bypass fabric-samples repo clone" + echo "-b : bypass download of platform-specific binaries" + echo + echo "e.g. bootstrap.sh 2.4.1 1.5.2 -s" + echo "will download docker images and binaries for Fabric v2.4.1 and Fabric CA v1.5.2" +} + +# dockerPull() pulls docker images from fabric and chaincode repositories +# note, if a docker image doesn't exist for a requested release, it will simply +# be skipped, since this script doesn't terminate upon errors. + +dockerPull() { + #three_digit_image_tag is passed in, e.g. "1.4.7" + three_digit_image_tag=$1 + shift + #two_digit_image_tag is derived, e.g. "1.4", especially useful as a local tag for two digit references to most recent baseos, ccenv, javaenv, nodeenv patch releases + two_digit_image_tag=$(echo "$three_digit_image_tag" | cut -d'.' -f1,2) + while [[ $# -gt 0 ]] + do + image_name="$1" + echo "====> hyperledger/fabric-$image_name:$three_digit_image_tag" + docker pull "hyperledger/fabric-$image_name:$three_digit_image_tag" + docker tag "hyperledger/fabric-$image_name:$three_digit_image_tag" "hyperledger/fabric-$image_name" + docker tag "hyperledger/fabric-$image_name:$three_digit_image_tag" "hyperledger/fabric-$image_name:$two_digit_image_tag" + shift + done +} + +cloneSamplesRepo() { + # clone (if needed) hyperledger/fabric-samples and checkout corresponding + # version to the binaries and docker images to be downloaded + if [ -d test-network ]; then + # if we are in the fabric-samples repo, checkout corresponding version + echo "==> Already in fabric-samples repo" + elif [ -d fabric-samples ]; then + # if fabric-samples repo already cloned and in current directory, + # cd fabric-samples + echo "===> Changing directory to fabric-samples" + cd fabric-samples + else + echo "===> Cloning hyperledger/fabric-samples repo" + git clone -b main https://github.com/hyperledger/fabric-samples.git && cd fabric-samples + fi + + if GIT_DIR=.git git rev-parse v${VERSION} >/dev/null 2>&1; then + echo "===> Checking out v${VERSION} of hyperledger/fabric-samples" + git checkout -q v${VERSION} + else + echo "fabric-samples v${VERSION} does not exist, defaulting to main. fabric-samples main branch is intended to work with recent versions of fabric." + git checkout -q main + fi +} + +# This will download the .tar.gz +download() { + local BINARY_FILE=$1 + local URL=$2 + echo "===> Downloading: " "${URL}" + curl -L --retry 5 --retry-delay 3 "${URL}" | tar xz || rc=$? + if [ -n "$rc" ]; then + echo "==> There was an error downloading the binary file." + return 22 + else + echo "==> Done." + fi +} + +pullBinaries() { + echo "===> Downloading version ${FABRIC_TAG} platform specific fabric binaries" + download "${BINARY_FILE}" "https://github.com/hyperledger/fabric/releases/download/v${VERSION}/${BINARY_FILE}" + if [ $? -eq 22 ]; then + echo + echo "------> ${FABRIC_TAG} platform specific fabric binary is not available to download <----" + echo + exit + fi + + echo "===> Downloading version ${CA_TAG} platform specific fabric-ca-client binary" + download "${CA_BINARY_FILE}" "https://github.com/hyperledger/fabric-ca/releases/download/v${CA_VERSION}/${CA_BINARY_FILE}" + if [ $? -eq 22 ]; then + echo + echo "------> ${CA_TAG} fabric-ca-client binary is not available to download (Available from 1.1.0-rc1) <----" + echo + exit + fi +} + +pullDockerImages() { + command -v docker >& /dev/null + NODOCKER=$? + if [ "${NODOCKER}" == 0 ]; then + FABRIC_IMAGES=(peer orderer ccenv tools) + case "$VERSION" in + 2.*) + FABRIC_IMAGES+=(baseos) + shift + ;; + esac + echo "FABRIC_IMAGES:" "${FABRIC_IMAGES[@]}" + echo "===> Pulling fabric Images" + dockerPull "${FABRIC_TAG}" "${FABRIC_IMAGES[@]}" + echo "===> Pulling fabric ca Image" + CA_IMAGE=(ca) + dockerPull "${CA_TAG}" "${CA_IMAGE[@]}" + echo "===> List out hyperledger docker images" + docker images | grep hyperledger + else + echo "=========================================================" + echo "Docker not installed, bypassing download of Fabric images" + echo "=========================================================" + fi +} + +DOCKER=true +SAMPLES=true +BINARIES=true + +# Parse commandline args pull out +# version and/or ca-version strings first +if [ -n "$1" ] && [ "${1:0:1}" != "-" ]; then + VERSION=$1;shift + if [ -n "$1" ] && [ "${1:0:1}" != "-" ]; then + CA_VERSION=$1;shift + if [ -n "$1" ] && [ "${1:0:1}" != "-" ]; then + THIRDPARTY_IMAGE_VERSION=$1;shift + fi + fi +fi + +# prior to 1.2.0 architecture was determined by uname -m +if [[ $VERSION =~ ^1\.[0-1]\.* ]]; then + export FABRIC_TAG=${MARCH}-${VERSION} + export CA_TAG=${MARCH}-${CA_VERSION} + export THIRDPARTY_TAG=${MARCH}-${THIRDPARTY_IMAGE_VERSION} +else + # starting with 1.2.0, multi-arch images will be default + : "${CA_TAG:="$CA_VERSION"}" + : "${FABRIC_TAG:="$VERSION"}" + : "${THIRDPARTY_TAG:="$THIRDPARTY_IMAGE_VERSION"}" +fi + +BINARY_FILE=hyperledger-fabric-${ARCH}-${VERSION}.tar.gz +CA_BINARY_FILE=hyperledger-fabric-ca-${ARCH}-${CA_VERSION}.tar.gz + +# then parse opts +while getopts "h?dsb" opt; do + case "$opt" in + h|\?) + printHelp + exit 0 + ;; + d) DOCKER=false + ;; + s) SAMPLES=false + ;; + b) BINARIES=false + ;; + esac +done + +if [ "$SAMPLES" == "true" ]; then + echo + echo "Clone hyperledger/fabric-samples repo" + echo + cloneSamplesRepo +fi +if [ "$BINARIES" == "true" ]; then + echo + echo "Pull Hyperledger Fabric binaries" + echo + pullBinaries +fi +if [ "$DOCKER" == "true" ]; then + echo + echo "Pull Hyperledger Fabric docker images" + echo + pullDockerImages +fi \ No newline at end of file diff --git a/test/integration-test.sh b/test/integration-test.sh index 905acb5e..f658f81f 100755 --- a/test/integration-test.sh +++ b/test/integration-test.sh @@ -62,6 +62,26 @@ case $1 in ARGS=(-cci initLedger) fi + echo y | ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go "${ARGS[@]}" + ;; + 2_4) + # Why comment following code? Please check this issue: https://github.com/Hyperledger-TWGC/tape/issues/159 + # curl -vsS https://raw.githubusercontent.com/hyperledger/fabric/release-2.3/scripts/bootstrap.sh | bash + ./test/bootstraps/bootstrap-v2.4.sh + cd ./fabric-samples/test-network + echo y | ./network.sh down + echo y | ./network.sh up createChannel + cp -r organizations "$DIR" + + CONFIG_FILE=/config/test/config20org1andorg2.yaml + + if [ $2 == "ORLogic" ]; then + CONFIG_FILE=/config/test/config20selectendorser.yaml + ARGS=(-ccep "OR('Org1.member','Org2.member')") + else + ARGS=(-cci initLedger) + fi + echo y | ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go "${ARGS[@]}" ;; latest)