Skip to content

Commit

Permalink
Merge pull request #123 from SigmaGmbH/refactor/disable-eip712
Browse files Browse the repository at this point in the history
Refactor/disable eip712
  • Loading branch information
MikkySnow authored Jul 24, 2024
2 parents 3f8969c + 4efb6ef commit cb7d913
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 1,954 deletions.
3 changes: 0 additions & 3 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
case "/ethermint.evm.v1.ExtensionOptionsEthereumTx":
// handle as *evmtypes.MsgHandleTx
anteHandler = NewEthAnteHandler(options)
case "/ethermint.types.v1.ExtensionOptionsWeb3Tx":
// Deprecated: Handle as normal Cosmos SDK tx, except signature is checked for Legacy EIP712 representation
anteHandler = NewLegacyCosmosAnteHandlerEip712(options)
case "/ethermint.types.v1.ExtensionOptionDynamicFeeTx":
// cosmos-sdk tx with dynamic fee extension
anteHandler = NewCosmosAnteHandler(options)
Expand Down
326 changes: 0 additions & 326 deletions app/ante/eip712.go

This file was deleted.

15 changes: 1 addition & 14 deletions app/ante/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
ante "swisstronik/app/ante"
"swisstronik/crypto/ethsecp256k1"
"swisstronik/encoding"
"swisstronik/ethereum/eip712"
"swisstronik/tests"
"swisstronik/types"
"swisstronik/utils"
Expand All @@ -56,9 +55,6 @@ type AnteTestSuite struct {
enableLondonHF bool
evmParamsOption func(*evmtypes.Params)
priv *ethsecp256k1.PrivKey

useLegacyEIP712Extension bool
useLegacyEIP712TypedData bool
}

const TestGasLimit uint64 = 100000
Expand Down Expand Up @@ -122,7 +118,6 @@ func (suite *AnteTestSuite) SetupTest() {
encodingConfig := encoding.MakeConfig(app.ModuleBasics)
// We're using TestMsg amino encoding in some tests, so register it here.
encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil)
eip712.SetEncodingConfig(encodingConfig)

suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig)
suite.Require().NotNil(suite.app.AppCodec())
Expand Down Expand Up @@ -332,18 +327,10 @@ func (suite *AnteTestSuite) GenerateMultipleKeys(n int) ([]cryptotypes.PrivKey,

// generateSingleSignature signs the given sign doc bytes using the given signType (EIP-712 or Standard)
func (suite *AnteTestSuite) generateSingleSignature(signMode signing.SignMode, privKey cryptotypes.PrivKey, signDocBytes []byte, signType string) (signature signing.SignatureV2) {
var (
msg []byte
err error
)
var msg []byte

msg = signDocBytes

if signType == "EIP-712" {
msg, err = eip712.GetEIP712BytesForMsg(signDocBytes)
suite.Require().NoError(err)
}

sigBytes, _ := privKey.Sign(msg)
sigData := &signing.SingleSignatureData{
SignMode: signMode,
Expand Down
3 changes: 0 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ import (
"swisstronik/app/upgrades/v1_0_3"
"swisstronik/docs"
"swisstronik/encoding"
"swisstronik/ethereum/eip712"
srvflags "swisstronik/server/flags"
evmcommontypes "swisstronik/types"
compliancemodule "swisstronik/x/compliance"
Expand Down Expand Up @@ -304,8 +303,6 @@ func New(
cdc := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

eip712.SetEncodingConfig(encodingConfig)

// Setup Mempool and Proposal Handlers
baseAppOptions = append(baseAppOptions, func(app *baseapp.BaseApp) {
mempool := mempool.NoOpMempool{}
Expand Down
Loading

0 comments on commit cb7d913

Please sign in to comment.