Skip to content

Load account from file or config; local cluster test#1

Closed
illia-bobyr wants to merge 1 commit into
apfitzge:feature/banking_stage-test_generator-redofrom
illia-bobyr:feature/banking_stage-test_generator-redo
Closed

Load account from file or config; local cluster test#1
illia-bobyr wants to merge 1 commit into
apfitzge:feature/banking_stage-test_generator-redofrom
illia-bobyr:feature/banking_stage-test_generator-redo

Conversation

@illia-bobyr
Copy link
Copy Markdown

More specifically the changes are:

  1. Ability to either load accounts from file or hard coded from ValidatorConfig
  2. Some fixes to make validator exit cleaner
  3. Local Cluster test to run a couple nodes for 30 seconds to test block creation/replay
  4. Additional Test scenario where we allocate accounts
  5. Few additional debug messages

@illia-bobyr illia-bobyr marked this pull request as ready for review March 20, 2023 21:36
More specifically the changes are:

1. Ability to either load accounts from file or hard coded from ValidatorConfig
2. Some fixes to make validator exit cleaner
3. Local Cluster test to run a couple nodes for 30 seconds to test block creation/replay
4. Additional Test scenario where we allocate accounts
5. Few additional debug messages
@apfitzge apfitzge closed this Mar 21, 2023
@illia-bobyr illia-bobyr deleted the feature/banking_stage-test_generator-redo branch March 22, 2023 00:15
apfitzge pushed a commit that referenced this pull request Oct 21, 2025
* Apply the retry code to the async pubsub client

Create a test server

```ts
import http from "http";

import { WebSocketServer } from "ws";

let attemptCount = 0;

const server = http.createServer();
const wss = new WebSocketServer({ noServer: true });

wss.on("connection", (ws) => {
  ws.send("Connection accepted.");
  ws.on("message", (msg) => console.log(`Received: ${msg}`));
});

server.on("upgrade", (req, socket, head) => {
  attemptCount += 1;

  if (attemptCount <= 4) {
    socket.write("HTTP/1.1 429 Too Many Requests\r\n\r\n");
    socket.destroy();
    console.log(`Rejected connection #${attemptCount} (429)`);
    return;
  }

  wss.handleUpgrade(req, socket, head, (ws) => {
    wss.emit("connection", ws, req);
    console.log("Connection accepted on attempt", attemptCount);
  });
});

server.listen(8080, () => {
  console.log("Server listening on port 8080");
});
```

Run `test_slot_subscription_async`:

```
Rejected connection #1 (429)
Rejected connection #2 (429)
Rejected connection #3 (429)
Rejected connection #4 (429)
Connection accepted on attempt 5
Received: {"id":1,"jsonrpc":"2.0","method":"slotSubscribe","params":[]}
```

* `s/async_with_retry/with_retry/`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants