Skip to content

Commit

Permalink
Merge pull request hyperledger-labs#43 from yacovm/CallViewFromRest
Browse files Browse the repository at this point in the history
Call view from REST hyperledger-labs#39
  • Loading branch information
adecaro authored Jul 1, 2021
2 parents d7e3f16 + ef2f6bb commit 0b0887e
Show file tree
Hide file tree
Showing 46 changed files with 1,759 additions and 249 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ require (
github.com/google/go-cmp v0.5.0
github.com/google/uuid v1.2.0 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20210522101830-0589229737b2 // indirect
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0
github.com/hashicorp/go-version v1.2.0
github.com/hyperledger/fabric v1.4.0-rc1.0.20200930182727-344fda602252
Expand Down
23 changes: 11 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWso
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw=
github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
Expand Down Expand Up @@ -220,7 +221,10 @@ github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/gordonklaus/ineffassign v0.0.0-20210522101830-0589229737b2 h1:hC4RAQwLzbDbHsa+CwwGBm1uG2oX9o3Frx9G73duPi8=
github.com/gordonklaus/ineffassign v0.0.0-20210522101830-0589229737b2/go.mod h1:M9mZEtGIsR1oDaZagNPNG9iq9n2HrhZ17dsXk73V3Lw=
github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I=
github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
Expand Down Expand Up @@ -339,6 +343,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJ
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d h1:68u9r4wEvL3gYg2jvAOgROwZ3H+Y3hIDk4tbbmIjcYQ=
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
Expand Down Expand Up @@ -537,6 +542,7 @@ github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9
github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.5 h1:XVZwSo04Cs3j/jS0uAEPpT3JY6DzMcVLLoWOSnCxOjg=
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 h1:F9x/1yl3T2AeKLr2AMdilSD8+f9bvMnNN8VS5iDtovc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
Expand Down Expand Up @@ -674,6 +680,7 @@ github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE
github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/twitchyliquid64/golang-asm v0.15.0/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go v1.1.1 h1:gmervu+jDMvXTbcHQ0pd2wee85nEoE0BsVyEuzkfK8w=
github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/urfave/cli v1.18.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
Expand Down Expand Up @@ -824,15 +831,9 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I=
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 h1:C+AwYEtBp/VQwoLntUmQ/yx3MS9vmZaKNdw5eOpoQe8=
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 h1:faDu4veV+8pcThn4fewv6TVlNCezafGoC1gM/mxQLbQ=
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
Expand Down Expand Up @@ -861,11 +862,9 @@ golang.org/x/tools v0.0.0-20200131233409-575de47986ce/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20201105001634-bc3cf281b174/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.2 h1:kRBLX7v7Af8W7Gdbbc908OJcdgtK8bOz9Uaj8/F1ACA=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs=
golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
82 changes: 77 additions & 5 deletions integration/fsc/pingpong/pingpong_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@ SPDX-License-Identifier: Apache-2.0
package pingpong_test

import (
"bytes"
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net/http"
"time"

"github.com/hyperledger-labs/fabric-smart-client/pkg/api"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/client/web"

config2 "github.com/hyperledger-labs/fabric-smart-client/platform/view/core/config"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

Expand All @@ -21,13 +31,53 @@ import (
var _ = Describe("EndToEnd", func() {

Describe("Node-based Ping pong", func() {
var (
initiator api.FabricSmartClientNode
responder api.FabricSmartClientNode
)

AfterEach(func() {
// Stop the ii
initiator.Stop()
responder.Stop()
time.Sleep(5 * time.Second)
})

It("successful pingpong based on REST API", func() {
// Init and Start fsc nodes
initiator = node.NewFromConfPath("./testdata/fsc/fscnodes/fsc.initiator")
Expect(initiator).NotTo(BeNil())

responder = node.NewFromConfPath("./testdata/fsc/fscnodes/fsc.responder")
Expect(responder).NotTo(BeNil())

err := initiator.Start()
Expect(err).NotTo(HaveOccurred())
err = responder.Start()
Expect(err).NotTo(HaveOccurred())

// Register views and view factories
err = initiator.RegisterFactory("init", &pingpong.InitiatorViewFactory{})
Expect(err).NotTo(HaveOccurred())
responder.RegisterResponder(&pingpong.Responder{}, &pingpong.Initiator{})

time.Sleep(3 * time.Second)

webClientConfig, err := web.NewConfigFromFSC("./testdata/fsc/fscnodes/fsc.initiator")
Expect(err).NotTo(HaveOccurred())
initiatorWebClient, err := web.NewClient(webClientConfig)
Expect(err).NotTo(HaveOccurred())
res, err := initiatorWebClient.CallView("init", bytes.NewBuffer([]byte("hi")).Bytes())
Expect(err).NotTo(HaveOccurred())
Expect(common.JSONUnmarshalString(res)).To(BeEquivalentTo("OK"))
})

It("successful pingpong", func() {
// Init and Start fsc nodes
initiator := node.NewFromConfPath("./testdata/fsc/fscnodes/fsc.initiator")
initiator = node.NewFromConfPath("./testdata/fsc/fscnodes/fsc.initiator")
Expect(initiator).NotTo(BeNil())

responder := node.NewFromConfPath("./testdata/fsc/fscnodes/fsc.responder")
responder = node.NewFromConfPath("./testdata/fsc/fscnodes/fsc.responder")
Expect(responder).NotTo(BeNil())

err := initiator.Start()
Expand All @@ -45,9 +95,6 @@ var _ = Describe("EndToEnd", func() {
res, err := initiator.CallView("init", nil)
Expect(err).NotTo(HaveOccurred())
Expect(common.JSONUnmarshalString(res)).To(BeEquivalentTo("OK"))

initiator.Stop()
responder.Stop()
})

})
Expand Down Expand Up @@ -113,3 +160,28 @@ var _ = Describe("EndToEnd", func() {
})

})

func newHTTPClient(confDir string) *http.Client {
configProvider, err := config2.NewProvider(confDir)
Expect(err).NotTo(HaveOccurred())

clientCertPool := x509.NewCertPool()
caCert, err := ioutil.ReadFile(configProvider.TranslatePath(configProvider.GetStringSlice("fsc.tls.clientRootCAs.files")[0]))
Expect(err).NotTo(HaveOccurred())
clientCertPool.AppendCertsFromPEM(caCert)

tlsClientConfig := &tls.Config{
RootCAs: clientCertPool,
}
clientCert, err := tls.LoadX509KeyPair(
configProvider.GetPath("fsc.tls.cert.file"),
configProvider.GetPath("fsc.tls.key.file"))
Expect(err).NotTo(HaveOccurred())
tlsClientConfig.Certificates = []tls.Certificate{clientCert}

return &http.Client{
Transport: &http.Transport{
TLSClientConfig: tlsClientConfig,
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fsc:
# This case is useful for docker containers.
# When set to true, will override FSC address.
addressAutoDetect: true
# GRPC Server listener address
# GRPC Server listener address
listenAddress: 127.0.0.1:20000
# Identity of this node, used to connect to other nodes
identity:
Expand Down Expand Up @@ -87,9 +87,13 @@ fsc:
kvs:
persistence:
# Persistence type can be \'badger\' (on disk) or \'memory\'
type: badger
type: memory
opts:
path: ./../../fscnodes/fsc.initiator/kvs
web:
enabled: true
# HTTPS server listener address
address: 127.0.0.1:19999
# The endpoint section tells how to reach other FSC node in the network.
# For each node, the name, the domain, the identity of the node, and its addresses must be specified.
endpoint:
Expand All @@ -100,6 +104,7 @@ fsc:
id: initiator
path: ./../../crypto/peerOrganizations/fsc.example.com/peers/initiator.fsc.example.com/msp/signcerts/initiator.fsc.example.com-cert.pem
addresses:
Web: 127.0.0.1:19999
Listen: 127.0.0.1:20000
P2P: 127.0.0.1:20001
View: 127.0.0.1:20000
Expand All @@ -109,6 +114,7 @@ fsc:
id: responder
path: ./../../crypto/peerOrganizations/fsc.example.com/peers/responder.fsc.example.com/msp/signcerts/responder.fsc.example.com-cert.pem
addresses:
Web: 127.0.0.1:19998
Listen: 127.0.0.1:20002
P2P: 127.0.0.1:20003
View: 127.0.0.1:20002
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fsc:
# This case is useful for docker containers.
# When set to true, will override FSC address.
addressAutoDetect: true
# GRPC Server listener address
# GRPC Server listener address
listenAddress: 127.0.0.1:20002
# Identity of this node, used to connect to other nodes
identity:
Expand Down Expand Up @@ -87,9 +87,13 @@ fsc:
kvs:
persistence:
# Persistence type can be \'badger\' (on disk) or \'memory\'
type: badger
type: memory
opts:
path: ./../../fscnodes/fsc.responder/kvs
web:
enabled: true
# HTTPS server listener address
address: 127.0.0.1:19998
# The endpoint section tells how to reach other FSC node in the network.
# For each node, the name, the domain, the identity of the node, and its addresses must be specified.
endpoint:
Expand All @@ -100,6 +104,7 @@ fsc:
id: initiator
path: ./../../crypto/peerOrganizations/fsc.example.com/peers/initiator.fsc.example.com/msp/signcerts/initiator.fsc.example.com-cert.pem
addresses:
Web: 127.0.0.1:19999
Listen: 127.0.0.1:20000
P2P: 127.0.0.1:20001
View: 127.0.0.1:20000
Expand All @@ -109,6 +114,7 @@ fsc:
id: responder
path: ./../../crypto/peerOrganizations/fsc.example.com/peers/responder.fsc.example.com/msp/signcerts/responder.fsc.example.com-cert.pem
addresses:
Web: 127.0.0.1:19998
Listen: 127.0.0.1:20002
P2P: 127.0.0.1:20003
View: 127.0.0.1:20002
6 changes: 3 additions & 3 deletions integration/nwo/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"gopkg.in/yaml.v2"

"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc/identity"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/client"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/client/view"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/grpc"
)

Expand Down Expand Up @@ -57,10 +57,10 @@ type Context interface {
SetAdminSigningIdentity(name string, id identity.SigningIdentity)
SetViewIdentity(name string, cert []byte)
ConnectionConfig(name string) *grpc.ConnectionConfig
ClientSigningIdentity(name string) client.SigningIdentity
ClientSigningIdentity(name string) view.SigningIdentity
SetViewClient(name string, c ViewClient)
GetViewIdentityAliases(name string) []string
AdminSigningIdentity(name string) client.SigningIdentity
AdminSigningIdentity(name string) view.SigningIdentity
ExtensionsByPeerID(name string) Extensions
}

Expand Down
6 changes: 3 additions & 3 deletions integration/nwo/common/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/api"
"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/common"
"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc/identity"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/client"
view2 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/client/view"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/grpc"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/view"
)
Expand Down Expand Up @@ -113,7 +113,7 @@ func (c *Context) ConnectionConfig(name string) *grpc.ConnectionConfig {
return c.ConnectionConfigs[name]
}

func (c *Context) ClientSigningIdentity(name string) client.SigningIdentity {
func (c *Context) ClientSigningIdentity(name string) view2.SigningIdentity {
return c.ClientSigningIdentities[name]
}

Expand All @@ -125,7 +125,7 @@ func (c *Context) GetViewIdentityAliases(name string) []string {
return c.ViewIdentityAliases[name]
}

func (c *Context) AdminSigningIdentity(name string) client.SigningIdentity {
func (c *Context) AdminSigningIdentity(name string) view2.SigningIdentity {
return c.AdminSigningIdentities[name]
}

Expand Down
3 changes: 2 additions & 1 deletion integration/nwo/fabric/network/network_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -1452,11 +1452,12 @@ const (
ViewPort api.PortName = "View"
P2PPort api.PortName = "P2P"
ClusterPort api.PortName = "Cluster"
WebPort api.PortName = "Web"
)

// PeerPortNames returns the list of ports that need to be reserved for a Peer.
func PeerPortNames() []api.PortName {
return []api.PortName{ListenPort, ChaincodePort, EventsPort, ProfilePort, OperationsPort, P2PPort}
return []api.PortName{ListenPort, ChaincodePort, EventsPort, ProfilePort, OperationsPort, P2PPort, WebPort}
}

// OrdererPortNames returns the list of ports that need to be reserved for an
Expand Down
10 changes: 5 additions & 5 deletions integration/nwo/fsc/fsc.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc/identity"
node2 "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc/node"
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/services/crypto"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/client"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/client/view"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/grpc"
)

Expand Down Expand Up @@ -174,8 +174,8 @@ func (p *platform) PostRun() {
Expect(err).NotTo(HaveOccurred())

// Get from the registry the signing identity and the connection config
c, err := client.New(
&client.Config{
c, err := view.New(
&view.Config{
ID: v.GetString("fsc.id"),
FSCNode: p.Context.ConnectionConfig(node.Name),
},
Expand All @@ -198,8 +198,8 @@ func (p *platform) PostRun() {

// Setup admins
if id := p.Context.AdminSigningIdentity(node.Name); id != nil {
c, err := client.New(
&client.Config{
c, err := view.New(
&view.Config{
ID: v.GetString("fsc.id"),
FSCNode: p.Context.ConnectionConfig(node.Name),
},
Expand Down
5 changes: 5 additions & 0 deletions integration/nwo/fsc/node/core_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ fsc:
type: badger
opts:
path: {{ NodeKVSPath }}
# HTML Server configuration for REST calls
web:
enabled: true
# HTTPS server listener address
address: 127.0.0.1:{{ .NodePort Peer "Web" }}
# The endpoint section tells how to reach other FSC node in the network.
# For each node, the name, the domain, the identity of the node, and its addresses must be specified.
endpoint:
Expand Down
Loading

0 comments on commit 0b0887e

Please sign in to comment.