-
Notifications
You must be signed in to change notification settings - Fork 36
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
Estimate gas limit by default whenever possible #487
Conversation
multiversx_sdk_cli/cli_delegation.py
Outdated
gas_limit = 0 if args.estimate_gas else args.gas_limit | ||
chain_id = cli_shared.get_chain_id(args.chain, args.proxy) | ||
config = TransactionsFactoryConfig(chain_id) | ||
delegation = DelegationOperations(config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
multiversx_sdk_cli/cli_delegation.py
Outdated
gas_limit = 0 if args.estimate_gas else args.gas_limit | ||
chain_id = cli_shared.get_chain_id(args.chain, args.proxy) | ||
config = TransactionsFactoryConfig(chain_id) | ||
delegation = DelegationOperations(config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -54,7 +53,7 @@ def create_transaction_for_staking( | |||
rewards_address=rewards_address, | |||
) | |||
|
|||
if estimate_gas: | |||
if not gas_limit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we can drop self.estimate_*
functions, since gas estimation is performed by controllers in sdk-py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, the transactions are not created using a controller from sdk-py
. This will be changed in a later PR. We still left the --gas-limit
argument in case a user wants to specify the gas.
proxy = ProxyNetworkProvider(url=args.proxy, config=network_provider_config) | ||
args.nonce = proxy.get_account(account.address).nonce | ||
|
||
|
||
def get_current_nonce_for_address(address: Address, proxy_url: Union[str, None]) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously reviewed 💭
multiversx_sdk_cli/cli_shared.py
Outdated
|
||
|
||
def prepare_sender(args: Any): | ||
"""Reurns a tuple containing the sender's account and the account nonce. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
@@ -57,7 +56,6 @@ def test_create_new_delegation_contract_with_provided_gas_limit(capsys: Any): | |||
str(alice), | |||
"--nonce", | |||
"7", | |||
"--estimate-gas", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document this breaking change in the PR description (so that we don't forget about it when writing the release notes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a short description.
The
--estimate-gas
flag was removed from all commands. The gas limit is now estimated by default wherever possible (excluding smart contract transactions).