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

feat: manual oracle activation #782

Merged
merged 23 commits into from
Apr 9, 2024
Merged

feat: manual oracle activation #782

merged 23 commits into from
Apr 9, 2024

Conversation

Roznovjak
Copy link
Contributor

@Roznovjak Roznovjak commented Mar 5, 2024

Fixes #771

Copy link

github-actions bot commented Mar 5, 2024

Crate versions that have not been updated:

  • pallet-omnipool: v4.1.5

Crate versions that have been updated:

  • runtime-integration-tests: v1.20.0 -> v1.20.1
  • pallet-asset-registry: v3.2.0 -> v3.2.1
  • pallet-dca: v1.4.2 -> v1.4.3
  • pallet-ema-oracle: v1.2.1 -> v1.3.0
  • pallet-omnipool-liquidity-mining: v2.1.3 -> v2.1.4
  • hydradx-runtime: v226.0.0 -> v227.0.0

Runtime version has been increased.

@Roznovjak Roznovjak self-assigned this Mar 5, 2024
@Roznovjak Roznovjak marked this pull request as ready for review March 5, 2024 18:24
Copy link
Member

@mrq1911 mrq1911 left a comment

Choose a reason for hiding this comment

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

please document new extrinsics

#[pallet::generate_deposit(pub(crate) fn deposit_event)]
pub enum Event<T: Config> {
/// Oracle was added to the whitelist.
OracleAdded { source: Source, assets: (AssetId, AssetId) },
Copy link
Member

Choose a reason for hiding this comment

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

when you add event like this, i would expect it being fired every time oracle is created, not just when you modify whitelist


#[pallet::call_index(1)]
#[pallet::weight(<T as Config>::WeightInfo::remove_oracle())]
pub fn remove_oracle(origin: OriginFor<T>, source: Source, assets: (AssetId, AssetId)) -> DispatchResult {
Copy link
Member

Choose a reason for hiding this comment

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

i would expect this function would remove actual oracle as well, not just item from whitelist

@@ -243,7 +294,10 @@ impl<T: Config> Pallet<T> {
assets: (AssetId, AssetId),
oracle_entry: OracleEntry<BlockNumberFor<T>>,
) -> Result<(), ()> {
if !T::OracleWhitelist::contains(&(src, assets.0, assets.1)) {
if !(T::OracleWhitelist::contains(&(src, assets.0, assets.1))
|| WhitelistedAssets::<T>::get().contains(&(src, (assets.0, assets.1))))
Copy link
Member

Choose a reason for hiding this comment

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

i dont like the way this is tacked on, from configuration of the pallet i would expect that only OracleWhitelist controls it, nothing else, therefore this list should be only contains implementation (default ()) so if you override it in config, it wont be utilized

Copy link
Member

@mrq1911 mrq1911 Mar 31, 2024

Choose a reason for hiding this comment

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

so for our case you would basically implement extension in the runtime config (extend sufficient asset filter), not other way around

@mrq1911 mrq1911 changed the title feat: Manual oracle activation feat: manual oracle activation Apr 9, 2024
@Roznovjak Roznovjak merged commit 8abf856 into master Apr 9, 2024
3 of 4 checks passed
@Roznovjak Roznovjak deleted the manual_oracle_activation branch April 9, 2024 17:27
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.

Manual oracle activation
2 participants