-
Notifications
You must be signed in to change notification settings - Fork 122
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
base: develop
Are you sure you want to change the base?
Conversation
Vercel deployment URL: https://stacks-blockchain-gr0ueyq6m-hirosystems.vercel.app 🚀 |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
WHERE (abi::text = '"null"') | ||
AND canonical = TRUE | ||
AND block_height > ${lastBlockHeight} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
Stacks core changed the name of the key for this data from
contract_abi
tocontract_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.