-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add a StateExactCirculatingSupply command #4148
Conversation
60a9ae9
to
bc72681
Compare
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.
Logic looks good
api/api_full.go
Outdated
@@ -400,6 +400,9 @@ type FullNode interface { | |||
|
|||
// StateCirculatingSupply returns the circulating supply of Filecoin at the given tipset | |||
StateCirculatingSupply(context.Context, types.TipSetKey) (CirculatingSupply, error) | |||
// TODO: Remove StateCirculatingSupply maybe? |
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.
It's used by chainwatch/visor to put this data into postgres, which the CE team can query, so probably not
We could add a comment to StateCirculatingSupply saying that it's an approximation, and that people should use StateCirculatingSupply in most cases
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.
*StateExactCirculatingSupply
cli/state.go
Outdated
@@ -1638,6 +1639,34 @@ var stateCircSupplyCmd = &cli.Command{ | |||
}, | |||
} | |||
|
|||
// TODO: Remove stateCircSupplyCmd |
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'd
- Make this the default output of
circulating-supply
- Add a
--vm-supply
flag to get theapi.StateCirculatingSupply
one
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.
Yeah, sounds like the approx CircSupply isn't going anywhere, so I will do this
bc72681
to
c938424
Compare
func (sm *StateManager) GetExactCirculatingSupply(ctx context.Context, height abi.ChainEpoch, st *state.StateTree) (abi.TokenAmount, error) { | ||
circ := big.Zero() | ||
unCirc := big.Zero() | ||
err := st.ForEach(func(a address.Address, actor *types.Actor) error { |
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.
should skip further processing on actors with zero balance
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.
ack
a909a8c
to
fbcfa7c
Compare
a == builtin.SystemActorAddr || | ||
a == builtin.CronActorAddr || | ||
a == builtin.BurntFundsActorAddr || | ||
a == builtin.SaftAddress || |
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 could start including funds in this address post-liftoff, but eh
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.
or just include it now, there's only 4M in it.
971985a
to
4762430
Compare
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.
Not being completely in the know about the rationale behind these changes (the PR description doesn't explain much about the motivation of this change, which makes it hard to follow), it looks like a smell that:
- we have two circulating supplies,
- we're choosing to expose the "exact" one via the API by default, but letting the VM use the non-exact value.
Intuitively, something feels a bit off here, either the divergence in values, or the naming. The circulating supply is a crucial cryptoecon variable, and IMO it should be as minimally ambiguous as possible.
@raulk You're not wrong, as I understand it, we're kinda stuck between two requirements here.
The naming is intended to reflect that external parties probably wanna use the slow, accurate method. Very open to hearing recommendations, though. |
Apologies for ignorance, what does CE mean here? |
4762430
to
a56683c
Compare
CryptoEcon, sorry |
a56683c
to
83624a8
Compare
At height 136,374, circ supply is 15579755.735329679830248779 FIL