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

'CollateralFromMinerBalance=false' does not work for ProveReplicaUpdates3 #12014

Open
5 of 11 tasks
hyunmoon opened this issue May 18, 2024 · 9 comments
Open
5 of 11 tasks

Comments

@hyunmoon
Copy link

hyunmoon commented May 18, 2024

Checklist

  • This is not a security-related bug/issue. If it is, please follow please follow the security policy.
  • I have searched on the issue tracker and the lotus forum, and there is no existing related issue or discussion.
  • I am running the Latest release, the most recent RC(release canadiate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.
  • I did not make any code changes to lotus.

Lotus component

  • lotus daemon - chain sync
  • lotus fvm/fevm - Lotus FVM and FEVM interactions
  • lotus miner/worker - sealing
  • lotus miner - proving(WindowPoSt/WinningPoSt)
  • lotus JSON-RPC API
  • lotus message management (mpool)
  • Other

Lotus Version

v1.26.2

Repro Steps

  1. Set CollateralFromMinerBalance = false
  2. Snap-up a sector
  3. See that the collateral has been paid from the miner's available balance

Describe the Bug

https://filecoinproject.slack.com/archives/CPFTWMY7N/p1714914337529209

ProveReplicaUpdates3 does not obey the 'CollateralFromMinerBalance=false' parameter in lotus-miner's config.
It will always spend collateral from the miner's available balance unlike ProveCommitSector.

Attaching @LexLuthr's comment on Slack:

"Looks like we are not using this param in batching path"

Logging Information

N/A
@hyunmoon
Copy link
Author

@LexLuthr
log.Infof("Initial value of collateral is %s", collateral.String())
Added this line after storage/pipeline/states_replica_update.go#L141 per request.

And got this:
2024-07-10T15:00:42.331+0900 INFO sectors pipeline/states_replica_update.go:142 Initial value of collateral is 167015280640685324

@LexLuthr
Copy link
Contributor

@hyunmoon That was a bit unexpected. Any chance you can run one more test but this time add the log after each code line which changes collateral?


@hyunmoon
Copy link
Author

hyunmoon commented Jul 10, 2024

@LexLuthr

2024-07-11T00:13:30.370+0900	INFO	sectors	pipeline/states_replica_update.go:142	After line 141, Initial value of collateral is 166917098170496416
2024-07-11T00:13:30.370+0900	INFO	sectors	pipeline/states_replica_update.go:153	After line 151, Initial value of collateral is 0
2024-07-11T00:13:30.370+0900	INFO	sectors	pipeline/states_replica_update.go:160	After line 157, Initial value of collateral is 0

https://filfox.info/en/message/bafy2bzacecj3oycep5tn5llcdfoayls3v2kinixihc2ch4euyiwao2pbzar3y?t=1

@LexLuthr
Copy link
Contributor

@hyunmoon I don't see collateral being subtracted from miner balance. Can you point me to that for the above message?

@hyunmoon
Copy link
Author

hyunmoon commented Jul 10, 2024

@LexLuthr
Sure. Compare the link above with my most recent ProveCommitSector message here:
https://filfox.info/en/message/bafy2bzaceaigz2rluvq7ia2vczivstnohguextpu7nghdldwzfsjmwidbmtc6?t=1

Notice the 3rd transaction tranfsers balance from the worker wallet to the miner.
Without a transfer looking like this, the collateral gets spent from the miner balance.

The most straight forward way to tell if the balance has been spent from the miner balance is looking at the message's value on filfox.
0 means it has been spent from the miner balnace. Non zero means it has been spent from somewhere else.

@LexLuthr
Copy link
Contributor

@hyunmoon That is not entirely correct. What if required collateral itself is 0. Which seems to be the case in our logs. We calculate initial value for collateral but then we compare it to what we already paid for CC sector and it comes out we have already paid the difference. So, we are not sending the collateral anymore. If your miner balance is still deducted then either the subtraction of previously paid collateral is incorrect or original calculated collateral is too low. Can you confirm a case where this was deducted?

@hyunmoon
Copy link
Author

hyunmoon commented Jul 11, 2024

@LexLuthr As I am onboarding verified deals, additional collateral is always needed.
Therefore, my miner balance is always deducted by 9x the CC sector's collateral.

I believe the current code for ProveReplicaUpdates3 is missing the compensation mechanism before spending the collateral.
For example, a ProveReplicaUpdates message (see here: Filfox message link) would send approximately 1.95 FIL from the worker to the miner.

However, a ProveReplicaUpdates3 message (see here: Filfox message link) would not send anything from the worker to the miner, even if CollateralFromMinerBalance is set to false.

@LexLuthr
Copy link
Contributor

It is not the method. The calculation of how much collateral is required has to be incorrect part. Sending mechanism is not unique to this method. I think we are calculating incorrect collateral in the first place. Let me check with @magik6k about the code that runs the calculations. It was changed for NV22.

@rjan90
Copy link
Contributor

rjan90 commented Jan 10, 2025

Hey @hyunmoon! I´m wondering if you have seen this issue recently? Reason for asking, is because filecoin-project/go-state-types#291 which has been merged and bubbled up to Lotus for quite some time now, could have fixed this - but we need a clear signal before closing.

@rjan90 rjan90 added this to FilOz Jan 15, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FilOz Jan 15, 2025
@rjan90 rjan90 removed the status in FilOz Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants