Skip to content

Addresses Josh and Janez PR comments #510

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

Merged
merged 3 commits into from
Aug 13, 2025

Conversation

joshuahannan
Copy link
Member

@joshuahannan joshuahannan commented Aug 12, 2025

Addresses the comments in #508 and #489

  • Renames some functions and arguments
  • Fixes a bug in process
  • Adds Execute entitlement

@joshuahannan joshuahannan changed the base branch from master to feature/callback-scheduling August 12, 2025 17:38
@@ -402,7 +403,7 @@ access(all) contract FlowCallbackScheduler {

/// Check if there are any timestamps that need processing
/// Returns true if processing is needed, false for early exit
access(all) fun check(current: UFix64): Bool {
access(all) fun checkIfTimestampsNeedProcessing(current: UFix64): Bool {
Copy link
Contributor

@devbugging devbugging Aug 13, 2025

Choose a reason for hiding this comment

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

More consistent naming if we want to have it verbose style

Suggested change
access(all) fun checkIfTimestampsNeedProcessing(current: UFix64): Bool {
access(all) fun hasBefore(current: UFix64): Bool {

Copy link
Member Author

Choose a reason for hiding this comment

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

good suggestion. That is a much better name

@@ -388,7 +389,7 @@ access(all) contract FlowCallbackScheduler {
}

/// Get all timestamps that are in the past (less than or equal to current timestamp)
access(all) fun past(current: UFix64): [UFix64] {
access(all) fun getTimestampsBefore(current: UFix64): [UFix64] {
Copy link
Contributor

@devbugging devbugging Aug 13, 2025

Choose a reason for hiding this comment

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

I actually preffer having more concise names, and if something is on the type it doesn't have to repeat the type, so it's getBefore becasue you would anyway have it called like: pastTimestamps.getBefore() while pastTimestamps.getTimestampsBefore() just repeats the type. This is subjective tho so don't want to force my opinion.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like getBefore. I'll update that

@@ -905,7 +910,7 @@ access(all) contract FlowCallbackScheduler {
callbackOwner: callback.handler.address
)
} else {
panic("Invalid Status: \(id) wrong status \(callback.status.rawValue)") // critical bug
panic("Invalid Status: Callback with id \(id) has wrong status \(callback.status.rawValue)") // critical bug
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT I think I've changed this to (in another PR, not sure where that is), but it feels better to first say the status after invalid status:... I made it that way so it's same as you made other errors.

Suggested change
panic("Invalid Status: Callback with id \(id) has wrong status \(callback.status.rawValue)") // critical bug
panic("Invalid Status: \(callback.status.rawValue) for callback id \(id)") // critical bug


// process the callbacks to make sure the garbage collection is triggered
processCallbacks()
// processCallbacks()
Copy link
Contributor

Choose a reason for hiding this comment

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

is it ok to leave things commented out like this? why not remove it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I should have just deleted it but I forgot. I removed it in the latest commit

Copy link
Contributor

@devbugging devbugging left a comment

Choose a reason for hiding this comment

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

Left some feedback

@joshuahannan joshuahannan merged commit 926eff2 into feature/callback-scheduling Aug 13, 2025
2 checks passed
@joshuahannan joshuahannan deleted the josh/address-PR-comments branch August 13, 2025 16:47
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.

2 participants