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

Adding CircSupply Calculations #710

Merged
merged 42 commits into from
Oct 28, 2020
Merged

Adding CircSupply Calculations #710

merged 42 commits into from
Oct 28, 2020

Conversation

RajarupanSampanthan
Copy link
Contributor

Summary of changes
Changes introduced in this pull request:

  • Ports over CircSupply related functionality from Lotus

Reference issue to close (if applicable)

Closes #677

Other information and links

Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

This logic should be replacing that in total_fil_circ_supply, this isn't connected in any way.

Also there is a lot of duplicate logic, try to create abstractions to reduce this, somewhat like how it is done in total_fil_circ_supply currently

blockchain/state_manager/src/lib.rs Outdated Show resolved Hide resolved
blockchain/state_manager/src/lib.rs Outdated Show resolved Hide resolved
@ec2
Copy link
Member

ec2 commented Sep 23, 2020

Building on what Austin said, I dont see why you need the ChainStore in the first place? I dont see any indications that the ChainStore is needed. Every time cs is used, you're using cs.db, which indicates to me you really only want the database (which is already in the StateManager) and not the ChainStore.

blockchain/state_manager/src/utils.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

I don't think incomplete network upgrade logic is worth bringing in, especially since untested. Can you please just remove it and just have the calculation based on the original and add TODOs where necessary? It's unclear we will even support this upgrade

types/src/lib.rs Outdated Show resolved Hide resolved
vm/actor/src/builtin/power/state.rs Outdated Show resolved Hide resolved
vm/actor/src/builtin/reward/state.rs Outdated Show resolved Hide resolved
vm/interpreter/src/circ_supply.rs Outdated Show resolved Hide resolved
vm/interpreter/src/circ_supply.rs Outdated Show resolved Hide resolved
vm/interpreter/src/circ_supply.rs Outdated Show resolved Hide resolved
vm/interpreter/src/circ_supply.rs Outdated Show resolved Hide resolved
vm/interpreter/src/circ_supply.rs Outdated Show resolved Hide resolved
vm/interpreter/src/vm.rs Outdated Show resolved Hide resolved
Co-authored-by: Austin Abell <austinabell8@gmail.com>
Co-authored-by: Austin Abell <austinabell8@gmail.com>
@ec2
Copy link
Member

ec2 commented Oct 15, 2020

Most of this stuff should probably live in the state manager. This is because there will API endpoint implemented for most/all of these functions.

Comment on lines 484 to 487
let default_preignition =
setup_preignition_genesis_actors_testnet(self.store).unwrap_or_default();
let default_postignition =
setup_postignition_genesis_actors_testnet(self.store).unwrap_or_default();
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic should not be inside of the VM. Also, this is being called every time there is a send in the VM, terribly inefficient

Copy link
Member

Choose a reason for hiding this comment

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

I think this should be passed into the VM::new() as a function pointer right? I believe that was the whole point of that change.

Copy link
Member

Choose a reason for hiding this comment

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

Well, acutally I dont meant that directly. It should be called every time you do a get_vm_circulating_supply. and that is what should be passed as the funciton pointer

Copy link
Contributor

Choose a reason for hiding this comment

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

The circ supply calculation should yes, this is not really related to that, and this function should not be called every time that is called, only when it's not initialized

Comment on lines 107 to 108
pre_ignition: GenesisInfo,
post_ignition: GenesisInfo,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be attached to the runtime, this does not allow for swapable circ supply calculations

tests/conformance_tests/tests/conformance_runner.rs Outdated Show resolved Hide resolved
tests/conformance_tests/tests/conformance_runner.rs Outdated Show resolved Hide resolved
blockchain/state_manager/src/vm_circ_supply.rs Outdated Show resolved Hide resolved
blockchain/state_manager/src/vm_circ_supply.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

did some cleanup after your review @ec2 if you want to double check

@ec2
Copy link
Member

ec2 commented Oct 28, 2020

looked at the changes, lgtm

@austinabell austinabell merged commit 2e1bb09 into main Oct 28, 2020
@austinabell austinabell deleted the rupan/curc_supply branch October 28, 2020 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update total fil circ supply calculations
4 participants