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: correctly diff new actor version #1145

Merged
merged 4 commits into from
Mar 2, 2023

Conversation

frrist
Copy link
Member

@frrist frrist commented Feb 28, 2023

@frrist frrist self-assigned this Feb 28, 2023
Comment on lines +428 to +487
if newTree.Tree.Version() <= types.StateTreeVersion4 {
var act types.ActorV4
buf.Reset(change.After.Raw)
err := act.UnmarshalCBOR(buf)
buf.Reset(nil)
if err != nil {
return nil, err
}
ch.Actor = *types.AsActorV5(&act)
} else {
var act types.Actor
buf.Reset(change.After.Raw)
err := act.UnmarshalCBOR(buf)
buf.Reset(nil)
if err != nil {
return nil, err
}
ch.Actor = act
}

case hamt.Remove:
ch.ChangeType = tasks.ChangeTypeRemove
buf.Reset(change.Before.Raw)
err = ch.Actor.UnmarshalCBOR(buf)
buf.Reset(nil)
if err != nil {
return nil, err
if newTree.Tree.Version() <= types.StateTreeVersion4 {
var act types.ActorV4
buf.Reset(change.Before.Raw)
err := act.UnmarshalCBOR(buf)
buf.Reset(nil)
if err != nil {
return nil, err
}
ch.Actor = *types.AsActorV5(&act)
} else {
var act types.Actor
buf.Reset(change.Before.Raw)
err := act.UnmarshalCBOR(buf)
buf.Reset(nil)
if err != nil {
return nil, err
}
ch.Actor = act
}

case hamt.Modify:
ch.ChangeType = tasks.ChangeTypeModify
buf.Reset(change.After.Raw)
err = ch.Actor.UnmarshalCBOR(buf)
buf.Reset(nil)
if err != nil {
return nil, err
if newTree.Tree.Version() <= types.StateTreeVersion4 {
var act types.ActorV4
buf.Reset(change.After.Raw)
err := act.UnmarshalCBOR(buf)
buf.Reset(nil)
if err != nil {
return nil, err
}
ch.Actor = *types.AsActorV5(&act)
} else {
var act types.Actor
buf.Reset(change.After.Raw)
err := act.UnmarshalCBOR(buf)
buf.Reset(nil)
if err != nil {
return nil, err
}
ch.Actor = act
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 is the actual fix; we address it by mimicking the behaviour of lotus: https://github.com/filecoin-project/lotus/blob/v1.20.0-rc2/chain/state/statetree.go#L631

@@ -294,6 +291,43 @@ func ComputeGasOutputs(ctx context.Context, block *types.BlockHeader, message *t
return vm.ComputeGasOutputs(receipt.GasUsed, message.GasLimit, block.ParentBaseFee, message.GasFeeCap, message.GasPremium, burn), nil
}

type StateTreeMeta struct {
// Root is the root od Map
Copy link
Contributor

Choose a reason for hiding this comment

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

of

if err == nil {
metrics.RecordInc(ctx, metrics.DataSourceActorStateChangesFastDiff)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think either keep those counts or add diff time histogram metrics.

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed

@frrist frrist merged commit f014011 into frrist/nv18-rc1 Mar 2, 2023
@frrist frrist deleted the frrist/fix-diff-new-actor-cbor branch March 2, 2023 00:35
Terryhung pushed a commit that referenced this pull request Mar 3, 2023
* fix: correctly diff new actor version

- closes #1144

* chore: remove unused metrics

* metric: track GettActorStateChanges duration
birdychang pushed a commit that referenced this pull request Mar 8, 2023
* deps: update to lotus 1.20.0-rc2

* chore: update actor gen

- clean up types, remove lily actors types, replace with go-state-types

* Frrist/receipt events schema (#1132)

* feat: implement actor event task and schema

- track the value of EventRoots contained in message receipts.

* feat: implement message param schema and task

- create a table that records raw message parameters

* feat: track raw receipt return value

* fix schema index's after rebase on master

* fix: use builtin lotus method to get events

- it handles the case of legacy events

* fixup! Frrist/receipt events schema (#1132)

* deps: replace deprecated blocks package

- use github.com/ipfs/go-libipfs/blocks instead

* deps: update to v1.20.0 release

* feat: track verifreg actor claim HAMT changes (#1141)

* feat: track verified registry actor claim HAMT changes

- addresses request made here: https://github.com/protocol/pldw/issues/177#issuecomment-1372920524

* fix: correctly diff new actor version (#1145)

* fix: correctly diff new actor version

- closes #1144

* chore: remove unused metrics

* metric: track GettActorStateChanges duration

* feat: update lotus deps to support vm para/ret marshal (#1150)

- use lotus deps from filecoin-project/lotus#10372

* fix: resolve the duplication issue of db migration version

---------

Co-authored-by: Terry <[email protected]>
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

3 participants