bridge_operator
¶
-
class
ethaergo_bridge_operator.proposer.client.
ProposerClient
(config_file_path: str, aergo_net: str, eth_net: str, eth_block_time: int, aergo_gas_price: int, eth_gas_price: int, privkey_name: str = None, privkey_pwd: str = None, anchoring_on: bool = False, auto_update: bool = False, oracle_update: bool = False, bridge_anchoring: bool = True, root_path: str = './', eco: bool = False, eth_eco: bool = False)¶ The ProposerClient starts Aergo and Ethereum proposers
-
class
ethaergo_bridge_operator.proposer.eth.client.
EthProposerClient
(config_file_path: str, aergo_net: str, eth_net: str, privkey_name: str = None, privkey_pwd: str = None, anchoring_on: bool = False, auto_update: bool = False, oracle_update: bool = False, root_path: str = './', eth_gas_price: int = None, bridge_anchoring: bool = True, eco: bool = False)¶ The ethereum bridge proposer periodically (every t_anchor) broadcasts the finalized Aergo trie state root (after lib) onto the ethereum bridge contract after validation by the Validators. It first checks the last merged height and waits until now > lib + t_anchor is reached, then merges the current finalised block (lib). If bridge_anchoring is True(default), then the proposer will create a Merkle proof of the bridge storage root to anchor both roots in the same transaction. Start again after waiting t_anchor. EthProposerClient anchors an Aergo state root onto Ethereum.
- Note on config_data:
- config_data is used to store current validators and their ip when the proposer starts. (change validators after the proposer has started)
- After starting, when users change the config.json, the proposer will attempt to gather signatures to reflect the changes.
- t_anchor value is always taken from the bridge contract
- validators are taken from the config_data because ip information is not stored on chain
- when a validator set update succeeds, self.config_data is updated
- if another proposer updates to a new set of validators and the proposer doesnt know about it, proposer must be restarted with the new current validator set to create new connections to them.
-
buildBridgeAnchorArgs
(root: bytes) → Tuple[bytes, List[bytes], bytes, int]¶ Build arguments to derive bridge storage root from the anchored state root with a merkle proof
-
monitor_settings
()¶ Check if a modification of bridge settings is requested by seeing if the config file has been changed and try to update the bridge contract (gather 2/3 validators signatures).
-
monitor_settings_and_sleep
(sleeping_time)¶ While sleeping, periodicaly check changes to the config file and update settings if necessary. If another proposer updated settings it doesnt matter, validators will just not give signatures.
-
run
() → None¶ Gathers signatures from validators, verifies them, and if 2/3 majority is acquired, set the new anchored root in eth_bridge.
-
update_oracle
(oracle)¶ Try to update the oracle registered in the bridge contract.
-
update_t_anchor
(t_anchor)¶ Try to update the anchoring periode registered in the bridge contract.
-
update_t_final
(t_final)¶ Try to update the anchoring periode registered in the bridge contract.
-
update_validators
(new_validators)¶ Try to update the validator set with the one in the config file.
-
wait_next_anchor
(merged_height: int) → int¶ Wait until t_anchor has passed after merged height. Return the next finalized block after t_anchor to be the next anchor
-
class
ethaergo_bridge_operator.proposer.aergo.client.
AergoProposerClient
(config_file_path: str, aergo_net: str, eth_net: str, eth_block_time: int, privkey_name: str = None, privkey_pwd: str = None, anchoring_on: bool = False, auto_update: bool = False, oracle_update: bool = False, aergo_gas_price: int = None, bridge_anchoring: bool = True, root_path: str = './', eco: bool = False)¶ The aergo bridge proposer periodically (every t_anchor) broadcasts the finalized trie state root (after lib) onto the aergo bridge contract after validation by the Validator servers. It first checks the last merged height and waits until now > lib + t_anchor is reached, then merges the current finalised block (lib). If bridge_anchoring is True(default), then the proposer will create a Merkle proof of the bridge storage root to anchor both roots in the same transaction. Start again after waiting t_anchor.
- Note on config_data:
- config_data is used to store current validators and their ip when the proposer starts. (change validators after the proposer has started)
- After starting, when users change the config.json, the proposer will attempt to gather signatures to reflect the changes.
- t_anchor value is always taken from the bridge contract
- validators are taken from the config_data because ip information is not stored on chain
- when a validator set update succeeds, self.config_data is updated
- if another proposer updates to a new set of validators and the proposer doesnt know about it, proposer must be restarted with the new current validator set to create new connections to them.
-
buildBridgeAnchorArgs
(next_anchor_height) → Tuple[List[str], List[str]]¶ Build arguments to derive bridge storage root from the anchored state root with a merkle proof
-
monitor_settings
()¶ Check if a modification of bridge settings is requested by seeing if the config file has been changed and try to update the bridge contract (gather 2/3 validators signatures).
-
monitor_settings_and_sleep
(sleeping_time)¶ While sleeping, periodicaly check changes to the config file and update settings if necessary. If another proposer updated settings it doesnt matter, validators will just not give signatures.
-
run
() → None¶ Gathers signatures from validators, verifies them, and if 2/3 majority is acquired, set the new anchored root in aergo_bridge.
-
update_oracle
(oracle)¶ Try to update the oracle periode registered in the bridge contract.
-
update_t_anchor
(t_anchor)¶ Try to update the anchoring periode registered in the bridge contract.
-
update_t_final
(t_final)¶ Try to update the anchoring periode registered in the bridge contract.
-
update_unfreeze_fee
(fee)¶ Try to update the anchoring periode registered in the bridge contract.
-
update_validators
(new_validators)¶ Try to update the validator set with the one in the config file.
-
wait_next_anchor
(merged_height: int) → int¶ Wait until t_anchor has passed after merged height. Return the next finalized block after t_anchor to be the next anchor
-
ethaergo_bridge_operator.bridge_deployer.
deploy_bridge
(config_path: str, lua_bytecode_path: str, sol_bytecode_path: str, eth_net: str, aergo_net: str, aergo_erc20: str = 'aergo_erc20', privkey_name: str = None, privkey_pwd: str = None) → None¶ Deploy brige contract on Aergo and Ethereum.
-
exception
ethaergo_bridge_operator.proposer.exceptions.
ValidatorMajorityError
¶ Exception raised by proposers when they fail to gather 2/3 validator signatures to make an update.