Skip to content

Security: signals-protocol/signals-contract

Security

docs/SECURITY.md

RangeBet Security Documentation

This document describes the security considerations, risk model, and vulnerability reporting procedures for the RangeBet protocol.

Table of Contents

  1. Security Model
  2. Potential Risks
  3. Mitigation Strategies
  4. Code Audits
  5. Security Vulnerability Reporting
  6. Bug Bounty Program
  7. Emergency Plan

Security Model

The RangeBet protocol follows these core security principles:

  1. Principle of Least Privilege: Each contract and function has only the minimum permissions necessary to perform its task.
  2. Principle of Isolation: Each market operates independently, preventing vulnerabilities in one market from affecting others.
  3. Validation First: All external inputs are validated before contract logic is executed.
  4. Transparency: All logic and state changes are transparent and verifiable on-chain.

Trust Assumptions

The RangeBet protocol makes the following trust assumptions:

  1. Owner Trust: The contract owner has market creation and closure authority and is assumed not to use these privileges maliciously.
  2. Code Integrity: The smart contract code and mathematical model are assumed to be free of defects.
  3. External Dependencies: The PRBMath library and OpenZeppelin libraries are assumed to be secure.

Potential Risks

The major risk factors identified in the RangeBet protocol are:

1. Economic Risks

  • Mathematical Model Errors: Potential inaccurate pricing due to errors in the betting cost calculation formula
  • Price Manipulation: Possibility of market price manipulation through large bets
  • Liquidity Imbalance: Imbalances caused by excessive betting on specific bins

2. Smart Contract Risks

  • Reentrancy Attacks: Possibility of reentrancy through external calls
  • Integer Overflow/Underflow: Potential overflow/underflow when processing large numbers
  • Gas Optimization Issues: High gas costs due to complex mathematical operations

3. Governance Risks

  • Centralization Risk: Excessive concentration of authority with the contract owner
  • Parameter Setting Errors: Risks due to improper market parameter settings

Mitigation Strategies

RangeBet implements the following security strategies to mitigate risks:

1. Economic Risk Mitigation

  • Mathematical Model Verification: Independent verification and simulation of the betting cost calculation formula
  • Slippage Protection: Limiting price impact through the maxCollateral parameter
  • Minimum/Maximum Betting Limits: Preventing excessive market manipulation

2. Smart Contract Risks

  • Reentrancy Protection: Protecting key functions using the nonReentrant modifier
  • Using SafeMath: Using OpenZeppelin's SafeMath or Solidity 0.8+ built-in overflow protection
  • Minimizing Dependencies: Minimizing interactions with external contracts

3. Governance Risks

  • Separation of Roles: Using multi-signature wallets for administrative functions
  • Transparent Parameter Setting: Emitting events for all important parameter changes
  • Gradual Upgrades: Phased upgrades and validation of changes

Code Audits

The RangeBet protocol undergoes the following audit steps:

  1. Internal Review: Code review among developers
  2. Formal Verification: Mathematical model verification using formal verification tools
  3. Automated Tools: Using automated security tools such as Slither, Mythril, etc.
  4. External Audit: Review by independent security audit companies

Latest Audit Reports

  • [Example Audit Report Link] - Q1 2023 Audit (Planned)

Security Vulnerability Reporting

If you discover a security vulnerability in the RangeBet protocol, please report it responsibly following these procedures:

  1. Private Reporting: Do not post vulnerabilities on public forums or GitHub issues.
  2. Email Reporting: Send vulnerability details to security@example.com.
  3. Encrypted Communication: If necessary, you can encrypt communications using a PGP key.

Report Content

When reporting security vulnerabilities, please include the following information:

  1. Type and description of the vulnerability
  2. Steps to reproduce the vulnerability
  3. Potential impact
  4. Mitigation or fix suggestions, if possible

Bug Bounty Program

RangeBet operates a bug bounty program to encourage identification of security vulnerabilities.

Scope

  • Smart contract code
  • Mathematical model
  • Protocol logic

Severity Levels

  1. Critical: Serious threat to fund loss or system integrity (10,000 USD)
  2. High: Significant fund risk or critical function impairment (5,000 USD)
  3. Medium: Limited fund risk or function impairment (2,000 USD)
  4. Low: Minor issues or best practice suggestions (500 USD)

Payment Method

  • Payment in ETH or stablecoins after bug confirmation and severity assessment
  • Payment completed before bug disclosure

Emergency Plan

Emergency Contacts

For urgent security issues:

Emergency Response Process

  1. Alert Phase: Security team receives alert and assesses severity
  2. Mitigation Phase: Contract pause or emergency fix if necessary
  3. Resolution Phase: Vulnerability fix and verification
  4. Communication Phase: Providing situation updates to the community
  5. Post-Analysis Phase: Analyzing incident causes and security improvements

Contract Pausing

In case of serious vulnerabilities, the following functions can be used to pause part or all of the system:

// Emergency pause function in RangeBetManager
function emergencyPause() external onlyOwner {
    // Implementation
}

// Unpause function
function unpause() external onlyOwner {
    // Implementation
}

Conclusion

The RangeBet team prioritizes the security of user funds. We strive to provide a secure prediction market platform through continuous security improvements and transparent communication.

If you have security questions or concerns, please contact security@example.com.

There aren't any published security advisories