Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cello CI
name: Integration Tests

on:
push:
Expand All @@ -24,7 +24,17 @@ jobs:

- name: Build Hyperledger Fabric Node
working-directory: src/nodes/hyperledger-fabric
run: docker build -t hyperledger/fabric:2.5.14 .
run: docker build -t hyperledger/fabric:2.5.15 .

- name: Run newman tests
working-directory: tests/postman
run: docker compose up --abort-on-container-exit

- name: Stop Hyperledger Fabric Chaincode
run: docker ps -q --filter "name=dev-peer0.org1.foo.com-basic_1.0" | xargs -r docker stop

- name: Stop Hyperledger Fabric Nodes
run: docker stop orderer0.foo.com peer0.org1.foo.com

- name: Stop Hyperledger Fabric Agent
run: docker stop cello-hyperledger-fabric-agent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code Check CI
name: Lint Check

on:
push:
Expand All @@ -12,21 +12,26 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Set up Nodejs
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions

- name: Install Nodejs dependencies
working-directory: src/dashboard
run: |
yarn install --frozen-lockfile

- name: Check code
run: make check
4 changes: 3 additions & 1 deletion src/agents/hyperledger-fabric/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM python:3.13

ENV FABRIC_VERSION=2.5.15

# Install software
RUN apt-get update\
&& apt-get autoclean\
Expand All @@ -18,7 +20,7 @@ RUN ARCH=$(dpkg --print-architecture) && \
amd64|arm64) FABRIC_ARCH="$ARCH" ;; \
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;; \
esac && \
curl -fsSL --retry 5 --retry-delay 3 "https://github.com/hyperledger/fabric/releases/download/v2.5.14/hyperledger-fabric-linux-${FABRIC_ARCH}-2.5.14.tar.gz" | tar xz -C ./cello/
curl -fsSL --retry 5 --retry-delay 3 "https://github.com/hyperledger/fabric/releases/download/v${FABRIC_VERSION}/hyperledger-fabric-linux-${FABRIC_ARCH}-${FABRIC_VERSION}.tar.gz" | tar xz -C ./cello/

# Install python dependencies
RUN pip3 install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion src/agents/hyperledger-fabric/chaincode/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def create(self, validated_data):

threading.Thread(
target=install_chaincode,
args=(fs.path(filename)),
args=(fs.path(filename),),
daemon=True).start()
return self

Expand Down
7 changes: 5 additions & 2 deletions src/agents/hyperledger-fabric/chaincode/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import os
import subprocess
import tarfile
import docker
import yaml
from typing import List, Optional, Dict, Any

from chaincode.enums import ChaincodeStatus
from hyperledger_fabric.settings import CELLO_HOME, CRYPTO_CONFIG, FABRIC_TOOL
from hyperledger_fabric.settings import CELLO_HOME, CRYPTO_CONFIG, FABRIC_TOOL, FABRIC_VERSION

LOG = logging.getLogger(__name__)

docker_client = docker.DockerClient("unix:///var/run/docker.sock")

def get_chaincode_status(
package_id: str,
Expand Down Expand Up @@ -280,6 +281,8 @@ def install_chaincode(file_path: str):
) as f:
crypto_config = yaml.safe_load(f)

docker_client.images.pull("hyperledger/fabric-ccenv", tag=FABRIC_VERSION.rsplit(".", 1)[0])

peer_organization_directory = os.path.join(
CELLO_HOME,
"peerOrganizations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
CELLO_HOME = os.path.join(BASE_DIR, "cello")
CRYPTO_CONFIG = os.path.join(CELLO_HOME, "crypto-config.yaml")
FABRIC_TOOL = os.path.join(CELLO_HOME, "bin")
FABRIC_VERSION = "2.5.14"
FABRIC_VERSION = "2.5.15"

LOGGING = {
"version": 1,
Expand Down
2 changes: 0 additions & 2 deletions src/agents/hyperledger-fabric/node/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from node.enums import NodeType

LOG = logging.getLogger(__name__)


docker_client = docker.DockerClient("unix:///var/run/docker.sock")

def get_node_status(node_type: str, name: str) -> str:
Expand Down
221 changes: 221 additions & 0 deletions src/api-engine/channel/migrations/0002_channel_invitation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
import common.utils
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("channel", "0001_initial"),
]

operations = [
migrations.CreateModel(
name="ChannelInvitation",
fields=[
(
"id",
models.UUIDField(
default=common.utils.make_uuid,
help_text="Channel Invitation ID",
primary_key=True,
serialize=False,
),
),
(
"status",
models.CharField(
choices=[
("DRAFT", "Draft"),
("SIGNING", "Signing"),
("READY", "Ready"),
("ACCEPTED", "Accepted"),
("REJECTED", "Rejected"),
("FAILED", "Failed"),
("CANCELED", "Canceled"),
],
default="DRAFT",
help_text="Channel invitation status",
max_length=32,
),
),
(
"artifact",
models.FileField(
blank=True,
help_text="Update Artifact",
null=True,
upload_to="channel_invitations/",
),
),
(
"artifact_hash",
models.CharField(
blank=True,
default="",
help_text="Artifact Hash",
max_length=64,
),
),
(
"required_signatures",
models.PositiveSmallIntegerField(
default=0,
help_text="Required Signatures",
),
),
(
"error_message",
models.TextField(
blank=True,
default="",
help_text="Error Message",
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True),
),
(
"updated_at",
models.DateTimeField(auto_now=True),
),
(
"channel",
models.ForeignKey(
help_text="Invitation Channel",
on_delete=django.db.models.deletion.CASCADE,
related_name="invitations",
to="channel.channel",
),
),
(
"creator_organization",
models.ForeignKey(
help_text="Creator Organization",
on_delete=django.db.models.deletion.CASCADE,
related_name="created_invitations",
to="organization.organization",
),
),
],
options={
"ordering": ("-created_at",),
},
),
migrations.CreateModel(
name="ChannelInvitationSignature",
fields=[
(
"id",
models.UUIDField(
default=common.utils.make_uuid,
help_text="Channel Invitation Signature ID",
primary_key=True,
serialize=False,
),
),
(
"artifact_hash",
models.CharField(
help_text="Artifact Hash",
max_length=64,
),
),
(
"signed_at",
models.DateTimeField(auto_now_add=True),
),
(
"invitation",
models.ForeignKey(
help_text="Invitation",
on_delete=django.db.models.deletion.CASCADE,
related_name="signatures",
to="channel.channelinvitation",
),
),
(
"organization",
models.ForeignKey(
help_text="Signing Organization",
on_delete=django.db.models.deletion.CASCADE,
related_name="invitation_signatures",
to="organization.organization",
),
),
],
options={
"ordering": ("signed_at",),
},
),
migrations.CreateModel(
name="ChannelInvitationInvitee",
fields=[
(
"id",
models.UUIDField(
default=common.utils.make_uuid,
help_text="Channel Invitation Invitee ID",
primary_key=True,
serialize=False,
),
),
(
"status",
models.CharField(
choices=[
("PENDING", "Pending"),
("ACCEPTED", "Accepted"),
("REJECTED", "Rejected"),
],
default="PENDING",
help_text="Invitee Status",
max_length=32,
),
),
(
"responded_at",
models.DateTimeField(
blank=True,
null=True,
),
),
(
"invitation",
models.ForeignKey(
help_text="Invitation",
on_delete=django.db.models.deletion.CASCADE,
related_name="invitees",
to="channel.channelinvitation",
),
),
(
"organization",
models.ForeignKey(
help_text="Invited Organization",
on_delete=django.db.models.deletion.CASCADE,
related_name="invitee_invitations",
to="organization.organization",
),
),
],
options={
"ordering": ("id",),
},
),
migrations.AddConstraint(
model_name="channelinvitationsignature",
constraint=models.UniqueConstraint(
fields=("invitation", "organization"),
name="unique_channel_invitation_signature",
),
),
migrations.AddConstraint(
model_name="channelinvitationinvitee",
constraint=models.UniqueConstraint(
fields=("invitation", "organization"),
name="unique_channel_invitation_invitee",
),
),
]
Loading