feat: Skeleton for nv23 (#11964)
* Use local GST Use local GST * Import actors and define upgrade heights Creatin a mock actor-bundle and define upgrade heights * Generate adapters Updates gen/inlinegen-data.json, and runs make actors-gen * Add schedule and migration Add schedule and migration * Add upgrade and network version fields/params Add upgrade and network version fields/params * Run make gen / make docsgen-cli Run make gen / make docsgen-cli * Update filecoin-ffi Update filecoin-ffi to the v1.28.0-dev tag, which supports the nv23 skeleton. * Update GST to v0.14.0-dev Update GST to v0.14.0-dev, which includes the nv23 skeleton * Add support for actor version 14 in actor registry Add support for actor version 14 in actor registry
This commit is contained in:
parent
d6d4fee4b6
commit
2d57bfe273
@ -346,6 +346,7 @@ type ForkUpgradeParams struct {
|
|||||||
UpgradeWatermelonHeight abi.ChainEpoch
|
UpgradeWatermelonHeight abi.ChainEpoch
|
||||||
UpgradeDragonHeight abi.ChainEpoch
|
UpgradeDragonHeight abi.ChainEpoch
|
||||||
UpgradePhoenixHeight abi.ChainEpoch
|
UpgradePhoenixHeight abi.ChainEpoch
|
||||||
|
UpgradeAussieHeight abi.ChainEpoch
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChainExportConfig holds configuration for chain ranged exports.
|
// ChainExportConfig holds configuration for chain ranged exports.
|
||||||
|
BIN
build/actors/v14.tar.zst
Normal file
BIN
build/actors/v14.tar.zst
Normal file
Binary file not shown.
@ -117,9 +117,32 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
|||||||
"system": MustParseCid("bafk2bzacec3vwj2chzaram3iqupkbfiein5h2l5qiltlrngbju2vg5umelclm"),
|
"system": MustParseCid("bafk2bzacec3vwj2chzaram3iqupkbfiein5h2l5qiltlrngbju2vg5umelclm"),
|
||||||
"verifiedregistry": MustParseCid("bafk2bzacedv2irkql7nil3w5v3ohqq3e54w62pxeoppjmaktzokolaaoh5ksu"),
|
"verifiedregistry": MustParseCid("bafk2bzacedv2irkql7nil3w5v3ohqq3e54w62pxeoppjmaktzokolaaoh5ksu"),
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
Network: "butterflynet",
|
||||||
|
Version: 13,
|
||||||
|
|
||||||
|
ManifestCid: MustParseCid("bafy2bzacec75zk7ufzwx6tg5avls5fxdjx5asaqmd2bfqdvkqrkzoxgyflosu"),
|
||||||
|
Actors: map[string]cid.Cid{
|
||||||
|
"account": MustParseCid("bafk2bzacedl533kwbzouqxibejpwp6syfdekvmzy4vmmno6j4iaydbdmv4xek"),
|
||||||
|
"cron": MustParseCid("bafk2bzacecimv5xnuwyoqgxk26qt4xqpgntleret475pnh35s3vvhqtdct4ow"),
|
||||||
|
"datacap": MustParseCid("bafk2bzacebpdd4ctavhs7wkcykfahpifct3p4hbptgtf4jfrqcp2trtlygvow"),
|
||||||
|
"eam": MustParseCid("bafk2bzaceahw5rrgj7prgbnmn237di7ymjz2ssea32wr525jydpfrwpuhs67m"),
|
||||||
|
"ethaccount": MustParseCid("bafk2bzacebrslcbew5mq3le2zsn36xqxd4gt5hryeoslxnuqwgw3rhuwh6ygu"),
|
||||||
|
"evm": MustParseCid("bafk2bzaced5smz4lhpem4mbr7igcskv3e5qopbdp7dqshww2qs4ahacgzjzo4"),
|
||||||
|
"init": MustParseCid("bafk2bzacedgj6hawhdw2ot2ufisci374o2bq6bfkvlvdt6q7s3uoe5ffyv43k"),
|
||||||
|
"multisig": MustParseCid("bafk2bzacectnnnpwyqiccaymy3h6ghu74ghjrqyhtqv5odfd4opivzebjj6to"),
|
||||||
|
"paymentchannel": MustParseCid("bafk2bzaceckhx44jawhzhkz6k23gfnv2gcutgb4j4ekhonj2plwaent4b2tpk"),
|
||||||
|
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||||
|
"reward": MustParseCid("bafk2bzacebbs3rlg7y3wbvxrj4wgbsqmasw4ksbbr3lyqbkaxj2t25qz6zzuy"),
|
||||||
|
"storagemarket": MustParseCid("bafk2bzaced3zmxsmlhp2nsiwkxcp2ugonbsebcd53t7htzo2jcoidvu464xmm"),
|
||||||
|
"storageminer": MustParseCid("bafk2bzacebedx7iaa2ruspxvghkg46ez7un5b7oiijjtnvddq2aot5wk7p7ry"),
|
||||||
|
"storagepower": MustParseCid("bafk2bzacebvne7m2l3hxxw4xa6oujol75x35yqpnlqiwx74jilyrop4cs7cse"),
|
||||||
|
"system": MustParseCid("bafk2bzaceacjmlxrvydlud77ilpzbscez46yedx6zjsj6olxsdeuv6d4x4cwe"),
|
||||||
|
"verifiedregistry": MustParseCid("bafk2bzacebs5muoq7ft2wgqojhjio7a4vltbyprqkmlr43ojlzbil4nwvj3jg"),
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
Network: "butterflynet",
|
Network: "butterflynet",
|
||||||
Version: 13,
|
Version: 14,
|
||||||
BundleGitTag: "v13.0.0",
|
BundleGitTag: "v13.0.0",
|
||||||
ManifestCid: MustParseCid("bafy2bzacec75zk7ufzwx6tg5avls5fxdjx5asaqmd2bfqdvkqrkzoxgyflosu"),
|
ManifestCid: MustParseCid("bafy2bzacec75zk7ufzwx6tg5avls5fxdjx5asaqmd2bfqdvkqrkzoxgyflosu"),
|
||||||
Actors: map[string]cid.Cid{
|
Actors: map[string]cid.Cid{
|
||||||
@ -246,9 +269,32 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
|||||||
"system": MustParseCid("bafk2bzacecioupndtcnyw6iq2hbrxag3aufvczlv5nobnfbkbywqzcyfaa376"),
|
"system": MustParseCid("bafk2bzacecioupndtcnyw6iq2hbrxag3aufvczlv5nobnfbkbywqzcyfaa376"),
|
||||||
"verifiedregistry": MustParseCid("bafk2bzaceavldupmf7bimeeacs67z5xdfdlfca6p7sn6bev3mt5ggepfqvhqo"),
|
"verifiedregistry": MustParseCid("bafk2bzaceavldupmf7bimeeacs67z5xdfdlfca6p7sn6bev3mt5ggepfqvhqo"),
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
Network: "calibrationnet",
|
||||||
|
Version: 13,
|
||||||
|
|
||||||
|
ManifestCid: MustParseCid("bafy2bzacect4ktyujrwp6mjlsitnpvuw2pbuppz6w52sfljyo4agjevzm75qs"),
|
||||||
|
Actors: map[string]cid.Cid{
|
||||||
|
"account": MustParseCid("bafk2bzaceb3j36ri5y5mfklgp5emlvrms6g4733ss2j3l7jismrxq6ng3tcc6"),
|
||||||
|
"cron": MustParseCid("bafk2bzaceaz6rocamdxehgpwcbku6wlapwpgzyyvkrploj66mlqptsulf52bs"),
|
||||||
|
"datacap": MustParseCid("bafk2bzacea22nv5g3yngpxvonqfj4r2nkfk64y6yw2malicm7odk77x7zuads"),
|
||||||
|
"eam": MustParseCid("bafk2bzaceatqtjzj7623i426noaslouvluhz6e3md3vvquqzku5qj3532uaxg"),
|
||||||
|
"ethaccount": MustParseCid("bafk2bzacean3hs7ga5csw6g3uu7watxfnqv5uvxviebn3ba6vg4sagwdur5pu"),
|
||||||
|
"evm": MustParseCid("bafk2bzacec5ibmbtzuzjgwjmksm2n6zfq3gkicxqywwu7tsscqgdzajpfctxk"),
|
||||||
|
"init": MustParseCid("bafk2bzaced5sq72oemz6qwi6yssxwlos2g54zfprslrx5qfhhx2vlgsbvdpcs"),
|
||||||
|
"multisig": MustParseCid("bafk2bzacedbgei6jkx36fwdgvoohce4aghvpohqdhoco7p4thszgssms7olv2"),
|
||||||
|
"paymentchannel": MustParseCid("bafk2bzaceasmgmfsi4mjanxlowsub65fmevhzky4toeqbtw4kp6tmu4kxjpgq"),
|
||||||
|
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||||
|
"reward": MustParseCid("bafk2bzacedjyp6ll5ez27dfgldjj4tntxfvyp4pa5zkk7s5uhipzqjyx2gmuc"),
|
||||||
|
"storagemarket": MustParseCid("bafk2bzaceabolct6qdnefwcrtati2us3sxtxfghyqk6aamfhl6byyefmtssqi"),
|
||||||
|
"storageminer": MustParseCid("bafk2bzaceckzw3v7wqliyggvjvihz4wywchnnsie4frfvkm3fm5znb64mofri"),
|
||||||
|
"storagepower": MustParseCid("bafk2bzacea7t4wynzjajl442mpdqbnh3wusjusqtnzgpvefvweh4n2tgzgqhu"),
|
||||||
|
"system": MustParseCid("bafk2bzacedjnrb5glewazsxpcx6rwiuhl4kwrfcqolyprn6rrjtlzmthlhdq6"),
|
||||||
|
"verifiedregistry": MustParseCid("bafk2bzacebj2zdquagzy2xxn7up574oemg3w7ed3fe4aujkyhgdwj57voesn2"),
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
Network: "calibrationnet",
|
Network: "calibrationnet",
|
||||||
Version: 13,
|
Version: 14,
|
||||||
BundleGitTag: "v13.0.0",
|
BundleGitTag: "v13.0.0",
|
||||||
ManifestCid: MustParseCid("bafy2bzacect4ktyujrwp6mjlsitnpvuw2pbuppz6w52sfljyo4agjevzm75qs"),
|
ManifestCid: MustParseCid("bafy2bzacect4ktyujrwp6mjlsitnpvuw2pbuppz6w52sfljyo4agjevzm75qs"),
|
||||||
Actors: map[string]cid.Cid{
|
Actors: map[string]cid.Cid{
|
||||||
@ -384,9 +430,32 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
|||||||
"system": MustParseCid("bafk2bzacedye5j5uxox7knb6zlnhseaadztyav76mjbyk5qslhhbpiy5cdtt2"),
|
"system": MustParseCid("bafk2bzacedye5j5uxox7knb6zlnhseaadztyav76mjbyk5qslhhbpiy5cdtt2"),
|
||||||
"verifiedregistry": MustParseCid("bafk2bzacecduww5pirr7dvaijjijw4gf6ygf7vipgxh4scvv6vseo46gueb46"),
|
"verifiedregistry": MustParseCid("bafk2bzacecduww5pirr7dvaijjijw4gf6ygf7vipgxh4scvv6vseo46gueb46"),
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
Network: "caterpillarnet",
|
||||||
|
Version: 13,
|
||||||
|
|
||||||
|
ManifestCid: MustParseCid("bafy2bzacedu7kk2zngxp7y3lynhtaht6vgadgn5jzkxe5nuowtwzasnogx63w"),
|
||||||
|
Actors: map[string]cid.Cid{
|
||||||
|
"account": MustParseCid("bafk2bzacecro3uo6ypqhfzwdhnamzcole5qmhrbkx7qny6t2qsrcpqxelt6s2"),
|
||||||
|
"cron": MustParseCid("bafk2bzaceam3kci46y4siltbw7f4itoap34kp7b7pvn2fco5s2bvnotomwdbe"),
|
||||||
|
"datacap": MustParseCid("bafk2bzacecmtdspcbqmmjtsaz4vucuqoqjqfsgxjonns7tom7eblkngbcm7bw"),
|
||||||
|
"eam": MustParseCid("bafk2bzaceaudqhrt7djewopqdnryvwxagfufyt7ja4gdvovrxbh6edh6evgrw"),
|
||||||
|
"ethaccount": MustParseCid("bafk2bzaced676ds3z6xe333wr7frwq3f2iq5kjwp4okl3te6rne3xf7kuqrwm"),
|
||||||
|
"evm": MustParseCid("bafk2bzacebeih4jt2s6mel6x4hje7xmnugh6twul2a5axx4iczu7fu4wcdi6k"),
|
||||||
|
"init": MustParseCid("bafk2bzaceba7vvuzzwj5wqnq2bvpbgtxup53mhr3qybezbllftnxvpqbfymxo"),
|
||||||
|
"multisig": MustParseCid("bafk2bzaceapkajhnqoczrgry5javqbl7uebgmsbpqqfemzc4yb5q2dqia2qog"),
|
||||||
|
"paymentchannel": MustParseCid("bafk2bzacebg7xq4ca22gafmdbkcq357x7v6slflib4h3fnj4amsovg6ulqg3o"),
|
||||||
|
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||||
|
"reward": MustParseCid("bafk2bzaceajt4idf26ffnyipybcib55fykjxnek7oszkqzi7lu7mbgijmkgos"),
|
||||||
|
"storagemarket": MustParseCid("bafk2bzaceadfmay7pyl7osjsdmrireafasnjnoziacljy5ewrcsxpp56kzqbw"),
|
||||||
|
"storageminer": MustParseCid("bafk2bzaceardbn5a7aq5jxl7efr4btmsbl7txnxm4hrrd3llyhujuc2cr5vcs"),
|
||||||
|
"storagepower": MustParseCid("bafk2bzacear4563jznjqyseoy42xl6kenyqk6umv6xl3bp5bsjb3hbs6sp6bm"),
|
||||||
|
"system": MustParseCid("bafk2bzacecc5oavxivfnvirx2g7megpdf6lugooyoc2wijloju247xzjcdezy"),
|
||||||
|
"verifiedregistry": MustParseCid("bafk2bzacebnkdt42mpf5emypo6iroux3hszfh5yt54v2mmnnura3ketholly4"),
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
Network: "caterpillarnet",
|
Network: "caterpillarnet",
|
||||||
Version: 13,
|
Version: 14,
|
||||||
BundleGitTag: "v13.0.0",
|
BundleGitTag: "v13.0.0",
|
||||||
ManifestCid: MustParseCid("bafy2bzacedu7kk2zngxp7y3lynhtaht6vgadgn5jzkxe5nuowtwzasnogx63w"),
|
ManifestCid: MustParseCid("bafy2bzacedu7kk2zngxp7y3lynhtaht6vgadgn5jzkxe5nuowtwzasnogx63w"),
|
||||||
Actors: map[string]cid.Cid{
|
Actors: map[string]cid.Cid{
|
||||||
@ -513,9 +582,32 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
|||||||
"system": MustParseCid("bafk2bzacecnau5wddulbsvwn75tc3w75jrlvkybgrlxs4ngonqab6xq3eowvg"),
|
"system": MustParseCid("bafk2bzacecnau5wddulbsvwn75tc3w75jrlvkybgrlxs4ngonqab6xq3eowvg"),
|
||||||
"verifiedregistry": MustParseCid("bafk2bzacec37mddea65nvh4htsagtryfa3sq6i67utcupslyhzbhjhoy6hopa"),
|
"verifiedregistry": MustParseCid("bafk2bzacec37mddea65nvh4htsagtryfa3sq6i67utcupslyhzbhjhoy6hopa"),
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
Network: "devnet",
|
||||||
|
Version: 13,
|
||||||
|
|
||||||
|
ManifestCid: MustParseCid("bafy2bzacecn7uxgehrqbcs462ktl2h23u23cmduy2etqj6xrd6tkkja56fna4"),
|
||||||
|
Actors: map[string]cid.Cid{
|
||||||
|
"account": MustParseCid("bafk2bzacebev3fu5geeehpx577b3kvza4xsmmggmepjj7rlsnr27hpoq27q2i"),
|
||||||
|
"cron": MustParseCid("bafk2bzacedalzqahtuz2bmnf7uawbcujfhhe5xzv5ys5ufadu6ggs3tcu6lsy"),
|
||||||
|
"datacap": MustParseCid("bafk2bzaceb7ou2vn7ac4xidespoowq2q5w7ognr7s4ujy3xzzgiishajpe7le"),
|
||||||
|
"eam": MustParseCid("bafk2bzacedqic2qskattorj4svf6mbto2k76ej3ll3ugsyorqramrg7rpq3by"),
|
||||||
|
"ethaccount": MustParseCid("bafk2bzaceaoad7iknpywijigv2h3jyvkijff2oxvohzue533v5hby3iix5vdu"),
|
||||||
|
"evm": MustParseCid("bafk2bzacecjgiw26gagsn6a7tffkrgoor4zfgzfokp76u6cwervtmvjbopmwg"),
|
||||||
|
"init": MustParseCid("bafk2bzaced2obubqojxggeddr246cpwtyzi6knnq52jsvsc2fs3tuk2kh6dtg"),
|
||||||
|
"multisig": MustParseCid("bafk2bzacebquruzb6zho45orbdkku624t6w6jt4tudaqzraz4yh3li3jfstpg"),
|
||||||
|
"paymentchannel": MustParseCid("bafk2bzaceaydrilyxvflsuzr24hmw32qwz6sy4hgls73bhpveydcsqskdgpca"),
|
||||||
|
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||||
|
"reward": MustParseCid("bafk2bzaceb74owpuzdddqoj2tson6ymbyuguqrnqefyiaxqvwm4ygitpabjrq"),
|
||||||
|
"storagemarket": MustParseCid("bafk2bzaceaw6dslv6pfqha4ynghq2imij5khnnjrie22kmfgtpie3bvxho6jq"),
|
||||||
|
"storageminer": MustParseCid("bafk2bzacecsputz6xygjfyrvx2d7bxkpp7b5v4icrmpckec7gnbabx2w377qs"),
|
||||||
|
"storagepower": MustParseCid("bafk2bzaceceyaa5yjwhxvvcqouob4l746zp5nesivr6enhtpimakdtby6kafi"),
|
||||||
|
"system": MustParseCid("bafk2bzaceaxg6k5vuozxlemfi5hv663m6jcawzu5puboo4znj73i36e3tsovs"),
|
||||||
|
"verifiedregistry": MustParseCid("bafk2bzacea2czkb4vt2iiiwdb6e57qfwqse4mk2pcyvwjmdl5ojbnla57oh2u"),
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
Network: "devnet",
|
Network: "devnet",
|
||||||
Version: 13,
|
Version: 14,
|
||||||
BundleGitTag: "v13.0.0",
|
BundleGitTag: "v13.0.0",
|
||||||
ManifestCid: MustParseCid("bafy2bzacecn7uxgehrqbcs462ktl2h23u23cmduy2etqj6xrd6tkkja56fna4"),
|
ManifestCid: MustParseCid("bafy2bzacecn7uxgehrqbcs462ktl2h23u23cmduy2etqj6xrd6tkkja56fna4"),
|
||||||
Actors: map[string]cid.Cid{
|
Actors: map[string]cid.Cid{
|
||||||
@ -665,9 +757,32 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
|||||||
"system": MustParseCid("bafk2bzacebfqrja2hip7esf4eafxjmu6xcogoqu5xxtgdg7xa5szgvvdguchu"),
|
"system": MustParseCid("bafk2bzacebfqrja2hip7esf4eafxjmu6xcogoqu5xxtgdg7xa5szgvvdguchu"),
|
||||||
"verifiedregistry": MustParseCid("bafk2bzacedudgflxc75c77c6zkmfyq4u2xuk7k6xw6dfdccarjrvxx453b77q"),
|
"verifiedregistry": MustParseCid("bafk2bzacedudgflxc75c77c6zkmfyq4u2xuk7k6xw6dfdccarjrvxx453b77q"),
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
Network: "mainnet",
|
||||||
|
Version: 13,
|
||||||
|
|
||||||
|
ManifestCid: MustParseCid("bafy2bzacecdhvfmtirtojwhw2tyciu4jkbpsbk5g53oe24br27oy62sn4dc4e"),
|
||||||
|
Actors: map[string]cid.Cid{
|
||||||
|
"account": MustParseCid("bafk2bzacedxnbtlsqdk76fsfmnhyvsblwyfducerwwtp3mqtx2wbrvs5idl52"),
|
||||||
|
"cron": MustParseCid("bafk2bzacebbopddyn5csb3fsuhh2an4ttd23x6qnwixgohlirj5ahtcudphyc"),
|
||||||
|
"datacap": MustParseCid("bafk2bzaceah42tfnhd7xnztawgf46gbvc3m2gudoxshlba2ucmmo2vy67t7ci"),
|
||||||
|
"eam": MustParseCid("bafk2bzaceb23bhvvcjsth7cn7vp3gbaphrutsaz7v6hkls3ogotzs4bnhm4mk"),
|
||||||
|
"ethaccount": MustParseCid("bafk2bzaceautge6zhuy6jbj3uldwoxwhpywuon6z3xfvmdbzpbdribc6zzmei"),
|
||||||
|
"evm": MustParseCid("bafk2bzacedq6v2lyuhgywhlllwmudfj2zufzcauxcsvvd34m2ek5xr55mvh2q"),
|
||||||
|
"init": MustParseCid("bafk2bzacedr4xacm3fts4vilyeiacjr2hpmwzclyzulbdo24lrfxbtau2wbai"),
|
||||||
|
"multisig": MustParseCid("bafk2bzacecr5zqarfqak42xqcfeulsxlavcltawsx2fvc7zsjtby6ti4b3wqc"),
|
||||||
|
"paymentchannel": MustParseCid("bafk2bzacebntdhfmyc24e7tm52ggx5tnw4i3hrr3jmllsepv3mibez4hywsa2"),
|
||||||
|
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||||
|
"reward": MustParseCid("bafk2bzacedq4q2kwkruu4xm7rkyygumlbw2yt4nimna2ivea4qarvtkohnuwu"),
|
||||||
|
"storagemarket": MustParseCid("bafk2bzacebjtoltdviyznpj34hh5qp6u257jnnbjole5rhqfixm7ug3epvrfu"),
|
||||||
|
"storageminer": MustParseCid("bafk2bzacebf4rrqyk7gcfggggul6nfpzay7f2ordnkwm7z2wcf4mq6r7i77t2"),
|
||||||
|
"storagepower": MustParseCid("bafk2bzacecjy4dkulvxppg3ocbmeixe2wgg6yxoyjxrm4ko2fm3uhpvfvam6e"),
|
||||||
|
"system": MustParseCid("bafk2bzacecyf523quuq2kdjfdvyty446z2ounmamtgtgeqnr3ynlu5cqrlt6e"),
|
||||||
|
"verifiedregistry": MustParseCid("bafk2bzacedkxehp7y7iyukbcje3wbpqcvufisos6exatkanyrbotoecdkrbta"),
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
Network: "mainnet",
|
Network: "mainnet",
|
||||||
Version: 13,
|
Version: 14,
|
||||||
BundleGitTag: "v13.0.0",
|
BundleGitTag: "v13.0.0",
|
||||||
ManifestCid: MustParseCid("bafy2bzacecdhvfmtirtojwhw2tyciu4jkbpsbk5g53oe24br27oy62sn4dc4e"),
|
ManifestCid: MustParseCid("bafy2bzacecdhvfmtirtojwhw2tyciu4jkbpsbk5g53oe24br27oy62sn4dc4e"),
|
||||||
Actors: map[string]cid.Cid{
|
Actors: map[string]cid.Cid{
|
||||||
@ -794,9 +909,32 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
|||||||
"system": MustParseCid("bafk2bzacecp4roanbxq3bflftlkipsoqqxio5etjjnzxus5pcu7lq43fnxb34"),
|
"system": MustParseCid("bafk2bzacecp4roanbxq3bflftlkipsoqqxio5etjjnzxus5pcu7lq43fnxb34"),
|
||||||
"verifiedregistry": MustParseCid("bafk2bzaceandytrgcnuvizfi47sijbqh6c243vjtzlzumexm6kjv7s7hye45g"),
|
"verifiedregistry": MustParseCid("bafk2bzaceandytrgcnuvizfi47sijbqh6c243vjtzlzumexm6kjv7s7hye45g"),
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
Network: "testing",
|
||||||
|
Version: 13,
|
||||||
|
|
||||||
|
ManifestCid: MustParseCid("bafy2bzacedg47dqxmtgzjch6i42kth72esd7w23gujyd6c6oppg3n6auag5ou"),
|
||||||
|
Actors: map[string]cid.Cid{
|
||||||
|
"account": MustParseCid("bafk2bzaceb3tncntgeqvzzr5fzhvpsc5ntv3tpqrsh4jst4irfyzpkdyigibc"),
|
||||||
|
"cron": MustParseCid("bafk2bzacecwwasmhixpgtshczm5cfspwciyawc25mrefknqhlxfrd6m57tqmc"),
|
||||||
|
"datacap": MustParseCid("bafk2bzaceckj66by6eohjrybazh5cymmovgl5bmikpvzki2q7huwk2fweoef2"),
|
||||||
|
"eam": MustParseCid("bafk2bzaceafzm65wvnaam3775homn4vzsv7odftn5tkifmn44wd2t6gupy63y"),
|
||||||
|
"ethaccount": MustParseCid("bafk2bzaced4q7m4mha2dsezhwub3ru64rgimkg52t25ul4gnekax6uq7hbkqu"),
|
||||||
|
"evm": MustParseCid("bafk2bzaceakpknw5cuizil3552jr5z35rs6ijaignjigciswtok67drhzdss6"),
|
||||||
|
"init": MustParseCid("bafk2bzacec7mbkemwugyg2p4oy2xgnovykk4dnsu5ym4wkreooujvxfsxbo3i"),
|
||||||
|
"multisig": MustParseCid("bafk2bzacebmftoql6dcyqf54xznwjg2bfgdsi67spqquwslpvvtvcx6qenhz2"),
|
||||||
|
"paymentchannel": MustParseCid("bafk2bzaceau57wpiiikea6pu5om4ryyqjrxjzfksfl4reqosnohydzv3pf4qq"),
|
||||||
|
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||||
|
"reward": MustParseCid("bafk2bzacecvlcdgbqlk3dyfzkcjrywg2th5bmn7ilijifikulpxr4ffcrw23o"),
|
||||||
|
"storagemarket": MustParseCid("bafk2bzacecgj53dwqla7eiubs2uiza7cgxkxtefxkfpjontj5jxefl3a4i2nq"),
|
||||||
|
"storageminer": MustParseCid("bafk2bzaceailclue4dba2edjethfjw6ycufcwsx4qjjmgsh77xcyprmogdjvu"),
|
||||||
|
"storagepower": MustParseCid("bafk2bzaceaqw6dhdjlqovhk3p4lb4sb25i5d6mhln2ir5m7tj6m4fegkgkinw"),
|
||||||
|
"system": MustParseCid("bafk2bzaceby6aiiosnrtb5kzlmrvd4k3o27oo3idmbd6llydz2uqibbp23pzq"),
|
||||||
|
"verifiedregistry": MustParseCid("bafk2bzaceadw6mxuyb6ipaq3fhekk7u5osyyiis3c4wbkvysy2ut6qfsua5zs"),
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
Network: "testing",
|
Network: "testing",
|
||||||
Version: 13,
|
Version: 14,
|
||||||
BundleGitTag: "v13.0.0",
|
BundleGitTag: "v13.0.0",
|
||||||
ManifestCid: MustParseCid("bafy2bzacedg47dqxmtgzjch6i42kth72esd7w23gujyd6c6oppg3n6auag5ou"),
|
ManifestCid: MustParseCid("bafy2bzacedg47dqxmtgzjch6i42kth72esd7w23gujyd6c6oppg3n6auag5ou"),
|
||||||
Actors: map[string]cid.Cid{
|
Actors: map[string]cid.Cid{
|
||||||
@ -923,9 +1061,32 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
|||||||
"system": MustParseCid("bafk2bzacecp4roanbxq3bflftlkipsoqqxio5etjjnzxus5pcu7lq43fnxb34"),
|
"system": MustParseCid("bafk2bzacecp4roanbxq3bflftlkipsoqqxio5etjjnzxus5pcu7lq43fnxb34"),
|
||||||
"verifiedregistry": MustParseCid("bafk2bzaceandytrgcnuvizfi47sijbqh6c243vjtzlzumexm6kjv7s7hye45g"),
|
"verifiedregistry": MustParseCid("bafk2bzaceandytrgcnuvizfi47sijbqh6c243vjtzlzumexm6kjv7s7hye45g"),
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
Network: "testing-fake-proofs",
|
||||||
|
Version: 13,
|
||||||
|
|
||||||
|
ManifestCid: MustParseCid("bafy2bzaceaf7fz33sp2i5ag5xg5ompn3dwppqlbwfacrwuvzaqdbqrtni7m5q"),
|
||||||
|
Actors: map[string]cid.Cid{
|
||||||
|
"account": MustParseCid("bafk2bzaceb3tncntgeqvzzr5fzhvpsc5ntv3tpqrsh4jst4irfyzpkdyigibc"),
|
||||||
|
"cron": MustParseCid("bafk2bzacecwwasmhixpgtshczm5cfspwciyawc25mrefknqhlxfrd6m57tqmc"),
|
||||||
|
"datacap": MustParseCid("bafk2bzaceckj66by6eohjrybazh5cymmovgl5bmikpvzki2q7huwk2fweoef2"),
|
||||||
|
"eam": MustParseCid("bafk2bzaceafzm65wvnaam3775homn4vzsv7odftn5tkifmn44wd2t6gupy63y"),
|
||||||
|
"ethaccount": MustParseCid("bafk2bzaced4q7m4mha2dsezhwub3ru64rgimkg52t25ul4gnekax6uq7hbkqu"),
|
||||||
|
"evm": MustParseCid("bafk2bzaceakpknw5cuizil3552jr5z35rs6ijaignjigciswtok67drhzdss6"),
|
||||||
|
"init": MustParseCid("bafk2bzacec7mbkemwugyg2p4oy2xgnovykk4dnsu5ym4wkreooujvxfsxbo3i"),
|
||||||
|
"multisig": MustParseCid("bafk2bzacedy4vldq4viv6bzzh4fueip3by3axsbgbh655lashddgumknc6pvs"),
|
||||||
|
"paymentchannel": MustParseCid("bafk2bzaceau57wpiiikea6pu5om4ryyqjrxjzfksfl4reqosnohydzv3pf4qq"),
|
||||||
|
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||||
|
"reward": MustParseCid("bafk2bzacecvlcdgbqlk3dyfzkcjrywg2th5bmn7ilijifikulpxr4ffcrw23o"),
|
||||||
|
"storagemarket": MustParseCid("bafk2bzacecgj53dwqla7eiubs2uiza7cgxkxtefxkfpjontj5jxefl3a4i2nq"),
|
||||||
|
"storageminer": MustParseCid("bafk2bzaceb6atn3k6yhmskgmc3lgfiwpzpfmaxzacohtnb2hivme2oroycqr6"),
|
||||||
|
"storagepower": MustParseCid("bafk2bzacedameh56mp2g4y7nprhax5sddbzcmpk5p7l523l45rtn2wjc6ah4e"),
|
||||||
|
"system": MustParseCid("bafk2bzaceby6aiiosnrtb5kzlmrvd4k3o27oo3idmbd6llydz2uqibbp23pzq"),
|
||||||
|
"verifiedregistry": MustParseCid("bafk2bzaceadw6mxuyb6ipaq3fhekk7u5osyyiis3c4wbkvysy2ut6qfsua5zs"),
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
Network: "testing-fake-proofs",
|
Network: "testing-fake-proofs",
|
||||||
Version: 13,
|
Version: 14,
|
||||||
BundleGitTag: "v13.0.0",
|
BundleGitTag: "v13.0.0",
|
||||||
ManifestCid: MustParseCid("bafy2bzaceaf7fz33sp2i5ag5xg5ompn3dwppqlbwfacrwuvzaqdbqrtni7m5q"),
|
ManifestCid: MustParseCid("bafy2bzaceaf7fz33sp2i5ag5xg5ompn3dwppqlbwfacrwuvzaqdbqrtni7m5q"),
|
||||||
Actors: map[string]cid.Cid{
|
Actors: map[string]cid.Cid{
|
||||||
|
@ -17746,7 +17746,7 @@
|
|||||||
"title": "number",
|
"title": "number",
|
||||||
"description": "Number is a number",
|
"description": "Number is a number",
|
||||||
"examples": [
|
"examples": [
|
||||||
22
|
23
|
||||||
],
|
],
|
||||||
"type": [
|
"type": [
|
||||||
"number"
|
"number"
|
||||||
@ -17798,7 +17798,7 @@
|
|||||||
"title": "number",
|
"title": "number",
|
||||||
"description": "Number is a number",
|
"description": "Number is a number",
|
||||||
"examples": [
|
"examples": [
|
||||||
22
|
23
|
||||||
],
|
],
|
||||||
"type": [
|
"type": [
|
||||||
"number"
|
"number"
|
||||||
@ -20569,7 +20569,8 @@
|
|||||||
"UpgradeThunderHeight": 10101,
|
"UpgradeThunderHeight": 10101,
|
||||||
"UpgradeWatermelonHeight": 10101,
|
"UpgradeWatermelonHeight": 10101,
|
||||||
"UpgradeDragonHeight": 10101,
|
"UpgradeDragonHeight": 10101,
|
||||||
"UpgradePhoenixHeight": 10101
|
"UpgradePhoenixHeight": 10101,
|
||||||
|
"UpgradeAussieHeight": 10101
|
||||||
},
|
},
|
||||||
"Eip155ChainID": 123
|
"Eip155ChainID": 123
|
||||||
}
|
}
|
||||||
@ -20599,6 +20600,10 @@
|
|||||||
"title": "number",
|
"title": "number",
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
"UpgradeAussieHeight": {
|
||||||
|
"title": "number",
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
"UpgradeBreezeHeight": {
|
"UpgradeBreezeHeight": {
|
||||||
"title": "number",
|
"title": "number",
|
||||||
"type": "number"
|
"type": "number"
|
||||||
@ -23732,7 +23737,7 @@
|
|||||||
"title": "number",
|
"title": "number",
|
||||||
"description": "Number is a number",
|
"description": "Number is a number",
|
||||||
"examples": [
|
"examples": [
|
||||||
22
|
23
|
||||||
],
|
],
|
||||||
"type": [
|
"type": [
|
||||||
"number"
|
"number"
|
||||||
|
@ -8845,7 +8845,7 @@
|
|||||||
"title": "number",
|
"title": "number",
|
||||||
"description": "Number is a number",
|
"description": "Number is a number",
|
||||||
"examples": [
|
"examples": [
|
||||||
22
|
23
|
||||||
],
|
],
|
||||||
"type": [
|
"type": [
|
||||||
"number"
|
"number"
|
||||||
|
@ -538,7 +538,7 @@
|
|||||||
"title": "number",
|
"title": "number",
|
||||||
"description": "Number is a number",
|
"description": "Number is a number",
|
||||||
"examples": [
|
"examples": [
|
||||||
22
|
23
|
||||||
],
|
],
|
||||||
"type": [
|
"type": [
|
||||||
"number"
|
"number"
|
||||||
|
@ -23,7 +23,7 @@ var NetworkBundle = "devnet"
|
|||||||
var BundleOverrides map[actorstypes.Version]string
|
var BundleOverrides map[actorstypes.Version]string
|
||||||
var ActorDebugging = true
|
var ActorDebugging = true
|
||||||
|
|
||||||
var GenesisNetworkVersion = network.Version21
|
var GenesisNetworkVersion = network.Version22
|
||||||
|
|
||||||
var UpgradeBreezeHeight = abi.ChainEpoch(-1)
|
var UpgradeBreezeHeight = abi.ChainEpoch(-1)
|
||||||
|
|
||||||
@ -67,9 +67,11 @@ var UpgradeThunderHeight = abi.ChainEpoch(-23)
|
|||||||
|
|
||||||
var UpgradeWatermelonHeight = abi.ChainEpoch(-24)
|
var UpgradeWatermelonHeight = abi.ChainEpoch(-24)
|
||||||
|
|
||||||
var UpgradeDragonHeight = abi.ChainEpoch(20)
|
var UpgradeDragonHeight = abi.ChainEpoch(-24)
|
||||||
|
|
||||||
var UpgradePhoenixHeight = UpgradeDragonHeight + 120
|
var UpgradePhoenixHeight = abi.ChainEpoch(-25)
|
||||||
|
|
||||||
|
var UpgradeAussieHeight = abi.ChainEpoch(200)
|
||||||
|
|
||||||
// This fix upgrade only ran on calibrationnet
|
// This fix upgrade only ran on calibrationnet
|
||||||
const UpgradeWatermelonFixHeight = -100
|
const UpgradeWatermelonFixHeight = -100
|
||||||
@ -154,6 +156,7 @@ func init() {
|
|||||||
UpgradeThunderHeight = getUpgradeHeight("LOTUS_THUNDER_HEIGHT", UpgradeThunderHeight)
|
UpgradeThunderHeight = getUpgradeHeight("LOTUS_THUNDER_HEIGHT", UpgradeThunderHeight)
|
||||||
UpgradeWatermelonHeight = getUpgradeHeight("LOTUS_WATERMELON_HEIGHT", UpgradeWatermelonHeight)
|
UpgradeWatermelonHeight = getUpgradeHeight("LOTUS_WATERMELON_HEIGHT", UpgradeWatermelonHeight)
|
||||||
UpgradeDragonHeight = getUpgradeHeight("LOTUS_DRAGON_HEIGHT", UpgradeDragonHeight)
|
UpgradeDragonHeight = getUpgradeHeight("LOTUS_DRAGON_HEIGHT", UpgradeDragonHeight)
|
||||||
|
UpgradeAussieHeight = getUpgradeHeight("LOTUS_AUSSIE_HEIGHT", UpgradeAussieHeight)
|
||||||
|
|
||||||
UpgradePhoenixHeight = getUpgradeHeight("LOTUS_PHOENIX_HEIGHT", UpgradePhoenixHeight)
|
UpgradePhoenixHeight = getUpgradeHeight("LOTUS_PHOENIX_HEIGHT", UpgradePhoenixHeight)
|
||||||
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||||
|
@ -56,10 +56,10 @@ const UpgradeHyggeHeight = -21
|
|||||||
const UpgradeLightningHeight = -22
|
const UpgradeLightningHeight = -22
|
||||||
const UpgradeThunderHeight = -23
|
const UpgradeThunderHeight = -23
|
||||||
const UpgradeWatermelonHeight = -24
|
const UpgradeWatermelonHeight = -24
|
||||||
|
const UpgradeDragonHeight = -25
|
||||||
|
const UpgradePhoenixHeight = -26
|
||||||
|
|
||||||
const UpgradeDragonHeight = 5760
|
const UpgradeAussieHeight = 400
|
||||||
|
|
||||||
const UpgradePhoenixHeight = UpgradeDragonHeight + 120
|
|
||||||
|
|
||||||
// This fix upgrade only ran on calibrationnet
|
// This fix upgrade only ran on calibrationnet
|
||||||
const UpgradeWatermelonFixHeight = -100
|
const UpgradeWatermelonFixHeight = -100
|
||||||
|
@ -98,6 +98,9 @@ const UpgradePhoenixHeight = UpgradeDragonHeight + 120
|
|||||||
// 2024-04-03T11:00:00Z
|
// 2024-04-03T11:00:00Z
|
||||||
const UpgradeCalibrationDragonFixHeight = 1493854
|
const UpgradeCalibrationDragonFixHeight = 1493854
|
||||||
|
|
||||||
|
// ?????
|
||||||
|
const UpgradeAussieHeight = 999999999999999
|
||||||
|
|
||||||
var SupportedProofTypes = []abi.RegisteredSealProof{
|
var SupportedProofTypes = []abi.RegisteredSealProof{
|
||||||
abi.RegisteredSealProof_StackedDrg32GiBV1,
|
abi.RegisteredSealProof_StackedDrg32GiBV1,
|
||||||
abi.RegisteredSealProof_StackedDrg64GiBV1,
|
abi.RegisteredSealProof_StackedDrg64GiBV1,
|
||||||
|
@ -54,8 +54,9 @@ var UpgradeHyggeHeight = abi.ChainEpoch(-21)
|
|||||||
var UpgradeLightningHeight = abi.ChainEpoch(-22)
|
var UpgradeLightningHeight = abi.ChainEpoch(-22)
|
||||||
var UpgradeThunderHeight = abi.ChainEpoch(-23)
|
var UpgradeThunderHeight = abi.ChainEpoch(-23)
|
||||||
var UpgradeWatermelonHeight = abi.ChainEpoch(-24)
|
var UpgradeWatermelonHeight = abi.ChainEpoch(-24)
|
||||||
|
var UpgradeDragonHeight = abi.ChainEpoch(-25)
|
||||||
|
|
||||||
const UpgradeDragonHeight = 50
|
const UpgradeAussieHeight = 50
|
||||||
|
|
||||||
const UpgradePhoenixHeight = UpgradeDragonHeight + 100
|
const UpgradePhoenixHeight = UpgradeDragonHeight + 100
|
||||||
|
|
||||||
|
@ -100,11 +100,14 @@ const UpgradeThunderHeight = UpgradeLightningHeight + 2880*21
|
|||||||
const UpgradeWatermelonHeight = 3469380
|
const UpgradeWatermelonHeight = 3469380
|
||||||
|
|
||||||
// 2024-04-24T14:00:00Z
|
// 2024-04-24T14:00:00Z
|
||||||
var UpgradeDragonHeight = abi.ChainEpoch(3855360)
|
const UpgradeDragonHeight = 3855360
|
||||||
|
|
||||||
// This epoch, 120 epochs after the "rest" of the nv22 upgrade, is when we switch to Drand quicknet
|
// This epoch, 120 epochs after the "rest" of the nv22 upgrade, is when we switch to Drand quicknet
|
||||||
// 2024-04-11T15:00:00Z
|
// 2024-04-11T15:00:00Z
|
||||||
var UpgradePhoenixHeight = UpgradeDragonHeight + 120
|
const UpgradePhoenixHeight = UpgradeDragonHeight + 120
|
||||||
|
|
||||||
|
// ??????
|
||||||
|
var UpgradeAussieHeight = abi.ChainEpoch(9999999999)
|
||||||
|
|
||||||
// This fix upgrade only ran on calibrationnet
|
// This fix upgrade only ran on calibrationnet
|
||||||
const UpgradeWatermelonFixHeight = -1
|
const UpgradeWatermelonFixHeight = -1
|
||||||
@ -130,10 +133,8 @@ func init() {
|
|||||||
SetAddressNetwork(address.Mainnet)
|
SetAddressNetwork(address.Mainnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.Getenv("LOTUS_DISABLE_DRAGON") == "1" {
|
if os.Getenv("LOTUS_DISABLE_AUSSIE") == "1" {
|
||||||
UpgradeDragonHeight = math.MaxInt64 - 1
|
UpgradeAussieHeight = math.MaxInt64 - 1
|
||||||
delete(DrandSchedule, UpgradePhoenixHeight)
|
|
||||||
UpgradePhoenixHeight = math.MaxInt64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: DO NOT change this unless you REALLY know what you're doing. This is not consensus critical, however,
|
// NOTE: DO NOT change this unless you REALLY know what you're doing. This is not consensus critical, however,
|
||||||
|
@ -30,7 +30,7 @@ const AllowableClockDriftSecs = uint64(1)
|
|||||||
/* inline-gen template
|
/* inline-gen template
|
||||||
const TestNetworkVersion = network.Version{{.latestNetworkVersion}}
|
const TestNetworkVersion = network.Version{{.latestNetworkVersion}}
|
||||||
/* inline-gen start */
|
/* inline-gen start */
|
||||||
const TestNetworkVersion = network.Version22
|
const TestNetworkVersion = network.Version23
|
||||||
|
|
||||||
/* inline-gen end */
|
/* inline-gen end */
|
||||||
|
|
||||||
|
@ -115,6 +115,7 @@ var (
|
|||||||
UpgradeDragonHeight abi.ChainEpoch = -26
|
UpgradeDragonHeight abi.ChainEpoch = -26
|
||||||
UpgradePhoenixHeight abi.ChainEpoch = -27
|
UpgradePhoenixHeight abi.ChainEpoch = -27
|
||||||
UpgradeCalibrationDragonFixHeight abi.ChainEpoch = -28
|
UpgradeCalibrationDragonFixHeight abi.ChainEpoch = -28
|
||||||
|
UpgradeAussieHeight abi.ChainEpoch = -29
|
||||||
|
|
||||||
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||||
0: DrandMainnet,
|
0: DrandMainnet,
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Methods = builtin13.MethodsAccount
|
var Methods = builtin14.MethodsAccount
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
@ -50,6 +50,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +126,9 @@ func MakeState(store adt.Store, av actorstypes.Version, addr address.Address) (S
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store, addr)
|
return make13(store, addr)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store, addr)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -153,5 +159,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
62
chain/actors/builtin/account/v14.go
generated
Normal file
62
chain/actors/builtin/account/v14.go
generated
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package account
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
account14 "github.com/filecoin-project/go-state-types/builtin/v14/account"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store, addr address.Address) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
out.State = account14.State{Address: addr}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
account14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) PubkeyAddress() (address.Address, error) {
|
||||||
|
return s.Address, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.AccountKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
@ -5,7 +5,7 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
@ -46,6 +46,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,13 +122,16 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store)
|
return make13(store)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin13.CronActorAddr
|
Address = builtin14.CronActorAddr
|
||||||
Methods = builtin13.MethodsCron
|
Methods = builtin14.MethodsCron
|
||||||
)
|
)
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
@ -151,5 +157,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
57
chain/actors/builtin/cron/v14.go
generated
Normal file
57
chain/actors/builtin/cron/v14.go
generated
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package cron
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
cron14 "github.com/filecoin-project/go-state-types/builtin/v14/cron"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
out.State = *cron14.ConstructState(cron14.BuiltInEntries())
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
cron14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.CronKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin13.DatacapActorAddr
|
Address = builtin14.DatacapActorAddr
|
||||||
Methods = builtin13.MethodsDatacap
|
Methods = builtin14.MethodsDatacap
|
||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
@ -44,6 +44,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +71,9 @@ func MakeState(store adt.Store, av actorstypes.Version, governor address.Address
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store, governor, bitwidth)
|
return make13(store, governor, bitwidth)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store, governor, bitwidth)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av)
|
return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av)
|
||||||
}
|
}
|
||||||
@ -93,5 +99,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
82
chain/actors/builtin/datacap/v14.go
generated
Normal file
82
chain/actors/builtin/datacap/v14.go
generated
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
package datacap
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
datacap14 "github.com/filecoin-project/go-state-types/builtin/v14/datacap"
|
||||||
|
adt14 "github.com/filecoin-project/go-state-types/builtin/v14/util/adt"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store, governor address.Address, bitwidth uint64) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
s, err := datacap14.ConstructState(store, governor, bitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
datacap14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Governor() (address.Address, error) {
|
||||||
|
return s.State.Governor, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||||
|
return forEachClient(s.store, actors.Version14, s.verifiedClients, cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) verifiedClients() (adt.Map, error) {
|
||||||
|
return adt14.AsMap(s.store, s.Token.Balances, int(s.Token.HamtBitWidth))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||||
|
return getDataCap(s.store, actors.Version14, s.verifiedClients, addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.DatacapKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
@ -5,7 +5,7 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/exitcode"
|
"github.com/filecoin-project/go-state-types/exitcode"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Methods = builtin13.MethodsEVM
|
var Methods = builtin14.MethodsEVM
|
||||||
|
|
||||||
// See https://github.com/filecoin-project/builtin-actors/blob/6e781444cee5965278c46ef4ffe1fb1970f18d7d/actors/evm/src/lib.rs#L35-L42
|
// See https://github.com/filecoin-project/builtin-actors/blob/6e781444cee5965278c46ef4ffe1fb1970f18d7d/actors/evm/src/lib.rs#L35-L42
|
||||||
const (
|
const (
|
||||||
@ -49,6 +49,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +73,9 @@ func MakeState(store adt.Store, av actorstypes.Version, bytecode cid.Cid) (State
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store, bytecode)
|
return make13(store, bytecode)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store, bytecode)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, xerrors.Errorf("evm actor only valid for actors v10 and above, got %d", av)
|
return nil, xerrors.Errorf("evm actor only valid for actors v10 and above, got %d", av)
|
||||||
}
|
}
|
||||||
|
72
chain/actors/builtin/evm/v14.go
generated
Normal file
72
chain/actors/builtin/evm/v14.go
generated
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package evm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
evm14 "github.com/filecoin-project/go-state-types/builtin/v14/evm"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store, bytecode cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
s, err := evm14.ConstructState(store, bytecode)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
evm14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Nonce() (uint64, error) {
|
||||||
|
return s.State.Nonce, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) IsAlive() (bool, error) {
|
||||||
|
return s.State.Tombstone == nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetBytecodeCID() (cid.Cid, error) {
|
||||||
|
return s.State.Bytecode, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetBytecodeHash() ([32]byte, error) {
|
||||||
|
return s.State.BytecodeHash, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetBytecode() ([]byte, error) {
|
||||||
|
bc, err := s.GetBytecodeCID()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var byteCode abi.CborBytesTransparent
|
||||||
|
if err := s.store.Get(s.store.Context(), bc, &byteCode); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return byteCode, nil
|
||||||
|
}
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -25,8 +25,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin13.InitActorAddr
|
Address = builtin14.InitActorAddr
|
||||||
Methods = builtin13.MethodsInit
|
Methods = builtin14.MethodsInit
|
||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
@ -55,6 +55,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +131,9 @@ func MakeState(store adt.Store, av actorstypes.Version, networkName string) (Sta
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store, networkName)
|
return make13(store, networkName)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store, networkName)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -181,5 +187,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
147
chain/actors/builtin/init/v14.go
generated
Normal file
147
chain/actors/builtin/init/v14.go
generated
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
package init
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
|
adt14 "github.com/filecoin-project/go-state-types/builtin/v14/util/adt"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store, networkName string) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
|
||||||
|
s, err := init14.ConstructState(store, networkName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
init14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ResolveAddress(address address.Address) (address.Address, bool, error) {
|
||||||
|
return s.State.ResolveAddress(s.store, address)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) MapAddressToNewID(address address.Address) (address.Address, error) {
|
||||||
|
return s.State.MapAddressToNewID(s.store, address)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error {
|
||||||
|
addrs, err := adt14.AsMap(s.store, s.State.AddressMap, builtin14.DefaultHamtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var actorID cbg.CborInt
|
||||||
|
return addrs.ForEach(&actorID, func(key string) error {
|
||||||
|
addr, err := address.NewFromBytes([]byte(key))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return cb(abi.ActorID(actorID), addr)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) NetworkName() (dtypes.NetworkName, error) {
|
||||||
|
return dtypes.NetworkName(s.State.NetworkName), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) SetNetworkName(name string) error {
|
||||||
|
s.State.NetworkName = name
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) SetNextID(id abi.ActorID) error {
|
||||||
|
s.State.NextID = id
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Remove(addrs ...address.Address) (err error) {
|
||||||
|
m, err := adt14.AsMap(s.store, s.State.AddressMap, builtin14.DefaultHamtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, addr := range addrs {
|
||||||
|
if err = m.Delete(abi.AddrKey(addr)); err != nil {
|
||||||
|
return xerrors.Errorf("failed to delete entry for address: %s; err: %w", addr, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
amr, err := m.Root()
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("failed to get address map root: %w", err)
|
||||||
|
}
|
||||||
|
s.State.AddressMap = amr
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) SetAddressMap(mcid cid.Cid) error {
|
||||||
|
s.State.AddressMap = mcid
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) AddressMap() (adt.Map, error) {
|
||||||
|
return adt14.AsMap(s.store, s.State.AddressMap, builtin14.DefaultHamtBitwidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) AddressMapBitWidth() int {
|
||||||
|
return builtin14.DefaultHamtBitwidth
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) AddressMapHashFunction() func(input []byte) []byte {
|
||||||
|
return func(input []byte) []byte {
|
||||||
|
res := sha256.Sum256(input)
|
||||||
|
return res[:]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.InitKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
@ -61,6 +61,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +137,9 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store)
|
return make13(store)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -235,6 +241,9 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return decodePublishStorageDealsReturn13(b)
|
return decodePublishStorageDealsReturn13(b)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return decodePublishStorageDealsReturn14(b)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -356,5 +365,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
404
chain/actors/builtin/market/v14.go
generated
Normal file
404
chain/actors/builtin/market/v14.go
generated
Normal file
@ -0,0 +1,404 @@
|
|||||||
|
package market
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-bitfield"
|
||||||
|
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
market14 "github.com/filecoin-project/go-state-types/builtin/v14/market"
|
||||||
|
adt14 "github.com/filecoin-project/go-state-types/builtin/v14/util/adt"
|
||||||
|
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
verifregtypes "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
|
||||||
|
s, err := market14.ConstructState(store)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
market14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) TotalLocked() (abi.TokenAmount, error) {
|
||||||
|
fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral)
|
||||||
|
fml = types.BigAdd(fml, s.TotalClientStorageFee)
|
||||||
|
return fml, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) BalancesChanged(otherState State) (bool, error) {
|
||||||
|
otherState14, ok := otherState.(*state14)
|
||||||
|
if !ok {
|
||||||
|
// there's no way to compare different versions of the state, so let's
|
||||||
|
// just say that means the state of balances has changed
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return !s.State.EscrowTable.Equals(otherState14.State.EscrowTable) || !s.State.LockedTable.Equals(otherState14.State.LockedTable), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) StatesChanged(otherState State) (bool, error) {
|
||||||
|
otherState14, ok := otherState.(*state14)
|
||||||
|
if !ok {
|
||||||
|
// there's no way to compare different versions of the state, so let's
|
||||||
|
// just say that means the state of balances has changed
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return !s.State.States.Equals(otherState14.State.States), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) States() (DealStates, error) {
|
||||||
|
stateArray, err := adt14.AsArray(s.store, s.State.States, market14.StatesAmtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &dealStates14{stateArray}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ProposalsChanged(otherState State) (bool, error) {
|
||||||
|
otherState14, ok := otherState.(*state14)
|
||||||
|
if !ok {
|
||||||
|
// there's no way to compare different versions of the state, so let's
|
||||||
|
// just say that means the state of balances has changed
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return !s.State.Proposals.Equals(otherState14.State.Proposals), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Proposals() (DealProposals, error) {
|
||||||
|
proposalArray, err := adt14.AsArray(s.store, s.State.Proposals, market14.ProposalsAmtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &dealProposals14{proposalArray}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) EscrowTable() (BalanceTable, error) {
|
||||||
|
bt, err := adt14.AsBalanceTable(s.store, s.State.EscrowTable)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &balanceTable14{bt}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) LockedTable() (BalanceTable, error) {
|
||||||
|
bt, err := adt14.AsBalanceTable(s.store, s.State.LockedTable)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &balanceTable14{bt}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) VerifyDealsForActivation(
|
||||||
|
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
|
||||||
|
) (weight, verifiedWeight abi.DealWeight, err error) {
|
||||||
|
w, vw, _, err := market14.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
|
||||||
|
return w, vw, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) NextID() (abi.DealID, error) {
|
||||||
|
return s.State.NextID, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type balanceTable14 struct {
|
||||||
|
*adt14.BalanceTable
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bt *balanceTable14) ForEach(cb func(address.Address, abi.TokenAmount) error) error {
|
||||||
|
asMap := (*adt14.Map)(bt.BalanceTable)
|
||||||
|
var ta abi.TokenAmount
|
||||||
|
return asMap.ForEach(&ta, func(key string) error {
|
||||||
|
a, err := address.NewFromBytes([]byte(key))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return cb(a, ta)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
type dealStates14 struct {
|
||||||
|
adt.Array
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *dealStates14) Get(dealID abi.DealID) (DealState, bool, error) {
|
||||||
|
var deal14 market14.DealState
|
||||||
|
found, err := s.Array.Get(uint64(dealID), &deal14)
|
||||||
|
if err != nil {
|
||||||
|
return nil, false, err
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return nil, false, nil
|
||||||
|
}
|
||||||
|
deal := fromV14DealState(deal14)
|
||||||
|
return deal, true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *dealStates14) ForEach(cb func(dealID abi.DealID, ds DealState) error) error {
|
||||||
|
var ds14 market14.DealState
|
||||||
|
return s.Array.ForEach(&ds14, func(idx int64) error {
|
||||||
|
return cb(abi.DealID(idx), fromV14DealState(ds14))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *dealStates14) decode(val *cbg.Deferred) (DealState, error) {
|
||||||
|
var ds14 market14.DealState
|
||||||
|
if err := ds14.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
ds := fromV14DealState(ds14)
|
||||||
|
return ds, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *dealStates14) array() adt.Array {
|
||||||
|
return s.Array
|
||||||
|
}
|
||||||
|
|
||||||
|
type dealStateV14 struct {
|
||||||
|
ds14 market14.DealState
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d dealStateV14) SectorStartEpoch() abi.ChainEpoch {
|
||||||
|
return d.ds14.SectorStartEpoch
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d dealStateV14) LastUpdatedEpoch() abi.ChainEpoch {
|
||||||
|
return d.ds14.LastUpdatedEpoch
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d dealStateV14) SlashEpoch() abi.ChainEpoch {
|
||||||
|
return d.ds14.SlashEpoch
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d dealStateV14) Equals(other DealState) bool {
|
||||||
|
if ov14, ok := other.(dealStateV14); ok {
|
||||||
|
return d.ds14 == ov14.ds14
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.SectorStartEpoch() != other.SectorStartEpoch() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if d.LastUpdatedEpoch() != other.LastUpdatedEpoch() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if d.SlashEpoch() != other.SlashEpoch() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ DealState = (*dealStateV14)(nil)
|
||||||
|
|
||||||
|
func fromV14DealState(v14 market14.DealState) DealState {
|
||||||
|
return dealStateV14{v14}
|
||||||
|
}
|
||||||
|
|
||||||
|
type dealProposals14 struct {
|
||||||
|
adt.Array
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *dealProposals14) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||||
|
var proposal14 market14.DealProposal
|
||||||
|
found, err := s.Array.Get(uint64(dealID), &proposal14)
|
||||||
|
if err != nil {
|
||||||
|
return nil, false, err
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return nil, false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
proposal, err := fromV14DealProposal(proposal14)
|
||||||
|
if err != nil {
|
||||||
|
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proposal, true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *dealProposals14) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||||
|
var dp14 market14.DealProposal
|
||||||
|
return s.Array.ForEach(&dp14, func(idx int64) error {
|
||||||
|
dp, err := fromV14DealProposal(dp14)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("decoding proposal: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return cb(abi.DealID(idx), dp)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *dealProposals14) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||||
|
var dp14 market14.DealProposal
|
||||||
|
if err := dp14.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
dp, err := fromV14DealProposal(dp14)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &dp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *dealProposals14) array() adt.Array {
|
||||||
|
return s.Array
|
||||||
|
}
|
||||||
|
|
||||||
|
func fromV14DealProposal(v14 market14.DealProposal) (DealProposal, error) {
|
||||||
|
|
||||||
|
label, err := fromV14Label(v14.Label)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return DealProposal{
|
||||||
|
PieceCID: v14.PieceCID,
|
||||||
|
PieceSize: v14.PieceSize,
|
||||||
|
VerifiedDeal: v14.VerifiedDeal,
|
||||||
|
Client: v14.Client,
|
||||||
|
Provider: v14.Provider,
|
||||||
|
|
||||||
|
Label: label,
|
||||||
|
|
||||||
|
StartEpoch: v14.StartEpoch,
|
||||||
|
EndEpoch: v14.EndEpoch,
|
||||||
|
StoragePricePerEpoch: v14.StoragePricePerEpoch,
|
||||||
|
|
||||||
|
ProviderCollateral: v14.ProviderCollateral,
|
||||||
|
ClientCollateral: v14.ClientCollateral,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func fromV14Label(v14 market14.DealLabel) (DealLabel, error) {
|
||||||
|
if v14.IsString() {
|
||||||
|
str, err := v14.ToString()
|
||||||
|
if err != nil {
|
||||||
|
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert string label to string: %w", err)
|
||||||
|
}
|
||||||
|
return markettypes.NewLabelFromString(str)
|
||||||
|
}
|
||||||
|
|
||||||
|
bs, err := v14.ToBytes()
|
||||||
|
if err != nil {
|
||||||
|
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert bytes label to bytes: %w", err)
|
||||||
|
}
|
||||||
|
return markettypes.NewLabelFromBytes(bs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ PublishStorageDealsReturn = (*publishStorageDealsReturn14)(nil)
|
||||||
|
|
||||||
|
func decodePublishStorageDealsReturn14(b []byte) (PublishStorageDealsReturn, error) {
|
||||||
|
var retval market14.PublishStorageDealsReturn
|
||||||
|
if err := retval.UnmarshalCBOR(bytes.NewReader(b)); err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to unmarshal PublishStorageDealsReturn: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &publishStorageDealsReturn14{retval}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type publishStorageDealsReturn14 struct {
|
||||||
|
market14.PublishStorageDealsReturn
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *publishStorageDealsReturn14) IsDealValid(index uint64) (bool, int, error) {
|
||||||
|
|
||||||
|
set, err := r.ValidDeals.IsSet(index)
|
||||||
|
if err != nil || !set {
|
||||||
|
return false, -1, err
|
||||||
|
}
|
||||||
|
maskBf, err := bitfield.NewFromIter(&rlepluslazy.RunSliceIterator{
|
||||||
|
Runs: []rlepluslazy.Run{rlepluslazy.Run{Val: true, Len: index}}})
|
||||||
|
if err != nil {
|
||||||
|
return false, -1, err
|
||||||
|
}
|
||||||
|
before, err := bitfield.IntersectBitField(maskBf, r.ValidDeals)
|
||||||
|
if err != nil {
|
||||||
|
return false, -1, err
|
||||||
|
}
|
||||||
|
outIdx, err := before.Count()
|
||||||
|
if err != nil {
|
||||||
|
return false, -1, err
|
||||||
|
}
|
||||||
|
return set, int(outIdx), nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *publishStorageDealsReturn14) DealIDs() ([]abi.DealID, error) {
|
||||||
|
return r.IDs, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||||
|
|
||||||
|
allocations, err := adt14.AsMap(s.store, s.PendingDealAllocationIds, builtin.DefaultHamtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var allocationId cbg.CborInt
|
||||||
|
found, err := allocations.Get(abi.UIntKey(uint64(dealId)), &allocationId)
|
||||||
|
if err != nil {
|
||||||
|
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return verifregtypes.NoAllocationID, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return verifregtypes.AllocationId(allocationId), nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.MarketKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
@ -55,6 +55,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +131,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
case actors.Version13:
|
case actors.Version13:
|
||||||
return make13(store)
|
return make13(store)
|
||||||
|
|
||||||
|
case actors.Version14:
|
||||||
|
return make14(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -391,5 +397,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
594
chain/actors/builtin/miner/v14.go
generated
Normal file
594
chain/actors/builtin/miner/v14.go
generated
Normal file
@ -0,0 +1,594 @@
|
|||||||
|
package miner
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-bitfield"
|
||||||
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
miner14 "github.com/filecoin-project/go-state-types/builtin/v14/miner"
|
||||||
|
adt14 "github.com/filecoin-project/go-state-types/builtin/v14/util/adt"
|
||||||
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
out.State = miner14.State{}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
miner14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
type deadline14 struct {
|
||||||
|
miner14.Deadline
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
type partition14 struct {
|
||||||
|
miner14.Partition
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
err = xerrors.Errorf("failed to get available balance: %w", r)
|
||||||
|
available = abi.NewTokenAmount(0)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
// this panics if the miner doesn't have enough funds to cover their locked pledge
|
||||||
|
available, err = s.GetAvailableBalance(bal)
|
||||||
|
return available, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||||
|
return s.CheckVestedFunds(s.store, epoch)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) LockedFunds() (LockedFunds, error) {
|
||||||
|
return LockedFunds{
|
||||||
|
VestingFunds: s.State.LockedFunds,
|
||||||
|
InitialPledgeRequirement: s.State.InitialPledge,
|
||||||
|
PreCommitDeposits: s.State.PreCommitDeposits,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) FeeDebt() (abi.TokenAmount, error) {
|
||||||
|
return s.State.FeeDebt, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) InitialPledge() (abi.TokenAmount, error) {
|
||||||
|
return s.State.InitialPledge, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) PreCommitDeposits() (abi.TokenAmount, error) {
|
||||||
|
return s.State.PreCommitDeposits, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns nil, nil if sector is not found
|
||||||
|
func (s *state14) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
|
||||||
|
info, ok, err := s.State.GetSector(s.store, num)
|
||||||
|
if !ok || err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
ret := fromV14SectorOnChainInfo(*info)
|
||||||
|
return &ret, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
|
||||||
|
dlIdx, partIdx, err := s.State.FindSector(s.store, num)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &SectorLocation{
|
||||||
|
Deadline: dlIdx,
|
||||||
|
Partition: partIdx,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) NumLiveSectors() (uint64, error) {
|
||||||
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
var total uint64
|
||||||
|
if err := dls.ForEach(s.store, func(dlIdx uint64, dl *miner14.Deadline) error {
|
||||||
|
total += dl.LiveSectors
|
||||||
|
return nil
|
||||||
|
}); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return total, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSectorExpiration returns the effective expiration of the given sector.
|
||||||
|
//
|
||||||
|
// If the sector does not expire early, the Early expiration field is 0.
|
||||||
|
func (s *state14) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) {
|
||||||
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// NOTE: this can be optimized significantly.
|
||||||
|
// 1. If the sector is non-faulty, it will expire on-time (can be
|
||||||
|
// learned from the sector info).
|
||||||
|
// 2. If it's faulty, it will expire early within the first 42 entries
|
||||||
|
// of the expiration queue.
|
||||||
|
|
||||||
|
stopErr := errors.New("stop")
|
||||||
|
out := SectorExpiration{}
|
||||||
|
err = dls.ForEach(s.store, func(dlIdx uint64, dl *miner14.Deadline) error {
|
||||||
|
partitions, err := dl.PartitionsArray(s.store)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
quant := s.State.QuantSpecForDeadline(dlIdx)
|
||||||
|
var part miner14.Partition
|
||||||
|
return partitions.ForEach(&part, func(partIdx int64) error {
|
||||||
|
if found, err := part.Sectors.IsSet(uint64(num)); err != nil {
|
||||||
|
return err
|
||||||
|
} else if !found {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if found, err := part.Terminated.IsSet(uint64(num)); err != nil {
|
||||||
|
return err
|
||||||
|
} else if found {
|
||||||
|
// already terminated
|
||||||
|
return stopErr
|
||||||
|
}
|
||||||
|
|
||||||
|
q, err := miner14.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant, miner14.PartitionExpirationAmtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var exp miner14.ExpirationSet
|
||||||
|
return q.ForEach(&exp, func(epoch int64) error {
|
||||||
|
if early, err := exp.EarlySectors.IsSet(uint64(num)); err != nil {
|
||||||
|
return err
|
||||||
|
} else if early {
|
||||||
|
out.Early = abi.ChainEpoch(epoch)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if onTime, err := exp.OnTimeSectors.IsSet(uint64(num)); err != nil {
|
||||||
|
return err
|
||||||
|
} else if onTime {
|
||||||
|
out.OnTime = abi.ChainEpoch(epoch)
|
||||||
|
return stopErr
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if err == stopErr {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if out.Early == 0 && out.OnTime == 0 {
|
||||||
|
return nil, xerrors.Errorf("failed to find sector %d", num)
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
||||||
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
|
if !ok || err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
ret := fromV14SectorPreCommitOnChainInfo(*info)
|
||||||
|
|
||||||
|
return &ret, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
|
precommitted, err := adt14.AsMap(s.store, s.State.PreCommittedSectors, builtin14.DefaultHamtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var info miner14.SectorPreCommitOnChainInfo
|
||||||
|
if err := precommitted.ForEach(&info, func(_ string) error {
|
||||||
|
return cb(fromV14SectorPreCommitOnChainInfo(info))
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) LoadSectors(snos *bitfield.BitField) ([]*SectorOnChainInfo, error) {
|
||||||
|
sectors, err := miner14.LoadSectors(s.store, s.State.Sectors)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no sector numbers are specified, load all.
|
||||||
|
if snos == nil {
|
||||||
|
infos := make([]*SectorOnChainInfo, 0, sectors.Length())
|
||||||
|
var info14 miner14.SectorOnChainInfo
|
||||||
|
if err := sectors.ForEach(&info14, func(_ int64) error {
|
||||||
|
info := fromV14SectorOnChainInfo(info14)
|
||||||
|
infos = append(infos, &info)
|
||||||
|
return nil
|
||||||
|
}); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return infos, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, load selected.
|
||||||
|
infos14, err := sectors.Load(*snos)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
infos := make([]*SectorOnChainInfo, len(infos14))
|
||||||
|
for i, info14 := range infos14 {
|
||||||
|
info := fromV14SectorOnChainInfo(*info14)
|
||||||
|
infos[i] = &info
|
||||||
|
}
|
||||||
|
return infos, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) loadAllocatedSectorNumbers() (bitfield.BitField, error) {
|
||||||
|
var allocatedSectors bitfield.BitField
|
||||||
|
err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors)
|
||||||
|
return allocatedSectors, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||||
|
allocatedSectors, err := s.loadAllocatedSectorNumbers()
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return allocatedSectors.IsSet(uint64(num))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetProvingPeriodStart() (abi.ChainEpoch, error) {
|
||||||
|
return s.State.ProvingPeriodStart, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error) {
|
||||||
|
allocatedSectors, err := s.loadAllocatedSectorNumbers()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
allocatedRuns, err := allocatedSectors.RunIterator()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
unallocatedRuns, err := rle.Subtract(
|
||||||
|
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
||||||
|
allocatedRuns,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
iter, err := rle.BitsFromRuns(unallocatedRuns)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
sectors := make([]abi.SectorNumber, 0, count)
|
||||||
|
for iter.HasNext() && len(sectors) < count {
|
||||||
|
nextNo, err := iter.Next()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
sectors = append(sectors, abi.SectorNumber(nextNo))
|
||||||
|
}
|
||||||
|
|
||||||
|
return sectors, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetAllocatedSectors() (*bitfield.BitField, error) {
|
||||||
|
var allocatedSectors bitfield.BitField
|
||||||
|
if err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &allocatedSectors, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) LoadDeadline(idx uint64) (Deadline, error) {
|
||||||
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
dl, err := dls.LoadDeadline(s.store, idx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &deadline14{*dl, s.store}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ForEachDeadline(cb func(uint64, Deadline) error) error {
|
||||||
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return dls.ForEach(s.store, func(i uint64, dl *miner14.Deadline) error {
|
||||||
|
return cb(i, &deadline14{*dl, s.store})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) NumDeadlines() (uint64, error) {
|
||||||
|
return miner14.WPoStPeriodDeadlines, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) DeadlinesChanged(other State) (bool, error) {
|
||||||
|
other14, ok := other.(*state14)
|
||||||
|
if !ok {
|
||||||
|
// treat an upgrade as a change, always
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return !s.State.Deadlines.Equals(other14.Deadlines), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) MinerInfoChanged(other State) (bool, error) {
|
||||||
|
other0, ok := other.(*state14)
|
||||||
|
if !ok {
|
||||||
|
// treat an upgrade as a change, always
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return !s.State.Info.Equals(other0.State.Info), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Info() (MinerInfo, error) {
|
||||||
|
info, err := s.State.GetInfo(s.store)
|
||||||
|
if err != nil {
|
||||||
|
return MinerInfo{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
mi := MinerInfo{
|
||||||
|
Owner: info.Owner,
|
||||||
|
Worker: info.Worker,
|
||||||
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
|
|
||||||
|
PeerId: info.PeerId,
|
||||||
|
Multiaddrs: info.Multiaddrs,
|
||||||
|
WindowPoStProofType: info.WindowPoStProofType,
|
||||||
|
SectorSize: info.SectorSize,
|
||||||
|
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
||||||
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
|
|
||||||
|
Beneficiary: info.Beneficiary,
|
||||||
|
BeneficiaryTerm: BeneficiaryTerm(info.BeneficiaryTerm),
|
||||||
|
PendingBeneficiaryTerm: (*PendingBeneficiaryChange)(info.PendingBeneficiaryTerm),
|
||||||
|
}
|
||||||
|
|
||||||
|
return mi, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error) {
|
||||||
|
return s.State.RecordedDeadlineInfo(epoch), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) DeadlineCronActive() (bool, error) {
|
||||||
|
return s.State.DeadlineCronActive, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) sectors() (adt.Array, error) {
|
||||||
|
return adt14.AsArray(s.store, s.Sectors, miner14.SectorsAmtBitwidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) {
|
||||||
|
var si miner14.SectorOnChainInfo
|
||||||
|
err := si.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
|
if err != nil {
|
||||||
|
return SectorOnChainInfo{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return fromV14SectorOnChainInfo(si), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) precommits() (adt.Map, error) {
|
||||||
|
return adt14.AsMap(s.store, s.PreCommittedSectors, builtin14.DefaultHamtBitwidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
||||||
|
var sp miner14.SectorPreCommitOnChainInfo
|
||||||
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
|
if err != nil {
|
||||||
|
return SectorPreCommitOnChainInfo{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return fromV14SectorPreCommitOnChainInfo(sp), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) EraseAllUnproven() error {
|
||||||
|
|
||||||
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = dls.ForEach(s.store, func(dindx uint64, dl *miner14.Deadline) error {
|
||||||
|
ps, err := dl.PartitionsArray(s.store)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var part miner14.Partition
|
||||||
|
err = ps.ForEach(&part, func(pindx int64) error {
|
||||||
|
_ = part.ActivateUnproven()
|
||||||
|
err = ps.Set(uint64(pindx), &part)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.Partitions, err = ps.Root()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return dls.UpdateDeadline(s.store, dindx, dl)
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.State.SaveDeadlines(s.store, dls)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *deadline14) LoadPartition(idx uint64) (Partition, error) {
|
||||||
|
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &partition14{*p, d.store}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *deadline14) ForEachPartition(cb func(uint64, Partition) error) error {
|
||||||
|
ps, err := d.Deadline.PartitionsArray(d.store)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var part miner14.Partition
|
||||||
|
return ps.ForEach(&part, func(i int64) error {
|
||||||
|
return cb(uint64(i), &partition14{part, d.store})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *deadline14) PartitionsChanged(other Deadline) (bool, error) {
|
||||||
|
other14, ok := other.(*deadline14)
|
||||||
|
if !ok {
|
||||||
|
// treat an upgrade as a change, always
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return !d.Deadline.Partitions.Equals(other14.Deadline.Partitions), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *deadline14) PartitionsPoSted() (bitfield.BitField, error) {
|
||||||
|
return d.Deadline.PartitionsPoSted, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *deadline14) DisputableProofCount() (uint64, error) {
|
||||||
|
|
||||||
|
ops, err := d.OptimisticProofsSnapshotArray(d.store)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return ops.Length(), nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *partition14) AllSectors() (bitfield.BitField, error) {
|
||||||
|
return p.Partition.Sectors, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *partition14) FaultySectors() (bitfield.BitField, error) {
|
||||||
|
return p.Partition.Faults, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *partition14) RecoveringSectors() (bitfield.BitField, error) {
|
||||||
|
return p.Partition.Recoveries, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *partition14) UnprovenSectors() (bitfield.BitField, error) {
|
||||||
|
return p.Partition.Unproven, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func fromV14SectorOnChainInfo(v14 miner14.SectorOnChainInfo) SectorOnChainInfo {
|
||||||
|
info := SectorOnChainInfo{
|
||||||
|
SectorNumber: v14.SectorNumber,
|
||||||
|
SealProof: v14.SealProof,
|
||||||
|
SealedCID: v14.SealedCID,
|
||||||
|
DealIDs: v14.DealIDs,
|
||||||
|
Activation: v14.Activation,
|
||||||
|
Expiration: v14.Expiration,
|
||||||
|
DealWeight: v14.DealWeight,
|
||||||
|
VerifiedDealWeight: v14.VerifiedDealWeight,
|
||||||
|
InitialPledge: v14.InitialPledge,
|
||||||
|
ExpectedDayReward: v14.ExpectedDayReward,
|
||||||
|
ExpectedStoragePledge: v14.ExpectedStoragePledge,
|
||||||
|
|
||||||
|
SectorKeyCID: v14.SectorKeyCID,
|
||||||
|
|
||||||
|
PowerBaseEpoch: v14.PowerBaseEpoch,
|
||||||
|
ReplacedDayReward: v14.ReplacedDayReward,
|
||||||
|
}
|
||||||
|
return info
|
||||||
|
}
|
||||||
|
|
||||||
|
func fromV14SectorPreCommitOnChainInfo(v14 miner14.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
||||||
|
ret := SectorPreCommitOnChainInfo{
|
||||||
|
Info: SectorPreCommitInfo{
|
||||||
|
SealProof: v14.Info.SealProof,
|
||||||
|
SectorNumber: v14.Info.SectorNumber,
|
||||||
|
SealedCID: v14.Info.SealedCID,
|
||||||
|
SealRandEpoch: v14.Info.SealRandEpoch,
|
||||||
|
DealIDs: v14.Info.DealIDs,
|
||||||
|
Expiration: v14.Info.Expiration,
|
||||||
|
UnsealedCid: nil,
|
||||||
|
},
|
||||||
|
PreCommitDeposit: v14.PreCommitDeposit,
|
||||||
|
PreCommitEpoch: v14.PreCommitEpoch,
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.Info.UnsealedCid = v14.Info.UnsealedCid
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.MinerKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
4
chain/actors/builtin/multisig/message10.go
generated
4
chain/actors/builtin/multisig/message10.go
generated
@ -8,7 +8,7 @@ import (
|
|||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
multisig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig"
|
multisig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig"
|
||||||
init13 "github.com/filecoin-project/go-state-types/builtin/v13/init"
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
@ -57,7 +57,7 @@ func (m message10) Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init13.ExecParams{
|
execParams := &init14.ExecParams{
|
||||||
CodeCID: code,
|
CodeCID: code,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
4
chain/actors/builtin/multisig/message11.go
generated
4
chain/actors/builtin/multisig/message11.go
generated
@ -8,7 +8,7 @@ import (
|
|||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
multisig11 "github.com/filecoin-project/go-state-types/builtin/v11/multisig"
|
multisig11 "github.com/filecoin-project/go-state-types/builtin/v11/multisig"
|
||||||
init13 "github.com/filecoin-project/go-state-types/builtin/v13/init"
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
@ -57,7 +57,7 @@ func (m message11) Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init13.ExecParams{
|
execParams := &init14.ExecParams{
|
||||||
CodeCID: code,
|
CodeCID: code,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
4
chain/actors/builtin/multisig/message12.go
generated
4
chain/actors/builtin/multisig/message12.go
generated
@ -8,7 +8,7 @@ import (
|
|||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
multisig12 "github.com/filecoin-project/go-state-types/builtin/v12/multisig"
|
multisig12 "github.com/filecoin-project/go-state-types/builtin/v12/multisig"
|
||||||
init13 "github.com/filecoin-project/go-state-types/builtin/v13/init"
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
@ -57,7 +57,7 @@ func (m message12) Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init13.ExecParams{
|
execParams := &init14.ExecParams{
|
||||||
CodeCID: code,
|
CodeCID: code,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
4
chain/actors/builtin/multisig/message13.go
generated
4
chain/actors/builtin/multisig/message13.go
generated
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
init13 "github.com/filecoin-project/go-state-types/builtin/v13/init"
|
|
||||||
multisig13 "github.com/filecoin-project/go-state-types/builtin/v13/multisig"
|
multisig13 "github.com/filecoin-project/go-state-types/builtin/v13/multisig"
|
||||||
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
@ -57,7 +57,7 @@ func (m message13) Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init13.ExecParams{
|
execParams := &init14.ExecParams{
|
||||||
CodeCID: code,
|
CodeCID: code,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
77
chain/actors/builtin/multisig/message14.go
generated
Normal file
77
chain/actors/builtin/multisig/message14.go
generated
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package multisig
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
|
multisig14 "github.com/filecoin-project/go-state-types/builtin/v14/multisig"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
type message14 struct{ message0 }
|
||||||
|
|
||||||
|
func (m message14) Create(
|
||||||
|
signers []address.Address, threshold uint64,
|
||||||
|
unlockStart, unlockDuration abi.ChainEpoch,
|
||||||
|
initialAmount abi.TokenAmount,
|
||||||
|
) (*types.Message, error) {
|
||||||
|
|
||||||
|
lenAddrs := uint64(len(signers))
|
||||||
|
|
||||||
|
if lenAddrs < threshold {
|
||||||
|
return nil, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
|
||||||
|
}
|
||||||
|
|
||||||
|
if threshold == 0 {
|
||||||
|
threshold = lenAddrs
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.from == address.Undef {
|
||||||
|
return nil, xerrors.Errorf("must provide source address")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up constructor parameters for multisig
|
||||||
|
msigParams := &multisig14.ConstructorParams{
|
||||||
|
Signers: signers,
|
||||||
|
NumApprovalsThreshold: threshold,
|
||||||
|
UnlockDuration: unlockDuration,
|
||||||
|
StartEpoch: unlockStart,
|
||||||
|
}
|
||||||
|
|
||||||
|
enc, actErr := actors.SerializeParams(msigParams)
|
||||||
|
if actErr != nil {
|
||||||
|
return nil, actErr
|
||||||
|
}
|
||||||
|
|
||||||
|
code, ok := actors.GetActorCodeID(actorstypes.Version14, manifest.MultisigKey)
|
||||||
|
if !ok {
|
||||||
|
return nil, xerrors.Errorf("failed to get multisig code ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
|
execParams := &init14.ExecParams{
|
||||||
|
CodeCID: code,
|
||||||
|
ConstructorParams: enc,
|
||||||
|
}
|
||||||
|
|
||||||
|
enc, actErr = actors.SerializeParams(execParams)
|
||||||
|
if actErr != nil {
|
||||||
|
return nil, actErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return &types.Message{
|
||||||
|
To: init_.Address,
|
||||||
|
From: m.from,
|
||||||
|
Method: builtintypes.MethodsInit.Exec,
|
||||||
|
Params: enc,
|
||||||
|
Value: initialAmount,
|
||||||
|
}, nil
|
||||||
|
}
|
4
chain/actors/builtin/multisig/message8.go
generated
4
chain/actors/builtin/multisig/message8.go
generated
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
init13 "github.com/filecoin-project/go-state-types/builtin/v13/init"
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
|
multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ func (m message8) Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init13.ExecParams{
|
execParams := &init14.ExecParams{
|
||||||
CodeCID: code,
|
CodeCID: code,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
4
chain/actors/builtin/multisig/message9.go
generated
4
chain/actors/builtin/multisig/message9.go
generated
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
init13 "github.com/filecoin-project/go-state-types/builtin/v13/init"
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
|
multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ func (m message9) Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init13.ExecParams{
|
execParams := &init14.ExecParams{
|
||||||
CodeCID: code,
|
CodeCID: code,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||||
msig13 "github.com/filecoin-project/go-state-types/builtin/v13/multisig"
|
msig14 "github.com/filecoin-project/go-state-types/builtin/v14/multisig"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -54,6 +54,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +130,9 @@ func MakeState(store adt.Store, av actorstypes.Version, signers []address.Addres
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
return make13(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -153,7 +159,7 @@ type State interface {
|
|||||||
GetState() interface{}
|
GetState() interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Transaction = msig13.Transaction
|
type Transaction = msig14.Transaction
|
||||||
|
|
||||||
var Methods = builtintypes.MethodsMultisig
|
var Methods = builtintypes.MethodsMultisig
|
||||||
|
|
||||||
@ -198,6 +204,9 @@ func Message(version actorstypes.Version, from address.Address) MessageBuilder {
|
|||||||
|
|
||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return message13{message0{from}}
|
return message13{message0{from}}
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return message14{message0{from}}
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unsupported actors version: %d", version))
|
panic(fmt.Sprintf("unsupported actors version: %d", version))
|
||||||
}
|
}
|
||||||
@ -221,13 +230,13 @@ type MessageBuilder interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this type is the same between v0 and v2
|
// this type is the same between v0 and v2
|
||||||
type ProposalHashData = msig13.ProposalHashData
|
type ProposalHashData = msig14.ProposalHashData
|
||||||
type ProposeReturn = msig13.ProposeReturn
|
type ProposeReturn = msig14.ProposeReturn
|
||||||
type ProposeParams = msig13.ProposeParams
|
type ProposeParams = msig14.ProposeParams
|
||||||
type ApproveReturn = msig13.ApproveReturn
|
type ApproveReturn = msig14.ApproveReturn
|
||||||
|
|
||||||
func txnParams(id uint64, data *ProposalHashData) ([]byte, error) {
|
func txnParams(id uint64, data *ProposalHashData) ([]byte, error) {
|
||||||
params := msig13.TxnIDParams{ID: msig13.TxnID(id)}
|
params := msig14.TxnIDParams{ID: msig14.TxnID(id)}
|
||||||
if data != nil {
|
if data != nil {
|
||||||
if data.Requester.Protocol() != address.ID {
|
if data.Requester.Protocol() != address.ID {
|
||||||
return nil, xerrors.Errorf("proposer address must be an ID address, was %s", data.Requester)
|
return nil, xerrors.Errorf("proposer address must be an ID address, was %s", data.Requester)
|
||||||
@ -264,5 +273,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
138
chain/actors/builtin/multisig/v14.go
generated
Normal file
138
chain/actors/builtin/multisig/v14.go
generated
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
package multisig
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
msig14 "github.com/filecoin-project/go-state-types/builtin/v14/multisig"
|
||||||
|
adt14 "github.com/filecoin-project/go-state-types/builtin/v14/util/adt"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
out.State = msig14.State{}
|
||||||
|
out.State.Signers = signers
|
||||||
|
out.State.NumApprovalsThreshold = threshold
|
||||||
|
out.State.StartEpoch = startEpoch
|
||||||
|
out.State.UnlockDuration = unlockDuration
|
||||||
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
|
em, err := adt14.StoreEmptyMap(store, builtin14.DefaultHamtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
msig14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||||
|
return s.State.AmountLocked(currEpoch - s.State.StartEpoch), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) StartEpoch() (abi.ChainEpoch, error) {
|
||||||
|
return s.State.StartEpoch, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) UnlockDuration() (abi.ChainEpoch, error) {
|
||||||
|
return s.State.UnlockDuration, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) InitialBalance() (abi.TokenAmount, error) {
|
||||||
|
return s.State.InitialBalance, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Threshold() (uint64, error) {
|
||||||
|
return s.State.NumApprovalsThreshold, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Signers() ([]address.Address, error) {
|
||||||
|
return s.State.Signers, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ForEachPendingTxn(cb func(id int64, txn Transaction) error) error {
|
||||||
|
arr, err := adt14.AsMap(s.store, s.State.PendingTxns, builtin14.DefaultHamtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var out msig14.Transaction
|
||||||
|
return arr.ForEach(&out, func(key string) error {
|
||||||
|
txid, n := binary.Varint([]byte(key))
|
||||||
|
if n <= 0 {
|
||||||
|
return xerrors.Errorf("invalid pending transaction key: %v", key)
|
||||||
|
}
|
||||||
|
return cb(txid, (Transaction)(out)) //nolint:unconvert
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) PendingTxnChanged(other State) (bool, error) {
|
||||||
|
other14, ok := other.(*state14)
|
||||||
|
if !ok {
|
||||||
|
// treat an upgrade as a change, always
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return !s.State.PendingTxns.Equals(other14.PendingTxns), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) transactions() (adt.Map, error) {
|
||||||
|
return adt14.AsMap(s.store, s.PendingTxns, builtin14.DefaultHamtBitwidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||||
|
var tx msig14.Transaction
|
||||||
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
|
return Transaction{}, err
|
||||||
|
}
|
||||||
|
return Transaction(tx), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.MultisigKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
109
chain/actors/builtin/paych/message14.go
generated
Normal file
109
chain/actors/builtin/paych/message14.go
generated
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package paych
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
|
paych14 "github.com/filecoin-project/go-state-types/builtin/v14/paych"
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
type message14 struct{ from address.Address }
|
||||||
|
|
||||||
|
func (m message14) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
|
||||||
|
|
||||||
|
actorCodeID, ok := actors.GetActorCodeID(actorstypes.Version14, "paymentchannel")
|
||||||
|
if !ok {
|
||||||
|
return nil, xerrors.Errorf("error getting actor paymentchannel code id for actor version %d", 14)
|
||||||
|
}
|
||||||
|
|
||||||
|
params, aerr := actors.SerializeParams(&paych14.ConstructorParams{From: m.from, To: to})
|
||||||
|
if aerr != nil {
|
||||||
|
return nil, aerr
|
||||||
|
}
|
||||||
|
enc, aerr := actors.SerializeParams(&init14.ExecParams{
|
||||||
|
CodeCID: actorCodeID,
|
||||||
|
ConstructorParams: params,
|
||||||
|
})
|
||||||
|
if aerr != nil {
|
||||||
|
return nil, aerr
|
||||||
|
}
|
||||||
|
|
||||||
|
return &types.Message{
|
||||||
|
To: init_.Address,
|
||||||
|
From: m.from,
|
||||||
|
Value: initialAmount,
|
||||||
|
Method: builtin14.MethodsInit.Exec,
|
||||||
|
Params: enc,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m message14) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
|
params, aerr := actors.SerializeParams(&paych14.UpdateChannelStateParams{
|
||||||
|
|
||||||
|
Sv: toV14SignedVoucher(*sv),
|
||||||
|
|
||||||
|
Secret: secret,
|
||||||
|
})
|
||||||
|
if aerr != nil {
|
||||||
|
return nil, aerr
|
||||||
|
}
|
||||||
|
|
||||||
|
return &types.Message{
|
||||||
|
To: paych,
|
||||||
|
From: m.from,
|
||||||
|
Value: abi.NewTokenAmount(0),
|
||||||
|
Method: builtin14.MethodsPaych.UpdateChannelState,
|
||||||
|
Params: params,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func toV14SignedVoucher(sv paychtypes.SignedVoucher) paych14.SignedVoucher {
|
||||||
|
merges := make([]paych14.Merge, len(sv.Merges))
|
||||||
|
for i := range sv.Merges {
|
||||||
|
merges[i] = paych14.Merge{
|
||||||
|
Lane: sv.Merges[i].Lane,
|
||||||
|
Nonce: sv.Merges[i].Nonce,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paych14.SignedVoucher{
|
||||||
|
ChannelAddr: sv.ChannelAddr,
|
||||||
|
TimeLockMin: sv.TimeLockMin,
|
||||||
|
TimeLockMax: sv.TimeLockMax,
|
||||||
|
SecretHash: sv.SecretHash,
|
||||||
|
Extra: (*paych14.ModVerifyParams)(sv.Extra),
|
||||||
|
Lane: sv.Lane,
|
||||||
|
Nonce: sv.Nonce,
|
||||||
|
Amount: sv.Amount,
|
||||||
|
MinSettleHeight: sv.MinSettleHeight,
|
||||||
|
Merges: merges,
|
||||||
|
Signature: sv.Signature,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m message14) Settle(paych address.Address) (*types.Message, error) {
|
||||||
|
return &types.Message{
|
||||||
|
To: paych,
|
||||||
|
From: m.from,
|
||||||
|
Value: abi.NewTokenAmount(0),
|
||||||
|
Method: builtin14.MethodsPaych.Settle,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m message14) Collect(paych address.Address) (*types.Message, error) {
|
||||||
|
return &types.Message{
|
||||||
|
To: paych,
|
||||||
|
From: m.from,
|
||||||
|
Value: abi.NewTokenAmount(0),
|
||||||
|
Method: builtin14.MethodsPaych.Collect,
|
||||||
|
}, nil
|
||||||
|
}
|
@ -56,6 +56,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +182,9 @@ func Message(version actorstypes.Version, from address.Address) MessageBuilder {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return message13{from}
|
return message13{from}
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return message14{from}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unsupported actors version: %d", version))
|
panic(fmt.Sprintf("unsupported actors version: %d", version))
|
||||||
}
|
}
|
||||||
@ -222,5 +228,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
135
chain/actors/builtin/paych/v14.go
generated
Normal file
135
chain/actors/builtin/paych/v14.go
generated
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
package paych
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
|
paych14 "github.com/filecoin-project/go-state-types/builtin/v14/paych"
|
||||||
|
adt14 "github.com/filecoin-project/go-state-types/builtin/v14/util/adt"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
out.State = paych14.State{}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
paych14.State
|
||||||
|
store adt.Store
|
||||||
|
lsAmt *adt14.Array
|
||||||
|
}
|
||||||
|
|
||||||
|
// Channel owner, who has funded the actor
|
||||||
|
func (s *state14) From() (address.Address, error) {
|
||||||
|
return s.State.From, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recipient of payouts from channel
|
||||||
|
func (s *state14) To() (address.Address, error) {
|
||||||
|
return s.State.To, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Height at which the channel can be `Collected`
|
||||||
|
func (s *state14) SettlingAt() (abi.ChainEpoch, error) {
|
||||||
|
return s.State.SettlingAt, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount successfully redeemed through the payment channel, paid out on `Collect()`
|
||||||
|
func (s *state14) ToSend() (abi.TokenAmount, error) {
|
||||||
|
return s.State.ToSend, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) getOrLoadLsAmt() (*adt14.Array, error) {
|
||||||
|
if s.lsAmt != nil {
|
||||||
|
return s.lsAmt, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the lane state from the chain
|
||||||
|
lsamt, err := adt14.AsArray(s.store, s.State.LaneStates, paych14.LaneStatesAmtBitwidth)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
s.lsAmt = lsamt
|
||||||
|
return lsamt, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get total number of lanes
|
||||||
|
func (s *state14) LaneCount() (uint64, error) {
|
||||||
|
lsamt, err := s.getOrLoadLsAmt()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return lsamt.Length(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate lane states
|
||||||
|
func (s *state14) ForEachLaneState(cb func(idx uint64, dl LaneState) error) error {
|
||||||
|
// Get the lane state from the chain
|
||||||
|
lsamt, err := s.getOrLoadLsAmt()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: we use a map instead of an array to store laneStates because the
|
||||||
|
// client sets the lane ID (the index) and potentially they could use a
|
||||||
|
// very large index.
|
||||||
|
var ls paych14.LaneState
|
||||||
|
return lsamt.ForEach(&ls, func(i int64) error {
|
||||||
|
return cb(uint64(i), &laneState14{ls})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
type laneState14 struct {
|
||||||
|
paych14.LaneState
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ls *laneState14) Redeemed() (big.Int, error) {
|
||||||
|
return ls.LaneState.Redeemed, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ls *laneState14) Nonce() (uint64, error) {
|
||||||
|
return ls.LaneState.Nonce, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.PaychKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -27,8 +27,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin13.StoragePowerActorAddr
|
Address = builtin14.StoragePowerActorAddr
|
||||||
Methods = builtin13.MethodsPower
|
Methods = builtin14.MethodsPower
|
||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
@ -57,6 +57,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +133,9 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store)
|
return make13(store)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -197,5 +203,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
207
chain/actors/builtin/power/v14.go
generated
Normal file
207
chain/actors/builtin/power/v14.go
generated
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
package power
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
power14 "github.com/filecoin-project/go-state-types/builtin/v14/power"
|
||||||
|
adt14 "github.com/filecoin-project/go-state-types/builtin/v14/util/adt"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
|
||||||
|
s, err := power14.ConstructState(store)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
power14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) TotalLocked() (abi.TokenAmount, error) {
|
||||||
|
return s.TotalPledgeCollateral, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) TotalPower() (Claim, error) {
|
||||||
|
return Claim{
|
||||||
|
RawBytePower: s.TotalRawBytePower,
|
||||||
|
QualityAdjPower: s.TotalQualityAdjPower,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Committed power to the network. Includes miners below the minimum threshold.
|
||||||
|
func (s *state14) TotalCommitted() (Claim, error) {
|
||||||
|
return Claim{
|
||||||
|
RawBytePower: s.TotalBytesCommitted,
|
||||||
|
QualityAdjPower: s.TotalQABytesCommitted,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) MinerPower(addr address.Address) (Claim, bool, error) {
|
||||||
|
claims, err := s.claims()
|
||||||
|
if err != nil {
|
||||||
|
return Claim{}, false, err
|
||||||
|
}
|
||||||
|
var claim power14.Claim
|
||||||
|
ok, err := claims.Get(abi.AddrKey(addr), &claim)
|
||||||
|
if err != nil {
|
||||||
|
return Claim{}, false, err
|
||||||
|
}
|
||||||
|
return Claim{
|
||||||
|
RawBytePower: claim.RawBytePower,
|
||||||
|
QualityAdjPower: claim.QualityAdjPower,
|
||||||
|
}, ok, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) {
|
||||||
|
return s.State.MinerNominalPowerMeetsConsensusMinimum(s.store, a)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) MinerCounts() (uint64, uint64, error) {
|
||||||
|
return uint64(s.State.MinerAboveMinPowerCount), uint64(s.State.MinerCount), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ListAllMiners() ([]address.Address, error) {
|
||||||
|
claims, err := s.claims()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var miners []address.Address
|
||||||
|
err = claims.ForEach(nil, func(k string) error {
|
||||||
|
a, err := address.NewFromBytes([]byte(k))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
miners = append(miners, a)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return miners, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ForEachClaim(cb func(miner address.Address, claim Claim) error) error {
|
||||||
|
claims, err := s.claims()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var claim power14.Claim
|
||||||
|
return claims.ForEach(&claim, func(k string) error {
|
||||||
|
a, err := address.NewFromBytes([]byte(k))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return cb(a, Claim{
|
||||||
|
RawBytePower: claim.RawBytePower,
|
||||||
|
QualityAdjPower: claim.QualityAdjPower,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ClaimsChanged(other State) (bool, error) {
|
||||||
|
other14, ok := other.(*state14)
|
||||||
|
if !ok {
|
||||||
|
// treat an upgrade as a change, always
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return !s.State.Claims.Equals(other14.State.Claims), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) SetTotalQualityAdjPower(p abi.StoragePower) error {
|
||||||
|
s.State.TotalQualityAdjPower = p
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) SetTotalRawBytePower(p abi.StoragePower) error {
|
||||||
|
s.State.TotalRawBytePower = p
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) SetThisEpochQualityAdjPower(p abi.StoragePower) error {
|
||||||
|
s.State.ThisEpochQualityAdjPower = p
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) SetThisEpochRawBytePower(p abi.StoragePower) error {
|
||||||
|
s.State.ThisEpochRawBytePower = p
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) claims() (adt.Map, error) {
|
||||||
|
return adt14.AsMap(s.store, s.Claims, builtin14.DefaultHamtBitwidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) decodeClaim(val *cbg.Deferred) (Claim, error) {
|
||||||
|
var ci power14.Claim
|
||||||
|
if err := ci.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
|
return Claim{}, err
|
||||||
|
}
|
||||||
|
return fromV14Claim(ci), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func fromV14Claim(v14 power14.Claim) Claim {
|
||||||
|
return Claim{
|
||||||
|
RawBytePower: v14.RawBytePower,
|
||||||
|
QualityAdjPower: v14.QualityAdjPower,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.PowerKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
@ -74,6 +74,22 @@ import (
|
|||||||
reward13 "github.com/filecoin-project/go-state-types/builtin/v13/reward"
|
reward13 "github.com/filecoin-project/go-state-types/builtin/v13/reward"
|
||||||
system13 "github.com/filecoin-project/go-state-types/builtin/v13/system"
|
system13 "github.com/filecoin-project/go-state-types/builtin/v13/system"
|
||||||
verifreg13 "github.com/filecoin-project/go-state-types/builtin/v13/verifreg"
|
verifreg13 "github.com/filecoin-project/go-state-types/builtin/v13/verifreg"
|
||||||
|
account14 "github.com/filecoin-project/go-state-types/builtin/v14/account"
|
||||||
|
cron14 "github.com/filecoin-project/go-state-types/builtin/v14/cron"
|
||||||
|
datacap14 "github.com/filecoin-project/go-state-types/builtin/v14/datacap"
|
||||||
|
eam14 "github.com/filecoin-project/go-state-types/builtin/v14/eam"
|
||||||
|
ethaccount14 "github.com/filecoin-project/go-state-types/builtin/v14/ethaccount"
|
||||||
|
evm14 "github.com/filecoin-project/go-state-types/builtin/v14/evm"
|
||||||
|
_init14 "github.com/filecoin-project/go-state-types/builtin/v14/init"
|
||||||
|
market14 "github.com/filecoin-project/go-state-types/builtin/v14/market"
|
||||||
|
miner14 "github.com/filecoin-project/go-state-types/builtin/v14/miner"
|
||||||
|
multisig14 "github.com/filecoin-project/go-state-types/builtin/v14/multisig"
|
||||||
|
paych14 "github.com/filecoin-project/go-state-types/builtin/v14/paych"
|
||||||
|
placeholder14 "github.com/filecoin-project/go-state-types/builtin/v14/placeholder"
|
||||||
|
power14 "github.com/filecoin-project/go-state-types/builtin/v14/power"
|
||||||
|
reward14 "github.com/filecoin-project/go-state-types/builtin/v14/reward"
|
||||||
|
system14 "github.com/filecoin-project/go-state-types/builtin/v14/system"
|
||||||
|
verifreg14 "github.com/filecoin-project/go-state-types/builtin/v14/verifreg"
|
||||||
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
|
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
|
||||||
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
|
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
|
||||||
_init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
_init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||||
@ -737,6 +753,110 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
for key, codeID := range codeIDs {
|
||||||
|
switch key {
|
||||||
|
case manifest.AccountKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: account14.Methods,
|
||||||
|
state: new(account14.State),
|
||||||
|
})
|
||||||
|
case manifest.CronKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: cron14.Methods,
|
||||||
|
state: new(cron14.State),
|
||||||
|
})
|
||||||
|
case manifest.InitKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: _init14.Methods,
|
||||||
|
state: new(_init14.State),
|
||||||
|
})
|
||||||
|
case manifest.MarketKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: market14.Methods,
|
||||||
|
state: new(market14.State),
|
||||||
|
})
|
||||||
|
case manifest.MinerKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: miner14.Methods,
|
||||||
|
state: new(miner14.State),
|
||||||
|
})
|
||||||
|
case manifest.MultisigKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: multisig14.Methods,
|
||||||
|
state: new(multisig14.State),
|
||||||
|
})
|
||||||
|
case manifest.PaychKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: paych14.Methods,
|
||||||
|
state: new(paych14.State),
|
||||||
|
})
|
||||||
|
case manifest.PowerKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: power14.Methods,
|
||||||
|
state: new(power14.State),
|
||||||
|
})
|
||||||
|
case manifest.RewardKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: reward14.Methods,
|
||||||
|
state: new(reward14.State),
|
||||||
|
})
|
||||||
|
case manifest.SystemKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: system14.Methods,
|
||||||
|
state: new(system14.State),
|
||||||
|
})
|
||||||
|
case manifest.VerifregKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: verifreg14.Methods,
|
||||||
|
state: new(verifreg14.State),
|
||||||
|
})
|
||||||
|
case manifest.DatacapKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: datacap14.Methods,
|
||||||
|
state: new(datacap14.State),
|
||||||
|
})
|
||||||
|
|
||||||
|
case manifest.EvmKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: evm14.Methods,
|
||||||
|
state: new(evm14.State),
|
||||||
|
})
|
||||||
|
case manifest.EamKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: eam14.Methods,
|
||||||
|
state: nil,
|
||||||
|
})
|
||||||
|
case manifest.PlaceholderKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: placeholder14.Methods,
|
||||||
|
state: nil,
|
||||||
|
})
|
||||||
|
case manifest.EthAccountKey:
|
||||||
|
registry = append(registry, RegistryEntry{
|
||||||
|
code: codeID,
|
||||||
|
methods: ethaccount14.Methods,
|
||||||
|
state: nil,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic("expected version v8 and up only, use specs-actors for v0-7")
|
panic("expected version v8 and up only, use specs-actors for v0-7")
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -25,8 +25,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin13.RewardActorAddr
|
Address = builtin14.RewardActorAddr
|
||||||
Methods = builtin13.MethodsReward
|
Methods = builtin14.MethodsReward
|
||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
@ -55,6 +55,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +131,9 @@ func MakeState(store adt.Store, av actorstypes.Version, currRealizedPower abi.St
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store, currRealizedPower)
|
return make13(store, currRealizedPower)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store, currRealizedPower)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -173,5 +179,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
120
chain/actors/builtin/reward/v14.go
generated
Normal file
120
chain/actors/builtin/reward/v14.go
generated
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
package reward
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
miner14 "github.com/filecoin-project/go-state-types/builtin/v14/miner"
|
||||||
|
reward14 "github.com/filecoin-project/go-state-types/builtin/v14/reward"
|
||||||
|
smoothing14 "github.com/filecoin-project/go-state-types/builtin/v14/util/smoothing"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store, currRealizedPower abi.StoragePower) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
out.State = *reward14.ConstructState(currRealizedPower)
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
reward14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ThisEpochReward() (abi.TokenAmount, error) {
|
||||||
|
return s.State.ThisEpochReward, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
|
return builtin.FilterEstimate{
|
||||||
|
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||||
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ThisEpochBaselinePower() (abi.StoragePower, error) {
|
||||||
|
return s.State.ThisEpochBaselinePower, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) TotalStoragePowerReward() (abi.TokenAmount, error) {
|
||||||
|
return s.State.TotalStoragePowerReward, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) EffectiveBaselinePower() (abi.StoragePower, error) {
|
||||||
|
return s.State.EffectiveBaselinePower, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) EffectiveNetworkTime() (abi.ChainEpoch, error) {
|
||||||
|
return s.State.EffectiveNetworkTime, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) CumsumBaseline() (reward14.Spacetime, error) {
|
||||||
|
return s.State.CumsumBaseline, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) CumsumRealized() (reward14.Spacetime, error) {
|
||||||
|
return s.State.CumsumRealized, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) InitialPledgeForPower(qaPower abi.StoragePower, networkTotalPledge abi.TokenAmount, networkQAPower *builtin.FilterEstimate, circSupply abi.TokenAmount) (abi.TokenAmount, error) {
|
||||||
|
return miner14.InitialPledgeForPower(
|
||||||
|
qaPower,
|
||||||
|
s.State.ThisEpochBaselinePower,
|
||||||
|
s.State.ThisEpochRewardSmoothed,
|
||||||
|
smoothing14.FilterEstimate{
|
||||||
|
PositionEstimate: networkQAPower.PositionEstimate,
|
||||||
|
VelocityEstimate: networkQAPower.VelocityEstimate,
|
||||||
|
},
|
||||||
|
circSupply,
|
||||||
|
), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) PreCommitDepositForPower(networkQAPower builtin.FilterEstimate, sectorWeight abi.StoragePower) (abi.TokenAmount, error) {
|
||||||
|
return miner14.PreCommitDepositForPower(s.State.ThisEpochRewardSmoothed,
|
||||||
|
smoothing14.FilterEstimate{
|
||||||
|
PositionEstimate: networkQAPower.PositionEstimate,
|
||||||
|
VelocityEstimate: networkQAPower.VelocityEstimate,
|
||||||
|
},
|
||||||
|
sectorWeight), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.RewardKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
@ -5,7 +5,7 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
@ -21,7 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin13.SystemActorAddr
|
Address = builtin14.SystemActorAddr
|
||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
@ -50,6 +50,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +126,9 @@ func MakeState(store adt.Store, av actorstypes.Version, builtinActors cid.Cid) (
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store, builtinActors)
|
return make13(store, builtinActors)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store, builtinActors)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -152,5 +158,6 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
72
chain/actors/builtin/system/v14.go
generated
Normal file
72
chain/actors/builtin/system/v14.go
generated
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
system14 "github.com/filecoin-project/go-state-types/builtin/v14/system"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store, builtinActors cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
out.State = system14.State{
|
||||||
|
BuiltinActors: builtinActors,
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
system14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetBuiltinActors() cid.Cid {
|
||||||
|
|
||||||
|
return s.State.BuiltinActors
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) SetBuiltinActors(c cid.Cid) error {
|
||||||
|
|
||||||
|
s.State.BuiltinActors = c
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.SystemKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
196
chain/actors/builtin/verifreg/v14.go
generated
Normal file
196
chain/actors/builtin/verifreg/v14.go
generated
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
package verifreg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
adt14 "github.com/filecoin-project/go-state-types/builtin/v14/util/adt"
|
||||||
|
verifreg14 "github.com/filecoin-project/go-state-types/builtin/v14/verifreg"
|
||||||
|
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||||
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state14)(nil)
|
||||||
|
|
||||||
|
func load14(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func make14(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
|
out := state14{store: store}
|
||||||
|
|
||||||
|
s, err := verifreg14.ConstructState(store, rootKeyAddress)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state14 struct {
|
||||||
|
verifreg14.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) RootKey() (address.Address, error) {
|
||||||
|
return s.State.RootKey, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||||
|
|
||||||
|
return false, big.Zero(), xerrors.Errorf("unsupported in actors v14")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||||
|
return getDataCap(s.store, actors.Version14, s.verifiers, addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) RemoveDataCapProposalID(verifier address.Address, client address.Address) (bool, uint64, error) {
|
||||||
|
return getRemoveDataCapProposalID(s.store, actors.Version14, s.removeDataCapProposalIDs, verifier, client)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ForEachVerifier(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||||
|
return forEachCap(s.store, actors.Version14, s.verifiers, cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||||
|
|
||||||
|
return xerrors.Errorf("unsupported in actors v14")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) verifiedClients() (adt.Map, error) {
|
||||||
|
|
||||||
|
return nil, xerrors.Errorf("unsupported in actors v14")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) verifiers() (adt.Map, error) {
|
||||||
|
return adt14.AsMap(s.store, s.Verifiers, builtin14.DefaultHamtBitwidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
|
return adt14.AsMap(s.store, s.RemoveDataCapProposalIDs, builtin14.DefaultHamtBitwidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetState() interface{} {
|
||||||
|
return &s.State
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
|
||||||
|
|
||||||
|
alloc, ok, err := s.FindAllocation(s.store, clientIdAddr, verifreg14.AllocationId(allocationId))
|
||||||
|
return (*Allocation)(alloc), ok, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
|
||||||
|
|
||||||
|
v14Map, err := s.LoadAllocationsToMap(s.store, clientIdAddr)
|
||||||
|
|
||||||
|
retMap := make(map[AllocationId]Allocation, len(v14Map))
|
||||||
|
for k, v := range v14Map {
|
||||||
|
retMap[AllocationId(k)] = Allocation(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
return retMap, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetAllAllocations() (map[AllocationId]Allocation, error) {
|
||||||
|
|
||||||
|
v14Map, err := s.State.GetAllAllocations(s.store)
|
||||||
|
|
||||||
|
retMap := make(map[AllocationId]Allocation, len(v14Map))
|
||||||
|
for k, v := range v14Map {
|
||||||
|
retMap[AllocationId(k)] = Allocation(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
return retMap, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
|
||||||
|
|
||||||
|
claim, ok, err := s.FindClaim(s.store, providerIdAddr, verifreg14.ClaimId(claimId))
|
||||||
|
return (*Claim)(claim), ok, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
|
||||||
|
|
||||||
|
v14Map, err := s.LoadClaimsToMap(s.store, providerIdAddr)
|
||||||
|
|
||||||
|
retMap := make(map[ClaimId]Claim, len(v14Map))
|
||||||
|
for k, v := range v14Map {
|
||||||
|
retMap[ClaimId(k)] = Claim(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
return retMap, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetAllClaims() (map[ClaimId]Claim, error) {
|
||||||
|
|
||||||
|
v14Map, err := s.State.GetAllClaims(s.store)
|
||||||
|
|
||||||
|
retMap := make(map[ClaimId]Claim, len(v14Map))
|
||||||
|
for k, v := range v14Map {
|
||||||
|
retMap[ClaimId(k)] = Claim(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
return retMap, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) GetClaimIdsBySector(providerIdAddr address.Address) (map[abi.SectorNumber][]ClaimId, error) {
|
||||||
|
|
||||||
|
v14Map, err := s.LoadClaimsToMap(s.store, providerIdAddr)
|
||||||
|
|
||||||
|
retMap := make(map[abi.SectorNumber][]ClaimId)
|
||||||
|
for k, v := range v14Map {
|
||||||
|
claims, ok := retMap[v.Sector]
|
||||||
|
if !ok {
|
||||||
|
retMap[v.Sector] = []ClaimId{ClaimId(k)}
|
||||||
|
} else {
|
||||||
|
retMap[v.Sector] = append(claims, ClaimId(k))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retMap, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorKey() string {
|
||||||
|
return manifest.VerifregKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) ActorVersion() actorstypes.Version {
|
||||||
|
return actorstypes.Version14
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state14) Code() cid.Cid {
|
||||||
|
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
}
|
13
chain/actors/builtin/verifreg/verifreg.go
generated
13
chain/actors/builtin/verifreg/verifreg.go
generated
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
@ -25,8 +25,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin13.VerifiedRegistryActorAddr
|
Address = builtin14.VerifiedRegistryActorAddr
|
||||||
Methods = builtin13.MethodsVerifiedRegistry
|
Methods = builtin14.MethodsVerifiedRegistry
|
||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
@ -55,6 +55,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return load13(store, act.Head)
|
return load13(store, act.Head)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return load14(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +131,9 @@ func MakeState(store adt.Store, av actorstypes.Version, rootKeyAddress address.A
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return make13(store, rootKeyAddress)
|
return make13(store, rootKeyAddress)
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return make14(store, rootKeyAddress)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
@ -170,6 +176,7 @@ func AllCodes() []cid.Cid {
|
|||||||
(&state11{}).Code(),
|
(&state11{}).Code(),
|
||||||
(&state12{}).Code(),
|
(&state12{}).Code(),
|
||||||
(&state13{}).Code(),
|
(&state13{}).Code(),
|
||||||
|
(&state14{}).Code(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
builtin12 "github.com/filecoin-project/go-state-types/builtin"
|
builtin12 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
builtin13 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
builtin14 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
market10 "github.com/filecoin-project/go-state-types/builtin/v10/market"
|
market10 "github.com/filecoin-project/go-state-types/builtin/v10/market"
|
||||||
@ -23,8 +24,11 @@ import (
|
|||||||
verifreg12 "github.com/filecoin-project/go-state-types/builtin/v12/verifreg"
|
verifreg12 "github.com/filecoin-project/go-state-types/builtin/v12/verifreg"
|
||||||
market13 "github.com/filecoin-project/go-state-types/builtin/v13/market"
|
market13 "github.com/filecoin-project/go-state-types/builtin/v13/market"
|
||||||
miner13 "github.com/filecoin-project/go-state-types/builtin/v13/miner"
|
miner13 "github.com/filecoin-project/go-state-types/builtin/v13/miner"
|
||||||
paych13 "github.com/filecoin-project/go-state-types/builtin/v13/paych"
|
|
||||||
verifreg13 "github.com/filecoin-project/go-state-types/builtin/v13/verifreg"
|
verifreg13 "github.com/filecoin-project/go-state-types/builtin/v13/verifreg"
|
||||||
|
market14 "github.com/filecoin-project/go-state-types/builtin/v14/market"
|
||||||
|
miner14 "github.com/filecoin-project/go-state-types/builtin/v14/miner"
|
||||||
|
paych14 "github.com/filecoin-project/go-state-types/builtin/v14/paych"
|
||||||
|
verifreg14 "github.com/filecoin-project/go-state-types/builtin/v14/verifreg"
|
||||||
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||||
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
|
verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
|
||||||
@ -63,14 +67,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ChainFinality = miner13.ChainFinality
|
ChainFinality = miner14.ChainFinality
|
||||||
SealRandomnessLookback = ChainFinality
|
SealRandomnessLookback = ChainFinality
|
||||||
PaychSettleDelay = paych13.SettleDelay
|
PaychSettleDelay = paych14.SettleDelay
|
||||||
MaxPreCommitRandomnessLookback = builtin13.EpochsInDay + SealRandomnessLookback
|
MaxPreCommitRandomnessLookback = builtin14.EpochsInDay + SealRandomnessLookback
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
MarketDefaultAllocationTermBuffer = market13.MarketDefaultAllocationTermBuffer
|
MarketDefaultAllocationTermBuffer = market14.MarketDefaultAllocationTermBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetSupportedProofTypes sets supported proof types, across all actor versions.
|
// SetSupportedProofTypes sets supported proof types, across all actor versions.
|
||||||
@ -187,11 +191,13 @@ func SetPreCommitChallengeDelay(delay abi.ChainEpoch) {
|
|||||||
|
|
||||||
miner13.PreCommitChallengeDelay = delay
|
miner13.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
|
miner14.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay.
|
// TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay.
|
||||||
func GetPreCommitChallengeDelay() abi.ChainEpoch {
|
func GetPreCommitChallengeDelay() abi.ChainEpoch {
|
||||||
return miner13.PreCommitChallengeDelay
|
return miner14.PreCommitChallengeDelay
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetConsensusMinerMinPower sets the minimum power of an individual miner must
|
// SetConsensusMinerMinPower sets the minimum power of an individual miner must
|
||||||
@ -249,6 +255,10 @@ func SetConsensusMinerMinPower(p abi.StoragePower) {
|
|||||||
policy.ConsensusMinerMinPower = p
|
policy.ConsensusMinerMinPower = p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, policy := range builtin14.PoStProofPolicies {
|
||||||
|
policy.ConsensusMinerMinPower = p
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should
|
// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should
|
||||||
@ -281,6 +291,8 @@ func SetMinVerifiedDealSize(size abi.StoragePower) {
|
|||||||
|
|
||||||
verifreg13.MinVerifiedDealSize = size
|
verifreg13.MinVerifiedDealSize = size
|
||||||
|
|
||||||
|
verifreg14.MinVerifiedDealSize = size
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) {
|
func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) {
|
||||||
@ -338,6 +350,10 @@ func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProo
|
|||||||
|
|
||||||
return miner13.MaxProveCommitDuration[t], nil
|
return miner13.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
|
||||||
|
return miner14.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported actors version")
|
return 0, xerrors.Errorf("unsupported actors version")
|
||||||
}
|
}
|
||||||
@ -408,6 +424,11 @@ func SetProviderCollateralSupplyTarget(num, denom big.Int) {
|
|||||||
Denominator: denom,
|
Denominator: denom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
market14.ProviderCollateralSupplyTarget = builtin14.BigFrac{
|
||||||
|
Numerator: num,
|
||||||
|
Denominator: denom,
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func DealProviderCollateralBounds(
|
func DealProviderCollateralBounds(
|
||||||
@ -486,13 +507,18 @@ func DealProviderCollateralBounds(
|
|||||||
min, max := market13.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
min, max := market13.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
return min, max, nil
|
return min, max, nil
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
|
||||||
|
min, max := market14.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
|
return min, max, nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version")
|
return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func DealDurationBounds(pieceSize abi.PaddedPieceSize) (min, max abi.ChainEpoch) {
|
func DealDurationBounds(pieceSize abi.PaddedPieceSize) (min, max abi.ChainEpoch) {
|
||||||
return market13.DealDurationBounds(pieceSize)
|
return market14.DealDurationBounds(pieceSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the challenge window and scales the proving period to match (such that
|
// Sets the challenge window and scales the proving period to match (such that
|
||||||
@ -582,6 +608,13 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
|
|||||||
// scale it if we're scaling the challenge period.
|
// scale it if we're scaling the challenge period.
|
||||||
miner13.WPoStDisputeWindow = period * 30
|
miner13.WPoStDisputeWindow = period * 30
|
||||||
|
|
||||||
|
miner14.WPoStChallengeWindow = period
|
||||||
|
miner14.WPoStProvingPeriod = period * abi.ChainEpoch(miner14.WPoStPeriodDeadlines)
|
||||||
|
|
||||||
|
// by default, this is 2x finality which is 30 periods.
|
||||||
|
// scale it if we're scaling the challenge period.
|
||||||
|
miner14.WPoStDisputeWindow = period * 30
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
|
func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
|
||||||
@ -639,6 +672,9 @@ func GetMaxSectorExpirationExtension(nv network.Version) (abi.ChainEpoch, error)
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return miner13.MaxSectorExpirationExtension, nil
|
return miner13.MaxSectorExpirationExtension, nil
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return miner14.MaxSectorExpirationExtension, nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported network version")
|
return 0, xerrors.Errorf("unsupported network version")
|
||||||
}
|
}
|
||||||
@ -646,11 +682,11 @@ func GetMaxSectorExpirationExtension(nv network.Version) (abi.ChainEpoch, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetMinSectorExpiration() abi.ChainEpoch {
|
func GetMinSectorExpiration() abi.ChainEpoch {
|
||||||
return miner13.MinSectorExpiration
|
return miner14.MinSectorExpiration
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) {
|
func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) {
|
||||||
sectorsPerPart, err := builtin13.PoStProofWindowPoStPartitionSectors(p)
|
sectorsPerPart, err := builtin14.PoStProofWindowPoStPartitionSectors(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@ -659,7 +695,7 @@ func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, e
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return min(miner13.PoStedPartitionsMax, int(uint64(maxSectors)/sectorsPerPart)), nil
|
return min(miner14.PoStedPartitionsMax, int(uint64(maxSectors)/sectorsPerPart)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
|
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
|
||||||
@ -671,7 +707,7 @@ func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version)
|
|||||||
return builtin4.SealProofPoliciesV0[proof].SectorMaxLifetime
|
return builtin4.SealProofPoliciesV0[proof].SectorMaxLifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
return builtin13.SealProofPoliciesV11[proof].SectorMaxLifetime
|
return builtin14.SealProofPoliciesV11[proof].SectorMaxLifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
|
func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
|
||||||
@ -720,6 +756,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
|
|||||||
case actorstypes.Version13:
|
case actorstypes.Version13:
|
||||||
return miner13.AddressedSectorsMax, nil
|
return miner13.AddressedSectorsMax, nil
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
return miner14.AddressedSectorsMax, nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported network version")
|
return 0, xerrors.Errorf("unsupported network version")
|
||||||
}
|
}
|
||||||
@ -785,6 +824,10 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
|
|||||||
|
|
||||||
return miner13.DeclarationsMax, nil
|
return miner13.DeclarationsMax, nil
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
|
||||||
|
return miner14.DeclarationsMax, nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported network version")
|
return 0, xerrors.Errorf("unsupported network version")
|
||||||
}
|
}
|
||||||
@ -849,6 +892,10 @@ func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, ba
|
|||||||
|
|
||||||
return miner13.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
return miner13.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
|
||||||
|
return miner14.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return big.Zero(), xerrors.Errorf("unsupported network version")
|
return big.Zero(), xerrors.Errorf("unsupported network version")
|
||||||
}
|
}
|
||||||
@ -913,6 +960,10 @@ func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, base
|
|||||||
|
|
||||||
return miner13.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
return miner13.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
|
case actorstypes.Version14:
|
||||||
|
|
||||||
|
return miner14.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return big.Zero(), xerrors.Errorf("unsupported network version")
|
return big.Zero(), xerrors.Errorf("unsupported network version")
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@ const ({{range .actorVersions}}
|
|||||||
|
|
||||||
/* inline-gen start */
|
/* inline-gen start */
|
||||||
|
|
||||||
var LatestVersion = 13
|
var LatestVersion = 14
|
||||||
|
|
||||||
var Versions = []int{0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}
|
var Versions = []int{0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version0 Version = 0
|
Version0 Version = 0
|
||||||
@ -32,6 +32,7 @@ const (
|
|||||||
Version11 Version = 11
|
Version11 Version = 11
|
||||||
Version12 Version = 12
|
Version12 Version = 12
|
||||||
Version13 Version = 13
|
Version13 Version = 13
|
||||||
|
Version14 Version = 14
|
||||||
)
|
)
|
||||||
|
|
||||||
/* inline-gen end */
|
/* inline-gen end */
|
||||||
|
@ -54,6 +54,7 @@ func NewActorRegistry() *vm.ActorRegistry {
|
|||||||
inv.Register(actorstypes.Version11, vm.ActorsVersionPredicate(actorstypes.Version11), builtin.MakeRegistry(actorstypes.Version11))
|
inv.Register(actorstypes.Version11, vm.ActorsVersionPredicate(actorstypes.Version11), builtin.MakeRegistry(actorstypes.Version11))
|
||||||
inv.Register(actorstypes.Version12, vm.ActorsVersionPredicate(actorstypes.Version12), builtin.MakeRegistry(actorstypes.Version12))
|
inv.Register(actorstypes.Version12, vm.ActorsVersionPredicate(actorstypes.Version12), builtin.MakeRegistry(actorstypes.Version12))
|
||||||
inv.Register(actorstypes.Version13, vm.ActorsVersionPredicate(actorstypes.Version13), builtin.MakeRegistry(actorstypes.Version13))
|
inv.Register(actorstypes.Version13, vm.ActorsVersionPredicate(actorstypes.Version13), builtin.MakeRegistry(actorstypes.Version13))
|
||||||
|
inv.Register(actorstypes.Version14, vm.ActorsVersionPredicate(actorstypes.Version14), builtin.MakeRegistry(actorstypes.Version14))
|
||||||
|
|
||||||
return inv
|
return inv
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
nv21 "github.com/filecoin-project/go-state-types/builtin/v12/migration"
|
nv21 "github.com/filecoin-project/go-state-types/builtin/v12/migration"
|
||||||
system12 "github.com/filecoin-project/go-state-types/builtin/v12/system"
|
system12 "github.com/filecoin-project/go-state-types/builtin/v12/system"
|
||||||
nv22 "github.com/filecoin-project/go-state-types/builtin/v13/migration"
|
nv22 "github.com/filecoin-project/go-state-types/builtin/v13/migration"
|
||||||
|
nv23 "github.com/filecoin-project/go-state-types/builtin/v14/migration"
|
||||||
nv17 "github.com/filecoin-project/go-state-types/builtin/v9/migration"
|
nv17 "github.com/filecoin-project/go-state-types/builtin/v9/migration"
|
||||||
"github.com/filecoin-project/go-state-types/manifest"
|
"github.com/filecoin-project/go-state-types/manifest"
|
||||||
"github.com/filecoin-project/go-state-types/migration"
|
"github.com/filecoin-project/go-state-types/migration"
|
||||||
@ -302,6 +303,17 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule {
|
|||||||
Height: build.UpgradeCalibrationDragonFixHeight,
|
Height: build.UpgradeCalibrationDragonFixHeight,
|
||||||
Network: network.Version22,
|
Network: network.Version22,
|
||||||
Migration: upgradeActorsV13VerifregFix(calibnetv13BuggyVerifregCID1, calibnetv13CorrectManifestCID1),
|
Migration: upgradeActorsV13VerifregFix(calibnetv13BuggyVerifregCID1, calibnetv13CorrectManifestCID1),
|
||||||
|
}, {
|
||||||
|
Height: build.UpgradeAussieHeight,
|
||||||
|
Network: network.Version23,
|
||||||
|
Migration: UpgradeActorsV14,
|
||||||
|
PreMigrations: []stmgr.PreMigration{{
|
||||||
|
PreMigration: PreUpgradeActorsV14,
|
||||||
|
StartWithin: 120,
|
||||||
|
DontStartWithin: 15,
|
||||||
|
StopWithin: 10,
|
||||||
|
}},
|
||||||
|
Expensive: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2468,6 +2480,108 @@ func upgradeActorsV13VerifregFix(oldBuggyVerifregCID, newManifestCID cid.Cid) fu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PreUpgradeActorsV14(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
|
||||||
|
// Use half the CPUs for pre-migration, but leave at least 3.
|
||||||
|
workerCount := MigrationMaxWorkerCount
|
||||||
|
if workerCount <= 4 {
|
||||||
|
workerCount = 1
|
||||||
|
} else {
|
||||||
|
workerCount /= 2
|
||||||
|
}
|
||||||
|
|
||||||
|
lbts, lbRoot, err := stmgr.GetLookbackTipSetForRound(ctx, sm, ts, epoch)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("error getting lookback ts for premigration: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
config := migration.Config{
|
||||||
|
MaxWorkers: uint(workerCount),
|
||||||
|
ProgressLogPeriod: time.Minute * 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = upgradeActorsV14Common(ctx, sm, cache, lbRoot, epoch, lbts, config)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpgradeActorsV14(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor,
|
||||||
|
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
|
||||||
|
// Use all the CPUs except 2.
|
||||||
|
workerCount := MigrationMaxWorkerCount - 3
|
||||||
|
if workerCount <= 0 {
|
||||||
|
workerCount = 1
|
||||||
|
}
|
||||||
|
config := migration.Config{
|
||||||
|
MaxWorkers: uint(workerCount),
|
||||||
|
JobQueueSize: 1000,
|
||||||
|
ResultQueueSize: 100,
|
||||||
|
ProgressLogPeriod: 10 * time.Second,
|
||||||
|
}
|
||||||
|
newRoot, err := upgradeActorsV14Common(ctx, sm, cache, root, epoch, ts, config)
|
||||||
|
if err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("migrating actors v14 state: %w", err)
|
||||||
|
}
|
||||||
|
return newRoot, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func upgradeActorsV14Common(
|
||||||
|
ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache,
|
||||||
|
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet,
|
||||||
|
config migration.Config,
|
||||||
|
) (cid.Cid, error) {
|
||||||
|
writeStore := blockstore.NewAutobatch(ctx, sm.ChainStore().StateBlockstore(), units.GiB/4)
|
||||||
|
adtStore := store.ActorStore(ctx, writeStore)
|
||||||
|
// ensure that the manifest is loaded in the blockstore
|
||||||
|
if err := bundle.LoadBundles(ctx, writeStore, actorstypes.Version14); err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("failed to load manifest bundle: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the state root.
|
||||||
|
var stateRoot types.StateRoot
|
||||||
|
if err := adtStore.Get(ctx, root, &stateRoot); err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("failed to decode state root: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if stateRoot.Version != types.StateTreeVersion5 {
|
||||||
|
return cid.Undef, xerrors.Errorf(
|
||||||
|
"expected state root version 5 for actors v14 upgrade, got %d",
|
||||||
|
stateRoot.Version,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
manifest, ok := actors.GetManifest(actorstypes.Version14)
|
||||||
|
if !ok {
|
||||||
|
return cid.Undef, xerrors.Errorf("no manifest CID for v14 upgrade")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the migration
|
||||||
|
newHamtRoot, err := nv23.MigrateStateTree(ctx, adtStore, manifest, stateRoot.Actors, epoch, config,
|
||||||
|
migrationLogger{}, cache)
|
||||||
|
if err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("upgrading to actors v14: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Persist the result.
|
||||||
|
newRoot, err := adtStore.Put(ctx, &types.StateRoot{
|
||||||
|
Version: types.StateTreeVersion5,
|
||||||
|
Actors: newHamtRoot,
|
||||||
|
Info: stateRoot.Info,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("failed to persist new state root: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Persists the new tree and shuts down the flush worker
|
||||||
|
if err := writeStore.Flush(ctx); err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("writeStore flush failed: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := writeStore.Shutdown(ctx); err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("writeStore shutdown failed: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return newRoot, nil
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
// Example upgrade function if upgrade requires only code changes
|
// Example upgrade function if upgrade requires only code changes
|
||||||
|
@ -156,7 +156,7 @@ func VersionForNetwork(ver network.Version) (types.StateTreeVersion, error) {
|
|||||||
case network.Version13, network.Version14, network.Version15, network.Version16, network.Version17:
|
case network.Version13, network.Version14, network.Version15, network.Version16, network.Version17:
|
||||||
return types.StateTreeVersion4, nil
|
return types.StateTreeVersion4, nil
|
||||||
|
|
||||||
case network.Version18, network.Version19, network.Version20, network.Version21, network.Version22:
|
case network.Version18, network.Version19, network.Version20, network.Version21, network.Version22, network.Version23:
|
||||||
return types.StateTreeVersion5, nil
|
return types.StateTreeVersion5, nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -475,7 +475,7 @@ Inputs:
|
|||||||
],
|
],
|
||||||
"Bw==",
|
"Bw==",
|
||||||
10101,
|
10101,
|
||||||
22
|
23
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -4734,7 +4734,7 @@ Perms: read
|
|||||||
Inputs:
|
Inputs:
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
22
|
23
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -4749,7 +4749,7 @@ Perms: read
|
|||||||
Inputs:
|
Inputs:
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
22
|
23
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -5561,7 +5561,8 @@ Response:
|
|||||||
"UpgradeThunderHeight": 10101,
|
"UpgradeThunderHeight": 10101,
|
||||||
"UpgradeWatermelonHeight": 10101,
|
"UpgradeWatermelonHeight": 10101,
|
||||||
"UpgradeDragonHeight": 10101,
|
"UpgradeDragonHeight": 10101,
|
||||||
"UpgradePhoenixHeight": 10101
|
"UpgradePhoenixHeight": 10101,
|
||||||
|
"UpgradeAussieHeight": 10101
|
||||||
},
|
},
|
||||||
"Eip155ChainID": 123
|
"Eip155ChainID": 123
|
||||||
}
|
}
|
||||||
@ -6485,7 +6486,7 @@ Inputs:
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
Response: `22`
|
Response: `23`
|
||||||
|
|
||||||
### StateReadState
|
### StateReadState
|
||||||
StateReadState returns the indicated actor's state.
|
StateReadState returns the indicated actor's state.
|
||||||
|
@ -6298,7 +6298,7 @@ Perms: read
|
|||||||
Inputs:
|
Inputs:
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
22
|
23
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -6313,7 +6313,7 @@ Perms: read
|
|||||||
Inputs:
|
Inputs:
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
22
|
23
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -7223,7 +7223,8 @@ Response:
|
|||||||
"UpgradeThunderHeight": 10101,
|
"UpgradeThunderHeight": 10101,
|
||||||
"UpgradeWatermelonHeight": 10101,
|
"UpgradeWatermelonHeight": 10101,
|
||||||
"UpgradeDragonHeight": 10101,
|
"UpgradeDragonHeight": 10101,
|
||||||
"UpgradePhoenixHeight": 10101
|
"UpgradePhoenixHeight": 10101,
|
||||||
|
"UpgradeAussieHeight": 10101
|
||||||
},
|
},
|
||||||
"Eip155ChainID": 123
|
"Eip155ChainID": 123
|
||||||
}
|
}
|
||||||
@ -8201,7 +8202,7 @@ Inputs:
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
Response: `22`
|
Response: `23`
|
||||||
|
|
||||||
### StateReadState
|
### StateReadState
|
||||||
StateReadState returns the indicated actor's state.
|
StateReadState returns the indicated actor's state.
|
||||||
|
2
extern/filecoin-ffi
vendored
2
extern/filecoin-ffi
vendored
@ -1 +1 @@
|
|||||||
Subproject commit ed08caaf8778e1b6def83efd37fce41574214353
|
Subproject commit 081367cae7cdfe87d8b7240a9c3767ce86a40b05
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"actorVersions": [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
"actorVersions": [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
|
||||||
"latestActorsVersion": 13,
|
"latestActorsVersion": 14,
|
||||||
|
|
||||||
"networkVersions": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22],
|
"networkVersions": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
||||||
"latestNetworkVersion": 22
|
"latestNetworkVersion": 23
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -49,7 +49,7 @@ require (
|
|||||||
github.com/filecoin-project/go-jsonrpc v0.3.1
|
github.com/filecoin-project/go-jsonrpc v0.3.1
|
||||||
github.com/filecoin-project/go-padreader v0.0.1
|
github.com/filecoin-project/go-padreader v0.0.1
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.4
|
github.com/filecoin-project/go-paramfetch v0.0.4
|
||||||
github.com/filecoin-project/go-state-types v0.13.3
|
github.com/filecoin-project/go-state-types v0.14.0-dev
|
||||||
github.com/filecoin-project/go-statemachine v1.0.3
|
github.com/filecoin-project/go-statemachine v1.0.3
|
||||||
github.com/filecoin-project/go-statestore v0.2.0
|
github.com/filecoin-project/go-statestore v0.2.0
|
||||||
github.com/filecoin-project/go-storedcounter v0.1.0
|
github.com/filecoin-project/go-storedcounter v0.1.0
|
||||||
|
4
go.sum
4
go.sum
@ -356,8 +356,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS
|
|||||||
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||||
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||||
github.com/filecoin-project/go-state-types v0.13.1/go.mod h1:cHpOPup9H1g2T29dKHAjC2sc7/Ef5ypjuW9A3I+e9yY=
|
github.com/filecoin-project/go-state-types v0.13.1/go.mod h1:cHpOPup9H1g2T29dKHAjC2sc7/Ef5ypjuW9A3I+e9yY=
|
||||||
github.com/filecoin-project/go-state-types v0.13.3 h1:9JPkC0E6HDtfHbaOIrFiCDzT/Z0jRTb9En4Y4Ci/b3w=
|
github.com/filecoin-project/go-state-types v0.14.0-dev h1:bDwq1S28D7EC/uDmKU8vvNcdFw/YDsNq09pe3zeV5h4=
|
||||||
github.com/filecoin-project/go-state-types v0.13.3/go.mod h1:cHpOPup9H1g2T29dKHAjC2sc7/Ef5ypjuW9A3I+e9yY=
|
github.com/filecoin-project/go-state-types v0.14.0-dev/go.mod h1:cHpOPup9H1g2T29dKHAjC2sc7/Ef5ypjuW9A3I+e9yY=
|
||||||
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
||||||
github.com/filecoin-project/go-statemachine v1.0.3 h1:N07o6alys+V1tNoSTi4WuuoeNC4erS/6jE74+NsgQuk=
|
github.com/filecoin-project/go-statemachine v1.0.3 h1:N07o6alys+V1tNoSTi4WuuoeNC4erS/6jE74+NsgQuk=
|
||||||
github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
||||||
|
@ -35,12 +35,12 @@ func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt {
|
|||||||
})
|
})
|
||||||
/* inline-gen start */
|
/* inline-gen start */
|
||||||
return UpgradeSchedule(stmgr.Upgrade{
|
return UpgradeSchedule(stmgr.Upgrade{
|
||||||
Network: network.Version21,
|
Network: network.Version22,
|
||||||
Height: -1,
|
Height: -1,
|
||||||
}, stmgr.Upgrade{
|
}, stmgr.Upgrade{
|
||||||
Network: network.Version22,
|
Network: network.Version23,
|
||||||
Height: upgradeHeight,
|
Height: upgradeHeight,
|
||||||
Migration: filcns.UpgradeActorsV13,
|
Migration: filcns.UpgradeActorsV14,
|
||||||
})
|
})
|
||||||
/* inline-gen end */
|
/* inline-gen end */
|
||||||
}
|
}
|
||||||
|
@ -1963,6 +1963,7 @@ func (a *StateAPI) StateGetNetworkParams(ctx context.Context) (*api.NetworkParam
|
|||||||
UpgradeWatermelonHeight: build.UpgradeWatermelonHeight,
|
UpgradeWatermelonHeight: build.UpgradeWatermelonHeight,
|
||||||
UpgradeDragonHeight: build.UpgradeDragonHeight,
|
UpgradeDragonHeight: build.UpgradeDragonHeight,
|
||||||
UpgradePhoenixHeight: build.UpgradePhoenixHeight,
|
UpgradePhoenixHeight: build.UpgradePhoenixHeight,
|
||||||
|
UpgradeAussieHeight: build.UpgradeAussieHeight,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user