Open
Conversation
We let DEFAULT_GAS_PRICE used for transaction submission and MAX_GAS_PRICE used as a limit for gas price bumps to be configurable instead of hardcoding them. The default values will be set the same as previously hardcoded: DEFAULT_GAS_PRICE = 100 Gwei MAX_GAS_PRICE = 600 Gwei Having it configurable is better from multi-environment perspective, as it doesn't make sense to start with 100 Gwei on Ropsten. It also gives possibility to easily tweak settings for mainnet without the need to rebuild the code. Following properties can be used to configure it: DEFAULT_GAS_PRICE_GWEI and MAX_GAS_PRICE_GWEI. Note that configured values are expected to be provided in Gwei (not wei!).
| def _compute_tx_gas_price(tx_nonce, tx_ticks): | ||
| '''Compute the proper gas price, adjusting for other pending txes and how | ||
| long this tx has been pending, taking the max gas price into account.''' | ||
| defaultGasPrice = int(config.get()['DEFAULT_GAS_PRICE_GWEI']) * GWEI |
There was a problem hiding this comment.
Minor remark:
Local variables seem to follow underscore notation, so perhaps "default_gas_price"?
| async def init() -> None: | ||
| '''Set up a connection to the interwebs''' | ||
| global CONNECTION | ||
| global MAX_GAS_PRICE |
There was a problem hiding this comment.
I've noticed that configurable variables are generally read from config wherever they are needed and not stored globally in Relay Maintainer, e.g:
URL = config.get()['BCOIN_URL']
Perhaps we could limit the number of global variables by doing the same with MAX_GAS_PRICE?
Just a suggestion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We let DEFAULT_GAS_PRICE used for transaction submission and MAX_GAS_PRICE used as a limit for gas price bumps to be configurable instead of hardcoding them.
The default values will be set the same as previously hardcoded:
DEFAULT_GAS_PRICE = 100 Gwei
MAX_GAS_PRICE = 600 Gwei
Having it configurable is better from a multi-environment perspective, as it doesn't make sense to start with 100 Gwei on Ropsten.
It also gives a possibility to easily tweak settings for the mainnet without the need to rebuild the code.
The following properties can be used to configure it:
DEFAULT_GAS_PRICE_GWEIandMAX_GAS_PRICE_GWEI. Note that configured values are expected to be provided in Gwei (not wei!).