Skip to content

Commit

Permalink
open up anvil args (ethereum-optimism#13320)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Slipper <[email protected]>
  • Loading branch information
ControlCplusControlV and mslipper authored Dec 9, 2024
1 parent 70e71c2 commit 2bdb818
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions op-service/testutils/anvil/anvil.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,21 @@ type Runner struct {
}

func New(l1RPCURL string, logger log.Logger) (*Runner, error) {
return NewWithOpts(l1RPCURL, "1000000000", logger)
}

func NewWithOpts(l1RPCURL string, baseFee string, logger log.Logger) (*Runner, error) {
if _, err := exec.LookPath("anvil"); err != nil {
return nil, fmt.Errorf("anvil not found in PATH: %w", err)
}

proc := exec.Command(
"anvil",
"--fork-url", l1RPCURL,
"--port",
"0",
"--base-fee",
"1000000000",
)
args := []string{"--port", "0", "--base-fee", baseFee}
if l1RPCURL != "" {
args = append([]string{"--fork-url", l1RPCURL}, args...)
}

proc := exec.Command("anvil", args...)

stdout, err := proc.StdoutPipe()
if err != nil {
return nil, err
Expand Down

0 comments on commit 2bdb818

Please sign in to comment.