-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[adapter][move] Relax object/pure arg ordering. remove return values #1474
Conversation
There are some gas tests that are failing, but I'm having a bit of trouble debugging them, maybe @lxfind, you will be able to help?
|
We need to load the immediate dependencies for safety reasons. |
Gotcha, makes sense. And do we not need to do it recursively? Because we assume the non-immediate deps are in a sane state? |
Correct, if a validator is aware of a package, it must have successfully executed the cert that publishes that package, which means all the dependencies of that package must be on-chain. So we don't need to check non-immediate dependencies. |
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.
Thanks! Amazing work. This is going to take a few iterations to review.
A few high-level comments:
- Why do we change to not pass in the objects to adapter? Is it really cleaner that way? If so, perhaps add a TODO somewhere that when we construct the TemporaryStore, we should just consume the input objects to avoid unnecessary clones.
- This PR seems to be doing many things at once, making it difficult to review.. I recommend in the future we try to break up PRs.
package_obj = object; | ||
&package_obj |
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.
Is this the same as &object.clone()
?
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.
No, the object
here is already owned (object: Object
), so the clone wouldn't do anything. This is a trick for getting around the lifetimes. If you try doing Some(object) => &object
, it complains that the reference will not live long enough. This is a trick that forces the lifetime outside of the match, thus letting it live long enough.
I tried cleaning up the logic that that had a count of the number of the objects, and then used
I apologize about that, and I still can try to do that now that it all makes a bit more sense to me. A bit of that comes from my unfamiliarity with the codebase. This PR is really the result of me just changing things and having the type checker yell, and I then fix it until it goes away. |
I tried to revert most of the spurious changes |
Adding @patrickkuo @666lcz for visibility on the changes to the gateway API. |
I think we still have two copies of the objects: one in |
Ah, yeah there is no real work to remove the clone there, just missed it (like no rearchitecting, just removing the & and reordering a few calls) |
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.
LGTM. Thank you!
Please take a look at the comments.
Also, @patrickkuo please confirm that the changes in the rest server and rpc server are good.
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.
rest and rpc_gateway changes LGTM
- Relaxed ordering on entry points, so object and pure arguments can be intermixed - Added new enum CallArg to support this - Removed return values from entry points - Removed CallResult
…remove return values
…ering. remove return values
…arg ordering. remove return values
…t/pure arg ordering. remove return values
…x object/pure arg ordering. remove return values
…e] Relax object/pure arg ordering. remove return values
A lot of the input object logic was gutted as the adapter rarely needs the owned object, so it now defers to loading an object reference.
I removed the loading of immediate dependencies for publish transactions. It will fail fairly quickly inside the VM, but I can put the eager logic back (I'm just not sure it is needed)