Skip to content

Commit

Permalink
Misc inabox improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyknox committed Dec 6, 2023
1 parent 7178dcc commit 9a39816
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
36 changes: 15 additions & 21 deletions inabox/deploy/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -103,17 +104,12 @@ func execYarnCmd(command string) {

cmd := exec.Command("yarn", command)

var out bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = &stderr
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

err := cmd.Run()
if err != nil {
log.Print(fmt.Sprint(err) + ": " + stderr.String())
log.Panicf("Failed to execute yarn command (%s). Err: %s", command, err)
} else {
log.Print(out.String())
}

log.Print("yarn command ran succesfully")
Expand Down Expand Up @@ -154,17 +150,12 @@ func execForgeScript(script, privateKey string, deployer *ContractDeployer, extr
cmd = exec.Command("forge", args...)
}

var out bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = &stderr
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stdin

err := cmd.Run()
if err != nil {
log.Print(fmt.Sprint(err) + ": " + stderr.String())
log.Panicf("Failed to execute forge script. Err: %s", err)
} else {
log.Print(out.String())
}

log.Print("Forge script ran succesfully!")
Expand Down Expand Up @@ -301,16 +292,19 @@ func execCmd(name string, args []string, envVars []string) error {
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, envVars...)
}
var out bytes.Buffer
var stderr bytes.Buffer
// TODO: When these are uncommented, the deployer sometimes fails to start anvil
// cmd.Stdout = &out
// cmd.Stderr = &stderr

cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

err := cmd.Run()
if err != nil {
return fmt.Errorf("%s: %s", err.Error(), stderr.String())
return err
}
fmt.Print(out.String())
return nil
}

func removeANSIColorCodes(input []byte) []byte {
// Regular expression to match ANSI escape codes
re := regexp.MustCompile(`\x1b\[[0-9;]*m`)
return re.ReplaceAllLiteral(input, []byte(""))
}
3 changes: 2 additions & 1 deletion retriever/eth/chain_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package eth
import (
"bytes"
"context"
"encoding/hex"
"fmt"

"github.com/Layr-Labs/eigenda/common"
Expand Down Expand Up @@ -43,7 +44,7 @@ func (c *chainClient) FetchBatchHeader(ctx context.Context, serviceManagerAddres
return nil, err
}
if len(logs) == 0 {
return nil, fmt.Errorf("could not find confirmBatch events for batch header %s", string(batchHeaderHash))
return nil, fmt.Errorf("could not find confirmBatch events for batch header %s", hex.EncodeToString(batchHeaderHash))
}

if len(logs) > 1 {
Expand Down

0 comments on commit 9a39816

Please sign in to comment.