Repository navigation
fix(reservations): unblock release builds and upgrade-window sweeps - #4385
Open
lrsaturnino wants to merge 5 commits into
Open
lrsaturnino wants to merge 5 commits into
lrsaturnino wants to merge 5 commits into
Conversation
…vironment None of the published @keep-network/tbtc-v2 packages carries the reservations build yet: the mainnet and sepolia packages lack ReservationRouter.json and ReservationVault.json, and their Bridge and WalletProposalValidator artifacts lack the reservation methods the client calls. The fallbacks and the method patch applied to the development environment only, so `make generate environment=mainnet` stopped at the missing ReservationRouter.json and release.yml could not build a mainnet image or binary from this tree. Sepolia builds failed the same way. The fallbacks substitute no address the client uses: the ReservationRouter binding is attached to the Bridge address, the ReservationVault binding to the vault address read from the Bridge at runtime, and gen.go embeds neither address. Both rules and patch-artifacts still act only on what a package is missing, so a package that publishes the real artifacts is used as is. The test runs the generator's artifact preparation for development, sepolia and mainnet against packages shaped like the published ones, and checks that published artifacts are left untouched.
Two states of the reservations upgrade made every upgraded client refuse every deposit sweep although nothing on chain could be reserved. Between the Bridge upgrade and setReservationRouter, the reservations-build Bridge answers reservationParameters() through a fallback that reverts while no router is set. The classifier recognises the reservations build, so the failed read stayed an unknown state and the closed-window sweep gate refused. On mainnet the router can only be set through a new BridgeGovernance, which takes the two-day governance delay. The adapter now reads getReservationRouter() when the parameters read fails on a reservations build: a zero router means no reservation vault can have been configured, since the vault is only set through the router and a reveal is reserved only when it names a non-zero vault, so it reports no trusted vault. Any other router, or a router read that fails, still refuses. The call goes to the selector directly because the Bridge binding the build image regenerates does not carry getReservationRouter. Once a build sets an activation block that is reached before the Bridge upgrade, both sweep paths ask isReservedDeposit, which a pre-reservations Bridge does not have. The adapter now answers "not reserved", with a warning, when the deployed code proves the Bridge predates reservations, the same proof the closed-window gate already relies on. Any other failure is still an error, and the reservations-build WalletProposalValidator keeps refusing on chain a sweep that contains a reserved deposit.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
The Dockerfile's TODO said to drop the vendored reservation fallbacks once the development package publishes the reservation contracts. Sepolia and mainnet release builds now depend on the same fallbacks, so removing them on that condition alone would break those builds again. The condition now names the development, sepolia and mainnet tags, and the comment refers to the methods the client binds against.
A zero getReservationRouter() answer clears a failed reservation-parameters read only after the deployed code proves the reservations build. The classifier table stubs a non-zero router in every case, so a change that read the router for a deployment that could not be classified would have passed every test. The new cases (no code, unreadable implementation code, a beacon proxy) require the reservation state to stay unknown while the router reads zero.
The sweep gate's doc, the leader's comment on the per-deposit check and the follower's interface doc still described the behaviour from before the adapter handled the two upgrade-window states: they said a pre-reservations Bridge never receives the per-deposit call and that the pre-reservations case is the gate's only exception. An open activation window does not prove the Bridge has been upgraded, and an unset router reaches the gate as "no trusted vault" rather than as an error. The comments and the M1 guide now say which failed reads let a sweep through and which refuse it.
piotr-roslaniec
approved these changes
Dec 2, 2026
This branch has not been deployed
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.
Problem
This stacks on #4282 and fixes two problems found reviewing it at
96530a787. First, binding generation requires ReservationRouter, ReservationVault and the reservation methods in every environment, but the vendored fallbacks and the method patch applied todevelopmentonly. No published tbtc-v2 package carries the reservations build (mainnet1.8.2,sepolia1.6.0-sepolia.6), somake generate environment=mainnetstopped at the missing ReservationRouter.json andrelease.ymlcould not build a mainnet image or binary. Sepolia builds failed the same way.Second, two states of the planned upgrade made every upgraded client refuse every deposit sweep. Between the Bridge upgrade and
setReservationRouter, the reservations-build Bridge revertsreservationParameters(), the classifier recognises the reservations build, and the closed-window gate refuses. On mainnet the router can only be set through a new BridgeGovernance, behind its two-day delay. Once an activation block is reached before the Bridge upgrade, both sweep paths askisReservedDeposit, which the current Bridge lacks.Solution
The fallback rules and
patch-artifactsnow apply in every environment, still only to what a package is missing. They substitute no address the client uses: the router binding sits at the Bridge address, the vault binding at the address read from the Bridge, andgen.goembeds neither. The Dockerfile comment now says so.When the parameters read fails on a reservations build, the adapter reads
getReservationRouter()directly, because the regenerated Bridge binding lacks it. A zero router means no vault can have been configured, so it reports no trusted vault. WhenisReservedDepositfails on a Bridge whose code proves it predates reservations, the adapter answers "not reserved" and logs a warning. Every other failure still refuses, and the reservations-build WalletProposalValidator still rejects on chain any sweep containing a reserved deposit.docs/plans/reservations/m1-guide.mddescribes both cases.Tests
New tests run the generator's artifact preparation for development, sepolia and mainnet against packages shaped like the published ones. Others pin the zero-router, router-failure and pre-reservations
isReservedDepositpaths. The new cases fail on the old code. Docker release builds for mainnet and sepolia (theoutput-binstarget) succeed against the published packages, and the binary runs. The Client workflow's jobs were replicated locally and pass, except the public Electrum integration step, which fails on the unchanged branch too and does not gate this branch in CI.