Merge branch 'release/v1.20.0' into raulk/timestamp-null-rounds

This commit is contained in:
Raúl Kripalani 2023-02-09 22:58:08 +00:00
commit d30ace0518
72 changed files with 6219 additions and 728 deletions

View File

@ -603,6 +603,11 @@ workflows:
suite: itest-deals
target: "./itests/deals_test.go"
- test:
name: test-itest-decode_params
suite: itest-decode_params
target: "./itests/decode_params_test.go"
- test:
name: test-itest-dup_mpool_messages
suite: itest-dup_mpool_messages
@ -628,6 +633,11 @@ workflows:
suite: itest-eth_config
target: "./itests/eth_config_test.go"
- test:
name: test-itest-eth_conformance
suite: itest-eth_conformance
target: "./itests/eth_conformance_test.go"
- test:
name: test-itest-eth_deploy
suite: itest-eth_deploy

View File

@ -298,7 +298,7 @@ actors-gen: actors-code-gen fiximports
.PHONY: actors-gen
bundle-gen:
$(GOCC) run ./gen/bundle
$(GOCC) run ./gen/bundle $(RELEASE)
$(GOCC) fmt ./build/...
.PHONY: bundle-gen
@ -354,7 +354,7 @@ docsgen-openrpc-gateway: docsgen-openrpc-bin
fiximports:
./scripts/fiximports
gen: actors-code-gen type-gen cfgdoc-gen docsgen api-gen circleci bundle-gen fiximports
gen: actors-code-gen type-gen cfgdoc-gen docsgen api-gen circleci fiximports
@echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO MAKE docsgen-cli"
.PHONY: gen

View File

@ -52,4 +52,4 @@ popd
echo "Generating metadata..."
make -C ../../ bundle-gen
make -C ../../ RELEASE="$RELEASE" bundle-gen

Binary file not shown.

Binary file not shown.

View File

@ -99,6 +99,7 @@ type BuiltinActorsMetadata struct {
Version actorstypes.Version
ManifestCid cid.Cid
Actors map[string]cid.Cid
BundleGitTag string
}
// ReadEmbeddedBuiltinActorsMetadata reads the metadata from the embedded built-in actor bundles.

View File

@ -31,46 +31,42 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "butterflynet",
Version: 9,
ManifestCid: MustParseCid("bafy2bzaceba5qgs4z3imhlxwds5vamahngatvuuglbv5yl3ftfiosj6ud5chs"),
ManifestCid: MustParseCid("bafy2bzacec35by4erhcdgcsgzp7yb3j57utydlxxfc73m3k5pep67ehvvyv6i"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebd5zetyjtragjwrv2nqktct6u2pmsi4eifbanovxohx3a7lszjxi"),
"cron": MustParseCid("bafk2bzacecrszortqkc7har77ssgajglymv6ftrqvmdko5h2yqqh5k2qospl2"),
"datacap": MustParseCid("bafk2bzacecapjnxnyw4talwqv5ajbtbkzmzqiosztj5cb3sortyp73ndjl76e"),
"eam": MustParseCid("bafk2bzacecflry2dyjqj6fhpovkbcbei377zabectznuxsf6bxggsve7bsxga"),
"ethaccount": MustParseCid("bafk2bzacedl4pmkfxkzoqajs6im3ranmopozsmxjcxsnk3kwvd3vv7mfwwrf4"),
"evm": MustParseCid("bafk2bzacebgzvmvwv7rsnnhp3zhqbiqkumvyrc7pazfovpptgpgtqkalrli74"),
"init": MustParseCid("bafk2bzacecbxp66q3ytjkg37nyv4rmzezbfaigvx4i5yhvqbm5gg4amjeaias"),
"multisig": MustParseCid("bafk2bzacecjltag3mn75dsnmrmopjow27buxqhabissowayqlmavrcfetqswc"),
"paymentchannel": MustParseCid("bafk2bzacednzxg263eqbl2imwz3uhujov63tjkffieyl4hl3dhrgxyhwep6hc"),
"placeholder": MustParseCid("bafk2bzaceaamp2a35vpfml4skap4dffklzae2urcm34mtwwce2lvhaons3a5y"),
"reward": MustParseCid("bafk2bzacectp23cxsbbdrr3uggnw7f263qll5wkkfzqhn5yq37ae2ehdjdzri"),
"storagemarket": MustParseCid("bafk2bzacea45ko3ezkpeujsniovncwnizc4wsxd7kyckskhs7gvzwthzb2mqe"),
"storageminer": MustParseCid("bafk2bzaced74qthwrl3gahcf7o3vrdrodbcqhlplh6fykbgy5sd2iyouhq44c"),
"storagepower": MustParseCid("bafk2bzaceduksv6wqthr5fgp7mx5prv6gzul2oozf3svrjbuggc4bgokdxgfy"),
"system": MustParseCid("bafk2bzacebe6j2ius6clbbr7dypsg54jzmn5xablzunph7ebedw6yhwla4cj2"),
"verifiedregistry": MustParseCid("bafk2bzacebu4joy25gneu2qv3qfm3ktakzalndjrbhekeqrqk3zhotv6nyy2g"),
"account": MustParseCid("bafk2bzaceajsdln7v4chxqoukiw7lxw6aexg5qdsaex2hgelz2sbu24iblhzg"),
"cron": MustParseCid("bafk2bzacecgrwmgnqhybn3l23uvwf2n2vrcfjrprfzgd44uxers2pgr5mhsue"),
"datacap": MustParseCid("bafk2bzacebyier2ceh27acbrq2ccv4efvzotl6qntnlrxdsrik6i4tembz6qw"),
"init": MustParseCid("bafk2bzaceberhto43wnf4pklkd4c7d36kzslngyzyms4op7shxuswv3dtvfxu"),
"multisig": MustParseCid("bafk2bzaceaclpbrhoqdruvsuqqgknvy2k5dywzmjoehk4uarce3uvt3w2rewu"),
"paymentchannel": MustParseCid("bafk2bzacedzp56g5cg73oilloak3kf7u667rdkd5pgnhe2cljmr3o7ykcrzuk"),
"reward": MustParseCid("bafk2bzacebczbwfbbi6mvppbjcozatasjiaohvjjiqcy65ccuuyyw3xiixhk2"),
"storagemarket": MustParseCid("bafk2bzaceawqexy6t2ybzh3jjwhbs7icbg5vqnedbbge4e4r4pfp7spkcadsu"),
"storageminer": MustParseCid("bafk2bzacearemd7pn2jj26fdtqd4di27lfhpng3vp5chepm7qnmdzgiqr6wfi"),
"storagepower": MustParseCid("bafk2bzaceddc7fiaxfobfegqaobf5xinjgmhsa5iu4yi6klvc3jmjimcdvgyg"),
"system": MustParseCid("bafk2bzacedylltr57b2n6zpadh4i2c2kis4fzzvhao3kgvfaggrrbqyacew7q"),
"verifiedregistry": MustParseCid("bafk2bzacecjkesz766626ab4svnzpq3jfs26a75vfktlfaku5fjdao2eyiqyq"),
},
}, {
Network: "butterflynet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacedsgi3wpyd46hbktrleolnlepzsm6k466fcrxuc7keht4guokgxiy"),
ManifestCid: MustParseCid("bafy2bzacecicijumaz6c5vpqwidz3kmfkn64wp76odwfo6ekvzjbx4gizrara"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebz7dm3vcuqtzzcf5jwvcubz6ecqk52t5rsd36fyzka2iosy4l4ro"),
"cron": MustParseCid("bafk2bzacea6qtj2wkbe2wq5vxc2knlnj3vdvk4bkjp36xtazgzhnegd2uaj7m"),
"datacap": MustParseCid("bafk2bzacedwxkx3jz7qwv5iwozadz7t5hhw5dtlgdxuwqxdp6oqguas7nakjk"),
"eam": MustParseCid("bafk2bzacedoegh4idwvhjqahfnbqq6aqzgccgjwumudx6ihfut36ng57or7fi"),
"ethaccount": MustParseCid("bafk2bzacebn6l3x7d2i6lv72osbgcl4a37imexh5ou5kvbmj56taetwcyyhgq"),
"evm": MustParseCid("bafk2bzaced5gaxg5mz3hho473aszx5brgjriicqgrcbqctnyyn2e6vcxv3ule"),
"init": MustParseCid("bafk2bzacecbo6ggprh7sz3oy6uu5raykwngqmnjdsiijdrgp4glet3mb65ywo"),
"multisig": MustParseCid("bafk2bzacecmu3bhbg4rh5sqbagjlvrpb6ip5k3pngq22a33ok44yuhk75zenq"),
"paymentchannel": MustParseCid("bafk2bzacebth7fqe5xts6hbm7m6n733qcu6b6atd7ur6l7jhddferjgpxdy4s"),
"account": MustParseCid("bafk2bzacedknkusm7lnhjpfe7djkxu6kwlqclsq7yk3s7h2wqtet2teul7hla"),
"cron": MustParseCid("bafk2bzacecvf4au52ks3btpfedsffhzkjvtogawsmpypjo4ddolszmszj62om"),
"datacap": MustParseCid("bafk2bzacecrgz4pzuonchcpbugavlmdrsakmz2qsjlpbt22yxum5r33tqkrls"),
"eam": MustParseCid("bafk2bzacecb4i45ifsj3kyeoglherbtc4dc37qrfa7meq37qtpio5gr6jcely"),
"ethaccount": MustParseCid("bafk2bzacec4l6ya2bate7r3yv7sutfhp4fmtcoxun36d4ltfdslczdgms2sx2"),
"evm": MustParseCid("bafk2bzacecicn2uu4wkdy23tifrevyferwfirqm2sipmmj3ctxfp3xrqntcvs"),
"init": MustParseCid("bafk2bzaceagvocld6zunqwrky2czyaao2azwbpwq7jcjv3fab5lmgbhxst5mi"),
"multisig": MustParseCid("bafk2bzaceaj27lzwb4le2rnpnughce45msvv2ezjmqiqpeazpgbzqq75jdudq"),
"paymentchannel": MustParseCid("bafk2bzaceaazgcdtp4jwezulxpuzjz76st3lumudwdvwbb5t6xzpssku5i6ha"),
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
"reward": MustParseCid("bafk2bzaceds7hy7v77k2jsbkfob7b2qor6v5s2oancfxhkuuzwqqg6kxk27xe"),
"storagemarket": MustParseCid("bafk2bzacebqi6ylwfmack3hfzw6eej7r6gwlbxzo33tdkfkpof7wg7h54pjtw"),
"storageminer": MustParseCid("bafk2bzacedsxpkqqiycn5tjydycnlqer4544mpqvtwfamwyq6hwz7yjqd3iry"),
"storagepower": MustParseCid("bafk2bzacedssirrse7ufxti6capgf2qufb6y3oatv2fnnnh7xrgp47x3hfox4"),
"system": MustParseCid("bafk2bzacea2lod7lxod72voxyik5btpzmpvduddr4hwshcsyyy257izh6kut4"),
"verifiedregistry": MustParseCid("bafk2bzacebss7ol4ay6nkg7r3c2355aqpku4yvqipyh3sgdrxkhsrssrsaaig"),
"reward": MustParseCid("bafk2bzacebvqwn475gljvwlklfnmebunhsc6lj2vyr6s5qr4jehzx5de2wils"),
"storagemarket": MustParseCid("bafk2bzaceberatlfjmzke7gd3hlisvhvkduu4fbsbqymt3nyybszd34vbul32"),
"storageminer": MustParseCid("bafk2bzacedjhhhx32aec25jewhk7qhxjhsjzapi3nc2mrqbdls43hj77r3zc2"),
"storagepower": MustParseCid("bafk2bzacedhl3j7b5dzbtu772y3shmdijsiqqv36j5u2jmvb53job6curj7sk"),
"system": MustParseCid("bafk2bzaceakoq47k4ro3x4f7wd46yk6n33g2vuiiwbps5o2e5qhkhraxgvf5c"),
"verifiedregistry": MustParseCid("bafk2bzaced2fw523rkzw5rsca7a3v7isjgqyifpwxbs5dzdz5nipwes6cjdjk"),
},
}, {
Network: "calibrationnet",
@ -110,24 +106,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "calibrationnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacec4ilfymf3sorrfxp67ruwbax3a4mbqzic63vy2xlfh3ulky3bxvs"),
ManifestCid: MustParseCid("bafy2bzaceafl4uxyttmhccmv3246hzxu6yknal4f7ugsbpcu46kvkf6mvfvri"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacecupizfd6xbts7blvn3ozouy3f2gtehwl7qohjks54nsomtzs3aki"),
"cron": MustParseCid("bafk2bzacedry7eqweymdnybq5jm5slizm67v4ffhv7zqiw2jwevr7ijv25gjc"),
"datacap": MustParseCid("bafk2bzacebq6vigteuwchk7si6y45ogrfu2zpxjbo4a54btnbhp3rc3ifghx6"),
"eam": MustParseCid("bafk2bzacebounosssmuaz35xpyuupvijbcwqyaumbeztqmigbihfw2ysbnx4w"),
"ethaccount": MustParseCid("bafk2bzacebi2ymbi5wo2o3rp2x6cqo55vroixngmpbdcs7el4rq4hvacyzsqy"),
"evm": MustParseCid("bafk2bzaceapklwjzdzkmnfprn5wsjdzjnueuw2ke4kixq46gnbwjncns4dleu"),
"init": MustParseCid("bafk2bzaced7u4zpkxh5ecjo2emwsrk3vnickhmkxy22garqf766nbxcewymy6"),
"multisig": MustParseCid("bafk2bzacedlunqzd3mxslb7zej5fsti2jxredfhtcqqxepng67t4zfiv6lwlc"),
"paymentchannel": MustParseCid("bafk2bzacea4z2yi33rfiiutkmqko33fslikmeqgypkiam5cqpeylyp3oup552"),
"account": MustParseCid("bafk2bzaced5aa6fukm56jrjbhh5sewj2kv5mejrkjhsbx26b4xmg7x42cbkus"),
"cron": MustParseCid("bafk2bzaceautoih7urvvrubgktnmq4oqlsfqyk5mwatkj5dn42d7v7wn4hbi2"),
"datacap": MustParseCid("bafk2bzacectwanemh5tn7ojovprhag6ikvdfs4evzu2tdyg4tx6nr4qdnsyra"),
"eam": MustParseCid("bafk2bzacecxllkzu2hjcqs2br7xq7iplp4ol7ae6k4pxlwy4lzrj2b6dwaucq"),
"ethaccount": MustParseCid("bafk2bzacechpkotxlk342wp5xkpzgcz46me5nm7gdr2krfbf7zkmrgom6j4oq"),
"evm": MustParseCid("bafk2bzacedsaquz6rsixcl4bs4tdemfsxdy6rvv5klwodaetjn7iozwpkqxqa"),
"init": MustParseCid("bafk2bzaceadfoajypcb3ocklgbu6qzad2tpvrz6yrdu7kofd6wq2vssvpqnda"),
"multisig": MustParseCid("bafk2bzacecy7yahpaunojdmaxd2lposejij3sg7orn6du7zqfyuecya3uoije"),
"paymentchannel": MustParseCid("bafk2bzacebxgoj2ql5eft4sbccnj6l3ubm5qagvjmegh2atk5wrjw4xsoqy6e"),
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
"reward": MustParseCid("bafk2bzacea4dnvun5vwzunhgepejrknukx2di2kmo3x4akz6rollq5icsrl3m"),
"storagemarket": MustParseCid("bafk2bzaceafoon3fsl756rbrih4upar3ayi6746gaj756bk56thncpotl4coa"),
"storageminer": MustParseCid("bafk2bzacea3dj37h74ue2jtief3bj2shxagigygcm2h6purgp42mr6swwfdiw"),
"storagepower": MustParseCid("bafk2bzacebmodckd4tustgfmeilcfi3ovd4wzxz2hnd6vyhkq7hgiojiy3cc6"),
"system": MustParseCid("bafk2bzacebpqirxha42noejsk5miv5kip44eay6lm63pxt26xhlwdmn7tnqaq"),
"verifiedregistry": MustParseCid("bafk2bzaceczf7qrddwt5kh3gvro25wpls346tanffeatk7nsczjnwb7jtd454"),
"reward": MustParseCid("bafk2bzaceac5aeqc7honlhs7do6n37ps56ljgx3gnoalmkz4rfy2as6nmonfu"),
"storagemarket": MustParseCid("bafk2bzacedsorzdsgjblcm7iexzxxcx5u3pqyxefn544klyv4gk357kp5fvb4"),
"storageminer": MustParseCid("bafk2bzacedvaorqhrkr3mootp4ltgzebphpqqyyj5wcyylq5dnlupxeyydagm"),
"storagepower": MustParseCid("bafk2bzacecz2u6772repwsr6x6tbbm2z4bdy4uxxlvwm6r6ggfgox6sp2buiu"),
"system": MustParseCid("bafk2bzaceafo3uoxhi6nebe3nygkmiq532cvt2iq4ikcxnioi5fqnrthnpi2q"),
"verifiedregistry": MustParseCid("bafk2bzacecw3t525evmi4g27wgqr6bowz7jgkzflr6haosej5aa3mide63edk"),
},
}, {
Network: "caterpillarnet",
@ -176,24 +172,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "caterpillarnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacec36gpvghhgjwa5ya3ocxg33pct2vddegeixgkpqsc6eiyajdjkii"),
ManifestCid: MustParseCid("bafy2bzaceajatwdn4jlfiweb2cuwqtnrdwdxlju2vvejlqsytocnc76xnwm2g"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebcl3xlk7i6t5tau2rfgxft5pu6qzvjqxo6zs5guerz3xarxztyv6"),
"cron": MustParseCid("bafk2bzacebhoqjvaxtzj3k4tz7c4vtt4or4u3h3jhwxlh3t4l6by2ota3s7by"),
"datacap": MustParseCid("bafk2bzaceb7ttn3d43yb7l5ok5rjgr7325jb6ds4air7mivgoyzp5p4gwgrq4"),
"eam": MustParseCid("bafk2bzacebobuasaev75fge6xg6bekrdvnyox4h7iluupt4wqq2n4expha2oe"),
"ethaccount": MustParseCid("bafk2bzaceaghtv45mm6qx3yrxwy7zz7x7mqj4n4lzw4hx7zxzlij6dcxxuv4c"),
"evm": MustParseCid("bafk2bzacecu7xpnpw27jquvnpfv4rseaal477ml4ouxy37eo7wymgfzkexllg"),
"init": MustParseCid("bafk2bzacea2rnkho4nliqvisiqgtqx66c4xneagpgj52tyqa64grxadggylbk"),
"multisig": MustParseCid("bafk2bzacebak6spthfa23cyqjmpgkgku4gg4egdn2zc6vkikbh5ongadzakma"),
"paymentchannel": MustParseCid("bafk2bzaceb3tib72pwze2rov72ldwlfv3otes3tejgnfpbrzahwb5xi7slhqm"),
"account": MustParseCid("bafk2bzacedqtev5u55huwir5pustw5ixxjzemaq67idea73mhfxb655vn6fba"),
"cron": MustParseCid("bafk2bzacec5f4javbqxjkt5lewqxs5j2it4xbwxqpcm4u5bdo6hhaibpiwad4"),
"datacap": MustParseCid("bafk2bzacec4mswfkqkvuoebimktkb3hnpl4dzclkdqyi5h7skzpl3dm73hwak"),
"eam": MustParseCid("bafk2bzacebqion6rzshb3vou32ohpat4gd2lkrihwswsthtkh3wt3ucvno3z4"),
"ethaccount": MustParseCid("bafk2bzacebnmviobduaxspr5xmmszmibs6fikdjzyxpszweooxxjxez47tr7e"),
"evm": MustParseCid("bafk2bzacebxwy5ktfrhtikwnoklcuvp4znxyh7kf2c6emdedqjtlqqnupfuqc"),
"init": MustParseCid("bafk2bzaceb37ao4tett62uxjklsaewcvauysu5he6flpk74fpfyhs4j4nlmhw"),
"multisig": MustParseCid("bafk2bzacebx6sasdjd5frk75cwcfng752f7hfdllvb5isc37zjzlsgnh2e5lq"),
"paymentchannel": MustParseCid("bafk2bzacediht5lgorndb77tr4ll2qpzziokzyuztunttod73gq6vc4fn7vrc"),
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
"reward": MustParseCid("bafk2bzaceak3n3orgdraub4bqiy3paio77hu4laaqv4vf7wmwv4ybl5ahgi5o"),
"storagemarket": MustParseCid("bafk2bzacearo7sog7yqbrwyws5o3lbsdsjf2cp5vsoxc4u3s5atgjtwzzh65s"),
"storageminer": MustParseCid("bafk2bzacecrzmjrbqjwknnkybdexspb6gfu4q6dvtaeguxl26yuytsjc3w7ws"),
"storagepower": MustParseCid("bafk2bzaceavlmlu4mt2u7xwnnzf6vwdmh2yo76aauujwlgsbfhafjgxb4zgtg"),
"system": MustParseCid("bafk2bzacec35rgzpiaa4n3r5bzgssk33bhfgozjvgunbwax32dooqqokfe6ag"),
"verifiedregistry": MustParseCid("bafk2bzacebjfkrzihgzlb2jecgm5seoqwf5e656zc22vjoyclioru6vdy2bnm"),
"reward": MustParseCid("bafk2bzacebagt36uxbahizev4pelp4v57duuerqu43ejgi7i2vvofyfpkicre"),
"storagemarket": MustParseCid("bafk2bzaced5fv3zrg4iedwj2vrfzobwyyuecyb6p463pbvz7deqmpftyqpbuc"),
"storageminer": MustParseCid("bafk2bzacebs7w7oy4ef3v6em7w3pqb2ywd44eqkyqm53hqtwhatniblmoiio6"),
"storagepower": MustParseCid("bafk2bzacecbp4h5o3562myp4j7gzznc2txpdijams55kk3ctjat3hfwd64mwy"),
"system": MustParseCid("bafk2bzacea447pmvgz63rvfv3ktxf5pmi5ujq2xf4ognmoe3o7wvn6sq3cs3o"),
"verifiedregistry": MustParseCid("bafk2bzacednk3yfr7kgqfcy3mlowaoaocdcdfc6pv76akiagkircgyesiw7zs"),
},
}, {
Network: "devnet",
@ -233,24 +229,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "devnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacebemt6rdgtsj5vhv2iimbdvm5g4xllgl7nugxvuuthsedncmfakww"),
ManifestCid: MustParseCid("bafy2bzacedwfwgngpn52a7zzqfun37dl6brh4ue6d7y3kcs5gsz5hzbppo7ic"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzaceajmds6zbz235lbjjhv3mxc6x3kqudjkxedh5xqvlemh3f6xslz76"),
"cron": MustParseCid("bafk2bzaceabbv5ej2yd3n7txl3s4pahknb4in5dok57hzwfheqnk6k67zegbk"),
"datacap": MustParseCid("bafk2bzaceayzgq7qpuc5pr4lrh6k3xnvmirlmutffplmgur4pvcaynpxlkph6"),
"eam": MustParseCid("bafk2bzacecrand7mp7q3jm3u5dpqm4o24ki3pk3uzcw4zonjcowq4rxwptsis"),
"ethaccount": MustParseCid("bafk2bzacecpwfxpvqiyiisbfw45v5ottcstxu2vifji3xswxt3jzk4vcrs4g4"),
"evm": MustParseCid("bafk2bzaceajrtntc5urxkwbzdu3khi2eqvarnfx6vh7luqt33gn6z4a4kjkj6"),
"init": MustParseCid("bafk2bzaced6npj5zrjb3lxhgtsq4st66dvde56nftbvchmpid3rcazfvnqkpk"),
"multisig": MustParseCid("bafk2bzacealhbd4slci4o76dpdurkkk3q5busopediwfh7uis4hfh7tzghzni"),
"paymentchannel": MustParseCid("bafk2bzacebvpkvrihus53sdyutsjsbpfefe5gd2amfb6zkztdfp6g2m4ubqrk"),
"account": MustParseCid("bafk2bzacebyyteba37hzusnw6nek4cc2t3tripnpmaqcjyan4jlrosxml4us2"),
"cron": MustParseCid("bafk2bzaceddvv6uvff77qqwar76dhhzgdthsgrt66wy47a4axq2isfsu3isqa"),
"datacap": MustParseCid("bafk2bzaceapgpfwhtarq323r7ccvb2jc4yedgtdjnn5w3jgr75ayh3ctqdilk"),
"eam": MustParseCid("bafk2bzacealsu5v4552tqzwefu6htk43oixucyviwpam2can57tthwzea2erm"),
"ethaccount": MustParseCid("bafk2bzaceasdkzg5t6joexhuqiigagueb4fwkyczod5h4ipabkl5he5p6pss2"),
"evm": MustParseCid("bafk2bzacec2rienkocd7d52htiutyy26zszk5zzu47iqev3v2yca5peqgtcoc"),
"init": MustParseCid("bafk2bzacedq4e2x3zbopkxgvsryrc2lakqac6dhelt6vjqvoxqghzwmhhen2o"),
"multisig": MustParseCid("bafk2bzaceaeqphqg7jeudjwiveugre5spemixlwnvvdywdnd4hv5spj2of4is"),
"paymentchannel": MustParseCid("bafk2bzaceaey7zxzfsallib7bdinlnbysivlithvogz2nmyd2qnxcsbwfolgq"),
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
"reward": MustParseCid("bafk2bzaceaftaidppnno2dzhpxl5vyti5mcmdhvheieanwvptgacuj5ozzloe"),
"storagemarket": MustParseCid("bafk2bzacea75td2k2cdwc2o4kotdods2thomhcoqg5rf62ty6gkuxojknziae"),
"storageminer": MustParseCid("bafk2bzaceapj5q7egywl3zovwcm4hpbvr4vjtoshj57ncqg3srzseweyclvug"),
"storagepower": MustParseCid("bafk2bzacebbraebsoin6hhmr4na56st4gyg7yd7p2ry2igegnvws7deq32hec"),
"system": MustParseCid("bafk2bzacedtw3mq5zyxxbnybnjegqyrz3ufiboeoipyzynlk6zgyumvl3267g"),
"verifiedregistry": MustParseCid("bafk2bzacecaqciqoky2z7win5rkzd3gkgpa3345adjyiidmg4swmw5celeb3a"),
"reward": MustParseCid("bafk2bzacec7n2iijqcrar6ztbue7sqexvuwwsif6svmzx4qfehppyom4ftyju"),
"storagemarket": MustParseCid("bafk2bzacedmyiyvcbm2zepqib5lrjxzutcc533wbkwfmcwrb5pcjsn7ucsqww"),
"storageminer": MustParseCid("bafk2bzaceai3i4ilksmjc5wmtb2hkrylrn3kfkmcyzp77vn36gc76yqor3h2i"),
"storagepower": MustParseCid("bafk2bzaceccwx5vmarswywl3spmbqfkuw4672ilsv4pyi3ytvz5vrap4ktsyk"),
"system": MustParseCid("bafk2bzacecacjaj6bgwxtywl7leqxusrcwidm6fyfibqanqgli7ueupdbib5c"),
"verifiedregistry": MustParseCid("bafk2bzacedspjal4tdnzfrn6qi4vpsikdhoeqokaizffj6lsru4kap5woyurm"),
},
}, {
Network: "hyperspace",
@ -274,28 +270,6 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
"system": MustParseCid("bafk2bzacedo2hfopt6gy52goj7fot5qwzhtnysmgo7h25crq4clpugkerjabk"),
"verifiedregistry": MustParseCid("bafk2bzacea7rfkjrixaidksnmjehglmavyt56nyeu3sfxu2e3dcpf62oab6tw"),
},
}, {
Network: "hyperspace",
Version: 9,
ManifestCid: MustParseCid("bafy2bzacedvffumcvf72f2btjqvece3kpcdorxq5tq76iwcmqbzvsiu526cqm"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacecim7uybic2qprbkjhowg7qkniv4zywj5h5g4u4ss72urco2akzuo"),
"cron": MustParseCid("bafk2bzaceahgq64awp4f7li3hdgimc4upqvdvltpmeywckvens33umcxt424a"),
"datacap": MustParseCid("bafk2bzacebkxn52ttooaslkwncijk3bgd3tm2zw7vijdhwvg2cxnxbrzmmq5e"),
"eam": MustParseCid("bafk2bzaceczhgub5anrnaf7ol65mu54gsgwcj6c6m3yhet7rhxm2l6kz4s4ru"),
"ethaccount": MustParseCid("bafk2bzacealn5enbxyxbfs7gbsjbyma2zk3bcr7okvflxhpr753d4eh6ixooa"),
"evm": MustParseCid("bafk2bzacedljkrmazyewawpnddrkzrt55556374dw2pm2hokgkompgzw4vx5y"),
"init": MustParseCid("bafk2bzacec55gyyaqjrw7zughywocgwcjvv6k5fijjpjw4xgckuqz6pjtff5a"),
"multisig": MustParseCid("bafk2bzaceblozbdzybdivvjdiid4jwm2jc6x5a66sunh2vvwsqba6wzqmr7i6"),
"paymentchannel": MustParseCid("bafk2bzacealcyke5a6n24efs6qe4iikynpk2twqssyugy7jcyf6p6shgw2iwa"),
"placeholder": MustParseCid("bafk2bzaceaamp2a35vpfml4skap4dffklzae2urcm34mtwwce2lvhaons3a5y"),
"reward": MustParseCid("bafk2bzacebafzaqhwsm3nmsfwcd6ngvx6ev6zlcpyfljqh4kb77vok6opban6"),
"storagemarket": MustParseCid("bafk2bzacecrjfg4p7fxznsdkoobs4po2ve3ywixrirrk6netgxh63qqaefamg"),
"storageminer": MustParseCid("bafk2bzaceb3ctd4atxwhdkmlg4i63zxo5aopknlj7l5kaiqr22xpcmico6vg4"),
"storagepower": MustParseCid("bafk2bzacecvcix3ugopvby2vah5wwiu5cqjedwzwkanmr34kdoc4f3o6p7nsq"),
"system": MustParseCid("bafk2bzacedo2hfopt6gy52goj7fot5qwzhtnysmgo7h25crq4clpugkerjabk"),
"verifiedregistry": MustParseCid("bafk2bzacea7rfkjrixaidksnmjehglmavyt56nyeu3sfxu2e3dcpf62oab6tw"),
},
}, {
Network: "mainnet",
Version: 8,
@ -334,24 +308,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "mainnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacec2ggeabyyl2cjaqmcpnyvjirrrm6bfc7d73q4pekm27hybzdqs3q"),
ManifestCid: MustParseCid("bafy2bzaceanax3ruj24in364mbozrpmcyn7jf2vrxshppsgufwxemvzf6fp26"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebdlwwnd57vd2444wrfe5amtf2f6htqj3hdh4fxblywdbynrurhgy"),
"cron": MustParseCid("bafk2bzacecxmaxh272zhgmayfg7btvq5lshv2cd7njkarlbbikba4otiaboyg"),
"datacap": MustParseCid("bafk2bzaceb64wicovvrjzaotvs64hmdtvolw4l6qanwp5tk56okzqbfttxck2"),
"eam": MustParseCid("bafk2bzacedxs56zywfumzcv7i5fwluku2qevg54cuiuwi5d3pavf3rilfu33g"),
"ethaccount": MustParseCid("bafk2bzacecepsmgsucfebvbwf5vebm7j6zeqaz3ub52warxqobqeymh5vdjik"),
"evm": MustParseCid("bafk2bzacecf6arqbso67nmrhcsjvyradrbbv7hs2noand27fyr4nfilms4znu"),
"init": MustParseCid("bafk2bzaceat2xcem5lko5ot4mmrowtm6ehx5klw7c4ss4vxma55tyfvvxwlge"),
"multisig": MustParseCid("bafk2bzacebz43omxi5vtkidhsxroqtgkpxtftdj6poew3744fayfftgdebe4y"),
"paymentchannel": MustParseCid("bafk2bzaceds4ob3ev2ie2vorhfomddd44otqfau4d4eogfofjjbjjx2h27nh2"),
"account": MustParseCid("bafk2bzacedw7633eh64r7azo5eihahnnshqs6ahfbovqfxijscpirfksw6gfe"),
"cron": MustParseCid("bafk2bzacebka3yrzfzotza5q22weufktf5azw2ew7ui5eeigxqbkzzp4ndkf2"),
"datacap": MustParseCid("bafk2bzaceawihbc7ovxq5ifj2op67u26lakybo63kgl57vyipn5rkfi4rppfq"),
"eam": MustParseCid("bafk2bzacedtzbyjyqvtvbx245uuvf4rndnbyxttavwnfo4l72oxpjiiyldh6a"),
"ethaccount": MustParseCid("bafk2bzaceapcifcyvqnbuqq2zgf4kqoypl2xj4mfqefzfp6upevmqygxayfb4"),
"evm": MustParseCid("bafk2bzaced36v7kakhej6m6jailrnojjtkqxf3ybfw4pttasxtzzczxi5fkks"),
"init": MustParseCid("bafk2bzacebqi3szlok75xn7hhtmtmnvoekwdkuhakhr4dpuxmfxvpcrhr2cog"),
"multisig": MustParseCid("bafk2bzacebsc6qdm5772h7aa6bdf3ujerpihc6cdb2zpqz4sldktk423asq2c"),
"paymentchannel": MustParseCid("bafk2bzacebxuh4n66s6vclyp73k4ee2fdxrnjouozqcf3huprobjdk6sf73g6"),
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
"reward": MustParseCid("bafk2bzaced7xvqx7n6426lls4ao54exn63pv73m7makxf7ygb575roqxhjuuw"),
"storagemarket": MustParseCid("bafk2bzaceb5piewkvdj4ee6b4qzhimixjzee5z3hsuwdjksncpvef7sgaw6rw"),
"storageminer": MustParseCid("bafk2bzaceacukfushmnsqtdvtdyx2in6o2el7jq46qo7iaxgwytel4oz5srv4"),
"storagepower": MustParseCid("bafk2bzacedi6z45jcms5guns4qxi6rs2e2prc6mpnhkr4klljrra3ayfburss"),
"system": MustParseCid("bafk2bzacedy7ssu2hez3nu7bi4j6ucojty4sfaublxlxhfd3tkgzyrm5sdxbq"),
"verifiedregistry": MustParseCid("bafk2bzacecjgudirfyzyroq3xhf2bldl636w7prexcvo7v3xqdijzcom4rgry"),
"reward": MustParseCid("bafk2bzacebwlo5udozvs7v4wbtwjtg7jdyw5g6kjws4uqfpwsqhvn6d5u6rr6"),
"storagemarket": MustParseCid("bafk2bzacebbzaj2m3hhtnpk3fz67vudb7yfyquscczksny5z2iiztp6qsbemu"),
"storageminer": MustParseCid("bafk2bzacebdb6kxpqnmiyvpgugoqtnshl362titnku6h6nmil7crodv7vjk6i"),
"storagepower": MustParseCid("bafk2bzacebqavpt7iqtcn5rlsi5cpk5l3ocrxcqcakk25hxf2zbffrzifec3w"),
"system": MustParseCid("bafk2bzacec3m3b6kktp43nrf5ow33yaehokvz2zzpa5qsrstoqwh3liv4eyba"),
"verifiedregistry": MustParseCid("bafk2bzacedufe6cnihk5anxwboprfsmbuy7nxo3peqfrdesxhgptoircbt7ca"),
},
}, {
Network: "testing",
@ -391,24 +365,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "testing",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacedhivj4zbumou6d3242p3ecqhlqfcjfskdv46uzjchlj3ve23xyoa"),
ManifestCid: MustParseCid("bafy2bzacecdqjm4vzjqna4kvhe6ngpyimlp3qp73gjlbr3ymjaz7udkqm5k64"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacea3vbptmow72euwh2meu2sgwxrxjxg53qba6xxrknltr6j7bgnlhg"),
"cron": MustParseCid("bafk2bzaceclbrnwfgolv5icdknexv3oi3ujzpt5stqabiyshwhtvnijacysjg"),
"datacap": MustParseCid("bafk2bzacebt2gym3ot447unemieakxfep3u2m2zxiqlssbacu3ifsyhtulz4m"),
"eam": MustParseCid("bafk2bzacedmnvhfvt7qc5w3mfr54ikrpwox54ddkxkxp5qka24xudj4vkggjs"),
"ethaccount": MustParseCid("bafk2bzacebnh3oadihryhwgo73ooesgk3x2eg4g5gorps463iirilm5ur4q7w"),
"evm": MustParseCid("bafk2bzacecw2i5bsjymtdblvxh5xte3htff4przqaek673cw5z7ommaptdmqq"),
"init": MustParseCid("bafk2bzacebo6n4pwpwayjsc7cbrmmjy6l6om3wzx5jdldni4wl47a4x4jeazo"),
"multisig": MustParseCid("bafk2bzacecl4mc5esjwfcoirhdeqhms4qquafam4ut424hj2mo3gqzb47n2rs"),
"paymentchannel": MustParseCid("bafk2bzacedsmvdirjuywbg5xz7r5u2pxew7ye4kpy2toksv5nba7dzkcsmu3i"),
"account": MustParseCid("bafk2bzacecfg6coqk3sn7m7g5b5akafe25qd2po4jhp5kmup4htw5iavtrca6"),
"cron": MustParseCid("bafk2bzaceblrexwzuiiqm5u77zx4xapruki3u2wzq3ca5kf72dkkv7xl3zr2a"),
"datacap": MustParseCid("bafk2bzacedbarmlig6u2tioxjqlvmlroz7pdxtqqjugtzdwg33gcsuv4zus7e"),
"eam": MustParseCid("bafk2bzacecnupv35lhealursu4osdtxjerbfqkdbugprnuctkwykmn4mlsob6"),
"ethaccount": MustParseCid("bafk2bzaceduxlxe2sasshmuvw2vzxzkkdg2e2iud6h5omcct2lszyh4xhayr2"),
"evm": MustParseCid("bafk2bzacebwhijcnwtjbyvs4czuxv6ldg3kjpv364ja3omofaacly67k4ri5k"),
"init": MustParseCid("bafk2bzaceckdouclxeccuduf42hx5draalc6iospmndsrey4mjywfv7owbdfa"),
"multisig": MustParseCid("bafk2bzacectozlgryut7dttrd6jx5uhhf5qda7tglgsoq2ccszcu34mgnpdsy"),
"paymentchannel": MustParseCid("bafk2bzacedpmrg2pseig5ollv4e6ymf7357enxflm3thsxbmz5if6anp6xpzw"),
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
"reward": MustParseCid("bafk2bzaceakq4np44ltnscgff7h3a6s6ao2d43vwx66tce5r57r2amw42pl5i"),
"storagemarket": MustParseCid("bafk2bzacebskzlyhvhrdheslyrez3p4sccr5t42xnqophnvj775roskwzoic4"),
"storageminer": MustParseCid("bafk2bzacecx2fs3ra4ydxvwq6oh73esqy2xjqhwsnfrdl5ctbg26zem77zy3u"),
"storagepower": MustParseCid("bafk2bzacedwfnzestwv7ylleeuk3fhp6jewc4ygw3fgodsciww7gw5ilt4ony"),
"system": MustParseCid("bafk2bzaceaql3e6266ixcbwcdmwuhod4tahhawlvhfkq4qzp7hnmkkybdf7zi"),
"verifiedregistry": MustParseCid("bafk2bzacecibid6xpyu64kaxk2mspouajnenxlh4jkny7d6l5ht3hxg67l32u"),
"reward": MustParseCid("bafk2bzacea6f7fxmfjy6bxo3jojgz7tsrmpag2pvz6yff3d4gs7jt5tr3f7ly"),
"storagemarket": MustParseCid("bafk2bzacedaopo7s23du2xosguopbjhip7zadzaquzeuhlniqgmuplsiamozq"),
"storageminer": MustParseCid("bafk2bzaceam2xfi3g7jjeby6zrauirm3cpbvfun4k2baftogckdgbrfvxsbus"),
"storagepower": MustParseCid("bafk2bzaceaeytro4ruhhhtyeatggxqpoxeqcjzg2qvutthkk4hl3wmz4xc66w"),
"system": MustParseCid("bafk2bzacedteuhprsuwcz5hqoomhy2ozyh5afmmcgughjfbak2mux3da3izvu"),
"verifiedregistry": MustParseCid("bafk2bzacedfmjez4jrix3sgpy3c3iuwemmsl446tfwwzmw7rag3imwomayzes"),
},
}, {
Network: "testing-fake-proofs",
@ -448,23 +422,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "testing-fake-proofs",
Version: 10,
ManifestCid: MustParseCid("bafy2bzaceav36pezxhapk6vlgohdp6jiydk44o6xowltjnyhu3nrhpfcby5zs"),
BundleGitTag: "dev/20230114-pre-rc.2",
ManifestCid: MustParseCid("bafy2bzacedc2lel545tjyh66n4mrrpiomx557xeatmo2nzig3b3l22dnaxhbg"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacea3vbptmow72euwh2meu2sgwxrxjxg53qba6xxrknltr6j7bgnlhg"),
"cron": MustParseCid("bafk2bzaceclbrnwfgolv5icdknexv3oi3ujzpt5stqabiyshwhtvnijacysjg"),
"datacap": MustParseCid("bafk2bzacebt2gym3ot447unemieakxfep3u2m2zxiqlssbacu3ifsyhtulz4m"),
"eam": MustParseCid("bafk2bzacedmnvhfvt7qc5w3mfr54ikrpwox54ddkxkxp5qka24xudj4vkggjs"),
"ethaccount": MustParseCid("bafk2bzacebnh3oadihryhwgo73ooesgk3x2eg4g5gorps463iirilm5ur4q7w"),
"evm": MustParseCid("bafk2bzacecw2i5bsjymtdblvxh5xte3htff4przqaek673cw5z7ommaptdmqq"),
"init": MustParseCid("bafk2bzacebo6n4pwpwayjsc7cbrmmjy6l6om3wzx5jdldni4wl47a4x4jeazo"),
"multisig": MustParseCid("bafk2bzacecl4mc5esjwfcoirhdeqhms4qquafam4ut424hj2mo3gqzb47n2rs"),
"paymentchannel": MustParseCid("bafk2bzacedsmvdirjuywbg5xz7r5u2pxew7ye4kpy2toksv5nba7dzkcsmu3i"),
"account": MustParseCid("bafk2bzacecfg6coqk3sn7m7g5b5akafe25qd2po4jhp5kmup4htw5iavtrca6"),
"cron": MustParseCid("bafk2bzaceblrexwzuiiqm5u77zx4xapruki3u2wzq3ca5kf72dkkv7xl3zr2a"),
"datacap": MustParseCid("bafk2bzacedbarmlig6u2tioxjqlvmlroz7pdxtqqjugtzdwg33gcsuv4zus7e"),
"eam": MustParseCid("bafk2bzacecnupv35lhealursu4osdtxjerbfqkdbugprnuctkwykmn4mlsob6"),
"ethaccount": MustParseCid("bafk2bzaceduxlxe2sasshmuvw2vzxzkkdg2e2iud6h5omcct2lszyh4xhayr2"),
"evm": MustParseCid("bafk2bzacebwhijcnwtjbyvs4czuxv6ldg3kjpv364ja3omofaacly67k4ri5k"),
"init": MustParseCid("bafk2bzaceckdouclxeccuduf42hx5draalc6iospmndsrey4mjywfv7owbdfa"),
"multisig": MustParseCid("bafk2bzacectozlgryut7dttrd6jx5uhhf5qda7tglgsoq2ccszcu34mgnpdsy"),
"paymentchannel": MustParseCid("bafk2bzacedpmrg2pseig5ollv4e6ymf7357enxflm3thsxbmz5if6anp6xpzw"),
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
"reward": MustParseCid("bafk2bzaceakq4np44ltnscgff7h3a6s6ao2d43vwx66tce5r57r2amw42pl5i"),
"storagemarket": MustParseCid("bafk2bzacebskzlyhvhrdheslyrez3p4sccr5t42xnqophnvj775roskwzoic4"),
"storageminer": MustParseCid("bafk2bzacebp3rj6d4g2ppngw2xp7okzqx6oapfk6xi54n3aqenadqvptlk45g"),
"storagepower": MustParseCid("bafk2bzacedhwtksxb6orm63doxx2bgcy6fpy5li5prjb3twsxdh75anjbmdug"),
"system": MustParseCid("bafk2bzaceaql3e6266ixcbwcdmwuhod4tahhawlvhfkq4qzp7hnmkkybdf7zi"),
"verifiedregistry": MustParseCid("bafk2bzacecibid6xpyu64kaxk2mspouajnenxlh4jkny7d6l5ht3hxg67l32u"),
"reward": MustParseCid("bafk2bzacea6f7fxmfjy6bxo3jojgz7tsrmpag2pvz6yff3d4gs7jt5tr3f7ly"),
"storagemarket": MustParseCid("bafk2bzacedaopo7s23du2xosguopbjhip7zadzaquzeuhlniqgmuplsiamozq"),
"storageminer": MustParseCid("bafk2bzacecweqgs7k452vertmz66hjz2ymrgdbn4ycduyho3znoqv56ay4xlw"),
"storagepower": MustParseCid("bafk2bzaceapnz6icrfdgjcr7d2rknak5wirxxbh7mmo7kfutacxys22xrapbe"),
"system": MustParseCid("bafk2bzacedteuhprsuwcz5hqoomhy2ozyh5afmmcgughjfbak2mux3da3izvu"),
"verifiedregistry": MustParseCid("bafk2bzacedfmjez4jrix3sgpy3c3iuwemmsl446tfwwzmw7rag3imwomayzes"),
},
}}

View File

@ -17,7 +17,13 @@ func TestEmbeddedMetadata(t *testing.T) {
metadata, err := build.ReadEmbeddedBuiltinActorsMetadata()
require.NoError(t, err)
require.Equal(t, metadata, build.EmbeddedBuiltinActorsMetadata)
for i, v1 := range metadata {
v2 := build.EmbeddedBuiltinActorsMetadata[i]
require.Equal(t, v1.Network, v2.Network)
require.Equal(t, v1.Version, v2.Version)
require.Equal(t, v1.ManifestCid, v2.ManifestCid)
require.Equal(t, v1.Actors, v2.Actors)
}
}
// Test that we're registering the manifest correctly.

Binary file not shown.

Binary file not shown.

View File

@ -19,7 +19,7 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
}
const GenesisNetworkVersion = network.Version16
const GenesisNetworkVersion = network.Version17
var NetworkBundle = "butterflynet"
var BundleOverrides map[actorstypes.Version]string

View File

@ -49,4 +49,8 @@ type State interface {
Nonce() (uint64, error)
GetState() interface{}
GetBytecode() ([]byte, error)
GetBytecodeCID() (cid.Cid, error)
GetBytecodeHash() ([32]byte, error)
}

View File

@ -49,4 +49,8 @@ type State interface {
Nonce() (uint64, error)
GetState() interface{}
GetBytecode() ([]byte, error)
GetBytecodeCID() (cid.Cid, error)
GetBytecodeHash() ([32]byte, error)
}

View File

@ -43,3 +43,25 @@ func (s *state{{.v}}) Nonce() (uint64, error) {
func (s *state{{.v}}) GetState() interface{} {
return &s.State
}
func (s *state{{.v}}) GetBytecodeCID() (cid.Cid, error) {
return s.State.Bytecode, nil
}
func (s *state{{.v}}) GetBytecodeHash() ([32]byte, error) {
return s.State.BytecodeHash, nil
}
func (s *state{{.v}}) 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
}

View File

@ -3,6 +3,7 @@ package evm
import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/abi"
evm10 "github.com/filecoin-project/go-state-types/builtin/v10/evm"
"github.com/filecoin-project/lotus/chain/actors/adt"
@ -43,3 +44,25 @@ func (s *state10) Nonce() (uint64, error) {
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) GetBytecodeCID() (cid.Cid, error) {
return s.State.Bytecode, nil
}
func (s *state10) GetBytecodeHash() ([32]byte, error) {
return s.State.BytecodeHash, nil
}
func (s *state10) 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
}

View File

@ -105,18 +105,9 @@ func (f *EventFilter) CollectEvents(ctx context.Context, te *TipSetEvents, rever
continue
}
entries := make([]types.EventEntry, len(ev.Entries))
for i, entry := range ev.Entries {
entries[i] = types.EventEntry{
Flags: entry.Flags,
Key: entry.Key,
Value: entry.Value,
}
}
// event matches filter, so record it
cev := &CollectedEvent{
Entries: entries,
Entries: ev.Entries,
EmitterAddr: addr,
EventIdx: evIdx,
Reverted: revert,

View File

@ -287,6 +287,7 @@ func fakeEvent(emitter abi.ActorID, indexed []kv, unindexed []kv) *types.Event {
ev.Entries = append(ev.Entries, types.EventEntry{
Flags: 0x01,
Key: in.k,
Codec: cid.Raw,
Value: in.v,
})
}
@ -295,6 +296,7 @@ func fakeEvent(emitter abi.ActorID, indexed []kv, unindexed []kv) *types.Event {
ev.Entries = append(ev.Entries, types.EventEntry{
Flags: 0x00,
Key: in.k,
Codec: cid.Raw,
Value: in.v,
})
}

View File

@ -47,6 +47,7 @@ var ddls = []string{
indexed INTEGER NOT NULL,
flags BLOB NOT NULL,
key TEXT NOT NULL,
codec INTEGER,
value BLOB NOT NULL
)`,
@ -67,8 +68,8 @@ const (
VALUES(?, ?, ?, ?, ?, ?, ?, ?)`
insertEntry = `INSERT OR IGNORE INTO event_entry
(event_id, indexed, flags, key, value)
VALUES(?, ?, ?, ?, ?)`
(event_id, indexed, flags, key, codec, value)
VALUES(?, ?, ?, ?, ?, ?)`
)
type EventIndex struct {
@ -194,6 +195,7 @@ func (ei *EventIndex) CollectEvents(ctx context.Context, te *TipSetEvents, rever
isIndexedValue(entry.Flags), // indexed
[]byte{entry.Flags}, // flags
entry.Key, // key
entry.Codec, // codec
entry.Value, // value
)
if err != nil {
@ -251,7 +253,7 @@ func (ei *EventIndex) PrefillFilter(ctx context.Context, f *EventFilter) error {
subclauses := []string{}
for _, val := range vals {
subclauses = append(subclauses, fmt.Sprintf("%s.value=?", joinAlias))
values = append(values, trimLeadingZeros(val))
values = append(values, val)
}
clauses = append(clauses, "("+strings.Join(subclauses, " OR ")+")")
}
@ -270,6 +272,7 @@ func (ei *EventIndex) PrefillFilter(ctx context.Context, f *EventFilter) error {
event.reverted,
event_entry.flags,
event_entry.key,
event_entry.codec,
event_entry.value
FROM event JOIN event_entry ON event.id=event_entry.event_id`
@ -319,6 +322,7 @@ func (ei *EventIndex) PrefillFilter(ctx context.Context, f *EventFilter) error {
reverted bool
flags []byte
key string
codec uint64
value []byte
}
@ -334,6 +338,7 @@ func (ei *EventIndex) PrefillFilter(ctx context.Context, f *EventFilter) error {
&row.reverted,
&row.flags,
&row.key,
&row.codec,
&row.value,
); err != nil {
return xerrors.Errorf("read prefill row: %w", err)
@ -378,6 +383,7 @@ func (ei *EventIndex) PrefillFilter(ctx context.Context, f *EventFilter) error {
ce.Entries = append(ce.Entries, types.EventEntry{
Flags: row.flags[0],
Key: row.key,
Codec: row.codec,
Value: row.value,
})
@ -398,12 +404,3 @@ func (ei *EventIndex) PrefillFilter(ctx context.Context, f *EventFilter) error {
return nil
}
func trimLeadingZeros(b []byte) []byte {
for i := range b {
if b[i] != 0 {
return b[i:]
}
}
return []byte{}
}

View File

@ -256,6 +256,20 @@ func (cs *ChainStore) MessagesForBlock(ctx context.Context, b *types.BlockHeader
return blsmsgs, secpkmsgs, nil
}
func (cs *ChainStore) SecpkMessagesForBlock(ctx context.Context, b *types.BlockHeader) ([]*types.SignedMessage, error) {
_, secpkcids, err := cs.ReadMsgMetaCids(ctx, b.Messages)
if err != nil {
return nil, err
}
secpkmsgs, err := cs.LoadSignedMessagesFromCids(ctx, secpkcids)
if err != nil {
return nil, xerrors.Errorf("loading secpk messages for block: %w", err)
}
return secpkmsgs, nil
}
func (cs *ChainStore) GetParentReceipt(ctx context.Context, b *types.BlockHeader, i int) (*types.MessageReceipt, error) {
// block headers use adt0, for now.
a, err := blockadt.AsArray(cs.ActorStore(ctx), b.ParentMessageReceipts)

View File

@ -1943,7 +1943,7 @@ func (t *Event) UnmarshalCBOR(r io.Reader) (err error) {
return nil
}
var lengthBufEventEntry = []byte{131}
var lengthBufEventEntry = []byte{132}
func (t *EventEntry) MarshalCBOR(w io.Writer) error {
if t == nil {
@ -1974,6 +1974,12 @@ func (t *EventEntry) MarshalCBOR(w io.Writer) error {
return err
}
// t.Codec (uint64) (uint64)
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Codec)); err != nil {
return err
}
// t.Value ([]uint8) (slice)
if len(t.Value) > cbg.ByteArrayMaxLen {
return xerrors.Errorf("Byte array in field t.Value was too long")
@ -2008,7 +2014,7 @@ func (t *EventEntry) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("cbor input should be of type array")
}
if extra != 3 {
if extra != 4 {
return fmt.Errorf("cbor input had wrong number of fields")
}
@ -2035,6 +2041,20 @@ func (t *EventEntry) UnmarshalCBOR(r io.Reader) (err error) {
t.Key = string(sval)
}
// t.Codec (uint64) (uint64)
{
maj, extra, err = cr.ReadHeader()
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.Codec = uint64(extra)
}
// t.Value ([]uint8) (slice)
maj, extra, err = cr.ReadHeader()

View File

@ -37,7 +37,8 @@ type EthTx struct {
Gas EthUint64 `json:"gas"`
MaxFeePerGas EthBigInt `json:"maxFeePerGas"`
MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"`
V EthBigInt `json:"v"`
AccessList []EthHash `json:"accessList"`
V EthBigInt `json:"yParity"`
R EthBigInt `json:"r"`
S EthBigInt `json:"s"`
}
@ -86,6 +87,7 @@ func EthTxFromSignedEthMessage(smsg *types.SignedMessage) (EthTx, error) {
Gas: EthUint64(txArgs.GasLimit),
MaxFeePerGas: EthBigInt(txArgs.MaxFeePerGas),
MaxPriorityFeePerGas: EthBigInt(txArgs.MaxPriorityFeePerGas),
AccessList: []EthHash{},
V: v,
R: r,
S: s,

View File

@ -22,6 +22,7 @@ import (
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/lib/must"
)
var (
@ -144,7 +145,7 @@ type EthBlock struct {
GasLimit EthUint64 `json:"gasLimit"`
GasUsed EthUint64 `json:"gasUsed"`
Timestamp EthUint64 `json:"timestamp"`
Extradata []byte `json:"extraData"`
Extradata EthBytes `json:"extraData"`
MixHash EthHash `json:"mixHash"`
Nonce EthNonce `json:"nonce"`
BaseFeePerGas EthBigInt `json:"baseFeePerGas"`
@ -154,21 +155,32 @@ type EthBlock struct {
Uncles []EthHash `json:"uncles"`
}
const EthBloomSize = 2048
var (
EmptyEthBloom = [256]byte{}
EmptyEthBloom = [EthBloomSize / 8]byte{}
FullEthBloom = [EthBloomSize / 8]byte{}
EmptyEthHash = EthHash{}
EmptyUncleHash = must.One(ParseEthHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")) // Keccak-256 of an RLP of an empty array
EmptyRootHash = must.One(ParseEthHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")) // Keccak-256 hash of the RLP of null
EmptyEthInt = EthUint64(0)
EmptyEthNonce = [8]byte{0, 0, 0, 0, 0, 0, 0, 0}
)
func NewEthBlock() EthBlock {
return EthBlock{
Sha3Uncles: EmptyEthHash,
func init() {
for i := range FullEthBloom {
FullEthBloom[i] = 0xff
}
}
func NewEthBlock(hasTransactions bool) EthBlock {
b := EthBlock{
Sha3Uncles: EmptyUncleHash, // Sha3Uncles set to a hardcoded value which is used by some clients to determine if has no uncles.
StateRoot: EmptyEthHash,
TransactionsRoot: EmptyEthHash,
TransactionsRoot: EmptyRootHash, // TransactionsRoot set to a hardcoded value which is used by some clients to determine if has no transactions.
ReceiptsRoot: EmptyEthHash,
Difficulty: EmptyEthInt,
LogsBloom: EmptyEthBloom[:],
LogsBloom: FullEthBloom[:],
Extradata: []byte{},
MixHash: EmptyEthHash,
Nonce: EmptyEthNonce,
@ -176,6 +188,11 @@ func NewEthBlock() EthBlock {
Uncles: []EthHash{},
Transactions: []interface{}{},
}
if hasTransactions {
b.TransactionsRoot = EmptyEthHash
}
return b
}
type EthCall struct {
@ -396,6 +413,10 @@ func DecodeHexString(s string) ([]byte, error) {
return b, nil
}
func DecodeHexStringTrimSpace(s string) ([]byte, error) {
return DecodeHexString(strings.TrimSpace(s))
}
func handleHexStringPrefix(s string) string {
// Strip the leading 0x or 0X prefix since hex.DecodeString does not support it.
if strings.HasPrefix(s, "0x") || strings.HasPrefix(s, "0X") {
@ -432,8 +453,19 @@ func EthHashFromTxBytes(b []byte) EthHash {
return ethHash
}
func EthBloomSet(f EthBytes, data []byte) {
hasher := sha3.NewLegacyKeccak256()
hasher.Write(data)
hash := hasher.Sum(nil)
for i := 0; i < 3; i++ {
n := binary.BigEndian.Uint16(hash[i*2:]) % EthBloomSize
f[(EthBloomSize/8)-(n/8)-1] |= 1 << (n % 8)
}
}
type EthFeeHistory struct {
OldestBlock uint64 `json:"oldestBlock"`
OldestBlock EthUint64 `json:"oldestBlock"`
BaseFeePerGas []EthBigInt `json:"baseFeePerGas"`
GasUsedRatio []float64 `json:"gasUsedRatio"`
Reward *[][]EthBigInt `json:"reward,omitempty"`

View File

@ -30,7 +30,10 @@ type EventEntry struct {
// The key of this event entry
Key string
// Any DAG-CBOR encodeable type.
// The event value's codec
Codec uint64
// The event value
Value []byte
}

View File

@ -291,7 +291,7 @@ func DumpActorState(i *ActorRegistry, act *types.Actor, b []byte) (interface{},
um := actInfo.vmActor.State()
if um == nil {
if act.Code != EmptyObjectCid {
if act.Head != EmptyObjectCid {
return nil, xerrors.Errorf("actor with code %s should only have empty object (%s) as its Head, instead has %s", act.Code, EmptyObjectCid, act.Head)
}

View File

@ -107,7 +107,7 @@ var EvmCallSimulateCmd = &cli.Command{
return err
}
params, err := ethtypes.DecodeHexString(cctx.Args().Get(2))
params, err := ethtypes.DecodeHexStringTrimSpace(cctx.Args().Get(2))
if err != nil {
return err
}
@ -151,7 +151,7 @@ var EvmGetContractAddress = &cli.Command{
return err
}
salt, err := ethtypes.DecodeHexString(cctx.Args().Get(1))
salt, err := ethtypes.DecodeHexStringTrimSpace(cctx.Args().Get(1))
if err != nil {
return xerrors.Errorf("Could not decode salt: %w", err)
}
@ -170,7 +170,7 @@ var EvmGetContractAddress = &cli.Command{
return err
}
contract, err := ethtypes.DecodeHexString(string(contractHex))
contract, err := ethtypes.DecodeHexStringTrimSpace(string(contractHex))
if err != nil {
return xerrors.Errorf("Could not decode contract file: %w", err)
}
@ -219,7 +219,7 @@ var EvmDeployCmd = &cli.Command{
return xerrors.Errorf("failed to read contract: %w", err)
}
if cctx.Bool("hex") {
contract, err = ethtypes.DecodeHexString(string(contract))
contract, err = ethtypes.DecodeHexStringTrimSpace(string(contract))
if err != nil {
return xerrors.Errorf("failed to decode contract: %w", err)
}
@ -341,7 +341,7 @@ var EvmInvokeCmd = &cli.Command{
}
var calldata []byte
calldata, err = ethtypes.DecodeHexString(cctx.Args().Get(1))
calldata, err = ethtypes.DecodeHexStringTrimSpace(cctx.Args().Get(1))
if err != nil {
return xerrors.Errorf("decoding hex input data: %w", err)
}

View File

@ -117,6 +117,17 @@ var sendCmd = &cli.Command{
params.From = faddr
}
if params.From.Protocol() == address.Delegated {
if !(params.To.Protocol() == address.ID || params.To.Protocol() == address.Delegated) {
api := srv.FullNodeAPI()
// Resolve id addr if possible.
params.To, err = api.StateLookupID(ctx, params.To, types.EmptyTSK)
if err != nil {
return xerrors.Errorf("f4 addresses can only send to other f4 or id addresses. could not find id address for %s", params.To.String())
}
}
}
if cctx.IsSet("gas-premium") {
gp, err := types.BigFromString(cctx.String("gas-premium"))
if err != nil {

View File

@ -1354,7 +1354,7 @@ func ComputeStateHTMLTempl(w io.Writer, ts *types.TipSet, o *api.ComputeStateOut
"GetMethod": getMethod,
"ToFil": toFil,
"JsonParams": JsonParams,
"JsonReturn": jsonReturn,
"JsonReturn": JsonReturn,
"IsSlow": isSlow,
"IsVerySlow": isVerySlow,
"IntExit": func(i exitcode.ExitCode) int64 { return int64(i) },
@ -1440,7 +1440,7 @@ func JsonParams(code cid.Cid, method abi.MethodNum, params []byte) (string, erro
return string(b), err
}
func jsonReturn(code cid.Cid, method abi.MethodNum, ret []byte) (string, error) {
func JsonReturn(code cid.Cid, method abi.MethodNum, ret []byte) (string, error) {
methodMeta, found := filcns.NewActorRegistry().Methods[code][method] // TODO: use remote
if !found {
return "", fmt.Errorf("method %d not found on actor %s", method, code)
@ -1549,7 +1549,7 @@ func printReceiptReturn(ctx context.Context, api v0api.FullNode, m *types.Messag
return err
}
jret, err := jsonReturn(act.Code, m.Method, r.Return)
jret, err := JsonReturn(act.Code, m.Method, r.Return)
if err != nil {
return err
}
@ -1689,7 +1689,7 @@ var StateCallCmd = &cli.Command{
return xerrors.Errorf("getting actor: %w", err)
}
retStr, err := jsonReturn(act.Code, abi.MethodNum(method), ret.MsgRct.Return)
retStr, err := JsonReturn(act.Code, abi.MethodNum(method), ret.MsgRct.Return)
if err != nil {
return xerrors.Errorf("decoding return: %w", err)
}

View File

@ -456,6 +456,7 @@ var chainBalanceStateCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "miner-info",
@ -679,6 +680,7 @@ var chainPledgeCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
ArgsUsage: "[stateroot epoch]",

View File

@ -41,6 +41,11 @@ var datastoreListCmd = &cli.Command{
Name: "list",
Description: "list datastore keys",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "repo-type",
Usage: "node type (FullNode, StorageMiner, Worker, Wallet)",
@ -110,6 +115,11 @@ var datastoreGetCmd = &cli.Command{
Name: "get",
Description: "list datastore keys",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "repo-type",
Usage: "node type (FullNode, StorageMiner, Worker, Wallet)",
@ -123,7 +133,7 @@ var datastoreGetCmd = &cli.Command{
},
ArgsUsage: "[namespace key]",
Action: func(cctx *cli.Context) error {
logging.SetLogLevel("badger", "ERROR") // nolint:errcheck
_ = logging.SetLogLevel("badger", "ERROR")
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {

View File

@ -26,6 +26,7 @@ var dealLabelCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -35,6 +35,7 @@ var diffMinerStates = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -37,6 +37,7 @@ var exportCarCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
ArgsUsage: "[outfile] [root cid]",

View File

@ -44,6 +44,7 @@ var exportChainCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "tipset",
@ -148,6 +149,7 @@ var exportRawCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "car-size",

View File

@ -58,12 +58,6 @@ var fip36PollCmd = &cli.Command{
Name: "fip36poll",
Usage: "Process the FIP0036 FilPoll result",
ArgsUsage: "[state root, votes]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
},
},
Subcommands: []*cli.Command{
finalResultCmd,
},
@ -77,6 +71,7 @@ var finalResultCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},

View File

@ -44,6 +44,7 @@ var gasTraceCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
@ -148,6 +149,7 @@ var replayOfflineCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.Int64Flag{
Name: "lookback-limit",

View File

@ -19,6 +19,13 @@ import (
var importCarCmd = &cli.Command{
Name: "import-car",
Description: "Import a car file into node chain blockstore",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {
@ -96,6 +103,13 @@ var importCarCmd = &cli.Command{
var importObjectCmd = &cli.Command{
Name: "import-obj",
Usage: "import a raw ipld object into your datastore",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {

View File

@ -37,6 +37,7 @@ var invariantsCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -146,9 +146,14 @@ var keyinfoImportCmd = &cli.Command{
Examples
env LOTUS_PATH=/var/lib/lotus lotus-shed keyinfo import libp2p-host.keyinfo`,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
flagRepo := cctx.String("repo")
var input io.Reader
if cctx.NArg() == 0 {
input = os.Stdin
@ -177,7 +182,7 @@ var keyinfoImportCmd = &cli.Command{
return err
}
fsrepo, err := repo.NewFS(flagRepo)
fsrepo, err := repo.NewFS(cctx.String("repo"))
if err != nil {
return err
}

View File

@ -1,7 +1,6 @@
package main
import (
"fmt"
"os"
logging "github.com/ipfs/go-log/v2"
@ -89,19 +88,6 @@ func main() {
Version: build.UserVersion(),
Commands: local,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},
Hidden: true,
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
},
&cli.StringFlag{
Name: "miner-repo",
Aliases: []string{"storagerepo"},
EnvVars: []string{"LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH"},
Value: "~/.lotusminer", // TODO: Consider XDG_DATA_HOME
Usage: fmt.Sprintf("Specify miner repo path. flag storagerepo and env LOTUS_STORAGE_PATH are DEPRECATION, will REMOVE SOON"),
},
&cli.StringFlag{
Name: "log-level",
Value: "info",

View File

@ -125,7 +125,8 @@ var marketExportDatastoreCmd = &cli.Command{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Usage: "path to the repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "backup-dir",
@ -242,7 +243,8 @@ var marketImportDatastoreCmd = &cli.Command{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Usage: "path to the repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "backup-path",

View File

@ -56,6 +56,7 @@ var migrationsCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "skip-pre-migration",

View File

@ -26,10 +26,12 @@ import (
var minerPeeridCmd = &cli.Command{
Name: "miner-peerid",
Usage: "Scrape state to find a miner based on peerid", Flags: []cli.Flag{
Usage: "Scrape state to find a miner based on peerid",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -28,10 +28,12 @@ import (
var minerTypesCmd = &cli.Command{
Name: "miner-types",
Usage: "Scrape state to report on how many miners of each WindowPoStProofType exist", Flags: []cli.Flag{
Usage: "Scrape state to report on how many miners of each WindowPoStProofType exist",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -45,6 +45,7 @@ var multisigGetAllCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -17,12 +17,6 @@ import (
var noncefix = &cli.Command{
Name: "noncefix",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},
Hidden: true,
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
},
&cli.Uint64Flag{
Name: "start",
},

View File

@ -88,6 +88,7 @@ var stateTreePruneCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.Int64Flag{
Name: "keep-from-lookback",

View File

@ -41,6 +41,7 @@ var splitstoreRollbackCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "gc-coldstore",
@ -131,6 +132,7 @@ var splitstoreClearCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.BoolFlag{
Name: "keys-only",

View File

@ -35,6 +35,7 @@ var terminationsCmd = &cli.Command{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {

View File

@ -644,6 +644,7 @@ Response:
{
"Flags": 7,
"Key": "string value",
"Codec": 42,
"Value": "Ynl0ZSBhcnJheQ=="
}
]
@ -2342,7 +2343,7 @@ Inputs:
Response:
```json
{
"oldestBlock": 42,
"oldestBlock": "0x5",
"baseFeePerGas": [
"0x0"
],
@ -2407,7 +2408,7 @@ Response:
"gasLimit": "0x5",
"gasUsed": "0x5",
"timestamp": "0x5",
"extraData": "Ynl0ZSBhcnJheQ==",
"extraData": "0x07",
"mixHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"nonce": "0x0707070707070707",
"baseFeePerGas": "0x0",
@ -2451,7 +2452,7 @@ Response:
"gasLimit": "0x5",
"gasUsed": "0x5",
"timestamp": "0x5",
"extraData": "Ynl0ZSBhcnJheQ==",
"extraData": "0x07",
"mixHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"nonce": "0x0707070707070707",
"baseFeePerGas": "0x0",
@ -2643,7 +2644,10 @@ Response:
"gas": "0x5",
"maxFeePerGas": "0x0",
"maxPriorityFeePerGas": "0x0",
"v": "0x0",
"accessList": [
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
],
"yParity": "0x0",
"r": "0x0",
"s": "0x0"
}
@ -2679,7 +2683,10 @@ Response:
"gas": "0x5",
"maxFeePerGas": "0x0",
"maxPriorityFeePerGas": "0x0",
"v": "0x0",
"accessList": [
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
],
"yParity": "0x0",
"r": "0x0",
"s": "0x0"
}
@ -2714,7 +2721,10 @@ Response:
"gas": "0x5",
"maxFeePerGas": "0x0",
"maxPriorityFeePerGas": "0x0",
"v": "0x0",
"accessList": [
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
],
"yParity": "0x0",
"r": "0x0",
"s": "0x0"
}

2
extern/filecoin-ffi vendored

@ -1 +1 @@
Subproject commit 0c792ee1d1f062377033d7d37442d18f765be467
Subproject commit 32df7d1f15e46406c5efafb5de5c2c70ec34d685

View File

@ -20,6 +20,7 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
{{- range . }} {
Network: {{printf "%q" .Network}},
Version: {{.Version}},
{{if .BundleGitTag}} BundleGitTag: {{printf "%q" .BundleGitTag}}, {{end}}
ManifestCid: MustParseCid({{printf "%q" .ManifestCid}}),
Actors: map[string]cid.Cid {
{{- range $name, $cid := .Actors }}
@ -37,6 +38,12 @@ func main() {
panic(err)
}
if len(os.Args) > 1 {
for _, m := range metadata {
m.BundleGitTag = os.Args[1]
}
}
fi, err := os.Create("./build/builtin_actors_gen.go")
if err != nil {
panic(err)

6
go.mod
View File

@ -62,10 +62,12 @@ require (
github.com/gbrlsnchs/jwt/v3 v3.0.1
github.com/gdamore/tcell/v2 v2.2.0
github.com/go-kit/kit v0.12.0
github.com/go-openapi/spec v0.19.11
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/gorilla/websocket v1.5.0
github.com/gregdhill/go-openrpc v0.0.0-20220114144539-ae6f44720487
github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e
github.com/hashicorp/go-multierror v1.1.1
@ -145,6 +147,7 @@ require (
github.com/whyrusleeping/cbor-gen v0.0.0-20221021053955-c138aae13722
github.com/whyrusleeping/ledger-filecoin-go v0.9.1-0.20201010031517-c3dcc1bddce4
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
github.com/xeipuuv/gojsonschema v1.2.0
github.com/xorcare/golden v0.6.1-0.20191112154924-b87f686d7542
go.opencensus.io v0.23.0
go.opentelemetry.io/otel v1.11.1
@ -213,7 +216,6 @@ require (
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-openapi/jsonpointer v0.19.3 // indirect
github.com/go-openapi/jsonreference v0.19.4 // indirect
github.com/go-openapi/spec v0.19.11 // indirect
github.com/go-openapi/swag v0.19.11 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
@ -324,6 +326,8 @@ require (
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.12.1 // indirect

26
go.sum
View File

@ -451,6 +451,7 @@ github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwoh
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
github.com/go-openapi/jsonreference v0.19.4 h1:3Vw+rh13uq2JFNxgnMTGE1rnoieU9FmyE1gvnyylsYg=
github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY=
github.com/go-openapi/spec v0.19.7/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk=
github.com/go-openapi/spec v0.19.11 h1:ogU5q8dtp3MMPn59a9VRrPKVxvJHEs5P7yNMR5sNnis=
github.com/go-openapi/spec v0.19.11/go.mod h1:vqK/dIdLGCosfvYsQV3WfC7N3TiZSnGY2RZKoFK7X28=
@ -464,6 +465,10 @@ github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
github.com/gobuffalo/packr/v2 v2.6.0/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08=
github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@ -586,6 +591,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gregdhill/go-openrpc v0.0.0-20220114144539-ae6f44720487 h1:NyaWOSkqFK1d9o+HLfnMIGzrHuUUPeBNIZyi5Zoe/lY=
github.com/gregdhill/go-openrpc v0.0.0-20220114144539-ae6f44720487/go.mod h1:a1eRkbhd3DYpRH2lnuUsVG+QMTI+v0hGnsis8C9hMrA=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE=
@ -665,6 +672,7 @@ github.com/icza/backscanner v0.0.0-20210726202459-ac2ffc679f94 h1:9tcYMdi+7Rb1y0
github.com/icza/backscanner v0.0.0-20210726202459-ac2ffc679f94/go.mod h1:GYeBD1CF7AqnKZK+UCytLcY3G+UKo0ByXX/3xfdNyqQ=
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k=
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA=
github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab h1:HqW4xhhynfjrtEiiSGcQUd6vrK23iMam1FO8rI7mwig=
@ -923,6 +931,7 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht
github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4=
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jonboulle/clockwork v0.1.1-0.20190114141812-62fb9bc030d1/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
@ -951,6 +960,7 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kabukky/httpscerts v0.0.0-20150320125433-617593d7dcb3/go.mod h1:BYpt4ufZiIGv2nXn4gMxnfKV306n3mWXgNu/d2TqdTU=
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
github.com/kilic/bls12-381 v0.0.0-20200607163746-32e1441c8a9f/go.mod h1:XXfR6YFCRSrkEXbNlIyDsgXVNJWVUV30m/ebkVy9n6s=
@ -976,6 +986,7 @@ github.com/klauspost/cpuid/v2 v2.1.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8t
github.com/koalacxr/quantile v0.0.1 h1:wAW+SQ286Erny9wOjVww96t8ws+x5Zj6AKHDULUK+o0=
github.com/koalacxr/quantile v0.0.1/go.mod h1:bGN/mCZLZ4lrSDHRQ6Lglj9chowGux8sGUIND+DQeD0=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
@ -990,6 +1001,7 @@ github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
@ -1693,6 +1705,7 @@ github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
@ -1779,6 +1792,7 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
@ -1795,6 +1809,8 @@ github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpP
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE=
github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU=
github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g=
github.com/tidwall/gjson v1.6.0 h1:9VEQWz6LLMUsUl6PueE49ir4Ka6CzLymOAZDxpFsTDc=
github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
@ -1880,6 +1896,12 @@ github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow=
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg=
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xorcare/golden v0.6.0/go.mod h1:7T39/ZMvaSEZlBPoYfVFmsBLmUl3uz9IuzWj/U6FtvQ=
github.com/xorcare/golden v0.6.1-0.20191112154924-b87f686d7542 h1:oWgZJmC1DorFZDpfMfWg7xk29yEOZiXmo/wZl+utTI8=
@ -2004,6 +2026,7 @@ golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@ -2191,12 +2214,14 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190524122548-abf6ff778158/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190524152521-dbbf3f1254d4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190526052359-791d8a0f4d09/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -2308,6 +2333,7 @@ golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBn
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,67 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17;
contract Create2Factory {
bytes32 savedSalt;
// Returns the address of the newly deployed contract
function deploy(
bytes32 _salt
) public returns (address) {
// This syntax is a newer way to invoke create2 without assembly, you just need to pass salt
// https://docs.soliditylang.org/en/latest/control-structures.html#salted-contract-creations-create2
savedSalt = _salt;
(bool success, address ret) = deployDelegateCall(_salt);
require(success);
return ret;
}
function deployDelegateCall(
bytes32 _salt
) public returns (bool, address) {
bytes memory data = abi.encodeWithSignature("_deploy(bytes32)", _salt);
(bool success, bytes memory returnedData) = address(this).delegatecall(data);
if(success){
(address ret) = abi.decode(returnedData, (address));
return (success, ret);
}else{
return (success, address(0));
}
}
function _deploy(bytes32 _salt) public returns (address) {
// https://solidity-by-example.org/app/create1/
// This syntax is a newer way to invoke create2 without assembly, you just need to pass salt
// https://docs.soliditylang.org/en/latest/control-structures.html#salted-contract-creations-create2
return address(new SelfDestruct{salt: _salt}(_salt));
}
function test(address _address) public returns (address){
// run destroy() on _address
SelfDestruct selfDestruct = SelfDestruct(_address);
selfDestruct.destroy();
//verify data can still be accessed
address ret = selfDestruct.sender();
// attempt and fail to deploy contract using salt
(bool success, ) = deployDelegateCall(selfDestruct.salt());
require(!success);
return ret;
}
}
contract SelfDestruct {
address public sender;
bytes32 public salt;
constructor(bytes32 _salt) {
sender = tx.origin;
salt=_salt;
}
function destroy() public {
selfdestruct(payable(msg.sender));
}
}

View File

@ -0,0 +1 @@
60806040523460405161001190610073565b6040518091039082f090508015801561002e573d6000803e3d6000fd5b506000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061007f565b60c78061031683390190565b6102888061008e6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630e3608df146100465780634313b53114610064578063b0d22c6214610082575b600080fd5b61004e6100a0565b60405161005b919061017d565b60405180910390f35b61006c610137565b60405161007991906101d9565b60405180910390f35b61008a61015b565b604051610097919061017d565b60405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa15801561010e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101329190610225565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006007905090565b6000819050919050565b61017781610164565b82525050565b6000602082019050610192600083018461016e565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101c382610198565b9050919050565b6101d3816101b8565b82525050565b60006020820190506101ee60008301846101ca565b92915050565b600080fd5b61020281610164565b811461020d57600080fd5b50565b60008151905061021f816101f9565b92915050565b60006020828403121561023b5761023a6101f4565b5b600061024984828501610210565b9150509291505056fea2646970667358221220c24abd10dbe58d92bfe62cb351771fcdc45d54241a8ce7085f2a75179c67cd8a64736f6c63430008110033608060405260b5806100126000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c806312065fe014602d575b600080fd5b60336047565b604051603e91906066565b60405180910390f35b600047905090565b6000819050919050565b606081604f565b82525050565b6000602082019050607960008301846059565b9291505056fea26469706673582212207123972a300833ee01aebf99e4bdf8ecf9f01c0d3dd776048bd41803c6855c0e64736f6c63430008110033

View File

@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17;
contract DeployValueTest {
address public newContract;
constructor() payable {
newContract = address(new NewContract{value: msg.value}());
}
function getConst() public view returns (uint) {
return 7;
}
function getNewContractBalance() public view returns (uint) {
return NewContract(newContract).getBalance();
}
}
contract NewContract {
constructor() payable {
}
function getBalance() public view returns (uint) {
return address(this).balance;
}
}

2
itests/contracts/compile.sh Executable file → Normal file
View File

@ -12,7 +12,7 @@ find . -name \*.sol -print0 |
#for these contracts we have 2 contracts in the same solidity file
#this command grabs the correct bytecode for us
for filename in Constructor TestApp ValueSender ; do
for filename in Constructor TestApp ValueSender Create2Factory DeployValueTest; do
echo $filename
solc --bin $filename.sol | tail -n5|head -n1 | tr -d "\n" > $filename.hex
done

View File

@ -0,0 +1,124 @@
// stm: #integration
package itests
import (
"bytes"
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
"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/builtin"
"github.com/filecoin-project/go-state-types/builtin/v10/eam"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/manifest"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/cli"
)
type marshalable interface {
cbor.Marshaler
cbor.Unmarshaler
}
type testCase struct {
ActorKey string
MethodNum abi.MethodNum
retVal marshalable
}
// Used './lotus state replay --show-trace <msg-cid>' to get params/return to decode.
func TestDecodeParams(t *testing.T) {
testCborBytes := abi.CborBytes([]byte{1, 2, 3})
testCases := []testCase{
{
ActorKey: manifest.EvmKey,
MethodNum: builtin.MethodsEVM.InvokeContract,
retVal: &testCborBytes,
},
{
ActorKey: manifest.EamKey,
MethodNum: builtin.MethodsEAM.CreateExternal,
retVal: &testCborBytes,
},
}
for _, _tc := range testCases {
tc := _tc
t.Run(tc.ActorKey+" "+tc.MethodNum.String(), func(t *testing.T) {
av, err := actorstypes.VersionForNetwork(build.TestNetworkVersion)
require.NoError(t, err)
actorCodeCid, found := actors.GetActorCodeID(av, tc.ActorKey)
require.True(t, found)
buf := bytes.NewBuffer(nil)
if err := tc.retVal.MarshalCBOR(buf); err != nil {
t.Fatal(err)
}
paramString, err := cli.JsonParams(actorCodeCid, tc.MethodNum, buf.Bytes())
require.NoError(t, err)
jsonParams, err := json.MarshalIndent(tc.retVal, "", " ")
require.NoError(t, err)
require.Equal(t, string(jsonParams), paramString)
})
}
}
func TestDecodeReturn(t *testing.T) {
testCborBytes := abi.CborBytes([]byte{1, 2, 3})
robustAddr, err := address.NewIDAddress(12345)
require.NoError(t, err)
//ethAddr, err := ethtypes.ParseEthAddress("d4c5fb16488Aa48081296299d54b0c648C9333dA")
//require.NoError(t, err)
testReturn := eam.CreateExternalReturn{
ActorID: 12345,
RobustAddress: &robustAddr,
EthAddress: [20]byte{},
}
testCases := []testCase{
{
ActorKey: manifest.EvmKey,
MethodNum: builtin.MethodsEVM.InvokeContract,
retVal: &testCborBytes,
},
{
ActorKey: manifest.EamKey,
MethodNum: builtin.MethodsEAM.CreateExternal,
retVal: &testReturn,
},
}
for _, _tc := range testCases {
tc := _tc
t.Run(tc.ActorKey+" "+tc.MethodNum.String(), func(t *testing.T) {
av, err := actorstypes.VersionForNetwork(build.TestNetworkVersion)
require.NoError(t, err)
actorCodeCid, found := actors.GetActorCodeID(av, tc.ActorKey)
require.True(t, found)
buf := bytes.NewBuffer(nil)
if err := tc.retVal.MarshalCBOR(buf); err != nil {
t.Fatal(err)
}
returnString, err := cli.JsonReturn(actorCodeCid, tc.MethodNum, buf.Bytes())
require.NoError(t, err)
jsonReturn, err := json.MarshalIndent(tc.retVal, "", " ")
require.NoError(t, err)
require.Equal(t, string(jsonReturn), returnString)
})
}
}

View File

@ -0,0 +1,514 @@
package itests
import (
"bytes"
"context"
"encoding/binary"
"encoding/hex"
"encoding/json"
"os"
"strings"
"testing"
"time"
"github.com/go-openapi/spec"
"github.com/gregdhill/go-openrpc/parse"
orpctypes "github.com/gregdhill/go-openrpc/types"
manet "github.com/multiformats/go-multiaddr/net"
"github.com/stretchr/testify/require"
"github.com/xeipuuv/gojsonschema"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/types/ethtypes"
"github.com/filecoin-project/lotus/chain/wallet/key"
"github.com/filecoin-project/lotus/itests/kit"
)
// TODO generate this using reflection. It's the same as the EthAPI except every return value is a json.RawMessage
type ethAPIRaw struct {
EthAccounts func(context.Context) (json.RawMessage, error)
EthBlockNumber func(context.Context) (json.RawMessage, error)
EthCall func(context.Context, ethtypes.EthCall, string) (json.RawMessage, error)
EthChainId func(context.Context) (json.RawMessage, error)
EthEstimateGas func(context.Context, ethtypes.EthCall) (json.RawMessage, error)
EthFeeHistory func(context.Context, ethtypes.EthUint64, string, []float64) (json.RawMessage, error)
EthGasPrice func(context.Context) (json.RawMessage, error)
EthGetBalance func(context.Context, ethtypes.EthAddress, string) (json.RawMessage, error)
EthGetBlockByHash func(context.Context, ethtypes.EthHash, bool) (json.RawMessage, error)
EthGetBlockByNumber func(context.Context, string, bool) (json.RawMessage, error)
EthGetBlockTransactionCountByHash func(context.Context, ethtypes.EthHash) (json.RawMessage, error)
EthGetBlockTransactionCountByNumber func(context.Context, ethtypes.EthUint64) (json.RawMessage, error)
EthGetCode func(context.Context, ethtypes.EthAddress, string) (json.RawMessage, error)
EthGetFilterChanges func(context.Context, ethtypes.EthFilterID) (json.RawMessage, error)
EthGetFilterLogs func(context.Context, ethtypes.EthFilterID) (json.RawMessage, error)
EthGetLogs func(context.Context, *ethtypes.EthFilterSpec) (json.RawMessage, error)
EthGetStorageAt func(context.Context, ethtypes.EthAddress, ethtypes.EthBytes, string) (json.RawMessage, error)
EthGetTransactionByBlockHashAndIndex func(context.Context, ethtypes.EthHash, ethtypes.EthUint64) (json.RawMessage, error)
EthGetTransactionByBlockNumberAndIndex func(context.Context, ethtypes.EthUint64, ethtypes.EthUint64) (json.RawMessage, error)
EthGetTransactionByHash func(context.Context, *ethtypes.EthHash) (json.RawMessage, error)
EthGetTransactionCount func(context.Context, ethtypes.EthAddress, string) (json.RawMessage, error)
EthGetTransactionReceipt func(context.Context, ethtypes.EthHash) (json.RawMessage, error)
EthMaxPriorityFeePerGas func(context.Context) (json.RawMessage, error)
EthNewBlockFilter func(context.Context) (json.RawMessage, error)
EthNewFilter func(context.Context, *ethtypes.EthFilterSpec) (json.RawMessage, error)
EthNewPendingTransactionFilter func(context.Context) (json.RawMessage, error)
EthSendRawTransaction func(context.Context, ethtypes.EthBytes) (json.RawMessage, error)
EthSubscribe func(context.Context, string, *ethtypes.EthSubscriptionParams) (json.RawMessage, error)
EthUninstallFilter func(context.Context, ethtypes.EthFilterID) (json.RawMessage, error)
EthUnsubscribe func(context.Context, ethtypes.EthSubscriptionID) (json.RawMessage, error)
}
func TestEthOpenRPCConformance(t *testing.T) {
kit.QuietAllLogsExcept("events", "messagepool")
// specs/eth_openrpc.json is built from https://github.com/ethereum/execution-apis
specJSON, err := os.ReadFile("specs/eth_openrpc.json")
require.NoError(t, err)
specParsed := orpctypes.NewOpenRPCSpec1()
err = json.Unmarshal(specJSON, specParsed)
require.NoError(t, err)
parse.GetTypes(specParsed, specParsed.Objects)
schemas := make(map[string]spec.Schema)
for _, method := range specParsed.Methods {
if method.Result != nil {
schemas[method.Name] = method.Result.Schema
}
}
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.WithEthRPC())
ens.InterconnectAll().BeginMining(10 * time.Millisecond)
contractHex, err := os.ReadFile("contracts/EventMatrix.hex")
require.NoError(t, err)
// strip any trailing newlines from the file
contractHex = bytes.TrimRight(contractHex, "\n")
contractBin, err := hex.DecodeString(string(contractHex))
require.NoError(t, err)
senderKey, senderEthAddr, senderFilAddr := client.EVM().NewAccount()
_, receiverEthAddr, _ := client.EVM().NewAccount()
kit.SendFunds(ctx, t, client, senderFilAddr, types.FromFil(1000))
deployerAddr, err := client.EVM().WalletDefaultAddress(ctx)
require.NoError(t, err)
pendingTransactionFilterID, err := client.EthNewPendingTransactionFilter(ctx)
require.NoError(t, err)
blockFilterID, err := client.EthNewBlockFilter(ctx)
require.NoError(t, err)
filterAllLogs := kit.NewEthFilterBuilder().FromBlockEpoch(0).Filter()
logFilterID, err := client.EthNewFilter(ctx, filterAllLogs)
require.NoError(t, err)
uninstallableFilterID, err := client.EthNewFilter(ctx, filterAllLogs)
require.NoError(t, err)
rawSignedEthTx := createRawSignedEthTx(ctx, t, client, senderEthAddr, receiverEthAddr, senderKey, contractBin)
result := client.EVM().DeployContract(ctx, deployerAddr, contractBin)
contractAddr, err := address.NewIDAddress(result.ActorID)
require.NoError(t, err)
contractEthAddr := ethtypes.EthAddress(result.EthAddress)
messageWithEvents, blockHashWithMessage, blockNumberWithMessage := waitForMessageWithEvents(ctx, t, client, deployerAddr, contractAddr)
// create a json-rpc client that returns raw json responses
var ethapi ethAPIRaw
netAddr, err := manet.ToNetAddr(client.ListenAddr)
require.NoError(t, err)
rpcAddr := "ws://" + netAddr.String() + "/rpc/v1"
closer, err := jsonrpc.NewClient(ctx, rpcAddr, "Filecoin", &ethapi, nil)
require.NoError(t, err)
defer closer()
testCases := []struct {
method string
variant string // suffix applied to the test name to distinguish different variants of a method call
call func(*ethAPIRaw) (json.RawMessage, error)
skipReason string
}{
// Alphabetical order
{
method: "eth_accounts",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthAccounts(context.Background())
},
},
{
method: "eth_blockNumber",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthBlockNumber(context.Background())
},
},
{
method: "eth_call",
variant: "latest",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthCall(context.Background(), ethtypes.EthCall{
From: &senderEthAddr,
Data: contractBin,
}, "latest")
},
},
{
method: "eth_chainId",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthChainId(context.Background())
},
},
{
method: "eth_estimateGas",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthEstimateGas(context.Background(), ethtypes.EthCall{
From: &senderEthAddr,
Data: contractBin,
})
},
},
{
method: "eth_feeHistory",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthFeeHistory(context.Background(), ethtypes.EthUint64(2), "", nil)
},
},
{
method: "eth_gasPrice",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGasPrice(context.Background())
},
},
{
method: "eth_getBalance",
variant: "blocknumber",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBalance(context.Background(), contractEthAddr, "0x0")
},
},
{
method: "eth_getBlockByHash",
variant: "txhashes",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByHash(context.Background(), blockHashWithMessage, false)
},
},
{
method: "eth_getBlockByHash",
variant: "txfull",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByHash(context.Background(), blockHashWithMessage, true)
},
},
{
method: "eth_getBlockByNumber",
variant: "earliest",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), "earliest", true)
},
skipReason: "earliest block is not supported",
},
{
method: "eth_getBlockByNumber",
variant: "pending",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), "pending", true)
},
},
{
method: "eth_getBlockByNumber",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), blockNumberWithMessage.Hex(), true)
},
},
{
method: "eth_getBlockTransactionCountByHash",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockTransactionCountByHash(context.Background(), blockHashWithMessage)
},
},
{
method: "eth_getBlockTransactionCountByNumber",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockTransactionCountByNumber(context.Background(), blockNumberWithMessage)
},
},
{
method: "eth_getCode",
variant: "blocknumber",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetCode(context.Background(), contractEthAddr, blockNumberWithMessage.Hex())
},
},
{
method: "eth_getFilterChanges",
variant: "pendingtransaction",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return a.EthGetFilterChanges(ctx, pendingTransactionFilterID)
},
},
{
method: "eth_getFilterChanges",
variant: "block",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return a.EthGetFilterChanges(ctx, blockFilterID)
},
},
{
method: "eth_getFilterChanges",
variant: "logs",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return a.EthGetFilterChanges(ctx, logFilterID)
},
},
{
method: "eth_getFilterLogs",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return a.EthGetFilterLogs(ctx, logFilterID)
},
},
{
method: "eth_getLogs",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetLogs(context.Background(), filterAllLogs)
},
},
{
method: "eth_getStorageAt",
variant: "blocknumber",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetStorageAt(context.Background(), contractEthAddr, ethtypes.EthBytes{0}, "0x0")
},
},
{
method: "eth_getTransactionByBlockHashAndIndex",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByBlockHashAndIndex(context.Background(), blockHashWithMessage, ethtypes.EthUint64(0))
},
skipReason: "unimplemented",
},
{
method: "eth_getTransactionByBlockNumberAndIndex",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByBlockNumberAndIndex(context.Background(), blockNumberWithMessage, ethtypes.EthUint64(0))
},
skipReason: "unimplemented",
},
{
method: "eth_getTransactionByHash",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByHash(context.Background(), &messageWithEvents)
},
},
{
method: "eth_getTransactionCount",
variant: "blocknumber",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionCount(context.Background(), senderEthAddr, blockNumberWithMessage.Hex())
},
},
{
method: "eth_getTransactionReceipt",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionReceipt(context.Background(), messageWithEvents)
},
},
{
method: "eth_maxPriorityFeePerGas",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthMaxPriorityFeePerGas(context.Background())
},
},
{
method: "eth_newBlockFilter",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthNewBlockFilter(context.Background())
},
},
{
method: "eth_newFilter",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthNewFilter(context.Background(), filterAllLogs)
},
},
{
method: "eth_newPendingTransactionFilter",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthNewPendingTransactionFilter(context.Background())
},
},
{
method: "eth_sendRawTransaction",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthSendRawTransaction(context.Background(), rawSignedEthTx)
},
},
{
method: "eth_uninstallFilter",
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return a.EthUninstallFilter(ctx, uninstallableFilterID)
},
},
}
for _, tc := range testCases {
tc := tc
name := tc.method
if tc.variant != "" {
name += "_" + tc.variant
}
t.Run(name, func(t *testing.T) {
if tc.skipReason != "" {
t.Skipf(tc.skipReason)
}
schema, ok := schemas[tc.method]
require.True(t, ok, "method not found in openrpc spec")
resp, err := tc.call(&ethapi)
require.NoError(t, err)
respJson, err := json.Marshal(resp)
require.NoError(t, err)
loader := gojsonschema.NewGoLoader(schema)
resploader := gojsonschema.NewBytesLoader(respJson)
result, err := gojsonschema.Validate(loader, resploader)
require.NoError(t, err)
if !result.Valid() {
if len(result.Errors()) == 1 && strings.Contains(result.Errors()[0].String(), "Must validate one and only one schema (oneOf)") {
// Ignore this error, since it seems the openrpc spec can't handle it
// New transaction and block filters have the same schema: an array of 32 byte hashes
return
}
niceRespJson, err := json.MarshalIndent(resp, "", " ")
if err == nil {
t.Logf("response was %s", niceRespJson)
}
schemaJson, err := json.MarshalIndent(schema, "", " ")
if err == nil {
t.Logf("schema was %s", schemaJson)
}
// check against https://www.jsonschemavalidator.net/
for _, desc := range result.Errors() {
t.Logf("- %s\n", desc)
}
t.Errorf("response did not validate")
}
})
}
}
func createRawSignedEthTx(ctx context.Context, t *testing.T, client *kit.TestFullNode, senderEthAddr ethtypes.EthAddress, receiverEthAddr ethtypes.EthAddress, senderKey *key.Key, contractBin []byte) []byte {
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
From: &senderEthAddr,
Data: contractBin,
})
require.NoError(t, err)
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
require.NoError(t, err)
tx := ethtypes.EthTxArgs{
ChainID: build.Eip155ChainId,
Value: big.NewInt(100),
Nonce: 0,
To: &receiverEthAddr,
MaxFeePerGas: types.NanoFil,
MaxPriorityFeePerGas: big.Int(maxPriorityFeePerGas),
GasLimit: int(gaslimit),
V: big.Zero(),
R: big.Zero(),
S: big.Zero(),
}
client.EVM().SignTransaction(&tx, senderKey.PrivateKey)
signed, err := tx.ToRlpSignedMsg()
require.NoError(t, err)
return signed
}
func waitForMessageWithEvents(ctx context.Context, t *testing.T, client *kit.TestFullNode, sender address.Address, target address.Address) (ethtypes.EthHash, ethtypes.EthHash, ethtypes.EthUint64) {
vals := []uint64{44, 27, 19, 12}
inputData := []byte{}
for _, v := range vals {
buf := make([]byte, 32)
binary.BigEndian.PutUint64(buf[24:], v)
inputData = append(inputData, buf...)
}
// send a message that exercises event logs
ret, err := client.EVM().InvokeSolidity(ctx, sender, target, kit.EventMatrixContract.Fn["logEventThreeIndexedWithData"], inputData)
require.NoError(t, err)
require.True(t, ret.Receipt.ExitCode.IsSuccess(), "contract execution failed")
msgHash, err := client.EthGetTransactionHashByCid(ctx, ret.Message)
require.NoError(t, err)
require.NotNil(t, msgHash)
ts, err := client.ChainGetTipSet(ctx, ret.TipSet)
require.NoError(t, err)
blockNumber := ethtypes.EthUint64(ts.Height())
tsCid, err := ts.Key().Cid()
require.NoError(t, err)
blockHash, err := ethtypes.EthHashFromCid(tsCid)
require.NoError(t, err)
return *msgHash, blockHash, blockNumber
}

View File

@ -11,12 +11,16 @@ import (
"time"
"github.com/stretchr/testify/require"
"golang.org/x/crypto/sha3"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/manifest"
gstStore "github.com/filecoin-project/go-state-types/store"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin/evm"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/types/ethtypes"
"github.com/filecoin-project/lotus/itests/kit"
@ -219,4 +223,32 @@ func TestDeployment(t *testing.T) {
require.NoError(t, err)
client.AssertActorType(ctx, contractAddr, "evm")
// Check bytecode and bytecode hash match.
contractAct, err := client.StateGetActor(ctx, contractAddr, types.EmptyTSK)
require.NoError(t, err)
bs := blockstore.NewAPIBlockstore(client)
ctxStore := gstStore.WrapBlockStore(ctx, bs)
evmSt, err := evm.Load(ctxStore, contractAct)
require.NoError(t, err)
byteCodeCid, err := evmSt.GetBytecodeCID()
require.NoError(t, err)
byteCode, err := bs.Get(ctx, byteCodeCid)
require.NoError(t, err)
byteCodeHashChain, err := evmSt.GetBytecodeHash()
require.NoError(t, err)
hasher := sha3.NewLegacyKeccak256()
hasher.Write(byteCode.RawData())
byteCodeHash := hasher.Sum(nil)
require.Equal(t, byteCodeHashChain[:], byteCodeHash)
byteCodeSt, err := evmSt.GetBytecode()
require.NoError(t, err)
require.Equal(t, byteCode.RawData(), byteCodeSt)
}

File diff suppressed because it is too large Load Diff

View File

@ -117,11 +117,9 @@ func TestLegacyTransaction(t *testing.T) {
require.NoError(t, err)
_, err = client.EVM().EthSendRawTransaction(ctx, txBytes)
require.ErrorContains(t, err, "legacy transaction is not supported")
}
func TestContractDeploymentValidSignature(t *testing.T) {
blockTime := 100 * time.Millisecond
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
@ -270,7 +268,6 @@ func TestContractInvocation(t *testing.T) {
// Success.
require.EqualValues(t, ethtypes.EthUint64(0x1), receipt.Status)
}
func deployContractTx(ctx context.Context, client *kit.TestFullNode, ethAddr ethtypes.EthAddress, contract []byte) (*ethtypes.EthTxArgs, error) {

View File

@ -3,6 +3,7 @@ package itests
import (
"bytes"
"context"
"crypto/rand"
"encoding/binary"
"encoding/hex"
"fmt"
@ -123,7 +124,7 @@ func TestFEVMRecursiveFail(t *testing.T) {
t.Run(fmt.Sprintf("TestFEVMRecursiveFail%d", failCallCount), func(t *testing.T) {
_, wait, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, idAddr, "recursiveCall(uint256)", buildInputFromuint64(failCallCount))
require.Error(t, err)
require.Equal(t, exitcode.ExitCode(23), wait.Receipt.ExitCode)
require.Equal(t, exitcode.ExitCode(37), wait.Receipt.ExitCode)
})
}
}
@ -150,24 +151,26 @@ func TestFEVMRecursive2(t *testing.T) {
require.Equal(t, 2, len(events))
}
// TestFEVMBasic does a basic fevm contract installation and invocation
// recursive delegate call succeeds up to 238 times
func TestFEVMRecursiveDelegatecall(t *testing.T) {
// TestFEVMRecursiveDelegatecallCount tests the maximum delegatecall recursion depth. It currently
// succeeds succeeds up to 237 times.
func TestFEVMRecursiveDelegatecallCount(t *testing.T) {
ctx, cancel, client := kit.SetupFEVMTest(t)
defer cancel()
highestSuccessCount := uint64(235)
filename := "contracts/RecursiveDelegeatecall.hex"
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(1))
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(2))
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(10))
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(100))
recursiveDelegatecallSuccess(ctx, t, client, filename, highestSuccessCount)
//success with 238 or fewer calls
for i := uint64(1); i <= 238; i += 30 {
recursiveDelegatecallSuccess(ctx, t, client, filename, i)
}
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(238))
recursiveDelegatecallFail(ctx, t, client, filename, highestSuccessCount+1)
recursiveDelegatecallFail(ctx, t, client, filename, uint64(1000))
recursiveDelegatecallFail(ctx, t, client, filename, uint64(10000000))
for i := uint64(239); i <= 800; i += 40 {
recursiveDelegatecallFail(ctx, t, client, filename, i)
}
}
// TestFEVMBasic does a basic fevm contract installation and invocation
@ -470,10 +473,9 @@ func TestFEVMSendGasLimit(t *testing.T) {
}
// TestFEVMDelegateCall deploys the two contracts in TestFEVMDelegateCall but instead of A calling B, A calls A which should cause A to cause A in an infinite loop and should give a reasonable error
// XXX should not be fatal errors
func TestFEVMDelegateCallRecursiveFail(t *testing.T) {
//TODO change the gas limit of this invocation and confirm that the number of errors is different
//also TODO should we not have fatal error show up here?
//TODO change the gas limit of this invocation and confirm that the number of errors is
// different
ctx, cancel, client := kit.SetupFEVMTest(t)
defer cancel()
@ -486,17 +488,16 @@ func TestFEVMDelegateCallRecursiveFail(t *testing.T) {
inputDataValue := inputDataFromArray([]byte{7})
inputData := append(inputDataContract, inputDataValue...)
//verify that the returned value of the call to setvars is 7
//verify that we run out of gas then revert.
_, wait, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, actorAddr, "setVarsSelf(address,uint256)", inputData)
require.Error(t, err)
require.Equal(t, exitcode.SysErrorIllegalArgument, wait.Receipt.ExitCode)
require.Equal(t, exitcode.ExitCode(33), wait.Receipt.ExitCode)
//assert no fatal errors but still there are errors::
errorAny := "fatal error"
require.NotContains(t, err.Error(), errorAny)
}
// XXX Currently fails as self destruct has a bug
// TestFEVMTestSendValueThroughContracts creates A and B contract and exchanges value
// and self destructs and accounts for value sent
func TestFEVMTestSendValueThroughContractsAndDestroy(t *testing.T) {
@ -601,10 +602,10 @@ func TestFEVMRecursiveActorCall(t *testing.T) {
t.Run("n=200,r=32", testN(200, 32, exitcode.Ok))
t.Run("n=251,r=32", testN(251, 32, exitcode.Ok))
t.Run("n=0,r=254", testN(0, 254, exitcode.Ok))
t.Run("n=0,r=252", testN(0, 252, exitcode.Ok))
t.Run("n=251,r=166", testN(251, 166, exitcode.Ok))
t.Run("n=0,r=256-fails", testN(0, 256, exitcode.ExitCode(33))) // 33 means transaction reverted
t.Run("n=0,r=253-fails", testN(0, 253, exitcode.ExitCode(33))) // 33 means transaction reverted
t.Run("n=251,r=167-fails", testN(251, 167, exitcode.ExitCode(33)))
}
@ -704,3 +705,84 @@ func TestFEVMRecursiveActorCallEstimate(t *testing.T) {
t.Run("n=50", testN(50))
t.Run("n=100", testN(100))
}
// TestFEVM deploys a contract while sending value to it
func TestFEVMDeployWithValue(t *testing.T) {
ctx, cancel, client := kit.SetupFEVMTest(t)
defer cancel()
//testValue is the amount sent when the contract is created
//at the end we check that the new contract has a balance of testValue
testValue := big.NewInt(20)
// deploy DeployValueTest which creates NewContract
// testValue is sent to DeployValueTest and that amount is
// also sent to NewContract
filenameActor := "contracts/DeployValueTest.hex"
fromAddr, idAddr := client.EVM().DeployContractFromFilenameWithValue(ctx, filenameActor, testValue)
//call getNewContractBalance to find the value of NewContract
ret, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, idAddr, "getNewContractBalance()", []byte{})
require.NoError(t, err)
contractBalance, err := decodeOutputToUint64(ret)
require.NoError(t, err)
//require balance of NewContract is testValue
require.Equal(t, testValue.Uint64(), contractBalance)
}
func TestFEVMDestroyCreate2(t *testing.T) {
ctx, cancel, client := kit.SetupFEVMTest(t)
defer cancel()
//deploy create2 factory contract
filename := "contracts/Create2Factory.hex"
fromAddr, idAddr := client.EVM().DeployContractFromFilename(ctx, filename)
//construct salt for create2
salt := make([]byte, 32)
_, err := rand.Read(salt)
require.NoError(t, err)
//deploy contract using create2 factory
selfDestructAddress, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, idAddr, "deploy(bytes32)", salt)
require.NoError(t, err)
//convert to filecoin actor address so we can call InvokeContractByFuncName
ea, err := ethtypes.CastEthAddress(selfDestructAddress[12:])
require.NoError(t, err)
selfDestructAddressActor, err := ea.ToFilecoinAddress()
require.NoError(t, err)
//read sender property from contract
ret, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, selfDestructAddressActor, "sender()", []byte{})
require.NoError(t, err)
//assert contract has correct data
ethFromAddr := inputDataFromFrom(ctx, t, client, fromAddr)
require.Equal(t, ethFromAddr, ret)
//run test() which 1.calls sefldestruct 2. verifies sender() is the correct value 3. attempts and fails to deploy via create2
testSenderAddress, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, idAddr, "test(address)", selfDestructAddress)
require.NoError(t, err)
require.Equal(t, testSenderAddress, ethFromAddr)
//read sender() but get response of 0x0 because of self destruct
senderAfterDestroy, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, selfDestructAddressActor, "sender()", []byte{})
require.NoError(t, err)
require.Equal(t, []byte{}, senderAfterDestroy)
// deploy new contract at same address usign same salt
newAddressSelfDestruct, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, idAddr, "deploy(bytes32)", salt)
require.NoError(t, err)
require.Equal(t, newAddressSelfDestruct, selfDestructAddress)
//verify sender() property is correct
senderSecondCall, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, selfDestructAddressActor, "sender()", []byte{})
require.NoError(t, err)
//assert contract has correct data
require.Equal(t, ethFromAddr, senderSecondCall)
}

View File

@ -5,6 +5,7 @@ import (
"context"
"encoding/binary"
"encoding/hex"
"errors"
"fmt"
"os"
"testing"
@ -42,19 +43,18 @@ func (f *TestFullNode) EVM() *EVM {
return &EVM{f}
}
func (e *EVM) DeployContract(ctx context.Context, sender address.Address, bytecode []byte) eam.CreateReturn {
var err error
func (e *EVM) DeployContractWithValue(ctx context.Context, sender address.Address, bytecode []byte, value big.Int) eam.CreateReturn {
require := require.New(e.t)
method := builtintypes.MethodsEAM.CreateExternal
initcode := abi.CborBytes(bytecode)
params, err := actors.SerializeParams(&initcode)
require.NoError(err)
params, errActors := actors.SerializeParams(&initcode)
require.NoError(errActors)
msg := &types.Message{
To: builtintypes.EthereumAddressManagerActorAddr,
From: sender,
Value: big.Zero(),
Value: value,
Method: method,
Params: params,
}
@ -76,8 +76,11 @@ func (e *EVM) DeployContract(ctx context.Context, sender address.Address, byteco
return result
}
func (e *EVM) DeployContract(ctx context.Context, sender address.Address, bytecode []byte) eam.CreateReturn {
return e.DeployContractWithValue(ctx, sender, bytecode, big.Zero())
}
func (e *EVM) DeployContractFromFilename(ctx context.Context, binFilename string) (address.Address, address.Address) {
func (e *EVM) DeployContractFromFilenameWithValue(ctx context.Context, binFilename string, value big.Int) (address.Address, address.Address) {
contractHex, err := os.ReadFile(binFilename)
require.NoError(e.t, err)
@ -90,12 +93,15 @@ func (e *EVM) DeployContractFromFilename(ctx context.Context, binFilename string
fromAddr, err := e.WalletDefaultAddress(ctx)
require.NoError(e.t, err)
result := e.DeployContract(ctx, fromAddr, contract)
result := e.DeployContractWithValue(ctx, fromAddr, contract, value)
idAddr, err := address.NewIDAddress(result.ActorID)
require.NoError(e.t, err)
return fromAddr, idAddr
}
func (e *EVM) DeployContractFromFilename(ctx context.Context, binFilename string) (address.Address, address.Address) {
return e.DeployContractFromFilenameWithValue(ctx, binFilename, big.Zero())
}
func (e *EVM) InvokeSolidity(ctx context.Context, sender address.Address, target address.Address, selector []byte, inputData []byte) (*api.MsgLookup, error) {
params := append(selector, inputData...)
@ -126,7 +132,11 @@ func (e *EVM) InvokeSolidity(ctx context.Context, sender address.Address, target
if err != nil {
return nil, err
}
if !wait.Receipt.ExitCode.IsSuccess() {
result, err := e.StateReplay(ctx, types.EmptyTSK, wait.Message)
require.NoError(e.t, err)
e.t.Log(result.Error)
}
return wait, nil
}
@ -244,7 +254,9 @@ func (e *EVM) InvokeContractByFuncName(ctx context.Context, fromAddr address.Add
return nil, wait, err
}
if !wait.Receipt.ExitCode.IsSuccess() {
return nil, wait, fmt.Errorf("contract execution failed - %v", wait.Receipt.ExitCode)
result, err := e.StateReplay(ctx, types.EmptyTSK, wait.Message)
require.NoError(e.t, err)
return nil, wait, errors.New(result.Error)
}
result, err := cbg.ReadByteArray(bytes.NewBuffer(wait.Receipt.Return), uint64(len(wait.Receipt.Return)))
if err != nil {
@ -354,3 +366,77 @@ func (e *EVM) TransferValueOrFail(ctx context.Context, fromAddr address.Address,
require.NoError(e.t, err)
require.Equal(e.t, exitcode.Ok, mLookup.Receipt.ExitCode)
}
func NewEthFilterBuilder() *EthFilterBuilder {
return &EthFilterBuilder{}
}
type EthFilterBuilder struct {
filter ethtypes.EthFilterSpec
}
func (e *EthFilterBuilder) Filter() *ethtypes.EthFilterSpec { return &e.filter }
func (e *EthFilterBuilder) FromBlock(v string) *EthFilterBuilder {
e.filter.FromBlock = &v
return e
}
func (e *EthFilterBuilder) FromBlockEpoch(v abi.ChainEpoch) *EthFilterBuilder {
s := ethtypes.EthUint64(v).Hex()
e.filter.FromBlock = &s
return e
}
func (e *EthFilterBuilder) ToBlock(v string) *EthFilterBuilder {
e.filter.ToBlock = &v
return e
}
func (e *EthFilterBuilder) ToBlockEpoch(v abi.ChainEpoch) *EthFilterBuilder {
s := ethtypes.EthUint64(v).Hex()
e.filter.ToBlock = &s
return e
}
func (e *EthFilterBuilder) BlockHash(h ethtypes.EthHash) *EthFilterBuilder {
e.filter.BlockHash = &h
return e
}
func (e *EthFilterBuilder) AddressOneOf(as ...ethtypes.EthAddress) *EthFilterBuilder {
e.filter.Address = as
return e
}
func (e *EthFilterBuilder) Topic1OneOf(hs ...ethtypes.EthHash) *EthFilterBuilder {
if len(e.filter.Topics) == 0 {
e.filter.Topics = make(ethtypes.EthTopicSpec, 1)
}
e.filter.Topics[0] = hs
return e
}
func (e *EthFilterBuilder) Topic2OneOf(hs ...ethtypes.EthHash) *EthFilterBuilder {
for len(e.filter.Topics) < 2 {
e.filter.Topics = append(e.filter.Topics, nil)
}
e.filter.Topics[1] = hs
return e
}
func (e *EthFilterBuilder) Topic3OneOf(hs ...ethtypes.EthHash) *EthFilterBuilder {
for len(e.filter.Topics) < 3 {
e.filter.Topics = append(e.filter.Topics, nil)
}
e.filter.Topics[2] = hs
return e
}
func (e *EthFilterBuilder) Topic4OneOf(hs ...ethtypes.EthHash) *EthFilterBuilder {
for len(e.filter.Topics) < 4 {
e.filter.Topics = append(e.filter.Topics, nil)
}
e.filter.Topics[3] = hs
return e
}

64
itests/kit/solidity.go Normal file
View File

@ -0,0 +1,64 @@
package kit
import (
"golang.org/x/crypto/sha3"
)
func EthTopicHash(sig string) []byte {
hasher := sha3.NewLegacyKeccak256()
hasher.Write([]byte(sig))
return hasher.Sum(nil)
}
func EthFunctionHash(sig string) []byte {
hasher := sha3.NewLegacyKeccak256()
hasher.Write([]byte(sig))
return hasher.Sum(nil)[:4]
}
// SolidityContractDef holds information about one of the test contracts
type SolidityContractDef struct {
Filename string // filename of the hex of the contract, e.g. contracts/EventMatrix.hex
Fn map[string][]byte // mapping of function names to 32-bit selector
Ev map[string][]byte // mapping of event names to 256-bit signature hashes
}
var EventMatrixContract = SolidityContractDef{
Filename: "contracts/EventMatrix.hex",
Fn: map[string][]byte{
"logEventZeroData": EthFunctionHash("logEventZeroData()"),
"logEventOneData": EthFunctionHash("logEventOneData(uint256)"),
"logEventTwoData": EthFunctionHash("logEventTwoData(uint256,uint256)"),
"logEventThreeData": EthFunctionHash("logEventThreeData(uint256,uint256,uint256)"),
"logEventFourData": EthFunctionHash("logEventFourData(uint256,uint256,uint256,uint256)"),
"logEventOneIndexed": EthFunctionHash("logEventOneIndexed(uint256)"),
"logEventTwoIndexed": EthFunctionHash("logEventTwoIndexed(uint256,uint256)"),
"logEventThreeIndexed": EthFunctionHash("logEventThreeIndexed(uint256,uint256,uint256)"),
"logEventOneIndexedWithData": EthFunctionHash("logEventOneIndexedWithData(uint256,uint256)"),
"logEventTwoIndexedWithData": EthFunctionHash("logEventTwoIndexedWithData(uint256,uint256,uint256)"),
"logEventThreeIndexedWithData": EthFunctionHash("logEventThreeIndexedWithData(uint256,uint256,uint256,uint256)"),
},
Ev: map[string][]byte{
"EventZeroData": EthTopicHash("EventZeroData()"),
"EventOneData": EthTopicHash("EventOneData(uint256)"),
"EventTwoData": EthTopicHash("EventTwoData(uint256,uint256)"),
"EventThreeData": EthTopicHash("EventThreeData(uint256,uint256,uint256)"),
"EventFourData": EthTopicHash("EventFourData(uint256,uint256,uint256,uint256)"),
"EventOneIndexed": EthTopicHash("EventOneIndexed(uint256)"),
"EventTwoIndexed": EthTopicHash("EventTwoIndexed(uint256,uint256)"),
"EventThreeIndexed": EthTopicHash("EventThreeIndexed(uint256,uint256,uint256)"),
"EventOneIndexedWithData": EthTopicHash("EventOneIndexedWithData(uint256,uint256)"),
"EventTwoIndexedWithData": EthTopicHash("EventTwoIndexedWithData(uint256,uint256,uint256)"),
"EventThreeIndexedWithData": EthTopicHash("EventThreeIndexedWithData(uint256,uint256,uint256,uint256)"),
},
}
var EventsContract = SolidityContractDef{
Filename: "contracts/events.bin",
Fn: map[string][]byte{
"log_zero_data": {0x00, 0x00, 0x00, 0x00},
"log_zero_nodata": {0x00, 0x00, 0x00, 0x01},
"log_four_data": {0x00, 0x00, 0x00, 0x02},
},
Ev: map[string][]byte{},
}

File diff suppressed because it is too large Load Diff

9
lib/must/must.go Normal file
View File

@ -0,0 +1,9 @@
package must
func One[R any](r R, err error) R {
if err != nil {
panic(err)
}
return r
}

View File

@ -12,7 +12,7 @@ import (
"github.com/filecoin-project/lotus/chain/types/ethtypes"
)
var ErrModuleDisabled = errors.New("module disabled, enable with Fevm.EnableEthRPC / LOTUS_FEVM_ENABLEETHPRC")
var ErrModuleDisabled = errors.New("module disabled, enable with Fevm.EnableEthRPC / LOTUS_FEVM_ENABLEETHRPC")
type EthModuleDummy struct{}

View File

@ -447,6 +447,11 @@ func (a *EthModule) EthGetCode(ctx context.Context, ethAddr ethtypes.EthAddress,
return nil, xerrors.Errorf("cannot parse block param: %s", blkParam)
}
// StateManager.Call will panic if there is no parent
if ts.Height() == 0 {
return nil, xerrors.Errorf("block param must not specify genesis block")
}
// Try calling until we find a height with no migration.
var res *api.InvocResult
for {
@ -637,7 +642,7 @@ func (a *EthModule) EthFeeHistory(ctx context.Context, blkCount ethtypes.EthUint
}
return ethtypes.EthFeeHistory{
OldestBlock: oldestBlkHeight,
OldestBlock: ethtypes.EthUint64(oldestBlkHeight),
BaseFeePerGas: baseFeeArray,
GasUsedRatio: gasUsedRatioArray,
}, nil
@ -962,7 +967,6 @@ func (a *EthModule) EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam s
if msg.To == builtintypes.EthereumAddressManagerActorAddr {
// As far as I can tell, the Eth API always returns empty on contract deployment
return ethtypes.EthBytes{}, nil
} else if len(invokeResult.MsgRct.Return) > 0 {
return cbg.ReadByteArray(bytes.NewReader(invokeResult.MsgRct.Return), uint64(len(invokeResult.MsgRct.Return)))
}
@ -1367,14 +1371,14 @@ func ethFilterResultFromEvents(evs []*filter.CollectedEvent, sa StateAPI) (*etht
var err error
for _, entry := range ev.Entries {
value, err := cborDecodeTopicValue(entry.Value)
if err != nil {
return nil, err
// Skip all events that aren't "raw" data.
if entry.Codec != cid.Raw {
continue
}
if entry.Key == ethtypes.EthTopic1 || entry.Key == ethtypes.EthTopic2 || entry.Key == ethtypes.EthTopic3 || entry.Key == ethtypes.EthTopic4 {
log.Topics = append(log.Topics, value)
log.Topics = append(log.Topics, entry.Value)
} else {
log.Data = value
log.Data = entry.Value
}
}
@ -1513,45 +1517,50 @@ func (e *ethSubscription) addFilter(ctx context.Context, f filter.Filter) {
e.filters = append(e.filters, f)
}
func (e *ethSubscription) send(ctx context.Context, v interface{}) {
resp := ethtypes.EthSubscriptionResponse{
SubscriptionID: e.id,
Result: v,
}
outParam, err := json.Marshal(resp)
if err != nil {
log.Warnw("marshaling subscription response", "sub", e.id, "error", err)
return
}
if err := e.out(ctx, outParam); err != nil {
log.Warnw("sending subscription response", "sub", e.id, "error", err)
return
}
}
func (e *ethSubscription) start(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
case v := <-e.in:
resp := ethtypes.EthSubscriptionResponse{
SubscriptionID: e.id,
}
var err error
switch vt := v.(type) {
case *filter.CollectedEvent:
resp.Result, err = ethFilterResultFromEvents([]*filter.CollectedEvent{vt}, e.StateAPI)
evs, err := ethFilterResultFromEvents([]*filter.CollectedEvent{vt}, e.StateAPI)
if err != nil {
continue
}
for _, r := range evs.Results {
e.send(ctx, r)
}
case *types.TipSet:
eb, err := newEthBlockFromFilecoinTipSet(ctx, vt, true, e.Chain, e.StateAPI)
ev, err := newEthBlockFromFilecoinTipSet(ctx, vt, true, e.Chain, e.StateAPI)
if err != nil {
break
}
resp.Result = eb
e.send(ctx, ev)
default:
log.Warnf("unexpected subscription value type: %T", vt)
}
if err != nil {
continue
}
outParam, err := json.Marshal(resp)
if err != nil {
log.Warnw("marshaling subscription response", "sub", e.id, "error", err)
continue
}
if err := e.out(ctx, outParam); err != nil {
log.Warnw("sending subscription response", "sub", e.id, "error", err)
continue
}
}
}
}
@ -1594,7 +1603,7 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx
return ethtypes.EthBlock{}, xerrors.Errorf("error loading messages for tipset: %v: %w", ts, err)
}
block := ethtypes.NewEthBlock()
block := ethtypes.NewEthBlock(len(msgs) > 0)
// this seems to be a very expensive way to get gasUsed of the block. may need to find an efficient way to do it
gasUsed := int64(0)
@ -1753,6 +1762,7 @@ func ethTxFromNativeMessage(ctx context.Context, msg *types.Message, sa StateAPI
Gas: ethtypes.EthUint64(msg.GasLimit),
MaxFeePerGas: ethtypes.EthBigInt(msg.GasFeeCap),
MaxPriorityFeePerGas: ethtypes.EthBigInt(msg.GasPremium),
AccessList: []ethtypes.EthHash{},
}
}
@ -1886,11 +1896,6 @@ func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLook
}
if len(events) > 0 {
// TODO return a dummy non-zero bloom to signal that there are logs
// need to figure out how worth it is to populate with a real bloom
// should be feasible here since we are iterating over the logs anyway
receipt.LogsBloom[255] = 0x01
receipt.Logs = make([]ethtypes.EthLog, 0, len(events))
for i, evt := range events {
l := ethtypes.EthLog{
@ -1903,14 +1908,15 @@ func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLook
}
for _, entry := range evt.Entries {
value, err := cborDecodeTopicValue(entry.Value)
if err != nil {
return api.EthTxReceipt{}, xerrors.Errorf("failed to decode event log value: %w", err)
// Ignore any non-raw values/keys.
if entry.Codec != cid.Raw {
continue
}
if entry.Key == ethtypes.EthTopic1 || entry.Key == ethtypes.EthTopic2 || entry.Key == ethtypes.EthTopic3 || entry.Key == ethtypes.EthTopic4 {
l.Topics = append(l.Topics, value)
ethtypes.EthBloomSet(receipt.LogsBloom, entry.Value)
l.Topics = append(l.Topics, entry.Value)
} else {
l.Data = value
l.Data = entry.Value
}
}
@ -1924,6 +1930,7 @@ func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLook
return api.EthTxReceipt{}, xerrors.Errorf("failed to resolve Ethereum address: %w", err)
}
ethtypes.EthBloomSet(receipt.LogsBloom, l.Address[:])
receipt.Logs = append(receipt.Logs, l)
}
}
@ -1967,6 +1974,52 @@ func (m *EthTxHashManager) Revert(ctx context.Context, from, to *types.TipSet) e
return nil
}
func (m *EthTxHashManager) PopulateExistingMappings(ctx context.Context, minHeight abi.ChainEpoch) error {
if minHeight < build.UpgradeHyggeHeight {
minHeight = build.UpgradeHyggeHeight
}
ts := m.StateAPI.Chain.GetHeaviestTipSet()
for ts.Height() > minHeight {
for _, block := range ts.Blocks() {
msgs, err := m.StateAPI.Chain.SecpkMessagesForBlock(ctx, block)
if err != nil {
// If we can't find the messages, we've either imported from snapshot or pruned the store
log.Debug("exiting message mapping population at epoch ", ts.Height())
return nil
}
for _, msg := range msgs {
m.ProcessSignedMessage(ctx, msg)
}
}
var err error
ts, err = m.StateAPI.Chain.GetTipSetFromKey(ctx, ts.Parents())
if err != nil {
return err
}
}
return nil
}
func (m *EthTxHashManager) ProcessSignedMessage(ctx context.Context, msg *types.SignedMessage) {
if msg.Signature.Type != crypto.SigTypeDelegated {
return
}
ethTx, err := newEthTxFromSignedMessage(ctx, msg, m.StateAPI)
if err != nil {
log.Errorf("error converting filecoin message to eth tx: %s", err)
}
err = m.TransactionHashLookup.UpsertHash(ethTx.Hash, msg.Cid())
if err != nil {
log.Errorf("error inserting tx mapping to db: %s", err)
}
}
func WaitForMpoolUpdates(ctx context.Context, ch <-chan api.MpoolUpdate, manager *EthTxHashManager) {
for {
select {
@ -1976,19 +2029,8 @@ func WaitForMpoolUpdates(ctx context.Context, ch <-chan api.MpoolUpdate, manager
if u.Type != api.MpoolAdd {
continue
}
if u.Message.Signature.Type != crypto.SigTypeDelegated {
continue
}
ethTx, err := newEthTxFromSignedMessage(ctx, u.Message, manager.StateAPI)
if err != nil {
log.Errorf("error converting filecoin message to eth tx: %s", err)
}
err = manager.TransactionHashLookup.UpsertHash(ethTx.Hash, u.Message.Cid())
if err != nil {
log.Errorf("error inserting tx mapping to db: %s", err)
}
manager.ProcessSignedMessage(ctx, u.Message)
}
}
}
@ -2009,45 +2051,6 @@ func EthTxHashGC(ctx context.Context, retentionDays int, manager *EthTxHashManag
}
}
func leftpad32(orig []byte) []byte {
needed := 32 - len(orig)
if needed <= 0 {
return orig
}
ret := make([]byte, 32)
copy(ret[needed:], orig)
return ret
}
func trimLeadingZeros(b []byte) []byte {
for i := range b {
if b[i] != 0 {
return b[i:]
}
}
return []byte{}
}
func cborEncodeTopicValue(orig []byte) ([]byte, error) {
var buf bytes.Buffer
err := cbg.WriteByteArray(&buf, trimLeadingZeros(orig))
if err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func cborDecodeTopicValue(orig []byte) ([]byte, error) {
if len(orig) == 0 {
return orig, nil
}
decoded, err := cbg.ReadByteArray(bytes.NewReader(orig), uint64(len(orig)))
if err != nil {
return nil, err
}
return leftpad32(decoded), nil
}
func parseEthTopics(topics ethtypes.EthTopicSpec) (map[string][][]byte, error) {
keys := map[string][][]byte{}
for idx, vals := range topics {
@ -2057,11 +2060,8 @@ func parseEthTopics(topics ethtypes.EthTopicSpec) (map[string][][]byte, error) {
// Ethereum topics are emitted using `LOG{0..4}` opcodes resulting in topics1..4
key := fmt.Sprintf("t%d", idx+1)
for _, v := range vals {
encodedVal, err := cborEncodeTopicValue(v[:])
if err != nil {
return nil, xerrors.Errorf("failed to encode topic value")
}
keys[key] = append(keys[key], encodedVal)
v := v // copy the ethhash to avoid repeatedly referencing the same one.
keys[key] = append(keys[key], v[:])
}
}
return keys, nil

View File

@ -2,6 +2,7 @@ package modules
import (
"context"
"os"
"path/filepath"
"go.uber.org/fx"
@ -24,7 +25,13 @@ func EthModuleAPI(cfg config.FevmConfig) func(helpers.MetricsCtx, repo.LockedRep
return nil, err
}
transactionHashLookup, err := ethhashlookup.NewTransactionHashLookup(filepath.Join(sqlitePath, "txhash.db"))
dbPath := filepath.Join(sqlitePath, "txhash.db")
// Check if the db exists, if not, we'll back-fill some entries
_, err = os.Stat(dbPath)
dbAlreadyExists := err == nil
transactionHashLookup, err := ethhashlookup.NewTransactionHashLookup(dbPath)
if err != nil {
return nil, err
}
@ -40,6 +47,13 @@ func EthModuleAPI(cfg config.FevmConfig) func(helpers.MetricsCtx, repo.LockedRep
TransactionHashLookup: transactionHashLookup,
}
if !dbAlreadyExists {
err = ethTxHashManager.PopulateExistingMappings(mctx, 0)
if err != nil {
return nil, err
}
}
const ChainHeadConfidence = 1
ctx := helpers.LifecycleCtx(mctx, lc)