Skip to content

Commit c0b4b2b

Browse files
authored
Update api.go
1 parent e7f46d0 commit c0b4b2b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

signer/core/api.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -497,19 +497,21 @@ func logDiff(original *SignTxRequest, new *SignTxResponse) bool {
497497
modified = true
498498
log.Info("Value changed by UI", "was", v0, "is", v1)
499499
}
500-
if d0, d1 := original.Transaction.Data, new.Transaction.Data; d0 != d1 {
501-
d0s := ""
502-
d1s := ""
503-
if d0 != nil {
504-
d0s = hexutil.Encode(*d0)
505-
}
506-
if d1 != nil {
507-
d1s = hexutil.Encode(*d1)
508-
}
509-
if d1s != d0s {
510-
modified = true
511-
log.Info("Data changed by UI", "was", d0s, "is", d1s)
512-
}
500+
// Compare effective calldata (prefer Input over Data)
501+
var oldData, newData []byte
502+
if original.Transaction.Input != nil {
503+
oldData = *original.Transaction.Input
504+
} else if original.Transaction.Data != nil {
505+
oldData = *original.Transaction.Data
506+
}
507+
if new.Transaction.Input != nil {
508+
newData = *new.Transaction.Input
509+
} else if new.Transaction.Data != nil {
510+
newData = *new.Transaction.Data
511+
}
512+
if !bytes.Equal(oldData, newData) {
513+
modified = true
514+
log.Info("Data changed by UI", "was", hexutil.Encode(oldData), "is", hexutil.Encode(newData))
513515
}
514516
if n0, n1 := original.Transaction.Nonce, new.Transaction.Nonce; n0 != n1 {
515517
modified = true

0 commit comments

Comments
 (0)