Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
174de12
test
bonnie57 Jul 16, 2025
0c22725
xx
bonnie57 Jul 16, 2025
b69ca92
fix: correct typo in Group Module description in README.md
bonnie57 Jul 16, 2025
dc5ecbb
chore: update workflow reference for unit tests in pr-internal.yml
bonnie57 Jul 16, 2025
bba3cb9
chore: remove reusable build and test workflow file
bonnie57 Jul 16, 2025
9bb4f5c
chore: update .gitignore to include mocha report and ensure cursor fi…
bonnie57 Jul 16, 2025
daf1f92
chore: update .gitignore to ensure mocha report directory is correctl…
bonnie57 Jul 16, 2025
2c8bc5b
chore: refine .gitignore to clarify mocha report directory exclusion
bonnie57 Jul 16, 2025
4f6bb16
chore: update .gitignore to add .vscode directory and refine mocha re…
bonnie57 Jul 16, 2025
18ed212
chore: update .prettierignore and eslint config to exclude mochawesom…
bonnie57 Jul 16, 2025
0669bac
chore: add integration test report upload and deployment step to reus…
bonnie57 Jul 17, 2025
363dc72
chore: enhance reusable build workflow with publish branch and file r…
bonnie57 Jul 17, 2025
3eab11c
chore: update GitHub Actions workflow to use version tag for gh-pages…
bonnie57 Jul 17, 2025
bc69c60
chore: simplify publish directory path in GitHub Actions workflow
bonnie57 Jul 17, 2025
d276764
chore: adjust publish directory path for consistency in GitHub Action…
bonnie57 Jul 17, 2025
d68cf58
chore: further simplify publish directory path in GitHub Actions work…
bonnie57 Jul 17, 2025
6d552c2
chore: update publish directory path in GitHub Actions workflow to po…
bonnie57 Jul 17, 2025
cd3078b
test: enable only the raiseDispute and counter dispute test suite and…
bonnie57 Jul 17, 2025
11324ec
test: remove unused disputeId variable from raiseDispute test for cla…
bonnie57 Jul 17, 2025
f59216e
chore: update GitHub Actions workflow to change to mochawesome direct…
bonnie57 Jul 17, 2025
2aa40f4
chore: remove unnecessary directory change step and update deployment…
bonnie57 Jul 17, 2025
07fcdd2
chore: update publish directory in GitHub Actions workflow to include…
bonnie57 Jul 17, 2025
505882d
chore: modify publish directory pattern in GitHub Actions workflow to…
bonnie57 Jul 17, 2025
7bf34c1
chore: add directory listing step before deployment in GitHub Actions…
bonnie57 Jul 17, 2025
5dc406b
chore: enhance GitHub Actions workflow by adding publish branch and k…
bonnie57 Jul 17, 2025
c6ebcc1
chore: refine directory listing step in GitHub Actions workflow to in…
bonnie57 Jul 17, 2025
324617f
chore: adjust directory change in GitHub Actions workflow to target m…
bonnie57 Jul 17, 2025
a565704
chore: update integration test command in core-sdk package.json to in…
bonnie57 Jul 17, 2025
2f0b872
chore: simplify integration test command in core-sdk package.json by …
bonnie57 Jul 17, 2025
c82e7de
chore: add build step to GitHub Actions workflow and update integrati…
bonnie57 Jul 21, 2025
db0959d
chore: add GitHub Page link to workflow summary and update integratio…
bonnie57 Jul 21, 2025
8ed5a2f
chore: add timestamp step to GitHub Actions workflow and update integ…
bonnie57 Jul 21, 2025
75d4e4a
chore: remove timestamp step from GitHub Actions workflow and clean u…
bonnie57 Jul 21, 2025
cb0c41a
chore: update GitHub Actions workflow to include TIMESTAMP input for …
bonnie57 Jul 21, 2025
6673b92
fix: correct TIMESTAMP output reference in GitHub Actions workflow
bonnie57 Jul 21, 2025
5b95c0c
chore: update GitHub Actions workflow to use environment variable for…
bonnie57 Jul 21, 2025
4b08e5f
Update resuable-create-release.yaml for action version due to warning
bonnie57 Jul 21, 2025
4cb062a
Update resuable-create-release.yaml for action version due to warning
bonnie57 Jul 21, 2025
aa1d176
Update resuable-create-release.yaml for action version due to warning
bonnie57 Jul 21, 2025
0e13f7e
Update resuable-create-release.yaml for action version due to warning
bonnie57 Jul 21, 2025
d85663a
Update resuable-create-release.yaml for action version due to warning
bonnie57 Jul 21, 2025
7693272
Update resuable-create-release.yaml for action version due to warning
bonnie57 Jul 21, 2025
b49360c
Update resuable-create-release.yaml for action version due to warning
bonnie57 Jul 21, 2025
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
14 changes: 2 additions & 12 deletions .github/workflows/pr-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,11 @@ jobs:

unit_tests:
needs: [Timestamp]
uses: storyprotocol/gha-workflows/.github/workflows/reusable-build-unit-test-workflow.yml@main
uses: ./.github/workflows/reusable-build-test-workflow.yml
with:
sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
ENVIRONMENT: "odyssey"
secrets:
WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }}
TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }}

integration_tests:
if: github.event_name == 'pull_request'
needs: [Timestamp]
uses: storyprotocol/gha-workflows/.github/workflows/reusable-build-integration-test-workflow.yml@main
with:
sha: ${{ github.event.pull_request.head.sha }}
ENVIRONMENT: "odyssey"
secrets:
WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }}
TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }}
TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }}
88 changes: 88 additions & 0 deletions .github/workflows/reusable-build-test-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build and Test

on:
workflow_call:
inputs:
sha:
required: true
type: string
ENVIRONMENT:
required: true
type: string

secrets:
WALLET_PRIVATE_KEY:
required: true
TEST_WALLET_ADDRESS:
required: true

jobs:
build_and_test:
name: Build and Test
timeout-minutes: 60
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT }}
strategy:
fail-fast: false
matrix:
node-version: [20.0.0]
env:
WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }}
TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }}

steps:
- name: Set Timestamp
run: |
echo "TIMESTAMP=$(date +%Y%m%d)" >> $GITHUB_ENV

- name: Check out code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
ref: ${{ inputs.sha }}

- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 8

- name: Setup Node.js environment
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Fix
run: pnpm fix

- name: Test
run: pnpm test

- name: Build
run: pnpm build

- name: Rename Report
run: |
mv -f packages/core-sdk/mochawesome-report packages/core-sdk/mochawesome-report-${{ env.TIMESTAMP }}
mv -f packages/core-sdk/mochawesome-report-${{ env.TIMESTAMP }}/mochawesome.html packages/core-sdk/mochawesome-report-${{ env.TIMESTAMP }}/mochawesome-${{ env.TIMESTAMP }}.html

- name: Integration Test Report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: integration-test-report-${{ env.TIMESTAMP }}
path: packages/core-sdk/mochawesome-report-${{ env.TIMESTAMP }}

- name: Deploy
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e #v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: packages/core-sdk/mochawesome-report-${{ env.TIMESTAMP }}
keep_files: true

- name: Add Github Page Link to Summary
run: |
repo_name=$(echo "${{ github.repository }}" | cut -d'/' -f2)
github_pages_url="https://${{ github.repository_owner }}.github.io/${repo_name}/mochawesome-${{ env.TIMESTAMP }}.html"
echo "## 📊Github Page Link: [View Test Report](${github_pages_url})" >> $GITHUB_STEP_SUMMARY
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.idea
.vscode

# dependencies
node_modules
Expand Down Expand Up @@ -40,4 +41,7 @@ yarn-error.log*
.vercel

# cursor
.cursor
.cursor

# mocha test report
/packages/core-sdk/mochawesome-report/
5 changes: 4 additions & 1 deletion packages/core-sdk/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
dist
dist
mochawesome-report


2 changes: 1 addition & 1 deletion packages/core-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Key Features:
- License Module: Create customizable license terms, attach them to IP assets, and mint transferable license tokens
- Royalty Module: Claim royalties, and manage payment distributions
- Dispute Module: Initiate, manage and resolve IP-related disputes through on-chain governance
- Group Module: Create IP collections with shared revenue pools
- Group Module: Create IP collections 1111with shared revenue pools
- WIP Module: Wrap native IP into ERC-20 tokens for DeFi integrations
- NFT Client Module: Mint a new SPG collection for use with Story Protocol.

Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export default [
...config,
//TODO: need to fix `e` which is not being used in generated files
{
ignores: ["./src/abi/generated.ts"],
ignores: ["./src/abi/generated.ts", "./mochawesome-report", "./dist"],
},
];
5 changes: 3 additions & 2 deletions packages/core-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
],
"scripts": {
"build": "pnpm run fix && preconstruct build",
"test": "pnpm run test:unit",
"test": "pnpm run test:unit && pnpm run test:integration",
"test:unit": "TS_NODE_PROJECT='./tsconfig.test.json' c8 --all --src ./src mocha -r ts-node/register './test/unit/**/*.test.ts' --require ./test/unit/hooks.ts",
"test:integration": "TS_NODE_PROJECT='./tsconfig.test.json' mocha -r ts-node/register './test/integration/**/*.test.ts' --timeout 300000",
"test:integration": "TS_NODE_PROJECT='./tsconfig.test.json' mocha -r ts-node/register './test/integration/**/*.test.ts' --timeout 300000 --reporter mochawesome",
"fix": "pnpm run format:fix && pnpm run lint:fix",
"format": "prettier --check .",
"format:fix": "prettier --write .",
Expand Down Expand Up @@ -57,6 +57,7 @@
"eslint": "^9.26.0",
"globals": "^16.0.0",
"mocha": "^10.2.0",
"mochawesome": "^7.1.3",
"prettier": "^2.8.8",
"sinon": "^16.0.0",
"ts-node": "^10.9.1",
Expand Down
146 changes: 72 additions & 74 deletions packages/core-sdk/test/integration/dispute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ describe("Dispute Functions", () => {
).ipId!;
});

describe("raiseDispute and counter dispute", () => {
let disputeId: bigint;
describe.only("raiseDispute and counter dispute", () => {
it("should raise a dispute", async () => {
const raiseDisputeRequest: RaiseDisputeRequest = {
targetIpId: ipIdB,
Expand All @@ -84,80 +83,79 @@ describe("Dispute Functions", () => {

expect(response.txHash).to.be.a("string");
expect(response.disputeId).to.be.a("bigint");
disputeId = response.disputeId!;
});

it("should validate all enum values defined in DisputeTargetTag", async () => {
const allTags = Object.values(DisputeTargetTag);

for (const tag of allTags) {
const tagHex: Hex = toHex(tag, { size: 32 });
const { allowed } = await clientA.dispute.disputeModuleClient.isWhitelistedDisputeTag({
tag: tagHex,
});
if (tag === DisputeTargetTag.IN_DISPUTE) {
expect(allowed).equal(false);
} else {
expect(allowed).equal(true);
}
}
});

it("should raise disputes with different DisputeTargetTag enum values", async () => {
const allTags = Object.values(DisputeTargetTag);

for (const tag of allTags) {
const raiseDisputeRequest: RaiseDisputeRequest = {
targetIpId: ipIdB,
cid: await generateCID(),
targetTag: tag,
liveness: 2592000,
bond: minimumBond,
};

if (tag === DisputeTargetTag.IN_DISPUTE) {
await expect(clientA.dispute.raiseDispute(raiseDisputeRequest)).to.be.rejectedWith(
"The target tag IN_DISPUTE is not whitelisted",
);
} else {
const response = await clientA.dispute.raiseDispute(raiseDisputeRequest);
expect(response.txHash).to.be.a("string");
expect(response.disputeId).to.be.a("bigint");
}
}
});

it("should reject a dispute with an invalid tag not defined in the enum", async () => {
await expect(
clientA.dispute.raiseDispute({
targetIpId: ipIdB,
cid: await generateCID(),
targetTag: "INVALID_TAG" as DisputeTargetTag,
liveness: 2592000,
bond: minimumBond,
}),
).to.be.rejectedWith("The target tag INVALID_TAG is not whitelisted");
});

it("should be able to counter existing dispute once", async () => {
const assertionId = await clientB.dispute.disputeIdToAssertionId(disputeId!);
const counterEvidenceCID = await generateCID();
const ret = await clientB.dispute.disputeAssertion({
ipId: ipIdB,
assertionId,
counterEvidenceCID,
});
expect(ret.txHash).to.be.a("string");

// should throw error if attempting to dispute assertion again
await expect(
clientB.dispute.disputeAssertion({
ipId: ipIdB,
assertionId,
counterEvidenceCID,
}),
).to.be.rejected;
});
// it("should validate all enum values defined in DisputeTargetTag", async () => {
// const allTags = Object.values(DisputeTargetTag);

// for (const tag of allTags) {
// const tagHex: Hex = toHex(tag, { size: 32 });
// const { allowed } = await clientA.dispute.disputeModuleClient.isWhitelistedDisputeTag({
// tag: tagHex,
// });
// if (tag === DisputeTargetTag.IN_DISPUTE) {
// expect(allowed).equal(false);
// } else {
// expect(allowed).equal(true);
// }
// }
// });

// it("should raise disputes with different DisputeTargetTag enum values", async () => {
// const allTags = Object.values(DisputeTargetTag);

// for (const tag of allTags) {
// const raiseDisputeRequest: RaiseDisputeRequest = {
// targetIpId: ipIdB,
// cid: await generateCID(),
// targetTag: tag,
// liveness: 2592000,
// bond: minimumBond,
// };

// if (tag === DisputeTargetTag.IN_DISPUTE) {
// await expect(clientA.dispute.raiseDispute(raiseDisputeRequest)).to.be.rejectedWith(
// "The target tag IN_DISPUTE is not whitelisted",
// );
// } else {
// const response = await clientA.dispute.raiseDispute(raiseDisputeRequest);
// expect(response.txHash).to.be.a("string");
// expect(response.disputeId).to.be.a("bigint");
// }
// }
// });

// it("should reject a dispute with an invalid tag not defined in the enum", async () => {
// await expect(
// clientA.dispute.raiseDispute({
// targetIpId: ipIdB,
// cid: await generateCID(),
// targetTag: "INVALID_TAG" as DisputeTargetTag,
// liveness: 2592000,
// bond: minimumBond,
// }),
// ).to.be.rejectedWith("The target tag INVALID_TAG is not whitelisted");
// });

// it("should be able to counter existing dispute once", async () => {
// const assertionId = await clientB.dispute.disputeIdToAssertionId(disputeId!);
// const counterEvidenceCID = await generateCID();
// const ret = await clientB.dispute.disputeAssertion({
// ipId: ipIdB,
// assertionId,
// counterEvidenceCID,
// });
// expect(ret.txHash).to.be.a("string");

// // should throw error if attempting to dispute assertion again
// await expect(
// clientB.dispute.disputeAssertion({
// ipId: ipIdB,
// assertionId,
// counterEvidenceCID,
// }),
// ).to.be.rejected;
// });
});

it("it should not cancel a dispute (yet)", async () => {
Expand Down
Loading