Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require (
github.com/btcsuite/btcd/btcutil v1.1.6
github.com/bygui86/multi-profile/v2 v2.1.0
github.com/coder/websocket v1.8.13
github.com/consensys/gnark-crypto v0.19.0
github.com/dustin/go-humanize v1.0.1
github.com/ethereum/go-ethereum v1.15.5
github.com/golang-jwt/jwt/v5 v5.2.2
Expand Down Expand Up @@ -83,7 +84,6 @@ require (
github.com/bits-and-blooms/bitset v1.22.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/consensys/gnark-crypto v0.18.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
Expand Down
30 changes: 28 additions & 2 deletions go.sum

Large diffs are not rendered by default.

809 changes: 458 additions & 351 deletions go.work.sum

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion packages/evm/evmutil/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import (
)

func Signer(chainID *big.Int) types.Signer {
return types.NewEIP155Signer(chainID)
// Handle pre-EIP-155 transactions (chainID 0 or nil)
if chainID == nil || chainID.Sign() == 0 {
return types.HomesteadSigner{}
}
return types.NewPragueSigner(chainID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the consequence of changing this? Can it affect tracing old transactions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It supports old transactions here is the snippet from https://github.com/ethereum/go-ethereum/blob/ca6e2d141b14e67d2ba826c6213e9e413148b6ec/core/types/transaction_signing.go#L279

// NewPragueSigner returns a signer that accepts
// - EIP-7702 set code transactions
// - EIP-4844 blob transactions
// - EIP-1559 dynamic fee transactions
// - EIP-2930 access list transactions,
// - EIP-155 replay protected transactions, and
// - legacy Homestead transactions.
func NewPragueSigner(chainId *big.Int) Signer {
	return newModernSigner(chainId, forks.Prague)
}

And in func newModernSigner(chainID *big.Int, fork forks.Fork) Signer
it set up the legacy signer as we are doing right now

// configure legacy signer
	switch {
	case fork >= forks.SpuriousDragon:
		s.legacy = NewEIP155Signer(chainID)

So it will use EIP155 signer for legacy tx, and other signers in the corresponding scenarios

I have change the signer of a test to get the prague signer, and it works well

}

func GetSender(tx *types.Transaction) (common.Address, error) {
Expand Down
27 changes: 25 additions & 2 deletions packages/evm/jsonrpc/evmchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,27 @@ func (e *EVMChain) SendTransaction(tx *types.Transaction) error {
}

gasFeePolicy := e.GasFeePolicy()
if err := evmutil.CheckGasPrice(tx.GasPrice(), gasFeePolicy); err != nil {
return err

// Validate gas pricing based on transaction type
if tx.Type() == types.LegacyTxType {
// For legacy and access list transactions, use the gas price
if err := evmutil.CheckGasPrice(tx.GasPrice(), gasFeePolicy); err != nil {
return err
}
} else {
// For EIP-1559-family (0x02, 0x03, 0x04) transactions, validate the fee cap
if err := evmutil.CheckGasPrice(tx.GasTipCap(), gasFeePolicy); err != nil {
return err
}
}

// extra check for blob transaction, we use the same min gas fee for blob gas too
if tx.Type() == types.BlobTxType {
if err := evmutil.CheckGasPrice(tx.BlobGasFeeCap(), gasFeePolicy); err != nil {
return err
}
}

if err := e.checkEnoughL2FundsForGasBudget(sender, tx, gasFeePolicy); err != nil {
return err
}
Expand Down Expand Up @@ -495,6 +513,11 @@ func (e *EVMChain) GasPrice() *big.Int {
return e.GasFeePolicy().DefaultGasPriceFullDecimals(parameters.BaseTokenDecimals)
}

func (e *EVMChain) PriorityFeePerGas() *big.Int {
e.log.LogDebugf("PriorityFeePerGas()")
return e.GasFeePolicy().DefaultGasPriceFullDecimals(parameters.BaseTokenDecimals)
}

func (e *EVMChain) StorageAt(address common.Address, key common.Hash, blockNumberOrHash *rpc.BlockNumberOrHash) (common.Hash, error) {
e.log.LogDebugf("StorageAt(address=%v, key=%v, blockNumberOrHash=%v)", address, key, blockNumberOrHash)
chainState, err := e.iscStateFromEVMBlockNumberOrHash(blockNumberOrHash)
Expand Down
Loading
Loading