Skip to content

Conversation

@mfontanini
Copy link
Member

This simplifies the reward distribution since it was pretty convoluted and hard to follow. Specifically this:

  • Avoids sharing the reward data so instead of living in the KeeperState it lives inside the reward distributor. This avoids having to lock every time we want to deal with it.
  • Uses tracing::instrument to avoid repeating the same parameters when logging.
  • Simplifies the logic around fetching the contract state (specifically the available budget and remaining budget). This was being fetched at different points in the code and this made it annoying to deal with. Now it's fetched at most once at the beginning of each loop. This also removes the Options around this info and keeps directly the u64 and U256 to avoid dealing with options since there was no need for them.
  • Stops caching the round information since there is no need for this as we only deal with each key/round once.
  • Adds a couple of missing metrics around contract state.

Comment on lines +30 to +31
checked_at: u64,
synced_at: u64,
Copy link
Member

Choose a reason for hiding this comment

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

What is this, block number? seconds? I'll derive it from the context later on but might be helpful to have a comment or rename to something more descriptive.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will fix in next PR, need to fix something

cache.last_budget = Some(fetched);
cache.last_remaining = None;
let ctx = self.fetch_token_context(reward_address).await?;
if ctx.checked_at != block_timestamp {
Copy link
Member

Choose a reason for hiding this comment

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

I see.

@mfontanini mfontanini merged commit 649d4a2 into main Feb 3, 2026
1 check passed
@mfontanini mfontanini deleted the chore/keeper-less-caching branch February 3, 2026 15:59
Copy link
Member

@jcabrero jcabrero left a comment

Choose a reason for hiding this comment

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

👍

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.

3 participants