Skip to content

Commit

Permalink
Move v2 implementation to repository root
Browse files Browse the repository at this point in the history
If any further v1 releases are required, they will be made from a
maintenance branch taken from the previous commit.

Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
  • Loading branch information
bestbeforetoday authored and denyeart committed Jul 22, 2024
1 parent eb409ab commit 9dc3120
Show file tree
Hide file tree
Showing 118 changed files with 253 additions and 14,662 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "gomod"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: weekly
7 changes: 2 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@ jobs:
checks:
uses: ./.github/workflows/check.yml

test-v1:
uses: ./.github/workflows/test-v1.yml

test-v2:
uses: ./.github/workflows/test-v2.yml
test:
uses: ./.github/workflows/test.yml
73 changes: 0 additions & 73 deletions .github/workflows/test-v1.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/test-v2.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright the Hyperledger Fabric contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: Test (v2)
name: Test

on:
workflow_call:
Expand All @@ -21,7 +21,6 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
version: latest
working-directory: v2

unit_test:
name: Unit test
Expand All @@ -44,7 +43,7 @@ jobs:
go-version: "1.21"
- name: Run functional tests
run: make functional-test

integration_test:
name: Integration test
runs-on: ubuntu-22.04
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/vulnerability-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@ on:
workflow_dispatch:

jobs:
v1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true
- name: Scan
run: make -f Makefile.v1 scan

v2:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright the Hyperledger Fabric contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

base_dir := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))/v2
base_dir := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
functional_dir := $(base_dir)/internal/functionaltests
go_bin_dir := $(shell go env GOPATH)/bin

Expand Down
42 changes: 0 additions & 42 deletions Makefile.v1

This file was deleted.

2 changes: 1 addition & 1 deletion contractapi/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package contractapi

import "github.com/hyperledger/fabric-contract-api-go/metadata"
import "github.com/hyperledger/fabric-contract-api-go/v2/metadata"

// IgnoreContractInterface extends ContractInterface and provides additional functionality
// that can be used to mark which functions should not be accessible by invoking/querying
Expand Down
23 changes: 14 additions & 9 deletions contractapi/contract_chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@ import (
"strings"
"unicode"

"github.com/hyperledger/fabric-chaincode-go/pkg/cid"
"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-contract-api-go/internal"
"github.com/hyperledger/fabric-contract-api-go/internal/utils"
"github.com/hyperledger/fabric-contract-api-go/metadata"
"github.com/hyperledger/fabric-contract-api-go/serializer"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-chaincode-go/v2/pkg/cid"
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
"github.com/hyperledger/fabric-contract-api-go/v2/internal"
"github.com/hyperledger/fabric-contract-api-go/v2/internal/utils"
"github.com/hyperledger/fabric-contract-api-go/v2/metadata"
"github.com/hyperledger/fabric-contract-api-go/v2/serializer"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
)

//lint:ignore U1000 used for testing
type chaincodeStubInterface interface {
shim.ChaincodeStubInterface
}

type contractChaincodeContract struct {
info metadata.InfoMetadata
functions map[string]*internal.ContractFunction
Expand Down Expand Up @@ -121,7 +126,7 @@ func (cc *ContractChaincode) Start() error {
// Init is called during Instantiate transaction after the chaincode container
// has been established for the first time, passes off details of the request to Invoke
// for handling the request if a function name is passed, otherwise returns shim.Success
func (cc *ContractChaincode) Init(stub shim.ChaincodeStubInterface) peer.Response {
func (cc *ContractChaincode) Init(stub shim.ChaincodeStubInterface) *peer.Response {
nsFcn, _ := stub.GetFunctionAndParameters()
if nsFcn == "" {
return shim.Success([]byte("Default initiator successful."))
Expand Down Expand Up @@ -149,7 +154,7 @@ func (cc *ContractChaincode) Init(stub shim.ChaincodeStubInterface) peer.Respons
// function handler returns a non-error type then then the after transaction is sent this value. The same
// transaction context is passed as a pointer to before, after, named and unknown functions on each Invoke.
// If no contract name is passed then the default contract is used.
func (cc *ContractChaincode) Invoke(stub shim.ChaincodeStubInterface) peer.Response {
func (cc *ContractChaincode) Invoke(stub shim.ChaincodeStubInterface) *peer.Response {

nsFcn, params := stub.GetFunctionAndParameters()

Expand Down
Loading

0 comments on commit 9dc3120

Please sign in to comment.