Skip to content

Use fixed lower call gas limit #627

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

Merged
merged 1 commit into from
Aug 18, 2021
Merged

Use fixed lower call gas limit #627

merged 1 commit into from
Aug 18, 2021

Conversation

k1rill-fedoseev
Copy link
Member

As part of the AMB a gas limit for the call on the other side can be provided. The provided gas limit is
checked against a minimum gas usage computed based on the number of bytes within a call:

function  getMinimumGasUsage(bytes _data) public pure returns (uint256 gas) {
  // From Ethereum Yellow Paper
  // 68 gas is paid for every non-zero byte of data or code for a transaction
  // Starting from Istanbul hardfork, 16 gas is paid (EIP-2028)
  return _data.length.mul(16);
}

However, as the call is made from within a smart contract, these costs do not apply. They only apply to initial calldata of a transaction. The dominating cost, namely the cost for the CALL itself (increased by EIP-2929) is not considered.

@k1rill-fedoseev k1rill-fedoseev added audit Items related to the security audits team-august-2021 Related to items found by ChainSecurity in the audit held in August of 2021 labels Aug 18, 2021
@k1rill-fedoseev k1rill-fedoseev self-assigned this Aug 18, 2021
@akolotov akolotov merged commit 4b0eb1e into develop Aug 18, 2021
@akolotov akolotov deleted the audit/august2021/7.9 branch August 18, 2021 10:49
akolotov added a commit that referenced this pull request Sep 6, 2021
This update for the `master` branch contains the changes made to address findings discovered during a security audit:
 * [Fix] Stricter preconditions for payInterest (#623)
 * [Fix] Fix offset in comments (#624)
 * [Fix] Use fixed lower call gas limit (#627)
 * [Fix] Separate XDaiForeignBridge contract with compound and GSN support (#626)
 * [Fix] Update GSN interface (#628)
 * [Fix] Block ERC20 selectors in AMB requests (#630)
 * [Other] Bump package and contracts interfaces version prior to 6.0.0 (#629)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit Items related to the security audits team-august-2021 Related to items found by ChainSecurity in the audit held in August of 2021
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants