-
Notifications
You must be signed in to change notification settings - Fork 110
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: feed sataoshi/B to zetacore and check actual outTx size #1243
Conversation
!!!WARNING!!! Be very careful about using Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203 Pay extra attention to the way |
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 make the fix on the ZetaClient level but we still use the same value for the fee payment user-side:
gasPrice * GAS_LIMIT + PROTOCOL_FLAT_FEE
https://github.com/zeta-chain/protocol-contracts/blob/6005f2247c787ead18857f81717b844c086c9af4/contracts/zevm/ZRC20.sol#L245
When 3M satoshis
is paid up on mock mainnet, is it the same value that has been calculated on the smart contract level?
We should ensure there are no discrepancies between the value paid on the smart contract and the actual fee paid by the TSS.
I believe we shouldn't need a change on the ZetaClient level, we should have the ability to control the fee value by modifying the parameters on the smart contract level: gasPrice
, gasLimit
@ws4charlie Line 97 in dec6172
The gas price is fetched from the gas price voted for the Bitcoin chain: Therefore if we can lower the gas price for the Bitcoin chain, I believe we can reduce equally the fees paid by the user on ZetaChain and the fees used by the TSS for the tx |
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.
Checked deeper into the code. PostGasPrice
will update the gas price value on the node, therefore no modification on the protocol side are required.
Overall, the fix looks good to me.
Just created an associated issue to track it for |
#1292) * refactor: change default mempool version in config (#1238) * fix(`MsgWhitelistERC20`): set unique index for generate cctx (#1245) * update index * remove deprecated functions * make generate * add return value in message * initialize test * whitelist tests * make generate * fix(`observer`): remove error return in `IsAuthorized` (#1250) * update function * regenerate interfaces * update for crosschain * fix(`GetForeignCoinFromAsset`): Ethereum comparaison checksum/non-checksum format (#1261) * fix error message * compare with ETH address type * tests * goimport --------- Co-authored-by: brewmaster012 <[email protected]> * feat(`fungible`): add ability to update gas limit (#1260) * add new field * update message type * message new logic * fix: Blame index update (#1264) * initial commit * added queries and unit tests * added cli * fix parse error * fix parse error 2 * fix lint and test errors * ran make generate * update index for keygen * refactor query name * refactor key calculation * refactor lib name * fix: feed sataoshi/B to zetacore and check actual outTx size (#1243) * feed sataoshi/B to zetacore and check size limit * removed fee cap * replaced magic number 1000 with constant bytesPerKB * put lowerbound, upperbound limit on sizeLimit * use actual txSize for fee calculation --------- Co-authored-by: charliec <[email protected]> * fix: cherry pick all hotfix from v10.0.x (zero-amount, precision, etc.) (#1235) * cherry pick all hotfix from v10.0.x * adjusted code to for nosec * adusted error handling and code comments according to PR review feedback * cherry pick hotfix for bitcoin outbound performance and updated some log prints * cherry pick mock mainnet hotfix for duplicate payment on nonce 0 --------- Co-authored-by: charliec <[email protected]> * fix: register emissions grpc server (#1257) * feat: Bitcoin block header and merkle proof (#1263) * initiated bitcoin header and proof * added smoke test for bitcoin merkle proof and RPC query * make generate * fix gosec and unit test * Update common/headers_test.go Co-authored-by: Lucas Bertrand <[email protected]> * code adjustment according to feedback of PR review * corrected a typo and added more comment to function * fix gosec error --------- Co-authored-by: charliec <[email protected]> Co-authored-by: Lucas Bertrand <[email protected]> Co-authored-by: brewmaster012 <[email protected]> * fix: read gas limit from smart contract (#1277) * read gas limit from smart contract * add more checks for gas limit * fix(`fungible`): add CLI command to query system contract (#1252) * fix proto * fix filename * add cli query * fix(`cmd`): add notice when using `--ledger` with Ethereum HD path (#1285) * change comment * add notice for ledger * merge develop into inbound-tracker and unified proof verification * fixed gosec errors --------- Co-authored-by: Lucas Bertrand <[email protected]> Co-authored-by: brewmaster012 <[email protected]> Co-authored-by: kevinssgh <[email protected]> Co-authored-by: charliec <[email protected]> Co-authored-by: Tanmay <[email protected]>
Description
End user paid up to 3M satoshis ($800) on ZRC20
withdraw
in mock mainnet for bitcoin outbound which is way more than enough. The correct gas price and gas limit needs to be used.satoshis/Byte
other thansatoshis/KB
because thegasLimit
in ZRC20 contract is in unit ofByte
instead ofKB
.txSize
falls in range[outTxBytesMin, outTxBytesCap]
.gasLimit
is about1600 Byte
and the largestgasLimit
is about3200 Byte
for ZRC20 configuration. See google sheet link belowCloses: 1253
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce.
Checklist: