forked from filecoin-project/go-state-types
/
system.go
34 lines (27 loc) · 780 Bytes
/
system.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package migration
import (
"context"
"github.com/CluEleSsUK/go-state-types/builtin/v8/system"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
)
// System Actor migrator
type systemActorMigrator struct {
OutCodeCID cid.Cid
ManifestData cid.Cid
}
func (m systemActorMigrator) migratedCodeCID() cid.Cid {
return m.OutCodeCID
}
func (m systemActorMigrator) migrateState(ctx context.Context, store cbor.IpldStore, in actorMigrationInput) (*actorMigrationResult, error) {
// The ManifestData itself is already in the blockstore
state := system.State{BuiltinActors: m.ManifestData}
stateHead, err := store.Put(ctx, &state)
if err != nil {
return nil, err
}
return &actorMigrationResult{
newCodeCID: m.OutCodeCID,
newHead: stateHead,
}, nil
}