Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move local blockchain to ws rpc #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/userop/testing/local_blockchain/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func NewAccountWithBalance(
return Account{}, fmt.Errorf("failed to exec increment balance: %w (exit code %d)", err, exitCode)
}

// TODO: wait for tx mine

scanner := bufio.NewScanner(result)
for scanner.Scan() {
slog.Debug(scanner.Text())
Expand Down
8 changes: 6 additions & 2 deletions pkg/userop/testing/local_blockchain/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func NewEthNode(ctx context.Context, t *testing.T) *EthNode {
// 8547 TCP, used by the GraphQL API
// 30303 TCP and UDP, used by the P2P protocol running the network
ExposedPorts: []string{"8545:8545/tcp", "8546:8546/tcp", "8547:8547/tcp", "30303:30303/tcp", "30303:30303/udp"},
Cmd: []string{"--dev", "--http", "--http.api=eth,web3,net", "--http.addr=0.0.0.0", "--http.corsdomain='*'", "--http.vhosts='*'"},
Cmd: []string{"--dev", "--http", "--ws", "--http.api=eth,web3,net", "--http.addr=0.0.0.0", "--http.corsdomain='*'", "--http.vhosts='*'", "--ws.addr=0.0.0.0", "--ws.origins='*'"},
WaitingFor: wait.ForLog("server started"),
},
Started: true,
Expand All @@ -105,10 +105,14 @@ func NewEthNode(ctx context.Context, t *testing.T) *EthNode {

containerIP, err := gethContainer.ContainerIP(ctx)
require.NoError(t, err, "failed to get Go-Ethereum container IP")
// As a rpc port we are using ws port for subscription
// As a container port we are using http port for bundler
rpcPort, err := gethContainer.MappedPort(ctx, "8546")
require.NoError(t, err, "failed to get Go-Ethereum container port")
containerPort, err := gethContainer.MappedPort(ctx, "8545")
require.NoError(t, err, "failed to get Go-Ethereum container port")

rpcURL, err = url.Parse(fmt.Sprintf("http://0.0.0.0:%s", containerPort.Port()))
rpcURL, err = url.Parse(fmt.Sprintf("ws://0.0.0.0:%s", rpcPort.Port()))
require.NoError(t, err, "failed to parse local RPC URL")
containerURL, err = url.Parse(fmt.Sprintf("http://%s:%s", containerIP, containerPort.Port()))
require.NoError(t, err, "failed to parse container RPC URL")
Expand Down