Skip to content

#95 Change split logic to return splits info only#100

Open
martti007 wants to merge 2 commits intov1from
issue-95-v1
Open

#95 Change split logic to return splits info only#100
martti007 wants to merge 2 commits intov1from
issue-95-v1

Conversation

@martti007
Copy link
Collaborator

No description provided.

@martti007 martti007 changed the title #95 Change split logic to return info splits only #95 Change split logic to return splits info only Feb 26, 2026
@martti007 martti007 requested review from MastaP and Copilot and removed request for MastaP March 2, 2026 08:29
@martti007 martti007 requested a review from MastaP March 2, 2026 08:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the token split flow so that the split operation returns split metadata (burn predicate/commitment + proofs) rather than mint commitments, and updates mint-reason verification to accept a RootTrustBase.

Changes:

  • Refactor split logic into TokenSplitBuilder.split(...) returning a TokenSplit containing burn predicate/commitment and per-new-token split proofs (plus serialization helpers).
  • Update IMintTransactionReason.verify(...) and mint transaction verification to pass trustBase, and strengthen SplitMintReason verification accordingly.
  • Update tests/docs and bump dev dependencies.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/token/CommonTestFlow.ts Updates split test flow to use TokenSplitBuilder.split(...) output (commitment + proofs) and then mint manually.
src/transaction/split/TokenSplitBuilder.ts Major split refactor: introduces exported TokenSplit, proof map wrappers, and JSON/CBOR serialization; exposes new static split(...) API.
src/transaction/TransferCommitment.ts Exports ITransferCommitmentJson for reuse in new split JSON types.
src/transaction/MintTransaction.ts Passes trustBase into mint-reason verification.
src/transaction/IMintTransactionReason.ts Updates mint-reason verification signature to accept RootTrustBase.
src/token/fungible/SplitMintReason.ts Updates verify(...) signature and adds token verification step using trustBase.
src/token/Token.ts Uses internal backing fields (_transactions, _nametagTokens) in verification/stringification paths.
package.json Dev dependency version bumps (eslint/tooling/testcontainers/etc.).
package-lock.json Lockfile updates corresponding to dev dependency bumps.
README.md Updates split example to match new TokenSplitBuilder.split(...) API and manual minting flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +151 to +156
export class TokenSplit {
public constructor(
private readonly token: Token<IMintTransactionReason>,
private readonly aggregationRoot: SparseMerkleTreeRootNode,
private readonly coinRoots: Map<string, SparseMerkleSumTreeRootNode>,
private readonly tokens: TokenRequest[],
public readonly predicate: BurnPredicate,
public readonly commitment: TransferCommitment,
public readonly proofs: ProofMap,
public readonly token: Token<IMintTransactionReason>,
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TokenSplit is exported but its public proofs property exposes the non-exported ProofMap type (and entries() returns non-exported ProofMapEntry). This leaks private types into the public API and makes the generated .d.ts harder to consume. Consider exporting these types or changing the public surface to standard types (e.g., ReadonlyMap<string, SplitMintReasonProof[]> / ReadonlyArray<...>) and keeping the internal wrappers private.

Copilot uses AI. Check for mistakes.
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.

Enhancement: Exclude Unicity Inclusion Proofs from Token Serialization in SplitMintReason

3 participants