Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Jan 10, 2025

This PR contains the following updates:

Package Type Update Change OpenSSF
github.com/hyperledger/fabric-contract-api-go require major v1.2.2v2.2.0 OpenSSF Scorecard

Release Notes

hyperledger/fabric-contract-api-go (github.com/hyperledger/fabric-contract-api-go)

v2.2.0

Compare Source

What's Changed

New Contributors

Full Changelog: hyperledger/fabric-contract-api-go@v2.1.0...v2.2.0

v2.1.0

Compare Source

What's Changed

Full Changelog: hyperledger/fabric-contract-api-go@v2.0.0...v2.1.0

v2.0.0

Compare Source

v2 Release Notes

The v2 release is functionally equivalent to the v1 release. The primary difference is the use of the current Go API for protocol buffers in place of the original (deprecated) API. The v2 implementation retains wire-level compatibility with Fabric but does include the following breaking changes:

  • Chaincode implementations that make direct use of github.com/hyperledger/fabric-protos-go will experience protocol buffer namespace conflicts (as described in https://protobuf.dev/reference/go/faq/). Any use of fabric-protos-go must be replaced by github.com/hyperledger/fabric-protos-go-apiv2.
  • In order to avoid an indirect dependency on fabric-protos-go, chaincode implementations that make use of github.com/hyperledger/fabric-chaincode-go must instead use github.com/hyperledger/fabric-chaincode-go/v2.

What's Changed

New Contributors

Full Changelog: hyperledger/fabric-contract-api-go@v1.2.2...v2.0.0


Configuration

📅 Schedule: Branch creation - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday ( * 0-4,22-23 * * 1-5 ), Only on Sunday and Saturday ( * * * * 0,6 ) (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 10, 2025

Reviewer's Guide by Sourcery

This PR updates the github.com/hyperledger/fabric-contract-api-go module from v1.2.2 to v2.2.0. This is a major version update that includes support for byte parameters and return types, struct arguments with optional fields, and updating the JSON schema spec from draft-04 to draft-07. Additionally, the update addresses GO-2024-2687 and utilizes the current Go API for protocol buffers. Note that this requires also updating the github.com/hyperledger/fabric-chaincode-go dependency to v2.

Class diagram showing updated API support in fabric-contract-api-go v2

classDiagram
    class ContractAPI {
        +HandleBytes[] byte
        +ReturnBytes() byte[]
    }

    class StructArgument {
        +OptionalField1 string
        +OptionalField2 int
    }

    note for ContractAPI "New support for byte[] parameters and return types"
    note for StructArgument "New support for structs with all optional fields"
Loading

File-Level Changes

Change Details Files
Updated the github.com/hyperledger/fabric-contract-api-go dependency to v2.2.0.
  • Changed the required version of github.com/hyperledger/fabric-contract-api-go from v1.2.2 to v2.2.0.
  • Added a new dependency to github.com/hyperledger/fabric-contract-api-go/v2 at version v2.2.0.
go.mod

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have skipped reviewing this pull request. It seems to have been created by a bot (hey, renovate[bot]!). We assume it knows what it's doing!

@renovate renovate bot force-pushed the renovate/github.com-hyperledger-fabric-contract-api-go-2.x branch from 6d82000 to 32fe259 Compare March 31, 2025 08:46
@renovate renovate bot force-pushed the renovate/github.com-hyperledger-fabric-contract-api-go-2.x branch 2 times, most recently from c56d7e1 to c53224b Compare August 13, 2025 13:24
@renovate renovate bot force-pushed the renovate/github.com-hyperledger-fabric-contract-api-go-2.x branch from c53224b to 82cfe56 Compare October 9, 2025 11:36
…-go to v2

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate bot force-pushed the renovate/github.com-hyperledger-fabric-contract-api-go-2.x branch from 82cfe56 to 56d87ee Compare December 15, 2025 15:40
require (
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230731094759-d626e9ab09b9
github.com/hyperledger/fabric-contract-api-go v1.2.2
github.com/hyperledger/fabric-contract-api-go/v2 v2.2.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The Go module was updated to v2 in go.mod, but the import paths in .go files were not updated with the required /v2 suffix, which will cause a build failure.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The go.mod file was updated to use version 2 of the fabric-contract-api-go dependency, but the import paths in the source code were not updated accordingly. Go's Semantic Import Versioning requires that for major versions v2 and above, the import path must include the version suffix (e.g., /v2). The current code imports from the v1 path (github.com/hyperledger/fabric-contract-api-go/contractapi) while the go.mod file specifies the v2 module. This mismatch will cause a build failure because the compiler cannot resolve the specified imports.

💡 Suggested Fix

Update the import paths in src/assetTransfer.go, src/chaincode/smartcontract.go, and src/chaincode/smartcontract_test.go from "github.com/hyperledger/fabric-contract-api-go/contractapi" to "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" to match the module version.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/go.mod#L9

Potential issue: The `go.mod` file was updated to use version 2 of the
`fabric-contract-api-go` dependency, but the import paths in the source code were not
updated accordingly. Go's Semantic Import Versioning requires that for major versions v2
and above, the import path must include the version suffix (e.g., `/v2`). The current
code imports from the v1 path
(`github.com/hyperledger/fabric-contract-api-go/contractapi`) while the `go.mod` file
specifies the v2 module. This mismatch will cause a build failure because the compiler
cannot resolve the specified imports.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7530241

Comment on lines +9 to 10
github.com/hyperledger/fabric-contract-api-go/v2 v2.2.0
github.com/hyperledger/fabric-contract-api-go/v2 v2.2.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The go.mod file has a duplicate require entry for the fabric-contract-api-go/v2 module. This makes the file malformed and can cause build tool failures.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The go.mod file contains a duplicate entry for the github.com/hyperledger/fabric-contract-api-go/v2 dependency. Having duplicate require entries for the same module makes the go.mod file malformed. This can lead to unpredictable behavior or outright failures when using Go toolchain commands like go build or go mod tidy, which expect a correctly structured dependency file. The change introduced a second identical line instead of modifying the existing one.

💡 Suggested Fix

Remove one of the duplicate lines for github.com/hyperledger/fabric-contract-api-go/v2 v2.2.0 from the go.mod file. Afterwards, run go mod tidy to ensure the file is correctly formatted and dependencies are consistent.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/go.mod#L9-L10

Potential issue: The `go.mod` file contains a duplicate entry for the
`github.com/hyperledger/fabric-contract-api-go/v2` dependency. Having duplicate
`require` entries for the same module makes the `go.mod` file malformed. This can lead
to unpredictable behavior or outright failures when using Go toolchain commands like `go
build` or `go mod tidy`, which expect a correctly structured dependency file. The change
introduced a second identical line instead of modifying the existing one.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7530241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant