Skip to content
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

im-online removal cleanup: remove off-chain storage #2290

Merged
merged 17 commits into from
Feb 19, 2024

Conversation

s0me0ne-unkn0wn
Copy link
Contributor

@s0me0ne-unkn0wn s0me0ne-unkn0wn commented Nov 13, 2023

This is a follow-up for im-online pallet removal that is cleaning up its off-chain storage. Must be merged no earlier than #2265 is enacted. Related: #1964

@s0me0ne-unkn0wn s0me0ne-unkn0wn changed the title [DNM] im-online removal cleanup: remove off-chain storage im-online removal cleanup: remove off-chain storage Jan 7, 2024
@s0me0ne-unkn0wn s0me0ne-unkn0wn marked this pull request as ready for review January 7, 2024 14:27
@s0me0ne-unkn0wn
Copy link
Contributor Author

Tested, it and it seems to work, but maybe I'm over-engineering it... Are there any better ideas on how to implement it without sticking a whole fake pallet into the runtime?

@gpestana gpestana added the T2-pallets This PR/Issue is related to a particular pallet. label Jan 18, 2024
Copy link
Contributor

@liamaharon liamaharon left a comment

Choose a reason for hiding this comment

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

Tests?

@s0me0ne-unkn0wn
Copy link
Contributor Author

s0me0ne-unkn0wn commented Jan 19, 2024

Tests?

I've done manual testing. I could automate that, but that seems to be overkill for a disposable fake pallet that will only fire once.

Besides, I'm not even sure that this is the right way to do what I want to do, and I'm still waiting for someone to come and say, "you're doing it totally wrong, see how it should be" 🙂

@liamaharon
Copy link
Contributor

What was your process for testing it, could you post a summary of the results?

Regarding the approach, I wonder if it's possible to use a runtime migration rather than a pallet? If not, probably deserves an issue.

@s0me0ne-unkn0wn
Copy link
Contributor Author

I've spun up a zombienet, then applied runtime upgrade with sudo as usual. In the logs, I see that the offchain worker fired on the next block, enumerated offchain storage keys in question, and removed them (or at least tried to remove them if they exist; .clear() does not provide any clue on the result of the operation). Still, I don't know if storage locking is required here. It works without locking in my tests, but I'm not 100% sure how it will behave in a live network.

However, this approach has some significant drawbacks. First, I'm sticking a whole fake pallet into the runtime just to remove several values from offchain storage. I'd expect an easier mechanism for that, but I didn't find one. That pallet has to be removed afterward. Second, until it is removed, it will fire an offchain worker every next block. It will do close to nothing (get the block number from on-chain storage; check we're not at that block; exit), but still, it's completely unneeded overhead.

Unfortunately, regular migration doesn't work here, as the offchain storage can only be accessed from an offchain worker, not from the runtime itself. That's the problem I'm trying to overcome with this fake pallet, and I'd be glad to hear that there's some cleaner solution for that.

polkadot/runtime/rococo/src/lib.rs Outdated Show resolved Hide resolved
polkadot/runtime/rococo/src/lib.rs Outdated Show resolved Hide resolved
@s0me0ne-unkn0wn s0me0ne-unkn0wn requested review from a team January 21, 2024 17:29
Copy link
Member

@ordian ordian left a comment

Choose a reason for hiding this comment

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

I'm not a FRAME expert, but if it's tested to work, sounds good to me :)

substrate/frame/im-online/Cargo.toml Outdated Show resolved Hide resolved
polkadot/runtime/rococo/src/lib.rs Show resolved Hide resolved
@s0me0ne-unkn0wn s0me0ne-unkn0wn requested a review from bkchr January 26, 2024 10:29
@s0me0ne-unkn0wn s0me0ne-unkn0wn requested a review from a team as a code owner February 5, 2024 14:49
@s0me0ne-unkn0wn
Copy link
Contributor Author

@bkchr Rococo and Westend have been running without im-online for quite some time now. Let's wrap it up with this PR?

substrate/frame/im-online/src/migration.rs Outdated Show resolved Hide resolved
prdoc/pr_2290.prdoc Outdated Show resolved Hide resolved
prdoc/pr_2290.prdoc Outdated Show resolved Hide resolved
@s0me0ne-unkn0wn s0me0ne-unkn0wn added this pull request to the merge queue Feb 19, 2024
Merged via the queue into master with commit a5492dc Feb 19, 2024
128 of 129 checks passed
@s0me0ne-unkn0wn s0me0ne-unkn0wn deleted the s0me0ne/retire-im-online-part-3 branch February 19, 2024 10:04
ordian added a commit that referenced this pull request Feb 19, 2024
* master: (41 commits)
  Add Coretime to Westend (#3319)
  removed `pallet::getter` from `pallet-sudo` (#3370)
  gossip-support: add unittests for update authorities (#3258)
  [FRAME Core] remove unnecessary overrides while using derive_impl for frame_system (#3317)
  Update coretime-westend bootnodes (#3380)
  `im-online` removal cleanup: remove off-chain storage (#2290)
  Bump the known_good_semver group with 1 update (#3379)
  Fix documentation dead link (#3372)
  Make `sp-keystore` `no_std`-compatible and fix the `build-runtimes-polkavm` CI job (#3363)
  Remove unused `im-online` weights (#3373)
  Ensure referenda `TracksInfo` is sorted (#3325)
  rpc server: add rate limiting middleware (#3301)
  do not block finality for "disabled" disputes (#3358)
  fix(zombienet): docker `img` version to use in merge queues for bridges (#3337)
  Various nits and alignments for SP testnets found during bumping `polkadot-fellows` repo (#3359)
  Add broker pallet to `coretime-westend` (#3272)
  remove recursion limit (#3348)
  Update subkey README.md (#3355)
  Bump the known_good_semver group with 6 updates (#3347)
  Document LocalKeystore insert method (#3336)
  ...
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
This is a follow-up for `im-online` pallet removal that is cleaning up
its off-chain storage. Must be merged no earlier than paritytech#2265 is enacted.
Related: paritytech#1964

---------

Co-authored-by: Bastian Köcher <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Mar 29, 2024
Removes transient code introduced to clean up offchain database after
`im-online` pallet removal.

Should be merged after #2290 has been enacted.
pgherveou pushed a commit that referenced this pull request Apr 2, 2024
Removes transient code introduced to clean up offchain database after
`im-online` pallet removal.

Should be merged after #2290 has been enacted.
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this pull request Apr 9, 2024
Removes transient code introduced to clean up offchain database after
`im-online` pallet removal.

Should be merged after paritytech#2290 has been enacted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants