feat(spartan): add the inbox bot as a fourth bot flavour - #190
Draft
spalladino wants to merge 1 commit into
Draft
spalladino wants to merge 1 commit into
spalladino wants to merge 1 commit into
Conversation
spalladino
added this pull request to stack #188
September 12, 2026 06:48
Wire BOT_MODE=inbox into the Helm chart and the deploy-aztec-infra Terraform stack beside the transfers, swaps and cross-chain bots. Every BOT_INBOX_REPLICAS default is 0, so this is a no-op on every environment: the Terraform release is simply absent until a network opts in. The bot chart gains BOT_L1_TO_L2_SEED_COUNT, BOT_L1_TO_L2_TIMEOUT_SECONDS, BOT_INBOX_MESSAGES_PER_BATCH, BOT_INBOX_CONSUME_MODE and BOT_INBOX_SATURATION_INTERVAL_SECONDS. The three inbox-only keys are gated on botMode so the other flavours render a byte-identical configmap and their pods do not roll; the two seed/timeout keys are gated on being set, which keeps the cross-chain bot on the code default it runs today. The daily saturation batch is off. It sends 257 sendL2Message calls in a single atomic Multicall3 aggregate3 transaction to force a bucket rollover, so it wants its own measured rollout rather than riding along with steady-state traffic. The bot code defaults the interval to 86400, so both values.yaml and bot-inbox.yaml set it to 0 explicitly rather than relying on a default. The release takes dedicated BOT_INBOX_DA_GAS_LIMIT and BOT_INBOX_L2_GAS_LIMIT rather than the shared BOT_DA_GAS_LIMIT and BOT_L2_GAS_LIMIT the other three bots inherit. Staging pins those shared limits to values tuned for a token transfer; a private consumption of an L1 to L2 message is a different circuit, and a fixed limit that is too low fails the transaction while one that is too high overpays. Both inbox variables default to empty so the wallet estimates. calculate_publisher_indices.sh reports mnemonic index 7300 once the bot is enabled. That list is what ensure_funded_environment tops up on Sepolia, where CREATE_ETH_DEVNET is false, so without it the bot's L1 account never receives ETH and fails on its first aggregate3.
spalladino
force-pushed
the
spl/a-2020-deploy-the-inbox-bot-to-next-net-and-staging
branch
from
September 15, 2026 22:39
36ecf14 to
67d262f
Compare
spalladino
removed this pull request from stack #188
September 15, 2026 22:42
spalladino
added this pull request to stack #217
September 15, 2026 22:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deploy the inbox bot to next-net and staging
Fixes A-2020. Follows A-1986, which built the inbox bot itself.
This adds
BOT_MODE=inboxto the spartan stack as a fourth bot flavour, alongsidetransfers, swaps and cross-chain. It is deliberately a no-op deploy: every
BOT_INBOX_REPLICASdefault is 0, so the Terraform release is absent on everyenvironment and no environment file is touched here. Turning the bot on is the next
three PRs, one per network, in rollout order.
Rollout
The plan is to land this wiring at replicas 0, then enable next-net, then
staging-internal, then staging-public, each as its own deploy with a 24h soak
before the next. This PR is the replicas-0 landing step. The plan document
explicitly keeps the three
spartan/environments/*.envenablement blocks out of theno-op wiring change, so they are not in this diff even though the issue lists those
files in scope; each enable ships with the deploy it belongs to.
For reference, the block each of
next-net.env,staging-internal.envandstaging-public.envwill get, one at a time:The saturation batch ships disabled
BOT_INBOX_SATURATION_INTERVAL_SECONDS=0on every path that can set it. This is nota default being inherited: the bot code defaults
inboxSaturationIntervalSecondsto86400, so
spartan/aztec-bot/values.yaml,values/bot-inbox.yaml, the Terraformvariable and the
deploy_network.shdefault all set 0 explicitly.A saturation run sends 257
sendL2Messagecalls in one atomic Multicall3aggregate3transaction to force a bucket rollover. It cannot partially land.Enabling it is a separate exercise that starts by measuring the batch's L1 gas
against Sepolia's block gas limit, and every daily-run alert must be gated on
saturation_enabled == 1so a deliberately disabled schedule never pages.Two things worth a reviewer's attention
Dedicated gas limits. The inbox release takes
BOT_INBOX_DA_GAS_LIMITandBOT_INBOX_L2_GAS_LIMIT, not the sharedBOT_DA_GAS_LIMIT/BOT_L2_GAS_LIMITtheother three bots inherit. Staging pins those shared values to 100000 and 6540000,
tuned for a token transfer. A private consumption of an L1 to L2 message is a
different circuit; too low a fixed limit fails the transaction, too high overpays,
and either way the probe stops measuring what it exists to measure. Both inbox
variables default to empty, so the wallet estimates.
Funding.
calculate_publisher_indices.shnow reports mnemonic index 7300 oncethe bot is enabled. That list is what
ensure_funded_environmenttops up, and allthree target networks run with
CREATE_ETH_DEVNET=false, soPREFUNDED_MNEMONIC_INDICESnever reaches them. Without this the bot's L1 account is never funded and it fails on
its first
aggregate3.Index 7300 keeps the existing 100-wide spacing after cross-chain's 7200, and each of
the three networks has its own mnemonic, so the index is free and independent in all
of them.
Configuration
One replica; two would each keep their own store and their own saturation schedule
with no coordination between them. Four messages per batch every 300 seconds, in
mixedconsume mode so one bot covers both the public and private domains.followChain: PROPOSED— inbox mode rejectsNONEoutright, andPROPOSEDkeepsthe outstanding-message cap draining while still recording first-proposed inclusion
separately.
maxErrors: 3withstopIfUnhealthy: false:maxErrors: 0woulddisable the unhealthy state rather than merely prevent a restart, so the threshold
stays and only the exit is disabled, which keeps the measuring process exporting
failure and timeout counts. A 2Gi PVC, because restart reconciliation reads the
durable store and an emptyDir would make every pod restart look like a fresh bot.
Verification
No deploy, no
terraform apply, no live cluster.helm templateon the three existing bot flavours before and after the chartchange: all three configmaps render byte-identical, so their pods will not roll.
helm templateon the inbox flavour rendersBOT_INBOX_SATURATION_INTERVAL_SECONDS: "0"and omitsBOT_DA_GAS_LIMIT/BOT_L2_GAS_LIMITentirely, which is the "estimate" path.helm linton the chart with the inbox values: clean.terraform validate: success.terraform consolewithBOT_DA_GAS_LIMIT=100000and
BOT_L2_GAS_LIMIT=6540000set, as staging sets them, evaluatesbot_transferswith those limits andbot_inboxwith""for both, which is thecontrast the dedicated variables exist to produce.
terraform fmt -checkon the new blocks: clean.bash -non both scripts: clean.calculate_publisher_indices.shemits 7300 withBOT_INBOX_REPLICAS=1and is unchanged from its previous output at 0.shellcheckis not installed in this environment, so the scripts were notshellchecked.
Recorded, not resolved
The shared
BOT_DA_GAS_LIMIT/BOT_L2_GAS_LIMITnever reach Terraform today.staging-internal.envandstaging-public.envset them, butdeploy_network.shdoes not write either into
terraform.tfvarsand nothing else exports them, so theTerraform variables sit at their
""defaults and all four bots estimate regardless.The dedicated inbox variables are still correct and are plumbed end to end, but the
"staging gas-limit trap" is latent rather than live. Left alone — repairing the
shared path would change the transfer and swap bots' behaviour on staging, which is
out of scope here.
Two pre-existing failures on this base, untouched by this change.
terraform fmt -checkflagsmain.tf:401(logLevelalignment), andspartan/scripts/check_env_vars.shreports 7 undefined variables(
AZTEC_EPOCHS_LAG,DEVNET_NAMESPACES_REGEX,MAINNET_NAMESPACES_REGEX,NEXT_NET_REGEX,NEXT_SCENARIO_REGEX,STAGING_REGEX,TESTNET_NAMESPACES_REGEX). None appear in this diff.spartan/bootstrap.shrunsthat check, so it is presumably already failing.
Sepolia funding is an operational prerequisite for each enable, not a repo change.
The inbox bot is the only bot with a continuous L1 burn — one transaction every 300
seconds, forever, on three networks at once, against roughly 38.6M gas/day per
network.
ensure_funded_environmentdefaults to a 0.5 ETH low watermark and a 1.0ETH top-up, which is about three days of headroom at 10 gwei and under a day through
a spike, and no scheduled job runs it. Before enabling each network, seed index 7300
to around 5 ETH with a targeted call rather than raising the environment-wide
watermarks, which apply to every index:
and put either scheduled replenishment or a balance alert on 7300 in place first. A
funding gap makes the probe report L1 submission failures that look like network
faults, which is the worst failure mode for a measuring instrument.
A dependency gate before the first enable. The image selected for deployment has
to contain
BOT_MODE=inbox. Rendering valid Helm and Terraform proves nothing aboutwhether a deployed binary can start the new mode.