Skip to content

Michelson parser/AST in go #191

@jevonearth

Description

@jevonearth

Summary

Implement a Michelson parser/AST in Go to enable rich policy rules for smart contract calls. This would allow Signatory to inspect transaction parameters and enforce granular policies beyond simple operation type filtering.

Use Cases

1. Entrypoint Allowlist

Only allow calls to specific contract entrypoints:

allow:
  generic:
    - transaction:
        entrypoints: [stake, unstake, claim]

2. Entrypoint Blocklist

Block dangerous entrypoints while allowing others:

deny:
  generic:
    - transaction:
        entrypoints: [withdraw_all, emergency_exit]

3. Parameter Constraints

Limit values in transaction parameters:

allow:
  generic:
    - transaction:
        entrypoint: transfer
        constraints:
          - path: $.amount
            max: 10000000000  # max 10k tez

4. Destination + Entrypoint Combinations

allow:
  generic:
    - transaction:
        destination: KT1StakingContract...
        entrypoints: [stake, unstake]
    - transaction:
        destination: KT1GovernanceContract...
        entrypoints: [vote, propose]

Technical Approach

  1. Parse Michelson parameters from transaction operations
  2. Build AST representation of the parameter data
  3. Implement JSONPath-like query language for policy rules
  4. Integrate with existing policy engine

Related Issues

Notes

This is a significant undertaking but would enable enterprise-grade policy control for institutional users managing treasury keys, staking operations, or DeFi interactions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    low-priorityNice to have, not urgent

    Projects

    Status

    Planning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions