Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Properly derive string representation for Ethereum typed txs when tx is not signed #2129

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

2dvorak
Copy link
Collaborator

@2dvorak 2dvorak commented Apr 4, 2024

Proposed changes

  • Currently, tx.String() returns error message if tx is not signed (Eth typed txs only)
    • The following code prints out tx: %!v(PANIC=String method: runtime error: invalid memory address or nil pointer dereference)
      fmt.Printf("tx: %v\n", NewTx(&TxInternalDataEthereumDynamicFee{Amount: big.NewInt(0)}))
      
    • This is because it cannot derive from address using recovery ID (which is empty).
  • Add check for nil recovery ID, and fill from with proper string replacement

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Currently, tx.String() returns error message if tx is not signed.
@2dvorak 2dvorak self-assigned this Apr 4, 2024
@2dvorak 2dvorak changed the title Properly derive string representation for Ethereum typed txs when tx signature is nil Properly derive string representation for Ethereum typed txs when tx is not signed Apr 4, 2024
@2dvorak 2dvorak merged commit e051004 into klaytn:dev Apr 22, 2024
11 checks passed
@2dvorak 2dvorak deleted the 2dvorak/eth-tx-string-fix branch April 22, 2024 02:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants