From a1c9712acb60062978f931cc76105f818d0a3a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Macedo?= Date: Wed, 8 May 2024 16:43:39 -0300 Subject: [PATCH 1/5] Bump go version to 1.21 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Macedo --- go.mod | 29 +++++++++++-------- go.sum | 89 +++++++++++++++++----------------------------------------- 2 files changed, 44 insertions(+), 74 deletions(-) diff --git a/go.mod b/go.mod index 17e1b1b..50673a8 100644 --- a/go.mod +++ b/go.mod @@ -1,29 +1,36 @@ module github.com/hyperledger-labs/cc-tools -go 1.14 +go 1.21 require ( - github.com/fsnotify/fsnotify v1.4.9 // indirect - github.com/golang/protobuf v1.4.3 - github.com/google/go-cmp v0.5.4 // indirect + github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.3.0 github.com/hyperledger/fabric v2.1.1+incompatible github.com/hyperledger/fabric-chaincode-go v0.0.0-20210603161043-af0e3898842a github.com/hyperledger/fabric-protos-go v0.0.0-20210528200356-82833ecdac31 + github.com/stretchr/testify v1.6.1 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/kr/text v0.2.0 // indirect github.com/miekg/pkcs11 v1.0.3 // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/viper v1.7.1 // indirect - github.com/stretchr/testify v1.6.1 github.com/sykesm/zap-logfmt v0.0.4 // indirect + go.uber.org/atomic v1.6.0 // indirect + go.uber.org/multierr v1.5.0 // indirect go.uber.org/zap v1.16.0 // indirect - golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect - golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b // indirect - golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect - golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/grpc v1.35.0 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/grpc v1.56.3 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0 // indirect diff --git a/go.sum b/go.sum index 43a706f..355b7e3 100644 --- a/go.sum +++ b/go.sum @@ -24,10 +24,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -39,10 +37,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= @@ -63,34 +57,24 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU 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/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= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -127,7 +111,6 @@ github.com/hyperledger/fabric-protos-go v0.0.0-20210528200356-82833ecdac31/go.mo github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -175,7 +158,6 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -186,9 +168,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -207,7 +187,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= @@ -238,9 +217,8 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -260,9 +238,8 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b h1:GgiSbuUyC0BlbUmHQBgFqu32eiRR/CEYdjOjOd4zE6Y= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 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= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -278,8 +255,8 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -303,16 +280,13 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -335,13 +309,10 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa h1:5E4dL8+NgFOgjwbTKz+OOEGGhP+ectTmF842l6KjupQ= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 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= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -361,26 +332,18 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.35.0 h1:TwIQcH3es+MojMVojxxfQ3l3OF2KzlRxML2xZq0kRo8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= +google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 70ed47b29a7979624326846bfd53e1c304f8f694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Macedo?= Date: Wed, 8 May 2024 17:14:44 -0300 Subject: [PATCH 2/5] Update CC-Tools version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Macedo --- .github/workflows/go.yml | 2 +- README.md | 2 +- test/main_test.go | 2 +- test/tx_getHeader_test.go | 4 ++-- transactions/getHeader.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ad7cc59..0e43b31 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.16 + go-version: 1.21 - name: Build run: go build -v ./... diff --git a/README.md b/README.md index afc09b2..ae8e436 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/hyperledger-labs/cc-tools)](https://goreportcard.com/report/github.com/hyperledger-labs/cc-tools) [![GoDoc](https://godoc.org/github.com/hyperledger-labs/cc-tools?status.svg)](https://godoc.org/github.com/hyperledger-labs/cc-tools) -This project is a GoLedger open-source project aimed at providing tools for Hyperledger Fabric chaincode development in Golang. This might have breaking changes before we arrive at release v1.0.0. +This project is a GoLedger open-source project aimed at providing tools for Hyperledger Fabric chaincode development in Golang. ## Getting Started diff --git a/test/main_test.go b/test/main_test.go index fcc8af5..3161ac8 100644 --- a/test/main_test.go +++ b/test/main_test.go @@ -15,7 +15,7 @@ func TestMain(m *testing.M) { tx.InitHeader(tx.Header{ Name: "CC Tools Test", - Version: "v0.8.1", + Version: "v1.0.0", Colors: map[string][]string{ "@default": {"#4267B2", "#34495E", "#ECF0F1"}, }, diff --git a/test/tx_getHeader_test.go b/test/tx_getHeader_test.go index 77ea5f6..b9e9aec 100644 --- a/test/tx_getHeader_test.go +++ b/test/tx_getHeader_test.go @@ -11,7 +11,7 @@ func TestGetHeader(t *testing.T) { stub := mock.NewMockStub("org1MSP", new(testCC)) expectedResponse := map[string]interface{}{ - "ccToolsVersion": "v0.8.1", + "ccToolsVersion": "v1.0.0", "colors": []interface{}{ "#4267B2", "#34495E", @@ -20,7 +20,7 @@ func TestGetHeader(t *testing.T) { "name": "CC Tools Test", "orgMSP": "org1MSP", "orgTitle": "CC Tools Demo", - "version": "v0.8.1", + "version": "v1.0.0", } err := invokeAndVerify(stub, "getHeader", nil, expectedResponse, 200) if err != nil { diff --git a/transactions/getHeader.go b/transactions/getHeader.go index 573f27b..a5ab9c3 100644 --- a/transactions/getHeader.go +++ b/transactions/getHeader.go @@ -19,7 +19,7 @@ var header Header func InitHeader(h Header) { header = h - header.CCToolsVersion = "v0.8.1" + header.CCToolsVersion = "v1.0.0" } // GetHeader returns data in CCHeader From b7274bf62395c9d41afd6283931c2218b1132b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Macedo?= Date: Wed, 8 May 2024 17:30:03 -0300 Subject: [PATCH 3/5] Update depedencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Macedo --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 50673a8..3072962 100644 --- a/go.mod +++ b/go.mod @@ -24,14 +24,14 @@ require ( go.uber.org/atomic v1.6.0 // indirect go.uber.org/multierr v1.5.0 // indirect go.uber.org/zap v1.16.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/grpc v1.56.3 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 355b7e3..bf0f3d7 100644 --- a/go.sum +++ b/go.sum @@ -217,8 +217,8 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -255,8 +255,8 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -280,8 +280,8 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -360,8 +360,8 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From ed1264ac61297fd1798e23282a56d7cd3b6421c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Macedo?= Date: Wed, 8 May 2024 17:59:52 -0300 Subject: [PATCH 4/5] Update tested versions on Readme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Macedo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae8e436..bddc4c1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This project is a GoLedger open-source project aimed at providing tools for Hype Make sure you visit the repository [hyperledger-labs/cc-tools-demo](https://github.com/hyperledger-labs/cc-tools-demo), which is a template of a functional chaincode that uses cc-tools and provides ready-to-use scripts to deploy development networks. This is our preferred way of working, but you can feel free to import the package and assemble the chaincode as you choose. -CC Tools has been tested with Hyperledger Fabric 1.x and 2.x realeases. +CC Tools has been tested with Hyperledger Fabric v2.2, v2.4 and v2.5 releases. ## Features - Standard asset data mapping (and their properties) From 10894c139aba66dbdcedb527ec337cf12abf74b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Macedo?= Date: Thu, 9 May 2024 17:38:38 -0300 Subject: [PATCH 5/5] Return lastTouchedBy to returns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Macedo --- assets/get.go | 3 - assets/put.go | 2 - assets/search.go | 2 - test/assets_get_test.go | 61 +++--- test/assets_put_test.go | 364 +++++++++----------------------- test/tryout_test.go | 37 ++-- test/tx_createAssetType_test.go | 2 +- test/tx_createAsset_test.go | 5 +- test/tx_deleteAsset_test.go | 1 - test/tx_readAsset_test.go | 25 +-- test/tx_updateAsset_test.go | 4 +- transactions/readAsset.go | 10 +- 12 files changed, 175 insertions(+), 341 deletions(-) diff --git a/assets/get.go b/assets/get.go index eb60a6b..a29a82b 100644 --- a/assets/get.go +++ b/assets/get.go @@ -41,8 +41,6 @@ func get(stub *sw.StubWrapper, pvtCollection, key string, committed bool) (*Asse return nil, errors.WrapErrorWithStatus(err, "failed to unmarshal asset from ledger", 500) } - delete(response, "@lastTouchBy") - return &response, nil } @@ -181,7 +179,6 @@ func getRecursive(stub *sw.StubWrapper, pvtCollection, key string, keysChecked [ return nil, errors.WrapErrorWithStatus(err, "failed to unmarshal asset from ledger", 500) } - delete(response, "@lastTouchBy") keysCheckedInScope := make([]string, 0) for k, v := range response { diff --git a/assets/put.go b/assets/put.go index 7e5cb4f..7282f19 100644 --- a/assets/put.go +++ b/assets/put.go @@ -48,8 +48,6 @@ func (a *Asset) put(stub *sw.StubWrapper) (map[string]interface{}, errors.ICCErr return nil, errors.WrapError(err, "failed to write asset to ledger") } - delete(*a, "@lastTouchBy") - return *a, nil } diff --git a/assets/search.go b/assets/search.go index c9273fc..ffe1e07 100644 --- a/assets/search.go +++ b/assets/search.go @@ -99,8 +99,6 @@ func Search(stub *sw.StubWrapper, request map[string]interface{}, privateCollect data = asset } - delete(data, "@lastTouchBy") - searchResult = append(searchResult, data) } diff --git a/test/assets_get_test.go b/test/assets_get_test.go index 515ce71..5ec10e2 100644 --- a/test/assets_get_test.go +++ b/test/assets_get_test.go @@ -16,12 +16,13 @@ func TestGetAsset(t *testing.T) { // State setup expectedResponse := assets.Asset{ - "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", - "@lastTx": "createAsset", - "@assetType": "person", - "name": "Maria", - "id": "31820792048", - "height": 0.0, + "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", + "@lastTx": "createAsset", + "@assetType": "person", + "name": "Maria", + "id": "31820792048", + "height": 0.0, } stub.MockTransactionStart("setupGetAsset") setupState, _ := json.Marshal(expectedResponse) @@ -92,9 +93,6 @@ func TestGetManyAssets(t *testing.T) { stub.PutState("person:916c708a-1d6c-5c4f-8f12-d9d36f2aad27", setupState) stub.MockTransactionEnd("setupGetManyAssets") - delete(asset1, "@lastTouchBy") - delete(asset2, "@lastTouchBy") - delete(asset3, "@lastTouchBy") expectedResponse := []*assets.Asset{&asset1, &asset2, &asset3} assetKeys := []assets.Key{ @@ -163,7 +161,6 @@ func TestGetCommittedAsset(t *testing.T) { t.FailNow() } - delete(expectedResponse, "@lastTouchBy") if !reflect.DeepEqual(*gotAsset, expectedResponse) { log.Println("these should be deeply equal") log.Println(expectedResponse) @@ -219,18 +216,20 @@ func TestGetRecursive(t *testing.T) { "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", } expectedResponse := map[string]interface{}{ - "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", - "@lastTx": "createAsset", - "@assetType": "book", - "title": "Meu Nome é Maria", - "author": "Maria Viana", + "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", + "@lastTouchBy": "org2MSP", + "@lastTx": "createAsset", + "@assetType": "book", + "title": "Meu Nome é Maria", + "author": "Maria Viana", "currentTenant": map[string]interface{}{ - "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", - "@lastTx": "createAsset", - "@assetType": "person", - "name": "Maria", - "id": "31820792048", - "height": 0.0, + "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", + "@lastTx": "createAsset", + "@assetType": "person", + "name": "Maria", + "id": "31820792048", + "height": 0.0, }, "genres": []interface{}{"biography", "non-fiction"}, "published": "2019-05-06T22:12:41Z", @@ -296,16 +295,18 @@ func TestGetRecursiveWithPvtData(t *testing.T) { "@key": "library:37262f3f-5f08-5649-b488-e5abaad266e1", } expectedResponse := map[string]interface{}{ - "@assetType": "library", - "@key": "library:37262f3f-5f08-5649-b488-e5abaad266e1", - "@lastTx": "createAsset", - "name": "Biblioteca Maria da Silva", + "@assetType": "library", + "@key": "library:37262f3f-5f08-5649-b488-e5abaad266e1", + "@lastTouchBy": "org3MSP", + "@lastTx": "createAsset", + "name": "Biblioteca Maria da Silva", "entranceCode": map[string]interface{}{ - "@assetType": "secret", - "@key": "secret:73a3f9a7-eb91-5f4d-b1bb-c0487e90f40b", - "@lastTx": "createAsset", - "secretName": "testSecret", - "secret": "this is very secret", + "@assetType": "secret", + "@key": "secret:73a3f9a7-eb91-5f4d-b1bb-c0487e90f40b", + "@lastTouchBy": "org2MSP", + "@lastTx": "createAsset", + "secretName": "testSecret", + "secret": "this is very secret", }, } diff --git a/test/assets_put_test.go b/test/assets_put_test.go index 4b00ca7..2415af3 100644 --- a/test/assets_put_test.go +++ b/test/assets_put_test.go @@ -117,7 +117,6 @@ func TestPutAssetWithSubAsset(t *testing.T) { t.FailNow() } - expectedState["@lastTouchBy"] = "org1MSP" if !reflect.DeepEqual(expectedState, state) { log.Println("these should be deeply equal") log.Println(expectedState) @@ -159,6 +158,7 @@ func TestPutNewAssetRecursive(t *testing.T) { expectedBook := map[string]interface{}{ "@assetType": "book", "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", + "@lastTouchBy": "org1MSP", "@lastTx": "", "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), "title": "Meu Nome é Maria", @@ -166,6 +166,7 @@ func TestPutNewAssetRecursive(t *testing.T) { "currentTenant": map[string]interface{}{ "@assetType": "person", "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", "@lastTx": "", "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), "name": "Maria", @@ -216,266 +217,111 @@ func TestPutNewAssetRecursive(t *testing.T) { } func TestUpdateRecursive(t *testing.T) { - tests := []struct { - description string - - assetkey string - asset map[string]interface{} - updateReq map[string]interface{} - expectedResponse func(lastUpdated string) map[string]interface{} - expectedState func(lastUpdated string) map[string]interface{} - }{ - { - description: "update recursive book", - - assetkey: "book:a36a2920-c405-51c3-b584-dcd758338cb5", - asset: map[string]interface{}{ - "@assetType": "book", - "title": "Meu Nome é Maria", - "author": "Maria Viana", - "currentTenant": map[string]interface{}{ - "@assetType": "person", - "name": "Maria", - "id": "31820792048", - "height": 1.66, - }, - "genres": []interface{}{"biography", "non-fiction"}, - "published": "2019-05-06T22:12:41Z", - }, - updateReq: map[string]interface{}{ - "@assetType": "book", - "author": "Maria Viana", - "title": "Meu Nome é Maria", - "published": "2022-05-06T22:12:41Z", - "currentTenant": map[string]interface{}{ - "@assetType": "person", - "id": "31820792048", - "height": 1.88, - }, - }, - expectedResponse: func(lastUpdated string) map[string]interface{} { - publishedTime, _ := time.Parse(time.RFC3339, "2022-05-06T22:12:41Z") - return map[string]interface{}{ - "@assetType": "book", - "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", - "@lastTx": "", - "@lastUpdated": lastUpdated, - "title": "Meu Nome é Maria", - "author": "Maria Viana", - "currentTenant": map[string]interface{}{ - "@assetType": "person", - "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", - "@lastTx": "", - "@lastUpdated": lastUpdated, - "name": "Maria", - "id": "31820792048", - "height": 1.88, - }, - "genres": []interface{}{"biography", "non-fiction"}, - "published": publishedTime, - } - }, - expectedState: func(lastUpdated string) map[string]interface{} { - return map[string]interface{}{ - "@assetType": "book", - "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", - "@lastTouchBy": "org1MSP", - "@lastTx": "", - "@lastUpdated": lastUpdated, - "title": "Meu Nome é Maria", - "author": "Maria Viana", - "currentTenant": map[string]interface{}{ - "@assetType": "person", - "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", - }, - "genres": []interface{}{"biography", "non-fiction"}, - "published": "2022-05-06T22:12:41Z", - } - }, + stub := mock.NewMockStub("org1MSP", new(testCC)) + + // Create a book + stub.MockTransactionStart("TestPutAsset") + sw := &sw.StubWrapper{ + Stub: stub, + } + book := map[string]interface{}{ + "@assetType": "book", + "title": "Meu Nome é Maria", + "author": "Maria Viana", + "currentTenant": map[string]interface{}{ + "@assetType": "person", + "name": "Maria", + "id": "31820792048", + "height": 1.66, }, - { - description: "update books in library", - - assetkey: "library:9c5ffeb3-2491-5a88-858c-653b1ea8dbc5", - asset: map[string]interface{}{ - "@assetType": "library", - "name": "biographies", - "books": []interface{}{ - map[string]interface{}{ - "@assetType": "book", - "title": "Meu Nome é Maria", - "author": "Maria Viana", - "currentTenant": map[string]interface{}{ - "@assetType": "person", - "name": "Maria", - "id": "31820792048", - "height": 1.66, - }, - "genres": []interface{}{"biography", "non-fiction"}, - "published": "2019-05-06T22:12:41Z", - }, - map[string]interface{}{ - "@assetType": "book", - "title": "Meu Nome é João", - "author": "João Viana", - "currentTenant": map[string]interface{}{ - "@assetType": "person", - "name": "João", - "id": "42931801159", - "height": 1.90, - }, - "genres": []interface{}{"biography", "non-fiction"}, - "published": "2020-06-06T22:12:41Z", - }, - }, - }, - updateReq: map[string]interface{}{ - "@assetType": "library", - "name": "biographies", - "books": []interface{}{ - map[string]interface{}{ // This book will not be updated - "@assetType": "book", - "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", - }, - map[string]interface{}{ // This book will be updated - "@assetType": "book", - "title": "Meu Nome é João", - "author": "João Viana", - "currentTenant": map[string]interface{}{ // This person will be updated - "@assetType": "person", - "id": "42931801159", - "height": 1.92, - }, - "published": "2020-06-10T22:12:41Z", - }, - }, - }, - expectedResponse: func(lastUpdated string) map[string]interface{} { - publishedTimeBook2, _ := time.Parse(time.RFC3339, "2020-06-10T22:12:41Z") - - return map[string]interface{}{ - "@assetType": "library", - "@key": "library:9c5ffeb3-2491-5a88-858c-653b1ea8dbc5", - "@lastTx": "", - "@lastTouchBy": "org1MSP", - "@lastUpdated": lastUpdated, - "name": "biographies", - "books": []interface{}{ - map[string]interface{}{ - "@assetType": "book", - "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", - "@lastTx": "", - "@lastTouchBy": "org1MSP", - "@lastUpdated": lastUpdated, - "title": "Meu Nome é Maria", - "author": "Maria Viana", - "currentTenant": map[string]interface{}{ - "@assetType": "person", - "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", - "@lastTx": "", - "@lastTouchBy": "org1MSP", - "@lastUpdated": lastUpdated, - "name": "Maria", - "id": "31820792048", - "height": 1.66, - }, - "genres": []interface{}{"biography", "non-fiction"}, - "published": "2019-05-06T22:12:41Z", - }, - map[string]interface{}{ - "@assetType": "book", - "@key": "book:679f58a4-578f-563c-9c22-3f51b9fab6d5", - "@lastTx": "", - "@lastUpdated": lastUpdated, - "title": "Meu Nome é João", - "author": "João Viana", - "currentTenant": map[string]interface{}{ - "@assetType": "person", - "@key": "person:09c4f266-3bac-5d2f-813b-db3c41ab3375", - "@lastTx": "", - "@lastUpdated": lastUpdated, - "name": "João", - "id": "42931801159", - "height": 1.92, - }, - "genres": []interface{}{"biography", "non-fiction"}, - "published": publishedTimeBook2, - }, - }, - } - }, - expectedState: func(lastUpdated string) map[string]interface{} { - return map[string]interface{}{ - "@assetType": "library", - "@key": "library:9c5ffeb3-2491-5a88-858c-653b1ea8dbc5", - "@lastTouchBy": "org1MSP", - "@lastTx": "", - "@lastUpdated": lastUpdated, - "name": "biographies", - "books": []interface{}{ - map[string]interface{}{ - "@assetType": "book", - "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", - }, - map[string]interface{}{ - "@assetType": "book", - "@key": "book:679f58a4-578f-563c-9c22-3f51b9fab6d5", - }, - }, - } - }, + "genres": []interface{}{"biography", "non-fiction"}, + "published": "2019-05-06T22:12:41Z", + } + + var err error + _, err = assets.PutNewRecursive(sw, book) + if err != nil { + log.Println(err) + t.FailNow() + } + stub.MockTransactionEnd("TestPutAsset") + + // Update the book and the tenant + stub.MockTransactionStart("TestUpdateAsset") + book["published"] = "2022-05-06T22:12:41Z" + book["currentTenant"] = map[string]interface{}{ + "@assetType": "person", + "name": "Maria", + "id": "31820792048", + "height": 1.88, + } + + putBook, err := assets.UpdateRecursive(sw, book) + if err != nil { + log.Println(err) + t.FailNow() + } + + publishedTime, _ := time.Parse(time.RFC3339, "2022-05-06T22:12:41Z") + lastUpdated, _ := stub.GetTxTimestamp() + expectedBook := map[string]interface{}{ + "@assetType": "book", + "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", + "@lastTouchBy": "org1MSP", + "@lastTx": "", + "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), + "title": "Meu Nome é Maria", + "author": "Maria Viana", + "currentTenant": map[string]interface{}{ + "@assetType": "person", + "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", + "@lastTx": "", + "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), + "name": "Maria", + "id": "31820792048", + "height": 1.88, }, + "genres": []interface{}{"biography", "non-fiction"}, + "published": publishedTime, } - for _, tt := range tests { - t.Run(tt.description, func(t *testing.T) { - stub := mock.NewMockStub("org1MSP", new(testCC)) - sw := &sw.StubWrapper{ - Stub: stub, - } - - // Put asset - stub.MockTransactionStart("TestPutAsset") - var err error - _, err = assets.PutNewRecursive(sw, tt.asset) - if err != nil { - log.Println(err) - t.FailNow() - } - stub.MockTransactionEnd("TestPutAsset") - - // Update asset - stub.MockTransactionStart("TestUpdateAsset") - updateResult, err := assets.UpdateRecursive(sw, tt.updateReq) - if err != nil { - log.Println(err) - t.FailNow() - } - - lastUpdatedTimestamp, _ := stub.GetTxTimestamp() - lastUpdated := lastUpdatedTimestamp.AsTime().Format(time.RFC3339) - if !reflect.DeepEqual(tt.expectedResponse(lastUpdated), updateResult) { - log.Println("these should be deeply equal") - log.Println(tt.expectedResponse(lastUpdated)) - log.Println(updateResult) - t.FailNow() - } - stub.MockTransactionEnd("TestUpdateAsset") - - // Check state - stateJSON := stub.State[tt.assetkey] - var state map[string]interface{} - err = json.Unmarshal(stateJSON, &state) - if err != nil { - log.Println(err) - t.FailNow() - } - - if !reflect.DeepEqual(tt.expectedState(lastUpdated), state) { - log.Println("these should be deeply equal") - log.Println(tt.expectedState(lastUpdated)) - log.Println(state) - t.FailNow() - } - }) + + // Check if the book is updated + if !reflect.DeepEqual(expectedBook, putBook) { + log.Println("these should be deeply equal") + log.Println(expectedBook) + log.Println(putBook) + t.FailNow() + } + + expectedState := map[string]interface{}{ + "@assetType": "book", + "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", + "@lastTouchBy": "org1MSP", + "@lastTx": "", + "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), + "title": "Meu Nome é Maria", + "author": "Maria Viana", + "currentTenant": map[string]interface{}{ + "@assetType": "person", + "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + }, + "genres": []interface{}{"biography", "non-fiction"}, + "published": "2022-05-06T22:12:41Z", + } + + stateJSON := stub.State["book:a36a2920-c405-51c3-b584-dcd758338cb5"] + var state map[string]interface{} + err = json.Unmarshal(stateJSON, &state) + if err != nil { + log.Println(err) + t.FailNow() + } + + if !reflect.DeepEqual(expectedState, state) { + log.Println("these should be deeply equal") + log.Println(expectedState) + log.Println(state) + t.FailNow() } } diff --git a/test/tryout_test.go b/test/tryout_test.go index d5a3089..ab32099 100644 --- a/test/tryout_test.go +++ b/test/tryout_test.go @@ -23,12 +23,13 @@ func TestTryout(t *testing.T) { } expectedPerson := []interface{}{ map[string]interface{}{ - "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", - "@lastTx": "createAsset", - "@assetType": "person", - "name": "Maria", - "id": "31820792048", - "height": 0.0, + "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", + "@lastTx": "createAsset", + "@assetType": "person", + "name": "Maria", + "id": "31820792048", + "height": 0.0, }, } @@ -58,11 +59,12 @@ func TestTryout(t *testing.T) { expectedBook := []interface{}{ map[string]interface{}{ - "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", - "@lastTx": "createAsset", - "@assetType": "book", - "title": "Meu Nome é Maria", - "author": "Maria Viana", + "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", + "@lastTouchBy": "org2MSP", + "@lastTx": "createAsset", + "@assetType": "book", + "title": "Meu Nome é Maria", + "author": "Maria Viana", "currentTenant": map[string]interface{}{ "@assetType": "person", "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", @@ -110,12 +112,13 @@ func TestTryout(t *testing.T) { } expectedUpdatePerson := map[string]interface{}{ - "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", - "@lastTx": "updateAsset", - "@assetType": "person", - "name": "Maria", - "id": "31820792048", - "height": 1.67, + "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org2MSP", + "@lastTx": "updateAsset", + "@assetType": "person", + "name": "Maria", + "id": "31820792048", + "height": 1.67, } err = invokeAndVerify(stub, "updateAsset", reqUpdatePerson, expectedUpdatePerson, 200) diff --git a/test/tx_createAssetType_test.go b/test/tx_createAssetType_test.go index 7d38cd7..781c5c5 100644 --- a/test/tx_createAssetType_test.go +++ b/test/tx_createAssetType_test.go @@ -118,6 +118,7 @@ func TestCreateAssetType(t *testing.T) { lastUpdated, _ := stub.GetTxTimestamp() expectedResponse = map[string]interface{}{ "@key": "magazine:236a29db-f53c-59e1-ac6d-a4f264dbc477", + "@lastTouchBy": "org1MSP", "@lastTx": "createAsset", "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), "@assetType": "magazine", @@ -160,7 +161,6 @@ func TestCreateAssetType(t *testing.T) { t.FailNow() } - expectedResponse["@lastTouchBy"] = "org1MSP" if !reflect.DeepEqual(state, expectedResponse) { log.Println("these should be equal") log.Printf("%#v\n", state) diff --git a/test/tx_createAsset_test.go b/test/tx_createAsset_test.go index 77a873f..bc0bed8 100644 --- a/test/tx_createAsset_test.go +++ b/test/tx_createAsset_test.go @@ -35,6 +35,7 @@ func TestCreateAsset(t *testing.T) { lastUpdated, _ := stub.GetTxTimestamp() expectedResponse := map[string]interface{}{ "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", "@lastTx": "createAsset", "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), "@assetType": "person", @@ -79,7 +80,6 @@ func TestCreateAsset(t *testing.T) { t.FailNow() } - expectedResponse["@lastTouchBy"] = "org1MSP" if !reflect.DeepEqual(state, expectedResponse) { log.Println("these should be equal") log.Printf("%#v\n", state) @@ -135,6 +135,7 @@ func TestCreateAssetGenericAssociation(t *testing.T) { lastUpdated, _ := stub.GetTxTimestamp() expectedResponse := map[string]interface{}{ "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", "@lastTx": "createAsset", "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), "@assetType": "person", @@ -185,8 +186,6 @@ func TestCreateAssetGenericAssociation(t *testing.T) { t.FailNow() } - expectedResponse["@lastTouchBy"] = "org1MSP" - if !reflect.DeepEqual(state, expectedResponse) { log.Println("these should be equal") log.Printf("%#v\n", state) diff --git a/test/tx_deleteAsset_test.go b/test/tx_deleteAsset_test.go index 4f5ae2e..7ff2e7b 100644 --- a/test/tx_deleteAsset_test.go +++ b/test/tx_deleteAsset_test.go @@ -62,7 +62,6 @@ func TestDeleteAsset(t *testing.T) { t.FailNow() } - delete(expectedResponse, "@lastTouchBy") if !reflect.DeepEqual(resPayload, expectedResponse) { log.Println("these should be equal") log.Printf("%#v\n", resPayload) diff --git a/test/tx_readAsset_test.go b/test/tx_readAsset_test.go index 1cbd3ff..304a84e 100644 --- a/test/tx_readAsset_test.go +++ b/test/tx_readAsset_test.go @@ -55,7 +55,6 @@ func TestReadAsset(t *testing.T) { t.FailNow() } - delete(expectedResponse, "@lastTouchBy") if !reflect.DeepEqual(resPayload, expectedResponse) { log.Println("these should be equal") log.Printf("%#v\n", resPayload) @@ -110,18 +109,20 @@ func TestReadRecursive(t *testing.T) { "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", } expectedResponse := map[string]interface{}{ - "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", - "@lastTx": "createAsset", - "@assetType": "book", - "title": "Meu Nome é Maria", - "author": "Maria Viana", + "@key": "book:a36a2920-c405-51c3-b584-dcd758338cb5", + "@lastTouchBy": "org2MSP", + "@lastTx": "createAsset", + "@assetType": "book", + "title": "Meu Nome é Maria", + "author": "Maria Viana", "currentTenant": map[string]interface{}{ - "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", - "@lastTx": "createAsset", - "@assetType": "person", - "name": "Maria", - "id": "31820792048", - "height": 0.0, + "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", + "@lastTx": "createAsset", + "@assetType": "person", + "name": "Maria", + "id": "31820792048", + "height": 0.0, }, "genres": []interface{}{"biography", "non-fiction"}, "published": "2019-05-06T22:12:41Z", diff --git a/test/tx_updateAsset_test.go b/test/tx_updateAsset_test.go index 5192956..9787213 100644 --- a/test/tx_updateAsset_test.go +++ b/test/tx_updateAsset_test.go @@ -69,6 +69,7 @@ func TestUpdateAsset(t *testing.T) { expectedPerson := map[string]interface{}{ "@key": "person:47061146-c642-51a1-844a-bf0b17cb5e19", + "@lastTouchBy": "org1MSP", "@lastTx": "updateAsset", "@lastUpdated": lastUpdated.AsTime().Format(time.RFC3339), "@assetType": "person", @@ -92,10 +93,9 @@ func TestUpdateAsset(t *testing.T) { t.FailNow() } - expectedPerson["@lastTouchBy"] = "org1MSP" if !reflect.DeepEqual(state, expectedPerson) { log.Println("these should be equal") - log.Printf("%#v\n", state) + log.Printf("%#v\n", resPayload) log.Printf("%#v\n", expectedPerson) t.FailNow() } diff --git a/transactions/readAsset.go b/transactions/readAsset.go index 47ec840..23b5eee 100644 --- a/transactions/readAsset.go +++ b/transactions/readAsset.go @@ -51,15 +51,7 @@ var ReadAsset = Transaction{ return nil, errors.WrapErrorWithStatus(err, "failed to serialize asset", 500) } } else { - var asset *assets.Asset - asset, err = key.Get(stub) - if err != nil { - return nil, errors.WrapError(err, "failed to get asset state") - } - - delete(*asset, "@lastTouchBy") - - assetJSON, err = json.Marshal(asset) + assetJSON, err = key.GetBytes(stub) if err != nil { return nil, errors.WrapError(err, "failed to get asset state") }