Skip to content

Commit

Permalink
feat(taiko-client): Revert access list (#13)
Browse files Browse the repository at this point in the history
* Revert "feat(txmgr): Ignore empty storage keys to save more gas (#12)"

This reverts commit 1470fa7.

* Revert "feat(txmgr): compare gasUsed and estimateGas (#11)"

This reverts commit 7871b0e.

* Revert "fix(txmgr): fix cli build (#10)"

This reverts commit a2b9191.

* Revert "feat(txmgr): call `CreateAccessList` (#9)"

This reverts commit 6873eca.

* Revert "feat(txmgr): introduce `AccessList` in `TxCandidate` (#7)"

This reverts commit 43346f1.
  • Loading branch information
YoGhurt111 authored Jun 27, 2024
1 parent 1470fa7 commit 4845247
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 216 deletions.
3 changes: 2 additions & 1 deletion op-service/txmgr/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ethereum-optimism/optimism/op-service/eth"
opsigner "github.com/ethereum-optimism/optimism/op-service/signer"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli/v2"
)
Expand Down Expand Up @@ -289,7 +290,7 @@ func NewConfig(cfg CLIConfig, l log.Logger) (Config, error) {

ctx, cancel := context.WithTimeout(context.Background(), cfg.NetworkTimeout)
defer cancel()
l1, err := NewEthClient(ctx, cfg.L1RPCURL)
l1, err := ethclient.DialContext(ctx, cfg.L1RPCURL)
if err != nil {
return Config{}, fmt.Errorf("could not dial eth client: %w", err)
}
Expand Down
175 changes: 0 additions & 175 deletions op-service/txmgr/eth_client.go

This file was deleted.

56 changes: 16 additions & 40 deletions op-service/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ type ETHBackend interface {
// EstimateGas returns an estimate of the amount of gas needed to execute the given
// transaction against the current pending block.
EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
// CreateAccessList returns an estimate of the AccessList
CreateAccessList(ctx context.Context, msg ethereum.CallMsg) (*types.AccessList, uint64, string, error)
// Close the underlying eth connection
Close()
}
Expand Down Expand Up @@ -198,8 +196,6 @@ type TxCandidate struct {
GasLimit uint64
// Value is the value to be used in the constructed tx.
Value *big.Int
// AccessList is an EIP-2930 access list to be used in the constructed tx.
AccessList types.AccessList
}

// Send is used to publish a transaction with incrementally higher gas prices
Expand Down Expand Up @@ -266,22 +262,17 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*

gasLimit := candidate.GasLimit

callArgs := ethereum.CallMsg{
From: m.cfg.From,
To: candidate.To,
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Data: candidate.TxData,
Value: candidate.Value,
}
// Set includeAccessList as default
includeAccessList := true
providedAccessList, gasUsed, _, err := m.backend.CreateAccessList(ctx, callArgs)
if err != nil {
return nil, err
}
// If the gas limit is set, we can use that as the gas
if gasLimit == 0 {
callArgs := ethereum.CallMsg{
From: m.cfg.From,
To: candidate.To,
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Data: candidate.TxData,
Value: candidate.Value,
}

for _, blob := range candidate.Blobs {
commitment, err := blob.ComputeKZGCommitment()
if err != nil {
Expand All @@ -299,9 +290,6 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
if err != nil {
return nil, fmt.Errorf("failed to estimate gas: %w", errutil.TryAddRevertReason(err))
}
if gasUsed >= gas {
includeAccessList = false
}
gasLimit = gas
}

Expand All @@ -316,16 +304,6 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
}
}

accessList := &types.AccessList{}
if includeAccessList {
for _, tuple := range *providedAccessList {
// Ignore empty storage keys to save more gas
if len(tuple.StorageKeys) > 0 {
*accessList = append(*accessList, tuple)
}
}
}

var txMessage types.TxData
if sidecar != nil {
if blobBaseFee == nil {
Expand All @@ -338,22 +316,20 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
Gas: gasLimit,
BlobHashes: blobHashes,
Sidecar: sidecar,
AccessList: *accessList,
}
if err := finishBlobTx(message, m.chainID, gasTipCap, gasFeeCap, blobFeeCap, candidate.Value); err != nil {
return nil, fmt.Errorf("failed to create blob transaction: %w", err)
}
txMessage = message
} else {
txMessage = &types.DynamicFeeTx{
ChainID: m.chainID,
To: candidate.To,
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Value: candidate.Value,
Data: candidate.TxData,
Gas: gasLimit,
AccessList: *accessList,
ChainID: m.chainID,
To: candidate.To,
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Value: candidate.Value,
Data: candidate.TxData,
Gas: gasLimit,
}
}
return m.signWithNextNonce(ctx, txMessage) // signer sets the nonce field of the tx
Expand Down

0 comments on commit 4845247

Please sign in to comment.