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
BattleChainDeployer or any other method)
- Agreement created via
AgreementFactory
- Agreement adopted via
adoptSafeHarbor()
- Commitment window extends at least 7 days
Request Attack Mode
attackRegistry.requestUnderAttack(agreementAddress);
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 contracts weren’t deployed via BattleChainDeployer:
attackRegistry.requestUnderAttackByNonAuthorized(agreementAddress);
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:
attackRegistry.goToProduction(agreementAddress);
This immediately sets state to PRODUCTION with no Safe Harbor protection.
Check Request Status
IAttackRegistry.ContractState state = attackRegistry.getAgreementState(agreementAddress);
// 2 = ATTACK_REQUESTED (waiting for DAO)
// 3 = UNDER_ATTACK (approved!)
// 0 = NOT_DEPLOYED (rejected or not requested)
What Happens Next
| Outcome | Timeline |
|---|
| DAO Approves | Immediate → UNDER_ATTACK |
| DAO Rejects | Immediate → NOT_DEPLOYED |
| DAO Takes No Action | 14 days → PRODUCTION (auto-promote) |
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