Skip to content

Fix contract storage backfill on network-scoped catalogs - #99

Merged
tmosleyIII merged 2 commits into
mainfrom
fix/mainnet-contract-storage-backfill-schema
Jul 28, 2026
Merged

Fix contract storage backfill on network-scoped catalogs#99
tmosleyIII merged 2 commits into
mainfrom
fix/mainnet-contract-storage-backfill-schema

Conversation

@tmosleyIII

Copy link
Copy Markdown
Contributor

This pull request updates the handling of network-scoped current tables to support catalogs that do not include a network column, improving compatibility with older data layouts. It also adds a new test to verify this behavior.

Support for network-scoped current tables without a network column:

  • Removed the requirement to filter by network in the selectContractStorageCurrent query, allowing the function to work with tables that do not have a network column. [1] [2]
  • Updated the documentation for selectContractStorageCurrent to clarify that the query must not require a network column due to older catalogs.

Testing improvements:

  • Added the test TestContractStorageProjectionSupportsNetworkScopedCurrentTablesWithoutNetworkColumn to ensure that the contract storage projection works correctly when the network column is missing from current tables.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the serving cold backfill’s contract storage “current” projection SQL to work with network-scoped DuckLake catalogs where the *_current tables do not have a network column (as in older catalog layouts), and adds a regression test to ensure the projection rebuild succeeds in that scenario.

Changes:

  • Removed the WHERE network = ... predicate from the ttl_current CTE in selectContractStorageCurrent so the query no longer requires a network column.
  • Added a new unit test that provisions silver.contract_data_current / silver.ttl_current without a network column and validates sv_contract_storage_current rebuild output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
obsrvr-lake/serving-cold-backfill/go/main.go Adjusts the sv_contract_storage_current source SQL to not require a network column in network-scoped catalogs.
obsrvr-lake/serving-cold-backfill/go/main_test.go Adds a regression test ensuring contract storage projection rebuild works when current tables omit the network column.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +127 to +133
var projection CurrentProjection
for _, candidate := range currentProjections() {
if candidate.Name == "sv_contract_storage_current" {
projection = candidate
break
}
}
@tmosleyIII
tmosleyIII merged commit f4f1129 into main Jul 28, 2026
@tmosleyIII
tmosleyIII deleted the fix/mainnet-contract-storage-backfill-schema branch July 28, 2026 12:54
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.

2 participants