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:
- Contracts deployed (via
BattleChainDeployeror any other method) - Agreement created via
AgreementFactory - Agreement adopted via
adoptSafeHarbor() - Commitment window extends at least 7 days
Request Attack Mode
Call requestUnderAttack on the AttackRegistry:
cast send 0x22134e878c409a0Eab7259d873b38e26Ca966d3C \
"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 0x22134e878c409a0Eab7259d873b38e26Ca966d3C \
"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 0x22134e878c409a0Eab7259d873b38e26Ca966d3C \
"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 0x22134e878c409a0Eab7259d873b38e26Ca966d3C \
"getAgreementState(address)(uint8)" $AGREEMENT_ADDRESS \
--rpc-url https://testnet.battlechain.com
| Output | Meaning |
|---|---|
0 | NOT_DEPLOYED — rejected or not requested |
2 | ATTACK_REQUESTED — waiting for DAO |
3 | UNDER_ATTACK — approved |
What Happens Next
| Outcome | Timeline |
|---|---|
| DAO Approves | Immediate → UNDER_ATTACK |
| DAO Rejects | Immediate → NOT_DEPLOYED |
| DAO Takes No Action | 14 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 0x3DdA228A38b4d7438bBF5D5137c8D1090DcaF6bF \
"approveAttack(address)" $AGREEMENT_ADDRESS \
--account battlechain \
--rpc-url https://testnet.battlechain.com
Request Attack Mode
Call requestUnderAttack on the AttackRegistry (0x24876e481eC7198CAC95af739Df2a852CE65A415 on mainnet):
cast send 0x24876e481eC7198CAC95af739Df2a852CE65A415 \
"requestUnderAttack(address)" $AGREEMENT_ADDRESS \
--account battlechain \
--rpc-url https://mainnet.battlechain.com
For Non-BattleChainDeployer Contracts
cast send 0x24876e481eC7198CAC95af739Df2a852CE65A415 \
"requestUnderAttackByNonAuthorized(address)" $AGREEMENT_ADDRESS \
--account battlechain \
--rpc-url https://mainnet.battlechain.com
This path requires extra DAO scrutiny since there's no on-chain proof of deployment.
Skip Attack Mode Entirely
cast send 0x24876e481eC7198CAC95af739Df2a852CE65A415 \
"goToProduction(address)" $AGREEMENT_ADDRESS \
--account battlechain \
--rpc-url https://mainnet.battlechain.com
This immediately sets state to PRODUCTION with no Safe Harbor protection.
Check Request Status
cast call 0x24876e481eC7198CAC95af739Df2a852CE65A415 \
"getAgreementState(address)(uint8)" $AGREEMENT_ADDRESS \
--rpc-url https://mainnet.battlechain.com
| Output | Meaning |
|---|---|
0 | NOT_DEPLOYED — rejected or not requested |
2 | ATTACK_REQUESTED — waiting for DAO |
3 | UNDER_ATTACK — approved |
What Happens Next
| Outcome | Timeline |
|---|---|
| DAO Approves | Immediate → UNDER_ATTACK |
| DAO Rejects | Immediate → NOT_DEPLOYED |
| DAO Takes No Action | 14 days → PRODUCTION (auto-promote) |
On mainnet the registry moderator is a controlled DAO role — there is no instant self-approval.
Track your request without scripting on the Approvals dashboard — your agreement appears there as soon as it's requested, showing its current state and full details for moderators to review.
Troubleshooting
| Error | Solution |
|---|---|
InvalidAgreement | Agreement not from official factory |
NotAgreementOwner | Only agreement owner can request |
AgreementOwnerNotAuthorized | Call authorizeAgreementOwner() for each contract |
InsufficientCommitment | Extend commitment window to 7+ days |
EmptyContractArray | Add contracts to agreement's BattleChain scope |
How to Promote to Production
Next: Promote after stress testing