From 85cae55ad57ef0e53b2a7db46367724a9676b826 Mon Sep 17 00:00:00 2001 From: Fedor Partanskiy Date: Wed, 12 Feb 2025 16:29:54 +0300 Subject: [PATCH] bump fabric-chaincode-go to v2.3.0 Signed-off-by: Fedor Partanskiy --- .../lifecycle/mock/chaincode_stub.go | 86 +++++++++++++++++++ core/scc/cscc/mocks/chaincode_stub.go | 86 +++++++++++++++++++ core/scc/lscc/mock/chaincode_stub.go | 86 +++++++++++++++++++ core/scc/qscc/mocks/chaincode_stub.go | 86 +++++++++++++++++++ go.mod | 2 +- go.sum | 4 +- .../fabric-chaincode-go/v2/shim/handler.go | 2 +- .../fabric-chaincode-go/v2/shim/interfaces.go | 7 ++ .../fabric-chaincode-go/v2/shim/stub.go | 15 +++- vendor/modules.txt | 2 +- 10 files changed, 370 insertions(+), 6 deletions(-) diff --git a/core/chaincode/lifecycle/mock/chaincode_stub.go b/core/chaincode/lifecycle/mock/chaincode_stub.go index 712b8f05ac1..2f62076ad53 100644 --- a/core/chaincode/lifecycle/mock/chaincode_stub.go +++ b/core/chaincode/lifecycle/mock/chaincode_stub.go @@ -57,6 +57,22 @@ type ChaincodeStub struct { finishWriteBatchReturnsOnCall map[int]struct { result1 error } + GetAllStatesCompositeKeyWithPaginationStub func(int32, string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) + getAllStatesCompositeKeyWithPaginationMutex sync.RWMutex + getAllStatesCompositeKeyWithPaginationArgsForCall []struct { + arg1 int32 + arg2 string + } + getAllStatesCompositeKeyWithPaginationReturns struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + } + getAllStatesCompositeKeyWithPaginationReturnsOnCall map[int]struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + } GetArgsStub func() [][]byte getArgsMutex sync.RWMutex getArgsArgsForCall []struct { @@ -793,6 +809,74 @@ func (fake *ChaincodeStub) FinishWriteBatchReturnsOnCall(i int, result1 error) { }{result1} } +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPagination(arg1 int32, arg2 string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + ret, specificReturn := fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall[len(fake.getAllStatesCompositeKeyWithPaginationArgsForCall)] + fake.getAllStatesCompositeKeyWithPaginationArgsForCall = append(fake.getAllStatesCompositeKeyWithPaginationArgsForCall, struct { + arg1 int32 + arg2 string + }{arg1, arg2}) + stub := fake.GetAllStatesCompositeKeyWithPaginationStub + fakeReturns := fake.getAllStatesCompositeKeyWithPaginationReturns + fake.recordInvocation("GetAllStatesCompositeKeyWithPagination", []interface{}{arg1, arg2}) + fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationCallCount() int { + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() + return len(fake.getAllStatesCompositeKeyWithPaginationArgsForCall) +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationCalls(stub func(int32, string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error)) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = stub +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationArgsForCall(i int) (int32, string) { + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() + argsForCall := fake.getAllStatesCompositeKeyWithPaginationArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationReturns(result1 shim.StateQueryIteratorInterface, result2 *peer.QueryResponseMetadata, result3 error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = nil + fake.getAllStatesCompositeKeyWithPaginationReturns = struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }{result1, result2, result3} +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationReturnsOnCall(i int, result1 shim.StateQueryIteratorInterface, result2 *peer.QueryResponseMetadata, result3 error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = nil + if fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall == nil { + fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall = make(map[int]struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }) + } + fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall[i] = struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }{result1, result2, result3} +} + func (fake *ChaincodeStub) GetArgs() [][]byte { fake.getArgsMutex.Lock() ret, specificReturn := fake.getArgsReturnsOnCall[len(fake.getArgsArgsForCall)] @@ -3150,6 +3234,8 @@ func (fake *ChaincodeStub) Invocations() map[string][][]interface{} { defer fake.delStateMutex.RUnlock() fake.finishWriteBatchMutex.RLock() defer fake.finishWriteBatchMutex.RUnlock() + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() fake.getArgsMutex.RLock() defer fake.getArgsMutex.RUnlock() fake.getArgsSliceMutex.RLock() diff --git a/core/scc/cscc/mocks/chaincode_stub.go b/core/scc/cscc/mocks/chaincode_stub.go index 2498bfc29d5..f98cf138e0a 100644 --- a/core/scc/cscc/mocks/chaincode_stub.go +++ b/core/scc/cscc/mocks/chaincode_stub.go @@ -57,6 +57,22 @@ type ChaincodeStub struct { finishWriteBatchReturnsOnCall map[int]struct { result1 error } + GetAllStatesCompositeKeyWithPaginationStub func(int32, string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) + getAllStatesCompositeKeyWithPaginationMutex sync.RWMutex + getAllStatesCompositeKeyWithPaginationArgsForCall []struct { + arg1 int32 + arg2 string + } + getAllStatesCompositeKeyWithPaginationReturns struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + } + getAllStatesCompositeKeyWithPaginationReturnsOnCall map[int]struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + } GetArgsStub func() [][]byte getArgsMutex sync.RWMutex getArgsArgsForCall []struct { @@ -793,6 +809,74 @@ func (fake *ChaincodeStub) FinishWriteBatchReturnsOnCall(i int, result1 error) { }{result1} } +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPagination(arg1 int32, arg2 string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + ret, specificReturn := fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall[len(fake.getAllStatesCompositeKeyWithPaginationArgsForCall)] + fake.getAllStatesCompositeKeyWithPaginationArgsForCall = append(fake.getAllStatesCompositeKeyWithPaginationArgsForCall, struct { + arg1 int32 + arg2 string + }{arg1, arg2}) + stub := fake.GetAllStatesCompositeKeyWithPaginationStub + fakeReturns := fake.getAllStatesCompositeKeyWithPaginationReturns + fake.recordInvocation("GetAllStatesCompositeKeyWithPagination", []interface{}{arg1, arg2}) + fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationCallCount() int { + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() + return len(fake.getAllStatesCompositeKeyWithPaginationArgsForCall) +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationCalls(stub func(int32, string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error)) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = stub +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationArgsForCall(i int) (int32, string) { + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() + argsForCall := fake.getAllStatesCompositeKeyWithPaginationArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationReturns(result1 shim.StateQueryIteratorInterface, result2 *peer.QueryResponseMetadata, result3 error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = nil + fake.getAllStatesCompositeKeyWithPaginationReturns = struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }{result1, result2, result3} +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationReturnsOnCall(i int, result1 shim.StateQueryIteratorInterface, result2 *peer.QueryResponseMetadata, result3 error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = nil + if fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall == nil { + fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall = make(map[int]struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }) + } + fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall[i] = struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }{result1, result2, result3} +} + func (fake *ChaincodeStub) GetArgs() [][]byte { fake.getArgsMutex.Lock() ret, specificReturn := fake.getArgsReturnsOnCall[len(fake.getArgsArgsForCall)] @@ -3150,6 +3234,8 @@ func (fake *ChaincodeStub) Invocations() map[string][][]interface{} { defer fake.delStateMutex.RUnlock() fake.finishWriteBatchMutex.RLock() defer fake.finishWriteBatchMutex.RUnlock() + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() fake.getArgsMutex.RLock() defer fake.getArgsMutex.RUnlock() fake.getArgsSliceMutex.RLock() diff --git a/core/scc/lscc/mock/chaincode_stub.go b/core/scc/lscc/mock/chaincode_stub.go index 712b8f05ac1..2f62076ad53 100644 --- a/core/scc/lscc/mock/chaincode_stub.go +++ b/core/scc/lscc/mock/chaincode_stub.go @@ -57,6 +57,22 @@ type ChaincodeStub struct { finishWriteBatchReturnsOnCall map[int]struct { result1 error } + GetAllStatesCompositeKeyWithPaginationStub func(int32, string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) + getAllStatesCompositeKeyWithPaginationMutex sync.RWMutex + getAllStatesCompositeKeyWithPaginationArgsForCall []struct { + arg1 int32 + arg2 string + } + getAllStatesCompositeKeyWithPaginationReturns struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + } + getAllStatesCompositeKeyWithPaginationReturnsOnCall map[int]struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + } GetArgsStub func() [][]byte getArgsMutex sync.RWMutex getArgsArgsForCall []struct { @@ -793,6 +809,74 @@ func (fake *ChaincodeStub) FinishWriteBatchReturnsOnCall(i int, result1 error) { }{result1} } +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPagination(arg1 int32, arg2 string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + ret, specificReturn := fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall[len(fake.getAllStatesCompositeKeyWithPaginationArgsForCall)] + fake.getAllStatesCompositeKeyWithPaginationArgsForCall = append(fake.getAllStatesCompositeKeyWithPaginationArgsForCall, struct { + arg1 int32 + arg2 string + }{arg1, arg2}) + stub := fake.GetAllStatesCompositeKeyWithPaginationStub + fakeReturns := fake.getAllStatesCompositeKeyWithPaginationReturns + fake.recordInvocation("GetAllStatesCompositeKeyWithPagination", []interface{}{arg1, arg2}) + fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationCallCount() int { + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() + return len(fake.getAllStatesCompositeKeyWithPaginationArgsForCall) +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationCalls(stub func(int32, string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error)) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = stub +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationArgsForCall(i int) (int32, string) { + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() + argsForCall := fake.getAllStatesCompositeKeyWithPaginationArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationReturns(result1 shim.StateQueryIteratorInterface, result2 *peer.QueryResponseMetadata, result3 error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = nil + fake.getAllStatesCompositeKeyWithPaginationReturns = struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }{result1, result2, result3} +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationReturnsOnCall(i int, result1 shim.StateQueryIteratorInterface, result2 *peer.QueryResponseMetadata, result3 error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = nil + if fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall == nil { + fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall = make(map[int]struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }) + } + fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall[i] = struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }{result1, result2, result3} +} + func (fake *ChaincodeStub) GetArgs() [][]byte { fake.getArgsMutex.Lock() ret, specificReturn := fake.getArgsReturnsOnCall[len(fake.getArgsArgsForCall)] @@ -3150,6 +3234,8 @@ func (fake *ChaincodeStub) Invocations() map[string][][]interface{} { defer fake.delStateMutex.RUnlock() fake.finishWriteBatchMutex.RLock() defer fake.finishWriteBatchMutex.RUnlock() + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() fake.getArgsMutex.RLock() defer fake.getArgsMutex.RUnlock() fake.getArgsSliceMutex.RLock() diff --git a/core/scc/qscc/mocks/chaincode_stub.go b/core/scc/qscc/mocks/chaincode_stub.go index 2498bfc29d5..f98cf138e0a 100644 --- a/core/scc/qscc/mocks/chaincode_stub.go +++ b/core/scc/qscc/mocks/chaincode_stub.go @@ -57,6 +57,22 @@ type ChaincodeStub struct { finishWriteBatchReturnsOnCall map[int]struct { result1 error } + GetAllStatesCompositeKeyWithPaginationStub func(int32, string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) + getAllStatesCompositeKeyWithPaginationMutex sync.RWMutex + getAllStatesCompositeKeyWithPaginationArgsForCall []struct { + arg1 int32 + arg2 string + } + getAllStatesCompositeKeyWithPaginationReturns struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + } + getAllStatesCompositeKeyWithPaginationReturnsOnCall map[int]struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + } GetArgsStub func() [][]byte getArgsMutex sync.RWMutex getArgsArgsForCall []struct { @@ -793,6 +809,74 @@ func (fake *ChaincodeStub) FinishWriteBatchReturnsOnCall(i int, result1 error) { }{result1} } +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPagination(arg1 int32, arg2 string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + ret, specificReturn := fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall[len(fake.getAllStatesCompositeKeyWithPaginationArgsForCall)] + fake.getAllStatesCompositeKeyWithPaginationArgsForCall = append(fake.getAllStatesCompositeKeyWithPaginationArgsForCall, struct { + arg1 int32 + arg2 string + }{arg1, arg2}) + stub := fake.GetAllStatesCompositeKeyWithPaginationStub + fakeReturns := fake.getAllStatesCompositeKeyWithPaginationReturns + fake.recordInvocation("GetAllStatesCompositeKeyWithPagination", []interface{}{arg1, arg2}) + fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationCallCount() int { + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() + return len(fake.getAllStatesCompositeKeyWithPaginationArgsForCall) +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationCalls(stub func(int32, string) (shim.StateQueryIteratorInterface, *peer.QueryResponseMetadata, error)) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = stub +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationArgsForCall(i int) (int32, string) { + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() + argsForCall := fake.getAllStatesCompositeKeyWithPaginationArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationReturns(result1 shim.StateQueryIteratorInterface, result2 *peer.QueryResponseMetadata, result3 error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = nil + fake.getAllStatesCompositeKeyWithPaginationReturns = struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }{result1, result2, result3} +} + +func (fake *ChaincodeStub) GetAllStatesCompositeKeyWithPaginationReturnsOnCall(i int, result1 shim.StateQueryIteratorInterface, result2 *peer.QueryResponseMetadata, result3 error) { + fake.getAllStatesCompositeKeyWithPaginationMutex.Lock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.Unlock() + fake.GetAllStatesCompositeKeyWithPaginationStub = nil + if fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall == nil { + fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall = make(map[int]struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }) + } + fake.getAllStatesCompositeKeyWithPaginationReturnsOnCall[i] = struct { + result1 shim.StateQueryIteratorInterface + result2 *peer.QueryResponseMetadata + result3 error + }{result1, result2, result3} +} + func (fake *ChaincodeStub) GetArgs() [][]byte { fake.getArgsMutex.Lock() ret, specificReturn := fake.getArgsReturnsOnCall[len(fake.getArgsArgsForCall)] @@ -3150,6 +3234,8 @@ func (fake *ChaincodeStub) Invocations() map[string][][]interface{} { defer fake.delStateMutex.RUnlock() fake.finishWriteBatchMutex.RLock() defer fake.finishWriteBatchMutex.RUnlock() + fake.getAllStatesCompositeKeyWithPaginationMutex.RLock() + defer fake.getAllStatesCompositeKeyWithPaginationMutex.RUnlock() fake.getArgsMutex.RLock() defer fake.getArgsMutex.RUnlock() fake.getArgsSliceMutex.RLock() diff --git a/go.mod b/go.mod index 9f3ef52417e..a4231620abd 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/gorilla/handlers v1.5.2 github.com/gorilla/mux v1.8.1 github.com/hyperledger-labs/SmartBFT v0.0.0-20241013183757-134292d4208a - github.com/hyperledger/fabric-chaincode-go/v2 v2.2.0 + github.com/hyperledger/fabric-chaincode-go/v2 v2.3.0 github.com/hyperledger/fabric-config v0.3.0 github.com/hyperledger/fabric-lib-go v1.1.3-0.20240523144151-25edd1eaf5f5 github.com/hyperledger/fabric-protos-go-apiv2 v0.3.6 diff --git a/go.sum b/go.sum index b04f1ca2ba8..fd66f851d61 100644 --- a/go.sum +++ b/go.sum @@ -887,8 +887,8 @@ github.com/hyperledger/aries-bbs-go v0.0.0-20240528084656-761671ea73bc h1:3Ykk6M github.com/hyperledger/aries-bbs-go v0.0.0-20240528084656-761671ea73bc/go.mod h1:Kofn6A6WWea1ZM8Rys5aBW9dszwJ7Ywa0kyyYL0TPYw= github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2 h1:B1Nt8hKb//KvgGRprk0h1t4lCnwhE9/ryb1WqfZbV+M= github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE= -github.com/hyperledger/fabric-chaincode-go/v2 v2.2.0 h1:n7rgo7iYD4cCC2+NlyI2DwtP+hYLwUl5UKPcJi4IrM8= -github.com/hyperledger/fabric-chaincode-go/v2 v2.2.0/go.mod h1:c3zA3gOL/V53a0v1TGgHe8nifeH6daG/UrmJs79I9pI= +github.com/hyperledger/fabric-chaincode-go/v2 v2.3.0 h1:NB/QO2t4R5f6Nz/oREqZeaE4splHI2U9gqndfEQZreo= +github.com/hyperledger/fabric-chaincode-go/v2 v2.3.0/go.mod h1:c3zA3gOL/V53a0v1TGgHe8nifeH6daG/UrmJs79I9pI= github.com/hyperledger/fabric-config v0.3.0 h1:FS5/dc9GAniljP6RYxQRG92AaiBVoN2vTvtOvnWqeQs= github.com/hyperledger/fabric-config v0.3.0/go.mod h1:kSevTn78K83Suc++JsEo7Nt1tYIPqDajW+ORz3OhWlg= github.com/hyperledger/fabric-lib-go v1.1.3-0.20240523144151-25edd1eaf5f5 h1:RPWTL5wxAb+xDOrsCU3QYZP65305F8v3PaOyzdbPVMU= diff --git a/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/handler.go b/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/handler.go index 346a15ac900..d9daa5d6648 100644 --- a/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/handler.go +++ b/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/handler.go @@ -821,7 +821,7 @@ func (h *Handler) handleEstablished(msg *peer.ChaincodeMessage) error { return nil } -// hanndleCreated handles messages received from the peer when the handler is in the "created" state. +// handleCreated handles messages received from the peer when the handler is in the "created" state. func (h *Handler) handleCreated(msg *peer.ChaincodeMessage) error { if msg.Type != peer.ChaincodeMessage_REGISTERED { return fmt.Errorf("[%s] Chaincode h cannot handle message (%s) while in state: %s", msg.Txid, msg.Type, h.state) diff --git a/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/interfaces.go b/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/interfaces.go index 66993fb82e8..816429a24a4 100644 --- a/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/interfaces.go +++ b/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/interfaces.go @@ -184,6 +184,13 @@ type ChaincodeStubInterface interface { GetStateByPartialCompositeKeyWithPagination(objectType string, keys []string, pageSize int32, bookmark string) (StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) + // GetAllStatesCompositeKeyWithPagination returns a range iterator over all set of + // keys with composite keys in the ledger. + // The bookmark works the same way as when GetStateByPartialCompositeKeyWithPagination is called. + // This call is only supported in a read only transaction. + GetAllStatesCompositeKeyWithPagination(pageSize int32, + bookmark string) (StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) + // CreateCompositeKey combines the given `attributes` to form a composite // key. The objectType and attributes are expected to have only valid utf8 // strings and should not contain U+0000 (nil byte) and U+10FFFF diff --git a/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/stub.go b/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/stub.go index 2553f2429e7..9f6cec3153b 100644 --- a/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/stub.go +++ b/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/stub.go @@ -634,6 +634,19 @@ func (s *ChaincodeStub) GetQueryResultWithPagination(query string, pageSize int3 return s.handleGetQueryResult(collection, query, metadata) } +// GetAllStatesCompositeKeyWithPagination ... +func (s *ChaincodeStub) GetAllStatesCompositeKeyWithPagination(pageSize int32, + bookmark string) (StateQueryIteratorInterface, *peer.QueryResponseMetadata, error) { + collection := "" + metadata, err := createQueryMetadata(pageSize, bookmark) + if err != nil { + return nil, nil, err + } + startKey := compositeKeyNamespace + endKey := compositeKeyNamespace + string(maxUnicodeRuneValue) + return s.handleGetStateByRange(collection, startKey, endKey, metadata) +} + // --------- Batch State functions ---------- // StartWriteBatch documentation can be found in interfaces.go @@ -676,7 +689,7 @@ func (iter *CommonIterator) HasNext() bool { return false } -// getResultsFromBytes deserializes QueryResult and return either a KV struct +// getResultFromBytes deserializes QueryResult and return either a KV struct // or KeyModification depending on the result type (i.e., state (range/execute) // query, history query). Note that queryResult is an empty golang // interface that can hold values of any type. diff --git a/vendor/modules.txt b/vendor/modules.txt index 8abe6a2b04c..fb61dab2104 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -216,7 +216,7 @@ github.com/hyperledger/fabric-amcl/amcl github.com/hyperledger/fabric-amcl/amcl/FP256BN github.com/hyperledger/fabric-amcl/core github.com/hyperledger/fabric-amcl/core/FP256BN -# github.com/hyperledger/fabric-chaincode-go/v2 v2.2.0 +# github.com/hyperledger/fabric-chaincode-go/v2 v2.3.0 ## explicit; go 1.22.0 github.com/hyperledger/fabric-chaincode-go/v2/pkg/statebased github.com/hyperledger/fabric-chaincode-go/v2/shim