The transaction fee estimate depends on the entire transaction flow, including validation and execution. zkSync Era provides functions for estimating the cost of a transaction regardless of the type of account. These accounts require a (usually) higher amount of gas than EOAs. On zkSync Era this varies because we support custom and paymaster accounts. checking the signature and updating the nonce for the account. On zkSync Era the opposite is true: as contract bytecode is only published once, updating the constructor parameters alone leads to substantial fee savings.Įthereum has a constant of 21000 gas that covers the intrinsic costs of processing a transaction, i.e.On Ethereum, avoiding constructor parameters and putting them into constants reduces some of the gas costs upon contract deployment.Reuse the contract code where possible:.Reuse as many storage slots as possible: Only the final state diff is published on Ethereum.Update storage slots as little as possible: Check to see if your code can avoid unnecessary storage updates.After that, subsequent deployments only involve updating one storage slot which sets the contract code hash on the newly deployed Pair address. The contract bytecode of Pair is only published when the first instance is deployed. An example is a DEX with a PairFactory contract for different Pair pools. Another advantage is the cost-effective contract redeployment. Execution of arithmetic operations is relatively cheap, as it involves computation alone and no storage changes.Ī considerable advantage we have over optimistic rollups is that, instead of publishing all transaction data to L1, zkSync Era only publishes state diffs, thus publishing significantly less data to L1. Like Ethereum, the most costly operation is a storage update. See the zkSync opcode documentation open in new window for an idea of how we calculate them. Other opcode prices are constant, similar to Ethereum. In zkSync Era, unlike in Ethereum where each opcode has a fixed gas price, storage write charges remain dynamic due to the fluctuation of gas price on L1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |