-
Notifications
You must be signed in to change notification settings - Fork 32
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
Dec 19, 2024
1 parent
5e72950
commit acf83a4
Showing
4 changed files
with
63 additions
and
65 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
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 |
---|---|---|
@@ -1,51 +1,45 @@ | ||
package e2e_test | ||
|
||
import ( | ||
"fmt" | ||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/Layr-Labs/eigenda-proxy/client" | ||
"github.com/Layr-Labs/eigenda-proxy/e2e" | ||
"testing" | ||
"unicode" | ||
) | ||
|
||
func addAllUnicodeTestCases(f *testing.F) { | ||
// FuzzProxyClientServerIntegrationAndOpClientKeccak256MalformedInputs will fuzz the proxy client server integration | ||
// and op client keccak256 with malformed inputs. This is never meant to be fuzzed with EigenDA. | ||
func FuzzProxyClientServerIntegration(f *testing.F) { | ||
if !runFuzzTests { | ||
f.Skip("Skipping test as FUZZ env var not set") | ||
} | ||
|
||
tsConfig := e2e.TestSuiteConfig(e2e.TestConfig(useMemory())) | ||
ts, kill := e2e.CreateTestSuite(tsConfig) | ||
|
||
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.Add([]byte(string(r))) // Add each printable Unicode character as a seed | ||
} | ||
} | ||
} | ||
|
||
// FuzzProxyClientServerIntegrationAndOpClientKeccak256MalformedInputs will fuzz the proxy client server integration | ||
// and op client keccak256 with malformed inputs. This is never meant to be fuzzed with EigenDA. | ||
//func FuzzProxyClientServerIntegrationAndOpClientKeccak256MalformedInputs(f *testing.F) { | ||
// if !runFuzzTests { | ||
// f.Skip("Skipping test as FUZZ env var not set") | ||
// } | ||
// | ||
// testCfg := e2e.TestConfig(true) | ||
// testCfg.UseKeccak256ModeS3 = true | ||
// tsConfig := e2e.TestSuiteConfig(testCfg) | ||
// ts, kill := e2e.CreateTestSuite(tsConfig) | ||
// defer kill() | ||
// | ||
// // Add each printable Unicode character as a seed | ||
// addAllUnicodeTestCases(f) | ||
// | ||
// cfg := &client.Config{ | ||
// URL: ts.Address(), | ||
// } | ||
// daClient := client.New(cfg) | ||
// daClientPcFalse := op_plasma.NewDAClient(ts.Address(), false, false) | ||
// | ||
// // seed and data are expected. `seed` value is seed: {rune} and data is the one with the random byte(s) | ||
// f.Fuzz(func(t *testing.T, _ string, data []byte) { | ||
// | ||
// _, err := daClient.SetData(ts.Ctx, data) | ||
// require.NoError(t, err) | ||
// | ||
// _, 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())) | ||
// } | ||
// }) | ||
//} | ||
cfg := &client.Config{ | ||
URL: ts.Address(), | ||
} | ||
|
||
daClient := client.New(cfg) | ||
|
||
// seed and data are expected. `seed` value is seed: {rune} and data is the one with the random byte(s) | ||
f.Fuzz(func(t *testing.T, data []byte) { | ||
_, err := daClient.SetData(ts.Ctx, data) | ||
assert.NoError(t, err) | ||
if err != nil { | ||
t.Errorf("Failed to set data: %v", err) | ||
} | ||
}) | ||
|
||
f.Cleanup(kill) | ||
|
||
} |
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