feat: add token behavior sealed trait, builder, and proto (16-type TDEG matrix)#118
feat: add token behavior sealed trait, builder, and proto (16-type TDEG matrix)#118ottobot-ai wants to merge 12 commits into
Conversation
356214b to
4ee7da5
Compare
29f2119 to
8b65e8b
Compare
* chore: add fork-specific CODEOWNERS and PR template * fix: don't pass --l0-token-identifier to ML0 ML0's run-genesis command doesn't accept --l0-token-identifier (it's a DL1/CL1 flag). The entrypoint was passing it to all metagraph layers (ml0|cl1|dl1 case), causing ML0 to print usage and exit immediately. Only pass the flag for CL1 and DL1.
Bumps [docker/login-action](https://github.com/docker/login-action) from 3 to 4. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](docker/login-action@v3...v4) --- updated-dependencies: - dependency-name: docker/login-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 5 to 6. - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](docker/metadata-action@v5...v6) --- updated-dependencies: - dependency-name: docker/metadata-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v4...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6 to 7. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v6...v7) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3 to 4. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](docker/setup-buildx-action@v3...v4) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
) PR scasplte2#136 removed --l0-token-identifier for all ML0 modes to fix the genesis crash, but ML0 run-validator REQUIRES it. Without it, validator nodes fail with 'Missing expected flag --l0-token-identifier'. Fix: only skip the flag for ML0 run-genesis mode. All other metagraph modes (ML0 run-validator/run-rollback, CL1, DL1) continue to receive it.
…asplte2#135) * chore: remove vestigial proto module, add SDK compatibility tests Rebased onto latest upstream/main (v0.7.11). Resolves merge conflict caused by upstream modifications to messages.proto — since the entire proto module is being removed, the modified file is deleted as intended. No functional change from original PR scasplte2#135; the proto module had zero .dependsOn() references and the ScalaPB codegen was never used at runtime. Co-authored-by: OttoBot <ottobot@kd5ujc.xyz> * fix: correct SdkCompatibilitySuite JSON fixtures StateId serializes as plain string 'idle', not {'value': 'idle'}. Updated test fixtures and assertions to match actual codec behavior. * chore: trigger CI
Implements the 16-type token behavior system using a 4-boolean TDEG matrix. ## Deliverables - TokenBehavior sealed trait with 16 case objects (modules/models/) - TokenBehaviorBuilder.toStateMachineDefinition(behavior) factory - TokenBehavior.isOperationAllowed(behavior, op) legality API - TokenOperation enum (8 operations) - token.proto with TokenBehaviorType + TokenOperationType enums - 58 TDD tests — all passing ## Key Design - 4-bit encoding: T=Transferable(8), D=Divisible(4), E=Expirable(2), G=Governable(1) - States: ACTIVE (initial), BURNED (terminal), EXPIRED (terminal, E=1 only) - Expiry guard uses sequenceNumber (fixes TypeScript $ordinal latent bug, AC4) - Cross-language equivalence with TypeScript SDK PR scasplte2#45 ## References - Trello: https://trello.com/c/6996301447b41cda59369256 - Spec: scasplte2#114 - TypeScript reference: ottobot-ai/ottochain-sdk PR scasplte2#45 Co-authored-by: OttoWork <ottobot@kd5ujc.xyz>
d9f387e to
f82b7ff
Compare
f82b7ff to
d9f387e
Compare
|
PR size: 1,764 lines (too large for automated conflict resolution) @scasplte2 — please rebase manually when ready. |
|
Closing in favor of the asset-model RFC ( This PR's 4-bit TDEG / 16-type Salvage into RFC task #1 (TokenBehavior + AssetPolicy types): the |
Summary
Implements the complete 16-type token behavior system using a 4-boolean TDEG matrix in Scala, achieving cross-language equivalence with the TypeScript SDK (PR #45).
Trello Card
🎲 SDK: 16-type token behavior matrix implementation
Deliverables
TokenBehavior— Sealed trait with 16 case objects (TDEG model) inmodules/models/TokenBehaviorBuilder.toStateMachineDefinition(behavior)— Factory producingStateMachineDefinitionTokenBehavior.isOperationAllowed(behavior, op): Boolean— Operation legality APITokenOperation— Enumeratum enum for 8 operation typestoken.proto— New domain proto underottochain/v1/withTokenBehaviorType+TokenOperationTypeenumsTokenBehaviorSuite— 58 TDD tests, all passingKey Design Decisions
modules/models/StateMachineDefinition; pure data, no IOtoken.protosequenceNumber$ordinallatent bug (defaults to 0 in JLVM)4-bit TDEG Encoding
16 named presets: SOULBOUND_RECEIPT(0) → GOVERNED_EXPIRABLE_FUNGIBLE(15)
Test Coverage (58 tests, all passing)
isTransferable,isDivisible,fromFlags, etc.StateMachineDefinitionwith correct statesStateIdwrappers, metadata fields, guardsnft,fungibleToken,stablecoin,license,soulboundBadgeReferences
ottobot-ai/ottochain-sdkPR fix: relax L1 sequence validation to >= for batching support #45 (84 tests)dfa-json-logic-patterns.md§11Implemented by @work (OttoBot) | 2026-02-26