-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
anupsv
committed
Sep 20, 2024
1 parent
3e25323
commit e331cbd
Showing
4 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: unit-tests | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
go-test: | ||
outputs: | ||
COVERAGE: ${{ steps.unit.outputs.coverage }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21 | ||
|
||
- name: Install project dependencies | ||
run: | | ||
go mod download | ||
- name: Run E2E Fuzz Tests | ||
run: | | ||
make e2e-fuzz-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package e2e_test | ||
|
||
import ( | ||
"github.com/Layr-Labs/eigenda-proxy/client" | ||
"github.com/Layr-Labs/eigenda-proxy/e2e" | ||
op_plasma "github.com/ethereum-optimism/optimism/op-plasma" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func FuzzProxyClientServerIntegration(f *testing.F) { | ||
//if !runIntegrationTests && !runTestnetIntegrationTests { | ||
// f.Skip("Skipping test as INTEGRATION or TESTNET env var not set") | ||
//} | ||
|
||
testCfg := e2e.TestConfig(useMemory()) | ||
testCfg.UseKeccak256ModeS3 = true | ||
tsConfig := e2e.TestSuiteConfigF(f, testCfg) | ||
ts, kill := e2e.CreateTestSuiteF(f, tsConfig) | ||
defer kill() | ||
|
||
cfg := &client.Config{ | ||
URL: ts.Address(), | ||
} | ||
daClient := client.New(cfg) | ||
|
||
// Add each printable Unicode character as a seed including ascii | ||
//for r := rune(0); r <= unicode.MaxRune; r++ { | ||
// if unicode.IsPrint(r) { | ||
// f.Add(fmt.Sprintf("seed: %s", string(r)), []byte(string(r))) // Add each printable Unicode character as a seed | ||
// } | ||
//} | ||
|
||
f.Fuzz(func(t *testing.T, seed string, data []byte) { | ||
_, err := daClient.SetData(ts.Ctx, data) | ||
require.NoError(t, err) | ||
}) | ||
} | ||
|
||
func FuzzOpClientKeccak256MalformedInputs(f *testing.F) { | ||
if !runIntegrationTests || runTestnetIntegrationTests { | ||
f.Skip("Skipping test as INTEGRATION var not set") | ||
} | ||
|
||
testCfg := e2e.TestConfig(useMemory()) | ||
testCfg.UseKeccak256ModeS3 = true | ||
tsConfig := e2e.TestSuiteConfigF(f, testCfg) | ||
ts, kill := e2e.CreateTestSuiteF(f, tsConfig) | ||
defer kill() | ||
|
||
daClientPcFalse := op_plasma.NewDAClient(ts.Address(), false, false) | ||
|
||
// Fuzz the SetInput function with random data | ||
// seed and data are expected. `seed` value is seed: {i} and data is the one with the random string | ||
f.Fuzz(func(t *testing.T, seed string, data []byte) { | ||
|
||
_, err := daClientPcFalse.SetInput(ts.Ctx, data) | ||
// should fail with proper error message as is now, and cannot contain panics or nils | ||
if err != nil { | ||
assert.True(t, !isNilPtrDerefPanic(err.Error())) | ||
} | ||
|
||
}) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters