Right now the aligned contract addresses are configured in the constructor:
constructor(address _stateSettlementAddr, address _accountValidationAddr) {
bridgeOperator = msg.sender;
stateSettlement = MinaStateSettlementExample(_stateSettlementAddr);
accountValidation = MinaAccountValidationExample(_accountValidationAddr);
}
We want to remove constructor-based wiring and instead set these aligned contract addresses via dedicated setter function(s). Additionally, the bridge contract must reject calls to any non-setup methods unless both aligned addresses are configured.
This should be fully tried within this repo following the existing Aligned Mina Bridge flow.
Goals / Requirements
Contract changes
-
Replace constructor params with a constructor that only sets bridgeOperator (or deployer/owner).
-
Add a configuration flow using setter(s):
setAlignedContracts(address _stateSettlementAddr, address _accountValidationAddr)
-
Access control:
- Only
bridgeOperator (or current owner/admin) can call setters.
-
Validation:
- Revert if address is
address(0).
- (Optional but recommended) revert if already set, OR allow updates but emit events.
-
Add a gating modifier used by all non-setup methods:
modifier onlyConfigured() { require(isConfigured(), "AlignedContractsNotConfigured"); _; }
isConfigured() returns true only if both addresses are non-zero.
Behavior requirements
Events
Emit events so configuration can be tracked:
event StateSettlementSet(address indexed newAddress);
event AccountValidationSet(address indexed newAddress);
(or one combined event)
Acceptance Criteria
- Constructor no longer accepts aligned contract addresses.
- Setter(s) exist, are access-controlled, validate input, and emit event(s).
- All non-setup methods are gated by
onlyConfigured (or equivalent).
Implementation Notes (suggested)
-
Prefer custom errors for gas + clarity:
error AlignedContractsNotConfigured();
error ZeroAddress();
error NotBridgeOperator();
-
Add onlyConfigured modifier and apply it widely (everything except setters + harmless views).
-
If there are many functions, consider applying the modifier to internal entrypoints or grouping external functions.
Right now the aligned contract addresses are configured in the constructor:
We want to remove constructor-based wiring and instead set these aligned contract addresses via dedicated setter function(s). Additionally, the bridge contract must reject calls to any non-setup methods unless both aligned addresses are configured.
This should be fully tried within this repo following the existing Aligned Mina Bridge flow.
Goals / Requirements
Contract changes
Replace constructor params with a constructor that only sets
bridgeOperator(or deployer/owner).Add a configuration flow using setter(s):
setAlignedContracts(address _stateSettlementAddr, address _accountValidationAddr)Access control:
bridgeOperator(or current owner/admin) can call setters.Validation:
address(0).Add a gating modifier used by all non-setup methods:
modifier onlyConfigured() { require(isConfigured(), "AlignedContractsNotConfigured"); _; }isConfigured()returns true only if both addresses are non-zero.Behavior requirements
Any method that relies on aligned contracts (and generally any method except configuration / view helpers) must revert until:
stateSettlementis set ANDaccountValidationis set.Expose a simple view:
function isConfigured() external view returns (bool);Events
Emit events so configuration can be tracked:
event StateSettlementSet(address indexed newAddress);event AccountValidationSet(address indexed newAddress);(or one combined event)
Acceptance Criteria
onlyConfigured(or equivalent).Implementation Notes (suggested)
Prefer custom errors for gas + clarity:
error AlignedContractsNotConfigured();error ZeroAddress();error NotBridgeOperator();Add
onlyConfiguredmodifier and apply it widely (everything except setters + harmless views).If there are many functions, consider applying the modifier to internal entrypoints or grouping external functions.