Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
f379fcd0
Unverified
Commit
f379fcd0
authored
Dec 07, 2023
by
Matthew Slipper
Committed by
GitHub
Dec 07, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8506 from ethereum-optimism/bugfix/proxyd-bad-test
proxyd: Delete bad test
parents
5fe703da
22e5c982
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
76 deletions
+0
-76
ws_test.go
proxyd/integration_tests/ws_test.go
+0
-76
No files found.
proxyd/integration_tests/ws_test.go
View file @
f379fcd0
...
@@ -3,91 +3,15 @@ package integration_tests
...
@@ -3,91 +3,15 @@ package integration_tests
import
(
import
(
"os"
"os"
"strings"
"strings"
"sync"
"sync/atomic"
"sync/atomic"
"testing"
"testing"
"time"
"time"
"github.com/ethereum-optimism/optimism/proxyd"
"github.com/ethereum-optimism/optimism/proxyd"
"github.com/ethereum/go-ethereum/log"
"github.com/gorilla/websocket"
"github.com/gorilla/websocket"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)
)
// TestConcurrentWSPanic tests for a panic in the websocket proxy
// that occurred when messages were sent from the upstream to the
// client right after the client sent an invalid request.
func
TestConcurrentWSPanic
(
t
*
testing
.
T
)
{
var
backendToProxyConn
*
websocket
.
Conn
var
setOnce
sync
.
Once
readyCh
:=
make
(
chan
struct
{},
1
)
quitC
:=
make
(
chan
struct
{})
// Pull out the backend -> proxyd conn so that we can spam it directly.
// Use a sync.Once to make sure we only do that once, for the first
// connection.
backend
:=
NewMockWSBackend
(
func
(
conn
*
websocket
.
Conn
)
{
setOnce
.
Do
(
func
()
{
backendToProxyConn
=
conn
readyCh
<-
struct
{}{}
})
},
nil
,
nil
)
defer
backend
.
Close
()
require
.
NoError
(
t
,
os
.
Setenv
(
"GOOD_BACKEND_RPC_URL"
,
backend
.
URL
()))
config
:=
ReadConfig
(
"ws"
)
_
,
shutdown
,
err
:=
proxyd
.
Start
(
config
)
require
.
NoError
(
t
,
err
)
client
,
err
:=
NewProxydWSClient
(
"ws://127.0.0.1:8546"
,
nil
,
nil
)
require
.
NoError
(
t
,
err
)
defer
shutdown
()
// suppress tons of log messages
oldHandler
:=
log
.
Root
()
.
GetHandler
()
log
.
Root
()
.
SetHandler
(
log
.
DiscardHandler
())
defer
func
()
{
log
.
Root
()
.
SetHandler
(
oldHandler
)
}()
<-
readyCh
var
wg
sync
.
WaitGroup
wg
.
Add
(
2
)
// spam messages
go
func
()
{
for
{
select
{
case
<-
quitC
:
wg
.
Done
()
return
default
:
_
=
backendToProxyConn
.
WriteMessage
(
websocket
.
TextMessage
,
[]
byte
(
"garbage"
))
}
}
}()
// spam invalid RPCs
go
func
()
{
for
{
select
{
case
<-
quitC
:
wg
.
Done
()
return
default
:
_
=
client
.
WriteMessage
(
websocket
.
TextMessage
,
[]
byte
(
"{
\"
id
\"
: 1,
\"
method
\"
:
\"
eth_foo
\"
,
\"
params
\"
: [
\"
newHeads
\"
]}"
))
}
}
}()
// 1 second is enough to trigger the panic due to
// concurrent write to websocket connection
time
.
Sleep
(
time
.
Second
)
close
(
quitC
)
wg
.
Wait
()
}
type
backendHandler
struct
{
type
backendHandler
struct
{
msgCB
atomic
.
Value
msgCB
atomic
.
Value
closeCB
atomic
.
Value
closeCB
atomic
.
Value
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment