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

SEP-10: Accept challenge transactions through clock drift #667

Merged
merged 4 commits into from
Jul 22, 2021

Conversation

morleyzhi
Copy link
Contributor

Accept challenge transactions that are 5 minutes off from their min and max time, to account for client clocks not matching server clocks.

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

One change request, otherwise looks great. Thanks for adding a solid test.

src/utils.ts Outdated
@@ -639,8 +639,12 @@ export namespace Utils {
const now = Math.floor(Date.now() / 1000);
const { minTime, maxTime } = transaction.timeBounds;

// give a small grace period for the transaction time to account for clock drift
const gracePeriod = 60 * 5;
Copy link
Member

Choose a reason for hiding this comment

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

Could you make this a parameter of the function, and pass the value in from the SEP-10 read function? This function is only used by the SEP-10 code today, but it is rather generic and the 5 minute time is appropriate for SEP-10 but may not be appropriate for other use cases.

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