Skip to content

Conversation

@dodo920306
Copy link
Contributor

Let's face it: the current state of this project’s code is not so good.

Contributions over time have lacked consistency, leading to duplicated implementations and a fragmented structure that makes maintenance and development difficult.

The combination of Python, Django, and object-oriented design has introduced unnecessary complexity, and without long-term technical stewardship, the project has become hard to extend.

Another pressing issue is the number of long-standing bugs. For a project that has been in existence for over six years, there remain issues that ideally should have been addressed very early on. Many of these are not superficial problems that tools or automated testing could easily detect, but deeper logical flaws that only become evident when the affected code paths are used.

Additionally, it seems that the project has not fully embraced the design principles of Django REST Framework (DRF). For example, serializers are often used only for traffic handling, while much of the core business logic resides in views.py, which goes against DRF’s intended design practices.

To summary, a refactor is inevitable, and to make sure I’m not just another person who criticizes without acting, I’ll do it myself.

@dodo920306 dodo920306 closed this Aug 29, 2025
@dodo920306 dodo920306 deleted the task/the-refactoring branch August 29, 2025 11:22
@dodo920306 dodo920306 restored the task/the-refactoring branch August 29, 2025 11:22
@dodo920306 dodo920306 reopened this Aug 29, 2025
@dodo920306 dodo920306 force-pushed the task/the-refactoring branch from b2553e7 to 4a3123e Compare October 6, 2025 07:52
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: KIRIN.CHU 朱祐麟 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
I encountered an issue after upgrading my Docker engine to version 29,
and it seems to be caused by hyperledger/fabric#5350.
Thus, I upgrade Hyperledger Fabric to 2.5.14 and go to 1.25.5 before I
realized that the merge fix PR hyperledger/fabric#5355
hasn't been included in a Hyperledger Fabric release yet. Although I ended
up downgrading my Docker engine to version 28, still, I commit my
changes to these dependencies anyway.

Signed-off-by: dodo920306 <[email protected]>
Chaincode installation can take a really long while.
It often causes the client gateway timeout. Chaincode
installation now uses another thread to wait for the
peer command to response as it did before the refactor.

Signed-off-by: dodo920306 <[email protected]>
@dodo920306
Copy link
Contributor Author

dodo920306 commented Jan 3, 2026

With the first interaction with a chaincode via Hyperledger Cello done on my PC, I hereby proudly announce that now Hyperledger Cello API Engine has the very basic ability to interact with chaincodes after a1f9e92 🥳!

This definitely took a lot longer than expected, and the functionality is definitely not mature enough now ---- it is currently inaccessible via dashboard.

螢幕快照 2026-01-03 20-30-06

@yeasy

@dodo920306
Copy link
Contributor Author

dodo920306 commented Jan 3, 2026

Update for this PR:

After several meetings and discussions, I officially retract some of my comments in #735 (comment) and acknowledge that agents do indeed have their necessity.

However, I also raised my concerns during the meetings — namely, that the logic for interacting with blockchain nodes on the main branch is almost entirely concentrated in the api-engine. The agent, acting as a proxy within each organization's cluster, still relies on the api-engine — which exists independently of all clusters — to perform operations. This greatly reduces the necessity of installing agents in each cluster, and also calls for a rethinking of the network layer design.

Subsequently, @yeasy proposed moving all current blockchain interaction logic into the agent, allowing the agent to handle all operations. This also aligns with the original intention of Hyperledger Cello: to move blockchain-specific operations into agents, enabling users to support various blockchain projects simply by swapping agents. Fortunately, after this refactoring, user request handling is decoupled from business logic to the maximum extent (i.e., a view-service layered design). This makes it relatively easier to extract service logic and insert it into a standalone agent project compared to the main branch, so implementing a new agent might be easier than explained during the meetings.

In any case, reintegrating the decoupled agent will be the next and final stage of this refactoring. Hopefully, this process will go more smoothly this time.

A new version of Hyperledger Fabric Docker Agent
has been added to the repo. It has been finished
yet. It's written in Python 3.13.7, a version a
lot newer than the api-engine, and adopts the
latest version of Django (6.0). Also, it uses
`drf_spectacular` instead of `drf_yasg` to
generate OpenAPI 3.0 schemas. In any respect,
it's a fully upgraded version of the old agent.
It now supports to create organization crypto
materials via Hyperledger Fabric cryptogen.

Signed-off-by: dodo920306 <[email protected]>
@dodo920306 dodo920306 force-pushed the task/the-refactoring branch from edeabb0 to eb936ad Compare January 4, 2026 15:47
@yeasy
Copy link
Contributor

yeasy commented Jan 13, 2026

And as we discussed, the new model can be pushed a a new branch such as refactor.

@dodo920306
Copy link
Contributor Author

And as we discussed, the new model can be pushed a a new branch such as refactor.

Yeah. So I did.

@dodo920306 dodo920306 marked this pull request as draft January 17, 2026 07:03
These values can be retrieved from files dynamically
whenever they're wanted. They shouldn't be stored
as DB columns.

Signed-off-by: dodo920306 <[email protected]>
They're not necessary.

Signed-off-by: dodo920306 <[email protected]>
Node types are parsed as strings rather than enums.

Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Use 'w' instead of 'r+' to overwrite files instead of
just appending contents.

Signed-off-by: dodo920306 <[email protected]>
Package MSP and TLS crypto materials into their
own directories respectively.

Signed-off-by: dodo920306 <[email protected]>
Save TLS certificates in the DB so that they can
be accessed by other organizations in the future.

Signed-off-by: dodo920306 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants