Skip to content

Commit

Permalink
wip: update message signer
Browse files Browse the repository at this point in the history
  • Loading branch information
boodyvo committed Nov 1, 2024
1 parent ca5f805 commit 3e698f0
Showing 1 changed file with 21 additions and 32 deletions.
53 changes: 21 additions & 32 deletions x/evm/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
protov1 "github.com/golang/protobuf/proto" //nolint:staticcheck
protov2 "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/protoadapt"
anypb "google.golang.org/protobuf/types/known/anypb"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
Expand Down Expand Up @@ -386,59 +387,47 @@ func GetSigners(msg protov2.Message) ([][]byte, error) {
// return nil, err
//}

anypb.Any{}.UnmarshalTo()

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

cannot call pointer method UnmarshalTo on anypb.Any (typecheck)

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

cannot call pointer method UnmarshalTo on anypb.Any) (typecheck)

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

cannot call pointer method UnmarshalTo on anypb.Any) (typecheck)

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

cannot call pointer method UnmarshalTo on anypb.Any) (typecheck)

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

cannot call pointer method UnmarshalTo on anypb.Any) (typecheck)

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / build

cannot call pointer method UnmarshalTo on anypb.Any

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / test-importer

cannot call pointer method UnmarshalTo on anypb.Any

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / test-rpc

cannot call pointer method UnmarshalTo on anypb.Any

Check failure on line 390 in x/evm/types/msg.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

cannot call pointer method UnmarshalTo on anypb.Any
tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1)
fmt.Println("Eth message tryingTypeAnyV1", tryingTypeAnyV1)
if err != nil {
fmt.Println("Eth message tryingTypeAnyV1 error", err)
}

msgTyped := &MsgEthereumTx{}
err = msgTyped.Unmarshal(tryingTypeAnyV1.Value)
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx", msgTyped)
if err != nil {
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx error", err)
}
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx data", msgTyped.Data)
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx data type", msgTyped.Data.TypeUrl)

var data TxData
switch {
case tryingTypeAnyV1.TypeUrl == "/ethermint.evm.v1.DynamicFeeTx":
msgTyped := &DynamicFeeTx{}
err = msgTyped.Unmarshal(tryingTypeAnyV1.Value)
case msgTyped.Data.TypeUrl == "/ethermint.evm.v1.DynamicFeeTx":
msgTyped2 := &DynamicFeeTx{}
err = msgTyped2.Unmarshal(msgTyped.Data.Value)
fmt.Println("Eth message tryingTypeAnyV1 DynamicFeeTx", msgTyped)
if err != nil {
fmt.Println("Eth message tryingTypeAnyV1 DynamicFeeTx error", err)
}
case tryingTypeAnyV1.TypeUrl == "/ethermint.evm.v1.AccessListTx":
msgTyped := &AccessListTx{}
err = msgTyped.Unmarshal(tryingTypeAnyV1.Value)
case msgTyped.Data.TypeUrl == "/ethermint.evm.v1.AccessListTx":
msgTyped2 := &AccessListTx{}
err = msgTyped2.Unmarshal(msgTyped.Data.Value)
fmt.Println("Eth message tryingTypeAnyV1 AccessListTx", msgTyped)
if err != nil {
fmt.Println("Eth message tryingTypeAnyV1 AccessListTx error", err)
}
case tryingTypeAnyV1.TypeUrl == "/ethermint.evm.v1.LegacyTx":
msgTyped := &LegacyTx{}
err = msgTyped.Unmarshal(tryingTypeAnyV1.Value)
case msgTyped.Data.TypeUrl == "/ethermint.evm.v1.LegacyTx":
msgTyped2 := &LegacyTx{}
err = msgTyped2.Unmarshal(msgTyped.Data.Value)
fmt.Println("Eth message tryingTypeAnyV1 LegacyTx", msgTyped)
if err != nil {
fmt.Println("Eth message tryingTypeAnyV1 LegacyTx error", err)
}
case tryingTypeAnyV1.TypeUrl == "/ethermint.evm.v1.MsgEthereumTx":
msgTyped := &MsgEthereumTx{}
err = msgTyped.Unmarshal(tryingTypeAnyV1.Value)
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx", msgTyped)
if err != nil {
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx error", err)
}
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx data", msgTyped.Data)
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx data type", msgTyped.Data.TypeUrl)

data, err = UnpackTxData(msgTyped.Data)
if err != nil {
fmt.Println("Eth message tryingTypeAnyV1 MsgEthereumTx data error", err)
}

sender, err := msgEthTx.GetSender(data.GetChainID())
if err != nil {
return nil, err
}

signer := sdk.AccAddress(sender.Bytes())
return [][]byte{signer}, nil
default:
fmt.Println("Eth message tryingTypeAnyV1 unknown")
fmt.Println("Eth message msgTyped.Data.TypeUrl unknown")
}

//data, err := UnpackTxData(tryingTypeAnyV1)
Expand Down

0 comments on commit 3e698f0

Please sign in to comment.