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

Fix addition gas in external calls #195

Merged
merged 6 commits into from
Mar 10, 2023
Merged

Conversation

nxqbao
Copy link
Contributor

@nxqbao nxqbao commented Mar 9, 2023

Description

In low-level call <contract>.call{ value: _amount, gas: _gas }(), the actual amount of gas stipend forwarding to the external is 2300 + _gas. The compiler determines this, regardless of hardfork of the chain.

Since we design that the recipient will receive 3500 gas (as in #127), this PR reduces the number of 3500 in the parameter of .call to 1200.

Contract storage

No slot of storage is shuffled after this PR.

Contract changes

The table below shows the following info:

  • Logic: the logic is changed.
  • ABI: the ABI is changed.
  • Init data: new storage field is declared and needs initializing.
  • Dependent: needs to be changed due to changes in other contracts.
Contract name Logic ABI Init data Dependent
BridgeTracking
GovernanceAdmin
Maintenance
SlashIndicator
Staking [x]
StakingVesting
ValidatorSet [x]

Checklist

  • I have clearly commented on all the main functions following the NatSpec Format
  • The box that allows repo maintainers to update this PR is checked
  • I tested locally to make sure this feature/fix works

@nxqbao nxqbao merged commit 0dd2ec4 into dev Mar 10, 2023
nxqbao added a commit that referenced this pull request Mar 10, 2023
* fix contracts

* add fallback test

* Fix gas addition gas to be 1200 (3500 in total)

* Remove gas striction between cross-contract call

* remove console

* revert garbage
@ducthotran2010 ducthotran2010 deleted the fix/addition-gas-in-external-calls branch March 10, 2023 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants