Skip to content

Commit

Permalink
Use MakeSigner instead of NewCancunSigner
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkushinDaniil committed Sep 18, 2024
1 parent 6b3f0e7 commit 61eafdd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
23 changes: 23 additions & 0 deletions monomer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"github.com/polymerdao/monomer/utils"
)

type Application interface {
Expand Down Expand Up @@ -214,3 +216,24 @@ func ValidForkchoiceUpdateResult(headBlockHash *common.Hash, id *engine.PayloadI
PayloadID: id,
}
}

func NewChainConfig(chainID *big.Int) *params.ChainConfig {
return &params.ChainConfig{
ChainID: chainID,

ByzantiumBlock: new(big.Int),
ConstantinopleBlock: new(big.Int),
PetersburgBlock: new(big.Int),
IstanbulBlock: new(big.Int),
MuirGlacierBlock: new(big.Int),
BerlinBlock: new(big.Int),
LondonBlock: new(big.Int),
ArrowGlacierBlock: new(big.Int),
GrayGlacierBlock: new(big.Int),
MergeNetsplitBlock: new(big.Int),

BedrockBlock: new(big.Int),
RegolithTime: utils.Ptr(uint64(0)),
CanyonTime: utils.Ptr(uint64(0)),
}
}
8 changes: 7 additions & 1 deletion x/rollup/keeper/deposits.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package keeper
import (
"encoding/json"
"fmt"
"math/big"

sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/common/hexutil"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/polymerdao/monomer"
"github.com/polymerdao/monomer/utils"
"github.com/polymerdao/monomer/x/rollup/types"
"github.com/samber/lo"
Expand Down Expand Up @@ -78,7 +80,11 @@ func (k *Keeper) processL1UserDepositTxs(ctx sdk.Context, txs [][]byte) (sdk.Eve
}

// Get the sender's address from the transaction
from, err := ethtypes.NewCancunSigner(tx.ChainId()).Sender(&tx)
from, err := ethtypes.MakeSigner(
monomer.NewChainConfig(tx.ChainId()),
big.NewInt(ctx.BlockHeight()),
uint64(ctx.BlockTime().Unix()),
).Sender(&tx)
if err != nil {
ctx.Logger().Error("Failed to get sender address", "evmAddress", from, "err", err)
return nil, types.WrapError(types.ErrInvalidL1Txs, "failed to get sender address: %v", err)
Expand Down

0 comments on commit 61eafdd

Please sign in to comment.