Comments (5)
You are write when it comes to gas_limit
it should be named l2_gas_limit
(your PR that makes those changes is already merged). Also when gas_limit
is not provided, the fixed default value of 10_000_000
is used. This is not correct anymore and the gas limit should be estimated using zks_estimateGasL1toL2. The provider does not have this RPC method implemented yet, but it will be implemented in the upcoming release.
from zksync2-python.
Gas estimation on mainnet does not work. Temporary solution is to estimate gas on testnet and set gasLimit
value for transactions that needs to be broadcasted to mainnet.
from zksync2-python.
Use web bridge zksync, transfer 0.001 ETH,The ETH cost is 0.00155528 ETH
But using the Python SDK, I found that the same amount of transfer The ETH cost is 0.006 ETH
It can be said that there is a big difference, so to solve this problem, you need to pass the gas_limit parameter
eth_provider.deposit(token=Token.create_eth(),
to=to,
amount=Web3.to_wei(amount, 'ether'),
l2_gas_limit=1123680,
gas_limit=200000,
gas_price=int(eth_web3.eth.gas_price * 1.2))
At the same time, I found another problem, it may be a bug, the gas_limit
should be l2_gas_limit
, Why? it can be found through the contract, the base cost is : l2GasPrice * _l2GasLimit
/// @notice Estimates the cost in Ether of requesting execution of an L2 transaction from L1
/// @return The estimated L2 gas for the transaction to be paid
function l2TransactionBaseCost(
uint256 _gasPrice,
uint256 _l2GasLimit,
uint256 _l2GasPerPubdataByteLimit
) public pure returns (uint256) {
uint256 l2GasPrice = _deriveL2GasPrice(_gasPrice, _l2GasPerPubdataByteLimit);
return l2GasPrice * _l2GasLimit;
}
/zksync2/provider/eth_provider.py
base_cost = self.get_base_cost(gas_price=gas_price,
gas_per_pubdata_byte=gas_per_pubdata_byte,
gas_limit=gas_limit)
from zksync2-python.
Any news, or plan to share with us? :)
from zksync2-python.
The issues are resolved in version 1.0.0
. To use the SDK, please refer to the documentation and examples.
from zksync2-python.
Related Issues (20)
- The block explorer always says "Fail with error 'mv'" error HOT 8
- timeout with withdraw HOT 3
- insufficient funds HOT 3
- deposit.py module errors HOT 2
- Issues when interacting with a local node HOT 1
- Example deposit testnet transaction fails on chain: "Fail with error 'qp'" HOT 7
- Unable to install zksync2-python SDK on Python 3.10 on Mac HOT 3
- eth_estimate_gas always return web3.exceptions.ContractLogicError: execution reverted: Failed to submit transaction: cannot estimate gas HOT 4
- version on pypi 0.4.0 while there is 0.5.0 available HOT 1
- pip install zksync2 fail HOT 2
- INTERNAL_ERROR: insufficient funds HOT 1
- transfer eth {'code': 3, 'message': 'failed to validate the transaction. reason: Validation revert: Failed to pay for the transaction: Failed to pay the fee to the operator', 'data': '0x'}
- Unable to verify compiled and deployed contract HOT 1
- Make target fails with: 17.62 Processing pydantic_core-2.4.0.tar.gz HOT 1
- eth_estimate_gas error in testnet HOT 3
- pysha3 conflict HOT 5
- web3 version dependency has a bug HOT 4
- The automated release is failing 🚨
- txn 113 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zksync2-python.