Skip to content

Commit dd11747

Browse files
authored
feat: merge-train/spartan (#24834)
BEGIN_COMMIT_OVERRIDE chore(spartan): lower mainnet inactivity slash target to 70% (#24827) chore: add rate-limited testnet rpc client (#24836) fix(ci): move nightly bench inclusion sweep to 06:00 UTC (#24830) fix(bench): handle void worker-wallet returns in inclusion sweep (#24843) END_COMMIT_OVERRIDE
2 parents 4589c1c + 816852d commit dd11747

5 files changed

Lines changed: 51 additions & 10 deletions

File tree

.github/workflows/nightly-bench-inclusion-sweep.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ name: Nightly Bench Inclusion Sweep
99

1010
on:
1111
schedule:
12-
- cron: "30 3 * * *"
12+
# 06:00 UTC, matching the other nightly consumers (spartan-bench, deploy-next-net).
13+
# The nightly git tag + docker image this sweep resolves are produced by the
14+
# Nightly Release Tag workflow at 04:00 UTC; running earlier races that job and
15+
# fails "Verify source git ref" with "couldn't find remote ref".
16+
- cron: "0 6 * * *"
1317
workflow_dispatch:
1418
inputs:
1519
docker_image:

spartan/environments/network-defaults.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ networks:
365365
ENABLE_AUTO_SHUTDOWN: false
366366
# Slasher penalties - more lenient initially
367367
SLASH_DATA_WITHHOLDING_PENALTY: 0
368-
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.8
368+
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.7
369369
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 2
370370
SLASH_INACTIVITY_PENALTY: 2000e18
371371
SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 2000e18

spartan/terraform/deploy-rpc/environments/testnet/main.tf

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,30 @@ locals {
7272
})
7373
}
7474

75+
# Consumers listed here get no per-minute cap (rate_limit_minute = 0). Consumers that need a
76+
# finite cap go in rate_limited_consumers instead, since this loop hardcodes 0 for every entry.
7577
consumer_secret_names = [
7678
"testnet-rpc-consumer-client1"
7779
]
7880

79-
consumers = {
80-
for name in local.consumer_secret_names : name => {
81-
username = name
82-
gcp_secret_manager_secret_name = name
83-
rate_limit_minute = 0
81+
rate_limited_consumers = {
82+
"testnet-rpc-consumer-client2" = {
83+
username = "testnet-rpc-consumer-client2"
84+
gcp_secret_manager_secret_name = "testnet-rpc-consumer-client2"
85+
rate_limit_minute = 3000
8486
}
8587
}
88+
89+
consumers = merge(
90+
{
91+
for name in local.consumer_secret_names : name => {
92+
username = name
93+
gcp_secret_manager_secret_name = name
94+
rate_limit_minute = 0
95+
}
96+
},
97+
local.rate_limited_consumers
98+
)
8699
}
87100

88101
module "environment" {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { ContractArtifact } from '@aztec/stdlib/abi';
2+
import type { ContractInstancePreimage } from '@aztec/stdlib/contract';
3+
4+
import { WorkerWallet } from './worker_wallet.js';
5+
6+
describe('WorkerWallet', () => {
7+
// The private constructor spawns a worker; call() only touches the transport client, so we build the
8+
// instance directly with a stub client and never start a worker.
9+
const walletRespondingWith = (requestResult: unknown): WorkerWallet => {
10+
const client = { request: () => Promise.resolve(requestResult) };
11+
return Reflect.construct(WorkerWallet, [undefined, client]);
12+
};
13+
14+
// registerContract / registerContractClass return void, which the worker serializes as `undefined`.
15+
// Feeding that to JSON.parse throws `"undefined" is not valid JSON` — the crash that failed every
16+
// inclusion-sweep bench point during setup.
17+
it('resolves a void-returning method when the worker responds with undefined', async () => {
18+
const wallet = walletRespondingWith(undefined);
19+
await expect(wallet.registerContract({} as ContractInstancePreimage)).resolves.toBeUndefined();
20+
await expect(wallet.registerContractClass({} as ContractArtifact)).resolves.toBeUndefined();
21+
});
22+
});

yarn-project/end-to-end/src/test-wallet/worker_wallet.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,17 @@ export class WorkerWallet implements Wallet {
116116
return wallet;
117117
}
118118

119-
private async callRaw(fn: string, ...args: any[]): Promise<string> {
119+
private async callRaw(fn: string, ...args: any[]): Promise<string | undefined> {
120120
const argsJson = jsonStringify(args);
121-
return (await this.client.request({ fn, args: argsJson })) as string;
121+
return (await this.client.request({ fn, args: argsJson })) as string | undefined;
122122
}
123123

124124
private async call(fn: string, ...args: any[]): Promise<any> {
125125
const resultJson = await this.callRaw(fn, ...args);
126126
const methodSchema = (WorkerWalletSchema as ApiSchema)[fn];
127-
return getSchemaReturnType(methodSchema).parseAsync(JSON.parse(resultJson));
127+
// Void-returning methods (e.g. registerContract) serialize to `undefined` on the worker side, which
128+
// JSON.parse cannot handle; hand it straight to the schema, whose `z.void()` output accepts undefined.
129+
return getSchemaReturnType(methodSchema).parseAsync(resultJson === undefined ? undefined : JSON.parse(resultJson));
128130
}
129131

130132
getChainInfo(): Promise<ChainInfo> {

0 commit comments

Comments
 (0)