{"id":21434722,"url":"https://github.com/ilmoi/rebuild-token-vesting","last_synced_at":"2025-09-01T04:33:27.806Z","repository":{"id":112510040,"uuid":"386564660","full_name":"ilmoi/rebuild-token-vesting","owner":"ilmoi","description":"rebuild https://github.com/Bonfida/token-vesting for fun and profit (learning)","archived":false,"fork":false,"pushed_at":"2021-07-21T17:42:31.000Z","size":75,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-15T19:46:31.782Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilmoi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-16T08:24:50.000Z","updated_at":"2022-09-01T20:37:21.000Z","dependencies_parsed_at":"2023-05-15T13:15:35.615Z","dependency_job_id":null,"html_url":"https://github.com/ilmoi/rebuild-token-vesting","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ilmoi/rebuild-token-vesting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilmoi%2Frebuild-token-vesting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilmoi%2Frebuild-token-vesting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilmoi%2Frebuild-token-vesting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilmoi%2Frebuild-token-vesting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilmoi","download_url":"https://codeload.github.com/ilmoi/rebuild-token-vesting/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilmoi%2Frebuild-token-vesting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273073282,"owners_count":25040691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T23:40:13.946Z","updated_at":"2025-09-01T04:33:27.795Z","avatar_url":"https://github.com/ilmoi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"This started as a simple \"training-wheels\" project to rebuild bonfida's token\nvesting contract.\n\n# De/serializing\n\nOne useful thing that came out along the way is benchmarking of how expensive\ndifferent instruction serialization methods are.\n\nI compared 3:\n1. manual de/serialization of bytes\n2. [rust's bincode](https://github.com/bincode-org/bincode)\n3. [near's borsh](https://borsh.io/)\n\nThe results are:\n```\nmanual\nProgram SoLi39YzAM2zEXcecy77VGbxLB5yHryNckY9Jx7yBKM consumed 3665 of 200000 compute units\n\nbincode\nProgram SoLi39YzAM2zEXcecy77VGbxLB5yHryNckY9Jx7yBKM consumed 4796 of 200000 compute units\n\nborsh\nProgram SoLi39YzAM2zEXcecy77VGbxLB5yHryNckY9Jx7yBKM consumed 3854 of 200000 compute units\n```\n\nThus manual is least expensive, but borsh is close.\n\nIn terms of quantity/readability of code - I thought borsh would win since\ndeserializing in rust is 1 line vs writing out everything yourself (see\n`rs/src/instruction.rs`). But js ended up being a shitshow - see `js/play.js` and https://github.com/near/borsh-js/issues/21\n\nFor now manual de/serialization seems optimal, unless borsh-js gets better enum handling.\n\n# Fuzzing\n\nI tried fuzzing with 2 different fuzzers, and managed to get both to work in\nthe end.\n\n## [honggfuzz](https://github.com/rust-fuzz/honggfuzz-rs)\n- unfortunately doesn't currently work on mac - see [this](https://github.com/rust-fuzz/honggfuzz-rs/issues/56)\n- so instead can be run out of a docker container\n- steps:\n - 1 build and run the docker image (mount the volume to make your life easier)\n```\ndocker build -t vesting .\ndocker run -it -v $(pwd):/app/ vesting bash  \n```\n - 2 cd into hfuzz dir and run this command (BPF_OUT_DIR=\"..\" is needed for the\n     fuzzer to work in bpf mode. Otherwise tests will be run as native code.)\n```\nBPF_OUT_DIR=\"/app/target/deploy\" HFUZZ_RUN_ARGS=\"-t 10 -n 1 -N 1000000 -Q\" cargo hfuzz run vesting_fuzz\n```\n - 3 customize flags passed to hfuzz as per [this](https://github.com/google/honggfuzz/blob/master/docs/USAGE.md)\n\n## [cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz)\n- works on mac, no problem\n- cd into fuzz dir and run this command:\n```\nBPF_OUT_DIR=\"/Users/ilmoi/Dropbox/crypto_bc/sol/token-vesting/rebuild-token-vesting/rs/target/deploy\" cargo-fuzz run fuzz_target_1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filmoi%2Frebuild-token-vesting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filmoi%2Frebuild-token-vesting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filmoi%2Frebuild-token-vesting/lists"}