-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/community-files'
- Loading branch information
Showing
9 changed files
with
260 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: "🐛 Bug" | ||
description: File a bug/issue | ||
title: "[BUG] <title>" | ||
labels: ["bug", "triage"] | ||
# projects: [] | ||
# assignees: [] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to fill out this bug report! | ||
Remember, contributions to this repository should follow its [contributing guidelines](../blob/develop/docs/CONTRIBUTING.md). | ||
- type: checkboxes | ||
attributes: | ||
label: Is there an existing issue for this? | ||
description: Please search to see if an issue already exists for the bug you encountered. | ||
options: | ||
- label: I have searched the existing issues | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Current Behavior | ||
description: A concise description of what you're experiencing. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Expected Behavior | ||
description: A concise description of what you expected to happen. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Steps To Reproduce | ||
description: Steps to reproduce the behavior. | ||
placeholder: | | ||
1. In this environment... | ||
1. With this config... | ||
1. Run '...' | ||
1. See error... | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Environment | ||
description: | | ||
examples: | ||
- **Packages**: @ckb-cobuild/[email protected] | ||
- **OS**: Ubuntu 20.04 | ||
- **Node**: v21.5.0 | ||
- **pnpm**: 8.6.12 | ||
value: | | ||
- **Packages**: | ||
- **OS**: | ||
- **Node**: | ||
- **pnpm**: | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Anything else? | ||
description: | | ||
Links? References? Anything that will give us more context about the issue you are encountering! | ||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blank_issues_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: "✨ Feature" | ||
description: Request a feature | ||
title: "[Feature] <title>" | ||
labels: ["feature", "triage"] | ||
# projects: [] | ||
# assignees: [] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to fill out this feature request! | ||
Remember, contributions to this repository should follow its [contributing guidelines](../blob/develop/docs/CONTRIBUTING.md). | ||
- type: checkboxes | ||
attributes: | ||
label: Is there an existing issue for this? | ||
description: Please search to see if an issue already exists for the feature you are requesting. | ||
options: | ||
- label: I have searched the existing issues | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Describe The Problem | ||
description: Please present a concise description of the problem to be addressed by this feature request. Please be clear what parts of the problem are considered to be in-scope and out-of-scope. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Suggest A Solution | ||
description: | | ||
A concise description of your preferred solution. If there are multiple solutions, please present each one separately. Save comparisons for the very end. | ||
placeholder: | | ||
Things to address include: | ||
- Details of the technical implementation | ||
- Tradeoffs made in design decisions | ||
- Caveats and considerations for the future | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Anything else? | ||
description: | | ||
Links? References? Anything that will give us more context about the feature you are requesting! | ||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. | ||
validations: | ||
required: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
build: | ||
name: Build and Test | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node: ["18", "lts/*", "latest"] | ||
run: | ||
- pnpm build | ||
- pnpm lint | ||
- pnpm test | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- uses: pnpm/[email protected] | ||
with: | ||
version: 8.6.12 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run Command | ||
run: ${{ matrix.run }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 ian | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Contributing Guidelines | ||
|
||
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: | ||
|
||
- Reporting a bug | ||
- Discussing the current state of the code | ||
- Submitting a fix | ||
- Proposing new features | ||
- Becoming a maintainer | ||
|
||
## We Develop with Github | ||
|
||
We use github to host code, to track issues and feature requests, as well as accept pull requests. | ||
|
||
## Pull Requests and [Changesets](https://github.com/changesets/changesets) | ||
|
||
Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests: | ||
|
||
1. Fork the repo and create your branch from `main`. | ||
2. If you've added code that should be tested, add tests. | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes. | ||
5. Make sure your code lints. | ||
6. Use a consistent coding style. Use prettier to format your code. | ||
7. Issue that pull request! | ||
|
||
## License | ||
|
||
By contributing, you agree that your contributions will be licensed under its MIT License. | ||
|
||
## Report bugs using Github's [issues](../../../issues) | ||
|
||
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](../../../issues/new/choose); it's that easy! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# PoC Review Guide | ||
|
||
Cobuild is still under active development. Please refer to [ckb-transaction-cobuild-poc](https://github.com/cryptape/ckb-transaction-cobuild-poc) for contract supports. | ||
|
||
The core principle of the PoC is how the CKB system DAO would look like if it supports Cobuild. | ||
|
||
The general workflow to build transactions in Cobuild: | ||
|
||
1. Create an empty **BuildingPacket** structure to initiate building a new transaction. | ||
2. (Type Script Phase) Users perform some operations often by submitting forms. For each operation: | ||
- a. Find the corresponding papp (name for dapp in Cobuid) and create an **Action**. | ||
- b. Let the papp process the **Action**. Update transaction in the **BuildingPacket** structure and add the **Action** as a message Action to `BuildingPacketV1.message.actions` | ||
3. (Fee Estimation Phase) Estimate witnesses size for fee calculation. | ||
- a. Ensure all message **Action**s have been completed. | ||
- b. (Optional) Remove message **Action**s that are experimental. For example, before DAO updates its contract, the DAO operations as message **Action**s are not validated. It's better to remove it to avoid inconsistent data. | ||
- c. For each lock script group: choose Cobuild or WitnessArgs layout and set the witness to enough size for fee estimation. | ||
- d. If there're witnesses are using `SighashAll` or `SighashAllOnly`. Set the first of such witnesses to `SighashAll` and put message **Action**s into it, and the remaining to `SighashAllOnly`. | ||
- e. If there's no such witnesses, and there's at least one message **Action**, add a `SighashAll` witness at a position beyond the number of inputs and save message **Action**s in it. | ||
- f. Estimate tx size and pay fee. If there are new cells added, ensure the witness size is correct for fee estimation. | ||
4. (Lock Script Phase) Prepare to finalize the transaction. For each lock script group: | ||
- a. Set witness for digest computation. | ||
- b. Compute the digest for the script group. | ||
- c. Connect wallet to create signatures from digests. | ||
- d. Store the signature into the witness. | ||
5. Finish, send the transaction to CKB. | ||
|
||
## Map Code To Steps | ||
|
||
The core is the step 2. There will be a framework to handle 1, 3, 4, 5, I just build a minimal framework to make the PoC work. | ||
|
||
1. `src/lib/cobuild/types.js`: Cobuild data structures definition. | ||
2. `src/lib/papps/dao`: DAO papp | ||
- a. | ||
- `src/lib/papps/dao/schema.js`: Action.data schema | ||
- `src/lib/papps/dao/action-creators.js`: Functions to create Action.data for DAO. | ||
- b. `src/lib/papps/dao/lumos-callbacks.js`: Build transactions based on DAO message actions. | ||
3. `src/lib/cobuild/fee-manager.js`: See the function `payFee` and `storeWitnessForFeeEstimation` | ||
4. `src/lib/cobuild/lock-actions.js`: See the function `prepareLockActions`. | ||
- a/b. `src/lib/cobuild/general-lock-actions.js`: See the function `prepareLockActionWithWitnessStore` | ||
- c. `src/lib/wallet/selector.js` acts as a gateway to connect different wallets and create signatures. | ||
- c. `src/lib/cobuild/general-lock-actions.js`: See the function `applyLockAction` | ||
5. `src/app/u/[wallet]/[connection]/submit-building-packet.js`: a simple UI to send tx and query its status. | ||
|
||
Remarks: | ||
|
||
- `src/lib/cobuild/react/building-packet-review.js`: UI to review the building packet for signing. |