Skip to content

Commit

Permalink
Merge branch 'master' into test-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
amsanghi committed Jul 13, 2023
2 parents 2890c86 + d92bf38 commit 006cfbe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ jobs:

- name: Set environment variables
run: |
mkdir -p target/tmp
echo "TMPDIR=$(pwd)/target/tmp" >> "$GITHUB_ENV"
mkdir -p target/tmp/deadbeefbee
echo "TMPDIR=$(pwd)/target/tmp/deadbeefbee" >> "$GITHUB_ENV"
echo "GOMEMLIMIT=6GiB" >> "$GITHUB_ENV"
echo "GOGC=80" >> "$GITHUB_ENV"
Expand Down
9 changes: 6 additions & 3 deletions staker/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -984,9 +984,12 @@ func (v *BlockValidator) checkLegacyValid() error {
log.Warn("legacy valid batch ahead of db", "current", batchCount, "required", requiredBatchCount)
return nil
}
msgCount, err := v.inboxTracker.GetBatchMessageCount(v.legacyValidInfo.AfterPosition.BatchNumber)
if err != nil {
return err
var msgCount arbutil.MessageIndex
if v.legacyValidInfo.AfterPosition.BatchNumber > 0 {
msgCount, err = v.inboxTracker.GetBatchMessageCount(v.legacyValidInfo.AfterPosition.BatchNumber - 1)
if err != nil {
return err
}
}
msgCount += arbutil.MessageIndex(v.legacyValidInfo.AfterPosition.PosInBatch)
processedCount, err := v.streamer.GetProcessedMessageCount()
Expand Down
14 changes: 13 additions & 1 deletion system_tests/forwarder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"
"math/big"
"os"
"path/filepath"
"strings"
"sync"
Expand Down Expand Up @@ -157,7 +158,18 @@ func createSequencer(

// tmpPath returns file path with specified filename from temporary directory of the test.
func tmpPath(t *testing.T, filename string) string {
return filepath.Join(t.TempDir(), filename)
t.Helper()
// create a unique, maximum 10 characters-long temporary directory {name} with path as $TMPDIR/{name}
tmpDir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
t.Cleanup(func() {
if err = os.RemoveAll(tmpDir); err != nil {
t.Errorf("Failed to cleanup temp dir: %v", err)
}
})
return filepath.Join(tmpDir, filename)
}

// testNodes creates specified number of paths for ipc from temporary directory of the test.
Expand Down

0 comments on commit 006cfbe

Please sign in to comment.