Skip to content

Commit

Permalink
adding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anupsv committed Sep 19, 2024
1 parent fcac380 commit 3e25323
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions e2e/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func isNilPtrDerefPanic(err string) bool {
strings.Contains(err, "nil pointer dereference")
}

// TestOpClientKeccak256MalformedInputs tests the NewDAClient from op_plasma by setting and getting against []byte("")
// preimage. It sets the precompute option to false on the NewDAClient.
func TestOpClientKeccak256MalformedInputs(t *testing.T) {
if !runIntegrationTests || runTestnetIntegrationTests {
t.Skip("Skipping test as TESTNET env set or INTEGRATION var not set")
Expand Down Expand Up @@ -61,6 +63,7 @@ func TestOpClientKeccak256MalformedInputs(t *testing.T) {
require.Error(t, err)

// Should not fail on slice bounds out of range. This needs to be fixed by OP.
// Refer to issue: https://github.com/ethereum-optimism/optimism/issues/11987
// assert.False(t, strings.Contains(err.Error(), ": EOF") && !isPanic(err.Error()))
})

Expand Down Expand Up @@ -148,6 +151,9 @@ func TestOptimismClientWithGenericCommitment(t *testing.T) {
require.Equal(t, testPreimage, preimage)
}

// TestProxyClientServerIntegration tests the proxy client and server integration by setting the data as a single byte,
// many unicode characters, single unicode character and an empty preimage. It then tries to get the data from the
// proxy server with empty byte, single byte and random string.
func TestProxyClientServerIntegration(t *testing.T) {
if !runIntegrationTests && !runTestnetIntegrationTests {
t.Skip("Skipping test as INTEGRATION or TESTNET env var not set")
Expand All @@ -165,19 +171,19 @@ func TestProxyClientServerIntegration(t *testing.T) {
daClient := client.New(cfg)

t.Run("single byte preimage set data case", func(t *testing.T) {
testPreimage := []byte{1} // Empty preimage
testPreimage := []byte{1} // single byte preimage
t.Log("Setting input data on proxy server...")
_, err := daClient.SetData(ts.Ctx, testPreimage)
require.NoError(t, err)
})

t.Run("unicode preimage set data case", func(t *testing.T) {
testPreimage := []byte("§§©ˆªªˆ˙√ç®∂§∞¶§ƒ¥√¨¥√¨¥ƒƒ©˙˜ø˜˜˜∫˙∫¥∫√†®®√稈¨˙ï") // Empty preimage
testPreimage := []byte("§§©ˆªªˆ˙√ç®∂§∞¶§ƒ¥√¨¥√¨¥ƒƒ©˙˜ø˜˜˜∫˙∫¥∫√†®®√稈¨˙ï") // many unicode characters
t.Log("Setting input data on proxy server...")
_, err := daClient.SetData(ts.Ctx, testPreimage)
require.NoError(t, err)

testPreimage = []byte("§") // Empty preimage
testPreimage = []byte("§") // single unicode character
t.Log("Setting input data on proxy server...")
_, err = daClient.SetData(ts.Ctx, testPreimage)
require.NoError(t, err)
Expand Down

0 comments on commit 3e25323

Please sign in to comment.