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

broadcastTransaction breaks contract by returning TransactionResponse with missing values #224

Closed
everdimension opened this issue Dec 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@everdimension
Copy link

everdimension commented Dec 5, 2024

🐛 Bug Report for zksync-ethers JavaScript SDK

📝 Description

broadcastTransaction promises to return TransactionResponse:

export class TransactionResponse extends ethers.TransactionResponse {

It in fact returns an object that doesn't satisfy this type (e.g. blockNumber, blockHash and gasPrice values are null, but must be defined):

{
    "_type": "TransactionResponse",
    "accessList": [],
    "blockNumber": null,
    "blockHash": null,
    "blobVersionedHashes": null,
    "chainId": "8453",
    "data": "0x...",
    "from": "0x...",
    "gasLimit": "559823",
    "gasPrice": null,
    "hash": "0x...",
    "maxFeePerGas": "63309540",
    "maxPriorityFeePerGas": "1000000",
    "maxFeePerBlobGas": null,
    "nonce": 448,
    "signature": {
       ...
    },
    "to": "0x...",
    "type": 2,
    "value": "0"
}

🤔 Expected Behavior

The library is expected to honour the types it provides

😯 Current Behavior

It doesn't.

🖥️ Environment

"zksync-ethers": "^6.15.2"

📋 Additional Context

Browser: Chrome

@everdimension everdimension added the bug Something isn't working label Dec 5, 2024
@petarTxFusion
Copy link
Contributor

petarTxFusion commented Dec 6, 2024

We have tried calling paymaster on test net and main net as well as local setup and everything worked. Also you need to wait for transaction, some fields like block number will be null until its not mined on L2. Difference between transactionReceipt and transactionResponse that response has transaction hash which you can use to wait for certain states of transaction and you can get transactionReceipt only of already mined transaction.
Here you can check how we use wait() :

const result = await tx.wait();

Here you can check wait function:
override async wait(

Also you have waitFinalized() which will wait for transaction to be finalized on L1 but on main and test net that could be few hours:
await withdrawTx.waitFinalize();

Test net tx: https://sepolia.explorer.zksync.io/tx/0xd6ca0cde42c6436811885efa8706d91ab5312d55699d605788e065cb4ead5be8
Main net tx: https://explorer.zksync.io/tx/0x869dd2969ac6d5557fba849800b7973a6a136a166b5814ee81215ff44f037c91

@everdimension
Copy link
Author

I see this is the ethers problem, it also returns null for the properties that are typed to be required.
I createn an issue in ethers repo: ethers-io/ethers.js#4891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants