Skip to content

Commit

Permalink
batch preference in bundler (#654)
Browse files Browse the repository at this point in the history
* refactor batcher, server not compiling

* batcher tests passing

* add processor cli cmd

* all builds

* batcher tests passing again

* clear timeout in balance monitor

* renames and comments

* changeset add

* lint, prettier

* fix dev package.json script

* update window start, use passed in batch size no hardcode, unit tests check window start

* fix bundler not setting window start properly

* add gas price multiplier flag for test actor to test diff batch pref

* changeset add

* rename window start + private prefix method
  • Loading branch information
luketchang authored Nov 28, 2023
1 parent 909e818 commit ccf1e59
Show file tree
Hide file tree
Showing 26 changed files with 602 additions and 496 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-eggs-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nocturne-xyz/test-actor": minor
---

add --op-gas-price-multiplier CLI arg to allow test actor to test batch preference
5 changes: 5 additions & 0 deletions .changeset/green-drinks-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nocturne-xyz/bundler": major
---

consolidate batcher and submitter into the processor command
5 changes: 5 additions & 0 deletions .changeset/tasty-suits-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nocturne-xyz/balance-monitor": patch
---

fix start() function to clear interval on teardown
5 changes: 5 additions & 0 deletions .changeset/weak-moles-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nocturne-xyz/bundler": minor
---

add batching preference functionality by refactoring batcher and server to support fast/medium/slow buffers
4 changes: 3 additions & 1 deletion actors/balance-monitor/src/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@ export class BalanceMonitor {
);
this.registerMetrics();

let timeoutId: NodeJS.Timeout;
const promise = new Promise<void>((resolve) => {
const poll = async () => {
this.logger.info("polling...");

if (this.closed) {
this.logger.info("Balance Monitor stopping...");
clearTimeout(timeoutId);
resolve();
return;
}
Expand All @@ -211,7 +213,7 @@ export class BalanceMonitor {

// balance monitor metrics piping is implicit, automatically executed via register metrics
// callbacks
setTimeout(poll, 60_000);
timeoutId = setTimeout(poll, 60_000);
};

void poll();
Expand Down
3 changes: 0 additions & 3 deletions actors/bundler/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
REDIS_URL=
REDIS_PASSWORD=

CONFIG_NAME_OR_PATH=
MAX_LATENCY=

OZ_RELAYER_API_KEY=
OZ_RELAYER_API_SECRET=
OZ_RELAYER_SPEED=
Expand Down
5 changes: 2 additions & 3 deletions actors/bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
"bundler-cli": "npx ts-node src/cli/index.ts",
"check": "tsc --noEmit",
"clean": "rm -rf .turbo dist",
"dev": "yarn dev:env && concurrently --kill-others \"yarn dev:server\" \"yarn dev:batcher\" \"yarn dev:submitter\"",
"dev:batcher": "nodemon src/cli/index.ts run batcher --config-name-or-path localhost --max-latency 60 --log-dir ../../logs/bundler-batcher",
"dev": "yarn dev:env && concurrently --kill-others \"yarn dev:server\" \"yarn dev:processor\"",
"dev:env": "cp .env.dev .env",
"dev:server": "nodemon src/cli/index.ts run server --bundler-address 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 --config-name-or-path localhost --port 3000 --log-dir ../../logs/bundler-server --log-level info",
"dev:submitter": "nodemon src/cli/index.ts run submitter --config-name-or-path localhost --log-dir ../../logs/bundler-submitter",
"dev:processor": "nodemon src/cli/index.ts run processor --config-name-or-path localhost --batch-poll-interval 10 --log-dir ../../logs/bundler-submitter",
"lint": "eslint --fix src --ext .ts",
"prettier:check": "prettier --check ./src ./test",
"prettier:write": "prettier --write ./src ./test",
Expand Down
Loading

0 comments on commit ccf1e59

Please sign in to comment.