Skip to content

fix: adjust contract ABI writes to read from contract_interface key instead of contract_abi #2276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

rafaelcr
Copy link
Collaborator

Stacks core changed the name of the key for this data from contract_abi to contract_interface in /new_block events. This PR reads from the new field.

A replay or a manual backfill will be necessary to get all the missing ABIs from recently deployed contracts.

Copy link

github-actions bot commented May 12, 2025

Vercel deployment URL: https://stacks-blockchain-gr0ueyq6m-hirosystems.vercel.app 🚀

Copy link

codecov bot commented May 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Comment on lines +35 to +37
WHERE (abi::text = '"null"')
AND canonical = TRUE
AND block_height > ${lastBlockHeight}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You should also filter by tx status, because you could have contract deploy txs that failed so they'll always have a null abi.

console.log('Starting script to patch missing contract ABIs...');

// 2) Initialize script variables and RPC client
let lastBlockHeight = LAST_BLOCK_HEIGHT; // Initial value for the first query
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Instead of pulling this from ENV you should be able to figure it out in your missing query (or with another query) to determine the block height of the first null contract.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Happy to add, but I don't think that's needed since this only determines where the batches start from i.e. technically not needed if we don't batch., (e.g. useful for if the script does crash or stall or something, and we can pickup from the last block-height. But this also sort of assumes there may be "null" values that should be there and are returned from the node, maybe that's also an incorrect assumption. Either way I think the default to -1 (or a similar value makes sense given some sorting).

@janniks janniks linked an issue May 19, 2025 that may be closed by this pull request
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.

smart contract ABI not saved from stacks node new block events
4 participants