fix(backend): make multisig (address, chainId) the real account key#254
Merged
gianalarcon merged 1 commit intoMay 13, 2026
Merged
Conversation
Contract addresses derive from CREATE = keccak256(rlp(sender, nonce)) and do not include chainId, so the same relayer wallet produces identical addresses on Horizen and Base when nonces align. The previous `accounts.address @unique` global constraint blocked legitimate multi-chain deployments and also let guards mismatch members across chains. Schema: drop the global address unique, add composite (address, chainId) on accounts; add chain_id to transactions and reserved_nonces and replace the foreign key, unique, and indexes with composite versions. Migration backfills chain_id from the parent account row before promoting NOT NULL and refuses to run if any orphan transaction is found. Code: route every account lookup through (address, chainId) — guards require a chainId query param, services use the composite key, x402 keeps a findFirst since it is chain-scoped to Base. Frontend hooks and api services pass the current account's chainId everywhere they previously sent only the address.
gianalarcon
approved these changes
May 13, 2026
Huygon764
added a commit
that referenced
this pull request
May 13, 2026
* fix(backend): make multisig (address, chainId) the real account key (#254) Contract addresses derive from CREATE = keccak256(rlp(sender, nonce)) and do not include chainId, so the same relayer wallet produces identical addresses on Horizen and Base when nonces align. The previous `accounts.address @unique` global constraint blocked legitimate multi-chain deployments and also let guards mismatch members across chains. Schema: drop the global address unique, add composite (address, chainId) on accounts; add chain_id to transactions and reserved_nonces and replace the foreign key, unique, and indexes with composite versions. Migration backfills chain_id from the parent account row before promoting NOT NULL and refuses to run if any orphan transaction is found. Code: route every account lookup through (address, chainId) — guards require a chainId query param, services use the composite key, x402 keeps a findFirst since it is chain-scoped to Base. Frontend hooks and api services pass the current account's chainId everywhere they previously sent only the address.
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.
Hot-fix production: "Can't create base account".
My assumption is it could create same address in both chain, but previously we only have 1 chain so I set @unique on address, so maybe it create address_1 in horizen, and on base it also create same address_1, so it can't create on db because the contraint.
Solution is change constraint from unique address to unique (address + chain_id)