Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/golang-migrate/migrate/v4 v4.17.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.1
github.com/hyperledger/firefly-common v1.4.14
github.com/hyperledger/firefly-common v1.4.15
github.com/hyperledger/firefly-signer v1.1.19
github.com/jarcoal/httpmock v1.2.0
github.com/lib/pq v1.10.9
Expand Down Expand Up @@ -72,7 +72,7 @@ require (
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rs/cors v1.11.0 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
Expand All @@ -90,7 +90,7 @@ require (
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
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/hyperledger/firefly-common v1.4.14 h1:G1x7jKBM2MmbGAo+Hwu/9w3F4cyGuWvYViEZGPLWlic=
github.com/hyperledger/firefly-common v1.4.14/go.mod h1:tYTzTbVODv/gx0TJ3TkEb+gUieQiAbqLfj/yFNrlDV4=
github.com/hyperledger/firefly-common v1.4.15 h1:dp4Mo2JQRPMbL7hoMw8T/ktvIUgematOLkXIppQtBp0=
github.com/hyperledger/firefly-common v1.4.15/go.mod h1:bA7tAJxcpfQMrHN3/YycTSpyk4g2WlnDlpHx8WOUtAY=
github.com/hyperledger/firefly-signer v1.1.19 h1:Gq5HqUp9/7egLrahJY9WMk4Y9dZVPIl99aSIged93HM=
github.com/hyperledger/firefly-signer v1.1.19/go.mod h1:XTwaPRkAfVxk2G3PQOYHLbuvMOiBs0px/4vwXTsUtsA=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down Expand Up @@ -163,8 +163,8 @@ github.com/qeesung/image2ascii v1.0.1 h1:Fe5zTnX/v/qNC3OC4P/cfASOXS501Xyw2UUcgrL
github.com/qeesung/image2ascii v1.0.1/go.mod h1:kZKhyX0h2g/YXa/zdJR3JnLnJ8avHjZ3LrvEKSYyAyU=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po=
github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
Expand Down Expand Up @@ -278,8 +278,8 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
10 changes: 6 additions & 4 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,8 @@ github.com/hashicorp/go-memdb v1.3.3/go.mod h1:uBTr1oQbtuMgd1SSGoR8YV27eT3sBHbYi
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
github.com/hyperledger/firefly-common v1.4.14 h1:G1x7jKBM2MmbGAo+Hwu/9w3F4cyGuWvYViEZGPLWlic=
github.com/hyperledger/firefly-common v1.4.14/go.mod h1:tYTzTbVODv/gx0TJ3TkEb+gUieQiAbqLfj/yFNrlDV4=
github.com/hyperledger/firefly-signer v1.1.19 h1:Gq5HqUp9/7egLrahJY9WMk4Y9dZVPIl99aSIged93HM=
github.com/hyperledger/firefly-signer v1.1.19/go.mod h1:XTwaPRkAfVxk2G3PQOYHLbuvMOiBs0px/4vwXTsUtsA=
github.com/hyperledger/firefly-common v1.4.15 h1:dp4Mo2JQRPMbL7hoMw8T/ktvIUgematOLkXIppQtBp0=
github.com/hyperledger/firefly-common v1.4.15/go.mod h1:bA7tAJxcpfQMrHN3/YycTSpyk4g2WlnDlpHx8WOUtAY=
github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds=
Expand Down Expand Up @@ -303,6 +301,8 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzL
github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/sagikazarmark/crypt v0.17.0/go.mod h1:SMtHTvdmsZMuY/bpZoqokSoChIrcJ/epOxZN58PbZDg=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/snowflakedb/gosnowflake v1.6.19/go.mod h1:FM1+PWUdwB9udFDsXdfD58NONC0m+MlOSmQRvimobSM=
Expand Down Expand Up @@ -335,6 +335,8 @@ google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJ
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac h1:ZL/Teoy/ZGnzyrqK/Optxxp2pmVh+fmJ97slxSRyzUg=
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k=
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/bson.v2 v2.0.0-20171018101713-d8c8987b8862/go.mod h1:VN8wuk/3Ksp8lVZ82HHf/MI1FHOBDt5bPK9VZ8DvymM=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
Expand Down
45 changes: 6 additions & 39 deletions internal/blockchain/fabric/fabric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ import (
"github.com/stretchr/testify/mock"
)

var utConfig = config.RootSection("fab_unit_tests")
var utFabconnectConf = utConfig.SubSection(FabconnectConfigKey)
var signer = "orgMSP::x509::CN=signer001,OU=client::CN=fabric-ca"
var (
utConfig = config.RootSection("fab_unit_tests")
utFabconnectConf = utConfig.SubSection(FabconnectConfigKey)
signer = "orgMSP::x509::CN=signer001,OU=client::CN=fabric-ca"
)

func resetConf(e *Fabric) {
coreconfig.Reset()
Expand Down Expand Up @@ -262,7 +264,6 @@ func TestBadTLS(t *testing.T) {
}

func TestInitAllNewStreamsAndWSEvent(t *testing.T) {

log.SetLevel("trace")
e, cancel := newTestFabric()
defer cancel()
Expand Down Expand Up @@ -336,11 +337,9 @@ func TestInitAllNewStreamsAndWSEvent(t *testing.T) {
fromServer <- `!json`
fromServer <- `{"not": "a reply"}`
fromServer <- `42`

}

func TestWSInitFail(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()

Expand All @@ -357,7 +356,6 @@ func TestWSInitFail(t *testing.T) {

err = e.StartNamespace(e.ctx, "ns1")
assert.Regexp(t, "FF00149", err)

}

func TestCacheInitFail(t *testing.T) {
Expand Down Expand Up @@ -886,7 +884,6 @@ func TestInitNewConfig(t *testing.T) {
}

func TestStreamQueryError(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()

Expand All @@ -912,11 +909,9 @@ func TestStreamQueryError(t *testing.T) {

err = e.StartNamespace(e.ctx, "ns1")
assert.Regexp(t, "FF10284.*pop", err)

}

func TestStreamCreateError(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()

Expand Down Expand Up @@ -944,11 +939,9 @@ func TestStreamCreateError(t *testing.T) {

err = e.StartNamespace(e.ctx, "ns1")
assert.Regexp(t, "FF10284.*pop", err)

}

func TestEnsureStreamDelete(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()

Expand Down Expand Up @@ -985,7 +978,6 @@ func TestEnsureStreamDelete(t *testing.T) {
}

func TestEnsureStreamDeleteFail(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()

Expand Down Expand Up @@ -1050,7 +1042,6 @@ func TestDeleteStreamOKNotFound(t *testing.T) {
}

func TestSubQueryCreateError(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()

Expand Down Expand Up @@ -1094,11 +1085,9 @@ func TestSubQueryCreateError(t *testing.T) {
e.streamID["ns1"] = "es12345"
_, err = e.AddFireflySubscription(e.ctx, ns, contract, "")
assert.Regexp(t, "FF10284.*pop", err)

}

func TestSubQueryCreate(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()

Expand Down Expand Up @@ -1142,11 +1131,9 @@ func TestSubQueryCreate(t *testing.T) {
e.streamID["ns1"] = "es12345"
_, err = e.AddFireflySubscription(e.ctx, ns, contract, "")
assert.NoError(t, err)

}

func TestSubmitBatchPinOK(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down Expand Up @@ -1186,11 +1173,9 @@ func TestSubmitBatchPinOK(t *testing.T) {
err := e.SubmitBatchPin(context.Background(), "", "ns1", signer, batch, location)

assert.NoError(t, err)

}

func TestSubmitBatchPinV1(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down Expand Up @@ -1230,11 +1215,9 @@ func TestSubmitBatchPinV1(t *testing.T) {
err := e.SubmitBatchPin(context.Background(), "", "ns1", signer, batch, location)

assert.NoError(t, err)

}

func TestSubmitBatchPinBadLocation(t *testing.T) {

e, _ := newTestFabric()

signer := "signer001"
Expand All @@ -1259,7 +1242,6 @@ func TestSubmitBatchPinBadLocation(t *testing.T) {
}

func TestSubmitBatchEmptyPayloadRef(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down Expand Up @@ -1298,11 +1280,9 @@ func TestSubmitBatchEmptyPayloadRef(t *testing.T) {
err := e.SubmitBatchPin(context.Background(), "", "ns1", signer, batch, location)

assert.NoError(t, err)

}

func TestSubmitBatchPinVersionFail(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down Expand Up @@ -1331,11 +1311,9 @@ func TestSubmitBatchPinVersionFail(t *testing.T) {
err := e.SubmitBatchPin(context.Background(), "", "ns1", signer, batch, location)

assert.Regexp(t, "FF10284.*pop", err)

}

func TestSubmitBatchPinFail(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down Expand Up @@ -1367,11 +1345,9 @@ func TestSubmitBatchPinFail(t *testing.T) {
err := e.SubmitBatchPin(context.Background(), "", "ns1", signer, batch, location)

assert.Regexp(t, "FF10284.*pop", err)

}

func TestSubmitBatchPinError(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down Expand Up @@ -1405,7 +1381,6 @@ func TestSubmitBatchPinError(t *testing.T) {
err := e.SubmitBatchPin(context.Background(), "", "ns1", signer, batch, location)

assert.Regexp(t, "FF10284.*Invalid", err)

}

func TestResolveSignerBlank(t *testing.T) {
Expand All @@ -1425,7 +1400,6 @@ func TestResolveFullIDSigner(t *testing.T) {
signKey, err := e.ResolveSigningKey(context.Background(), id, blockchain.ResolveKeyIntentSign)
assert.NoError(t, err)
assert.Equal(t, "org1MSP::x509::CN=admin,OU=client::CN=fabric-ca-server", signKey)

}

func TestResolveSigner(t *testing.T) {
Expand Down Expand Up @@ -1458,7 +1432,7 @@ func TestResolveSignerFailedFabricCARequest(t *testing.T) {
responder, _ := httpmock.NewJsonResponder(503, res)
httpmock.RegisterResponder("GET", `http://localhost:12345/identities/signer001`, responder)
_, err := e.ResolveSigningKey(context.Background(), "signer001", blockchain.ResolveKeyIntentSign)
assert.EqualError(t, err, "FF10284: Error from fabconnect: %!!(MISSING)s(<nil>)")
assert.Contains(t, err.Error(), "FF10284: Error from fabconnect:")
}

func TestResolveSignerBadECertReturned(t *testing.T) {
Expand Down Expand Up @@ -1572,7 +1546,6 @@ func TestHandleMessageBatchPinOK(t *testing.T) {
assert.Equal(t, "19b82093de5ce92a01e333048e877e2374354bf846dd034864ef6ffbd6438771", b.Batch.Contexts[1].String())

em.AssertExpectations(t)

}

func TestHandleMessageBatchPinMissingChaincodeID(t *testing.T) {
Expand Down Expand Up @@ -1615,7 +1588,6 @@ func TestHandleMessageBatchPinMissingChaincodeID(t *testing.T) {
assert.NoError(t, err)
err = e.handleMessageBatch(context.Background(), events)
assert.Regexp(t, "FF10310", err)

}

func TestHandleMessageUnknownEventName(t *testing.T) {
Expand Down Expand Up @@ -3042,7 +3014,6 @@ func TestHandleNetworkAction(t *testing.T) {
assert.NoError(t, err)

em.AssertExpectations(t)

}

func TestHandleNetworkActionFail(t *testing.T) {
Expand Down Expand Up @@ -3084,7 +3055,6 @@ func TestHandleNetworkActionFail(t *testing.T) {
assert.EqualError(t, err, "pop")

em.AssertExpectations(t)

}

func TestGetNetworkVersion(t *testing.T) {
Expand Down Expand Up @@ -3244,7 +3214,6 @@ func TestConvertDeprecatedContractConfigNoChannel(t *testing.T) {
}

func TestSubmitNetworkAction(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down Expand Up @@ -3275,7 +3244,6 @@ func TestSubmitNetworkAction(t *testing.T) {
}

func TestSubmitNetworkActionV1(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down Expand Up @@ -3334,7 +3302,6 @@ func TestSubmitNetworkActionBadLocation(t *testing.T) {
}

func TestSubmitNetworkActionVersionError(t *testing.T) {

e, cancel := newTestFabric()
defer cancel()
httpmock.ActivateNonDefault(e.client.GetClient())
Expand Down
2 changes: 1 addition & 1 deletion smart_contracts/fabric/custompin-sample/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/hyperledger/fabric-contract-api-go v1.2.2
github.com/hyperledger/fabric-protos-go v0.3.3
github.com/stretchr/testify v1.8.4
google.golang.org/protobuf v1.32.0
google.golang.org/protobuf v1.33.0
)

require (
Expand Down
Loading
Loading