Skip to content

Commit

Permalink
Merge branch 'hyperledger:main' into issue-4240
Browse files Browse the repository at this point in the history
  • Loading branch information
semil committed May 15, 2024
2 parents ab37f83 + 71cda03 commit 870b82c
Show file tree
Hide file tree
Showing 79 changed files with 682 additions and 382 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/broken-link-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ on:
env:
GO_VER: 1.21.9

permissions:
contents: read

jobs:
broken-lint-checker:
# Only run the scheduled job in hyperledger/fabric repository, not on personal forks
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'hyperledger/fabric')
name: "Check for Broken Links"
runs-on: fabric-ubuntu-latest
runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-20.04' || 'ubuntu-20.04' }}
steps:
- name: Checkout Fabric Code
uses: actions/checkout@v4
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ jobs:
CONTEXT: .
- COMPONENT: orderer
CONTEXT: .
- COMPONENT: tools
CONTEXT: .

steps:
- name: Set up QEMU
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

name: Scorecard supply-chain security
on:
workflow_dispatch:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '17 21 * * 3'
push:
branches: [ "main" ]

# Declare default permissions as read only.
permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write
# Uncomment the permissions below if installing in a private repository.
# contents: read
# actions: read

steps:
- name: "Checkout code"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecard on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
# repo_token: ${{ secrets.SCORECARD_TOKEN }}

# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories:
# - `publish_results` will always be set to `false`, regardless
# of the value entered here.
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
with:
sarif_file: results.sarif
4 changes: 3 additions & 1 deletion .github/workflows/vulnerability-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ permissions:

jobs:
scan:
runs-on: fabric-ubuntu-latest
# Only run the scheduled job in hyperledger/fabric repository, not on personal forks
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'hyperledger/fabric')
runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-20.04' || 'ubuntu-20.04' }}
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
# - publish-images - publishes release docker images to nexus3 or docker hub.
# - release-all - builds release packages for all target platforms
# - release - builds release packages for the host platform
# - tools-docker[-clean] - ensures the tools container is available[/cleaned]
# - unit-test-clean - cleans unit test state (particularly from docker)
# - unit-test - runs the go-test based unit tests
# - verify - runs unit tests for only the changed package tree
Expand Down Expand Up @@ -82,7 +81,7 @@ GO_VER = 1.21.9
GO_TAGS ?=

RELEASE_EXES = orderer $(TOOLS_EXES)
RELEASE_IMAGES = baseos ccenv orderer peer tools
RELEASE_IMAGES = baseos ccenv orderer peer
RELEASE_PLATFORMS = darwin-amd64 darwin-arm64 linux-amd64 linux-arm64 windows-amd64
TOOLS_EXES = configtxgen configtxlator cryptogen discover ledgerutil osnadmin peer

Expand Down Expand Up @@ -237,7 +236,6 @@ $(BUILD_DIR)/images/baseos/$(DUMMY): BUILD_CONTEXT=images/baseos
$(BUILD_DIR)/images/ccenv/$(DUMMY): BUILD_CONTEXT=images/ccenv
$(BUILD_DIR)/images/peer/$(DUMMY): BUILD_ARGS=--build-arg GO_TAGS=${GO_TAGS}
$(BUILD_DIR)/images/orderer/$(DUMMY): BUILD_ARGS=--build-arg GO_TAGS=${GO_TAGS}
$(BUILD_DIR)/images/tools/$(DUMMY): BUILD_ARGS=--build-arg GO_TAGS=${GO_TAGS}

$(BUILD_DIR)/images/%/$(DUMMY):
@echo "Building Docker image $(DOCKER_NS)/fabric-$*"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Hyperledger Fabric

[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/hyperledger/fabric/badge)](https://scorecard.dev/viewer/?uri=github.com/hyperledger/fabric)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/955/badge)](https://bestpractices.coreinfrastructure.org/projects/955)
[![Go Report Card](https://goreportcard.com/badge/github.com/hyperledger/fabric)](https://goreportcard.com/report/github.com/hyperledger/fabric)
[![GoDoc](https://godoc.org/github.com/hyperledger/fabric?status.svg)](https://godoc.org/github.com/hyperledger/fabric)
Expand Down
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ cd fabric-samples/test-network
export PATH=${PWD}/../bin:$PATH
export FABRIC_CFG_PATH=$PWD/../config/
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_LOCALMSPID=Org1MSP
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
export CORE_PEER_ADDRESS=localhost:7051
Expand Down
2 changes: 1 addition & 1 deletion ccaas_builder/cmd/build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func main() {

func run() error {
if len(os.Args) < 4 {
return fmt.Errorf("incorrect number of arguments")
return errors.New("incorrect number of arguments")
}

sourceDir, metadataDir, outputDir := os.Args[1], os.Args[2], os.Args[3]
Expand Down
2 changes: 1 addition & 1 deletion ccaas_builder/cmd/detect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type chaincodeMetadata struct {

func run() error {
if len(os.Args) < 3 {
return fmt.Errorf("too few arguments")
return errors.New("too few arguments")
}

chaincodeMetaData := os.Args[2]
Expand Down
3 changes: 2 additions & 1 deletion ccaas_builder/cmd/release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SPDX-License-Identifier: Apache-2.0
package main

import (
"errors"
"fmt"
"io"
"log"
Expand Down Expand Up @@ -48,7 +49,7 @@ func main() {

func run() error {
if len(os.Args) < 3 {
return fmt.Errorf("incorrect number of arguments")
return errors.New("incorrect number of arguments")
}

builderOutputDir, releaseDir := os.Args[1], os.Args[2]
Expand Down
2 changes: 1 addition & 1 deletion ci/scripts/setup_hsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ sudo mkdir -p /var/lib/softhsm/tokens
sudo softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 98765432
sudo chmod -R 777 /var/lib/softhsm
mkdir -p ~/.config/softhsm2
cp /usr/share/softhsm/softhsm2.conf ~/.config/softhsm2
cp /usr/share/softhsm/softhsm2.conf ~/.config/softhsm2
2 changes: 1 addition & 1 deletion common/deliverclient/blocksprovider/bft_deliverer.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (d *BFTDeliverer) FetchBlocks(source *orderers.Endpoint) {
// Starts a goroutine that receives blocks from the stream client and places them in the `recvC` channel
blockRcv.Start()

// Consume blocks fom the `recvC` channel
// Consume blocks from the `recvC` channel
if errProc := blockRcv.ProcessIncoming(d.onBlockProcessingSuccess); errProc != nil {
switch errProc.(type) {
case *ErrStopping:
Expand Down
13 changes: 6 additions & 7 deletions common/deliverclient/blocksprovider/bft_deliverer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1113,18 +1113,17 @@ func TestBFTDeliverer_CensorshipMonitorEvents(t *testing.T) {
setup.monErrC <- &blocksprovider.ErrCensorship{Message: fmt.Sprintf("censorship %d", n)}
}()

setup.gWithT.Eventually(
func() int {
setup.mutex.Lock()
defer setup.mutex.Unlock()
numMon := func() int {
setup.mutex.Lock()
defer setup.mutex.Unlock()

return len(setup.monitorSet)
}).Should(Equal(n + 1))
return len(setup.monitorSet)
}
setup.gWithT.Eventually(numMon, 10*time.Second, 10*time.Millisecond).Should(Equal(n + 1))

setup.gWithT.Eventually(setup.fakeDialer.DialCallCount).Should(Equal(n + 1))
setup.gWithT.Expect(setup.fakeSleeper.SleepCallCount()).To(Equal(n))
setup.gWithT.Eventually(setup.fakeCensorshipMonFactory.CreateCallCount).Should(Equal(n + 1))

}

t.Log("Exponential backoff after every round, with saturation")
Expand Down
Loading

0 comments on commit 870b82c

Please sign in to comment.