test: fix TestGenesis_ValidTokenIdsPreserved + TestGetKnownGoodCollectionId#93
Merged
test: fix TestGenesis_ValidTokenIdsPreserved + TestGetKnownGoodCollectionId#93
Conversation
…tionId
Both tests authored token-id shapes that the chain has never accepted.
keeper.CreateTokens (tokens.go:23) requires ValidTokenIds to be a single
contiguous range starting from 1 — the constraint dates back to the v0.47
fork in 2023. These tests came in later (badges→tokenization rename and
the AI-generated genesis test sweep) without ever being run against the
production code path.
- simulation/helpers.go GetOrCreateCollection: was building ValidTokenIds
with GetBoundedTimelineTimes, which returns randomly-positioned ranges
appropriate for timeline-time fields (TransferTimes, OwnershipTimes) but
not for token IDs. Replaced with [{Start:1, End:1+rand}].
- ai_test genesis: was hardcoding two ranges with a gap
([1..50], [100..200]). Replaced with single [1..200] range.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Cherry-picks the test fix from #91 so the test suite goes green independent of the EIP-712 work (which is gated on the upstream go-ethereum patch).
Both tests authored token-id shapes the chain has never accepted.
keeper.CreateTokens(tokens.go:23) requiresValidTokenIdsto be a single contiguous range starting from 1 — a constraint dating back to the v0.47 fork in 2023. These tests came in later (badges→tokenization rename and the AI-generated genesis test sweep) without ever being run against the production code path. PR #79 closed the production-side hole that had been silently dropping these invalid inputs, which unmasked them.simulation/helpers.go GetOrCreateCollection: was buildingValidTokenIdswithGetBoundedTimelineTimes, which returns randomly-positioned ranges appropriate for timeline-time fields (TransferTimes,OwnershipTimes) but not for token IDs. Replaced with[{Start:1, End:1+rand}].ai_testgenesis: was hardcoding two ranges with a gap ([1..50],[100..200]). Replaced with single[1..200]range.Refs
bitbadges-autopilot#0381. Carved out of #91 so the test suite can be green without waiting on the EIP-712 fork merge.Test plan
go test -tags=test ./x/tokenization/ai_test/unit/genesis/... -run TestGenesisTestSuite/TestGenesis_ValidTokenIdsPreserved— passesgo test -tags=test ./x/tokenization/simulation/... -run TestGetKnownGoodCollectionId— passesmake testclean in CI🤖 Generated with Claude Code