Skip to content

Commit

Permalink
Removed CoWasm signature extraction when creating corresponding EVM t…
Browse files Browse the repository at this point in the history
…ransaction

This wasn't validated so in doubt, it's preferable to avoid setting it in the block. Same thing for `input`, didn't got the time to complete this.
  • Loading branch information
maoueh committed Aug 7, 2024
1 parent cf1d6b5 commit c08751e
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions x/evm/tracers/firehose.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"sync/atomic"
"time"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
Expand Down Expand Up @@ -855,26 +854,21 @@ func (f *Firehose) onPostTxCosmosEventsCoWasmTx(event seitracing.SeiPostTxCosmos
To: to.Bytes(),
}

if isFirehoseInfoEnabled {
// Logging to check if we could bridge CoWasm to EVM input
for _, msg := range event.Tx.GetMsgs() {
if v, ok := msg.(*wasmtypes.MsgExecuteContract); ok {
firehoseInfo("input from CoWasm transaction (input=%s)", string(v.Msg))
break
}
}
}

if sigTx, ok := event.Tx.(authsigning.SigVerifiableTx); ok && len(sigTx.GetSigners()) > 0 {
if r, s, v, data, err := extractCoWasmTxFirstSignature(sigTx); err != nil {
firehoseInfo("signature from CoWasm transaction (error=%s)", err)
} else {
firehoseInfo("signature from CoWasm transaction (r=%s, s=%s, v=%d, cowasm{signature=%s, sign_mode=%d))", byteView(r), byteView(s), byteView(v), byteView(data.Signature), data.SignMode)
f.transaction.R = normalizeSignaturePoint(r)
f.transaction.S = normalizeSignaturePoint(s)
f.transaction.V = emptyBytesToNil(v)
}
}
_ = extractCoWasmTxFirstSignature
// We haven't got the time to get this validated by Sei team if it was to correct way to extract
// R, S and V from the CoWasm transaction, so we are commenting it out for now. The R and S seems
// correct but the way to extract V is not clear, current logic in 'extractCoWasmTxFirstSignature'
// seems broken.
// if sigTx, ok := event.Tx.(authsigning.SigVerifiableTx); ok && len(sigTx.GetSigners()) > 0 {
// if r, s, v, data, err := extractCoWasmTxFirstSignature(sigTx); err != nil {
// firehoseInfo("signature from CoWasm transaction (error=%s)", err)
// } else {
// firehoseInfo("signature from CoWasm transaction (r=%s, s=%s, v=%d, cowasm{signature=%s, sign_mode=%d))", byteView(r), byteView(s), byteView(v), byteView(data.Signature), data.SignMode)
// f.transaction.R = normalizeSignaturePoint(r)
// f.transaction.S = normalizeSignaturePoint(s)
// f.transaction.V = emptyBytesToNil(v)
// }
// }

f.OnCallEnter(0, 0, from, to, f.transaction.Input, f.transaction.GasLimit, nil)
for _, addedLog := range event.AddedLogs {
Expand Down

0 comments on commit c08751e

Please sign in to comment.