Skip to content

Add decimals-consistency guard rejecting register_offering with mismatched token decimals #816

Description

@thlpkee20-wq

Description

When payment_token_decimals is provided at registration it must match the on-chain payment-token contract's decimals(). Reject mismatches with a structured error to prevent display corruption.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: src/lib.rs, docs/multi-offering-payment-token-independence.md
  • Guard must be robust to token contracts that revert on decimals()

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feat/decimals-consistency
  • Implement changes
    • Query token decimals via cross-contract call
    • Compare with declared value
    • Reject with DecimalsMismatch
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • cargo test --all
  • Cover edge cases
    • Token contract returning zero decimals and reverting decimals
  • Include test output and security notes

Example commit message

feat: guard against decimals mismatch on register

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions