This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Fix: Allows timeout field to accept both uint64 and string durations #80
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
agouin
reviewed
May 19, 2023
router/types/forward.go
Outdated
@@ -86,3 +89,28 @@ func (o JSONObject) MarshalJSON() ([]byte, error) { | |||
// primitive, return raw bytes. | |||
return o.primitive, nil | |||
} | |||
|
|||
func (d Duration) MarshalJSON() ([]byte, error) { | |||
return json.Marshal(time.Duration(d).String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should marshal to the nanoseconds value so it's backwards compatible with older PFM
Added logic to handle invalid unmarshalls. |
agouin
reviewed
May 20, 2023
Co-authored-by: Andrew Gouin <andrew@gouin.io>
agouin
approved these changes
May 20, 2023
boojamya
added a commit
that referenced
this pull request
May 23, 2023
…80) * timeout accetps both string and time.duration * feedback * handle invalid unmarshalls * Update router/ibc_middleware.go Co-authored-by: Andrew Gouin <andrew@gouin.io> * add test case for empty valid json --------- Co-authored-by: Andrew Gouin <andrew@gouin.io>
boojamya
added a commit
that referenced
this pull request
May 23, 2023
…80) * timeout accetps both string and time.duration * feedback * handle invalid unmarshalls * Update router/ibc_middleware.go Co-authored-by: Andrew Gouin <andrew@gouin.io> * add test case for empty valid json --------- Co-authored-by: Andrew Gouin <andrew@gouin.io>
boojamya
added a commit
that referenced
this pull request
May 23, 2023
…80) * timeout accetps both string and time.duration * feedback * handle invalid unmarshalls * Update router/ibc_middleware.go Co-authored-by: Andrew Gouin <andrew@gouin.io> * add test case for empty valid json --------- Co-authored-by: Andrew Gouin <andrew@gouin.io>
boojamya
added a commit
that referenced
this pull request
May 23, 2023
…80) * timeout accetps both string and time.duration * feedback * handle invalid unmarshalls * Update router/ibc_middleware.go Co-authored-by: Andrew Gouin <andrew@gouin.io> * add test case for empty valid json --------- Co-authored-by: Andrew Gouin <andrew@gouin.io>
jackzampolin
pushed a commit
that referenced
this pull request
May 23, 2023
* Fix: Allows timeout field to accept both uint64 and string durations (#80) * timeout accetps both string and time.duration * feedback * handle invalid unmarshalls * Update router/ibc_middleware.go Co-authored-by: Andrew Gouin <andrew@gouin.io> * add test case for empty valid json --------- Co-authored-by: Andrew Gouin <andrew@gouin.io> * timeout fix * remove unused make command --------- Co-authored-by: Andrew Gouin <andrew@gouin.io>
jackzampolin
pushed a commit
that referenced
this pull request
May 23, 2023
* Fix same bool being used for all 3 (#81) * fix: middleware panic upon receiving amount that is not int64; added test (#78) resolves #77 * Fix: Allows timeout field to accept both uint64 and string durations (#80) * timeout accetps both string and time.duration * feedback * handle invalid unmarshalls * Update router/ibc_middleware.go Co-authored-by: Andrew Gouin <andrew@gouin.io> * add test case for empty valid json --------- Co-authored-by: Andrew Gouin <andrew@gouin.io> * fix tests * remove unused protos * regen-protos * fix lint --------- Co-authored-by: Andrew Gouin <andrew@gouin.io> Co-authored-by: Max Kupriianov <max@kc.vc>
jackzampolin
pushed a commit
that referenced
this pull request
May 23, 2023
* Fix same bool being used for all 3 (#81) * fix: middleware panic upon receiving amount that is not int64; added test (#78) resolves #77 * Fix: Allows timeout field to accept both uint64 and string durations (#80) * timeout accetps both string and time.duration * feedback * handle invalid unmarshalls * Update router/ibc_middleware.go Co-authored-by: Andrew Gouin <andrew@gouin.io> * add test case for empty valid json --------- Co-authored-by: Andrew Gouin <andrew@gouin.io> * fix for ibc-go version * re gen protos * remove unused make test command * fix lint --------- Co-authored-by: Andrew Gouin <andrew@gouin.io> Co-authored-by: Max Kupriianov <max@kc.vc>
jackzampolin
pushed a commit
that referenced
this pull request
May 23, 2023
* Fix same bool being used for all 3 (#81) * fix: middleware panic upon receiving amount that is not int64; added test (#78) resolves #77 * Fix: Allows timeout field to accept both uint64 and string durations (#80) * timeout accetps both string and time.duration * feedback * handle invalid unmarshalls * Update router/ibc_middleware.go Co-authored-by: Andrew Gouin <andrew@gouin.io> * add test case for empty valid json --------- Co-authored-by: Andrew Gouin <andrew@gouin.io> * make compliant with ibc-go version and fix lint * remove unused make test command * regen protos * add lint check to CI --------- Co-authored-by: Andrew Gouin <andrew@gouin.io> Co-authored-by: Max Kupriianov <max@kc.vc>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the
timeout
field only works with time.duration types. So the example in the readme of using a time out of\"timeout\":\"10m\"
does not work and causes the asset to get stuck on the middle chain.Currently, if you want a 10 minute timeout you need to convert it to nanoseconds:
\"timeout\": 600000000000
.This fixes the issue and allows users to use either a nanosecond uint64 OR a string format.
I've also confirmed this works using an interchaintest test case on noble chain. See lines 632
and 688 for both a uint64 version and a string version.
Once accepted, I can backport to v4, v5, v6, and main.