-
Notifications
You must be signed in to change notification settings - Fork 46
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
Conversation
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 |
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.
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
chain/datasource/datasource.go
Outdated
@@ -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 |
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.
of
if err == nil { | ||
metrics.RecordInc(ctx, metrics.DataSourceActorStateChangesFastDiff) |
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 think either keep those counts or add diff time histogram metrics.
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.
addressed
* fix: correctly diff new actor version - closes #1144 * chore: remove unused metrics * metric: track GettActorStateChanges duration
* 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]>
nv18-rc1
#1144