# use at your own risk

services:
  opencampuscodex-sepolia:
    image: ${OPENCAMPUSCODEX_NITRO_IMAGE:-offchainlabs/nitro-node}:${OPENCAMPUSCODEX_SEPOLIA_NITRO_VERSION:-v3.5.3-0a9c975}
    user: root
    ulimits:
      nofile: 1048576    # Max open files (for RPC/WS connections)
    sysctls:
      # TCP Performance
      net.ipv4.tcp_slow_start_after_idle: 0       # Disable slow start after idle
      net.ipv4.tcp_no_metrics_save: 1             # Disable metrics cache
      net.ipv4.tcp_rmem: 4096 87380 16777216      # Increase TCP read buffers
      net.ipv4.tcp_wmem: 4096 87380 16777216      # Increase TCP write buffers
      net.core.somaxconn: 32768                   # Higher connection queue
      # Memory/Connection Management
      net.core.netdev_max_backlog: 50000          # Increase network buffer
      net.ipv4.tcp_max_syn_backlog: 30000         # More SYN requests
      net.ipv4.tcp_max_tw_buckets: 2000000        # Allow more TIME_WAIT sockets
    expose:
      - 8545
      - 8551

    ports:
      - 10938:10938
      - 10938:10938/udp
    volumes:
      - ${OPENCAMPUSCODEX_SEPOLIA_NITRO_PRUNED_PEBBLE_HASH_DATA:-opencampuscodex-sepolia-nitro-pruned-pebble-hash}:/root/.arbitrum
      - /slowdisk:/slowdisk

      - .jwtsecret:/jwtsecret:ro

      - ./tmp/opencampuscodex-sepolia:/tmp

    command:
      - --datadir=/root/.arbitrum
      - --port=10938
      - --bind=0.0.0.0
      - --nat=extip:${IP}
      - --http
      - --http.port=8545
      - --http.vhosts=*
      - --ws
      - --ws.port=8545
      - --ws.origins=*
      - --ws.addr=0.0.0.0
      - --http.addr=0.0.0.0
      - --maxpeers=50
      - --http.api=eth,net,web3,arb,txpool,debug
      - --ws.api=eth,net,web3,arb,txpool,debug

      - --rpc.gascap=600000000
      - --rpc.returndatalimit=10000000
      - --rpc.txfeecap=0

      - --execution.caching.state-scheme=hash
      - --execution.rpc.gas-cap=600000000
      - --execution.caching.archive=false
      - --execution.sequencer.enable=false
      - --persistent.db-engine=pebble
      - --persistent.chain=/root/.arbitrum/opencampuscodex-sepolia

      - --conf.file=/config/baseConfig.json

      - --node.sequencer=false
      - --node.staker.enable=false
      - --node.batch-poster.enable=false
      - --node.data-availability.enable=true
      - --node.data-availability.sequencer-inbox-address=0xe347C1223381b9Dcd6c0F61cf81c90175A7Bae77
      - --node.data-availability.parent-chain-node-url=${ARBITRUM_SEPOLIA_EXECUTION_RPC}
      - --node.data-availability.rest-aggregator.enable=true
      - --node.data-availability.rest-aggregator.urls=https://das.open-campus-codex.gelato.digital

      - --node.feed.input.url=wss://feed.open-campus-codex.gelato.digital
      - --execution.forwarding-target=https://rpc.open-campus-codex.gelato.digital
      - --parent-chain.connection.url=${ARBITRUM_SEPOLIA_EXECUTION_RPC}

    networks:
      - chains
    restart: unless-stopped
    stop_grace_period: 5m
    labels:
      - traefik.enable=true
      - traefik.http.middlewares.opencampuscodex-sepolia-nitro-pruned-pebble-hash-stripprefix.stripprefix.prefixes=/opencampuscodex-sepolia
      - traefik.http.services.opencampuscodex-sepolia-nitro-pruned-pebble-hash.loadbalancer.server.port=8545
      - ${NO_SSL:-traefik.http.routers.opencampuscodex-sepolia-nitro-pruned-pebble-hash.entrypoints=websecure}
      - ${NO_SSL:-traefik.http.routers.opencampuscodex-sepolia-nitro-pruned-pebble-hash.tls.certresolver=myresolver}
      - ${NO_SSL:-traefik.http.routers.opencampuscodex-sepolia-nitro-pruned-pebble-hash.rule=Host(`$DOMAIN`) && PathPrefix(`/opencampuscodex-sepolia`)}
      - ${NO_SSL:+traefik.http.routers.opencampuscodex-sepolia-nitro-pruned-pebble-hash.rule=PathPrefix(`/opencampuscodex-sepolia`)}
      - traefik.http.routers.opencampuscodex-sepolia-nitro-pruned-pebble-hash.middlewares=opencampuscodex-sepolia-nitro-pruned-pebble-hash-stripprefix, ipwhitelist

volumes:
  opencampuscodex-sepolia-nitro-pruned-pebble-hash:

x-upstreams:
  - chain: open-campus-codex-sepolia
    method-groups:
      enabled:
        - debug
        - filter

    methods:
      disabled:
      enabled:
        # standard geth only
        - name: debug_getRawBlock
        - name: debug_getRawTransaction
        - name: debug_getRawReceipts
        - name: debug_getRawHeader
        - name: debug_getBadBlocks
        # non standard geth only slightly dangerous
        - name: debug_intermediateRoots
        - name: debug_dumpBlock
        # standard geth and erigon
        - name: debug_accountRange
        - name: debug_getModifiedAccountsByNumber
        - name: debug_getModifiedAccountsByHash
        # non standard geth and erigon
        - name: eth_getRawTransactionByHash
        - name: eth_getRawTransactionByBlockHashAndIndex
