How to Request Attack Mode

Submit your contracts for DAO approval to enter attack mode

Overview

After deploying contracts and creating an agreement, request attack mode to enable Safe Harbor protection and allow whitehats to test your contracts.

Prerequisites

Before requesting:

  1. Contracts deployed (via BattleChainDeployer or any other method)
  2. Agreement created via AgreementFactory
  3. Agreement adopted via adoptSafeHarbor()
  4. Commitment window extends at least 7 days

Request Attack Mode

Call requestUnderAttack on the AttackRegistry:

cast send 0xdD029a6374095EEb4c47a2364Ce1D0f47f007350 \
  "requestUnderAttack(address)" $AGREEMENT_ADDRESS \
  --account battlechain \
  --rpc-url https://testnet.battlechain.com

Run the Foundry script with:

forge script script/RequestAttackMode.s.sol \
  --account battlechain \
  --rpc-url https://testnet.battlechain.com \
  --broadcast

This validates:

  • Agreement was created by official factory
  • You're the agreement owner
  • All contracts were deployed via BattleChainDeployer
  • Commitment window meets minimum requirements

For Non-BattleChainDeployer Contracts

If your contracts weren't deployed via BattleChainDeployer, call requestUnderAttackByNonAuthorized instead. This must be called by the agreement owner — the same address that created the agreement via AgreementFactory.

cast send 0xdD029a6374095EEb4c47a2364Ce1D0f47f007350 \
  "requestUnderAttackByNonAuthorized(address)" $AGREEMENT_ADDRESS \
  --account battlechain \
  --rpc-url https://testnet.battlechain.com
⚠️

This path requires extra DAO scrutiny since there's no on-chain proof of deployment.

Skip Attack Mode Entirely

To go directly to production without attack testing:

cast send 0xdD029a6374095EEb4c47a2364Ce1D0f47f007350 \
  "goToProduction(address)" $AGREEMENT_ADDRESS \
  --account battlechain \
  --rpc-url https://testnet.battlechain.com

This immediately sets state to PRODUCTION with no Safe Harbor protection.

Check Request Status

cast call 0xdD029a6374095EEb4c47a2364Ce1D0f47f007350 \
  "getAgreementState(address)(uint8)" $AGREEMENT_ADDRESS \
  --rpc-url https://testnet.battlechain.com
OutputMeaning
0NOT_DEPLOYED — rejected or not requested
2ATTACK_REQUESTED — waiting for DAO
3UNDER_ATTACK — approved

What Happens Next

OutcomeTimeline
DAO ApprovesImmediate → UNDER_ATTACK
DAO RejectsImmediate → NOT_DEPLOYED
DAO Takes No Action14 days → PRODUCTION (auto-promote)

Instant Approval (Testnet Only)

On testnet the registry moderator is a MockRegistryModerator — a permissionless contract that forwards any approveAttack call straight to the AttackRegistry. You can approve your own request immediately:

cast send 0x1bC64E6F187a47D136106784f4E9182801535BD3 \
  "approveAttack(address)" $AGREEMENT_ADDRESS \
  --account battlechain \
  --rpc-url https://testnet.battlechain.com

Troubleshooting

ErrorSolution
InvalidAgreementAgreement not from official factory
NotAgreementOwnerOnly agreement owner can request
AgreementOwnerNotAuthorizedCall authorizeAgreementOwner() for each contract
InsufficientCommitmentExtend commitment window to 7+ days
EmptyContractArrayAdd contracts to agreement's BattleChain scope

How to Promote to Production

Next: Promote after stress testing