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

unexpected high gas used with bootstrap predeploy #2819

Closed
shunjizhan opened this issue Oct 16, 2024 · 3 comments
Closed

unexpected high gas used with bootstrap predeploy #2819

shunjizhan opened this issue Oct 16, 2024 · 3 comments

Comments

@shunjizhan
Copy link
Contributor

shunjizhan commented Oct 16, 2024

when calling bootstrap multiple times, gasUsed will be extremely high after the first time.

Reproduce

prepare

  • checkout this branch
  • put KEY=<yout private key> into .env, make sure you have enough jitosol (>1) and ACA (>20) on acala fork testnet for testing
  • yarn build

route bootstrap without gasdrop

GAS_DROP=0 yarn hardhat run scripts/test.ts --network acalaFork

this will perform deployDropAndBootstrapStakeRouter for 2 times, and we can observe that in the second run, gasUsed is extremely high, which is abnormal.

-------------------- RUN 0 --------------------
{
  usedGas: '49,773',
  usedStorage: '-64'
}
{
  usedGas: '3,008,857',    // looks normal
  usedStorage: '22,974'    // expected since we need to deploy router for the first time
}

-------------------- RUN 1 --------------------
{
  usedGas: '49,773',
  usedStorage: '-64'
}
{
  usedGas: '24,592,742',  // ❓❓❓
  usedStorage: '0'        // expected since we do not need to deploy router now
}

route bootstrap with gasdrop 3 ACA

GAS_DROP=3 yarn hardhat run scripts/test.ts --network acalaFork

with gas drop, first run is fine, but second run will fail. My guess is that gasUsed will exceed block gas limit

-------------------- RUN 0 --------------------
{
  usedGas: '49,773',
  usedStorage: '-64'
}
{
  usedGas: '3,043,770',
  usedStorage: '22,974'    // expected since we need to deploy router for the first time
}

-------------------- RUN 1 --------------------
Error: cannot estimate gas; transaction may fail or may require manual gas limit
...
execution reverted: TRANSFER_FROM_FAILED
@shunjizhan
Copy link
Contributor Author

shunjizhan commented Oct 16, 2024

oh the failure for dropping ACA is expected, since we didn't deploy router for the second run and so didn't 'top up ACA for the router

UPDATE: this is still unexpected

@shunjizhan
Copy link
Contributor Author

shunjizhan commented Oct 16, 2024

for the high gas used, it could be due to calculating router address? will do some validation

@shunjizhan
Copy link
Contributor Author

ok it's indeed an asset router issue AcalaNetwork/asset-router#63

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

No branches or pull requests

1 participant