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

Refactor construction API #51

Merged
merged 14 commits into from
Oct 11, 2022
Merged

Refactor construction API #51

merged 14 commits into from
Oct 11, 2022

Conversation

andreibancioiu
Copy link
Contributor

@andreibancioiu andreibancioiu commented Oct 5, 2022

@andreibancioiu andreibancioiu self-assigned this Oct 5, 2022
Base automatically changed from metadata-04 to main October 5, 2022 07:46
@andreibancioiu andreibancioiu marked this pull request as ready for review October 10, 2022 14:02
@iulianpascalau iulianpascalau self-requested a review October 10, 2022 14:06
}

func isZeroAmount(amount string) bool {
return amount == "" || amount == "0" || amount == "-0"
Copy link
Contributor

Choose a reason for hiding this comment

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

what about "0.0"? or "00". Do we have a more robust way to find out that we cover all these cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, added a more robust solution - for integers, though (decimal numbers do not need to be handled - at least, not yet).

return errors.New("missing metadata: 'gasPrice'")
}
if metadata.Version != 1 {
return errors.New("bad metadata: unexpected 'version'")
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe

return fmt.Errorf("bad metadata: unexpected 'version' %v", metadata.Version)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, fixed.

@bogdan-rosianu bogdan-rosianu self-requested a review October 11, 2022 08:47
server/services/constructionMetadata.go Outdated Show resolved Hide resolved
server/services/constructionMetadata.go Show resolved Hide resolved
server/services/constructionOptions.go Show resolved Hide resolved
server/services/constructionService.go Outdated Show resolved Hide resolved

value, ok := big.NewInt(0).SetString(amount, 10)
if ok {
return value.Sign() == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@andreibancioiu andreibancioiu merged commit d34f31e into main Oct 11, 2022
@andreibancioiu andreibancioiu deleted the construction-refactor-05 branch October 11, 2022 13:33
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