Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
etherman test created with the exception of a few cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nivida committed Dec 13, 2023
1 parent 4dfa4af commit fef3231
Show file tree
Hide file tree
Showing 3 changed files with 779 additions and 79 deletions.
8 changes: 4 additions & 4 deletions etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/jackc/pgx/v4"
)

type Etherman struct {
Expand All @@ -36,7 +35,7 @@ func (e *Etherman) GetSequencerAddr(l1Contract common.Address) (common.Address,
return common.Address{}, err
}

return contract.TrustedSequencer(&bind.CallOpts{Pending: false}), nil
return contract.TrustedSequencer(&bind.CallOpts{Pending: false})
}

func (e *Etherman) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, proof tx.ZKP) (data []byte, err error) {
Expand Down Expand Up @@ -148,7 +147,7 @@ func (e *Etherman) EstimateGas(ctx context.Context, from common.Address, to *com
}

// SignTx tries to sign a transaction accordingly to the provided sender
func (e *Etherman) SignTx(ctx context.Context, sender common.Address, tx *types.Transaction) (*types.Transaction, error) {
func (e *Etherman) SignTx(tx *types.Transaction) (*types.Transaction, error) {
return e.auth.Signer(e.auth.From, tx)
}

Expand All @@ -165,6 +164,7 @@ func (e *Etherman) GetRevertMessage(ctx context.Context, tx *types.Transaction)

if receipt.Status == types.ReceiptStatusFailed {
revertMessage, err := operations.RevertReason(ctx, e.ethClient, tx, receipt.BlockNumber)

if err != nil {
return "", err
}
Expand All @@ -173,7 +173,7 @@ func (e *Etherman) GetRevertMessage(ctx context.Context, tx *types.Transaction)
return "", nil
}

func (e *Etherman) GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error) {
func (e *Etherman) GetLastBlock(ctx context.Context) (*state.Block, error) {
block, err := e.ethClient.BlockByNumber(ctx, nil)
if err != nil {
return nil, err
Expand Down
Loading

0 comments on commit fef3231

Please sign in to comment.