diff --git a/api/types.go b/api/types.go index 1a092208967..647e4048f6c 100644 --- a/api/types.go +++ b/api/types.go @@ -193,6 +193,7 @@ type ForkUpgradeParams struct { UpgradePhoenixHeight abi.ChainEpoch UpgradeWaffleHeight abi.ChainEpoch UpgradeTuktukHeight abi.ChainEpoch + UpgradeXxHeight abi.ChainEpoch } // ChainExportConfig holds configuration for chain ranged exports. diff --git a/build/actors/v16.tar.zst b/build/actors/v16.tar.zst new file mode 100644 index 00000000000..d33f536fd85 Binary files /dev/null and b/build/actors/v16.tar.zst differ diff --git a/build/buildconstants/params.go b/build/buildconstants/params.go index 37e4b30f219..2216261cefa 100644 --- a/build/buildconstants/params.go +++ b/build/buildconstants/params.go @@ -42,6 +42,6 @@ var Devnet = true /* inline-gen template const TestNetworkVersion = network.Version{{.latestNetworkVersion}} /* inline-gen start */ -const TestNetworkVersion = network.Version24 +const TestNetworkVersion = network.Version25 /* inline-gen end */ diff --git a/build/buildconstants/params_2k.go b/build/buildconstants/params_2k.go index 7925ce48ff7..b4d975a1de9 100644 --- a/build/buildconstants/params_2k.go +++ b/build/buildconstants/params_2k.go @@ -21,7 +21,7 @@ const GenesisFile = "" var NetworkBundle = "devnet" var ActorDebugging = true -var GenesisNetworkVersion = network.Version23 +var GenesisNetworkVersion = network.Version24 var UpgradeBreezeHeight = abi.ChainEpoch(-1) @@ -71,7 +71,9 @@ var UpgradePhoenixHeight = abi.ChainEpoch(-25) var UpgradeWaffleHeight = abi.ChainEpoch(-26) -var UpgradeTuktukHeight = abi.ChainEpoch(200) +var UpgradeTuktukHeight = abi.ChainEpoch(-27) + +var UpgradeXxHeight = abi.ChainEpoch(200) // FIP-0081: for the power actor state for pledge calculations. // UpgradeTuktukPowerRampDurationEpochs ends up in the power actor state after @@ -167,6 +169,7 @@ func init() { UpgradeWaffleHeight = getUpgradeHeight("LOTUS_WAFFLE_HEIGHT", UpgradeWaffleHeight) UpgradePhoenixHeight = getUpgradeHeight("LOTUS_PHOENIX_HEIGHT", UpgradePhoenixHeight) UpgradeTuktukHeight = getUpgradeHeight("LOTUS_TUKTUK_HEIGHT", UpgradeTuktukHeight) + UpgradeXxHeight = getUpgradeHeight("LOTUS_XX_HEIGHT", UpgradeXxHeight) DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandQuicknet, diff --git a/build/buildconstants/params_butterfly.go b/build/buildconstants/params_butterfly.go index fc84e326240..98b4048a8d5 100644 --- a/build/buildconstants/params_butterfly.go +++ b/build/buildconstants/params_butterfly.go @@ -56,9 +56,10 @@ const UpgradeWatermelonHeight = -24 const UpgradeDragonHeight = -25 const UpgradePhoenixHeight = -26 const UpgradeWaffleHeight = -27 +const UpgradeTuktukHeight = -28 // ?????? -const UpgradeTuktukHeight = 999999999999999 +const UpgradeXxHeight = 999999999999999 // FIP-0081: for the power actor state for pledge calculations. // UpgradeTuktukPowerRampDurationEpochs ends up in the power actor state after diff --git a/build/buildconstants/params_calibnet.go b/build/buildconstants/params_calibnet.go index 46c672dc510..0e99b5a8e83 100644 --- a/build/buildconstants/params_calibnet.go +++ b/build/buildconstants/params_calibnet.go @@ -102,6 +102,9 @@ const UpgradeWaffleHeight = 1779094 // 2024-10-23T13:30:00Z const UpgradeTuktukHeight = 2078794 +// ?????? +const UpgradeXxHeight = 999999999999999 + // FIP-0081: for the power actor state for pledge calculations. // UpgradeTuktukPowerRampDurationEpochs ends up in the power actor state after // Tuktuk migration. along with a RampStartEpoch matching the upgrade height. diff --git a/build/buildconstants/params_interop.go b/build/buildconstants/params_interop.go index 05dd3d49289..e992213c3d8 100644 --- a/build/buildconstants/params_interop.go +++ b/build/buildconstants/params_interop.go @@ -55,8 +55,9 @@ var UpgradeWatermelonHeight = abi.ChainEpoch(-24) var UpgradeDragonHeight = abi.ChainEpoch(-25) var UpgradePhoenixHeight = abi.ChainEpoch(-26) var UpgradeWaffleHeight = abi.ChainEpoch(-27) +var UpgradeTuktukHeight = abi.ChainEpoch(-28) -const UpgradeTuktukHeight = 50 +const UpgradeXxHeight = 50 // FIP-0081: for the power actor state for pledge calculations. // UpgradeTuktukPowerRampDurationEpochs ends up in the power actor state after diff --git a/build/buildconstants/params_mainnet.go b/build/buildconstants/params_mainnet.go index c38f43132f3..941d100d597 100644 --- a/build/buildconstants/params_mainnet.go +++ b/build/buildconstants/params_mainnet.go @@ -110,7 +110,11 @@ const UpgradePhoenixHeight abi.ChainEpoch = UpgradeDragonHeight + 120 const UpgradeWaffleHeight abi.ChainEpoch = 4154640 // 2024-11-20T23:00:00Z -var UpgradeTuktukHeight = abi.ChainEpoch(4461240) +// var because of TestMigrationNV24 in itests/migration_test.go to test the FIP-0081 pledge ramp +var UpgradeTuktukHeight abi.ChainEpoch = 4461240 + +// ?????? +var UpgradeXxHeight = abi.ChainEpoch(9999999999) // FIP-0081: for the power actor state for pledge calculations. // UpgradeTuktukPowerRampDurationEpochs ends up in the power actor state after @@ -145,8 +149,8 @@ func init() { } SetAddressNetwork(addrNetwork) - if os.Getenv("LOTUS_DISABLE_TUKTUK") == "1" { - UpgradeTuktukHeight = math.MaxInt64 - 1 + if os.Getenv("LOTUS_DISABLE_XX") == "1" { + UpgradeXxHeight = math.MaxInt64 - 1 } // NOTE: DO NOT change this unless you REALLY know what you're doing. This is not consensus critical, however, diff --git a/build/buildconstants/params_testground.go b/build/buildconstants/params_testground.go index 98ad2b482a6..7ab7599ff4c 100644 --- a/build/buildconstants/params_testground.go +++ b/build/buildconstants/params_testground.go @@ -107,6 +107,7 @@ var ( UpgradeCalibrationDragonFixHeight abi.ChainEpoch = -28 UpgradeWaffleHeight abi.ChainEpoch = -29 UpgradeTuktukHeight abi.ChainEpoch = -30 + UpgradeXxHeight abi.ChainEpoch = -31 UpgradeTuktukPowerRampDurationEpochs uint64 = 0 diff --git a/build/builtin_actors_gen.go b/build/builtin_actors_gen.go index 0d6da2e28ee..58b8e16679a 100644 --- a/build/builtin_actors_gen.go +++ b/build/builtin_actors_gen.go @@ -163,9 +163,32 @@ var EmbeddedBuiltinActorsMetadata = []*BuiltinActorsMetadata{{ "system": cid.MustParse("bafk2bzacebbrs3dzgxwj43ztup7twz25xkbhhtmcbjjbscjvpsrpbwux3b32g"), "verifiedregistry": cid.MustParse("bafk2bzacebj3znhdpxqjgvztrv3petqwdkvrefg4j6lrp3n7wfrkdoan4os42"), }, +}, { + Network: "butterflynet", + Version: 15, + + ManifestCid: cid.MustParse("bafy2bzacearjal5rsmzloz3ny7aoju2rgw66wgxdrydgg27thcsazbmf5qihq"), + Actors: map[string]cid.Cid{ + "account": cid.MustParse("bafk2bzaceapjxl4kobnxn267u42nh2feouubkxcm62vzrk2nrfkqmtz6rgfw4"), + "cron": cid.MustParse("bafk2bzacediarrpbvwmkch4axjzxlu7lvpjmee5og7q2dxfqu4kkir2p2qusy"), + "datacap": cid.MustParse("bafk2bzaceb4lpszr3axumf6f5ane5tlyj76zimptvt3lx7zpu5lx57zmua4dw"), + "eam": cid.MustParse("bafk2bzaceaxjorcph7nmcgfgyv225s5y44xpswtp4b5744dm7kfxiztgf4ti4"), + "ethaccount": cid.MustParse("bafk2bzacebz3y3vjqrfk2x2koj733cblhyjqajldc7dfiu7jud6g64b4bzqqc"), + "evm": cid.MustParse("bafk2bzacedj7idaxudsiwwvmgluhzvzzvcr7u2r2cfymagjq7amegxfs3oyim"), + "init": cid.MustParse("bafk2bzacedtpna72vpmt6yyqx5lxersccnmv2aq2odfp2f5v7o2cvl6zxgrtg"), + "multisig": cid.MustParse("bafk2bzacebz3uwa4g5tyg5zb6nad24gnqwlplrlvakdwlytznqfqrnulpg7gm"), + "paymentchannel": cid.MustParse("bafk2bzaceatyws2kngfwau6o7c74cl2ogcdm4aopdaozu7r76ymtvrhuk3a4k"), + "placeholder": cid.MustParse("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"), + "reward": cid.MustParse("bafk2bzacecxt3jqyiyrqhbdr4eavgkmoijkoundxap7rdbw3g6j62t2hak23u"), + "storagemarket": cid.MustParse("bafk2bzacecbx6yzird3wp3lkyroqizp3g5lsysh5qijstfwe4sjngbpo3lx3q"), + "storageminer": cid.MustParse("bafk2bzaceb2jyz6tx5gdmu66smksb544wrhqwgub45tq3qltc3wiv64zsbqoa"), + "storagepower": cid.MustParse("bafk2bzacebdwg62s5fwmctrtsoz77qx3qk3hj5eu45aiamryphhcak65od4xe"), + "system": cid.MustParse("bafk2bzacebf6qpnaem4d3kku74hyizal7rfqmxvngvnerq3gxmyqvnib4ho22"), + "verifiedregistry": cid.MustParse("bafk2bzacebxppwtgpstn55klmiux64pwekibcapv6v26nbfrrateth5zzsdic"), + }, }, { Network: "butterflynet", - Version: 15, + Version: 16, BundleGitTag: "v15.0.0", ManifestCid: cid.MustParse("bafy2bzacearjal5rsmzloz3ny7aoju2rgw66wgxdrydgg27thcsazbmf5qihq"), Actors: map[string]cid.Cid{ @@ -338,9 +361,32 @@ var EmbeddedBuiltinActorsMetadata = []*BuiltinActorsMetadata{{ "system": cid.MustParse("bafk2bzacederl6tlpieldsn6mkndqwd4wj5orfoqgab6p2klswfn3cjagxwla"), "verifiedregistry": cid.MustParse("bafk2bzaceczw2kp6gjjdcjbso7mewp7guik7gr525pal6dotdja2lrct6ok3c"), }, +}, { + Network: "calibrationnet", + Version: 15, + + ManifestCid: cid.MustParse("bafy2bzaceax5zkysst7vtyup4whdxwzlpnaya3qp34rnoi6gyt4pongps7obw"), + Actors: map[string]cid.Cid{ + "account": cid.MustParse("bafk2bzacecwdkoknhok52hlddoetdkqfwohhv4bx6csu3x6o7aduryv5ufssu"), + "cron": cid.MustParse("bafk2bzacebjbuz7fjjsmt6zsuk724ief7yhkzm3b4ghgtasbe2zr4rrwr2qaw"), + "datacap": cid.MustParse("bafk2bzacebxssfq5qpdahcvypgxk3o34npc7br5vd6dwe3zdelpql5hil7auq"), + "eam": cid.MustParse("bafk2bzacebfllr37yrgvczflbncokmsoqzp5tpf3v4jhfcwz5x5bsieqvmf4c"), + "ethaccount": cid.MustParse("bafk2bzacec6onad6awpg54l6d6dubjsncwauxrzrjq5lbxzpyzs5hthepwvmm"), + "evm": cid.MustParse("bafk2bzaceabq3zagn4ee2wbagarxf7xgbrqgqgm55xydanxik2bifztqgynts"), + "init": cid.MustParse("bafk2bzacedg7uw4z5gdzdlfzalc6xlmbqduawuk6gzrijtln35yas5yagn7s2"), + "multisig": cid.MustParse("bafk2bzacean3scmnmvgvyxv44d775ssfwcwghyubqv4dul3ohkvlv3cm2bwui"), + "paymentchannel": cid.MustParse("bafk2bzaceb3o3ayjxoi5dc3e6ysuyqtcwbas5cvl3mxhxn57ieackjah5dhe6"), + "placeholder": cid.MustParse("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"), + "reward": cid.MustParse("bafk2bzacedcnokx43cbvma4kish3ujmgn7ku2epgfpcv73pzliqlquswu2ukw"), + "storagemarket": cid.MustParse("bafk2bzacedifpoan54pgc3bpzpefdlvyigieyjyueiptv4keaeg7fspjjxe62"), + "storageminer": cid.MustParse("bafk2bzacecal5j3xng2dlrx3vlieyzni4rvqpvjngxgpai5oarhcrb4wtaaf2"), + "storagepower": cid.MustParse("bafk2bzaceclefusmffhuuvtggrmadr3cwpwsgphtlj2wb222ztwwv5mssu5ea"), + "system": cid.MustParse("bafk2bzacecybufhea4ah2vwtp4pqxotdfk2lnrgu6cw63jstysjzzcegio4ps"), + "verifiedregistry": cid.MustParse("bafk2bzacedbvfxhxsdktslf2rto5kyiumvppoen2avbmpgh7ijsmkxjyua3s4"), + }, }, { Network: "calibrationnet", - Version: 15, + Version: 16, BundleGitTag: "v15.0.0", ManifestCid: cid.MustParse("bafy2bzaceax5zkysst7vtyup4whdxwzlpnaya3qp34rnoi6gyt4pongps7obw"), Actors: map[string]cid.Cid{ @@ -522,9 +568,32 @@ var EmbeddedBuiltinActorsMetadata = []*BuiltinActorsMetadata{{ "system": cid.MustParse("bafk2bzacea75k6agtdmjxdfnwbctzstc6pozdblpdevc5ixjevvuzcqwwuzrc"), "verifiedregistry": cid.MustParse("bafk2bzacedxwgmgffeapq4nffplapb5mixkrm2vosmc2i3fxcye5dookiqubu"), }, +}, { + Network: "caterpillarnet", + Version: 15, + + ManifestCid: cid.MustParse("bafy2bzaceaw24gctg3dx6pzrymhggsp32c7mofjscwnylk4pzsqmilolygwhi"), + Actors: map[string]cid.Cid{ + "account": cid.MustParse("bafk2bzacecmm4ymqjjbonet2yxe7l4jqg3uphcxmiz6vwyza4d4tfiy7hu3j4"), + "cron": cid.MustParse("bafk2bzaceavxtvwpeakmnjfzfrkoeaxj7olniuucih7ktkd2q5kuuetqaz3ra"), + "datacap": cid.MustParse("bafk2bzacebwhd6ojy3v6yqmdg5yxegv5fwydrkorzps2wbfyvhnyse4xgz27u"), + "eam": cid.MustParse("bafk2bzaceankzhowyxqpcqmmqwv53uy37hvpzgpe6npbi4kkcxfuryzfeykeg"), + "ethaccount": cid.MustParse("bafk2bzaceai5kycpmi6eogph6qnpojtwpn3fxzou7nbdqbooud5ql2ru3zhvk"), + "evm": cid.MustParse("bafk2bzacecqefgqxphgqar6tfroj7bfvbnwtbbqeypmkwlis5s2aycgu7cf3q"), + "init": cid.MustParse("bafk2bzacedn364np7lgbuzxirktflnkhtt2aipj6u2m66lmhrpxmrsqtbre5o"), + "multisig": cid.MustParse("bafk2bzacebhqbrqli6udo5bclkuj5gpaiedzuqisuvzpzdkfalh5lsvxiyqba"), + "paymentchannel": cid.MustParse("bafk2bzaceancwwau6oyvwstcigo5l6nytm5q35z5jndy5pmekhpjcmmou3lzs"), + "placeholder": cid.MustParse("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"), + "reward": cid.MustParse("bafk2bzacebomw2znawgbr5bf36i43vziblgk2fv5e5wro6xtj62gqfjnk7sg2"), + "storagemarket": cid.MustParse("bafk2bzacecz47tblw4pnzpskivaeyazlvbarfh5wifjl7eyckijmjdwi5wqxq"), + "storageminer": cid.MustParse("bafk2bzacecb5d2x4dmgqch3fakw54hzzrqg3z7qslb7b6yvoxn5ljftwne7qo"), + "storagepower": cid.MustParse("bafk2bzacebz5j6alycdjtqrlsdsjmxdzoictvry43eihon7e5gtlxpq3dwv76"), + "system": cid.MustParse("bafk2bzacecwyleco2r5bjjxdj3dp26bluua3f3u4mta4wmrrslfxscb2kz37o"), + "verifiedregistry": cid.MustParse("bafk2bzacec4i7zpu6ca5zqcxsowiqqofqix7z5gh3k27mndpnm3wujbzuf2bk"), + }, }, { Network: "caterpillarnet", - Version: 15, + Version: 16, BundleGitTag: "v15.0.0", ManifestCid: cid.MustParse("bafy2bzaceaw24gctg3dx6pzrymhggsp32c7mofjscwnylk4pzsqmilolygwhi"), Actors: map[string]cid.Cid{ @@ -697,9 +766,32 @@ var EmbeddedBuiltinActorsMetadata = []*BuiltinActorsMetadata{{ "system": cid.MustParse("bafk2bzacea4rh5i36ucj23zb4mid4tw5ym2wqlfap4ejjaynvobengeuby4ja"), "verifiedregistry": cid.MustParse("bafk2bzaceapbsihfuk3munfpcoevtxlwuenxeiiv7dp7v3t2yjs26hcpypexi"), }, +}, { + Network: "devnet", + Version: 15, + + ManifestCid: cid.MustParse("bafy2bzacedlusqjwf7chvl2ve2fum5noyqrtjzcrzkhpbzpkg7puiru7dj4ug"), + Actors: map[string]cid.Cid{ + "account": cid.MustParse("bafk2bzaceb7f7gjyz2fkzkbf6jlwttjinny4nci4zdoby7r246xuyc4e2n7me"), + "cron": cid.MustParse("bafk2bzaceat32zil3qjywp7bfq4hbew3i6eiadcwjx54sqydw27an5wwzmkri"), + "datacap": cid.MustParse("bafk2bzacechbefgwgnajqk3urksgiqw4kro7pankoaidajjobbryitzuhevrm"), + "eam": cid.MustParse("bafk2bzaceb4koufzo3rkf7kw4l5zrahfdougmve6jgp72zp3wsvahhfxsmlmg"), + "ethaccount": cid.MustParse("bafk2bzacebdovyvmzzssiaqkwl5kw65d72ki3am7p3uic6pzvude76cye5um6"), + "evm": cid.MustParse("bafk2bzacebmv2k57q5atsj6jdpkyoa2wmap7hj3jmkuzwlycly44cudyfnwyu"), + "init": cid.MustParse("bafk2bzaceaalaquld7f5qryyf2expe7hx7ooeyanybbwehleu2fdzraubknmu"), + "multisig": cid.MustParse("bafk2bzacedzegnrtnjrei34cgzv73wgobtverwwkllhvfxpjovqfxs3mtbnpa"), + "paymentchannel": cid.MustParse("bafk2bzacedxdsrba55q4isy3mge3hr3l7to6um5wcrmxficstvwpepwfufkda"), + "placeholder": cid.MustParse("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"), + "reward": cid.MustParse("bafk2bzacebkzpb37wi7jwxtfnvoa2cpiebyrkq6plcpbzwjyvx7nzambptarq"), + "storagemarket": cid.MustParse("bafk2bzacea7xxmmjcxl3vnfqrnbiv7rkq2tgorrsfbdkzcoqxkhmjtslsy5r6"), + "storageminer": cid.MustParse("bafk2bzacedlej4t4igjn7nxudsvpvmijcd4oiwngbizcb4jytm7wyzfvgqfzy"), + "storagepower": cid.MustParse("bafk2bzacec5auarmk46n2nourfxn34f75xnny63xe7kznnx6vqphawytnl6xs"), + "system": cid.MustParse("bafk2bzacebkim7xhbjjuwyqmegclkftnfoz74735yreqdcwr2i6z2kbv767ae"), + "verifiedregistry": cid.MustParse("bafk2bzacedd6hquizdv65nai6h5f2lfhkxgkrofn2zcrrwqi5cmbo2wotx6vm"), + }, }, { Network: "devnet", - Version: 15, + Version: 16, BundleGitTag: "v15.0.0", ManifestCid: cid.MustParse("bafy2bzacedlusqjwf7chvl2ve2fum5noyqrtjzcrzkhpbzpkg7puiru7dj4ug"), Actors: map[string]cid.Cid{ @@ -895,9 +987,32 @@ var EmbeddedBuiltinActorsMetadata = []*BuiltinActorsMetadata{{ "system": cid.MustParse("bafk2bzacecak4ow7tmauku42s3u2yydonk4hx6ov6ov542hy7lcbji3nhrrhs"), "verifiedregistry": cid.MustParse("bafk2bzacebvyzjzmvmjvpypphqsumpy6rzxuugnehgum7grc6sv3yqxzrshb4"), }, +}, { + Network: "mainnet", + Version: 15, + + ManifestCid: cid.MustParse("bafy2bzaceakwje2hyinucrhgtsfo44p54iw4g6otbv5ghov65vajhxgntr53u"), + Actors: map[string]cid.Cid{ + "account": cid.MustParse("bafk2bzacecia5zacqt4gvd4z7275lnkhgraq75shy63cphakphhw6crf4joii"), + "cron": cid.MustParse("bafk2bzacecbyx7utt3tkvhqnfk64kgtlt5jlvv56o2liwczikgzfowk2cvqvk"), + "datacap": cid.MustParse("bafk2bzacecrypcpyzidphfl3sf3vhrjbiwzu7w3hoole45wsk2bqpverw4tni"), + "eam": cid.MustParse("bafk2bzacebybq7keb45l6isqfaiwxy5oi5wlpknhggjheut7q6xwp7mbxxku4"), + "ethaccount": cid.MustParse("bafk2bzaceajdy72edg3t2zcb6qwv2wgdsysfwdtczcklxcp4hlwh7pkxekja4"), + "evm": cid.MustParse("bafk2bzaceandffodu45eyro7jr7bizxw7ibipaiskt36xbp4vpvsxtrpkyjfm"), + "init": cid.MustParse("bafk2bzaceb5mjmy56ediswt2hvwqdfs2xzi4qw3cefkufoat57yyt3iwkg7kw"), + "multisig": cid.MustParse("bafk2bzaced3csl3buj7chpunsubrhwhchtskx674fpukfen4u6pbpkcheueya"), + "paymentchannel": cid.MustParse("bafk2bzacea3dpsfxw7cnj6zljmjnnaubp43a5kvuausigztmukektesg2flei"), + "placeholder": cid.MustParse("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"), + "reward": cid.MustParse("bafk2bzaceapkgue3gcxmwx7bvypn33okppa2nwpelcfp7oyo5yln3brixpjpm"), + "storagemarket": cid.MustParse("bafk2bzaceaqrnikbxymygwhwa2rsvhnqj5kfch75pn5xawnx243brqlfglsl6"), + "storageminer": cid.MustParse("bafk2bzacecnl2hqe3nozwo7al7kdznqgdrv2hbbbmpcbcwzh3yl4trog433hc"), + "storagepower": cid.MustParse("bafk2bzacecb3tvvppxmktll3xehjc7mqbfilt6bd4gragbdwxn77hm5frkuac"), + "system": cid.MustParse("bafk2bzacecvcqje6kcfqeayj66hezlwzfznytwqkxgw7p64xac5f5lcwjpbwe"), + "verifiedregistry": cid.MustParse("bafk2bzacecudaqwbz6dukmdbfok7xuxcpjqighnizhxun4spdqvnqgftkupp2"), + }, }, { Network: "mainnet", - Version: 15, + Version: 16, BundleGitTag: "v15.0.0", ManifestCid: cid.MustParse("bafy2bzaceakwje2hyinucrhgtsfo44p54iw4g6otbv5ghov65vajhxgntr53u"), Actors: map[string]cid.Cid{ @@ -1070,9 +1185,32 @@ var EmbeddedBuiltinActorsMetadata = []*BuiltinActorsMetadata{{ "system": cid.MustParse("bafk2bzacechwe3ehay6h7x7tecaajgsxrvvmzcdul6omejfvzf4mpbzkuryhm"), "verifiedregistry": cid.MustParse("bafk2bzacec66mmy7sj6qy5urqplwhbem7wbjrzna7mxh6qbdljdawhu3g5rao"), }, +}, { + Network: "testing", + Version: 15, + + ManifestCid: cid.MustParse("bafy2bzacedio6qbcgxduz3y2zksor5dgyt3ieiugnugvsz6k2jdzwvugwahag"), + Actors: map[string]cid.Cid{ + "account": cid.MustParse("bafk2bzaceabav73gljoyhtozycl5dqwomg4vviuy2jimte545yx3vgg3vfnyo"), + "cron": cid.MustParse("bafk2bzacedsbgvf64up7gqlhh5bdvxgvnqvsbppp33assv5osluz46oqafibc"), + "datacap": cid.MustParse("bafk2bzacea2ubiaxayu3tg7xpefj3ndbsfgqn5dnyvlwya2yik7kh6twx74ri"), + "eam": cid.MustParse("bafk2bzacedykh5puyw66joxeuvobde36bfdiktutxve634b2tc2d2ydfj4fje"), + "ethaccount": cid.MustParse("bafk2bzacecdgnwjqc3i2y6goz6d4a6auaxinkwub4eh7aqyntaazitisjhkka"), + "evm": cid.MustParse("bafk2bzacecjfoi4jv5h3l5bnd2ewasawqiagahew5wz2377o6t5l2ahm6t4dm"), + "init": cid.MustParse("bafk2bzaceau2csdeu3zaqnupnb6d3lor5e6laatvbdslyi3zsexoylpfruh6s"), + "multisig": cid.MustParse("bafk2bzacedfkajtsx2i5pzesm7dgvzgeqpgrhlnplz4v2hxzczranmj6ujb4y"), + "paymentchannel": cid.MustParse("bafk2bzaceagcnvbzecwryztsgnclpywakvsunzoxkwd5b7bgtgwe5k6dppqju"), + "placeholder": cid.MustParse("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"), + "reward": cid.MustParse("bafk2bzacedxwzuvtooihiaq43ibfngg767zibxeygn67gjouwh6pkiat22igi"), + "storagemarket": cid.MustParse("bafk2bzacecwnqpoxhhbu6ntiha3yz7x5apyceagbcu7v2togmrbsovajbg7my"), + "storageminer": cid.MustParse("bafk2bzacednp3ii6leamsir5sh44spg3rlz7wo5sqocrlmgmh2poa5wm4d2bk"), + "storagepower": cid.MustParse("bafk2bzacebigfazstagtjbx6ixzxzns3lza6mnrsw4lvhetej7b6dygiwsvxo"), + "system": cid.MustParse("bafk2bzaceb7zn7sblfs3jterbvzm2cnp4g3ys5yfd3vhatkascrjsidyw74sq"), + "verifiedregistry": cid.MustParse("bafk2bzaceafcnglgibjq5c26bzoyndzu77g6wdr7s3nnr3wjwhhtvfy7pb5dw"), + }, }, { Network: "testing", - Version: 15, + Version: 16, BundleGitTag: "v15.0.0", ManifestCid: cid.MustParse("bafy2bzacedio6qbcgxduz3y2zksor5dgyt3ieiugnugvsz6k2jdzwvugwahag"), Actors: map[string]cid.Cid{ @@ -1245,9 +1383,32 @@ var EmbeddedBuiltinActorsMetadata = []*BuiltinActorsMetadata{{ "system": cid.MustParse("bafk2bzacechwe3ehay6h7x7tecaajgsxrvvmzcdul6omejfvzf4mpbzkuryhm"), "verifiedregistry": cid.MustParse("bafk2bzacec66mmy7sj6qy5urqplwhbem7wbjrzna7mxh6qbdljdawhu3g5rao"), }, +}, { + Network: "testing-fake-proofs", + Version: 15, + + ManifestCid: cid.MustParse("bafy2bzacea3jtzs4jz75ht3ncdyvabef4spz7w375ja7spp36yy3zwp5ji2wi"), + Actors: map[string]cid.Cid{ + "account": cid.MustParse("bafk2bzaceabav73gljoyhtozycl5dqwomg4vviuy2jimte545yx3vgg3vfnyo"), + "cron": cid.MustParse("bafk2bzacedsbgvf64up7gqlhh5bdvxgvnqvsbppp33assv5osluz46oqafibc"), + "datacap": cid.MustParse("bafk2bzacea2ubiaxayu3tg7xpefj3ndbsfgqn5dnyvlwya2yik7kh6twx74ri"), + "eam": cid.MustParse("bafk2bzacedykh5puyw66joxeuvobde36bfdiktutxve634b2tc2d2ydfj4fje"), + "ethaccount": cid.MustParse("bafk2bzacecdgnwjqc3i2y6goz6d4a6auaxinkwub4eh7aqyntaazitisjhkka"), + "evm": cid.MustParse("bafk2bzacecjfoi4jv5h3l5bnd2ewasawqiagahew5wz2377o6t5l2ahm6t4dm"), + "init": cid.MustParse("bafk2bzaceau2csdeu3zaqnupnb6d3lor5e6laatvbdslyi3zsexoylpfruh6s"), + "multisig": cid.MustParse("bafk2bzaceclv7t7qu5pu4kwkkkxqknbpdtuaa57cdgoxaci6vfjfxpzbwb4h4"), + "paymentchannel": cid.MustParse("bafk2bzaceagcnvbzecwryztsgnclpywakvsunzoxkwd5b7bgtgwe5k6dppqju"), + "placeholder": cid.MustParse("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"), + "reward": cid.MustParse("bafk2bzacedxwzuvtooihiaq43ibfngg767zibxeygn67gjouwh6pkiat22igi"), + "storagemarket": cid.MustParse("bafk2bzacecwnqpoxhhbu6ntiha3yz7x5apyceagbcu7v2togmrbsovajbg7my"), + "storageminer": cid.MustParse("bafk2bzacecf3u77js4taapxfwasgwldq4auzrvxgasdqvf5afqgatfgdcvvhc"), + "storagepower": cid.MustParse("bafk2bzacebigfazstagtjbx6ixzxzns3lza6mnrsw4lvhetej7b6dygiwsvxo"), + "system": cid.MustParse("bafk2bzaceb7zn7sblfs3jterbvzm2cnp4g3ys5yfd3vhatkascrjsidyw74sq"), + "verifiedregistry": cid.MustParse("bafk2bzaceafcnglgibjq5c26bzoyndzu77g6wdr7s3nnr3wjwhhtvfy7pb5dw"), + }, }, { Network: "testing-fake-proofs", - Version: 15, + Version: 16, BundleGitTag: "v15.0.0", ManifestCid: cid.MustParse("bafy2bzacea3jtzs4jz75ht3ncdyvabef4spz7w375ja7spp36yy3zwp5ji2wi"), Actors: map[string]cid.Cid{ diff --git a/build/openrpc/full.json b/build/openrpc/full.json index d94a8f031b5..71bea9c4d08 100644 --- a/build/openrpc/full.json +++ b/build/openrpc/full.json @@ -17089,7 +17089,7 @@ "title": "number", "description": "Number is a number", "examples": [ - 24 + 25 ], "type": [ "number" @@ -17141,7 +17141,7 @@ "title": "number", "description": "Number is a number", "examples": [ - 24 + 25 ], "type": [ "number" @@ -19914,7 +19914,8 @@ "UpgradeDragonHeight": 10101, "UpgradePhoenixHeight": 10101, "UpgradeWaffleHeight": 10101, - "UpgradeTuktukHeight": 10101 + "UpgradeTuktukHeight": 10101, + "UpgradeXxHeight": 10101 }, "Eip155ChainID": 123 } @@ -20051,6 +20052,10 @@ "UpgradeWatermelonHeight": { "title": "number", "type": "number" + }, + "UpgradeXxHeight": { + "title": "number", + "type": "number" } }, "type": "object" @@ -23198,7 +23203,7 @@ "title": "number", "description": "Number is a number", "examples": [ - 24 + 25 ], "type": [ "number" diff --git a/build/openrpc/gateway.json b/build/openrpc/gateway.json index 95828b746d9..c3c30b02c5c 100644 --- a/build/openrpc/gateway.json +++ b/build/openrpc/gateway.json @@ -10252,7 +10252,7 @@ "title": "number", "description": "Number is a number", "examples": [ - 24 + 25 ], "type": [ "number" diff --git a/build/openrpc/miner.json b/build/openrpc/miner.json index 4d7cb59962c..fc97cd1974b 100644 --- a/build/openrpc/miner.json +++ b/build/openrpc/miner.json @@ -538,7 +538,7 @@ "title": "number", "description": "Number is a number", "examples": [ - 24 + 25 ], "type": [ "number" diff --git a/chain/actors/builtin/account/account.go b/chain/actors/builtin/account/account.go index 308fb763c9a..93dff219f16 100644 --- a/chain/actors/builtin/account/account.go +++ b/chain/actors/builtin/account/account.go @@ -6,7 +6,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" @@ -22,7 +22,7 @@ import ( "github.com/filecoin-project/lotus/chain/types" ) -var Methods = builtin15.MethodsAccount +var Methods = builtin16.MethodsAccount func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { @@ -56,6 +56,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -135,6 +138,9 @@ func MakeState(store adt.Store, av actorstypes.Version, addr address.Address) (S case actorstypes.Version15: return make15(store, addr) + case actorstypes.Version16: + return make16(store, addr) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -167,5 +173,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/account/v16.go b/chain/actors/builtin/account/v16.go new file mode 100644 index 00000000000..844383f5fb2 --- /dev/null +++ b/chain/actors/builtin/account/v16.go @@ -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" + account16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store, addr address.Address) (State, error) { + out := state16{store: store} + out.State = account16.State{Address: addr} + return &out, nil +} + +type state16 struct { + account16.State + store adt.Store +} + +func (s *state16) PubkeyAddress() (address.Address, error) { + return s.Address, nil +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) ActorKey() string { + return manifest.AccountKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/cron/cron.go b/chain/actors/builtin/cron/cron.go index c4d0894aadd..9648cc30531 100644 --- a/chain/actors/builtin/cron/cron.go +++ b/chain/actors/builtin/cron/cron.go @@ -5,7 +5,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -52,6 +52,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -131,13 +134,16 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) { case actorstypes.Version15: return make15(store) + case actorstypes.Version16: + return make16(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } var ( - Address = builtin15.CronActorAddr - Methods = builtin15.MethodsCron + Address = builtin16.CronActorAddr + Methods = builtin16.MethodsCron ) type State interface { @@ -165,5 +171,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/cron/v16.go b/chain/actors/builtin/cron/v16.go new file mode 100644 index 00000000000..b16e65bc0e9 --- /dev/null +++ b/chain/actors/builtin/cron/v16.go @@ -0,0 +1,57 @@ +package cron + +import ( + "fmt" + + "github.com/ipfs/go-cid" + + actorstypes "github.com/filecoin-project/go-state-types/actors" + cron16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store) (State, error) { + out := state16{store: store} + out.State = *cron16.ConstructState(cron16.BuiltInEntries()) + return &out, nil +} + +type state16 struct { + cron16.State + store adt.Store +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) ActorKey() string { + return manifest.CronKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/datacap/datacap.go b/chain/actors/builtin/datacap/datacap.go index f24cebc106e..916858c80ab 100644 --- a/chain/actors/builtin/datacap/datacap.go +++ b/chain/actors/builtin/datacap/datacap.go @@ -7,7 +7,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/manifest" @@ -17,8 +17,8 @@ import ( ) var ( - Address = builtin15.DatacapActorAddr - Methods = builtin15.MethodsDatacap + Address = builtin16.DatacapActorAddr + Methods = builtin16.MethodsDatacap ) 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.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -80,6 +83,9 @@ func MakeState(store adt.Store, av actorstypes.Version, governor address.Address case actorstypes.Version15: return make15(store, governor, bitwidth) + case actorstypes.Version16: + return make16(store, governor, bitwidth) + default: return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av) } @@ -107,5 +113,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/datacap/v16.go b/chain/actors/builtin/datacap/v16.go new file mode 100644 index 00000000000..e6328e94b14 --- /dev/null +++ b/chain/actors/builtin/datacap/v16.go @@ -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" + datacap16 "github.com/filecoin-project/go-state-types/builtin/v16/datacap" + adt16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store, governor address.Address, bitwidth uint64) (State, error) { + out := state16{store: store} + s, err := datacap16.ConstructState(store, governor, bitwidth) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state16 struct { + datacap16.State + store adt.Store +} + +func (s *state16) Governor() (address.Address, error) { + return s.State.Governor, nil +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error { + return forEachClient(s.store, actors.Version16, s.verifiedClients, cb) +} + +func (s *state16) verifiedClients() (adt.Map, error) { + return adt16.AsMap(s.store, s.Token.Balances, int(s.Token.HamtBitWidth)) +} + +func (s *state16) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) { + return getDataCap(s.store, actors.Version16, s.verifiedClients, addr) +} + +func (s *state16) ActorKey() string { + return manifest.DatacapKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/evm/evm.go b/chain/actors/builtin/evm/evm.go index 73e335e2c05..8c36476af25 100644 --- a/chain/actors/builtin/evm/evm.go +++ b/chain/actors/builtin/evm/evm.go @@ -5,7 +5,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/manifest" @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/lotus/chain/types" ) -var Methods = builtin15.MethodsEVM +var Methods = builtin16.MethodsEVM // See https://github.com/filecoin-project/builtin-actors/blob/6e781444cee5965278c46ef4ffe1fb1970f18d7d/actors/evm/src/lib.rs#L35-L42 const ( @@ -55,6 +55,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -82,6 +85,9 @@ func MakeState(store adt.Store, av actorstypes.Version, bytecode cid.Cid) (State case actorstypes.Version15: return make15(store, bytecode) + case actorstypes.Version16: + return make16(store, bytecode) + default: return nil, xerrors.Errorf("evm actor only valid for actors v10 and above, got %d", av) } diff --git a/chain/actors/builtin/evm/v16.go b/chain/actors/builtin/evm/v16.go new file mode 100644 index 00000000000..3ec5b30ccdb --- /dev/null +++ b/chain/actors/builtin/evm/v16.go @@ -0,0 +1,72 @@ +package evm + +import ( + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/go-state-types/abi" + evm16 "github.com/filecoin-project/go-state-types/builtin/v16/evm" + + "github.com/filecoin-project/lotus/chain/actors/adt" +) + +var _ State = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store, bytecode cid.Cid) (State, error) { + out := state16{store: store} + s, err := evm16.ConstructState(store, bytecode) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state16 struct { + evm16.State + store adt.Store +} + +func (s *state16) Nonce() (uint64, error) { + return s.State.Nonce, nil +} + +func (s *state16) IsAlive() (bool, error) { + return s.State.Tombstone == nil, nil +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) GetBytecodeCID() (cid.Cid, error) { + return s.State.Bytecode, nil +} + +func (s *state16) GetBytecodeHash() ([32]byte, error) { + return s.State.BytecodeHash, nil +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/init/init.go b/chain/actors/builtin/init/init.go index 138ca775e28..1512f16e685 100644 --- a/chain/actors/builtin/init/init.go +++ b/chain/actors/builtin/init/init.go @@ -7,7 +7,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" @@ -25,8 +25,8 @@ import ( ) var ( - Address = builtin15.InitActorAddr - Methods = builtin15.MethodsInit + Address = builtin16.InitActorAddr + Methods = builtin16.MethodsInit ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -61,6 +61,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -140,6 +143,9 @@ func MakeState(store adt.Store, av actorstypes.Version, networkName string) (Sta case actorstypes.Version15: return make15(store, networkName) + case actorstypes.Version16: + return make16(store, networkName) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -195,5 +201,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/init/v16.go b/chain/actors/builtin/init/v16.go new file mode 100644 index 00000000000..134f3448fba --- /dev/null +++ b/chain/actors/builtin/init/v16.go @@ -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" + builtin16 "github.com/filecoin-project/go-state-types/builtin" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" + adt16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store, networkName string) (State, error) { + out := state16{store: store} + + s, err := init16.ConstructState(store, networkName) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state16 struct { + init16.State + store adt.Store +} + +func (s *state16) ResolveAddress(address address.Address) (address.Address, bool, error) { + return s.State.ResolveAddress(s.store, address) +} + +func (s *state16) MapAddressToNewID(address address.Address) (address.Address, error) { + return s.State.MapAddressToNewID(s.store, address) +} + +func (s *state16) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error { + addrs, err := adt16.AsMap(s.store, s.State.AddressMap, builtin16.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 *state16) NetworkName() (dtypes.NetworkName, error) { + return dtypes.NetworkName(s.State.NetworkName), nil +} + +func (s *state16) SetNetworkName(name string) error { + s.State.NetworkName = name + return nil +} + +func (s *state16) SetNextID(id abi.ActorID) error { + s.State.NextID = id + return nil +} + +func (s *state16) Remove(addrs ...address.Address) (err error) { + m, err := adt16.AsMap(s.store, s.State.AddressMap, builtin16.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 *state16) SetAddressMap(mcid cid.Cid) error { + s.State.AddressMap = mcid + return nil +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) AddressMap() (adt.Map, error) { + return adt16.AsMap(s.store, s.State.AddressMap, builtin16.DefaultHamtBitwidth) +} + +func (s *state16) AddressMapBitWidth() int { + return builtin16.DefaultHamtBitwidth +} + +func (s *state16) AddressMapHashFunction() func(input []byte) []byte { + return func(input []byte) []byte { + res := sha256.Sum256(input) + return res[:] + } +} + +func (s *state16) ActorKey() string { + return manifest.InitKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/market/market.go b/chain/actors/builtin/market/market.go index 77450fe39d6..3804474ad28 100644 --- a/chain/actors/builtin/market/market.go +++ b/chain/actors/builtin/market/market.go @@ -67,6 +67,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -146,6 +149,9 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) { case actorstypes.Version15: return make15(store) + case actorstypes.Version16: + return make16(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -253,6 +259,9 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora case actorstypes.Version15: return decodePublishStorageDealsReturn15(b) + case actorstypes.Version16: + return decodePublishStorageDealsReturn16(b) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -381,5 +390,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/market/v16.go b/chain/actors/builtin/market/v16.go new file mode 100644 index 00000000000..17d84677161 --- /dev/null +++ b/chain/actors/builtin/market/v16.go @@ -0,0 +1,410 @@ +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" + market16 "github.com/filecoin-project/go-state-types/builtin/v16/market" + adt16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store) (State, error) { + out := state16{store: store} + + s, err := market16.ConstructState(store) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state16 struct { + market16.State + store adt.Store +} + +func (s *state16) TotalLocked() (abi.TokenAmount, error) { + fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral) + fml = types.BigAdd(fml, s.TotalClientStorageFee) + return fml, nil +} + +func (s *state16) BalancesChanged(otherState State) (bool, error) { + otherState16, ok := otherState.(*state16) + 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(otherState16.State.EscrowTable) || !s.State.LockedTable.Equals(otherState16.State.LockedTable), nil +} + +func (s *state16) StatesChanged(otherState State) (bool, error) { + otherState16, ok := otherState.(*state16) + 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(otherState16.State.States), nil +} + +func (s *state16) States() (DealStates, error) { + stateArray, err := adt16.AsArray(s.store, s.State.States, market16.StatesAmtBitwidth) + if err != nil { + return nil, err + } + return &dealStates16{stateArray}, nil +} + +func (s *state16) ProposalsChanged(otherState State) (bool, error) { + otherState16, ok := otherState.(*state16) + 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(otherState16.State.Proposals), nil +} + +func (s *state16) Proposals() (DealProposals, error) { + proposalArray, err := adt16.AsArray(s.store, s.State.Proposals, market16.ProposalsAmtBitwidth) + if err != nil { + return nil, err + } + return &dealProposals16{proposalArray}, nil +} + +func (s *state16) EscrowTable() (BalanceTable, error) { + bt, err := adt16.AsBalanceTable(s.store, s.State.EscrowTable) + if err != nil { + return nil, err + } + return &balanceTable16{bt}, nil +} + +func (s *state16) LockedTable() (BalanceTable, error) { + bt, err := adt16.AsBalanceTable(s.store, s.State.LockedTable) + if err != nil { + return nil, err + } + return &balanceTable16{bt}, nil +} + +func (s *state16) VerifyDealsForActivation( + minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market16.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err +} + +func (s *state16) NextID() (abi.DealID, error) { + return s.State.NextID, nil +} + +type balanceTable16 struct { + *adt16.BalanceTable +} + +func (bt *balanceTable16) ForEach(cb func(address.Address, abi.TokenAmount) error) error { + asMap := (*adt16.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 dealStates16 struct { + adt.Array +} + +func (s *dealStates16) Get(dealID abi.DealID) (DealState, bool, error) { + var deal16 market16.DealState + found, err := s.Array.Get(uint64(dealID), &deal16) + if err != nil { + return nil, false, err + } + if !found { + return nil, false, nil + } + deal := fromV16DealState(deal16) + return deal, true, nil +} + +func (s *dealStates16) ForEach(cb func(dealID abi.DealID, ds DealState) error) error { + var ds16 market16.DealState + return s.Array.ForEach(&ds16, func(idx int64) error { + return cb(abi.DealID(idx), fromV16DealState(ds16)) + }) +} + +func (s *dealStates16) decode(val *cbg.Deferred) (DealState, error) { + var ds16 market16.DealState + if err := ds16.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil { + return nil, err + } + ds := fromV16DealState(ds16) + return ds, nil +} + +func (s *dealStates16) array() adt.Array { + return s.Array +} + +type dealStateV16 struct { + ds16 market16.DealState +} + +func (d dealStateV16) SectorNumber() abi.SectorNumber { + + return d.ds16.SectorNumber + +} + +func (d dealStateV16) SectorStartEpoch() abi.ChainEpoch { + return d.ds16.SectorStartEpoch +} + +func (d dealStateV16) LastUpdatedEpoch() abi.ChainEpoch { + return d.ds16.LastUpdatedEpoch +} + +func (d dealStateV16) SlashEpoch() abi.ChainEpoch { + return d.ds16.SlashEpoch +} + +func (d dealStateV16) Equals(other DealState) bool { + if ov16, ok := other.(dealStateV16); ok { + return d.ds16 == ov16.ds16 + } + + 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 = (*dealStateV16)(nil) + +func fromV16DealState(v16 market16.DealState) DealState { + return dealStateV16{v16} +} + +type dealProposals16 struct { + adt.Array +} + +func (s *dealProposals16) Get(dealID abi.DealID) (*DealProposal, bool, error) { + var proposal16 market16.DealProposal + found, err := s.Array.Get(uint64(dealID), &proposal16) + if err != nil { + return nil, false, err + } + if !found { + return nil, false, nil + } + + proposal, err := fromV16DealProposal(proposal16) + if err != nil { + return nil, true, xerrors.Errorf("decoding proposal: %w", err) + } + + return &proposal, true, nil +} + +func (s *dealProposals16) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error { + var dp16 market16.DealProposal + return s.Array.ForEach(&dp16, func(idx int64) error { + dp, err := fromV16DealProposal(dp16) + if err != nil { + return xerrors.Errorf("decoding proposal: %w", err) + } + + return cb(abi.DealID(idx), dp) + }) +} + +func (s *dealProposals16) decode(val *cbg.Deferred) (*DealProposal, error) { + var dp16 market16.DealProposal + if err := dp16.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil { + return nil, err + } + + dp, err := fromV16DealProposal(dp16) + if err != nil { + return nil, err + } + + return &dp, nil +} + +func (s *dealProposals16) array() adt.Array { + return s.Array +} + +func fromV16DealProposal(v16 market16.DealProposal) (DealProposal, error) { + + label, err := fromV16Label(v16.Label) + + if err != nil { + return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err) + } + + return DealProposal{ + PieceCID: v16.PieceCID, + PieceSize: v16.PieceSize, + VerifiedDeal: v16.VerifiedDeal, + Client: v16.Client, + Provider: v16.Provider, + + Label: label, + + StartEpoch: v16.StartEpoch, + EndEpoch: v16.EndEpoch, + StoragePricePerEpoch: v16.StoragePricePerEpoch, + + ProviderCollateral: v16.ProviderCollateral, + ClientCollateral: v16.ClientCollateral, + }, nil +} + +func fromV16Label(v16 market16.DealLabel) (DealLabel, error) { + if v16.IsString() { + str, err := v16.ToString() + if err != nil { + return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert string label to string: %w", err) + } + return markettypes.NewLabelFromString(str) + } + + bs, err := v16.ToBytes() + if err != nil { + return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert bytes label to bytes: %w", err) + } + return markettypes.NewLabelFromBytes(bs) +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +var _ PublishStorageDealsReturn = (*publishStorageDealsReturn16)(nil) + +func decodePublishStorageDealsReturn16(b []byte) (PublishStorageDealsReturn, error) { + var retval market16.PublishStorageDealsReturn + if err := retval.UnmarshalCBOR(bytes.NewReader(b)); err != nil { + return nil, xerrors.Errorf("failed to unmarshal PublishStorageDealsReturn: %w", err) + } + + return &publishStorageDealsReturn16{retval}, nil +} + +type publishStorageDealsReturn16 struct { + market16.PublishStorageDealsReturn +} + +func (r *publishStorageDealsReturn16) 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 *publishStorageDealsReturn16) DealIDs() ([]abi.DealID, error) { + return r.IDs, nil +} + +func (s *state16) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) { + + allocations, err := adt16.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 *state16) ActorKey() string { + return manifest.MarketKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/miner/miner.go b/chain/actors/builtin/miner/miner.go index 6290a051a3a..62ced8d0554 100644 --- a/chain/actors/builtin/miner/miner.go +++ b/chain/actors/builtin/miner/miner.go @@ -61,6 +61,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -140,6 +143,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) { case actors.Version15: return make15(store) + case actors.Version16: + return make16(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -406,5 +412,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/miner/v16.go b/chain/actors/builtin/miner/v16.go new file mode 100644 index 00000000000..f1809c00343 --- /dev/null +++ b/chain/actors/builtin/miner/v16.go @@ -0,0 +1,595 @@ +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" + builtin16 "github.com/filecoin-project/go-state-types/builtin" + miner16 "github.com/filecoin-project/go-state-types/builtin/v16/miner" + adt16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store) (State, error) { + out := state16{store: store} + out.State = miner16.State{} + return &out, nil +} + +type state16 struct { + miner16.State + store adt.Store +} + +type deadline16 struct { + miner16.Deadline + store adt.Store +} + +type partition16 struct { + miner16.Partition + store adt.Store +} + +func (s *state16) 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 *state16) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) { + return s.CheckVestedFunds(s.store, epoch) +} + +func (s *state16) LockedFunds() (LockedFunds, error) { + return LockedFunds{ + VestingFunds: s.State.LockedFunds, + InitialPledgeRequirement: s.State.InitialPledge, + PreCommitDeposits: s.State.PreCommitDeposits, + }, nil +} + +func (s *state16) FeeDebt() (abi.TokenAmount, error) { + return s.State.FeeDebt, nil +} + +func (s *state16) InitialPledge() (abi.TokenAmount, error) { + return s.State.InitialPledge, nil +} + +func (s *state16) PreCommitDeposits() (abi.TokenAmount, error) { + return s.State.PreCommitDeposits, nil +} + +// Returns nil, nil if sector is not found +func (s *state16) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { + info, ok, err := s.State.GetSector(s.store, num) + if !ok || err != nil { + return nil, err + } + + ret := fromV16SectorOnChainInfo(*info) + return &ret, nil +} + +func (s *state16) 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 *state16) 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 *miner16.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 *state16) 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 *miner16.Deadline) error { + partitions, err := dl.PartitionsArray(s.store) + if err != nil { + return err + } + quant := s.State.QuantSpecForDeadline(dlIdx) + var part miner16.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 := miner16.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant, miner16.PartitionExpirationAmtBitwidth) + if err != nil { + return err + } + var exp miner16.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 *state16) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) { + info, ok, err := s.State.GetPrecommittedSector(s.store, num) + if !ok || err != nil { + return nil, err + } + + ret := fromV16SectorPreCommitOnChainInfo(*info) + + return &ret, nil +} + +func (s *state16) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error { + precommitted, err := adt16.AsMap(s.store, s.State.PreCommittedSectors, builtin16.DefaultHamtBitwidth) + if err != nil { + return err + } + + var info miner16.SectorPreCommitOnChainInfo + if err := precommitted.ForEach(&info, func(_ string) error { + return cb(fromV16SectorPreCommitOnChainInfo(info)) + }); err != nil { + return err + } + + return nil +} + +func (s *state16) LoadSectors(snos *bitfield.BitField) ([]*SectorOnChainInfo, error) { + sectors, err := miner16.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 info16 miner16.SectorOnChainInfo + if err := sectors.ForEach(&info16, func(_ int64) error { + info := fromV16SectorOnChainInfo(info16) + infos = append(infos, &info) + return nil + }); err != nil { + return nil, err + } + return infos, nil + } + + // Otherwise, load selected. + infos16, err := sectors.Load(*snos) + if err != nil { + return nil, err + } + infos := make([]*SectorOnChainInfo, len(infos16)) + for i, info16 := range infos16 { + info := fromV16SectorOnChainInfo(*info16) + infos[i] = &info + } + return infos, nil +} + +func (s *state16) loadAllocatedSectorNumbers() (bitfield.BitField, error) { + var allocatedSectors bitfield.BitField + err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors) + return allocatedSectors, err +} + +func (s *state16) IsAllocated(num abi.SectorNumber) (bool, error) { + allocatedSectors, err := s.loadAllocatedSectorNumbers() + if err != nil { + return false, err + } + + return allocatedSectors.IsSet(uint64(num)) +} + +func (s *state16) GetProvingPeriodStart() (abi.ChainEpoch, error) { + return s.State.ProvingPeriodStart, nil +} + +func (s *state16) 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 *state16) 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 *state16) 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 &deadline16{*dl, s.store}, nil +} + +func (s *state16) 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 *miner16.Deadline) error { + return cb(i, &deadline16{*dl, s.store}) + }) +} + +func (s *state16) NumDeadlines() (uint64, error) { + return miner16.WPoStPeriodDeadlines, nil +} + +func (s *state16) DeadlinesChanged(other State) (bool, error) { + other16, ok := other.(*state16) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + + return !s.State.Deadlines.Equals(other16.Deadlines), nil +} + +func (s *state16) MinerInfoChanged(other State) (bool, error) { + other0, ok := other.(*state16) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + return !s.State.Info.Equals(other0.State.Info), nil +} + +func (s *state16) 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 *state16) DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error) { + return s.State.RecordedDeadlineInfo(epoch), nil +} + +func (s *state16) DeadlineCronActive() (bool, error) { + return s.State.DeadlineCronActive, nil +} + +func (s *state16) sectors() (adt.Array, error) { + return adt16.AsArray(s.store, s.Sectors, miner16.SectorsAmtBitwidth) +} + +func (s *state16) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) { + var si miner16.SectorOnChainInfo + err := si.UnmarshalCBOR(bytes.NewReader(val.Raw)) + if err != nil { + return SectorOnChainInfo{}, err + } + + return fromV16SectorOnChainInfo(si), nil +} + +func (s *state16) precommits() (adt.Map, error) { + return adt16.AsMap(s.store, s.PreCommittedSectors, builtin16.DefaultHamtBitwidth) +} + +func (s *state16) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) { + var sp miner16.SectorPreCommitOnChainInfo + err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw)) + if err != nil { + return SectorPreCommitOnChainInfo{}, err + } + + return fromV16SectorPreCommitOnChainInfo(sp), nil +} + +func (s *state16) EraseAllUnproven() error { + + dls, err := s.State.LoadDeadlines(s.store) + if err != nil { + return err + } + + err = dls.ForEach(s.store, func(dindx uint64, dl *miner16.Deadline) error { + ps, err := dl.PartitionsArray(s.store) + if err != nil { + return err + } + + var part miner16.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 *deadline16) LoadPartition(idx uint64) (Partition, error) { + p, err := d.Deadline.LoadPartition(d.store, idx) + if err != nil { + return nil, err + } + return &partition16{*p, d.store}, nil +} + +func (d *deadline16) ForEachPartition(cb func(uint64, Partition) error) error { + ps, err := d.Deadline.PartitionsArray(d.store) + if err != nil { + return err + } + var part miner16.Partition + return ps.ForEach(&part, func(i int64) error { + return cb(uint64(i), &partition16{part, d.store}) + }) +} + +func (d *deadline16) PartitionsChanged(other Deadline) (bool, error) { + other16, ok := other.(*deadline16) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + + return !d.Deadline.Partitions.Equals(other16.Deadline.Partitions), nil +} + +func (d *deadline16) PartitionsPoSted() (bitfield.BitField, error) { + return d.Deadline.PartitionsPoSted, nil +} + +func (d *deadline16) DisputableProofCount() (uint64, error) { + + ops, err := d.OptimisticProofsSnapshotArray(d.store) + if err != nil { + return 0, err + } + + return ops.Length(), nil + +} + +func (p *partition16) AllSectors() (bitfield.BitField, error) { + return p.Partition.Sectors, nil +} + +func (p *partition16) FaultySectors() (bitfield.BitField, error) { + return p.Partition.Faults, nil +} + +func (p *partition16) RecoveringSectors() (bitfield.BitField, error) { + return p.Partition.Recoveries, nil +} + +func (p *partition16) UnprovenSectors() (bitfield.BitField, error) { + return p.Partition.Unproven, nil +} + +func fromV16SectorOnChainInfo(v16 miner16.SectorOnChainInfo) SectorOnChainInfo { + info := SectorOnChainInfo{ + SectorNumber: v16.SectorNumber, + SealProof: v16.SealProof, + SealedCID: v16.SealedCID, + DealIDs: v16.DealIDs, + Activation: v16.Activation, + Expiration: v16.Expiration, + DealWeight: v16.DealWeight, + VerifiedDealWeight: v16.VerifiedDealWeight, + InitialPledge: v16.InitialPledge, + ExpectedDayReward: v16.ExpectedDayReward, + ExpectedStoragePledge: v16.ExpectedStoragePledge, + + SectorKeyCID: v16.SectorKeyCID, + + PowerBaseEpoch: v16.PowerBaseEpoch, + ReplacedDayReward: v16.ReplacedDayReward, + Flags: SectorOnChainInfoFlags(v16.Flags), + } + return info +} + +func fromV16SectorPreCommitOnChainInfo(v16 miner16.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo { + ret := SectorPreCommitOnChainInfo{ + Info: SectorPreCommitInfo{ + SealProof: v16.Info.SealProof, + SectorNumber: v16.Info.SectorNumber, + SealedCID: v16.Info.SealedCID, + SealRandEpoch: v16.Info.SealRandEpoch, + DealIDs: v16.Info.DealIDs, + Expiration: v16.Info.Expiration, + UnsealedCid: nil, + }, + PreCommitDeposit: v16.PreCommitDeposit, + PreCommitEpoch: v16.PreCommitEpoch, + } + + ret.Info.UnsealedCid = v16.Info.UnsealedCid + + return ret +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) ActorKey() string { + return manifest.MinerKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/multisig/message10.go b/chain/actors/builtin/multisig/message10.go index 20884441d0f..ba52a9ffb0d 100644 --- a/chain/actors/builtin/multisig/message10.go +++ b/chain/actors/builtin/multisig/message10.go @@ -8,7 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtintypes "github.com/filecoin-project/go-state-types/builtin" multisig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig" - init15 "github.com/filecoin-project/go-state-types/builtin/v15/init" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" "github.com/filecoin-project/go-state-types/manifest" "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 - execParams := &init15.ExecParams{ + execParams := &init16.ExecParams{ CodeCID: code, ConstructorParams: enc, } diff --git a/chain/actors/builtin/multisig/message11.go b/chain/actors/builtin/multisig/message11.go index abd35889281..ec5f47f3136 100644 --- a/chain/actors/builtin/multisig/message11.go +++ b/chain/actors/builtin/multisig/message11.go @@ -8,7 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtintypes "github.com/filecoin-project/go-state-types/builtin" multisig11 "github.com/filecoin-project/go-state-types/builtin/v11/multisig" - init15 "github.com/filecoin-project/go-state-types/builtin/v15/init" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" "github.com/filecoin-project/go-state-types/manifest" "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 - execParams := &init15.ExecParams{ + execParams := &init16.ExecParams{ CodeCID: code, ConstructorParams: enc, } diff --git a/chain/actors/builtin/multisig/message12.go b/chain/actors/builtin/multisig/message12.go index 731cc2fbd02..831c9ec569a 100644 --- a/chain/actors/builtin/multisig/message12.go +++ b/chain/actors/builtin/multisig/message12.go @@ -8,7 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtintypes "github.com/filecoin-project/go-state-types/builtin" multisig12 "github.com/filecoin-project/go-state-types/builtin/v12/multisig" - init15 "github.com/filecoin-project/go-state-types/builtin/v15/init" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" "github.com/filecoin-project/go-state-types/manifest" "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 - execParams := &init15.ExecParams{ + execParams := &init16.ExecParams{ CodeCID: code, ConstructorParams: enc, } diff --git a/chain/actors/builtin/multisig/message13.go b/chain/actors/builtin/multisig/message13.go index 932225be5c5..fed7562909f 100644 --- a/chain/actors/builtin/multisig/message13.go +++ b/chain/actors/builtin/multisig/message13.go @@ -8,7 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtintypes "github.com/filecoin-project/go-state-types/builtin" multisig13 "github.com/filecoin-project/go-state-types/builtin/v13/multisig" - init15 "github.com/filecoin-project/go-state-types/builtin/v15/init" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" "github.com/filecoin-project/go-state-types/manifest" "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 - execParams := &init15.ExecParams{ + execParams := &init16.ExecParams{ CodeCID: code, ConstructorParams: enc, } diff --git a/chain/actors/builtin/multisig/message14.go b/chain/actors/builtin/multisig/message14.go index 0ba5e04326d..25a1a8452bf 100644 --- a/chain/actors/builtin/multisig/message14.go +++ b/chain/actors/builtin/multisig/message14.go @@ -8,7 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtintypes "github.com/filecoin-project/go-state-types/builtin" multisig14 "github.com/filecoin-project/go-state-types/builtin/v14/multisig" - init15 "github.com/filecoin-project/go-state-types/builtin/v15/init" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" @@ -57,7 +57,7 @@ func (m message14) Create( } // new actors are created by invoking 'exec' on the init actor with the constructor params - execParams := &init15.ExecParams{ + execParams := &init16.ExecParams{ CodeCID: code, ConstructorParams: enc, } diff --git a/chain/actors/builtin/multisig/message15.go b/chain/actors/builtin/multisig/message15.go index 3c4a4c29310..8ec70b9a3f7 100644 --- a/chain/actors/builtin/multisig/message15.go +++ b/chain/actors/builtin/multisig/message15.go @@ -7,8 +7,8 @@ import ( "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" - init15 "github.com/filecoin-project/go-state-types/builtin/v15/init" multisig15 "github.com/filecoin-project/go-state-types/builtin/v15/multisig" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" @@ -57,7 +57,7 @@ func (m message15) Create( } // new actors are created by invoking 'exec' on the init actor with the constructor params - execParams := &init15.ExecParams{ + execParams := &init16.ExecParams{ CodeCID: code, ConstructorParams: enc, } diff --git a/chain/actors/builtin/multisig/message16.go b/chain/actors/builtin/multisig/message16.go new file mode 100644 index 00000000000..f16ca09293c --- /dev/null +++ b/chain/actors/builtin/multisig/message16.go @@ -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" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" + multisig16 "github.com/filecoin-project/go-state-types/builtin/v16/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 message16 struct{ message0 } + +func (m message16) 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 := &multisig16.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.Version16, 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 := &init16.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 +} diff --git a/chain/actors/builtin/multisig/message8.go b/chain/actors/builtin/multisig/message8.go index d2c7e5531ec..add2b2df7d3 100644 --- a/chain/actors/builtin/multisig/message8.go +++ b/chain/actors/builtin/multisig/message8.go @@ -7,7 +7,7 @@ import ( "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" - init15 "github.com/filecoin-project/go-state-types/builtin/v15/init" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig" "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 - execParams := &init15.ExecParams{ + execParams := &init16.ExecParams{ CodeCID: code, ConstructorParams: enc, } diff --git a/chain/actors/builtin/multisig/message9.go b/chain/actors/builtin/multisig/message9.go index 0dcad5b45ef..6500d4fed20 100644 --- a/chain/actors/builtin/multisig/message9.go +++ b/chain/actors/builtin/multisig/message9.go @@ -7,7 +7,7 @@ import ( "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" - init15 "github.com/filecoin-project/go-state-types/builtin/v15/init" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig" "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 - execParams := &init15.ExecParams{ + execParams := &init16.ExecParams{ CodeCID: code, ConstructorParams: enc, } diff --git a/chain/actors/builtin/multisig/multisig.go b/chain/actors/builtin/multisig/multisig.go index ddd4be932f5..7650fa7926e 100644 --- a/chain/actors/builtin/multisig/multisig.go +++ b/chain/actors/builtin/multisig/multisig.go @@ -11,7 +11,7 @@ import ( "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" - msig15 "github.com/filecoin-project/go-state-types/builtin/v15/multisig" + msig16 "github.com/filecoin-project/go-state-types/builtin/v16/multisig" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" @@ -59,6 +59,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -138,6 +141,9 @@ func MakeState(store adt.Store, av actorstypes.Version, signers []address.Addres case actorstypes.Version15: return make15(store, signers, threshold, startEpoch, unlockDuration, initialBalance) + case actorstypes.Version16: + return make16(store, signers, threshold, startEpoch, unlockDuration, initialBalance) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -164,7 +170,7 @@ type State interface { GetState() interface{} } -type Transaction = msig15.Transaction +type Transaction = msig16.Transaction var Methods = builtintypes.MethodsMultisig @@ -215,6 +221,9 @@ func Message(version actorstypes.Version, from address.Address) MessageBuilder { case actorstypes.Version15: return message15{message0{from}} + + case actorstypes.Version16: + return message16{message0{from}} default: panic(fmt.Sprintf("unsupported actors version: %d", version)) } @@ -238,10 +247,10 @@ type MessageBuilder interface { } // this type is the same between v0 and v2 -type ProposalHashData = msig15.ProposalHashData -type ProposeReturn = msig15.ProposeReturn -type ProposeParams = msig15.ProposeParams -type ApproveReturn = msig15.ApproveReturn +type ProposalHashData = msig16.ProposalHashData +type ProposeReturn = msig16.ProposeReturn +type ProposeParams = msig16.ProposeParams +type ApproveReturn = msig16.ApproveReturn func AllCodes() []cid.Cid { return []cid.Cid{ @@ -260,5 +269,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/multisig/v16.go b/chain/actors/builtin/multisig/v16.go new file mode 100644 index 00000000000..87e92d692e6 --- /dev/null +++ b/chain/actors/builtin/multisig/v16.go @@ -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" + builtin16 "github.com/filecoin-project/go-state-types/builtin" + msig16 "github.com/filecoin-project/go-state-types/builtin/v16/multisig" + adt16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) { + out := state16{store: store} + out.State = msig16.State{} + out.State.Signers = signers + out.State.NumApprovalsThreshold = threshold + out.State.StartEpoch = startEpoch + out.State.UnlockDuration = unlockDuration + out.State.InitialBalance = initialBalance + + em, err := adt16.StoreEmptyMap(store, builtin16.DefaultHamtBitwidth) + if err != nil { + return nil, err + } + + out.State.PendingTxns = em + + return &out, nil +} + +type state16 struct { + msig16.State + store adt.Store +} + +func (s *state16) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) { + return s.State.AmountLocked(currEpoch - s.State.StartEpoch), nil +} + +func (s *state16) StartEpoch() (abi.ChainEpoch, error) { + return s.State.StartEpoch, nil +} + +func (s *state16) UnlockDuration() (abi.ChainEpoch, error) { + return s.State.UnlockDuration, nil +} + +func (s *state16) InitialBalance() (abi.TokenAmount, error) { + return s.State.InitialBalance, nil +} + +func (s *state16) Threshold() (uint64, error) { + return s.State.NumApprovalsThreshold, nil +} + +func (s *state16) Signers() ([]address.Address, error) { + return s.State.Signers, nil +} + +func (s *state16) ForEachPendingTxn(cb func(id int64, txn Transaction) error) error { + arr, err := adt16.AsMap(s.store, s.State.PendingTxns, builtin16.DefaultHamtBitwidth) + if err != nil { + return err + } + var out msig16.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 *state16) PendingTxnChanged(other State) (bool, error) { + other16, ok := other.(*state16) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + return !s.State.PendingTxns.Equals(other16.PendingTxns), nil +} + +func (s *state16) transactions() (adt.Map, error) { + return adt16.AsMap(s.store, s.PendingTxns, builtin16.DefaultHamtBitwidth) +} + +func (s *state16) decodeTransaction(val *cbg.Deferred) (Transaction, error) { + var tx msig16.Transaction + if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil { + return Transaction{}, err + } + return Transaction(tx), nil +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) ActorKey() string { + return manifest.MultisigKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/paych/message16.go b/chain/actors/builtin/paych/message16.go new file mode 100644 index 00000000000..f0b6b2e937d --- /dev/null +++ b/chain/actors/builtin/paych/message16.go @@ -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" + builtin16 "github.com/filecoin-project/go-state-types/builtin" + init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" + paych16 "github.com/filecoin-project/go-state-types/builtin/v16/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 message16 struct{ from address.Address } + +func (m message16) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) { + + actorCodeID, ok := actors.GetActorCodeID(actorstypes.Version16, "paymentchannel") + if !ok { + return nil, xerrors.Errorf("error getting actor paymentchannel code id for actor version %d", 16) + } + + params, aerr := actors.SerializeParams(&paych16.ConstructorParams{From: m.from, To: to}) + if aerr != nil { + return nil, aerr + } + enc, aerr := actors.SerializeParams(&init16.ExecParams{ + CodeCID: actorCodeID, + ConstructorParams: params, + }) + if aerr != nil { + return nil, aerr + } + + return &types.Message{ + To: init_.Address, + From: m.from, + Value: initialAmount, + Method: builtin16.MethodsInit.Exec, + Params: enc, + }, nil +} + +func (m message16) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) { + params, aerr := actors.SerializeParams(&paych16.UpdateChannelStateParams{ + + Sv: toV16SignedVoucher(*sv), + + Secret: secret, + }) + if aerr != nil { + return nil, aerr + } + + return &types.Message{ + To: paych, + From: m.from, + Value: abi.NewTokenAmount(0), + Method: builtin16.MethodsPaych.UpdateChannelState, + Params: params, + }, nil +} + +func toV16SignedVoucher(sv paychtypes.SignedVoucher) paych16.SignedVoucher { + merges := make([]paych16.Merge, len(sv.Merges)) + for i := range sv.Merges { + merges[i] = paych16.Merge{ + Lane: sv.Merges[i].Lane, + Nonce: sv.Merges[i].Nonce, + } + } + + return paych16.SignedVoucher{ + ChannelAddr: sv.ChannelAddr, + TimeLockMin: sv.TimeLockMin, + TimeLockMax: sv.TimeLockMax, + SecretHash: sv.SecretHash, + Extra: (*paych16.ModVerifyParams)(sv.Extra), + Lane: sv.Lane, + Nonce: sv.Nonce, + Amount: sv.Amount, + MinSettleHeight: sv.MinSettleHeight, + Merges: merges, + Signature: sv.Signature, + } +} + +func (m message16) Settle(paych address.Address) (*types.Message, error) { + return &types.Message{ + To: paych, + From: m.from, + Value: abi.NewTokenAmount(0), + Method: builtin16.MethodsPaych.Settle, + }, nil +} + +func (m message16) Collect(paych address.Address) (*types.Message, error) { + return &types.Message{ + To: paych, + From: m.from, + Value: abi.NewTokenAmount(0), + Method: builtin16.MethodsPaych.Collect, + }, nil +} diff --git a/chain/actors/builtin/paych/paych.go b/chain/actors/builtin/paych/paych.go index 110edfd285b..32b53aa7403 100644 --- a/chain/actors/builtin/paych/paych.go +++ b/chain/actors/builtin/paych/paych.go @@ -62,6 +62,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -191,6 +194,9 @@ func Message(version actorstypes.Version, from address.Address) MessageBuilder { case actorstypes.Version15: return message15{from} + case actorstypes.Version16: + return message16{from} + default: panic(fmt.Sprintf("unsupported actors version: %d", version)) } @@ -236,5 +242,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/paych/v16.go b/chain/actors/builtin/paych/v16.go new file mode 100644 index 00000000000..c394ba091f8 --- /dev/null +++ b/chain/actors/builtin/paych/v16.go @@ -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" + paych16 "github.com/filecoin-project/go-state-types/builtin/v16/paych" + adt16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store) (State, error) { + out := state16{store: store} + out.State = paych16.State{} + return &out, nil +} + +type state16 struct { + paych16.State + store adt.Store + lsAmt *adt16.Array +} + +// Channel owner, who has funded the actor +func (s *state16) From() (address.Address, error) { + return s.State.From, nil +} + +// Recipient of payouts from channel +func (s *state16) To() (address.Address, error) { + return s.State.To, nil +} + +// Height at which the channel can be `Collected` +func (s *state16) SettlingAt() (abi.ChainEpoch, error) { + return s.State.SettlingAt, nil +} + +// Amount successfully redeemed through the payment channel, paid out on `Collect()` +func (s *state16) ToSend() (abi.TokenAmount, error) { + return s.State.ToSend, nil +} + +func (s *state16) getOrLoadLsAmt() (*adt16.Array, error) { + if s.lsAmt != nil { + return s.lsAmt, nil + } + + // Get the lane state from the chain + lsamt, err := adt16.AsArray(s.store, s.State.LaneStates, paych16.LaneStatesAmtBitwidth) + if err != nil { + return nil, err + } + + s.lsAmt = lsamt + return lsamt, nil +} + +// Get total number of lanes +func (s *state16) LaneCount() (uint64, error) { + lsamt, err := s.getOrLoadLsAmt() + if err != nil { + return 0, err + } + return lsamt.Length(), nil +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +// Iterate lane states +func (s *state16) 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 paych16.LaneState + return lsamt.ForEach(&ls, func(i int64) error { + return cb(uint64(i), &laneState16{ls}) + }) +} + +type laneState16 struct { + paych16.LaneState +} + +func (ls *laneState16) Redeemed() (big.Int, error) { + return ls.LaneState.Redeemed, nil +} + +func (ls *laneState16) Nonce() (uint64, error) { + return ls.LaneState.Nonce, nil +} + +func (s *state16) ActorKey() string { + return manifest.PaychKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/power/power.go b/chain/actors/builtin/power/power.go index 9d0a2067d54..1347a483d80 100644 --- a/chain/actors/builtin/power/power.go +++ b/chain/actors/builtin/power/power.go @@ -9,7 +9,7 @@ import ( "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" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" @@ -27,8 +27,8 @@ import ( ) var ( - Address = builtin15.StoragePowerActorAddr - Methods = builtin15.MethodsPower + Address = builtin16.StoragePowerActorAddr + Methods = builtin16.MethodsPower ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -63,6 +63,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -142,6 +145,9 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) { case actorstypes.Version15: return make15(store) + case actorstypes.Version16: + return make16(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -223,5 +229,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/power/v16.go b/chain/actors/builtin/power/v16.go new file mode 100644 index 00000000000..7617c8fd624 --- /dev/null +++ b/chain/actors/builtin/power/v16.go @@ -0,0 +1,215 @@ +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" + builtin16 "github.com/filecoin-project/go-state-types/builtin" + power16 "github.com/filecoin-project/go-state-types/builtin/v16/power" + adt16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store) (State, error) { + out := state16{store: store} + + s, err := power16.ConstructState(store) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state16 struct { + power16.State + store adt.Store +} + +func (s *state16) TotalLocked() (abi.TokenAmount, error) { + return s.TotalPledgeCollateral, nil +} + +func (s *state16) 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 *state16) TotalCommitted() (Claim, error) { + return Claim{ + RawBytePower: s.TotalBytesCommitted, + QualityAdjPower: s.TotalQABytesCommitted, + }, nil +} + +func (s *state16) MinerPower(addr address.Address) (Claim, bool, error) { + claims, err := s.claims() + if err != nil { + return Claim{}, false, err + } + var claim power16.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 *state16) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) { + return s.State.MinerNominalPowerMeetsConsensusMinimum(s.store, a) +} + +func (s *state16) TotalPowerSmoothed() (builtin.FilterEstimate, error) { + return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil +} + +func (s *state16) MinerCounts() (uint64, uint64, error) { + return uint64(s.State.MinerAboveMinPowerCount), uint64(s.State.MinerCount), nil +} + +func (s *state16) RampStartEpoch() int64 { + return s.State.RampStartEpoch +} + +func (s *state16) RampDurationEpochs() uint64 { + return s.State.RampDurationEpochs +} + +func (s *state16) 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 *state16) ForEachClaim(cb func(miner address.Address, claim Claim) error) error { + claims, err := s.claims() + if err != nil { + return err + } + + var claim power16.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 *state16) ClaimsChanged(other State) (bool, error) { + other16, ok := other.(*state16) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + return !s.State.Claims.Equals(other16.State.Claims), nil +} + +func (s *state16) SetTotalQualityAdjPower(p abi.StoragePower) error { + s.State.TotalQualityAdjPower = p + return nil +} + +func (s *state16) SetTotalRawBytePower(p abi.StoragePower) error { + s.State.TotalRawBytePower = p + return nil +} + +func (s *state16) SetThisEpochQualityAdjPower(p abi.StoragePower) error { + s.State.ThisEpochQualityAdjPower = p + return nil +} + +func (s *state16) SetThisEpochRawBytePower(p abi.StoragePower) error { + s.State.ThisEpochRawBytePower = p + return nil +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) claims() (adt.Map, error) { + return adt16.AsMap(s.store, s.Claims, builtin16.DefaultHamtBitwidth) +} + +func (s *state16) decodeClaim(val *cbg.Deferred) (Claim, error) { + var ci power16.Claim + if err := ci.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil { + return Claim{}, err + } + return fromV16Claim(ci), nil +} + +func fromV16Claim(v16 power16.Claim) Claim { + return Claim{ + RawBytePower: v16.RawBytePower, + QualityAdjPower: v16.QualityAdjPower, + } +} + +func (s *state16) ActorKey() string { + return manifest.PowerKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/registry.go b/chain/actors/builtin/registry.go index 0286c35d6d4..f4a1276e385 100644 --- a/chain/actors/builtin/registry.go +++ b/chain/actors/builtin/registry.go @@ -106,6 +106,22 @@ import ( reward15 "github.com/filecoin-project/go-state-types/builtin/v15/reward" system15 "github.com/filecoin-project/go-state-types/builtin/v15/system" verifreg15 "github.com/filecoin-project/go-state-types/builtin/v15/verifreg" + account16 "github.com/filecoin-project/go-state-types/builtin/v16/account" + cron16 "github.com/filecoin-project/go-state-types/builtin/v16/cron" + datacap16 "github.com/filecoin-project/go-state-types/builtin/v16/datacap" + eam16 "github.com/filecoin-project/go-state-types/builtin/v16/eam" + ethaccount16 "github.com/filecoin-project/go-state-types/builtin/v16/ethaccount" + evm16 "github.com/filecoin-project/go-state-types/builtin/v16/evm" + _init16 "github.com/filecoin-project/go-state-types/builtin/v16/init" + market16 "github.com/filecoin-project/go-state-types/builtin/v16/market" + miner16 "github.com/filecoin-project/go-state-types/builtin/v16/miner" + multisig16 "github.com/filecoin-project/go-state-types/builtin/v16/multisig" + paych16 "github.com/filecoin-project/go-state-types/builtin/v16/paych" + placeholder16 "github.com/filecoin-project/go-state-types/builtin/v16/placeholder" + power16 "github.com/filecoin-project/go-state-types/builtin/v16/power" + reward16 "github.com/filecoin-project/go-state-types/builtin/v16/reward" + system16 "github.com/filecoin-project/go-state-types/builtin/v16/system" + verifreg16 "github.com/filecoin-project/go-state-types/builtin/v16/verifreg" account8 "github.com/filecoin-project/go-state-types/builtin/v8/account" cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron" _init8 "github.com/filecoin-project/go-state-types/builtin/v8/init" @@ -977,6 +993,110 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { } } + case actorstypes.Version16: + for key, codeID := range codeIDs { + switch key { + case manifest.AccountKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: account16.Methods, + state: new(account16.State), + }) + case manifest.CronKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: cron16.Methods, + state: new(cron16.State), + }) + case manifest.InitKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: _init16.Methods, + state: new(_init16.State), + }) + case manifest.MarketKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: market16.Methods, + state: new(market16.State), + }) + case manifest.MinerKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: miner16.Methods, + state: new(miner16.State), + }) + case manifest.MultisigKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: multisig16.Methods, + state: new(multisig16.State), + }) + case manifest.PaychKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: paych16.Methods, + state: new(paych16.State), + }) + case manifest.PowerKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: power16.Methods, + state: new(power16.State), + }) + case manifest.RewardKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: reward16.Methods, + state: new(reward16.State), + }) + case manifest.SystemKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: system16.Methods, + state: new(system16.State), + }) + case manifest.VerifregKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: verifreg16.Methods, + state: new(verifreg16.State), + }) + case manifest.DatacapKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: datacap16.Methods, + state: new(datacap16.State), + }) + + case manifest.EvmKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: evm16.Methods, + state: new(evm16.State), + }) + case manifest.EamKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: eam16.Methods, + state: nil, + }) + case manifest.PlaceholderKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: placeholder16.Methods, + state: nil, + }) + case manifest.EthAccountKey: + registry = append(registry, RegistryEntry{ + code: codeID, + methods: ethaccount16.Methods, + state: nil, + }) + + } + } + default: panic("expected version v8 and up only, use specs-actors for v0-7") } diff --git a/chain/actors/builtin/reward/reward.go b/chain/actors/builtin/reward/reward.go index 56fb0d0b82d..4b176285c79 100644 --- a/chain/actors/builtin/reward/reward.go +++ b/chain/actors/builtin/reward/reward.go @@ -6,7 +6,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" @@ -25,8 +25,8 @@ import ( ) var ( - Address = builtin15.RewardActorAddr - Methods = builtin15.MethodsReward + Address = builtin16.RewardActorAddr + Methods = builtin16.MethodsReward ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -61,6 +61,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -140,6 +143,9 @@ func MakeState(store adt.Store, av actorstypes.Version, currRealizedPower abi.St case actorstypes.Version15: return make15(store, currRealizedPower) + case actorstypes.Version16: + return make16(store, currRealizedPower) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -194,5 +200,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/reward/v16.go b/chain/actors/builtin/reward/v16.go new file mode 100644 index 00000000000..8ad92694b67 --- /dev/null +++ b/chain/actors/builtin/reward/v16.go @@ -0,0 +1,122 @@ +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" + miner16 "github.com/filecoin-project/go-state-types/builtin/v16/miner" + reward16 "github.com/filecoin-project/go-state-types/builtin/v16/reward" + smoothing16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store, currRealizedPower abi.StoragePower) (State, error) { + out := state16{store: store} + out.State = *reward16.ConstructState(currRealizedPower) + return &out, nil +} + +type state16 struct { + reward16.State + store adt.Store +} + +func (s *state16) ThisEpochReward() (abi.TokenAmount, error) { + return s.State.ThisEpochReward, nil +} + +func (s *state16) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) { + + return builtin.FilterEstimate{ + PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate, + VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate, + }, nil + +} + +func (s *state16) ThisEpochBaselinePower() (abi.StoragePower, error) { + return s.State.ThisEpochBaselinePower, nil +} + +func (s *state16) TotalStoragePowerReward() (abi.TokenAmount, error) { + return s.State.TotalStoragePowerReward, nil +} + +func (s *state16) EffectiveBaselinePower() (abi.StoragePower, error) { + return s.State.EffectiveBaselinePower, nil +} + +func (s *state16) EffectiveNetworkTime() (abi.ChainEpoch, error) { + return s.State.EffectiveNetworkTime, nil +} + +func (s *state16) CumsumBaseline() (reward16.Spacetime, error) { + return s.State.CumsumBaseline, nil +} + +func (s *state16) CumsumRealized() (reward16.Spacetime, error) { + return s.State.CumsumRealized, nil +} + +func (s *state16) InitialPledgeForPower(qaPower abi.StoragePower, _ abi.TokenAmount, networkQAPower *builtin.FilterEstimate, circSupply abi.TokenAmount, epochsSinceRampStart int64, rampDurationEpochs uint64) (abi.TokenAmount, error) { + return miner16.InitialPledgeForPower( + qaPower, + s.State.ThisEpochBaselinePower, + s.State.ThisEpochRewardSmoothed, + smoothing16.FilterEstimate{ + PositionEstimate: networkQAPower.PositionEstimate, + VelocityEstimate: networkQAPower.VelocityEstimate, + }, + circSupply, + epochsSinceRampStart, + rampDurationEpochs, + ), nil +} + +func (s *state16) PreCommitDepositForPower(networkQAPower builtin.FilterEstimate, sectorWeight abi.StoragePower) (abi.TokenAmount, error) { + return miner16.PreCommitDepositForPower(s.State.ThisEpochRewardSmoothed, + smoothing16.FilterEstimate{ + PositionEstimate: networkQAPower.PositionEstimate, + VelocityEstimate: networkQAPower.VelocityEstimate, + }, + sectorWeight), nil +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) ActorKey() string { + return manifest.RewardKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/system/system.go b/chain/actors/builtin/system/system.go index 5bb1fe44dd0..c677e3df573 100644 --- a/chain/actors/builtin/system/system.go +++ b/chain/actors/builtin/system/system.go @@ -5,7 +5,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -21,7 +21,7 @@ import ( ) var ( - Address = builtin15.SystemActorAddr + Address = builtin16.SystemActorAddr ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -56,6 +56,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -135,6 +138,9 @@ func MakeState(store adt.Store, av actorstypes.Version, builtinActors cid.Cid) ( case actorstypes.Version15: return make15(store, builtinActors) + case actorstypes.Version16: + return make16(store, builtinActors) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -166,5 +172,6 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/builtin/system/v16.go b/chain/actors/builtin/system/v16.go new file mode 100644 index 00000000000..e0bd835de89 --- /dev/null +++ b/chain/actors/builtin/system/v16.go @@ -0,0 +1,72 @@ +package system + +import ( + "fmt" + + "github.com/ipfs/go-cid" + + actorstypes "github.com/filecoin-project/go-state-types/actors" + system16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store, builtinActors cid.Cid) (State, error) { + out := state16{store: store} + out.State = system16.State{ + BuiltinActors: builtinActors, + } + return &out, nil +} + +type state16 struct { + system16.State + store adt.Store +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) GetBuiltinActors() cid.Cid { + + return s.State.BuiltinActors + +} + +func (s *state16) SetBuiltinActors(c cid.Cid) error { + + s.State.BuiltinActors = c + return nil + +} + +func (s *state16) ActorKey() string { + return manifest.SystemKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/verifreg/v16.go b/chain/actors/builtin/verifreg/v16.go new file mode 100644 index 00000000000..d05bd2e573e --- /dev/null +++ b/chain/actors/builtin/verifreg/v16.go @@ -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" + builtin16 "github.com/filecoin-project/go-state-types/builtin" + adt16 "github.com/filecoin-project/go-state-types/builtin/v16/util/adt" + verifreg16 "github.com/filecoin-project/go-state-types/builtin/v16/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 = (*state16)(nil) + +func load16(store adt.Store, root cid.Cid) (State, error) { + out := state16{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make16(store adt.Store, rootKeyAddress address.Address) (State, error) { + out := state16{store: store} + + s, err := verifreg16.ConstructState(store, rootKeyAddress) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state16 struct { + verifreg16.State + store adt.Store +} + +func (s *state16) RootKey() (address.Address, error) { + return s.State.RootKey, nil +} + +func (s *state16) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) { + + return false, big.Zero(), xerrors.Errorf("unsupported in actors v16") + +} + +func (s *state16) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) { + return getDataCap(s.store, actors.Version16, s.verifiers, addr) +} + +func (s *state16) RemoveDataCapProposalID(verifier address.Address, client address.Address) (bool, uint64, error) { + return getRemoveDataCapProposalID(s.store, actors.Version16, s.removeDataCapProposalIDs, verifier, client) +} + +func (s *state16) ForEachVerifier(cb func(addr address.Address, dcap abi.StoragePower) error) error { + return forEachCap(s.store, actors.Version16, s.verifiers, cb) +} + +func (s *state16) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error { + + return xerrors.Errorf("unsupported in actors v16") + +} + +func (s *state16) verifiedClients() (adt.Map, error) { + + return nil, xerrors.Errorf("unsupported in actors v16") + +} + +func (s *state16) verifiers() (adt.Map, error) { + return adt16.AsMap(s.store, s.Verifiers, builtin16.DefaultHamtBitwidth) +} + +func (s *state16) removeDataCapProposalIDs() (adt.Map, error) { + return adt16.AsMap(s.store, s.RemoveDataCapProposalIDs, builtin16.DefaultHamtBitwidth) +} + +func (s *state16) GetState() interface{} { + return &s.State +} + +func (s *state16) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) { + + alloc, ok, err := s.FindAllocation(s.store, clientIdAddr, verifreg16.AllocationId(allocationId)) + return (*Allocation)(alloc), ok, err +} + +func (s *state16) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) { + + v16Map, err := s.LoadAllocationsToMap(s.store, clientIdAddr) + + retMap := make(map[AllocationId]Allocation, len(v16Map)) + for k, v := range v16Map { + retMap[AllocationId(k)] = Allocation(v) + } + + return retMap, err + +} + +func (s *state16) GetAllAllocations() (map[AllocationId]Allocation, error) { + + v16Map, err := s.State.GetAllAllocations(s.store) + + retMap := make(map[AllocationId]Allocation, len(v16Map)) + for k, v := range v16Map { + retMap[AllocationId(k)] = Allocation(v) + } + + return retMap, err + +} + +func (s *state16) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) { + + claim, ok, err := s.FindClaim(s.store, providerIdAddr, verifreg16.ClaimId(claimId)) + return (*Claim)(claim), ok, err + +} + +func (s *state16) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) { + + v16Map, err := s.LoadClaimsToMap(s.store, providerIdAddr) + + retMap := make(map[ClaimId]Claim, len(v16Map)) + for k, v := range v16Map { + retMap[ClaimId(k)] = Claim(v) + } + + return retMap, err + +} + +func (s *state16) GetAllClaims() (map[ClaimId]Claim, error) { + + v16Map, err := s.State.GetAllClaims(s.store) + + retMap := make(map[ClaimId]Claim, len(v16Map)) + for k, v := range v16Map { + retMap[ClaimId(k)] = Claim(v) + } + + return retMap, err + +} + +func (s *state16) GetClaimIdsBySector(providerIdAddr address.Address) (map[abi.SectorNumber][]ClaimId, error) { + + v16Map, err := s.LoadClaimsToMap(s.store, providerIdAddr) + + retMap := make(map[abi.SectorNumber][]ClaimId) + for k, v := range v16Map { + 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 *state16) ActorKey() string { + return manifest.VerifregKey +} + +func (s *state16) ActorVersion() actorstypes.Version { + return actorstypes.Version16 +} + +func (s *state16) 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 +} diff --git a/chain/actors/builtin/verifreg/verifreg.go b/chain/actors/builtin/verifreg/verifreg.go index 02d8aa116fd..779c1bd292f 100644 --- a/chain/actors/builtin/verifreg/verifreg.go +++ b/chain/actors/builtin/verifreg/verifreg.go @@ -7,7 +7,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" - builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "github.com/filecoin-project/go-state-types/builtin" verifregtypes12 "github.com/filecoin-project/go-state-types/builtin/v12/verifreg" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/go-state-types/cbor" @@ -26,8 +26,8 @@ import ( ) var ( - Address = builtin15.VerifiedRegistryActorAddr - Methods = builtin15.MethodsVerifiedRegistry + Address = builtin16.VerifiedRegistryActorAddr + Methods = builtin16.MethodsVerifiedRegistry ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -62,6 +62,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case actorstypes.Version15: return load15(store, act.Head) + case actorstypes.Version16: + return load16(store, act.Head) + } } @@ -141,6 +144,9 @@ func MakeState(store adt.Store, av actorstypes.Version, rootKeyAddress address.A case actorstypes.Version15: return make15(store, rootKeyAddress) + case actorstypes.Version16: + return make16(store, rootKeyAddress) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -185,6 +191,7 @@ func AllCodes() []cid.Cid { (&state13{}).Code(), (&state14{}).Code(), (&state15{}).Code(), + (&state16{}).Code(), } } diff --git a/chain/actors/policy/policy.go b/chain/actors/policy/policy.go index 1f488518dea..17c966a2002 100644 --- a/chain/actors/policy/policy.go +++ b/chain/actors/policy/policy.go @@ -12,6 +12,7 @@ import ( builtin13 "github.com/filecoin-project/go-state-types/builtin" builtin14 "github.com/filecoin-project/go-state-types/builtin" builtin15 "github.com/filecoin-project/go-state-types/builtin" + builtin16 "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" market10 "github.com/filecoin-project/go-state-types/builtin/v10/market" @@ -31,8 +32,11 @@ import ( verifreg14 "github.com/filecoin-project/go-state-types/builtin/v14/verifreg" market15 "github.com/filecoin-project/go-state-types/builtin/v15/market" miner15 "github.com/filecoin-project/go-state-types/builtin/v15/miner" - paych15 "github.com/filecoin-project/go-state-types/builtin/v15/paych" verifreg15 "github.com/filecoin-project/go-state-types/builtin/v15/verifreg" + market16 "github.com/filecoin-project/go-state-types/builtin/v16/market" + miner16 "github.com/filecoin-project/go-state-types/builtin/v16/miner" + paych16 "github.com/filecoin-project/go-state-types/builtin/v16/paych" + verifreg16 "github.com/filecoin-project/go-state-types/builtin/v16/verifreg" market8 "github.com/filecoin-project/go-state-types/builtin/v8/market" miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner" verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg" @@ -71,14 +75,14 @@ import ( ) const ( - ChainFinality = miner15.ChainFinality + ChainFinality = miner16.ChainFinality SealRandomnessLookback = ChainFinality - PaychSettleDelay = paych15.SettleDelay - MaxPreCommitRandomnessLookback = builtin15.EpochsInDay + SealRandomnessLookback + PaychSettleDelay = paych16.SettleDelay + MaxPreCommitRandomnessLookback = builtin16.EpochsInDay + SealRandomnessLookback ) var ( - MarketDefaultAllocationTermBuffer = market15.MarketDefaultAllocationTermBuffer + MarketDefaultAllocationTermBuffer = market16.MarketDefaultAllocationTermBuffer ) // SetSupportedProofTypes sets supported proof types, across all actor versions. @@ -199,11 +203,13 @@ func SetPreCommitChallengeDelay(delay abi.ChainEpoch) { miner15.PreCommitChallengeDelay = delay + miner16.PreCommitChallengeDelay = delay + } func GetPreCommitChallengeDelay() abi.ChainEpoch { // TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay. - return miner15.PreCommitChallengeDelay + return miner16.PreCommitChallengeDelay } // SetConsensusMinerMinPower sets the minimum power of an individual miner must @@ -269,6 +275,10 @@ func SetConsensusMinerMinPower(p abi.StoragePower) { policy.ConsensusMinerMinPower = p } + for _, policy := range builtin16.PoStProofPolicies { + policy.ConsensusMinerMinPower = p + } + } // SetMinVerifiedDealSize sets the minimum size of a verified deal. This should @@ -305,6 +315,8 @@ func SetMinVerifiedDealSize(size abi.StoragePower) { verifreg15.MinVerifiedDealSize = size + verifreg16.MinVerifiedDealSize = size + } func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) { @@ -370,6 +382,10 @@ func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProo return miner15.MaxProveCommitDuration[t], nil + case actorstypes.Version16: + + return miner16.MaxProveCommitDuration[t], nil + default: return 0, xerrors.Errorf("unsupported actors version") } @@ -450,6 +466,11 @@ func SetProviderCollateralSupplyTarget(num, denom big.Int) { Denominator: denom, } + market16.ProviderCollateralSupplyTarget = builtin16.BigFrac{ + Numerator: num, + Denominator: denom, + } + } func DealProviderCollateralBounds( @@ -538,13 +559,18 @@ func DealProviderCollateralBounds( min, max := market15.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil) return min, max, nil + case actorstypes.Version16: + + min, max := market16.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil) + return min, max, nil + default: return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version") } } func DealDurationBounds(pieceSize abi.PaddedPieceSize) (min, max abi.ChainEpoch) { - return market15.DealDurationBounds(pieceSize) + return market16.DealDurationBounds(pieceSize) } // SetWPoStChallengeWindow sets the challenge window and scales the proving period to match (such @@ -648,6 +674,13 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) { // scale it if we're scaling the challenge period. miner15.WPoStDisputeWindow = period * 30 + miner16.WPoStChallengeWindow = period + miner16.WPoStProvingPeriod = period * abi.ChainEpoch(miner16.WPoStPeriodDeadlines) + + // by default, this is 2x finality which is 30 periods. + // scale it if we're scaling the challenge period. + miner16.WPoStDisputeWindow = period * 30 + } func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch { @@ -711,6 +744,9 @@ func GetMaxSectorExpirationExtension(nv network.Version) (abi.ChainEpoch, error) case actorstypes.Version15: return miner15.MaxSectorExpirationExtension, nil + case actorstypes.Version16: + return miner16.MaxSectorExpirationExtension, nil + default: return 0, xerrors.Errorf("unsupported network version") } @@ -718,11 +754,11 @@ func GetMaxSectorExpirationExtension(nv network.Version) (abi.ChainEpoch, error) } func GetMinSectorExpiration() abi.ChainEpoch { - return miner15.MinSectorExpiration + return miner16.MinSectorExpiration } func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) { - sectorsPerPart, err := builtin15.PoStProofWindowPoStPartitionSectors(p) + sectorsPerPart, err := builtin16.PoStProofWindowPoStPartitionSectors(p) if err != nil { return 0, err } @@ -731,7 +767,7 @@ func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, e return 0, err } - return min(miner15.PoStedPartitionsMax, int(uint64(maxSectors)/sectorsPerPart)), nil + return min(miner16.PoStedPartitionsMax, int(uint64(maxSectors)/sectorsPerPart)), nil } func GetDefaultAggregationProof() abi.RegisteredAggregationProof { @@ -743,7 +779,7 @@ func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version) return builtin4.SealProofPoliciesV0[proof].SectorMaxLifetime } - return builtin15.SealProofPoliciesV11[proof].SectorMaxLifetime + return builtin16.SealProofPoliciesV11[proof].SectorMaxLifetime } func GetAddressedSectorsMax(nwVer network.Version) (int, error) { @@ -798,6 +834,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) { case actorstypes.Version15: return miner15.AddressedSectorsMax, nil + case actorstypes.Version16: + return miner16.AddressedSectorsMax, nil + default: return 0, xerrors.Errorf("unsupported network version") } @@ -871,6 +910,10 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) { return miner15.DeclarationsMax, nil + case actorstypes.Version16: + + return miner16.DeclarationsMax, nil + default: return 0, xerrors.Errorf("unsupported network version") } @@ -943,6 +986,10 @@ func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, ba return miner15.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil + case actorstypes.Version16: + + return miner16.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil + default: return big.Zero(), xerrors.Errorf("unsupported network version") } @@ -1015,6 +1062,10 @@ func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, base return miner15.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil + case actorstypes.Version16: + + return miner16.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil + default: return big.Zero(), xerrors.Errorf("unsupported network version") } diff --git a/chain/actors/version.go b/chain/actors/version.go index 86199d0cf17..d1cb9ac3d46 100644 --- a/chain/actors/version.go +++ b/chain/actors/version.go @@ -14,9 +14,9 @@ const ({{range .actorVersions}} /* inline-gen start */ -var LatestVersion = 15 +var LatestVersion = 16 -var Versions = []int{0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} +var Versions = []int{0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} const ( Version0 Version = 0 @@ -34,6 +34,7 @@ const ( Version13 Version = 13 Version14 Version = 14 Version15 Version = 15 + Version16 Version = 16 ) /* inline-gen end */ diff --git a/chain/consensus/compute_state.go b/chain/consensus/compute_state.go index 62a4c495138..51ebb51371e 100644 --- a/chain/consensus/compute_state.go +++ b/chain/consensus/compute_state.go @@ -56,6 +56,7 @@ func NewActorRegistry() *vm.ActorRegistry { inv.Register(actorstypes.Version13, vm.ActorsVersionPredicate(actorstypes.Version13), builtin.MakeRegistry(actorstypes.Version13)) inv.Register(actorstypes.Version14, vm.ActorsVersionPredicate(actorstypes.Version14), builtin.MakeRegistry(actorstypes.Version14)) inv.Register(actorstypes.Version15, vm.ActorsVersionPredicate(actorstypes.Version15), builtin.MakeRegistry(actorstypes.Version15)) + inv.Register(actorstypes.Version16, vm.ActorsVersionPredicate(actorstypes.Version16), builtin.MakeRegistry(actorstypes.Version16)) return inv } diff --git a/chain/consensus/filcns/upgrades.go b/chain/consensus/filcns/upgrades.go index 3aac1cdb060..839288a0594 100644 --- a/chain/consensus/filcns/upgrades.go +++ b/chain/consensus/filcns/upgrades.go @@ -31,6 +31,7 @@ import ( nv22 "github.com/filecoin-project/go-state-types/builtin/v13/migration" nv23 "github.com/filecoin-project/go-state-types/builtin/v14/migration" nv24 "github.com/filecoin-project/go-state-types/builtin/v15/migration" + nv25 "github.com/filecoin-project/go-state-types/builtin/v16/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/migration" @@ -329,6 +330,17 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { StopWithin: 10, }}, Expensive: true, + }, { + Height: buildconstants.UpgradeXxHeight, + Network: network.Version25, + Migration: UpgradeActorsV16, + PreMigrations: []stmgr.PreMigration{{ + PreMigration: PreUpgradeActorsV16, + StartWithin: 120, + DontStartWithin: 15, + StopWithin: 10, + }}, + Expensive: true, }, } @@ -2728,6 +2740,108 @@ func upgradeActorsV15Common( return newRoot, nil } +func PreUpgradeActorsV16(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 = upgradeActorsV16Common(ctx, sm, cache, lbRoot, epoch, lbts, config) + return err +} + +func UpgradeActorsV16(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 := upgradeActorsV16Common(ctx, sm, cache, root, epoch, ts, config) + if err != nil { + return cid.Undef, xerrors.Errorf("migrating actors vXX state: %w", err) + } + return newRoot, nil +} + +func upgradeActorsV16Common( + 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.Version16); 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 vXX+1 upgrade, got %d", + stateRoot.Version, + ) + } + + manifest, ok := actors.GetManifest(actorstypes.Version16) + if !ok { + return cid.Undef, xerrors.Errorf("no manifest CID for vXX+1 upgrade") + } + + // Perform the migration + newHamtRoot, err := nv25.MigrateStateTree(ctx, adtStore, manifest, stateRoot.Actors, epoch, config, + migrationLogger{}, cache) + if err != nil { + return cid.Undef, xerrors.Errorf("upgrading to actors vXX+1: %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 diff --git a/chain/state/statetree.go b/chain/state/statetree.go index de822003306..bea0c07c3a8 100644 --- a/chain/state/statetree.go +++ b/chain/state/statetree.go @@ -157,7 +157,7 @@ func VersionForNetwork(ver network.Version) (types.StateTreeVersion, error) { case network.Version13, network.Version14, network.Version15, network.Version16, network.Version17: return types.StateTreeVersion4, nil - case network.Version18, network.Version19, network.Version20, network.Version21, network.Version22, network.Version23, network.Version24: + case network.Version18, network.Version19, network.Version20, network.Version21, network.Version22, network.Version23, network.Version24, network.Version25: return types.StateTreeVersion5, nil default: diff --git a/cmd/lotus-shed/invariants.go b/cmd/lotus-shed/invariants.go index e8a6e734af9..bc994bbe633 100644 --- a/cmd/lotus-shed/invariants.go +++ b/cmd/lotus-shed/invariants.go @@ -21,6 +21,7 @@ import ( v13 "github.com/filecoin-project/go-state-types/builtin/v13" v14 "github.com/filecoin-project/go-state-types/builtin/v14" v15 "github.com/filecoin-project/go-state-types/builtin/v15" + v16 "github.com/filecoin-project/go-state-types/builtin/v16" v8 "github.com/filecoin-project/go-state-types/builtin/v8" v9 "github.com/filecoin-project/go-state-types/builtin/v9" @@ -203,6 +204,11 @@ var invariantsCmd = &cli.Command{ if err != nil { return xerrors.Errorf("checking state invariants: %w", err) } + case actorstypes.Version16: + messages, err = v16.CheckStateInvariants(actorTree, abi.ChainEpoch(epoch), actorCodeCids) + if err != nil { + return xerrors.Errorf("checking state invariants: %w", err) + } default: return xerrors.Errorf("unsupported actor version: %v", av) } diff --git a/cmd/lotus-shed/migrations.go b/cmd/lotus-shed/migrations.go index 10b7d073d5f..be0ef834c4d 100644 --- a/cmd/lotus-shed/migrations.go +++ b/cmd/lotus-shed/migrations.go @@ -38,6 +38,7 @@ import ( adt13 "github.com/filecoin-project/go-state-types/builtin/v13/util/adt" v14 "github.com/filecoin-project/go-state-types/builtin/v14" v15 "github.com/filecoin-project/go-state-types/builtin/v15" + v16 "github.com/filecoin-project/go-state-types/builtin/v16" market8 "github.com/filecoin-project/go-state-types/builtin/v8/market" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" v9 "github.com/filecoin-project/go-state-types/builtin/v9" @@ -297,6 +298,8 @@ func getMigrationFuncsForNetwork(nv network.Version) (UpgradeActorsFunc, PreUpgr return filcns.UpgradeActorsV14, filcns.PreUpgradeActorsV14, checkNv23Invariants, nil case network.Version24: return filcns.UpgradeActorsV15, filcns.PreUpgradeActorsV15, checkNv24Invariants, nil + case network.Version25: + return filcns.UpgradeActorsV16, filcns.PreUpgradeActorsV16, checkNv25Invariants, nil default: return nil, nil, nil, xerrors.Errorf("migration not implemented for nv%d", nv) } @@ -625,6 +628,39 @@ func printMarketActorDiff(ctx context.Context, cst *cbornode.BasicIpldStore, nv return nil } +func checkNv25Invariants(ctx context.Context, oldStateRootCid cid.Cid, newStateRootCid cid.Cid, bs blockstore.Blockstore, epoch abi.ChainEpoch) error { + + actorStore := store.ActorStore(ctx, bs) + startTime := time.Now() + + // Load the new state root. + var newStateRoot types.StateRoot + if err := actorStore.Get(ctx, newStateRootCid, &newStateRoot); err != nil { + return xerrors.Errorf("failed to decode state root: %w", err) + } + + actorCodeCids, err := actors.GetActorCodeIDs(actorstypes.Version16) + if err != nil { + return err + } + newActorTree, err := builtin.LoadTree(actorStore, newStateRoot.Actors) + if err != nil { + return err + } + messages, err := v16.CheckStateInvariants(newActorTree, epoch, actorCodeCids) + if err != nil { + return xerrors.Errorf("checking state invariants: %w", err) + } + + for _, message := range messages.Messages() { + fmt.Println("got the following error: ", message) + } + + fmt.Println("completed invariant checks, took ", time.Since(startTime)) + + return nil +} + func checkNv24Invariants(ctx context.Context, oldStateRootCid cid.Cid, newStateRootCid cid.Cid, bs blockstore.Blockstore, epoch abi.ChainEpoch) error { actorStore := store.ActorStore(ctx, bs) diff --git a/documentation/en/api-v0-methods-miner.md b/documentation/en/api-v0-methods-miner.md index 5e22a9efa7f..8eead363f3a 100644 --- a/documentation/en/api-v0-methods-miner.md +++ b/documentation/en/api-v0-methods-miner.md @@ -400,7 +400,7 @@ Inputs: ], "Bw==", 10101, - 24 + 25 ] ``` diff --git a/documentation/en/api-v0-methods.md b/documentation/en/api-v0-methods.md index b34c7ca5565..d2fabb1114e 100644 --- a/documentation/en/api-v0-methods.md +++ b/documentation/en/api-v0-methods.md @@ -3655,7 +3655,7 @@ Perms: read Inputs: ```json [ - 24 + 25 ] ``` @@ -3670,7 +3670,7 @@ Perms: read Inputs: ```json [ - 24 + 25 ] ``` @@ -4484,7 +4484,8 @@ Response: "UpgradeDragonHeight": 10101, "UpgradePhoenixHeight": 10101, "UpgradeWaffleHeight": 10101, - "UpgradeTuktukHeight": 10101 + "UpgradeTuktukHeight": 10101, + "UpgradeXxHeight": 10101 }, "Eip155ChainID": 123 } @@ -5410,7 +5411,7 @@ Inputs: ] ``` -Response: `24` +Response: `25` ### StateReadState StateReadState returns the indicated actor's state. diff --git a/documentation/en/api-v1-unstable-methods.md b/documentation/en/api-v1-unstable-methods.md index 6becf849f81..ac72740bf0a 100644 --- a/documentation/en/api-v1-unstable-methods.md +++ b/documentation/en/api-v1-unstable-methods.md @@ -5874,7 +5874,7 @@ Perms: read Inputs: ```json [ - 24 + 25 ] ``` @@ -5889,7 +5889,7 @@ Perms: read Inputs: ```json [ - 24 + 25 ] ``` @@ -6802,7 +6802,8 @@ Response: "UpgradeDragonHeight": 10101, "UpgradePhoenixHeight": 10101, "UpgradeWaffleHeight": 10101, - "UpgradeTuktukHeight": 10101 + "UpgradeTuktukHeight": 10101, + "UpgradeXxHeight": 10101 }, "Eip155ChainID": 123 } @@ -7817,7 +7818,7 @@ Inputs: ] ``` -Response: `24` +Response: `25` ### StateReadState StateReadState returns the indicated actor's state. diff --git a/extern/filecoin-ffi b/extern/filecoin-ffi index 72b081de3c8..dfe9d750a23 160000 --- a/extern/filecoin-ffi +++ b/extern/filecoin-ffi @@ -1 +1 @@ -Subproject commit 72b081de3c80dd0f5040921e0038aff8d07994f4 +Subproject commit dfe9d750a23f77b7671fb1a2baf9c966de3164df diff --git a/gen/inlinegen-data.json b/gen/inlinegen-data.json index 59112f29065..e6224bcfbd4 100644 --- a/gen/inlinegen-data.json +++ b/gen/inlinegen-data.json @@ -1,7 +1,7 @@ { - "actorVersions": [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], - "latestActorsVersion": 15, + "actorVersions": [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], + "latestActorsVersion": 16, - "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, 24], - "latestNetworkVersion": 24 + "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, 24, 25], + "latestNetworkVersion": 25 } diff --git a/go.mod b/go.mod index 42100a1f73a..c25df224d20 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( github.com/elastic/gosigar v0.14.2 github.com/etclabscore/go-openrpc-reflect v0.0.36 github.com/fatih/color v1.15.0 - github.com/filecoin-project/filecoin-ffi v1.30.0 + github.com/filecoin-project/filecoin-ffi v1.31.0 github.com/filecoin-project/go-address v1.2.0 github.com/filecoin-project/go-amt-ipld/v4 v4.4.0 github.com/filecoin-project/go-bitfield v0.2.4 @@ -50,7 +50,7 @@ require ( github.com/filecoin-project/go-jsonrpc v0.7.0 github.com/filecoin-project/go-padreader v0.0.1 github.com/filecoin-project/go-paramfetch v0.0.4 - github.com/filecoin-project/go-state-types v0.15.0 + github.com/filecoin-project/go-state-types v0.16.0-dev github.com/filecoin-project/go-statemachine v1.0.3 github.com/filecoin-project/go-statestore v0.2.0 github.com/filecoin-project/go-storedcounter v0.1.0 @@ -154,12 +154,12 @@ require ( go.uber.org/fx v1.22.1 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.28.0 + golang.org/x/crypto v0.29.0 golang.org/x/mod v0.20.0 golang.org/x/net v0.29.0 - golang.org/x/sync v0.8.0 - golang.org/x/sys v0.26.0 - golang.org/x/term v0.25.0 + golang.org/x/sync v0.9.0 + golang.org/x/sys v0.27.0 + golang.org/x/term v0.26.0 golang.org/x/time v0.5.0 golang.org/x/tools v0.24.0 golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da @@ -332,7 +332,7 @@ require ( go.uber.org/mock v0.4.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/text v0.20.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect google.golang.org/grpc v1.64.0 // indirect diff --git a/go.sum b/go.sum index 0de1d7a9d05..804e730c9e9 100644 --- a/go.sum +++ b/go.sum @@ -298,8 +298,8 @@ github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= 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.15.0 h1:GaUSCti0tGMzLg7fVpRjtNVGBvirbMFzLfyWbR+qzWE= -github.com/filecoin-project/go-state-types v0.15.0/go.mod h1:2okQFn4DVOt5Bs6OFh0lLSzn8p7Vczh8XjgaKLKhKgI= +github.com/filecoin-project/go-state-types v0.16.0-dev h1:66GP8xfo0elYdLLGxQ4LcAhAvOqKf4IiJkRYxU7UH2M= +github.com/filecoin-project/go-state-types v0.16.0-dev/go.mod h1:k0/j7i06QHRet86mv9/8gregMq59tv+yCr655G9zsX8= 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-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI= @@ -1447,8 +1447,8 @@ golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98y golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1573,8 +1573,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1665,8 +1665,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1680,8 +1680,8 @@ golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= -golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= +golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1695,8 +1695,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/itests/kit/ensemble_opts_nv.go b/itests/kit/ensemble_opts_nv.go index 758d8faafb8..8cdf1a635c6 100644 --- a/itests/kit/ensemble_opts_nv.go +++ b/itests/kit/ensemble_opts_nv.go @@ -35,12 +35,12 @@ func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt { }) /* inline-gen start */ return UpgradeSchedule(stmgr.Upgrade{ - Network: network.Version23, + Network: network.Version24, Height: -1, }, stmgr.Upgrade{ - Network: network.Version24, + Network: network.Version25, Height: upgradeHeight, - Migration: filcns.UpgradeActorsV15, + Migration: filcns.UpgradeActorsV16, }) /* inline-gen end */ } diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 74adf72b215..10ce3648ea1 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -2060,6 +2060,7 @@ func (a *StateAPI) StateGetNetworkParams(ctx context.Context) (*api.NetworkParam UpgradePhoenixHeight: buildconstants.UpgradePhoenixHeight, UpgradeWaffleHeight: buildconstants.UpgradeWaffleHeight, UpgradeTuktukHeight: buildconstants.UpgradeTuktukHeight, + UpgradeXxHeight: buildconstants.UpgradeXxHeight, }, }, nil }