Add test for off-chain vote data size limit#2946
Open
ArturWieczorek wants to merge 2 commits into
Open
Conversation
ArturWieczorek
force-pushed
the
artur/increase-gov-action-file-size
branch
from
March 19, 2025 22:14
ad1ae41 to
a2f0285
Compare
ArturWieczorek
force-pushed
the
artur/increase-gov-action-file-size
branch
from
October 31, 2025 18:49
a2f0285 to
a2c302a
Compare
ArturWieczorek
force-pushed
the
artur/increase-gov-action-file-size
branch
from
July 16, 2026 17:41
a2c302a to
5594757
Compare
Verify db-sync's off-chain vote data size boundary: an anchor of 3,000,000 bytes is stored in off_chain_vote_data, while one byte over is rejected with a "Size error" in off_chain_vote_fetch_error and no data row. Both cases go through an info action whose anchor is generated at the target size and served from the internal web server. Add a `query_voting_anchor_id` db-sync query helper to look up an anchor by url.
ArturWieczorek
force-pushed
the
artur/increase-gov-action-file-size
branch
from
July 16, 2026 17:49
5594757 to
d36b8f4
Compare
Collaborator
Author
|
CI tests: 💚 https://github.com/IntersectMBO/cardano-node-tests/actions/runs/29530385569/job/87729023887 Local tests: 💚 |
ArturWieczorek
marked this pull request as ready for review
July 16, 2026 17:53
The off-chain vote size tests serve their anchor from the internal
(localhost) web server. Since db-sync 13.7.x the off-chain fetcher
rejects localhost/private hosts at URL-parse time ("Access to localhost
is not allowed") unless launched with `--allow-private-offchain-urls`,
so both tests failed in CI (wrong error / no data row).
The flag cannot be enabled globally: test_smash.py's
`test_fetch_pool_metadata_localhost_rejected` asserts that db-sync
rejects localhost URLs. So the flag is toggled per-test instead:
* Add `DBSyncManager.restart_db_sync` (restart without recreating the
DB) and `set_allow_private_offchain_urls`, which forces the flag by
editing the `run-cardano-dbsync` launcher and restarting db-sync.
* Run the size tests on a locked singleton cluster (with governance) so
the cluster-wide restart is isolated from tests running in parallel,
and restore the default (flag off) on teardown.
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
Tests cardano-db-sync's off-chain vote data size limit. db-sync fetches gov-action and DRep anchors up to a fixed size (
httpGetOffChainVoteDataSingleinOffChain/Http.hs, currently 3,000,000 bytes); content up to that size is downloaded and stored inoff_chain_vote_data, larger content is rejected with aSize errorrecorded inoff_chain_vote_fetch_errorand no data row.New module
tests_conway/test_offchain_vote_size.pywithTestOffChainVoteSize:test_within_size_limit— an info action with a conformant anchor of exactlyOFFCHAIN_VOTE_MAX_BYTES(3,000,000); asserts db-sync storesoff_chain_vote_datawithis_valid = TRUEand the raw bytes match.test_over_size_limit— an anchor one byte over the limit; asserts db-sync records aSize errorinoff_chain_vote_fetch_errorand stores nooff_chain_vote_datarow.The anchor payloads are generated at runtime (a conformant CIP-108 document padded via
body.motivation, made unique per run) and served from the internal web server, so no multi-MB fixtures are committed to the repo. A small additive helperdbsync_queries.query_voting_anchor_id(url=...)looks up the anchor id by url (used to find the fetch-error row without going throughget_gov_action_proposals).Verification
Verified end-to-end on a local dev cluster — 2 passed on db-sync
13.7.2.1(revdb8cdf6, off-chain vote limit = 3,000,000 bytes):Note
Like the other
web.publish-based off-chain tests (e.g.test_drep.py::TestDReps::test_register_wrong_metadata), this test needs db-sync started with--allow-private-offchain-urlsso it can fetch the anchor from the cluster's local web server; otherwise db-sync rejects the localhost url and nooff_chain_vote_data/off_chain_vote_fetch_errorrow is produced.Note on history
This replaces the original approach (padding the shared
governance_action_anchor.json, since renamed toga_anchor.json, to ~1 MB). That would have bloated the shared conformant anchor used by many unrelated tests and, on its own, exercised no db-sync behavior. The branch was reset to master and rebuilt as the boundary test above.