-
Notifications
You must be signed in to change notification settings - Fork 399
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: manipulate entire context instead of TestSetXXX #3582
base: master
Are you sure you want to change the base?
refactor: manipulate entire context instead of TestSetXXX #3582
Conversation
🛠 PR Checks Summary🔴 Changes to 'docs' folder must be reviewed/authored by at least one devrel and one tech-staff Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
…nd + remove X_testSetOrigSend
…remove X_testSetOrigPkgAddr
If possible, lets rename and modify Once we get the API down, let me know, and I'll help on modifying the docs for this. |
IMHO, SkipHeigh make more sense with current usage and simpler to use because we do not need to get the current height to calculate the "newHeight" to set with SetHeight. I think we could have SetHeight and SetTimestamp if needed but usages are not the same. WDYT ? @leohhhn |
Co-authored-by: Morgan <morgan@morganbaz.com>
…-contexts-instead-of-testSetX
…-contexts-instead-of-testSetX
…-contexts-instead-of-testSetX
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.
can you revert this?
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.
overall lgtm
|
||
func testIssueCoins(addr string, denom []string, amt []int64) | ||
|
||
func SetOriginCaller(origCaller std.Address) { |
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.
func SetOriginCaller(origCaller std.Address) { | |
func (c *Context) SetOriginCaller(origCaller std.Address) { |
what about doing this, and also adding a func (c Context) String()
that we can print?
cc @thehowl
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.
I'm not sure about the stringer, I think it can already be printed well with fmt.Sprintf("%+v", c)
?
Maybe just doing that, not sure.
As for moving to Context, could be good mostly for godoc and "type organization"; in terms of usage, I think most usages would be testing.GetContext().SetXXX
, so maybe a bit more verbose.
func SetOriginCaller(origCaller std.Address) { | ||
ctx := GetContext() | ||
ctx.OriginCaller = origCaller | ||
SetContext(ctx) | ||
} |
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.
func SetOriginCaller(origCaller std.Address) { | |
ctx := GetContext() | |
ctx.OriginCaller = origCaller | |
SetContext(ctx) | |
} | |
func SetOriginCaller(origCaller std.Address) { | |
ctx := GetContext() | |
ctx.SetOriginCaller(origCaller) | |
} | |
func (ctx *Context) SetOriginCaller(origCaller std.Address) { | |
ctx.OriginCaller = origCaller | |
SetContext(ctx) | |
} |
maybe like this, where top-level funcs are aliases.
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.
I don't like the aliases and I asked Yo Ha to rollback this; because IMO it adds multiple ways of doing the same thing.
Linked to #1475
Should we do these refactors in the scope of this PR ?