Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store gas consumption limits in the bridge contracts #18

Open
akolotov opened this issue Feb 13, 2018 · 1 comment
Open

Store gas consumption limits in the bridge contracts #18

akolotov opened this issue Feb 13, 2018 · 1 comment

Comments

@akolotov
Copy link
Contributor

As per the bridge deployment process it is necessary to create configuration file for every bridge instance. There is a section in the configuration file which allows to define gas consumption limits which will be used in the bridge transactions:

deposit_relay
withdraw_confirm
withdraw_relay

Since these limits are common for every bridge instance it is redundant to distribute this info among all nodes before deployment begins.
Moreover these limits needs to be updated in case of gas consumption changes if the bridge contract is upgraded as per #7. In order to reduce human factor it is worth to update this automatically.
Some big constant value for these parameters is not good option to have - it could cause delays in validation since limits will be too big for block validators especially in the Ethereum Foundation network.

Proposal for changes

Solidity

  1. Introduce gasLimitWithdrawRelay in the contract HomeBridge.
  2. Introduce gasLimitDepositRelay and gasLimitWithdrawConfirm field in the contract ForeignBridge.
  3. Setup this parameter as part of bridge contracts deployment process.
  4. Introduce ability to change these parameters as part of bridge contract upgrade process as soon as (Feature) Make bridge contract upgradable #7 is implemented. Events must be raised in case of gas limit changes.

Rust

  1. Change bridge/src/bridge/deploy.rs to setup gasLimitWithdrawRelay, gasLimitDepositRelay and gasLimitWithdrawConfirm as part of deployment process.
  2. Introduce new functionality in bridge/src/bridge/deposit_relay.rs, bridge/src/bridge/withdraw_confirm.rs and bridge/src/bridge/withdraw_relay.rs in order to pickup gas limits from the corresponding contract. In order to optimize number of requests made to the blockchain nodes the limits could be re-read as soon as the corresponding event received from the bridge contracts.
@rstormsf
Copy link
Contributor

Solidity side is done

noot pushed a commit to noot/poa-bridge that referenced this issue Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants