diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1a591b720..c77ef3b770 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" diff --git a/staker/block_validator.go b/staker/block_validator.go index 108ef5710c..0ff74a8014 100644 --- a/staker/block_validator.go +++ b/staker/block_validator.go @@ -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() diff --git a/system_tests/forwarder_test.go b/system_tests/forwarder_test.go index 3691caf5d2..d4cf0d8eb7 100644 --- a/system_tests/forwarder_test.go +++ b/system_tests/forwarder_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "math/big" + "os" "path/filepath" "strings" "sync" @@ -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.