feat: events: integrate with FVM changes (#9644)

This commit is contained in:
raulk 2022-11-16 09:30:35 +00:00 committed by GitHub
parent 273ac513fc
commit 2735e81aaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 397 additions and 227 deletions

Binary file not shown.

View File

@ -44,23 +44,23 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "butterflynet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacech5zikzhyspdibj7ozpo5q7edmq4wnz2bkqsv532w5dbn36gv6pg"),
ManifestCid: MustParseCid("bafy2bzaceds5xqqb4dj6crvlonmfoghqkuf4cbev2ptckfwlw6xb7m2n7aomc"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzaceczu2o5v46l6jj6oe4v5pwlbacmjmmpo6klpbbzi35uexw6jx2sjg"),
"cron": MustParseCid("bafk2bzaced7h7pnzvpawfjoaauzl4rmeowsbew66zjoqx7lzfaxnifc3t4dda"),
"datacap": MustParseCid("bafk2bzacebbmaksmfux5ht7ucbxqdftkwlannhx3p5nd3jxoz6pc4vhuuomxc"),
"eam": MustParseCid("bafk2bzacedzdp6jr2w46mnnmztittt7md2krcicotqmuoil4ic5c6l3jkg2ju"),
"account": MustParseCid("bafk2bzacebzhu2otpz4gwsrtbbjxnqp22hs62dqnnjn2zhbuuwjyxmvzxp6eo"),
"cron": MustParseCid("bafk2bzaced3lid6dfxfjijysp6xoi3xnj6xmf4nvcdbui4kkgpixtopv33ue2"),
"datacap": MustParseCid("bafk2bzacecbmthy6jhkbehbwvilz5mjnqyexirgjiwahgerm6vpll3dblszvu"),
"eam": MustParseCid("bafk2bzaced2ejtrwzr5ducq243ybcnhvezdswz3ezzag3kroxi2ugtrr7e5jy"),
"embryo": MustParseCid("bafk2bzacecau3tohdilfx66pohfqdrngpuqd5oew2j5iv3c7sjlrkcm5npqos"),
"evm": MustParseCid("bafk2bzaceblv2mbvueap3f4tavi5aozgspebdqmqzskuhmd3fe2xe4jx7zkam"),
"init": MustParseCid("bafk2bzacecdylyzglnbo7j4hmkqeba2n3bmjegvsb4osoictknq4vovufrcku"),
"multisig": MustParseCid("bafk2bzaceb2kcz3342uaslo5hxgazmz6j6fx6nkrpquf43jqp6qskhpwznzes"),
"paymentchannel": MustParseCid("bafk2bzaceclkwohvisshvhunzi7fnouwlginejje2xdxxy4mf4krofi7hbhtc"),
"reward": MustParseCid("bafk2bzacecn2rkubqfohtxipehwsshez3zegailjsgjaws74cqqmz45vlistu"),
"storagemarket": MustParseCid("bafk2bzacedu3rtlofbeguc7qwdsctomv5rph2jdtebgxruitmudgh5orop77m"),
"storageminer": MustParseCid("bafk2bzaceawyrwb6e6xktx765fv3oozryfqc7z2qhynjg3thtrlykmvgodlzs"),
"storagepower": MustParseCid("bafk2bzacecwmkw5anen277bofe2nhd7bum62jwuibp4o7iqcz4lj3rbk53ylg"),
"system": MustParseCid("bafk2bzacea7kozhxosbrh3lc4azas2vqxldiclxftni7nhdip2uzghdpme6ou"),
"verifiedregistry": MustParseCid("bafk2bzacec5probznte3gi5wrb6wpuzqtynsa7xmaccbe2itlgyciwplg45uc"),
"evm": MustParseCid("bafk2bzacebqx5kqz2gt6qp6evjyflsysm7bhwxvvvuvgo6usbe4ib4lf6awfk"),
"init": MustParseCid("bafk2bzacecozkph7eoat4ptavggaom4ihtzcozszane7yu4hlrkf6iqdx5l2c"),
"multisig": MustParseCid("bafk2bzacedgmpc6qv3f7fs4dekt2vqmnuzoyyfnaxuws4hhb4ajqkxx5emb3o"),
"paymentchannel": MustParseCid("bafk2bzacea6rtmyek5ga45juh6nbl3dvxgoluehrkzu2zr2jejezrfv6s7pda"),
"reward": MustParseCid("bafk2bzacedzckhynu265erur6p3euxdgqh3iwnu5nz5dlxxvoegvfl7kz7uco"),
"storagemarket": MustParseCid("bafk2bzacectjpmcc3ckke3dtco4aljhhvebqlfyrlfebp2mgqt5mxrb26rrpq"),
"storageminer": MustParseCid("bafk2bzacedypyozzaiff62fvwosjwfa6ckt335f6quwpxdzq75shbajekycje"),
"storagepower": MustParseCid("bafk2bzaceckh535d7axpq7x6uwfvmlwxfn5xj5tr66i4ptptw47zjjwoaznnc"),
"system": MustParseCid("bafk2bzaceclhuz5raj42pzgdgtin3sko7efjd4w7q774rceuty4efihqhxc2k"),
"verifiedregistry": MustParseCid("bafk2bzacedea2rkviihjthv47rhtnahpxhqkvkblglf264dghytcz77wyg2sw"),
},
}, {
Network: "calibrationnet",
@ -100,23 +100,23 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "calibrationnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzaceakll7cw4xednc7fagkpcuigmskgnqwclloskurdpwe6ksowsveem"),
ManifestCid: MustParseCid("bafy2bzaceaxdbz4z7p5wx4uzvblugn4nvnicvfjgn5pzvyv7gklw4tdbsf4d6"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacedym6hvldrhewweusr3o47jw6ppnoqybwxfpizukin4jqm2utanc6"),
"cron": MustParseCid("bafk2bzaceajvgdgkcmyum2rgkoohf2igmjlgft6rm6cmlm6e2n2mq5vsjtbc6"),
"datacap": MustParseCid("bafk2bzacebqdsmsoomixknyc7rot4sgomvxlcnvctdzyzspdsvmvtsbzo3adw"),
"eam": MustParseCid("bafk2bzacedtrp6jlak7kfnb4w6juwys672raifm5l6fkjovtfxnsbel7nraa6"),
"account": MustParseCid("bafk2bzacea4uwonbtuceqmoledfpfihqdugxb22tno65htutqe4dgfataqczw"),
"cron": MustParseCid("bafk2bzaceccrjzha42kseb5eoh6hgfyetli3yng3frbqqhmwjuo73rb2vl4me"),
"datacap": MustParseCid("bafk2bzacecex2gxg435ztdefqrpft5dpmidahgvey7hstlv4fp3k76clxiyc6"),
"eam": MustParseCid("bafk2bzacecqsgsmnytupnkswmqfkbmnydzmz4i7gzeoprx5vhosbw7jj3qr5w"),
"embryo": MustParseCid("bafk2bzacecau3tohdilfx66pohfqdrngpuqd5oew2j5iv3c7sjlrkcm5npqos"),
"evm": MustParseCid("bafk2bzaceavkezg7jk6hhlyvlmfxuygxphnmhlparlrpuiu26om5lm5sqea2i"),
"init": MustParseCid("bafk2bzaceddk4flq2hsni3foc3uwsia4gaugmu6ntnj6lo2gcynj5vsncp44c"),
"multisig": MustParseCid("bafk2bzacebok4642anm3443a7qcdenkr5rbfea6ghjrsattp24qfltokvw3au"),
"paymentchannel": MustParseCid("bafk2bzaceamay6icwp2h42uhdksljsydyz5fjolgfrkj5wyocg437ud3xg2t4"),
"reward": MustParseCid("bafk2bzaceb2psfhos5ozxacng3naeizijn6z25hp64ze4udmzjfxwy2357gqc"),
"storagemarket": MustParseCid("bafk2bzacedwyvhlc5bd3u2hmcweetkica6elj6myswrqsgi7d2ojfccfz22yw"),
"storageminer": MustParseCid("bafk2bzaceb7k267d6w7iktrr6xbyxgyqrl4ahdwabjyndgbnxe2q236wydaoo"),
"storagepower": MustParseCid("bafk2bzacebfm23kwvby4rp66pygqppevdg5adw6cmeneg4vt3ahbtqhj42n3i"),
"system": MustParseCid("bafk2bzacedrn4b7otr4uq5zhb4urbpxaoo26t3srbxvyyrvknhrx466ax5neq"),
"verifiedregistry": MustParseCid("bafk2bzacedydpsphnnmtp2q56phftt674i5ew4feb2idjxhbvilxkma4yavw2"),
"evm": MustParseCid("bafk2bzacea4mwhtjpuxgrwr4attbzzw5drkjimranmxm5yko6uab76674ohvs"),
"init": MustParseCid("bafk2bzaceakfykl3nqor3enn6p6e3z2jii7ry7tjg2ojme5cxoutc5gwktvwq"),
"multisig": MustParseCid("bafk2bzacebncxbf5fsvduaptk7vx7ejiugaxvgwpw5qyy4xlaehe3lw7sso74"),
"paymentchannel": MustParseCid("bafk2bzacebgkbbiify5cenlylpquyla5s4qpfevwfycccnkfgifmd4fgnnkle"),
"reward": MustParseCid("bafk2bzaceaf6h24wo6r7dskimqom34xmz32svku2y54vd5xa7aztqneidvypu"),
"storagemarket": MustParseCid("bafk2bzacedhfgzld4ddznrgfddfzcv55cotrdewdfrzuqmlvdv3rw4jddq3bg"),
"storageminer": MustParseCid("bafk2bzacea3gve3fa4yvphpzd3daxzngeaj5adl3ibvml663rmpmdb5fy65qc"),
"storagepower": MustParseCid("bafk2bzacebgti4piuxic7yvtx5vw4naci7b67othkhyqckfejh7q6k6u64u5m"),
"system": MustParseCid("bafk2bzacebnolm5rbnkqqbcawxg7grigq4ipa7fqqwdw4xiewsikaxrea4r76"),
"verifiedregistry": MustParseCid("bafk2bzacedflzbo7uu2rx7mf7u455cdkm6ivhqrmlnzm42cu6rfmit3h7cste"),
},
}, {
Network: "caterpillarnet",
@ -156,23 +156,23 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "caterpillarnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacec7dckmatj6aqieerpjzyvtgonnwjghzx6nxwgeftyp4x63sjyzji"),
ManifestCid: MustParseCid("bafy2bzacean73htnna4vzhelsyipiirmpcupuz63ocjs5a5bbi53sjn4vkvnw"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacea7ltxlbxq5t735tvokfw3vutsv5vcvmarrt3smvy6ityxc7kzyjo"),
"cron": MustParseCid("bafk2bzacebkyepynkejhiwwer4fqzgnodx4qoesueon5gkvfrsoo5qqnon7xq"),
"datacap": MustParseCid("bafk2bzaced4oa6qiyl64xaawitscelc3b7wxqlzyrorsawjz5aveyib7gifg2"),
"eam": MustParseCid("bafk2bzaceadxs6yx43da4bcleqbpdho7h72hbl27yxzxr6r42qfpga2pn5i64"),
"account": MustParseCid("bafk2bzaced3yo6f46koryeguugod3iigqdqyxd7gdhfaamzewg7kvsjhirbxk"),
"cron": MustParseCid("bafk2bzaceblwarx4vx26rxrvzaudk6xljyptincal6pw24ouwgpp2wosyeg74"),
"datacap": MustParseCid("bafk2bzaceapvsk4q566bbwbg4yxdrnvwmxe6om3uqkw6ft7oykzcogo6bc3hy"),
"eam": MustParseCid("bafk2bzacebhpljnelmwxhserrmfp5mp3naczoxmocifcwhujqtrfssdpsrd7m"),
"embryo": MustParseCid("bafk2bzacecau3tohdilfx66pohfqdrngpuqd5oew2j5iv3c7sjlrkcm5npqos"),
"evm": MustParseCid("bafk2bzacechzhg6vwsnbsshj7exshd3ptt73tyvvnby2dir3l3ugmq2jub3ja"),
"init": MustParseCid("bafk2bzacecpvier4hsrkzhnojtupquugx4jj372uco4kdyfm7smxhdrvrl75k"),
"multisig": MustParseCid("bafk2bzacebrqip3wapds4ks46ba2yc5hcatppu5mu7eug25o6veolrwglxzem"),
"paymentchannel": MustParseCid("bafk2bzaced6i6kpzze22rbsx6pqqdsrpgzxulwbsuqjk6v6wjgei5rmetwkcg"),
"reward": MustParseCid("bafk2bzaced3j6bmqbdun7x7kv7um26n37kmbmjhrzlayo6ixqp26jlprof4jo"),
"storagemarket": MustParseCid("bafk2bzacebc25u4aoostddz4c3ayz7q4lumdxnpedtu33c3t7zv3csqujdzlq"),
"storageminer": MustParseCid("bafk2bzacedveye4v5wj44eukdgr52jxeyqkencpbnddbksqjq7gibn7zro75c"),
"storagepower": MustParseCid("bafk2bzacedwg6am6kwujhaw4pk72j6nmnwyvbblzctkdeqerz3o3ftum6vyuk"),
"system": MustParseCid("bafk2bzacebaxz63jyxokfiyi2fjzaevnn55e5wja3fkygwfmxr7rgtstzeh7s"),
"verifiedregistry": MustParseCid("bafk2bzacebhtptnl7rvega7pckyi6wvjg3jknbbqiblz7pi466kkxfakr4v3o"),
"evm": MustParseCid("bafk2bzacebt4if2oh43yykeceiag4kd4c23vazytnlb6wnr7jesb3ocws2oea"),
"init": MustParseCid("bafk2bzacedw3ynvupohlc2aisvb3snwq5giltf4tukw5pwesglclf7lymoxbk"),
"multisig": MustParseCid("bafk2bzacedhn72dr34sqgn3i7qrczmqhukzz4ryxyxrsglplc2vph54qgh37o"),
"paymentchannel": MustParseCid("bafk2bzacedkig4cqczpyjjajxis2zqut2h2j4ozv3arhqz4ckpir7kasivyfw"),
"reward": MustParseCid("bafk2bzacedfklolxqx2aepvejvpzuritsqm7q2io42wamward4nfpyhcukd4w"),
"storagemarket": MustParseCid("bafk2bzaceb4rxsr7zkv67ybsbvdihbboq4px3arlir3irl4hlwwoq2q4vzlby"),
"storageminer": MustParseCid("bafk2bzaceab7nby72yhnxpmz6gp4flskppzt2ubeg567ng2dwqgpnsm3sv2v6"),
"storagepower": MustParseCid("bafk2bzaceaorcbtdkewanwu7f4kooft2tm2otc562dysk4pumlcuwdvfm7i6g"),
"system": MustParseCid("bafk2bzacecsqce2e7itrk5fjr6oqdaso2yfezw5lsw3f7pbbpsfipjcjllvuq"),
"verifiedregistry": MustParseCid("bafk2bzaceal33m7mywef4xfyapk6o35ozaozddxrhbgrc66e6mdtajfs7esru"),
},
}, {
Network: "devnet",
@ -212,23 +212,23 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "devnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacedozgcap7rarf3wb7fyi7efzu6qtf7w3g3lul45yhgflovpj5czkm"),
ManifestCid: MustParseCid("bafy2bzaceb6ka27h4ju75bou3qypxysft6vnhd4hv5cv4rultuh3hzgz6fogs"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacedewxnpn7dso7fypubae2w7ovnw4gj5kpb7lzohygm34mc7eqa3hm"),
"cron": MustParseCid("bafk2bzacecuj4iqhstejynmnq6c5rqkyqhkemk6pr3kz3pnlsiqw6zmqkr72c"),
"datacap": MustParseCid("bafk2bzacec645kiqnun4pgkru5jmnuzeh24p556bwgh3af3fv7erumg7poypg"),
"eam": MustParseCid("bafk2bzacedqquawjg4yowzgzh4gjo6uqsi5i2fn5orks5a5oueg2alo7zlss4"),
"account": MustParseCid("bafk2bzaceb5bip6whji327mnai3gjgb32xkufuqfdk2nedxqiowmj6olk6ctu"),
"cron": MustParseCid("bafk2bzaceadudubwe63ae4w6pjfwl3t3tdgakxsw3shcn5756sdz4m3yzcgrw"),
"datacap": MustParseCid("bafk2bzacec3gamtt2mn6e4mribg3hff3o2qh5yka5jigni7izmcdow4fizosy"),
"eam": MustParseCid("bafk2bzacedbp2a7zpomgcjxgxg5qzk3zwloo6u5us5hd2bzlcqqje67ffp77u"),
"embryo": MustParseCid("bafk2bzacecau3tohdilfx66pohfqdrngpuqd5oew2j5iv3c7sjlrkcm5npqos"),
"evm": MustParseCid("bafk2bzacec7reu4kwibnazp2jw6trkh777w6njt4fwrmza7nxalwqsigggfio"),
"init": MustParseCid("bafk2bzaceclig55sktlhe3ws2kbkkteinlyotc2drcupmp53porrn6xzxd6t6"),
"multisig": MustParseCid("bafk2bzacea5r262zfroswf3j2qkgqbfkzmdugxxgd4fkol673spsyp5x2fezu"),
"paymentchannel": MustParseCid("bafk2bzacebn2whw2uauxcjxnu4xqmaxp7jvipbwfbjrbqyzglzbzbjm7o2lzy"),
"reward": MustParseCid("bafk2bzacebv26kdmzyif45jugv5odyavzf33jo5l6grk7f2rkeqwuuuwpa45u"),
"storagemarket": MustParseCid("bafk2bzacebbw6mxowf4wolutjjckl45u2fig67ltbqyxhdlv5zao3geh5mkvw"),
"storageminer": MustParseCid("bafk2bzacedlxojnzgyz6nd3nopt73hhknx3i2pbajqo42mqajlonu73vh6iie"),
"storagepower": MustParseCid("bafk2bzacea6vslpi6dinukglk62ko52z2irkqbp4uzf3lcdrzqttuqv6ugw6u"),
"system": MustParseCid("bafk2bzacecyrjaxcqsahor6eqdvl3qologclu5dmuqrbidors4tsmkjtmfqzi"),
"verifiedregistry": MustParseCid("bafk2bzacebqrndjputpy5wivtb6jhv7bmnlq2ly27da5gt5432c5viafreff4"),
"evm": MustParseCid("bafk2bzacedccdoexycic4vof7ouxuqvm4fdh6whyphyi6tw5fqwkk3vnnjrua"),
"init": MustParseCid("bafk2bzaceca5nhozbivtpd5uz2tcgcqqauqojxbbxwy54l3lt4sx5uogyamvy"),
"multisig": MustParseCid("bafk2bzacedvgrxplfjst6vxay7zt4uiw67fm53twm7pb5w7qoanvuxy4kvwie"),
"paymentchannel": MustParseCid("bafk2bzacedw3pztdqracvfr23yyf2mrtynshuspo777n2xxlbpawzv4uv2qlc"),
"reward": MustParseCid("bafk2bzacebwblkwlzgmw6s7kgv3sv3rey62nbofaj7qwygqfozpoxukxbreu2"),
"storagemarket": MustParseCid("bafk2bzacebjzbrlvbnhqhamgoi7lkuo5tvdpzylz2doutrmv7bzceclykmuru"),
"storageminer": MustParseCid("bafk2bzaceb4557ljju2vouhjqnmdutn6k66zc7b5xuwsykmy7d6kpbofmy2am"),
"storagepower": MustParseCid("bafk2bzaceajddcxua5yerxywnmm6tia6donrmsxotzw3sd6rjbtme5umr4t6y"),
"system": MustParseCid("bafk2bzaceaasnh3nj3z2uitfjy4liynnbh7twjh7h7yadz6z464dm7cghtc3w"),
"verifiedregistry": MustParseCid("bafk2bzacecaxkuhojx2kfrwst6lcjbpbrso4jhg3bnqnrxqu7bnajmmw46ffq"),
},
}, {
Network: "mainnet",
@ -268,23 +268,23 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "mainnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacecgsf5euzqplra4vxqhfim7zgsy6fpy2hvb6u3eplovclpfctdcnc"),
ManifestCid: MustParseCid("bafy2bzaced3erfprmw3fm4fgp2dftckb472yslosbs6l4ximezetpmf6sdxj6"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebrferb5v5mldmtcd5u3ln7uold6esrkqjy3cmcn5gajur5ymgj64"),
"cron": MustParseCid("bafk2bzacecixoe7cnx2233hxy5xdovoghp7mcaydk4vaj4bp6oa4nwiatzqim"),
"datacap": MustParseCid("bafk2bzacecyfsfp3vftqbsxeqe76exjck54tsuupcpxtrendjvrjb4g5ot6bi"),
"eam": MustParseCid("bafk2bzaceahedp5yhhnmk76spnvtx4cmtbjz463o3qhgamdftor4denxpzmh2"),
"account": MustParseCid("bafk2bzacebeeuthos5igio6xmaeyrex2kgh5fw26qxcrd4x5oxbfe7t7vv47c"),
"cron": MustParseCid("bafk2bzacedp5kwcgrhlm2hysrmbnlw7u4trx2b5cklhbzhba7oytkzxpcl2fg"),
"datacap": MustParseCid("bafk2bzaceb2frdjnbeahgjkjucp7dobztkcn4vpfitkgglh5uyglgobuhgnms"),
"eam": MustParseCid("bafk2bzacebmvwyefbgfgd47ecuiqrshatuzbxda6wx7vjyq4hxh2v7l6ewsg4"),
"embryo": MustParseCid("bafk2bzacecau3tohdilfx66pohfqdrngpuqd5oew2j5iv3c7sjlrkcm5npqos"),
"evm": MustParseCid("bafk2bzaced4cftxbo3h3wa4htlgjmfmqqrvqk5ddckmdua5ikc4syxfpup7gs"),
"init": MustParseCid("bafk2bzaceamsma6u3hxnfea6b7h3mfekbiufcdtghtqxpp2w45pt4d472oxak"),
"multisig": MustParseCid("bafk2bzaced2dxdjxgottjchlc2kdlw2z2hd4oirwsu67ca72sdbnc5y75zveu"),
"paymentchannel": MustParseCid("bafk2bzacedr5eoysu45rvm4tfsp3hiay6kyucmlyj4flsxow2ag3omuwhgmee"),
"reward": MustParseCid("bafk2bzaceaua7nxqwk5uuqjdwvwth57citforok365ybfcmtwfg2glmykke2y"),
"storagemarket": MustParseCid("bafk2bzacebdvnxh3bj6yuvvnmygiloge5b246iiawtc4s4ldjby67ykop46m2"),
"storageminer": MustParseCid("bafk2bzaceby25xk5l2st6grf5jsqshccuhrxw57x2ws54vjifaipip5i27oiw"),
"storagepower": MustParseCid("bafk2bzaceabh35xpju4yd57ro2by7gq6zdqcmrbm2vvrb43esxflbr47uaeym"),
"system": MustParseCid("bafk2bzaceaymi5z5hanmqbqlcaglyg65ib4t6wx7glvzcwir7g3sa57zchzpi"),
"verifiedregistry": MustParseCid("bafk2bzacebw5tjiqj36dnhr6osgw5rfpunweoeeu2onah3xsfdc54hznidmga"),
"evm": MustParseCid("bafk2bzacebdzui2m5kmlvfyesx6gdysmribnftjfutzavg3pju2hm7of6laca"),
"init": MustParseCid("bafk2bzacecqggsq43axglynghabmdahgswizu27lp5jtr3wazyq2bkuxn3jnw"),
"multisig": MustParseCid("bafk2bzacecppiqinrrdpga7k5cji7ss4q2zbazxfxovm3idh3ak6wccnul45a"),
"paymentchannel": MustParseCid("bafk2bzacebfidlzckt4dxt5bvo7g65m2yfe3i2hlzno74czj4copklnfmqg7g"),
"reward": MustParseCid("bafk2bzacedcygfkhanjhsbckt6r3lwmlnkqpl6hor4wm4q6dxy5hoce4tuf2k"),
"storagemarket": MustParseCid("bafk2bzaceaippnqwihzfl7i7twqnezqatokqmj4n3ha3xhusmuswu6yxlcwjo"),
"storageminer": MustParseCid("bafk2bzaceajhgiw74uqoni3lj25u5ttbyb6wvmbdcudf36yzifxmkhclnh7fk"),
"storagepower": MustParseCid("bafk2bzaced4affrthobrxw742cqzjqents3fpzyo35pcsyacapsgcghfyhwim"),
"system": MustParseCid("bafk2bzaceareuf2qikbqqhys2umhe7anm7wjpqujbe2ukdgcvd5ov4fgdtk3w"),
"verifiedregistry": MustParseCid("bafk2bzacea2oebvxkpbcsr2i6aeiqwpcediynmqdqdafnnzmoxskbbyj3a7xc"),
},
}, {
Network: "testing",
@ -324,23 +324,23 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "testing",
Version: 10,
ManifestCid: MustParseCid("bafy2bzaceblyvl5vpmg5vsiheag37rmxbhyysppiducdiwrjigfmqzxzmeiw2"),
ManifestCid: MustParseCid("bafy2bzacec7hzwr3x7o4wn6bcfjyduadl2xthxr7tektluy2d5kxr3uz7dt6i"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacecbss2ettatvrznxisyfokry3e3iseviub37giux6gu4xd4oufyuq"),
"cron": MustParseCid("bafk2bzacecznld24ktoctdwdnztgjgfm7vc2xpxy2bs4rvh54i42nhadfy6hm"),
"datacap": MustParseCid("bafk2bzacedkxqprqldjle5gr4exhevmpejc4u2hv6abs7gymh4kwo2bdyaixg"),
"eam": MustParseCid("bafk2bzacedfvxauqyelthrgu5i43quivikf3ndsc7345n7qm5sevf6ujl6bds"),
"account": MustParseCid("bafk2bzacealym3qu6np5eqirbvn5e67ci5ilkpl3i3nostxf5adcctql25ku2"),
"cron": MustParseCid("bafk2bzacedlqqtzrqbuwa2jyz3i3km2wygione3hw55mkub2jleqfdrhagbqq"),
"datacap": MustParseCid("bafk2bzaceacijmmesdkpijapjerovahjlenzxe3d6emenrirdnrxv3dzvn5r6"),
"eam": MustParseCid("bafk2bzaced2h757nl3efkii7faqdti47w5cyzevjphq3jco6e6dnjv2vuosv2"),
"embryo": MustParseCid("bafk2bzacecau3tohdilfx66pohfqdrngpuqd5oew2j5iv3c7sjlrkcm5npqos"),
"evm": MustParseCid("bafk2bzacecvk7sj5hqeirku3fyemeexatl6gyuggahr2sh5vmnwq36e36jolo"),
"init": MustParseCid("bafk2bzacecv4vkplbdumw3hoyx22dr6frfh63h5k7wbwlb3vbyrzqnbwm3hq2"),
"multisig": MustParseCid("bafk2bzacecchofadvbkmrw3sal6vya3j3vgzm7fdqsv6exxdn5tkyfy7aqika"),
"paymentchannel": MustParseCid("bafk2bzaceares72arkoutsqffr3mpys2yxawuwadvo22mnwjvm7krwzw2vvis"),
"reward": MustParseCid("bafk2bzacebateijm6usif3etrbnepz5qaraynbaiefwzykxkchym4or3aw6bi"),
"storagemarket": MustParseCid("bafk2bzacebbrlxtkfwoyv6b3dpowsuza35gmqmqhgyuqzjnrouc5suuvottdw"),
"storageminer": MustParseCid("bafk2bzacecrnmcy75hs3gv4ixyed4b77ctdg2fezmoijdoviwp777zwvflu3o"),
"storagepower": MustParseCid("bafk2bzacecozrbsk3lyo6ttn27g4hhzxpoc5ekcmu7njq7chqfyk2iewm3nq6"),
"system": MustParseCid("bafk2bzacedg37rk2nyluufudaheng5illo7qlv5gsux3b57rzsoa4puaeu27a"),
"verifiedregistry": MustParseCid("bafk2bzaceblkqi3jhrzhrl5qgfkyhy2jhvm7dj6fhbp3rm5c3bmslk4apl45c"),
"evm": MustParseCid("bafk2bzacecodghcivxgvqmbqrw7xfbkpeddifkvcpa4bo4lm56n3hrpjw7bk6"),
"init": MustParseCid("bafk2bzacechocgew6sytawp3cdt5kyxjtbmu22zqk3w542n74qosz6r6jvugi"),
"multisig": MustParseCid("bafk2bzaceahbxrystfo2dsd6e7tce3swf2i52cjgckg5emvk7737ayv7mvwkq"),
"paymentchannel": MustParseCid("bafk2bzacecs545r2mumo74syan6rqeqyy6x7cian22vyw5jfqmz62cuhgjdua"),
"reward": MustParseCid("bafk2bzacecz7xmjji26fsuzwf46i7mastqx53lxfe2dlvds4uuotq5jburnx4"),
"storagemarket": MustParseCid("bafk2bzacedibij7772uzuhrksmcxof6vme5kcgnayenqa5r7jdalh2rlxzj5a"),
"storageminer": MustParseCid("bafk2bzacedgjz4ny2n7mr2suaifnsueblqdovuxb6sd3gzfsuflbbzaa5ay5e"),
"storagepower": MustParseCid("bafk2bzaceadblcbk6zqyhdze5zxxelgfwfbp32v5tpsr3tgsgu5mum4p355no"),
"system": MustParseCid("bafk2bzacea62hbkhxc7brvtsszszxvxnz3yujolapf6z7z2tqa6wbcxtkuzsi"),
"verifiedregistry": MustParseCid("bafk2bzaceal2zir4rgyiufm65ntsg5owbbkf3sv3fbzwel4xa4mmedd5qpcz2"),
},
}, {
Network: "testing-fake-proofs",
@ -380,22 +380,22 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
}, {
Network: "testing-fake-proofs",
Version: 10,
ManifestCid: MustParseCid("bafy2bzaceb2w3nde3bk73rkvsircwvj43qnw7f6hbcabtxkemku3tyixoyydc"),
ManifestCid: MustParseCid("bafy2bzaceac6vfgswvzjg4rzcswcmig457odrhd3nnbfyd5ipem2fawnuif7k"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacecbss2ettatvrznxisyfokry3e3iseviub37giux6gu4xd4oufyuq"),
"cron": MustParseCid("bafk2bzacecznld24ktoctdwdnztgjgfm7vc2xpxy2bs4rvh54i42nhadfy6hm"),
"datacap": MustParseCid("bafk2bzacedkxqprqldjle5gr4exhevmpejc4u2hv6abs7gymh4kwo2bdyaixg"),
"eam": MustParseCid("bafk2bzacedfvxauqyelthrgu5i43quivikf3ndsc7345n7qm5sevf6ujl6bds"),
"account": MustParseCid("bafk2bzacealym3qu6np5eqirbvn5e67ci5ilkpl3i3nostxf5adcctql25ku2"),
"cron": MustParseCid("bafk2bzacedlqqtzrqbuwa2jyz3i3km2wygione3hw55mkub2jleqfdrhagbqq"),
"datacap": MustParseCid("bafk2bzaceacijmmesdkpijapjerovahjlenzxe3d6emenrirdnrxv3dzvn5r6"),
"eam": MustParseCid("bafk2bzaced2h757nl3efkii7faqdti47w5cyzevjphq3jco6e6dnjv2vuosv2"),
"embryo": MustParseCid("bafk2bzacecau3tohdilfx66pohfqdrngpuqd5oew2j5iv3c7sjlrkcm5npqos"),
"evm": MustParseCid("bafk2bzacecvk7sj5hqeirku3fyemeexatl6gyuggahr2sh5vmnwq36e36jolo"),
"init": MustParseCid("bafk2bzacecv4vkplbdumw3hoyx22dr6frfh63h5k7wbwlb3vbyrzqnbwm3hq2"),
"multisig": MustParseCid("bafk2bzacecchofadvbkmrw3sal6vya3j3vgzm7fdqsv6exxdn5tkyfy7aqika"),
"paymentchannel": MustParseCid("bafk2bzaceares72arkoutsqffr3mpys2yxawuwadvo22mnwjvm7krwzw2vvis"),
"reward": MustParseCid("bafk2bzacebateijm6usif3etrbnepz5qaraynbaiefwzykxkchym4or3aw6bi"),
"storagemarket": MustParseCid("bafk2bzacebbrlxtkfwoyv6b3dpowsuza35gmqmqhgyuqzjnrouc5suuvottdw"),
"storageminer": MustParseCid("bafk2bzacedehmf7vjcvsnsa2vrbc2oofjvy4mrosn5guudt7tt7cbcc26ggqu"),
"storagepower": MustParseCid("bafk2bzaceayqib4titfnswzcphrwvdcqkhnwuuhdvk2yafxgumtmnkuwkibbo"),
"system": MustParseCid("bafk2bzacedg37rk2nyluufudaheng5illo7qlv5gsux3b57rzsoa4puaeu27a"),
"verifiedregistry": MustParseCid("bafk2bzaceblkqi3jhrzhrl5qgfkyhy2jhvm7dj6fhbp3rm5c3bmslk4apl45c"),
"evm": MustParseCid("bafk2bzacecodghcivxgvqmbqrw7xfbkpeddifkvcpa4bo4lm56n3hrpjw7bk6"),
"init": MustParseCid("bafk2bzacechocgew6sytawp3cdt5kyxjtbmu22zqk3w542n74qosz6r6jvugi"),
"multisig": MustParseCid("bafk2bzaceahbxrystfo2dsd6e7tce3swf2i52cjgckg5emvk7737ayv7mvwkq"),
"paymentchannel": MustParseCid("bafk2bzacecs545r2mumo74syan6rqeqyy6x7cian22vyw5jfqmz62cuhgjdua"),
"reward": MustParseCid("bafk2bzacecz7xmjji26fsuzwf46i7mastqx53lxfe2dlvds4uuotq5jburnx4"),
"storagemarket": MustParseCid("bafk2bzacedibij7772uzuhrksmcxof6vme5kcgnayenqa5r7jdalh2rlxzj5a"),
"storageminer": MustParseCid("bafk2bzacea24wfvofmadqf24ajjdgvpz3kbp6sggn3yyyk6tasjd2cct457ra"),
"storagepower": MustParseCid("bafk2bzacebb6u2ouemucg6ylbfr76uuqqgy6qa3gynu6bskq5wgnv5gk2iq5e"),
"system": MustParseCid("bafk2bzacea62hbkhxc7brvtsszszxvxnz3yujolapf6z7z2tqa6wbcxtkuzsi"),
"verifiedregistry": MustParseCid("bafk2bzaceal2zir4rgyiufm65ntsg5owbbkf3sv3fbzwel4xa4mmedd5qpcz2"),
},
}}

View File

@ -198,7 +198,7 @@ func (f *EventFilter) matchKeys(ees []types.EventEntry) bool {
continue
}
keyname := string(ee.Key)
keyname := ee.Key
// skip if we have already matched this key
if matched[keyname] {

View File

@ -286,7 +286,7 @@ func fakeEvent(emitter abi.ActorID, indexed []kv, unindexed []kv) *types.Event {
for _, in := range indexed {
ev.Entries = append(ev.Entries, types.EventEntry{
Flags: 0x01,
Key: []byte(in.k),
Key: in.k,
Value: in.v,
})
}
@ -294,7 +294,7 @@ func fakeEvent(emitter abi.ActorID, indexed []kv, unindexed []kv) *types.Event {
for _, in := range unindexed {
ev.Entries = append(ev.Entries, types.EventEntry{
Flags: 0x00,
Key: []byte(in.k),
Key: in.k,
Value: in.v,
})
}

View File

@ -1962,16 +1962,15 @@ func (t *EventEntry) MarshalCBOR(w io.Writer) error {
return err
}
// t.Key ([]uint8) (slice)
if len(t.Key) > cbg.ByteArrayMaxLen {
return xerrors.Errorf("Byte array in field t.Key was too long")
// t.Key (string) (string)
if len(t.Key) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.Key was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Key))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil {
return err
}
if _, err := cw.Write(t.Key[:]); err != nil {
if _, err := io.WriteString(w, string(t.Key)); err != nil {
return err
}
@ -2026,26 +2025,15 @@ func (t *EventEntry) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("integer in input was too large for uint8 field")
}
t.Flags = uint8(extra)
// t.Key ([]uint8) (slice)
// t.Key (string) (string)
maj, extra, err = cr.ReadHeader()
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Key: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
if extra > 0 {
t.Key = make([]uint8, extra)
}
if _, err := io.ReadFull(cr, t.Key[:]); err != nil {
return err
t.Key = string(sval)
}
// t.Value ([]uint8) (slice)

View File

@ -17,7 +17,7 @@ type EventEntry struct {
Flags uint8
// The key of this event entry
Key []byte
Key string
// Any DAG-CBOR encodeable type.
Value []byte

View File

@ -24,6 +24,7 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
amt4 "github.com/filecoin-project/go-amt-ipld/v4"
cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
@ -1769,6 +1770,37 @@ var ChainInvokeEVMCmd = &cli.Command{
afmt.Println("OK")
}
if eventsRoot := wait.Receipt.EventsRoot; eventsRoot != nil {
afmt.Println("Events emitted:")
s := &apiIpldStore{ctx, api}
amt, err := amt4.LoadAMT(ctx, s, *eventsRoot, amt4.UseTreeBitWidth(5))
if err != nil {
return err
}
var evt types.Event
err = amt.ForEach(ctx, func(u uint64, deferred *cbg.Deferred) error {
fmt.Printf("%x\n", deferred.Raw)
if err := evt.UnmarshalCBOR(bytes.NewReader(deferred.Raw)); err != nil {
return err
}
fmt.Printf("\tEmitter ID: %s\n", evt.Emitter)
for _, e := range evt.Entries {
value, err := cbg.ReadByteArray(bytes.NewBuffer(e.Value), uint64(len(e.Value)))
if err != nil {
return err
}
fmt.Printf("\t\tKey: %s, Value: 0x%x, Flags: b%b\n", e.Key, value, e.Flags)
}
return nil
})
}
if err != nil {
return err
}
return nil
},
}

2
extern/filecoin-ffi vendored

@ -1 +1 @@
Subproject commit 2e788b5a50b600670a88f5397cbe856c2755fe4a
Subproject commit 39bed0d7a477eae618d310a476233eafe3e6b571

2
go.mod
View File

@ -30,6 +30,7 @@ require (
github.com/filecoin-project/dagstore v0.5.2
github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f
github.com/filecoin-project/go-address v1.1.0
github.com/filecoin-project/go-amt-ipld/v4 v4.0.0
github.com/filecoin-project/go-bitfield v0.2.4
github.com/filecoin-project/go-cbor-util v0.0.1
github.com/filecoin-project/go-commp-utils v0.1.3
@ -185,7 +186,6 @@ require (
github.com/etclabscore/go-jsonschema-walk v0.0.6 // indirect
github.com/filecoin-project/go-amt-ipld/v2 v2.1.0 // indirect
github.com/filecoin-project/go-amt-ipld/v3 v3.1.0 // indirect
github.com/filecoin-project/go-amt-ipld/v4 v4.0.0 // indirect
github.com/filecoin-project/go-commp-utils/nonffi v0.0.0-20220905160352-62059082a837 // indirect
github.com/filecoin-project/go-ds-versioning v0.1.1 // indirect
github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect

View File

@ -0,0 +1 @@
63000000678063000000116000396000f360003560e01c80600014601f578060011460365780600214604157600080fd5b67112233445566778860005260086018a060006000f35b60006000a060006000f35b67112233445566778860005263000044446200333361222261111160086018a460006000f3

View File

@ -0,0 +1,79 @@
package itests
import (
"context"
"encoding/hex"
"fmt"
"os"
"testing"
"time"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/itests/kit"
"github.com/stretchr/testify/require"
)
// TestFEVMEvents does a basic events smoke test.
func TestFEVMEvents(t *testing.T) {
require := require.New(t)
kit.QuietMiningLogs()
blockTime := 100 * time.Millisecond
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
ens.InterconnectAll().BeginMining(blockTime)
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
// install contract
contractHex, err := os.ReadFile("contracts/events.bin")
require.NoError(err)
contract, err := hex.DecodeString(string(contractHex))
require.NoError(err)
fromAddr, err := client.WalletDefaultAddress(ctx)
require.NoError(err)
result := client.EVM().DeployContract(ctx, fromAddr, contract)
idAddr, err := address.NewIDAddress(result.ActorID)
require.NoError(err)
t.Logf("actor ID address is %s", idAddr)
// var (
// earliest = "earliest"
// latest = "latest"
// )
//
// // Install a filter.
// filter, err := client.EthNewFilter(ctx, &api.EthFilterSpec{
// FromBlock: &earliest,
// ToBlock: &latest,
// })
// require.NoError(err)
//
// // No logs yet.
// res, err := client.EthGetFilterLogs(ctx, filter)
// require.NoError(err)
// require.Empty(res.NewLogs)
// log a zero topic event with data
ret := client.EVM().InvokeSolidity(ctx, fromAddr, idAddr, []byte{0x00, 0x00, 0x00, 0x00}, nil)
require.True(ret.Receipt.ExitCode.IsSuccess(), "contract execution failed")
require.NotNil(ret.Receipt.EventsRoot)
fmt.Println(client.EVM().LoadEvents(ctx, *ret.Receipt.EventsRoot))
// log a zero topic event with no data
ret = client.EVM().InvokeSolidity(ctx, fromAddr, idAddr, []byte{0x00, 0x00, 0x00, 0x01}, nil)
require.True(ret.Receipt.ExitCode.IsSuccess(), "contract execution failed")
fmt.Println(ret)
fmt.Println(client.EVM().LoadEvents(ctx, *ret.Receipt.EventsRoot))
// log a four topic event with data
ret = client.EVM().InvokeSolidity(ctx, fromAddr, idAddr, []byte{0x00, 0x00, 0x00, 0x02}, nil)
require.True(ret.Receipt.ExitCode.IsSuccess(), "contract execution failed")
fmt.Println(ret)
fmt.Println(client.EVM().LoadEvents(ctx, *ret.Receipt.EventsRoot))
}

View File

@ -3,7 +3,6 @@ package itests
import (
"bytes"
"context"
"encoding/binary"
"encoding/hex"
"os"
"testing"
@ -13,13 +12,7 @@ import (
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/builtin/v10/eam"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit"
)
@ -46,43 +39,7 @@ func TestFEVMBasic(t *testing.T) {
fromAddr, err := client.WalletDefaultAddress(ctx)
require.NoError(t, err)
nonce, err := client.MpoolGetNonce(ctx, fromAddr)
if err != nil {
nonce = 0 // assume a zero nonce on error (e.g. sender doesn't exist).
}
var salt [32]byte
binary.BigEndian.PutUint64(salt[:], nonce)
method := builtintypes.MethodsEAM.Create2
params, err := actors.SerializeParams(&eam.Create2Params{
Initcode: contract,
Salt: salt,
})
require.NoError(t, err)
msg := &types.Message{
To: builtintypes.EthereumAddressManagerActorAddr,
From: fromAddr,
Value: big.Zero(),
Method: method,
Params: params,
}
t.Log("sending create message")
smsg, err := client.MpoolPushMessage(ctx, msg, nil)
require.NoError(t, err)
t.Log("waiting for message to execute")
wait, err := client.StateWaitMsg(ctx, smsg.Cid(), 0, 0, false)
require.NoError(t, err)
require.True(t, wait.Receipt.ExitCode.IsSuccess(), "contract installation failed")
var result eam.CreateReturn
r := bytes.NewReader(wait.Receipt.Return)
err = result.UnmarshalCBOR(r)
require.NoError(t, err)
result := client.EVM().DeployContract(ctx, fromAddr, contract)
idAddr, err := address.NewIDAddress(result.ActorID)
require.NoError(t, err)
@ -96,27 +53,7 @@ func TestFEVMBasic(t *testing.T) {
inputData, err := hex.DecodeString("000000000000000000000000ff00000000000000000000000000000000000064")
require.NoError(t, err)
params := append(entryPoint, inputData...)
var buffer bytes.Buffer
err = cbg.WriteByteArray(&buffer, params)
require.NoError(t, err)
params = buffer.Bytes()
msg := &types.Message{
To: idAddr,
From: fromAddr,
Value: big.Zero(),
Method: abi.MethodNum(2),
Params: params,
}
t.Log("sending invoke message")
smsg, err := client.MpoolPushMessage(ctx, msg, nil)
require.NoError(t, err)
t.Log("waiting for message to execute")
wait, err := client.StateWaitMsg(ctx, smsg.Cid(), 0, 0, false)
require.NoError(t, err)
wait := client.EVM().InvokeSolidity(ctx, fromAddr, idAddr, entryPoint, inputData)
require.True(t, wait.Receipt.ExitCode.IsSuccess(), "contract execution failed")
@ -136,28 +73,7 @@ func TestFEVMBasic(t *testing.T) {
inputData, err := hex.DecodeString("000000000000000000000000ff00000000000000000000000000000000000065")
require.NoError(t, err)
params := append(entryPoint, inputData...)
var buffer bytes.Buffer
err = cbg.WriteByteArray(&buffer, params)
require.NoError(t, err)
params = buffer.Bytes()
msg := &types.Message{
To: idAddr,
From: fromAddr,
Value: big.Zero(),
Method: abi.MethodNum(2),
Params: params,
}
t.Log("sending invoke message")
smsg, err := client.MpoolPushMessage(ctx, msg, nil)
require.NoError(t, err)
t.Log("waiting for message to execute")
wait, err := client.StateWaitMsg(ctx, smsg.Cid(), 0, 0, false)
require.NoError(t, err)
wait := client.EVM().InvokeSolidity(ctx, fromAddr, idAddr, entryPoint, inputData)
require.True(t, wait.Receipt.ExitCode.IsSuccess(), "contract execution failed")
result, err := cbg.ReadByteArray(bytes.NewBuffer(wait.Receipt.Return), uint64(len(wait.Receipt.Return)))

154
itests/kit/evm.go Normal file
View File

@ -0,0 +1,154 @@
package kit
import (
"bytes"
"context"
"encoding/binary"
"fmt"
amt4 "github.com/filecoin-project/go-amt-ipld/v4"
"github.com/ipfs/go-cid"
"github.com/stretchr/testify/require"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/builtin/v10/eam"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
)
// EVM groups EVM-related actions.
type EVM struct{ *TestFullNode }
func (f *TestFullNode) EVM() *EVM {
return &EVM{f}
}
func (e *EVM) DeployContract(ctx context.Context, sender address.Address, bytecode []byte) eam.CreateReturn {
require := require.New(e.t)
nonce, err := e.MpoolGetNonce(ctx, sender)
if err != nil {
nonce = 0 // assume a zero nonce on error (e.g. sender doesn't exist).
}
var salt [32]byte
binary.BigEndian.PutUint64(salt[:], nonce)
method := builtintypes.MethodsEAM.Create2
params, err := actors.SerializeParams(&eam.Create2Params{
Initcode: bytecode,
Salt: salt,
})
require.NoError(err)
msg := &types.Message{
To: builtintypes.EthereumAddressManagerActorAddr,
From: sender,
Value: big.Zero(),
Method: method,
Params: params,
}
e.t.Log("sending create message")
smsg, err := e.MpoolPushMessage(ctx, msg, nil)
require.NoError(err)
e.t.Log("waiting for message to execute")
wait, err := e.StateWaitMsg(ctx, smsg.Cid(), 0, 0, false)
require.NoError(err)
require.True(wait.Receipt.ExitCode.IsSuccess(), "contract installation failed")
var result eam.CreateReturn
r := bytes.NewReader(wait.Receipt.Return)
err = result.UnmarshalCBOR(r)
require.NoError(err)
return result
}
func (e *EVM) InvokeSolidity(ctx context.Context, sender address.Address, target address.Address, selector []byte, inputData []byte) *api.MsgLookup {
require := require.New(e.t)
params := append(selector, inputData...)
var buffer bytes.Buffer
err := cbg.WriteByteArray(&buffer, params)
require.NoError(err)
params = buffer.Bytes()
msg := &types.Message{
To: target,
From: sender,
Value: big.Zero(),
Method: abi.MethodNum(2),
Params: params,
}
e.t.Log("sending invoke message")
smsg, err := e.MpoolPushMessage(ctx, msg, nil)
require.NoError(err)
e.t.Log("waiting for message to execute")
wait, err := e.StateWaitMsg(ctx, smsg.Cid(), 0, 0, false)
require.NoError(err)
return wait
}
// LoadEvents loads all events in an event AMT.
func (e *EVM) LoadEvents(ctx context.Context, eventsRoot cid.Cid) []types.Event {
require := require.New(e.t)
s := &apiIpldStore{ctx, e}
amt, err := amt4.LoadAMT(ctx, s, eventsRoot, amt4.UseTreeBitWidth(5))
require.NoError(err)
ret := make([]types.Event, 0, amt.Len())
err = amt.ForEach(ctx, func(u uint64, deferred *cbg.Deferred) error {
var evt types.Event
if err := evt.UnmarshalCBOR(bytes.NewReader(deferred.Raw)); err != nil {
return err
}
ret = append(ret, evt)
return nil
})
require.NoError(err)
return ret
}
// TODO: cleanup and put somewhere reusable.
type apiIpldStore struct {
ctx context.Context
api api.FullNode
}
func (ht *apiIpldStore) Context() context.Context {
return ht.ctx
}
func (ht *apiIpldStore) Get(ctx context.Context, c cid.Cid, out interface{}) error {
raw, err := ht.api.ChainReadObj(ctx, c)
if err != nil {
return err
}
cu, ok := out.(cbg.CBORUnmarshaler)
if ok {
if err := cu.UnmarshalCBOR(bytes.NewReader(raw)); err != nil {
return err
}
return nil
}
return fmt.Errorf("object does not implement CBORUnmarshaler")
}
func (ht *apiIpldStore) Put(ctx context.Context, v interface{}) (cid.Cid, error) {
panic("No mutations allowed")
}

View File

@ -1228,10 +1228,10 @@ type filterTipSetCollector interface {
}
var (
ethTopic1 = []byte("topic1")
ethTopic2 = []byte("topic2")
ethTopic3 = []byte("topic3")
ethTopic4 = []byte("topic4")
ethTopic1 = "topic1"
ethTopic2 = "topic2"
ethTopic3 = "topic3"
ethTopic4 = "topic4"
)
func ethFilterResultFromEvents(evs []*filter.CollectedEvent) (*api.EthFilterResult, error) {
@ -1249,7 +1249,7 @@ func ethFilterResultFromEvents(evs []*filter.CollectedEvent) (*api.EthFilterResu
for _, entry := range ev.Event.Entries {
hash := api.EthHashData(entry.Value)
if bytes.Equal(entry.Key, ethTopic1) || bytes.Equal(entry.Key, ethTopic2) || bytes.Equal(entry.Key, ethTopic3) || bytes.Equal(entry.Key, ethTopic4) {
if entry.Key == ethTopic1 || entry.Key == ethTopic2 || entry.Key == ethTopic3 || entry.Key == ethTopic4 {
log.Topics = append(log.Topics, hash)
} else {
log.Data = append(log.Data, hash)