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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions blockchain/types/tx_internal_data_ethereum_access_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,15 @@ func (t *TxInternalDataEthereumAccessList) String() string {

v, r, s := t.V, t.R, t.S

signer := LatestSignerForChainID(t.ChainId())
if f, err := Sender(signer, tx); err != nil { // derive but don't cache
from = "[invalid sender: invalid sig]"
if v != nil {
signer := LatestSignerForChainID(t.ChainId())
if f, err := Sender(signer, tx); err != nil { // derive but don't cache
from = "[invalid sender: invalid sig]"
} else {
from = fmt.Sprintf("%x", f[:])
}
} else {
from = fmt.Sprintf("%x", f[:])
from = "[invalid sender: nil V field]"
}

if t.GetRecipient() == nil {
Expand Down
13 changes: 8 additions & 5 deletions blockchain/types/tx_internal_data_ethereum_dynamic_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,15 @@ func (t *TxInternalDataEthereumDynamicFee) String() string {
tx := &Transaction{data: t}

v, r, s := t.V, t.R, t.S

signer := LatestSignerForChainID(t.ChainId())
if f, err := Sender(signer, tx); err != nil { // derive but don't cache
from = "[invalid sender: invalid sig]"
if v != nil {
signer := LatestSignerForChainID(t.ChainId())
if f, err := Sender(signer, tx); err != nil { // derive but don't cache
from = "[invalid sender: invalid sig]"
} else {
from = fmt.Sprintf("%x", f[:])
}
} else {
from = fmt.Sprintf("%x", f[:])
from = "[invalid sender: nil V field]"
}

if t.GetRecipient() == nil {
Expand Down
Loading