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 panic on send tx #139

Merged
merged 4 commits into from
Mar 6, 2024
Merged

Conversation

uri-lightblocks
Copy link
Contributor

How to recreate

prepare and send a transaction with the wrong chainID

Motivation

This fixes a panic

2024-03-05T19:45:30.775Z        DEBUG   logging/zap_logger.go:45        Estimating gas and nonce
2024-03-05T19:45:30.952Z        DEBUG   logging/zap_logger.go:45        Getting signer for tx
2024-03-05T19:45:30.952Z        DEBUG   logging/zap_logger.go:45        Sending transaction
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x65cda4]

goroutine 1 [running]:
github.com/ethereum/go-ethereum/core/types.(*Transaction).Hash(0x2a4?)
        /root/go/pkg/mod/github.com/ethereum/go-ethereum@v1.13.14/core/types/transaction.go:464 +0x24
github.com/Layr-Labs/eigensdk-go/chainio/clients/wallet.(*privateKeyWallet).SendTransaction(0x4000427900, {0xc0dc08, 0x109f7e0}, 0x0?)
        /root/go/pkg/mod/github.com/!layr-!labs/eigensdk-go@v0.1.2-0.20240305012634-36a80cc83d6e/chainio/clients/wallet/privatekey_wallet.go:84 +0x52c
github.com/Layr-Labs/eigensdk-go/chainio/txmgr.(*SimpleTxManager).Send(0x4000527888, {0xc0dc08, 0x109f7e0}, 0x4000248570?)
        /root/go/pkg/mod/github.com/!layr-!labs/eigensdk-go@v0.1.2-0.20240305012634-36a80cc83d6e/chainio/txmgr/txmgr.go:68 +0x38
...

Solution

print the hash of the input transaction
(EXTRA *errors.errorString=send: tx 0xaa2ed977c171484f812f37baac53b3fc10358f3d9ba10b958b4ca0983c0aaaea failed.: invalid chain id for signer)

if contract.RawTransact fail, it overrides the `tx` and the tx.hash is nil.
If it fails we can use the hash of the transaction that was passed as the argument and print its hash
Copy link
Collaborator

@samlaf samlaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Uri :)

@samlaf samlaf merged commit 93fddac into Layr-Labs:master Mar 6, 2024
2 of 3 checks passed
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