Skip to content

Commit 00d73a0

Browse files
authored
load public params from vault when possible (#431)
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent f3bfb27 commit 00d73a0

File tree

33 files changed

+401
-258
lines changed

33 files changed

+401
-258
lines changed

docs/core-token.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ token:
1212
network: default # the name of the network this TMS refers to (Fabric, Orion, etc)
1313
channel: testchannel # the name of the network's channel this TMS refers to, if applicable
1414
namespace: tns # the name of the channel's namespace this TMS refers to, if applicable
15+
# the name of the driver that provides the implementation of the Driver API.
16+
# This field is optional. If not specified, the Token-SDK will derive this information by fetching the public parameters
17+
# from the remote network
18+
driver: zkatdlog
1519
# sections dedicated to the definition of the wallets
1620
wallets:
1721
# owner wallets

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/dgraph-io/ristretto v0.1.0
1010
github.com/golang/protobuf v1.5.2
1111
github.com/hashicorp/go-uuid v1.0.2
12-
github.com/hyperledger-labs/fabric-smart-client v0.1.1-0.20221130141649-2080c0c69de1
12+
github.com/hyperledger-labs/fabric-smart-client v0.1.1-0.20221201145120-5b16ba703b2f
1313
github.com/hyperledger-labs/orion-sdk-go v0.2.5
1414
github.com/hyperledger-labs/orion-server v0.2.5
1515
github.com/hyperledger/fabric v1.4.0-rc1.0.20220808214918-83596078d0c3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,8 @@ github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmK
805805
github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo=
806806
github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc=
807807
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
808-
github.com/hyperledger-labs/fabric-smart-client v0.1.1-0.20221130141649-2080c0c69de1 h1:F5/QSzgJsQS0rFsO8YK2mAQ0VU8ZclQrprzt82Z0PeU=
809-
github.com/hyperledger-labs/fabric-smart-client v0.1.1-0.20221130141649-2080c0c69de1/go.mod h1:WtNWdKVbF9R1/2hIBVQUlR9Zl3T0TdkzUcCQTc2Eqk4=
808+
github.com/hyperledger-labs/fabric-smart-client v0.1.1-0.20221201145120-5b16ba703b2f h1:rBsPzYygDoG3fm7CdwlgsR6UhlnmeoOCERMuoSYaRNo=
809+
github.com/hyperledger-labs/fabric-smart-client v0.1.1-0.20221201145120-5b16ba703b2f/go.mod h1:WtNWdKVbF9R1/2hIBVQUlR9Zl3T0TdkzUcCQTc2Eqk4=
810810
github.com/hyperledger-labs/orion-sdk-go v0.2.5 h1:HFGRTuMZgzo9EtyJeFAhVSlbrj6x3jtY0aDcghdjzRE=
811811
github.com/hyperledger-labs/orion-sdk-go v0.2.5/go.mod h1:At8hiFATfkDXQ4AFLVbaTiC9GDhVDo8aN/supb1KBb4=
812812
github.com/hyperledger-labs/orion-server v0.2.5 h1:aFudmB9SAnsT5v8jhazkuszEu0pdJNFqaYZF2GpvAuI=

integration/token/dvp/tests.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import (
2020
)
2121

2222
func TestAll(network *integration.Infrastructure) {
23-
// Give some time for the network to start
24-
// TODO: remove this in the future by makings sure that the FSC nodes are connected to the p2p network.
23+
// give some time to the nodes to get the public parameters
2524
time.Sleep(10 * time.Second)
2625

2726
// Ready to go

integration/token/fungible/support.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ func SwapCash(network *integration.Infrastructure, id string, wallet string, typ
415415
func CheckPublicParams(network *integration.Infrastructure, ids ...string) {
416416
for _, id := range ids {
417417
_, err := network.Client(id).CallView("CheckPublicParamsMatch", common.JSONMarshall(&views.CheckPublicParamsMatch{}))
418-
Expect(err).NotTo(HaveOccurred())
418+
Expect(err).NotTo(HaveOccurred(), "failed to check public params at [%s]", id)
419419
}
420420
}
421421

integration/token/fungible/tests.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ var BobAcceptedTransactions = []*ttxdb.TransactionRecord{
209209
func TestAll(network *integration.Infrastructure, auditor string) {
210210
RegisterAuditor(network, auditor)
211211

212+
// give some time to the nodes to get the public parameters
213+
time.Sleep(10 * time.Second)
214+
212215
CheckPublicParams(network, "issuer", auditor, "alice", "bob", "charlie", "manager")
213216

214217
t0 := time.Now()

integration/token/interop/tests.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import (
2424
)
2525

2626
func TestHTLCSingleNetwork(network *integration.Infrastructure) {
27+
// give some time to the nodes to get the public parameters
28+
time.Sleep(10 * time.Second)
29+
2730
defaultTMSID := token.TMSID{}
2831
RegisterAuditor(network)
2932

@@ -165,6 +168,9 @@ func TestHTLCSingleNetwork(network *integration.Infrastructure) {
165168
}
166169

167170
func TestHTLCTwoNetworks(network *integration.Infrastructure) {
171+
// give some time to the nodes to get the public parameters
172+
time.Sleep(10 * time.Second)
173+
168174
alpha := token.TMSID{Network: "alpha"}
169175
beta := token.TMSID{Network: "beta"}
170176

@@ -224,6 +230,9 @@ func TestHTLCTwoNetworks(network *integration.Infrastructure) {
224230
}
225231

226232
func TestHTLCNoCrossClaimTwoNetworks(network *integration.Infrastructure) {
233+
// give some time to the nodes to get the public parameters
234+
time.Sleep(10 * time.Second)
235+
227236
alpha := token.TMSID{Network: "alpha"}
228237
beta := token.TMSID{Network: "beta"}
229238

@@ -276,6 +285,9 @@ func TestHTLCNoCrossClaimTwoNetworks(network *integration.Infrastructure) {
276285
}
277286

278287
func TestFastExchange(network *integration.Infrastructure) {
288+
// give some time to the nodes to get the public parameters
289+
time.Sleep(10 * time.Second)
290+
279291
alpha := token.TMSID{Network: "alpha"}
280292
beta := token.TMSID{Network: "beta"}
281293

integration/token/nft/tests.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import (
1717
)
1818

1919
func TestAll(network *integration.Infrastructure) {
20+
// give some time to the nodes to get the public parameters
21+
time.Sleep(10 * time.Second)
22+
2023
registerAuditor(network)
2124
houseID := issueHouse(network, "alice", 4)
2225
queryHouse(network, "alice", houseID, "5th Avenue")

token/core/cmd/certfier/keypairgen.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ import (
1212
"os"
1313
"path/filepath"
1414

15-
"github.com/pkg/errors"
16-
"github.com/spf13/cobra"
17-
1815
"github.com/hyperledger-labs/fabric-token-sdk/token/core"
1916
_ "github.com/hyperledger-labs/fabric-token-sdk/token/services/certifier/dummy"
2017
_ "github.com/hyperledger-labs/fabric-token-sdk/token/services/certifier/interactive"
18+
"github.com/pkg/errors"
19+
"github.com/spf13/cobra"
2120
)
2221

2322
var driver string

token/core/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Copyright IBM Corp. All Rights Reserved.
33
44
SPDX-License-Identifier: Apache-2.0
55
*/
6+
67
package core
78

89
import (

0 commit comments

Comments
 (0)