Skip to content

Fix: launch: constrain the network column so a typo cannot split the dataset (Auto-Generated) - #480

Open
privyy-bit wants to merge 6 commits into
Telocel-Labs:devfrom
privyy-bit:driptide/issue-435-1787845684111
Open

Fix: launch: constrain the network column so a typo cannot split the dataset (Auto-Generated)#480
privyy-bit wants to merge 6 commits into
Telocel-Labs:devfrom
privyy-bit:driptide/issue-435-1787845684111

Conversation

@privyy-bit

Copy link
Copy Markdown

Closes #435

This pull request was generated automatically and scoped strictly to issue #435.

Changes

Constrain the network column across trident_events, api_keys, and webhook_subscriptions tables to known values ('mainnet', 'testnet', 'futurenet', 'sandbox') via a CHECK constraint and database migration. Validate network parameter in the API layer before it reaches SQL with a documented INVALID_ARGUMENT error code, and add unit/integration tests asserting bad values are rejected at both API and DB layers.

Verification

⚠️ Not verified locally (no build system detected, or the required toolchain isn't installed on the worker). GitHub CI is the source of truth — please check the CI status on this PR before merging.

Linked with Closes #435 so the Drips Wave bot resolves the issue on merge.

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@privyy-bit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Depo-dev added a commit to ravendevhub/Trident that referenced this pull request Aug 31, 2026
…Labs#252, Telocel-Labs#435)

Reworked from Telocel-Labs#534 and Telocel-Labs#480, both of which were unmergeable as written.

Telocel-Labs#534 also renamed the vocabulary (mainnet -> pubnet, standalone -> local)
across every table. That rename is dropped: 16 files in services/ and crates/
write 'mainnet' and only the indexer config mentions 'pubnet' at all, as an
accepted alias — so migrating the data without changing those writers would
have made every subsequent INSERT violate the new constraints. It also
numbered its migration 0027, already taken by webhook_secret_rotation; this
is 0031, the next free slot.

Telocel-Labs#480's crates/common/src/types.rs replaced the file rather than adding to it,
deleting seven existing types (E0432 on ContractLiveness, SorobanEvent and
five others). The Network enum is appended here instead. Its FromStr impl
declared 'fn fromStr', which does not satisfy the trait, and the FUTUREnet
constant broke naming convention; both fixed.

Telocel-Labs#480's Go ValidateNetwork collided with the existing query-param validator of
the same name in validators.go, as did its test function. Renamed to
ValidateNetworkValue / TestValidateNetworkValue.

The migration normalises any legacy pubnet/standalone/local rows before adding
the constraints, so it is safe against a database seeded by the earlier draft.

All three layers now agree on mainnet/testnet/futurenet/sandbox:
cargo clippy -p trident-common --all-targets -- -D warnings passes,
go vet and go test ./validation/ pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

launch: constrain the network column so a typo cannot split the dataset

2 participants