Bridge Cosigner Manager
In order to provide anti-fraud protection, the cosigner manager is developed for. It check on validity of enter result, verify correct signatures of syndicate on chain and it's uniqueness. In order to be a successfull transaction at exit function, it should have more than 66% of votes collected from cosigners and which is called syndicate.
Base functionality
The core and important logic for bridge cosigner manager
Cosigner
struct Cosigner {
address addr;
uint256 chainId;
uint256 index;
bool active;
}
- Should not be a zero to prevent unexpected behaviour;
- Should represent for what chain it specific for;
- Could be deactivate in case of compromise;
addCosigner
function addCosigner(address cosaddr, uint256 chainId) external;
- Allows only SAO to execute;
- Should not add already existing cosigner on anychain (unique in mature);
- Could not be zero address;
- Could not add cosigner for local chain, only remote chains;
removeCosigner
function removeCosigner(address cosaddr) external;
- Allows only SAO to execute;
- Should remove if it exists;
- Could not be zero address;
getCosigners
function getCosigners(uint256 chainId)
external
view
returns (address[] memory);
- Should return active cosigners list for specific chain;
- Should not return cosigners for local chain;
getCosignCount
function getCosignCount(uint256 chainId) external view returns (uint8);
- Should return the number of cosigners required to proof the enter validity;
- Always must be more then 66% of existing cosigners;
verify
function verify(
bytes32 commitment,
uint256 chainId,
bytes[] calldata signatures
) external view returns (bool);
- Should be used in exit function as basically designed for it;
- Signatures should not be equal and function must protect from this;
- Always verify external chain id;