Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

update for lotus/actors network upgrade changes #260

Closed
wants to merge 2 commits into from

Conversation

Stebalien
Copy link
Member

No description provided.

FaultedSectors map[int][]uint64
// FaultedSectors is a slice per-deadline faulty sectors. If the miner
// has no faulty sectors, this will be nil.
FaultedSectors [][]uint64
Copy link
Member Author

Choose a reason for hiding this comment

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

Is this acceptable? I'm trying to avoid hard-coding the number of deadlines.

if err != nil {
return nil, err
}

var mas miner.State
Copy link
Member Author

Choose a reason for hiding this comment

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

We didn't actually use this.

}
// need to modify the VM invoker to add the puppet actor
chainValInvoker := vm.NewInvoker()
chainValInvoker.Register(puppet.PuppetActorCodeID, puppet.Actor{}, puppet.State{})
Copy link
Member Author

Choose a reason for hiding this comment

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

This has been removed downstream. Did we need it?

Copy link
Member

Choose a reason for hiding this comment

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

We need only the ChaosActor (which replaced the PuppetActor) AFAIK, and this is done at https://github.com/filecoin-project/lotus/blob/master/conformance/driver.go#L144

So I think this is fine, and we should actually remove tvx/lotus/driver.go as this has now been moved to Lotus - something we can do after this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. I'm going to merge #246 which makes tvx use the lotus driver, and then we can erase the driver. I'll push to both PRs directly.

@@ -51,15 +51,12 @@ func (d *Driver) ExecuteMessage(msg *types.Message, preroot cid.Cid, bs blocksto
Syscalls: mkFakedSigSyscalls(vm.Syscalls(ffiwrapper.ProofVerifier)),
CircSupplyCalc: nil,
BaseFee: BaseFee,
NtwkVersion: func(context.Context, abi.ChainEpoch) network.Version {
// TODO: Network upgrade.
return network.Version0
Copy link
Member Author

Choose a reason for hiding this comment

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

For now, this is hard-coded at 0. But we'll probably want to add some form of lotus API call to get the actual version given a height.

Copy link
Member

Choose a reason for hiding this comment

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

This driver is actually not used any longer. We incubated it here, but we didn't erase it when it was moved to Lotus. This change needs to be applied here: https://github.com/filecoin-project/lotus/blob/master/conformance/driver.go#L125-L133. Will take care of it.


OTOH, I guess a hardcoded value is OK here for now, but we will want to change this in the test vector. How can we resolve, given a chain epoch, what network version to return here? There must be a function on Lotus side for that? (we don't need it exposed over the RPC).

@@ -45,9 +43,13 @@ func NewSurgeon(ctx context.Context, api api.FullNode, stores *Stores) *Surgeon
// compute a minimal state tree. In the future, thid method will dive into
// other system actors like the power actor and the market actor.
func (sg *Surgeon) GetMaskedStateTree(tsk types.TipSetKey, retain []address.Address) (cid.Cid, error) {
stateMap := adt.MakeEmptyMap(sg.stores.ADTStore)
// TODO: this will need to be parameterized on network version.
stateTree, err := state.NewStateTree(sg.stores.CBORStore, builtin.Version0)
Copy link
Member Author

Choose a reason for hiding this comment

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

Ditto. We'll need to get the version from the API.

// TODO: The simplest approach would be to just add a "remove" method
// (as below) to the init actor abstraction. However, I'm not sure if we
// even _want_ this code. From what I can tell, lotus never removes
// address in the init actor, even if the underlying actor disappears.
Copy link
Member Author

Choose a reason for hiding this comment

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

Big TODO. This is a weird case because:

  1. We usually only read state using these abstractions (we rarely modify).
  2. We never delete actors from this map. So any function to do so would exist for oni (of course, maybe we should be deleting actors?).

Copy link
Member Author

Choose a reason for hiding this comment

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

Alternatively, we could introduce per-version logic.

Copy link
Member

Choose a reason for hiding this comment

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

We only use this to trim down the state tree when we extract a test vector from an on-chain message. This constructs a synthetic state tree, with only the entries that the vector effectively needs. For a given message M, we don't need the full address mapping inside the init actor.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, it turns out that init_.State is now an interface, and we can't freely manipulate the underlying struct. We're gonna have to type assert into a concrete struct.

@nonsense
Copy link
Member

Just a note on the background of this code - it originates from the Lotus CLI tools, and is used to record various state around proving deadlines, number of sectors per miner, etc.

Copy link
Member

@nonsense nonsense left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Leaving up to @raulk to also double-check the Surgeon bit, but I think this is fine as well.

raulk added a commit that referenced this pull request Sep 24, 2020
@raulk raulk closed this in #261 Sep 28, 2020
@raulk raulk deleted the refactor/net-upgrade branch September 28, 2020 21:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants