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

fix market actor publish_storage_deals #1327

Merged
merged 5 commits into from
Dec 10, 2021
Merged

fix market actor publish_storage_deals #1327

merged 5 commits into from
Dec 10, 2021

Conversation

noot
Copy link
Contributor

@noot noot commented Dec 10, 2021

Summary of changes
Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes n/a

Other information and links

@noot noot requested a review from a user December 10, 2021 17:17
let mut msm = state.mutator(store);
msm.with_pending_proposals(Permission::ReadOnly);
msm.with_escrow_table(Permission::ReadOnly);
msm.with_locked_table(Permission::ReadOnly);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not tested but pretty sure you can chain withs like this:

let msm = state.mutator(store)
    .with_pending_proposals(Permission::ReadOnly)
    .with_escrow_table(Permission::ReadOnly)
    .with_locked_table(Permission::ReadOnly);

This would allow msm binding staying immutable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, i get an error when i try that:

error[E0716]: temporary value dropped while borrowed
   --> vm/actor/src/builtin/market/mod.rs:268:23
    |
268 |           let msm = state.mutator(store)
    |                         ^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
...
271 |           .with_locked_table(Permission::ReadOnly);
    |                                                   - temporary value is freed at the end of this statement
...
319 |               let client_balance_ok = msm
    |  _____________________________________-
320 | |                 .balance_covered(client, total_client_lockup.get(&client).unwrap())
    | |___________________________________________________________________________________- borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value

Copy link
Contributor

Choose a reason for hiding this comment

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

There are places like here where withs are chained but then a build is used. Not sure at all if we need this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh nice, yeah updated!

Copy link
Contributor

@elmattic elmattic left a comment

Choose a reason for hiding this comment

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

lgtm

@elmattic elmattic self-requested a review December 10, 2021 17:40
@noot noot merged commit 35aa3d5 into main Dec 10, 2021
@noot noot deleted the noot/fix-market branch December 10, 2021 21:16
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.

None yet

2 participants