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 gas estimation harcoding it #247

Merged
merged 6 commits into from
Aug 17, 2021
Merged

Fix gas estimation harcoding it #247

merged 6 commits into from
Aug 17, 2021

Conversation

pmprete
Copy link
Contributor

@pmprete pmprete commented Aug 16, 2021

Gas estimation does not work correctly on RSK and after the London harfork, neither is working on Ethereum
Example https://etherscan.io/tx/0xd30d6cf428606e2ef3667427b9b6baecb2f4c9cbb44a0c82c735a238ec8f72fb
To fix it, we decided to use a hardcoded gas estimation of 250.000

Also Lucas informed me that we got this error

[2021-08-17T14:44:18.687] [INFO] HEARTBEAT - Found 9 heartbeatLogs
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (3609055)
    at Object.writeFileSync (node:fs:2136:5)
    at Heartbeat._saveProgress (/app/federator/src/lib/Heartbeat.js:213:16)
    at Heartbeat.readLogs (/app/federator/src/lib/Heartbeat.js:127:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async run (/app/federator/src/main.js:52:9)
    at async Scheduler.poll (/app/federator/src/services/Scheduler.js:24:13)
    at async Scheduler.start (/app/federator/src/services/Scheduler.js:17:9) {
  code: 'ERR_INVALID_ARG_TYPE'
}
[2021-08-17T14:44:18.687] [ERROR] HEARTBEAT - Error: Exception Running Federator
    at Heartbeat.readLogs (/app/federator/src/lib/Heartbeat.js:134:35)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async run (/app/federator/src/main.js:52:9)
    at async Scheduler.poll (/app/federator/src/services/Scheduler.js:24:13)
    at async Scheduler.start (/app/federator/src/services/Scheduler.js:17:9) TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (3609055)
    at Object.writeFileSync (node:fs:2136:5)
    at Heartbeat._saveProgress (/app/federator/src/lib/Heartbeat.js:213:16)
    at Heartbeat.readLogs (/app/federator/src/lib/Heartbeat.js:127:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async run (/app/federator/src/main.js:52:9)
    at async Scheduler.poll (/app/federator/src/services/Scheduler.js:24:13)
    at async Scheduler.start (/app/federator/src/services/Scheduler.js:17:9) {
  code: 'ERR_INVALID_ARG_TYPE'
}```
The error is that writeFileSync does not support passing a number from this size, so we need to convert it to a string
``` fs.writeFileSync(path, value.toString());```

Gas estimation does not work correctly on RSK and after the London harfork, neither is working on Ethereum
Example https://etherscan.io/tx/0xd30d6cf428606e2ef3667427b9b6baecb2f4c9cbb44a0c82c735a238ec8f72fb
To fix it, we decided to use a hardcoded gas estimation of 200.000
@pmprete pmprete requested a review from marcciosilva August 16, 2021 23:26
pedro added 2 commits August 16, 2021 20:54
The same information is printed later on, so this is not necesary
@lgtm-com
Copy link

lgtm-com bot commented Aug 17, 2021

This pull request introduces 1 alert when merging bcacedc into 591403c - view on LGTM.com

new alerts:

  • 1 for Incomplete URL substring sanitization

@pmprete pmprete requested a review from marcciosilva August 17, 2021 17:29
@pmprete pmprete merged commit 37e2762 into master Aug 17, 2021
@pmprete pmprete deleted the fix-gas-estimation branch August 17, 2021 18:06
Dominikkq pushed a commit to Dominikkq/tokenbridge that referenced this pull request Jan 19, 2025
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