Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat shed cid #5072

Merged
merged 4 commits into from
Dec 8, 2020
Merged

Feat shed cid #5072

merged 4 commits into from
Dec 8, 2020

Conversation

zgfzgf
Copy link
Contributor

@zgfzgf zgfzgf commented Dec 1, 2020

add encoding flag
add abi Cid should be see it

./lotus-shed cid id hlaxMCqLZuSYNEy7ESmdgFEzgVBAmtCq/qE8jFGFm7IAceSignvaJbnUc7YCKrm+sRyfpQ8TFmmYu9fzkUGXaC6PMlztJoip4/1TCIHPq+2xMlCd6FGKKjP2G3LkViS9FChx5MMcLFl+KlzyBWTe59gbLFTekL5fozXbkxjPuZ1eN/lrHF/2Qak8HHDbbjgAq/fzH5Y6eKdm22720+rMDMhoiCYGT8Cq9EeXv2NE+vPFGvxNrldCaGsPcNM2KLtaufXRUfo3Fqyn1R6/L1QXQBH0WTci8634mFkSB/aBl3xNIimSuRIRBi4eZQCp8SIusQfdnsXEp+K0eTsRJIpn70cBZWeOejpThx6YMvx3fFro5uNuDRWH9oZ7uNiVE6cNA/YKptoCcj+AfH9DmKreGsi1j9tbW7KApitT978nspSACw0FKtlO93itw4ozgiUIgIVjOGxQRjE82v0VQO9naIkIUUEwPdSKZZKIsZiAWEwMH+zQLauNBp8zBHUI3gdsqgqPn9dK/bdAVyHCXG/CPjcoHE7O0mO+0FmV4rnl1WSLMpSjPXXONzZ6w9lqTRhZo3FCgxJgYMwePYKXdKDLeQBENKjrx4OlMSSQXKDn/q0SlVjowIOXfF6EM6ib6i2ODXH8dawasNMfq+x5nFwwfiOgsYGA1UyEr+WGk1L1l3AkUI4UoQV9RTeiWjWqdiMptignGTZ9M3ApRTEkC/OW+bv1szcWd4H2YvJn2pTuq5bx3+4tGfRqxJeCGqZwFVigl0A1NTwFhBaYB4iz+KN59wi4/y2RPVWc1AodB6Hs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bywH+WN8cYJx/iDSZx9F4gIXYkeIfXTiBTmIoAhHI3QArzbF0ZPei81w43GhVG49H3kZJldfi1D8tcVSji53aVLbOvhtxm6FoQVVTjZZquVBItfw35HSE6/gJ/cV2LlyKP98yGzlKUTcUBdJ9+PD0igwk2y5Kpa4rvvUvDdfCuNUybyhIXyJLG7GV9Dzl5C+xIyJ3ruohDxZ82Faxt9YNqcMvHh+r/CEgdhoIJqpl5hQG9mZJTUgn9/fNVEXyewoz9v2AlctnVVzyIxAj+O1JBH3Ktt+f86+ETVln/Il+BavVqYiu1Pyp+YSmKnJ+Rz8i3ug25yA7mSI21sX8CR8kMaqmT5FVSuPgS4VCQ07HEl2Jey2IepjXALVOqN0zfxjjwDBY0yu5K45+5tOC0aGHFwU/0oqIfrqo1bBxNNAickDe0q5uRof3AjXECLYyM1hAl3E2fjx57E+FI5RpVDs/8ElIPrlnu2UomW8N5PCXQgU0LDkjdcpaTVKTLFsze+xqGVn2qnfNbaSNHK+k23pek7OHqk8MnoDASNTs7XryklHMGKKsIV+lr+ThFNfbGCcaEqQOyTfdkdvEyAC4xhH7Ux4j65AjhHLhDzL1K3HperbM2htUCgg7Ss57tu4/xuAKCzkLaHpUmJ3sdMUVn5ao74pTk2kPQa1
Raw Cid:bafkqbaapqzllcmbkrntojgbujs5rckm5qbithakqicnnbkx6ue6iyumftozaa4peukbhxwrfxhkhhnqcfk435mi4t6sq6eywngmlxv7tsfazo2bor4zfz3jgrcu6h7ktbca47k7nwezfbhpikgfcum7wdnzoivrexukcq4peymocywl6fjopeble33t5qgzmktpjbps7um25xeyyz64z2xrx7fvryx7wigutyhdq3nxdqafl67zr7fr2pctwnw3o63j6vtamzbuiqjqgj7akv5chs67wgrh26pcrv7cnvzlue2dlb5yngnrixnnlt5orkh5dofvmu7kr5pzpkqluaepule3sf45n7cmfseqh62azo7cneiuzfoiscedc4htfacu7cirowed53hwfyst6fndzhmisjcth55dqczlhrz5duu4hd2mdf7dxprnorzxdnygrlb7wqz53rwevcotq2a7wbktnuatsh6ahy72dtcvn4gwiwwh5ww23wkakmk2t667spmuuqafq2bjk3fhpo6fnyofdharfbcaikyzynriemmj43l6rkqhpm5uisccrieyd3vekmwjirmmyqbmeyda75tic3k4na2ptgbdvbdpao3fkbkhz7v2k7w3uavzbyjog7qr6g4ubytwo2jr35uczsxrltzovmsftfffdhv244nzwplb5s2sndbm2g4kcqmjgaygmdy6yff3uudfxsacegsuoxr4duuysjec4udt75lissvmorqeds56f5bbtvcn6ulmobvy7y5nmdkyngh5l5r4zyxbqpyr2bmmbqdkuzbfp4wdjguxvs5yciueocsqqk7kfg6rfunnkoyrstnrie4mtm7jtoauukmjebpzzn6n36wztoftxqh3gf4th3kko5k4w6hp64liz6rvmjf4cdkthafkyucluanjvhqcyifuya6elh6fdph3qroh7fwit2vm42qfb2b5b5tuvvru4m22z2hcj2nxmanwh7nsnfduphgrwsbrj7e53zb4urqea2lb7olotr333qwrbs7qqwojazuyl7e4zdazpy3rouvz5jdfq7d47kbfqk5wgzawqjub7uwiq3uj7msa5ip55b3yyzil7x2k4bnlv5c7oe6ksqvwsylm3ccqjjds5nc2aupd6qhnnz3svfxbjxwk6vcvu7onotjqwpjbqkz7igxz3h33ozxs3mcvrs6rp2vzljd3brbxmjo2ngxfohjkrnhvh3i4gr5wssk2j4ry2oc4wdm56mclnoc3ixkzazlwqvr3fid3rzjnxloddarxsxqkm5kxeg6v7r3rxruys5xbp7w6z76yn34jk5hdfvtx3b6aem75apbl2li7b377xyaqnrzwheeijphcjd4okqgazbycmuqwjofiznicyenmst7kycleohrwh2wfny2yf2no5wmqsq7uay36lnacgz62qum2rmdflbhnjs2rfz2gqsyimdrvhyiwndvikbnvqarwzy6xc6j3oiavketqc5ncvh3degzfnqjryrrfkieqkskwzu2girijnqotzeetcconm5xv3bheroejvx5u7ph22ouinaz2ewgexwfnn6mbxenr6orirerzi26ijrmd5w6tipelh5au7qdcupqeinhcwyiphdox57iux3fhqszholrfbhbo3cvnjqqxec2sgx37nu4odvufkvk46z6pz4xnrnpktv5ftf6md5ejuahpaglnj6beksn2vng5hx62zlspot2wjzzxinv7v2tikrofow4wjmnxmrcvatm7ocjgtftc4mtj5toh4f344eopbqhpwns3pdip7xafv3ou5hgzomrz5hbm6afh3nvea2hms7qvylg4xhk2c6pubi5aziyxdrirg35sknxoevhec6fya6sndggchlmk4npf27n7w2nepvzp2bvjan6ck62yg4bavvme5qftlikvuzr4lkuiunv3dx3sazst2ossztjlyrmbt465u47unahljydrfbizry7q2toiqpmua5kr4vlke24n7t2xszfe4lbscozeyjufgfjp6ec4dmalw3jk7xkorheku7kgjapw2eovbycl6xdlin4mxakna65nayigirqei7a3ed6gsgwz5i5xqzqtyuuaesiraa7sbmu6up2fpsvhx2drqpgo67fam3rnn7wajvm5kzeink5cjmlrskgbx5rkgc27evqwdtw64jwfqjrssieihd6azlbp7rl2zhcpwf4j7yaohvfnqadyjyp25ef72b5xsyb7zmn6hdatr7yqnezy7ixraef3ci6eh25hcau4yriaii4rxiafpg3c5de66rpgxby3rufkg4pi7pemsmv27rnipznofkkhc453jklntv6dnyzxiliifkvhdmwnk4vasfv7q36i5ee5p4at7ofoyxfzcr734zbwokkke3ribospx4pb5ekbqsnwlskuwxcxpxvf4g5pqvy2uzg6kcil4rewg5rsx2dzzpef6ysgitxv3vccdywptmfnmnx2yg2tqzpdyp2x7bbeb3bucbgvjs6mfag6ztestkie737ptkuixzhwcrt636ybfolm5kvz4rdcar7r3kjar64vnw7t7z27bcnlft7zcl6awv5lkmiv3kpzkpzqstcu4t6i47sfxxig3tsao4zei3nnrp4bepsimnkuzhzcvkk4pqexbkcinhmoes5rf5s3cd2tdlqbnkovdotg7yy4padawgtfo4sxdt643jyfunbq4lqkp6srkeh5ovi2wyhcngqejzebxwsvzxenb7xai24icfwgizvqqexoe3h4pdz5rhyki4unfkdwp7qjfed5olhxnssrglpbxspbf2cau2cyojdoxffutkssmwfwm335rvbswpwvj3423neruok7jg3pjpjhm4hvjhqzhuaybenj3hnplzjeuomdcrkyik7uwx6jyiu27nrqjy2cksa5sjx3wi5xrgiac4mmep3kmpch24qeochfyipgl2sw4pjpk3mzwq3kqfaqo2kzz53n3r7y3qauczzbnuhuveytxwhjrivt6lkr34kkojwsd2bvv
Abi Cid:bafy2bzaceabvyhnmzpd3auq6c7gykska7z5bfi3y2osmc5ijtuopzgknvyukc

if err != nil {
return err
}
fmt.Printf("Raw Cid:%s\n", rCid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We sometimes use this output in scripts, I'd print a single CID without a prefix like before, and add a flag to select a CID builder (--builder=[id,abi])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK
./lotus-shed cid id --encoding hex 313233343536
bafy2bzacebbwdptcaaoslxvsxwc7vm7emai27lsxkoicnwgtpvl7ixrjk4jhc
./lotus-shed cid id --encoding hex --codec raw 313233343536
bafkqabrrgiztinjw

return xerrors.Errorf("cidBuilder abi: %w", err)
}
fmt.Println(aCid)
case "raw":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be id or identity. Raw actually has a slightly different meaning for IPLD data (also, this command is called id)

},
&cli.StringFlag{
Name: "codec",
Value: "abi",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should keep old default behavior to not break existing scripts

Copy link
Contributor Author

@zgfzgf zgfzgf Dec 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./lotus-shed cid id --encoding hex 313233343536
bafkqabrrgiztinjw

@magik6k magik6k merged commit a999e41 into filecoin-project:master Dec 8, 2020
@zgfzgf zgfzgf deleted the feat-shed-cid branch December 8, 2020 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants