{"id":13603979,"url":"https://github.com/centrifuge/fudge","last_synced_at":"2025-12-24T09:49:59.515Z","repository":{"id":37080126,"uuid":"456964731","full_name":"centrifuge/fudge","owner":"centrifuge","description":"FUlly Decoupled Generic Environment for Substrate-chains","archived":false,"fork":false,"pushed_at":"2024-03-26T09:33:09.000Z","size":2306,"stargazers_count":21,"open_issues_count":13,"forks_count":2,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-03-26T10:46:49.661Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/centrifuge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license-template-apache.txt","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}},"created_at":"2022-02-08T14:23:04.000Z","updated_at":"2024-04-15T04:13:39.144Z","dependencies_parsed_at":"2024-01-03T05:14:44.512Z","dependency_job_id":"7155f08d-8af7-4d0a-b30f-feb7ed8931c3","html_url":"https://github.com/centrifuge/fudge","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centrifuge%2Ffudge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centrifuge%2Ffudge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centrifuge%2Ffudge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centrifuge%2Ffudge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/centrifuge","download_url":"https://codeload.github.com/centrifuge/fudge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248489763,"owners_count":21112633,"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","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-08-01T19:00:37.547Z","updated_at":"2025-12-24T09:49:59.508Z","avatar_url":"https://github.com/centrifuge.png","language":"Rust","funding_links":[],"categories":["Libraries","Tools"],"sub_categories":["Multisig Wallets"],"readme":"# Centrifuge - FUDGE \n\nFUDGE - FUlly Decoupled Generic Environment\n\n:warning: NOTE:\n\n:warning: Expect Breaking Changes\n\n:warning: Expect reaching not yet implemented errors during runtime, and various bugs during altering a chains state as interacting with the underlying db is complex. Expect errors due to unwrapping where error handling should instead propagate errors. \n\nFUDGE provides a core lib for interacting with a substrate based blockchain database.\nThis allows users to \n* Load a database and do analytics on any given block the database provides \n* Populate an empty database with a genesis configuration\n* Manipulate the latest state of the database arbitrarily\n* Provides externalities\n* Build blocks on top of the latest block in the database (in WASM environment)\n* Build blocks in companion with a relay-chain (i.e. mimics normal relay-chain-parachain environment locally)\n\n\n### Features\n- [x] Accessing state of a chain at any given block (given the database contains that state)\n- [x] Mutating the latest state of a given chain\n- [x] Executing runtime code in any given state of the chain\n- [x] Building blocks for Para- Relay-Chain setups, Standalone-chains\n  \n  (**NOTE:** Does **NOT** mimic actual block importing procedure in the para-relay-chain-setup. Instead forces head of parachains manually)\n\n  (**NOTE:** Does build a block with the normal block building procedure that standard substrate node use)\n  - [ ] Mimic block production in para-relay-chain-setup\n- [x] Inject extrinsic into normal substrate `FullPool`, that provides them to the block building mechanism\n- [ ] XCM-Support\n- [ ] Mutating past state and propagating changes to the latest block\n\n\n## How to use?\nAdd the following dependecy to your project (*Currently only polkadot-v0.9.17 compatability*). Please always use \nthe latest version available until we reach a more stable *0.1.x* state.\n```toml\nfudge = { git = \"https://github.com/centrifuge/fudge\", tag = \"v0.0.5-polkadot-v0.9.17\"}\n```\n\nSet up your test environment like the following.\nIn this setup the `RelayCidp` and `Centrifuge` are the `CreateInherentDataProviders` of the respective chains. \n\nFor a detailed example please look at test cases in the repo at *crate::core::tests*. \n```rust\n#[fudge::companion]\npub struct TestEnv {\n\t#[fudge::relaychain]\n\trelay: RelaychainBuilder\u003cRelayBlock, RelayRtApi, RelayRt, RelayCidp, Dp\u003e,\n\t#[fudge::parachain(2000)]\n\tcentrifuge: ParachainBuilder\u003cCentrifugeBlock, CentrifugeRtApi, CentrifugeCidp, Dp\u003e,\n}\n```\nThe `TestEnv` will expose the following methods:\n```rust\n\nimpl TestEnv {\n  // Takes a scale-encoded extrinsic and injects it into the pool if the respective chain.\n  // Will throw an error if decoding into chains extrinsic fails.\n  pub fn append_extrinsic(chain: Chain, xt: Vec\u003cu8\u003e) -\u003e Result\u003c(), ()\u003e;\n\n  // Provides the latest state of the chain. (Externalities provided environment)\n  pub fn with_state(chain: Chain, exec: FnOnce() -\u003e Result\u003cR, E\u003e) -\u003e Result\u003cR, ()\u003e;\n\n  // Provides the latest state of the chain mutably. (Externalities provided environment)\n  pub fn with_mut_state(chain: Chain, exec: FnOnce() -\u003e Result\u003cR, E\u003e) -\u003e Result\u003cR, ()\u003e;\n\n  // Builds one parachain block and two relay-chain blocks\n  pub fn evolve() -\u003e Result\u003c(), ()\u003e;\n}\n```\n\nthat can be called like\n```rust\n// Access the state of the parachain\nenv.with_state(Chain::Para(ID_HERE), || {\n    // Externalities provided environment\n    // at the latest state of the chain\n})\n\n// Access the state of the relay, with mutations \n// being stored, hence altering the latest state of the parachain\nenv.with_mut_state(Chain::Relay, || {\n// Externalities provided environment\n// at the latest state of the chain\n})\n\n// Progess the chains\nenv.evolve()\n```\n\n\n### Additional Requirements\nTo build you'll also need `protoc` installed from protobuf.\n\nShould be available in `asdf` if using `asdf`, or from the protobuf release page: https://github.com/protocolbuffers/protobuf/releases\n(i.e: https://github.com/protocolbuffers/protobuf/releases/download/v3.20.2/protoc-3.20.2-osx-x86_64.zip)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentrifuge%2Ffudge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentrifuge%2Ffudge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentrifuge%2Ffudge/lists"}