├── ipc ├── .dockerignore ├── .gitignore ├── wallet │ ├── tests │ │ └── keystore_encrypted_old │ │ │ └── keystore │ └── src │ │ ├── fvm │ │ ├── mod.rs │ │ ├── utils.rs │ │ └── errors.rs │ │ └── lib.rs ├── rust-toolchain.toml ├── types │ ├── README.md │ └── Cargo.toml ├── provider │ └── src │ │ ├── manager │ │ └── mod.rs │ │ └── lotus │ │ └── message │ │ └── serialize.rs ├── observability │ ├── src │ │ ├── serde.rs │ │ └── observe.rs │ └── Cargo.toml ├── cli │ └── src │ │ ├── main.rs │ │ └── commands │ │ ├── config │ │ └── mod.rs │ │ └── util │ │ ├── f4.rs │ │ ├── mod.rs │ │ └── eth.rs ├── Dockerfile └── api │ └── src │ ├── error.rs │ └── gateway.rs ├── contracts ├── tsconfig.json ├── slither.config.json ├── .gitattributes ├── .env.template ├── tasks │ ├── lib │ │ ├── index.ts │ │ └── selectors.ts │ ├── index.ts │ └── deploy-libraries.ts ├── contracts │ ├── enums │ │ ├── ConsensusType.sol │ │ └── IPCMsgType.sol │ ├── interfaces │ │ ├── ISubnetActor.sol │ │ ├── IDiamond.sol │ │ ├── IERC165.sol │ │ ├── IDiamondCut.sol │ │ └── IValidatorGater.sol │ ├── constants │ │ └── Constants.sol │ ├── OwnershipFacet.sol │ ├── lib │ │ └── AccountHelper.sol │ ├── structs │ │ └── FvmAddress.sol │ └── subnet │ │ ├── SubnetActorPauseFacet.sol │ │ └── SubnetActorRewardFacet.sol ├── test │ ├── helpers │ │ ├── contracts │ │ │ ├── NumberContractFacetEight.sol │ │ │ └── NumberContractFacetSeven.sol │ │ ├── ERC20Helper.sol │ │ ├── ERC20Nil.sol │ │ └── FvmAddressHelper.sol │ ├── mocks │ │ ├── AssetHelperMock.sol │ │ └── SubnetActorMock.sol │ └── unit │ │ ├── FvmAddressHelper.t.sol │ │ └── AccountHelper.t.sol ├── .prettierignore ├── ops │ ├── commit-rust-binding.sh │ ├── README.md │ ├── check-rust-binding.sh │ ├── commit-abi.sh │ ├── compile-abi.sh │ └── chain-id.sh ├── binding │ └── Cargo.toml ├── tools │ └── check_coverage.sh ├── .prettierrc ├── sdk │ └── interfaces │ │ └── IIpcHandler.sol └── .gitignore ├── fendermint ├── actors │ ├── .gitignore │ ├── api │ │ ├── src │ │ │ └── lib.rs │ │ └── Cargo.toml │ ├── src │ │ └── lib.rs │ ├── chainmetadata │ │ ├── src │ │ │ └── lib.rs │ │ └── Cargo.toml │ ├── timehub │ │ └── src │ │ │ └── lib.rs │ ├── bucket │ │ └── src │ │ │ └── lib.rs │ ├── blob_reader │ │ └── src │ │ │ └── lib.rs │ ├── blobs │ │ ├── src │ │ │ ├── state │ │ │ │ ├── accounts.rs │ │ │ │ ├── blobs.rs │ │ │ │ ├── credit │ │ │ │ │ └── params.rs │ │ │ │ └── credit.rs │ │ │ ├── shared.rs │ │ │ ├── lib.rs │ │ │ ├── sol_facade │ │ │ │ └── mod.rs │ │ │ └── actor │ │ │ │ └── metrics.rs │ │ ├── shared │ │ │ ├── src │ │ │ │ ├── accounts.rs │ │ │ │ ├── credit.rs │ │ │ │ ├── blobs.rs │ │ │ │ ├── accounts │ │ │ │ │ └── params.rs │ │ │ │ └── blobs │ │ │ │ │ ├── blob.rs │ │ │ │ │ └── status.rs │ │ │ └── Cargo.toml │ │ └── testing │ │ │ └── Cargo.toml │ ├── recall_config │ │ └── shared │ │ │ └── Cargo.toml │ ├── machine │ │ └── Cargo.toml │ ├── activity-tracker │ │ └── src │ │ │ └── types.rs │ └── eam │ │ └── Cargo.toml ├── testing │ ├── .gitignore │ ├── contracts │ │ ├── QueryBlockhash_storage.json │ │ ├── QueryBlockhash.signatures │ │ ├── SimpleCoin.signatures │ │ ├── Greeter.signatures │ │ ├── Greeter_storage.json │ │ ├── QueryBlockhash.abi │ │ ├── QueryBlockhash.sol │ │ ├── SimpleCoin_storage.json │ │ ├── Greeter.abi │ │ ├── QueryBlockhash.bin-runtime │ │ ├── QueryBlockhash.bin │ │ └── Greeter.sol │ ├── graph-test │ │ ├── subgraph │ │ │ ├── graph-node │ │ │ │ └── .gitignore │ │ │ ├── schema.graphql │ │ │ └── subgraph.template.yaml │ │ ├── scripts │ │ │ └── graph.env │ │ ├── Cargo.toml │ │ └── README.md │ ├── smoke-test │ │ ├── scripts │ │ │ └── smoke.env │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── benchmarks │ │ └── state-size │ │ │ ├── .gitignore │ │ │ ├── measurements │ │ │ ├── state-size-0-true-none.stats │ │ │ ├── state-size-15-false-level.stats │ │ │ ├── state-size-15-false-none.stats │ │ │ ├── state-size-15-true-none.stats │ │ │ ├── state-size-0-false-level-transfer.stats │ │ │ ├── state-size-0-true-none.png │ │ │ ├── state-size-15-false-none.png │ │ │ ├── state-size-15-true-none.png │ │ │ ├── state-size-15-false-level.png │ │ │ └── state-size-0-false-level-transfer.png │ │ │ └── scripts │ │ │ ├── growth-plot.plt │ │ │ ├── stats.sh │ │ │ ├── growth-plot.sh │ │ │ ├── make-manifest.sh │ │ │ └── make-measurements.sh │ ├── snapshot-test │ │ ├── scripts │ │ │ ├── snapshot.env │ │ │ ├── node-2.env │ │ │ ├── node-1.env │ │ │ └── node-3.env │ │ └── Cargo.toml │ ├── contract-test │ │ ├── src │ │ │ └── ipc │ │ │ │ └── mod.rs │ │ └── tests │ │ │ └── staking │ │ │ └── mod.rs │ ├── scripts │ │ ├── fendermint.toml │ │ ├── ci.env │ │ ├── get_port.sh │ │ └── common.env │ ├── src │ │ ├── lib.rs │ │ └── arb │ │ │ ├── mod.rs │ │ │ ├── address.rs │ │ │ └── message.rs │ ├── materializer │ │ ├── tests │ │ │ ├── docker_tests │ │ │ │ └── mod.rs │ │ │ ├── manifests │ │ │ │ ├── root-only.yaml │ │ │ │ └── standalone.yaml │ │ │ └── golden.rs │ │ └── scripts │ │ │ └── docker-entry.sh │ ├── Makefile │ └── README.md ├── vm │ ├── message │ │ ├── golden │ │ │ ├── query │ │ │ │ ├── request │ │ │ │ │ ├── ipld.txt │ │ │ │ │ ├── actor_state.cbor │ │ │ │ │ ├── actor_state.txt │ │ │ │ │ └── ipld.cbor │ │ │ │ └── response │ │ │ │ │ ├── actor_state.txt │ │ │ │ │ └── actor_state.cbor │ │ │ ├── fvm │ │ │ │ ├── message.cid │ │ │ │ ├── message.cbor │ │ │ │ └── message.txt │ │ │ └── chain │ │ │ │ ├── ipc_top_down.txt │ │ │ │ ├── ipc_top_down.cbor │ │ │ │ ├── signed.cbor │ │ │ │ ├── signed.txt │ │ │ │ ├── ipc_bottom_up_resolve.cbor │ │ │ │ ├── ipc_bottom_up_resolve.txt │ │ │ │ └── ipc_bottom_up_exec.cbor │ │ └── src │ │ │ └── lib.rs │ ├── resolver │ │ ├── src │ │ │ └── lib.rs │ │ └── Cargo.toml │ ├── actor_interface │ │ └── src │ │ │ ├── blobs.rs │ │ │ ├── gas.rs │ │ │ ├── blob_reader.rs │ │ │ ├── gas_market.rs │ │ │ ├── activity.rs │ │ │ ├── chainmetadata.rs │ │ │ ├── ethaccount.rs │ │ │ ├── recall_config.rs │ │ │ ├── burntfunds.rs │ │ │ ├── bucket.rs │ │ │ ├── timehub.rs │ │ │ ├── reward.rs │ │ │ ├── account.rs │ │ │ ├── placeholder.rs │ │ │ ├── diamond.rs │ │ │ ├── system.rs │ │ │ └── cron.rs │ ├── core │ │ ├── src │ │ │ ├── lib.rs │ │ │ └── timestamp.rs │ │ └── Cargo.toml │ ├── iroh_resolver │ │ ├── src │ │ │ └── lib.rs │ │ └── Cargo.toml │ ├── interpreter │ │ ├── golden │ │ │ └── fvmstateparams │ │ │ │ ├── json │ │ │ │ ├── fvmstateparams.txt │ │ │ │ └── fvmstateparams.json │ │ │ │ └── cbor │ │ │ │ ├── fvmstateparams.txt │ │ │ │ └── fvmstateparams.cbor │ │ ├── src │ │ │ ├── fvm │ │ │ │ ├── state │ │ │ │ │ └── mod.rs │ │ │ │ └── store │ │ │ │ │ └── mod.rs │ │ │ └── arb.rs │ │ └── tests │ │ │ └── golden.rs │ ├── event │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── encoding │ │ └── Cargo.toml │ ├── snapshot │ │ ├── golden │ │ │ └── manifest │ │ │ │ ├── cbor │ │ │ │ ├── manifest.txt │ │ │ │ └── manifest.cbor │ │ │ │ └── json │ │ │ │ ├── manifest.txt │ │ │ │ └── manifest.json │ │ ├── src │ │ │ ├── error.rs │ │ │ └── lib.rs │ │ └── tests │ │ │ └── golden.rs │ ├── genesis │ │ └── tests │ │ │ └── golden.rs │ └── topdown │ │ └── src │ │ └── error.rs ├── eth │ ├── api │ │ ├── src │ │ │ ├── handlers │ │ │ │ └── mod.rs │ │ │ └── conv │ │ │ │ ├── mod.rs │ │ │ │ └── from_fvm.rs │ │ └── README.md │ └── hardhat │ │ └── Cargo.toml ├── app │ ├── options │ │ └── src │ │ │ ├── config.rs │ │ │ └── run.rs │ ├── src │ │ ├── metrics │ │ │ ├── mod.rs │ │ │ └── prometheus.rs │ │ ├── cmd │ │ │ └── config.rs │ │ └── lib.rs │ ├── settings │ │ └── src │ │ │ ├── objects.rs │ │ │ └── testing.rs │ └── config │ │ └── test.toml ├── abci │ ├── src │ │ ├── lib.rs │ │ └── util.rs │ └── Cargo.toml ├── .gitignore ├── tracing │ └── Cargo.toml ├── docker │ ├── docker-entry.sh │ └── builder.local.Dockerfile ├── rocksdb │ └── src │ │ ├── lib.rs │ │ ├── rocks │ │ └── error.rs │ │ └── namespaces.rs ├── crypto │ └── Cargo.toml ├── storage │ └── Cargo.toml └── rpc │ └── src │ └── lib.rs ├── docs ├── fendermint │ ├── diagrams │ │ ├── .gitignore │ │ ├── checkpointing.png │ │ ├── Makefile │ │ └── README.md │ ├── images │ │ └── IPC with Tendermint Core.jpg │ ├── demos │ │ └── milestone-1 │ │ │ ├── Fendermint_Demo.pdf │ │ │ └── README.md │ └── README.md └── ipc │ ├── img │ ├── metamask_add.png │ ├── metamask_rpc.png │ └── metamask_network.png │ ├── quickstart-calibration.md │ └── diagrams │ └── Makefile ├── ext ├── libp2p-bitswap │ ├── .gitignore │ ├── build.rs │ └── src │ │ ├── compat │ │ └── mod.rs │ │ └── lib.rs ├── frc42_dispatch │ ├── macros │ │ ├── example │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── tests │ │ │ └── naming │ │ │ │ ├── empty-name-string.stderr │ │ │ │ ├── illegal-chars.stderr │ │ │ │ ├── non-capital-start.stderr │ │ │ │ ├── missing-name.stderr │ │ │ │ ├── empty-name-string.rs │ │ │ │ ├── missing-name.rs │ │ │ │ ├── illegal-chars.rs │ │ │ │ └── non-capital-start.rs │ │ ├── Cargo.toml │ │ └── src │ │ │ └── hash.rs │ ├── README.md │ ├── hasher │ │ ├── src │ │ │ └── lib.rs │ │ └── Cargo.toml │ ├── src │ │ └── lib.rs │ └── Cargo.toml └── merkle-tree-rs │ ├── src │ └── lib.rs │ └── Cargo.toml ├── .dockerignore ├── deployment ├── .gitignore ├── docker │ ├── anvil.Dockerfile │ ├── localnet.Dockerfile │ └── subnet-setup.Dockerfile ├── README.md └── set-up-nu.sh ├── CODEOWNERS ├── ipld └── resolver │ ├── .gitignore │ ├── docs │ └── diagrams │ │ ├── ipld_resolver.png │ │ ├── checkpoint_schema.png │ │ ├── checkpoint_submission.png │ │ └── Makefile │ ├── src │ ├── lib.rs │ ├── hash.rs │ └── arb.rs │ └── Makefile ├── pnpm-workspace.yaml ├── rustfmt.toml ├── demos ├── axelar-token │ ├── architecture.png │ ├── foundry.toml │ ├── .gitignore │ └── test │ │ ├── DummyERC20.sol │ │ └── TestSender.sol └── linked-token │ ├── linked-token-bridging.png │ ├── linked-token-withdrawing.png │ ├── .prettierignore │ ├── contracts │ ├── v2 │ │ └── README.md │ └── USDCTest.sol │ ├── .gitignore │ ├── test │ ├── LinkedTokenReplicaV2Extension.sol │ └── LinkedTokenControllerV2Extension.sol │ ├── foundry.toml │ ├── script │ └── DeployUSDCTest.s.sol │ ├── .env.template │ └── .prettierrc ├── SECURITY.md ├── rust-toolchain.toml ├── .gitignore ├── recall ├── actor_sdk │ ├── src │ │ ├── lib.rs │ │ └── storage.rs │ └── Cargo.toml ├── ipld │ ├── src │ │ ├── amt.rs │ │ ├── hamt.rs │ │ └── lib.rs │ └── Cargo.toml ├── kernel │ ├── ops │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── Cargo.toml ├── syscalls │ └── Cargo.toml ├── iroh_manager │ └── Cargo.toml ├── executor │ └── Cargo.toml └── Makefile ├── package.json ├── .github ├── workflows │ ├── license.yaml │ ├── contracts-pnpm-audit.yaml │ ├── contracts-prettier.yaml │ ├── demos.yaml │ └── contracts-storage.yaml └── actions │ └── setup-cache │ └── action.yaml ├── infra ├── fendermint │ └── scripts │ │ ├── node.toml │ │ ├── docker.toml │ │ ├── grafana.toml │ │ ├── loki.toml │ │ ├── prometheus.toml │ │ ├── anvil.toml │ │ └── relayer.toml ├── promtail │ └── promtail-config.yaml └── prometheus │ └── prometheus.yaml ├── .gitmodules └── LICENSE-MIT /ipc/.dockerignore: -------------------------------------------------------------------------------- 1 | target/ -------------------------------------------------------------------------------- /contracts/tsconfig.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /fendermint/actors/.gitignore: -------------------------------------------------------------------------------- 1 | output 2 | -------------------------------------------------------------------------------- /fendermint/testing/.gitignore: -------------------------------------------------------------------------------- 1 | **/test-data 2 | -------------------------------------------------------------------------------- /docs/fendermint/diagrams/.gitignore: -------------------------------------------------------------------------------- 1 | plantuml.jar 2 | -------------------------------------------------------------------------------- /ext/libp2p-bitswap/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | target 2 | contracts/cache 3 | contracts/node-modules 4 | -------------------------------------------------------------------------------- /deployment/.gitignore: -------------------------------------------------------------------------------- 1 | /.nu/ 2 | /localnet-data* 3 | /testnet-data-* 4 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/QueryBlockhash_storage.json: -------------------------------------------------------------------------------- 1 | {"storage":[]} -------------------------------------------------------------------------------- /fendermint/testing/graph-test/subgraph/graph-node/.gitignore: -------------------------------------------------------------------------------- 1 | data/ 2 | -------------------------------------------------------------------------------- /contracts/slither.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "filter_paths": "lib,test" 3 | } 4 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Route all PRs to the ipc-core-devs team. 2 | * @consensus-shipyard/ipc-core-devs -------------------------------------------------------------------------------- /contracts/.gitattributes: -------------------------------------------------------------------------------- 1 | out/* linguist-generated=true 2 | binding/* linguist-generated=true 3 | -------------------------------------------------------------------------------- /fendermint/testing/graph-test/scripts/graph.env: -------------------------------------------------------------------------------- 1 | NETWORK_NAME="graph" 2 | TEST_DIR="graph-test" 3 | -------------------------------------------------------------------------------- /fendermint/testing/smoke-test/scripts/smoke.env: -------------------------------------------------------------------------------- 1 | NETWORK_NAME="smoke" 2 | TEST_DIR="smoke-test" 3 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/.gitignore: -------------------------------------------------------------------------------- 1 | state-size.yaml 2 | measurements/*.jsonline 3 | -------------------------------------------------------------------------------- /ipld/resolver/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.iml 3 | /target 4 | docs/diagrams/plantuml.jar 5 | Cargo.lock 6 | -------------------------------------------------------------------------------- /docs/ipc/img/metamask_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/docs/ipc/img/metamask_add.png -------------------------------------------------------------------------------- /docs/ipc/img/metamask_rpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/docs/ipc/img/metamask_rpc.png -------------------------------------------------------------------------------- /docs/ipc/quickstart-calibration.md: -------------------------------------------------------------------------------- 1 | # Moved to [IPC Docs](https://docs.ipc.space/quickstarts/deploy-a-subnet) -------------------------------------------------------------------------------- /fendermint/vm/message/golden/query/request/ipld.txt: -------------------------------------------------------------------------------- 1 | Ipld(Cid(QmcBeJYXLGf54hskJi9XEjLF62XkfFd86awqbmNSoTtVMR)) -------------------------------------------------------------------------------- /contracts/.env.template: -------------------------------------------------------------------------------- 1 | export PRIVATE_KEY= 2 | export RPC_URL=https://filecoin-calibration.chainup.net/rpc/v1 -------------------------------------------------------------------------------- /fendermint/testing/snapshot-test/scripts/snapshot.env: -------------------------------------------------------------------------------- 1 | NETWORK_NAME="snapshot" 2 | TEST_DIR="snapshot-test" 3 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'contracts' 3 | - 'demos/axelar-token' 4 | - 'demos/linked-token' 5 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | edition = "2021" 2 | 3 | # Ignore auto-generated files. 4 | ignore = ["contracts/binding/src"] 5 | -------------------------------------------------------------------------------- /docs/ipc/img/metamask_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/docs/ipc/img/metamask_network.png -------------------------------------------------------------------------------- /fendermint/testing/contracts/QueryBlockhash.signatures: -------------------------------------------------------------------------------- 1 | Function signatures: 2 | e9413d38: getBlockhash(uint256) 3 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/query/request/actor_state.cbor: -------------------------------------------------------------------------------- 1 | a16a4163746f7253746174655004ffffffffffffffffff0117c0d40094 -------------------------------------------------------------------------------- /contracts/tasks/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './diamond' 2 | export * from './deployments' 3 | export * from './selectors' -------------------------------------------------------------------------------- /demos/axelar-token/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/demos/axelar-token/architecture.png -------------------------------------------------------------------------------- /fendermint/vm/message/golden/fvm/message.cid: -------------------------------------------------------------------------------- 1 | 0171a0e40220e39618f0b70f125751437cb18ebdfa3ecc5f9da2b333262dadf048a33bb2ec91 -------------------------------------------------------------------------------- /fendermint/vm/message/golden/query/request/actor_state.txt: -------------------------------------------------------------------------------- 1 | ActorState(Address("f418446744073709551615fc7aniaeuez775jy")) -------------------------------------------------------------------------------- /ipc/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.iml 3 | /target 4 | docs/diagrams/plantuml.jar 5 | bin 6 | /lotus 7 | fx.dot 8 | testing/itest/logs -------------------------------------------------------------------------------- /docs/fendermint/diagrams/checkpointing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/docs/fendermint/diagrams/checkpointing.png -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security 2 | 3 | ## Reporting a vulnerability 4 | 5 | Please report any security-sensitive issues via ipc@protocol.ai 6 | -------------------------------------------------------------------------------- /demos/linked-token/linked-token-bridging.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/demos/linked-token/linked-token-bridging.png -------------------------------------------------------------------------------- /fendermint/testing/graph-test/subgraph/schema.graphql: -------------------------------------------------------------------------------- 1 | type Greeting @entity { 2 | id: ID! 3 | currentGreeting: String! 4 | } 5 | -------------------------------------------------------------------------------- /demos/linked-token/linked-token-withdrawing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/demos/linked-token/linked-token-withdrawing.png -------------------------------------------------------------------------------- /fendermint/vm/message/golden/query/request/ipld.cbor: -------------------------------------------------------------------------------- 1 | a16449706c64d82a5823001220cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8 -------------------------------------------------------------------------------- /ipld/resolver/docs/diagrams/ipld_resolver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/ipld/resolver/docs/diagrams/ipld_resolver.png -------------------------------------------------------------------------------- /ipc/wallet/tests/keystore_encrypted_old/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/ipc/wallet/tests/keystore_encrypted_old/keystore -------------------------------------------------------------------------------- /ipld/resolver/docs/diagrams/checkpoint_schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/ipld/resolver/docs/diagrams/checkpoint_schema.png -------------------------------------------------------------------------------- /docs/fendermint/images/IPC with Tendermint Core.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/docs/fendermint/images/IPC with Tendermint Core.jpg -------------------------------------------------------------------------------- /fendermint/actors/api/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | pub mod gas_market; 5 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "1.81.0" 3 | components = ["clippy", "llvm-tools", "rustfmt"] 4 | targets = ["wasm32-unknown-unknown"] 5 | -------------------------------------------------------------------------------- /docs/fendermint/demos/milestone-1/Fendermint_Demo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/docs/fendermint/demos/milestone-1/Fendermint_Demo.pdf -------------------------------------------------------------------------------- /ipc/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "1.81.0" 3 | components = ["clippy", "llvm-tools", "rustfmt"] 4 | targets = ["wasm32-unknown-unknown"] 5 | -------------------------------------------------------------------------------- /ipld/resolver/docs/diagrams/checkpoint_submission.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/ipld/resolver/docs/diagrams/checkpoint_submission.png -------------------------------------------------------------------------------- /fendermint/vm/message/golden/chain/ipc_top_down.txt: -------------------------------------------------------------------------------- 1 | Ipc(TopDownExec(ParentFinality { height: 3233809629, block_hash: [150, 0, 100, 212, 209, 1, 180, 165, 12] })) -------------------------------------------------------------------------------- /fendermint/vm/resolver/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | pub mod ipld; 5 | pub mod pool; 6 | -------------------------------------------------------------------------------- /fendermint/eth/api/src/handlers/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | pub mod http; 5 | pub mod ws; 6 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/chain/ipc_top_down.cbor: -------------------------------------------------------------------------------- 1 | a163497063a16b546f70446f776e45786563a2666865696768741ac0c004dd6a626c6f636b5f6861736889189600186418d418d10118b418a50c -------------------------------------------------------------------------------- /fendermint/actors/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | mod manifest; 4 | 5 | pub use manifest::Manifest; 6 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/blobs.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | define_id!(BLOBS { id: 66 }); 5 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/gas.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | define_id!(GAS_MARKET { id: 98 }); 5 | -------------------------------------------------------------------------------- /fendermint/testing/contract-test/src/ipc/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | pub mod registry; 5 | pub mod subnet; 6 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/blob_reader.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021-2023 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | define_id!(BLOB_READER { id: 67 }); 5 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/gas_market.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | define_id!(GAS_MARKET { id: 98 }); 5 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/activity.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | define_id!(ACTIVITY_TRACKER { id: 99 }); 5 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/chainmetadata.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | define_id!(CHAINMETADATA { id: 48 }); 5 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/ethaccount.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | define_code!(ETHACCOUNT { code_id: 16 }); 5 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/recall_config.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | define_id!(RECALL_CONFIG { id: 70 }); 5 | -------------------------------------------------------------------------------- /fendermint/eth/api/src/conv/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | pub mod from_eth; 5 | pub mod from_fvm; 6 | pub mod from_tm; 7 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-0-true-none.stats: -------------------------------------------------------------------------------- 1 | { 2 | "block_height": 10278, 3 | "db_size_kb": 60740, 4 | "avg_growth_kb": 5.131840311587147 5 | } 6 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-15-false-level.stats: -------------------------------------------------------------------------------- 1 | { 2 | "block_height": 1811, 3 | "db_size_kb": 9124, 4 | "avg_growth_kb": 0.6201550387596899 5 | } 6 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-15-false-none.stats: -------------------------------------------------------------------------------- 1 | { 2 | "block_height": 1941, 3 | "db_size_kb": 9208, 4 | "avg_growth_kb": 0.621900826446281 5 | } 6 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-15-true-none.stats: -------------------------------------------------------------------------------- 1 | { 2 | "block_height": 2630, 3 | "db_size_kb": 21200, 4 | "avg_growth_kb": 5.0248946763692075 5 | } 6 | -------------------------------------------------------------------------------- /fendermint/testing/scripts/fendermint.toml: -------------------------------------------------------------------------------- 1 | 2 | [tasks.fendermint-init] 3 | extend = "fendermint-run" 4 | env = { "ENTRY" = "/data/scripts/init.sh", "FLAGS" = "-a STDOUT -a STDERR --rm" } 5 | -------------------------------------------------------------------------------- /fendermint/testing/scripts/ci.env: -------------------------------------------------------------------------------- 1 | CMT_WAIT_MILLIS = 20000 2 | IROH_WAIT_MILLIS = 5000 3 | # Help debug any issues with simplecoin by logging requests and responses. 4 | VERBOSITY = "--verbose" 5 | -------------------------------------------------------------------------------- /fendermint/vm/core/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | pub mod chainid; 4 | mod timestamp; 5 | 6 | pub use timestamp::Timestamp; 7 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-0-false-level-transfer.stats: -------------------------------------------------------------------------------- 1 | { 2 | "block_height": 221, 3 | "db_size_kb": 8892, 4 | "avg_growth_kb": 4.018433179723503 5 | } 6 | -------------------------------------------------------------------------------- /fendermint/app/options/src/config.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use clap::Args; 5 | 6 | #[derive(Args, Debug)] 7 | pub struct ConfigArgs; 8 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-0-true-none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/fendermint/testing/benchmarks/state-size/measurements/state-size-0-true-none.png -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-15-false-none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/fendermint/testing/benchmarks/state-size/measurements/state-size-15-false-none.png -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-15-true-none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/fendermint/testing/benchmarks/state-size/measurements/state-size-15-true-none.png -------------------------------------------------------------------------------- /fendermint/testing/contracts/SimpleCoin.signatures: -------------------------------------------------------------------------------- 1 | f8b2cb4f: getBalance(address) 2 | 7bd703e8: getBalanceInEth(address) 3 | 90b98a11: sendCoin(address,uint256) 4 | 587cb60c: sendCoinOrRevert(address,uint256) 5 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-15-false-level.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/fendermint/testing/benchmarks/state-size/measurements/state-size-15-false-level.png -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/example/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | frc42_macros = { version = "6.0.0", path = ".." } 9 | -------------------------------------------------------------------------------- /fendermint/app/src/metrics/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | mod prometheus; 5 | 6 | pub use prometheus::eth::register_metrics as register_eth_metrics; 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .idea 3 | node_modules/ 4 | .DS_Store 5 | 6 | # we migrated from npm to pnpm. 7 | package-lock.json 8 | .vscode 9 | 10 | # recall 11 | test-network 12 | nohup* 13 | .env 14 | relayer.log 15 | -------------------------------------------------------------------------------- /fendermint/actors/chainmetadata/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021-2023 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | #[cfg(feature = "fil-actor")] 4 | mod actor; 5 | mod shared; 6 | 7 | pub use shared::*; 8 | -------------------------------------------------------------------------------- /fendermint/abci/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | mod application; 4 | 5 | pub use application::{AbciResult, Application, ApplicationService}; 6 | pub mod util; 7 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/measurements/state-size-0-false-level-transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/recallnet/ipc/HEAD/fendermint/testing/benchmarks/state-size/measurements/state-size-0-false-level-transfer.png -------------------------------------------------------------------------------- /fendermint/vm/iroh_resolver/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | pub mod iroh; 6 | pub mod observe; 7 | pub mod pool; 8 | -------------------------------------------------------------------------------- /ipc/types/README.md: -------------------------------------------------------------------------------- 1 | # primitives 2 | This crate contains the typed primitives useful for fvm implementation. The list of items 3 | include `TAddress`, `TCid`, `TAmt` and `THamt`, corresponding to `Address`, `Cid`, 4 | `Amt` and `Hamt`. -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/burntfunds.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | // The burnt funds actor is just an Account actor. 5 | 6 | define_id!(BURNT_FUNDS { id: 99 }); 7 | -------------------------------------------------------------------------------- /recall/actor_sdk/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | pub mod caller; 6 | pub mod evm; 7 | pub mod storage; 8 | pub mod util; 9 | -------------------------------------------------------------------------------- /fendermint/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | builtin-actors 3 | docker/.artifacts 4 | docker/Dockerfile 5 | cometbft 6 | test-network 7 | testing/materializer/tests/docker-materializer-data 8 | .idea 9 | .make 10 | .contracts-gen 11 | .vscode 12 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/Greeter.signatures: -------------------------------------------------------------------------------- 1 | Function signatures: 2 | cfae3217: greet() 3 | a4136862: setGreeting(string) 4 | 5 | Event signatures: 6 | ad181ee258ff92d26bf7ed2e6b571ef1cba3afc45f028b863b0f02adaffc2f06: GreetingSet(string) 7 | -------------------------------------------------------------------------------- /contracts/contracts/enums/ConsensusType.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | /// @title Subnet Consensus Type enum 5 | /// @author LimeChain team 6 | enum ConsensusType { 7 | Fendermint 8 | } 9 | -------------------------------------------------------------------------------- /demos/linked-token/.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in the lib folder 2 | lib/ 3 | package.json 4 | package-lock.json 5 | out/ 6 | .out/ 7 | artifacts/ 8 | cache/ 9 | cache_hardhat/ 10 | typechain/ 11 | .storage-layouts/ 12 | node_modules/ -------------------------------------------------------------------------------- /demos/linked-token/contracts/v2/README.md: -------------------------------------------------------------------------------- 1 | This folder is provided as an example of how an upgrade would look. In this example the upgrade creates no significant changes. In general you would want to update when an important change would be introduced. 2 | -------------------------------------------------------------------------------- /fendermint/actors/timehub/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | mod actor; 6 | mod shared; 7 | mod sol_facade; 8 | 9 | pub use shared::*; 10 | -------------------------------------------------------------------------------- /fendermint/testing/graph-test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_graph_test" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /fendermint/testing/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | #[cfg(feature = "arb")] 4 | pub mod arb; 5 | #[cfg(feature = "golden")] 6 | pub mod golden; 7 | #[cfg(feature = "smt")] 8 | pub mod smt; 9 | -------------------------------------------------------------------------------- /contracts/contracts/enums/IPCMsgType.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | /// @title IPC Message type enum 5 | /// @author LimeChain team 6 | enum IPCMsgType { 7 | TopDown, 8 | BottomUp 9 | } 10 | -------------------------------------------------------------------------------- /fendermint/eth/api/src/conv/from_fvm.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | //! Helper methods to convert between FVM and Ethereum data formats. 5 | 6 | pub use fendermint_vm_message::conv::from_fvm::*; 7 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/Greeter_storage.json: -------------------------------------------------------------------------------- 1 | {"storage":[{"astId":3,"contract":"contracts/Greeter.sol:Greeter","label":"greeting","offset":0,"slot":"0","type":"t_string_storage"}],"types":{"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"}}} -------------------------------------------------------------------------------- /recall/ipld/src/amt.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // Copyright 2019-2022 ChainSafe Systems 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | 6 | mod core; 7 | pub mod vec; 8 | 9 | pub use vec::Root; 10 | -------------------------------------------------------------------------------- /fendermint/actors/bucket/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | mod actor; 6 | mod shared; 7 | mod sol_facade; 8 | mod state; 9 | 10 | pub use shared::*; 11 | -------------------------------------------------------------------------------- /contracts/test/helpers/contracts/NumberContractFacetEight.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | contract NumberContractFacetEight { 5 | function getNum() external pure returns (uint8) { 6 | return 8; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /contracts/test/helpers/contracts/NumberContractFacetSeven.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | contract NumberContractFacetSeven { 5 | function getNum() external pure returns (uint8) { 6 | return 7; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /fendermint/actors/blob_reader/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | mod actor; 6 | mod shared; 7 | mod sol_facade; 8 | mod state; 9 | 10 | pub use shared::*; 11 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/src/state/accounts.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | mod account; 6 | mod methods; 7 | #[cfg(test)] 8 | mod tests; 9 | 10 | pub use account::*; 11 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/src/shared.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | pub use crate::state::State; 6 | 7 | /// The name of the blob actor. 8 | pub const BLOBS_ACTOR_NAME: &str = "blobs"; 9 | -------------------------------------------------------------------------------- /contracts/.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in the lib folder 2 | lib/ 3 | tools/ 4 | package.json 5 | package-lock.json 6 | out/ 7 | scripts/deploy-registry.ts 8 | scripts/deploy-gateway.ts 9 | .out/ 10 | artifacts/ 11 | cache/ 12 | cache_hardhat/ 13 | typechain/ 14 | .storage-layouts/ 15 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/scripts/growth-plot.plt: -------------------------------------------------------------------------------- 1 | set term png size 1200,800; 2 | set output fileout; 3 | set ylabel "KBytes"; 4 | set xlabel "Block Height"; 5 | #set key off; 6 | 7 | set title "RocksDB size growth"; 8 | plot filein using 1:2 with lines axis x1y1 title "DB Size" 9 | -------------------------------------------------------------------------------- /recall/kernel/ops/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "recall_kernel_ops" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [lib] 9 | crate-type = ["cdylib", "lib"] 10 | 11 | [dependencies] 12 | fvm = { workspace = true } 13 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/README.md: -------------------------------------------------------------------------------- 1 | # frc42_dispatch 2 | 3 | Helper library to work with [FRC-0042](https://github.com/filecoin-project/FIPs/blob/master/FRCs/frc-0042.md) method hashing 4 | 5 | There's an example of it in use [here](https://github.com/helix-onchain/filecoin/tree/main/dispatch_examples/greeter) -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/bucket.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | // Note: See this thread about choosing the ids https://filecoinproject.slack.com/archives/C04JR5R1UL8/p1706638112395409 5 | define_code!(BUCKET { code_id: 68 }); 6 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/timehub.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | // Note: See this thread about choosing the ids https://filecoinproject.slack.com/archives/C04JR5R1UL8/p1706638112395409 5 | define_code!(TIMEHUB { code_id: 69 }); 6 | -------------------------------------------------------------------------------- /demos/axelar-token/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = "contracts" 3 | out = "out" 4 | libs = ["node_modules", "lib"] 5 | fs_permissions = [{ access = "read-write", path = "./out"}] 6 | remappings = [ 7 | "@consensus-shipyard/=node_modules/@consensus-shipyard/" 8 | ] 9 | allow_paths = ["../../contracts"] -------------------------------------------------------------------------------- /fendermint/tracing/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_tracing" 3 | description = "Abstractions for emitting traces" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | 10 | [dependencies] 11 | tracing = { workspace = true } 12 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/shared/src/accounts.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | mod account; 6 | mod params; 7 | mod status; 8 | 9 | pub use account::*; 10 | pub use params::*; 11 | pub use status::*; 12 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/QueryBlockhash.abi: -------------------------------------------------------------------------------- 1 | [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getBlockhash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /fendermint/actors/blobs/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | mod actor; 6 | mod caller; 7 | mod shared; 8 | mod sol_facade; 9 | mod state; 10 | #[cfg(test)] 11 | mod testing; 12 | 13 | pub use shared::*; 14 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/QueryBlockhash.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.19; 3 | 4 | contract QueryBlockhash { 5 | constructor() {} 6 | 7 | function getBlockhash(uint blockNumber) public view returns (bytes32) { 8 | return blockhash(blockNumber); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@consensus-shipyard/ipc-workspace", 3 | "private": true, 4 | "packageManager": "pnpm@9.3.0", 5 | "pnpm": { 6 | "overrides": { 7 | "axios@>=0.8.1 <0.28.0": ">=0.28.0", 8 | "ws": ">=8.17.1", 9 | "axios@>=1.3.2 <=1.7.3": ">=1.7.4" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/tests/naming/empty-name-string.stderr: -------------------------------------------------------------------------------- 1 | error: proc macro panicked 2 | --> tests/naming/empty-name-string.rs:5:18 3 | | 4 | 5 | let _str_hash = method_hash!(""); 5 | | ^^^^^^^^^^^^^^^^ 6 | | 7 | = help: message: called `Result::unwrap()` on an `Err` value: EmptyString 8 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/src/sol_facade/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use recall_actor_sdk::declare_abi_call; 6 | 7 | declare_abi_call!(); 8 | 9 | pub mod blobs; 10 | pub mod credit; 11 | pub mod gas; 12 | -------------------------------------------------------------------------------- /contracts/contracts/interfaces/ISubnetActor.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import {Asset} from "../structs/Subnet.sol"; 5 | 6 | /// @title Subnet actor interface 7 | interface ISubnetActor { 8 | function supplySource() external view returns (Asset memory); 9 | } 10 | -------------------------------------------------------------------------------- /fendermint/testing/scripts/get_port.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | get_open_port() { 6 | local PORT=$1 7 | while lsof -i :"$PORT" >/dev/null 2>&1 || netstat -tuln | grep ":$PORT " >/dev/null 2>&1; do 8 | PORT=$((PORT+1)) 9 | done 10 | echo "$PORT" 11 | } 12 | 13 | get_open_port "$1" 14 | -------------------------------------------------------------------------------- /fendermint/docker/docker-entry.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script should be used as ENTRYPOINT for fendermint docker image. 4 | 5 | CMD=$1 6 | 7 | if [[ $CMD == 'ipc-cli' ]]; then 8 | ipc-cli "${@:2}" 9 | else 10 | if (( $# == 0)); then 11 | exec fendermint 12 | else 13 | exec fendermint "$@" 14 | fi 15 | fi 16 | -------------------------------------------------------------------------------- /recall/kernel/ops/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use fvm::kernel::prelude::Cid; 6 | use fvm::kernel::Result; 7 | 8 | pub trait RecallOps { 9 | fn block_add(&mut self, cid: Cid, data: &[u8]) -> Result<()>; 10 | } 11 | -------------------------------------------------------------------------------- /demos/axelar-token/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiler files 2 | cache/ 3 | out/ 4 | 5 | # Ignores development broadcast logs 6 | /broadcast 7 | 8 | # Docs 9 | docs/ 10 | 11 | # Libraries (installed via make deps) 12 | lib/ 13 | 14 | # Dotenv file 15 | .env 16 | 17 | ## Licenses are picked up from the root when packing the npm package. 18 | LICENSE-* -------------------------------------------------------------------------------- /contracts/tasks/index.ts: -------------------------------------------------------------------------------- 1 | // Create index.ts file to export all tasks 2 | import './deploy-libraries' 3 | import './deploy-gateway' 4 | import './deploy-registry' 5 | import './deploy' 6 | import './upgrade' 7 | import './validator-gater' 8 | import './validator-rewarder' 9 | import './gen-selector-library' 10 | import './cross-network-messenger' 11 | -------------------------------------------------------------------------------- /fendermint/rocksdb/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | mod rocks; 4 | 5 | #[cfg(feature = "blockstore")] 6 | pub mod blockstore; 7 | #[cfg(feature = "kvstore")] 8 | mod kvstore; 9 | 10 | pub mod namespaces; 11 | 12 | pub use rocks::{Error as RocksDbError, RocksDb, RocksDbConfig}; 13 | -------------------------------------------------------------------------------- /demos/linked-token/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiler files 2 | cache/ 3 | out/ 4 | 5 | # Ignores development broadcast logs 6 | !/broadcast 7 | /broadcast/*/31337/ 8 | /broadcast/**/dry-run/ 9 | 10 | # Docs 11 | docs/ 12 | 13 | # Dotenv file 14 | .env 15 | 16 | config.json 17 | 18 | ## Licenses are picked up from the root when packing the npm package. 19 | LICENSE-* -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/tests/naming/illegal-chars.stderr: -------------------------------------------------------------------------------- 1 | error: proc macro panicked 2 | --> tests/naming/illegal-chars.rs:5:18 3 | | 4 | 5 | let _str_hash = method_hash!("Bad!Method!Name!"); 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | | 7 | = help: message: called `Result::unwrap()` on an `Err` value: IllegalName(IllegalCharacters) 8 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/tests/naming/non-capital-start.stderr: -------------------------------------------------------------------------------- 1 | error: proc macro panicked 2 | --> tests/naming/non-capital-start.rs:5:18 3 | | 4 | 5 | let _str_hash = method_hash!("noPlaceForCamelCase"); 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | | 7 | = help: message: called `Result::unwrap()` on an `Err` value: IllegalName(NotValidStart) 8 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/scripts/stats.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | cat $1 | jq --slurp ' 6 | .[0] as $first 7 | | .[-1] as $last 8 | | { block_height: $last.block_height, 9 | db_size_kb: $last.db_size_kb, 10 | avg_growth_kb: (($last.db_size_kb - $first.db_size_kb) / ($last.block_height - $first.block_height)) 11 | }' 12 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/fvm/message.cbor: -------------------------------------------------------------------------------- 1 | 8a1b24844a7aef1004c65502f7b0ff51288c0945255b00ffa66ff6723e48ecda583103359bb4ee1b7cd40044aaff30d100f740e4c7474da12fe7124cc0b4ff419974a6e2092396661ba9ff012cabff43fb2d5f1ba7b1c24da436c8f35100c1246f2f3efc1c01de9e92e1acc918901bffffffffffffffff5100a9646cc279a4311c4314f16082af63a55100ffffffffffffffffa64a58e63f3302231b2dab25a8c5befc3943716269 -------------------------------------------------------------------------------- /contracts/ops/commit-rust-binding.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | set -o pipefail 4 | 5 | # checks and commit changes in rust binding 6 | if [[ `git status ./binding --porcelain` ]]; then 7 | echo "********** NOT ALL RUST BINDINGS COMMITTED, AUTO PUSH **********\n"; 8 | git add ./binding 9 | git commit -m "GEN: commit rust binding" 10 | git push 11 | fi; 12 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/reward.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | // The reward actor is a singleton, but for now let's just use a 5 | // simple account, instead of the one in the built-in actors library, 6 | // because that has too many Filecoin mainnet specific things. 7 | 8 | define_id!(REWARD { id: 2 }); 9 | -------------------------------------------------------------------------------- /fendermint/vm/interpreter/golden/fvmstateparams/json/fvmstateparams.txt: -------------------------------------------------------------------------------- 1 | FvmStateParams { state_root: Cid(bafrcsarb5a), timestamp: Timestamp(464351210397053192), network_version: NetworkVersion(21), base_fee: TokenAmount(278529018090234937453.573838123846074366), circ_supply: TokenAmount(219376640221550827920.910316078780626583), chain_id: 4350233659076787, power_scale: -1, app_version: 1 } -------------------------------------------------------------------------------- /contracts/tasks/lib/selectors.ts: -------------------------------------------------------------------------------- 1 | import {Interface} from "ethers/lib/utils"; 2 | 3 | interface ContractLike { 4 | interface: Interface; 5 | } 6 | 7 | export function selectors(contract: ContractLike) { 8 | return Object.keys(contract.interface.functions) 9 | .filter((sig) => sig !== 'init(bytes)') 10 | .map((sig) => contract.interface.getSighash(sig)) 11 | } -------------------------------------------------------------------------------- /demos/linked-token/test/LinkedTokenReplicaV2Extension.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.23; 3 | 4 | import {LinkedTokenReplicaV2} from "../contracts/v2/LinkedTokenReplicaV2.sol"; 5 | 6 | contract LinkedTokenReplicaV2Extension is LinkedTokenReplicaV2 { 7 | function newFunctionReturns8() public returns (uint256) { 8 | return 8; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/tests/naming/missing-name.stderr: -------------------------------------------------------------------------------- 1 | error: unexpected end of input, expected string literal 2 | --> tests/naming/missing-name.rs:5:23 3 | | 4 | 5 | let _ident_hash = method_hash!(); 5 | | ^^^^^^^^^^^^^^ 6 | | 7 | = note: this error originates in the macro `method_hash` (in Nightly builds, run with -Z macro-backtrace for more info) 8 | -------------------------------------------------------------------------------- /fendermint/vm/interpreter/golden/fvmstateparams/json/fvmstateparams.json: -------------------------------------------------------------------------------- 1 | { 2 | "state_root": "bafrcsarb5a", 3 | "timestamp": 464351210397053192, 4 | "network_version": 21, 5 | "base_fee": "278529018090234937453573838123846074366", 6 | "circ_supply": "219376640221550827920910316078780626583", 7 | "chain_id": 4350233659076787, 8 | "power_scale": -1, 9 | "app_version": 1 10 | } -------------------------------------------------------------------------------- /demos/linked-token/test/LinkedTokenControllerV2Extension.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.23; 3 | 4 | import {LinkedTokenControllerV2} from "../contracts/v2/LinkedTokenControllerV2.sol"; 5 | 6 | contract LinkedTokenControllerV2Extension is LinkedTokenControllerV2 { 7 | function newFunctionReturns7() public returns (uint256) { 8 | return 7; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /fendermint/vm/interpreter/golden/fvmstateparams/cbor/fvmstateparams.txt: -------------------------------------------------------------------------------- 1 | FvmStateParams { state_root: Cid(bahb37ximqjnav23rpqw34wus566pm), timestamp: Timestamp(3469043008308547194), network_version: NetworkVersion(21), base_fee: TokenAmount(103500617001559955113.404039395143211711), circ_supply: TokenAmount(257358427881990211741.496905449432533781), chain_id: 136071763155560, power_scale: 3, app_version: 0 } -------------------------------------------------------------------------------- /recall/ipld/src/hamt.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // Copyright 2019-2022 ChainSafe Systems 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | 6 | mod core; 7 | pub mod map; 8 | 9 | pub use core::Map; 10 | pub use core::MapKey; 11 | pub use core::DEFAULT_HAMT_CONFIG; 12 | pub use fvm_ipld_hamt::{BytesKey, Error}; 13 | pub use map::Root; 14 | -------------------------------------------------------------------------------- /contracts/ops/README.md: -------------------------------------------------------------------------------- 1 | # IPC deployment operations 2 | 3 | This directory includes a set of scripts to ease the deployment of the IPC Solidity contracts to any network using hardhat. 4 | 5 | - `deploy.sh`: Deploys the IPC solidity contracts into a specific network. 6 | - `compile-abi.sh`: Compiles all contracts and outputs the ABI for the high-level contracts in the desired folder (by default `./out`). 7 | -------------------------------------------------------------------------------- /fendermint/vm/interpreter/golden/fvmstateparams/cbor/fvmstateparams.cbor: -------------------------------------------------------------------------------- 1 | a86a73746174655f726f6f74d82a530001c3bfdd0c825a0aeb717c2dbe5a92efbcf66974696d657374616d701b3024843c7cc88e7a6f6e6574776f726b5f76657273696f6e1568626173655f66656551004ddd7e66b356ac97f26d89ce87ca5abf6b636972635f737570706c795100c19d6e2629f4dc2ff02f124d68b5cb1568636861696e5f69641b00007bc1ad1b5a686b706f7765725f7363616c65036b6170705f76657273696f6e00 -------------------------------------------------------------------------------- /fendermint/rocksdb/src/rocks/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // Copyright 2019-2022 ChainSafe Systems 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use thiserror::Error; 6 | 7 | /// Database error 8 | #[derive(Debug, Error)] 9 | pub enum Error { 10 | #[error(transparent)] 11 | Database(#[from] rocksdb::Error), 12 | #[error("{0}")] 13 | Other(String), 14 | } 15 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/scripts/growth-plot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | OUT=$1 6 | IN=$2 7 | 8 | DAT=$IN.dat 9 | PLT=$(dirname $0)/$(basename $0 .sh).plt 10 | 11 | rm -f $DAT 12 | 13 | cat $IN \ 14 | | jq -r "[.block_height, .db_size_kb] | @tsv" \ 15 | >> $DAT 16 | 17 | gnuplot \ 18 | -e "filein='$DAT'" \ 19 | -e "fileout='$OUT'" \ 20 | $PLT 21 | 22 | rm $DAT 23 | -------------------------------------------------------------------------------- /fendermint/testing/snapshot-test/scripts/node-2.env: -------------------------------------------------------------------------------- 1 | SEED_NODE_NAME=node-0 2 | SEED_CMT_CONTAINER_NAME=snapshot-cometbft 3 | NODE_NAME=node-2 4 | ENV_FILE=${TEST_DATA_DIR}/${NODE_NAME}/.env 5 | FM_CONTAINER_NAME=snapshot-fendermint-2 6 | CMT_CONTAINER_NAME=snapshot-cometbft-2 7 | CMT_DIR=${TEST_DATA_DIR}/${NODE_NAME}/cometbft 8 | CMT_P2P_HOST_PORT=26256 9 | CMT_RPC_HOST_PORT=26257 10 | CMT_WAIT_MILLIS=20000 11 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/hasher/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/filecoin-project/actors-utils with assumed MIT license 5 | // as per Cargo.toml: https://github.com/filecoin-project/actors-utils/blob/7628cd8d39dafcc6035f28e350cdb0cccbea5ab4/frc42_dispatch/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | pub mod hash; 9 | -------------------------------------------------------------------------------- /fendermint/vm/event/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_vm_event" 3 | description = "Defines the event type emitted in fendermint" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | strum = { workspace = true } 13 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/chain/signed.cbor: -------------------------------------------------------------------------------- 1 | a1665369676e6564836346766d8a1b727c18b337ff72cc58310345f3839a5d8321ae104dd6ac67e773a9ecbec2ae0d30eadf406dacbc108666ecd6892e9f6f2b96aeb1113717c54500ff581a04b1c0b5d0cbdba6a8393ac544801e004308ff063dec81a9c8d61b894b986f45bab82c51000e50229c083f1f80fac386d65091b3c11bc864bb5690b07a9d4900ad041ae91e82075c51006b3f2164a8c4b74b46816e2e37da33721bd4013ba7ef3180ce49c207816529fc3600c94401740a49 -------------------------------------------------------------------------------- /ipc/provider/src/manager/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | pub use crate::lotus::message::ipc::SubnetInfo; 4 | pub use evm::{EthManager, EthSubnetManager}; 5 | pub use subnet::{ 6 | BottomUpCheckpointRelayer, GetBlockHashResult, SubnetGenesisInfo, SubnetManager, 7 | TopDownFinalityQuery, TopDownQueryPayload, 8 | }; 9 | 10 | pub mod evm; 11 | mod subnet; 12 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/query/response/actor_state.txt: -------------------------------------------------------------------------------- 1 | ActorState { code: Cid(baeswcp6etwxgcb4a5o5piz3af3qj7ju7mce5tu7azgxm7j2dp2w5g33sui65ebiaq6jjaf6t6amjvbn3jrrc4g2aca35nuylu2c2usshuaaq), state: Cid(baeilp36otpxpxvedcavy5vud5ufx4fbjmccxyqporedzcvq52r7rpxk4naddcamyi2f4wdgkel4u3jcfeekkg4ct), sequence: 10469392735219420655, balance: TokenAmount(0.0), delegated_address: Some(Address("f23gn33d77vo476xlnwecaijagq4anwjf7cigctda")) } -------------------------------------------------------------------------------- /fendermint/testing/snapshot-test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_snapshot_test" 3 | description = "End-to-end integration testing multiple nodes exercising snapshots and state sync" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/account.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | use fvm_ipld_encoding::tuple::*; 4 | use fvm_shared::address::Address; 5 | 6 | define_code!(ACCOUNT { code_id: 4 }); 7 | 8 | /// State includes the address for the actor 9 | #[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone)] 10 | pub struct State { 11 | pub address: Address, 12 | } 13 | -------------------------------------------------------------------------------- /ipc/observability/src/serde.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use hex; 5 | use std::fmt; 6 | 7 | /// Hex encodable block hash. 8 | pub struct HexEncodableBlockHash(pub Vec); 9 | 10 | impl fmt::Debug for HexEncodableBlockHash { 11 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 12 | write!(f, "{}", hex::encode(&self.0)) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /fendermint/testing/smoke-test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_smoke_test" 3 | description = "Provides some end-to-end integration testing between Fendermint and a full Tendermint node." 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | -------------------------------------------------------------------------------- /fendermint/testing/snapshot-test/scripts/node-1.env: -------------------------------------------------------------------------------- 1 | SEED_NODE_NAME=node-0 2 | SEED_CMT_CONTAINER_NAME=snapshot-cometbft 3 | NODE_NAME=node-1 4 | ENV_FILE=${TEST_DATA_DIR}/${NODE_NAME}/.env 5 | FM_CONTAINER_NAME=snapshot-fendermint-1 6 | CMT_CONTAINER_NAME=snapshot-cometbft-1 7 | CMT_DIR=${TEST_DATA_DIR}/${NODE_NAME}/cometbft 8 | CMT_P2P_HOST_PORT=26156 9 | CMT_RPC_HOST_PORT=26157 10 | CMT_WAIT_MILLIS=20000 11 | IROH_WAIT_MILLIS=5000 12 | -------------------------------------------------------------------------------- /fendermint/testing/snapshot-test/scripts/node-3.env: -------------------------------------------------------------------------------- 1 | SEED_NODE_NAME=node-1 2 | SEED_CMT_CONTAINER_NAME=snapshot-cometbft-1 3 | NODE_NAME=node-3 4 | ENV_FILE=${TEST_DATA_DIR}/${NODE_NAME}/.env 5 | FM_CONTAINER_NAME=snapshot-fendermint-3 6 | CMT_CONTAINER_NAME=snapshot-cometbft-3 7 | CMT_DIR=${TEST_DATA_DIR}/${NODE_NAME}/cometbft 8 | CMT_P2P_HOST_PORT=26356 9 | CMT_RPC_HOST_PORT=26357 10 | CMT_WAIT_MILLIS=20000 11 | IROH_WAIT_MILLIS=5000 12 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/placeholder.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | //! Placeholders can be used for delegated address types. 4 | //! The FVM automatically creates one if the recipient of a transaction 5 | //! doesn't exist. Then, the executor replaces the code later based on 6 | //! the namespace in the delegated address. 7 | 8 | define_code!(PLACEHOLDER { code_id: 13 }); 9 | -------------------------------------------------------------------------------- /fendermint/testing/smoke-test/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | //! Run some tests against a pair of Fendermint and Tendermint docker containers running locally. 4 | //! 5 | //! Example: 6 | //! 7 | //! ```text 8 | //! cd fendermint/testing/smoke-test 9 | //! cargo make 10 | //! ``` 11 | //! 12 | //! Make sure you installed cargo-make by running `cargo install cargo-make` first. 13 | -------------------------------------------------------------------------------- /docs/fendermint/README.md: -------------------------------------------------------------------------------- 1 | ## Docs 2 | 3 | The following documentation should help getting oriented: 4 | 5 | * [Architecture Overview](./architecture.md) 6 | * [Getting started with Tendermint](./tendermint.md) 7 | * [Running Fendermint](./running.md) 8 | * [Checkpointing](./checkpointing.md) 9 | * [Running IPC infrastructure](./ipc.md) 10 | 11 | You can also check out the previous demos: 12 | * [Milestone-1 Demo](./demos/milestone-1/README.md) 13 | -------------------------------------------------------------------------------- /fendermint/testing/src/arb/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | mod address; 5 | mod cid; 6 | mod message; 7 | mod subnetid; 8 | mod token; 9 | 10 | pub use crate::arb::address::ArbAddress; 11 | pub use crate::arb::cid::ArbCid; 12 | pub use crate::arb::message::ArbMessage; 13 | pub use crate::arb::subnetid::{ArbSubnetAddress, ArbSubnetID}; 14 | pub use crate::arb::token::ArbTokenAmount; 15 | -------------------------------------------------------------------------------- /contracts/contracts/constants/Constants.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | address constant BURNT_FUNDS_ACTOR = address(99); 5 | bytes32 constant EMPTY_HASH = bytes32(""); 6 | bytes constant EMPTY_BYTES = bytes(""); 7 | bytes4 constant METHOD_SEND = bytes4(0); 8 | 9 | // The length of the public key that is associated with a validator. 10 | uint256 constant VALIDATOR_SECP256K1_PUBLIC_KEY_LENGTH = 65; 11 | -------------------------------------------------------------------------------- /ipc/wallet/src/fvm/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // Copyright 2019-2023 ChainSafe Systems 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | pub mod errors; 6 | pub mod keystore; 7 | mod serialization; 8 | pub mod utils; 9 | pub mod wallet; 10 | pub mod wallet_helpers; 11 | 12 | pub use errors::*; 13 | pub use keystore::*; 14 | pub use utils::*; 15 | pub use wallet::*; 16 | pub use wallet_helpers::*; 17 | -------------------------------------------------------------------------------- /contracts/contracts/OwnershipFacet.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.23; 3 | 4 | import {LibDiamond} from "./lib/LibDiamond.sol"; 5 | 6 | contract OwnershipFacet { 7 | function transferOwnership(address _newOwner) external { 8 | LibDiamond.transferOwnership(_newOwner); 9 | } 10 | 11 | function owner() external view returns (address owner_) { 12 | owner_ = LibDiamond.contractOwner(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /contracts/contracts/lib/AccountHelper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import {FilAddress} from "fevmate/contracts/utils/FilAddress.sol"; 5 | 6 | /// @title Helper library for checking account type 7 | /// @author LimeChain team 8 | library AccountHelper { 9 | function isSystemActor(address _address) external pure returns (bool) { 10 | return _address == FilAddress.SYSTEM_ACTOR; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /demos/linked-token/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = "contracts" 3 | out = "out" 4 | libs = ["node_modules", "lib"] 5 | fs_permissions = [{ access = "read-write", path = "./config.json"}] 6 | remappings = [ 7 | "@ipc/=node_modules/@consensus-shipyard/ipc-contracts/", 8 | ## this murky remapping is only needed transitively for testing; we should try to get rid of this. 9 | "murky/=node_modules/@consensus-shipyard/ipc-contracts/lib/murky/src/", 10 | ] -------------------------------------------------------------------------------- /fendermint/vm/message/golden/query/response/actor_state.cbor: -------------------------------------------------------------------------------- 1 | a564636f6465d82a5844000125613fc49dae610780ebbaf467602ee09fa69f6089d9d3e0c9aecfa7437eadd36f72a23dd2050087929017d3f0189a85bb4c622e1b401037d6d30ba685aa4a47a001657374617465d82a5838000110b7efce9beefbd483102b8ed683ed0b7e142960857c41ee890791561dd47f17dd5c6806310198468bcb0cca22f94da4452114a370536873657175656e63651b914ac13934cf0def6762616c616e6365407164656c6567617465645f616464726573735502d99bbd8fffabb9ff5d6db1040424068700db24bf -------------------------------------------------------------------------------- /fendermint/testing/materializer/tests/docker_tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | //! These test modules are all imported by the top level `docker.rs` module, 4 | //! so that they can be annotated with the `#[serial]` macro and run one by one, 5 | //! sharing their materializer state. 6 | 7 | // Tests using the manifest bearing their name. 8 | pub mod layer2; 9 | pub mod root_only; 10 | pub mod standalone; 11 | -------------------------------------------------------------------------------- /demos/linked-token/contracts/USDCTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.23; 3 | 4 | import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; 6 | 7 | contract USDCTest is ERC20, Ownable { 8 | constructor() ERC20("USDC", "USDC") Ownable(msg.sender) {} 9 | 10 | function mint(uint256 amount) public onlyOwner { 11 | _mint(msg.sender, amount); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /fendermint/crypto/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_crypto" 3 | description = "Cryptographic utilities" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | # Defined here so no other crate keeps a direct reference to it. 11 | libsecp256k1 = "0.7" 12 | 13 | anyhow = { workspace = true } 14 | base64 = { workspace = true } 15 | rand = { workspace = true } 16 | zeroize = { workspace = true } 17 | -------------------------------------------------------------------------------- /contracts/binding/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ipc_actors_abis" 3 | description = "Rust bindings for the IPC Solidity Actors" 4 | version = "0.1.0" 5 | authors = ["Protocol Labs"] 6 | edition = "2021" 7 | license = "MIT OR Apache-2.0" 8 | 9 | [dependencies] 10 | ethers = { workspace = true, features = ["abigen", "ws"] } 11 | fvm_shared = { workspace = true } 12 | anyhow = { workspace = true } 13 | 14 | [build-dependencies] 15 | ethers = { workspace = true, features = ["abigen", "ws"] } 16 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/src/state/blobs.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | mod blob; 6 | mod expiries; 7 | mod methods; 8 | mod params; 9 | mod queue; 10 | mod subscribers; 11 | mod subscriptions; 12 | #[cfg(test)] 13 | mod tests; 14 | 15 | pub use blob::*; 16 | pub use expiries::*; 17 | pub use params::*; 18 | pub use queue::*; 19 | pub use subscribers::*; 20 | pub use subscriptions::*; 21 | -------------------------------------------------------------------------------- /contracts/ops/check-rust-binding.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | set -o pipefail 4 | 5 | # checks if there are changes in rust binding 6 | if [[ `git status ./binding --porcelain` ]]; then 7 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 8 | echo "********** NOT ALL RUST BINDINGS COMMITTED, COMMIT THEM **********\n"; 9 | git status ./binding --porcelain 10 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" 11 | exit 1; 12 | fi; -------------------------------------------------------------------------------- /fendermint/testing/contracts/SimpleCoin_storage.json: -------------------------------------------------------------------------------- 1 | {"storage":[{"astId":5,"contract":"contracts/SimpleCoin.sol:SimpleCoin","label":"balances","offset":0,"slot":"0","type":"t_mapping(t_address,t_uint256)"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_mapping(t_address,t_uint256)":{"encoding":"mapping","key":"t_address","label":"mapping(address => uint256)","numberOfBytes":"32","value":"t_uint256"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}} -------------------------------------------------------------------------------- /demos/linked-token/script/DeployUSDCTest.s.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.23; 3 | 4 | import "../contracts/USDCTest.sol"; 5 | import "./ConfigManager.sol"; 6 | 7 | contract DeployUSDCTest is ConfigManager { 8 | function run() external override { 9 | vm.startBroadcast(); 10 | 11 | USDCTest erc20Token = new USDCTest(); 12 | 13 | vm.stopBroadcast(); 14 | 15 | writeConfig("OriginalToken", vm.toString(address(erc20Token))); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ext/merkle-tree-rs/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Ikechukwu Ahiara Marvellous (@literallymarvellous) 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/literallymarvellous/merkle-tree-rs with assumed MIT license 5 | // as per Cargo.toml: https://github.com/literallymarvellous/merkle-tree-rs/blob/d4abd1ca716e65d05e577e2f22b69947bef5b843/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | #[allow(clippy::all)] 9 | pub mod core; 10 | pub mod format; 11 | pub mod standard; 12 | -------------------------------------------------------------------------------- /deployment/docker/anvil.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 2 | 3 | RUN set -x; \ 4 | arch=$(uname -m | sed -e s/aarch64/arm64/ -e s/x86_64/amd64/); \ 5 | apt update && apt install -y curl && \ 6 | curl -Lo /tmp/tt.tgz https://github.com/foundry-rs/foundry/releases/download/stable/foundry_stable_linux_${arch}.tar.gz && \ 7 | tar xvf /tmp/tt.tgz -C /usr/bin && \ 8 | rm /tmp/tt.tgz 9 | 10 | RUN mkdir -p /workdir 11 | WORKDIR /workdir 12 | 13 | ENTRYPOINT ["anvil", "--host", "0.0.0.0", "--state", "/workdir/state"] 14 | -------------------------------------------------------------------------------- /fendermint/testing/graph-test/README.md: -------------------------------------------------------------------------------- 1 | # Integration test with The Graph 2 | 3 | ## Run test 4 | ```bash 5 | cargo make setup # Start CometBFT, Fendermint and ETH API 6 | cargo make test # Run Graph integration test 7 | cargo make teardown 8 | ``` 9 | 10 | This test is derived from: https://docs.hedera.com/hedera/tutorials/smart-contracts/deploy-a-subgraph-using-the-graph-and-json-rpc 11 | 12 | Reference for docker setup for subgraph: https://github.com/graphprotocol/graph-node/blob/master/docker/README.md 13 | -------------------------------------------------------------------------------- /demos/linked-token/.env.template: -------------------------------------------------------------------------------- 1 | export PRIVATE_KEY= 2 | 3 | export AMOUNT=1000 4 | 5 | export ORIGIN_NET_RPC_URL=https://api.calibration.node.glif.io/rpc/v1 6 | export ORIGIN_NET_CHAIN_ID=314159 7 | export ORIGIN_NET_GATEWAY= 8 | 9 | export SUBNET_RPC_URL=http://0.0.0.0:8545 10 | export SUBNET_GATEWAY=0x77aa40b105843728088c0132e43fc44348881da8 11 | export SUBNET_ROUTE_IN_ETH_FORMAT= 12 | 13 | 14 | export REPLICA_TOKEN_NAME=OriginalTokenReplica 15 | export REPLICA_TOKEN_SYMBOL=OTR 16 | export REPLICA_TOKEN_DECIMALS=6 17 | -------------------------------------------------------------------------------- /deployment/docker/localnet.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker 2 | 3 | RUN apk add bash 4 | 5 | RUN mkdir -p /workdir 6 | WORKDIR /workdir 7 | 8 | COPY docker /workdir/docker 9 | COPY localnet-data /workdir/localnet-data 10 | RUN chown -R nobody:nobody /workdir 11 | ENV RECALL_NODE_USER=nobody 12 | RUN ls -la /workdir/localnet-data/anvil/ 13 | 14 | # This is needed to expose DIND endpoints correctly from inside the localnet container 15 | ENV LOCALNET_CLI_BIND_HOST=0.0.0.0 16 | 17 | ENTRYPOINT ["./docker/entrypoint-localnet.sh"] 18 | -------------------------------------------------------------------------------- /docs/ipc/diagrams/Makefile: -------------------------------------------------------------------------------- 1 | PUMLS = $(shell find . -type f -name "*.puml") 2 | PNGS = $(PUMLS:.puml=.png) 3 | PUML_VER=1.2023.2 4 | 5 | .PHONY: all 6 | all: diagrams 7 | 8 | .PHONY: diagrams 9 | diagrams: $(PNGS) 10 | 11 | plantuml.jar: 12 | wget -O $@ https://github.com/plantuml/plantuml/releases/download/v$(PUML_VER)/plantuml-$(PUML_VER).jar --no-check-certificate --quiet 13 | 14 | %.png: plantuml.jar %.puml 15 | @# Using pipelining to preserve file names. 16 | cat $*.puml | java -jar plantuml.jar -pipe > $*.png 17 | -------------------------------------------------------------------------------- /fendermint/vm/encoding/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_vm_encoding" 3 | description = "Utilities for encoding some of the primitive FVM types with serde" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | 10 | [dependencies] 11 | serde = { workspace = true } 12 | serde_with = { workspace = true } 13 | num-traits = { workspace = true } 14 | 15 | cid = { workspace = true } 16 | fvm_shared = { workspace = true } 17 | ipc-api = { workspace = true } 18 | -------------------------------------------------------------------------------- /ipld/resolver/docs/diagrams/Makefile: -------------------------------------------------------------------------------- 1 | PUMLS = $(shell find . -type f -name "*.puml") 2 | PNGS = $(PUMLS:.puml=.png) 3 | PUML_VER=1.2023.2 4 | 5 | .PHONY: all 6 | all: diagrams 7 | 8 | .PHONY: diagrams 9 | diagrams: $(PNGS) 10 | 11 | plantuml.jar: 12 | wget -O $@ https://github.com/plantuml/plantuml/releases/download/v$(PUML_VER)/plantuml-$(PUML_VER).jar --no-check-certificate --quiet 13 | 14 | %.png: plantuml.jar %.puml 15 | @# Using pipelining to preserve file names. 16 | cat $*.puml | java -jar plantuml.jar -pipe > $*.png 17 | -------------------------------------------------------------------------------- /recall/kernel/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "recall_kernel" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [lib] 9 | crate-type = ["cdylib", "lib"] 10 | 11 | [dependencies] 12 | ambassador = { workspace = true } 13 | anyhow = { workspace = true } 14 | fvm = { workspace = true } 15 | fvm_ipld_blockstore = { workspace = true } 16 | fvm_shared = { workspace = true } 17 | 18 | recall_kernel_ops = { path = "./ops" } 19 | recall_syscalls = { path = "../syscalls" } 20 | -------------------------------------------------------------------------------- /recall/syscalls/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "recall_syscalls" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [lib] 9 | crate-type = ["cdylib", "lib"] 10 | 11 | [dependencies] 12 | fvm = { workspace = true } 13 | fvm_shared = { workspace = true } 14 | iroh-blobs = { workspace = true } 15 | tokio = { workspace = true } 16 | tracing = { workspace = true } 17 | 18 | recall_kernel_ops = { path = "../kernel/ops" } 19 | iroh_manager = { path = "../iroh_manager" } 20 | -------------------------------------------------------------------------------- /fendermint/eth/api/README.md: -------------------------------------------------------------------------------- 1 | # Ethereum API Facade 2 | 3 | The `fendermint_eth_api` crate implements some of the [Ethereum JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc) methods. The up-to-date list of which methods are implemented can be gleaned from the [API registration](./src/apis/mod.rs). 4 | 5 | The API is tested for basic type lineup during the `make e2e` tests via the [ethers example](./examples/ethers.rs). 6 | 7 | The relevant specification is [FIP-55](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0055.md). -------------------------------------------------------------------------------- /contracts/ops/commit-abi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | set -o pipefail 4 | 5 | if [ $# -ne 1 ] 6 | then 7 | echo "Expected a single argument with the output directory for the compiled contracts" 8 | exit 1 9 | fi 10 | 11 | OUTPUT=$1 12 | 13 | # checks and commit changes in output artifacts 14 | if [[ `git status $OUTPUT --porcelain` ]]; then 15 | echo "********** NOT ALL ABI ARTIFACTS ARE COMMITTED, AUTO PUSH **********\n"; 16 | git add $OUTPUT 17 | git commit -m "GEN: commit ABI artifacts" 18 | git push 19 | fi; 20 | -------------------------------------------------------------------------------- /ext/libp2p-bitswap/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/consensus-shipyard/libp2p-bitswap with assumed MIT license 5 | // as per Cargo.toml: https://github.com/consensus-shipyard/libp2p-bitswap/blob/7dd9cececda3e4a8f6e14c200a4b457159d8db33/Cargo.toml#L7 6 | // 7 | // License headers added post-fork. 8 | fn main() { 9 | #[cfg(feature = "compat")] 10 | prost_build::compile_protos(&["src/compat/bitswap_pb.proto"], &["src/compat"]).unwrap(); 11 | } 12 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/fvm/message.txt: -------------------------------------------------------------------------------- 1 | Message { version: 2631309974148482246, from: Address("f3gwn3j3q3ptkaarfk74yncahxidsmor2nuex6oesmyc2p6qmzostoecjdsztbxkp7aewkx72d7mwv6hjpikdq"), to: Address("f266yp6ujirqeukjk3ad72m37woi7er3g2x6z2pby"), sequence: 12083652913935075571, value: TokenAmount(256730180964078512947.118751200859199632), method_num: 3290765359526640697, params: RawBytes { 716269 }, gas_limit: 18446744073709551615, gas_fee_cap: TokenAmount(225160966881651169371.383523144685806501), gas_premium: TokenAmount(340282366920938463456.910350862557315619) } -------------------------------------------------------------------------------- /docs/fendermint/diagrams/Makefile: -------------------------------------------------------------------------------- 1 | PUMLS = $(shell find . -type f -name "*.puml") 2 | PNGS = $(PUMLS:.puml=.png) 3 | PUML_VER=1.2023.2 4 | 5 | .PHONY: all 6 | all: diagrams 7 | 8 | .PHONY: diagrams 9 | diagrams: $(PNGS) 10 | 11 | plantuml.jar: 12 | wget -O $@ https://github.com/plantuml/plantuml/releases/download/v$(PUML_VER)/plantuml-$(PUML_VER).jar --no-check-certificate --quiet 13 | 14 | %.png: plantuml.jar %.puml 15 | @# Using pipelining to preserve file names. 16 | cat $*.puml | java -DPLANTUML_LIMIT_SIZE=8192 -jar plantuml.jar -pipe > $*.png 17 | -------------------------------------------------------------------------------- /fendermint/eth/hardhat/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_eth_hardhat" 3 | description = "Utilities to deal with Hardhat build artifacts" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | anyhow = { workspace = true } 13 | ethers-core = { workspace = true } 14 | hex = { workspace = true } 15 | serde = { workspace = true } 16 | serde_json = { workspace = true } 17 | -------------------------------------------------------------------------------- /recall/ipld/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // Copyright 2019-2022 ChainSafe Systems 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | 6 | #[cfg(feature = "fil-actor")] 7 | use crate::hash_algorithm::FvmHashSha256; 8 | #[cfg(not(feature = "fil-actor"))] 9 | use fvm_ipld_hamt::Sha256; 10 | 11 | pub mod amt; 12 | pub mod hamt; 13 | mod hash_algorithm; 14 | 15 | #[cfg(feature = "fil-actor")] 16 | type Hasher = FvmHashSha256; 17 | 18 | #[cfg(not(feature = "fil-actor"))] 19 | type Hasher = Sha256; 20 | -------------------------------------------------------------------------------- /.github/workflows/license.yaml: -------------------------------------------------------------------------------- 1 | name: Check licenses 2 | 3 | # This workflow is triggered from the main CI workflow. 4 | on: 5 | workflow_call: 6 | 7 | jobs: 8 | license: 9 | name: License checks 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Check out the project 13 | uses: actions/checkout@v4 14 | 15 | # This is so `make license` doesn't say "bad revision origin/main" 16 | - name: Fetch origin for diff 17 | run: git fetch origin 18 | 19 | - name: Check license headers 20 | run: make license 21 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/tests/naming/empty-name-string.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/filecoin-project/actors-utils with assumed MIT license 5 | // as per Cargo.toml: https://github.com/filecoin-project/actors-utils/blob/7628cd8d39dafcc6035f28e350cdb0cccbea5ab4/frc42_dispatch/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | use frc42_macros::method_hash; 9 | 10 | fn main() { 11 | // this should panic due to empty string 12 | let _str_hash = method_hash!(""); 13 | } 14 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/shared/src/credit.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use fvm_shared::econ::TokenAmount; 6 | 7 | mod allowance; 8 | mod approval; 9 | mod params; 10 | mod token_rate; 11 | 12 | pub use allowance::*; 13 | pub use approval::*; 14 | pub use params::*; 15 | pub use token_rate::*; 16 | 17 | /// Credit is counted the same way as tokens. 18 | /// The smallest indivisible unit is 1 atto, and 1 credit = 1e18 atto credits. 19 | pub type Credit = TokenAmount; 20 | -------------------------------------------------------------------------------- /fendermint/app/src/cmd/config.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use fendermint_app_options::config::ConfigArgs; 5 | 6 | use crate::{cmd, settings::Settings}; 7 | 8 | cmd! { 9 | ConfigArgs(self, settings) { 10 | print_settings(settings) 11 | } 12 | } 13 | 14 | fn print_settings(settings: Settings) -> anyhow::Result<()> { 15 | // Currently the `Settings` doesn't support `Serialize`, 16 | // but if it did we could choose a format to print in. 17 | println!("{settings:?}"); 18 | Ok(()) 19 | } 20 | -------------------------------------------------------------------------------- /fendermint/vm/snapshot/golden/manifest/cbor/manifest.txt: -------------------------------------------------------------------------------- 1 | SnapshotManifest { block_height: 1055003531, size: 6246768546451722534, chunks: 71921915, checksum: Hash::Sha256(AB2911000701A616502523EEBB2BE0A1592D943393C918BCD99EF2514C391E79), state_params: FvmStateParams { state_root: Cid(QmTqSjEYd91M9ibVL1XqPALCsFsbj1wsmcbQv1EogUeLSw), timestamp: Timestamp(6008470596095378007), network_version: NetworkVersion(4294967295), base_fee: TokenAmount(0.0), circ_supply: TokenAmount(70637057994666379185.715622006925685645), chain_id: 1458256522975223, power_scale: 0, app_version: 0 }, version: 1808381970 } -------------------------------------------------------------------------------- /ipc/cli/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | 4 | use tracing_subscriber::prelude::*; 5 | use tracing_subscriber::{fmt, EnvFilter}; 6 | 7 | #[tokio::main] 8 | async fn main() { 9 | tracing_subscriber::registry() 10 | .with(fmt::layer()) 11 | .with(EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"))) 12 | .init(); 13 | 14 | if let Err(e) = ipc_cli::cli().await { 15 | log::error!("main process failed: {e:#}"); 16 | std::process::exit(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/Greeter.abi: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"string","name":"_greeting","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"greeting","type":"string"}],"name":"GreetingSet","type":"event"},{"inputs":[],"name":"greet","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_greeting","type":"string"}],"name":"setGreeting","outputs":[],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /ipc/observability/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ipc-observability" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license-file.workspace = true 7 | 8 | [dependencies] 9 | lazy_static = { workspace = true } 10 | prometheus = { workspace = true } 11 | tracing = { workspace = true } 12 | tracing-subscriber = { workspace = true } 13 | tracing-appender = { workspace = true } 14 | hex = { workspace = true } 15 | anyhow = { workspace = true } 16 | serde = { workspace = true } 17 | serde_with = { workspace = true } 18 | strum = { workspace = true } 19 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/tests/naming/missing-name.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/filecoin-project/actors-utils with assumed MIT license 5 | // as per Cargo.toml: https://github.com/filecoin-project/actors-utils/blob/7628cd8d39dafcc6035f28e350cdb0cccbea5ab4/frc42_dispatch/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | use frc42_macros::method_hash; 9 | 10 | fn main() { 11 | // should panic because no string or identifier provided 12 | let _ident_hash = method_hash!(); 13 | } 14 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/filecoin-project/actors-utils with assumed MIT license 5 | // as per Cargo.toml: https://github.com/filecoin-project/actors-utils/blob/7628cd8d39dafcc6035f28e350cdb0cccbea5ab4/frc42_dispatch/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | pub use frc42_hasher as hasher; 9 | pub use frc42_hasher::hash; 10 | pub use frc42_macros::method_hash; 11 | 12 | pub mod match_method; 13 | pub mod message; 14 | 15 | #[cfg(test)] 16 | mod tests {} 17 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/QueryBlockhash.bin-runtime: -------------------------------------------------------------------------------- 1 | 6080604052348015600e575f80fd5b50600436106026575f3560e01c8063e9413d3814602a575b5f80fd5b60406004803603810190603c91906090565b6054565b604051604b919060cc565b60405180910390f35b5f81409050919050565b5f80fd5b5f819050919050565b6072816062565b8114607b575f80fd5b50565b5f81359050608a81606b565b92915050565b5f6020828403121560a25760a1605e565b5b5f60ad84828501607e565b91505092915050565b5f819050919050565b60c68160b6565b82525050565b5f60208201905060dd5f83018460bf565b9291505056fea264697066735822122043fe775d8f1bec1cffeb914065ede9b881dd38b7a55159e60976ec680888f4a464736f6c63430008170033 -------------------------------------------------------------------------------- /contracts/contracts/interfaces/IDiamond.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | interface IDiamond { 5 | // Add=0, Replace=1, Remove=2 6 | enum FacetCutAction { 7 | Add, 8 | Replace, 9 | Remove 10 | } 11 | 12 | struct FacetCut { 13 | address facetAddress; 14 | FacetCutAction action; 15 | bytes4[] functionSelectors; 16 | } 17 | // The DiamondCut event records all function changes to a diamond. 18 | event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); 19 | } 20 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/tests/naming/illegal-chars.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/filecoin-project/actors-utils with assumed MIT license 5 | // as per Cargo.toml: https://github.com/filecoin-project/actors-utils/blob/7628cd8d39dafcc6035f28e350cdb0cccbea5ab4/frc42_dispatch/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | use frc42_macros::method_hash; 9 | 10 | fn main() { 11 | // should panic because the name contains illegal chars 12 | let _str_hash = method_hash!("Bad!Method!Name!"); 13 | } 14 | -------------------------------------------------------------------------------- /fendermint/testing/materializer/tests/manifests/root-only.yaml: -------------------------------------------------------------------------------- 1 | accounts: 2 | alice: {} 3 | bob: {} 4 | charlie: {} 5 | rootnet: 6 | type: New 7 | validators: 8 | alice: '100' 9 | balances: 10 | alice: '1000000000000000000' 11 | bob: '2000000000000000000' 12 | charlie: '3000000000000000000' 13 | nodes: 14 | node-1: 15 | mode: 16 | type: Validator 17 | validator: alice 18 | ethapi: false 19 | seed_nodes: [] 20 | 21 | node-2: 22 | mode: 23 | type: Full 24 | ethapi: true 25 | seed_nodes: 26 | - node-1 27 | -------------------------------------------------------------------------------- /fendermint/vm/snapshot/golden/manifest/json/manifest.txt: -------------------------------------------------------------------------------- 1 | SnapshotManifest { block_height: 1514949179, size: 9449484793876511189, chunks: 1881682918, checksum: Hash::Sha256(FA02B44C12C7FE9C0EA20C01BABC5D648ED9E1D6C2E3AE429074FA4C58A757CF), state_params: FvmStateParams { state_root: Cid(QmRt9iwGtA1VPrcAYd57NHA6dw1GzUJdTSa2UFf7hD4fYE), timestamp: Timestamp(18027569400920354349), network_version: NetworkVersion(4294967295), base_fee: TokenAmount(172807186586029917247.083625690263418461), circ_supply: TokenAmount(67710964973056974958.929745942806112066), chain_id: 0, power_scale: 0, app_version: 0 }, version: 45625102 } -------------------------------------------------------------------------------- /ipc/provider/src/lotus/message/serialize.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | use fvm_shared::econ::TokenAmount; 4 | use ipc_api::subnet_id::SubnetID; 5 | use serde::Serializer; 6 | 7 | pub fn serialize_subnet_id_to_str(id: &SubnetID, s: S) -> Result 8 | where 9 | S: Serializer, 10 | { 11 | s.serialize_str(&id.to_string()) 12 | } 13 | 14 | pub fn serialize_token_amount_to_atto(amount: &TokenAmount, s: S) -> Result 15 | where 16 | S: Serializer, 17 | { 18 | s.serialize_str(&amount.atto().to_string()) 19 | } 20 | -------------------------------------------------------------------------------- /contracts/tools/check_coverage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | set -o pipefail 4 | 5 | coverages=$(sed -n '/^.*headerCovTableEntryLo">/p' ./coverage_report/index.html | sed -En 's/[^0-9]*([0-9]{1,3})[^0-9]*/\1 /gp' | sed 's/ [0-9]//g') 6 | 7 | measurements[0]="lines" 8 | measurements[1]="functions" 9 | measurements[2]="branches" 10 | 11 | threshold=30 12 | i=0 13 | 14 | for c in $coverages 15 | do 16 | if [ $c -lt $threshold ]; then 17 | echo "${measurements[i]} coverage is too low: $c"; 18 | exit 1; 19 | fi 20 | i=$((i+1)) 21 | done 22 | 23 | echo "coverage test passed"; 24 | exit 0 -------------------------------------------------------------------------------- /demos/linked-token/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier-plugin-solidity"], 3 | semi: false, 4 | singleQuote: true, 5 | printWidth: 80, 6 | endOfLine: 'auto', 7 | tabWidth: 4, 8 | trailingComma: 'all', 9 | overrides: [ 10 | { 11 | files: '*.sol', 12 | options: { 13 | parser: 'solidity-parse', 14 | printWidth: 120, 15 | tabWidth: 4, 16 | useTabs: false, 17 | singleQuote: false, 18 | bracketSpacing: false, 19 | }, 20 | }, 21 | ], 22 | } -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/tests/naming/non-capital-start.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/filecoin-project/actors-utils with assumed MIT license 5 | // as per Cargo.toml: https://github.com/filecoin-project/actors-utils/blob/7628cd8d39dafcc6035f28e350cdb0cccbea5ab4/frc42_dispatch/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | use frc42_macros::method_hash; 9 | 10 | fn main() { 11 | // should panic because the name starts with non-capital letter 12 | let _str_hash = method_hash!("noPlaceForCamelCase"); 13 | } 14 | -------------------------------------------------------------------------------- /fendermint/app/settings/src/objects.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use crate::{MetricsSettings, SocketAddress}; 6 | use ipc_observability::config::TracingSettings; 7 | use serde::Deserialize; 8 | use serde_with::serde_as; 9 | 10 | /// Object API facade settings. 11 | #[serde_as] 12 | #[derive(Debug, Deserialize, Clone)] 13 | pub struct ObjectsSettings { 14 | pub max_object_size: u64, 15 | pub listen: SocketAddress, 16 | pub tracing: TracingSettings, 17 | pub metrics: MetricsSettings, 18 | } 19 | -------------------------------------------------------------------------------- /recall/actor_sdk/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "recall_actor_sdk" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [lib] 9 | crate-type = ["cdylib", "lib"] 10 | 11 | [dependencies] 12 | fvm_shared = { workspace = true } 13 | fvm_sdk = { workspace = true } 14 | num-traits = { workspace = true } 15 | fil_actors_runtime = { workspace = true } 16 | recall_sol_facade = { workspace = true, features = [] } 17 | anyhow = { workspace = true } 18 | fvm_ipld_encoding = { workspace = true } 19 | serde = { workspace = true } 20 | cid = { workspace = true } 21 | -------------------------------------------------------------------------------- /contracts/contracts/interfaces/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.23; 3 | 4 | interface IERC165 { 5 | /// @notice Query if a contract implements an interface 6 | /// @param interfaceId The interface identifier, as specified in ERC-165 7 | /// @dev Interface identification is specified in ERC-165. This function 8 | /// uses less than 30,000 gas. 9 | /// @return `true` if the contract implements `interfaceID` and 10 | /// `interfaceID` is not 0xffffffff, `false` otherwise 11 | function supportsInterface(bytes4 interfaceId) external view returns (bool); 12 | } 13 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "frc42_macros" 3 | version = "6.0.0" 4 | license = "MIT OR Apache-2.0" 5 | description = "Filecoin FRC-0042 calling convention procedural macros" 6 | repository = "https://github.com/helix-onchain/filecoin/" 7 | edition = "2021" 8 | 9 | [lib] 10 | proc-macro = true 11 | 12 | [dependencies] 13 | blake2b_simd = { version = "1.0.0" } 14 | frc42_hasher = { version = "6.0.0", path = "../hasher", default-features = false } 15 | proc-macro2 = "1.0" 16 | quote = "1.0" 17 | syn = { version = "1.0", features = ["full"] } 18 | 19 | [dev-dependencies] 20 | trybuild = "1.0" 21 | -------------------------------------------------------------------------------- /contracts/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "printWidth": 120, 5 | "endOfLine": "auto", 6 | "tabWidth": 4, 7 | "trailingComma": "all", 8 | "plugins": ["prettier-plugin-solidity"], 9 | "overrides": [ 10 | { 11 | "files": "*.sol", 12 | "options": { 13 | "parser": "solidity-parse", 14 | "printWidth": 120, 15 | "tabWidth": 4, 16 | "useTabs": false, 17 | "singleQuote": false, 18 | "bracketSpacing": false 19 | } 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /fendermint/testing/src/arb/address.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | use fvm_shared::address::Address; 4 | use quickcheck::{Arbitrary, Gen}; 5 | 6 | /// Unfortunately an arbitrary `DelegatedAddress` can be inconsistent with bytes that do not correspond to its length. 7 | #[derive(Clone, Debug)] 8 | pub struct ArbAddress(pub Address); 9 | 10 | impl Arbitrary for ArbAddress { 11 | fn arbitrary(g: &mut Gen) -> Self { 12 | let addr = Address::arbitrary(g); 13 | let bz = addr.to_bytes(); 14 | Self(Address::from_bytes(&bz).unwrap()) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /contracts/sdk/interfaces/IIpcHandler.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import {IpcEnvelope, ResultMsg, CallMsg, IpcMsgKind} from "../../contracts/structs/CrossNet.sol"; 5 | 6 | // Interface that needs to be implemented by IPC-aware contracts. 7 | interface IIpcHandler { 8 | error CallerIsNotGateway(); 9 | error UnsupportedMsgKind(); 10 | error UnrecognizedResult(); 11 | 12 | /// @notice Entrypoint for handling xnet messages in IPC-aware contracts. 13 | function handleIpcMessage(IpcEnvelope calldata envelope) external payable returns (bytes memory ret); 14 | } 15 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/hasher/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "frc42_hasher" 3 | version = "6.0.0" 4 | license = "MIT OR Apache-2.0" 5 | description = "Filecoin FRC-0042 calling convention method hashing" 6 | repository = "https://github.com/helix-onchain/filecoin/" 7 | edition = "2021" 8 | 9 | [dependencies] 10 | fvm_sdk = { workspace = true, optional = true } 11 | fvm_shared = { workspace = true, optional = true } 12 | thiserror = { version = "1.0.31" } 13 | 14 | [features] 15 | # The fvm dependencies are optional. Useful for proc macro and similar purposes. 16 | default = ["use_sdk"] 17 | use_sdk = ["dep:fvm_sdk", "dep:fvm_shared"] 18 | -------------------------------------------------------------------------------- /demos/axelar-token/test/DummyERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import "@openzeppelin/contracts/access/Ownable.sol"; 6 | 7 | contract DummyERC20 is ERC20, Ownable { 8 | constructor( 9 | string memory _name, 10 | string memory _symbol, 11 | uint256 _initialSupply 12 | ) Ownable(msg.sender) ERC20(_name, _symbol) { 13 | _mint(owner(), _initialSupply); 14 | } 15 | 16 | function mint(address _to, uint256 _amount) public onlyOwner { 17 | _mint(_to, _amount); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/QueryBlockhash.bin: -------------------------------------------------------------------------------- 1 | 608060405234801561000f575f80fd5b506101198061001d5f395ff3fe6080604052348015600e575f80fd5b50600436106026575f3560e01c8063e9413d3814602a575b5f80fd5b60406004803603810190603c91906090565b6054565b604051604b919060cc565b60405180910390f35b5f81409050919050565b5f80fd5b5f819050919050565b6072816062565b8114607b575f80fd5b50565b5f81359050608a81606b565b92915050565b5f6020828403121560a25760a1605e565b5b5f60ad84828501607e565b91505092915050565b5f819050919050565b60c68160b6565b82525050565b5f60208201905060dd5f83018460bf565b9291505056fea264697066735822122043fe775d8f1bec1cffeb914065ede9b881dd38b7a55159e60976ec680888f4a464736f6c63430008170033 -------------------------------------------------------------------------------- /contracts/test/mocks/AssetHelperMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity ^0.8.23; 3 | 4 | import {Asset} from "../../contracts/structs/Subnet.sol"; 5 | import {AssetHelper} from "../../contracts/lib/AssetHelper.sol"; 6 | 7 | /// @notice Helpers to deal with a supply source. 8 | contract AssetHelperMock { 9 | function performCall( 10 | Asset memory supplySource, 11 | address payable target, 12 | bytes memory data, 13 | uint256 value 14 | ) public returns (bool success, bytes memory ret) { 15 | return AssetHelper.performCall(supplySource, target, data, value); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /demos/axelar-token/test/TestSender.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import "forge-std/Test.sol"; 5 | import "../contracts/IpcTokenSender.sol"; 6 | import "./DummyERC20.sol"; 7 | import { FvmAddressHelper } from "@consensus-shipyard/ipc-contracts/contracts/lib/FvmAddressHelper.sol"; 8 | 9 | contract TestSender is Test { 10 | using FvmAddressHelper for address; 11 | 12 | function test_sender_Ok() public { 13 | 14 | } 15 | 16 | // TODO test_sender_fails_transfer (fails to transfer the tokens to itself) 17 | 18 | // TODO test_sender_fails_axelar (the Axelar gateway reverts) 19 | 20 | } -------------------------------------------------------------------------------- /fendermint/actors/blobs/testing/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_actor_blobs_testing" 3 | description = "Test utils for blobs" 4 | license.workspace = true 5 | edition.workspace = true 6 | authors.workspace = true 7 | version = "0.1.0" 8 | 9 | [lib] 10 | ## lib is necessary for integration tests 11 | ## cdylib is necessary for Wasm build 12 | crate-type = ["cdylib", "lib"] 13 | 14 | [dependencies] 15 | fvm_shared = { workspace = true } 16 | iroh-blobs = { workspace = true } 17 | rand = { workspace = true } 18 | tracing-subscriber = { workspace = true, features = ["env-filter"] } 19 | 20 | fendermint_actor_blobs_shared = { path = "../shared" } 21 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/src/hash.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/filecoin-project/actors-utils with assumed MIT license 5 | // as per Cargo.toml: https://github.com/filecoin-project/actors-utils/blob/7628cd8d39dafcc6035f28e350cdb0cccbea5ab4/frc42_dispatch/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | use blake2b_simd::blake2b; 9 | use frc42_hasher::hash::Hasher; 10 | 11 | pub struct Blake2bHasher {} 12 | impl Hasher for Blake2bHasher { 13 | fn hash(&self, bytes: &[u8]) -> Vec { 14 | blake2b(bytes).as_bytes().to_vec() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /fendermint/vm/snapshot/golden/manifest/json/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "block_height": 1514949179, 3 | "size": 9449484793876511189, 4 | "chunks": 1881682918, 5 | "checksum": "FA02B44C12C7FE9C0EA20C01BABC5D648ED9E1D6C2E3AE429074FA4C58A757CF", 6 | "state_params": { 7 | "state_root": "QmRt9iwGtA1VPrcAYd57NHA6dw1GzUJdTSa2UFf7hD4fYE", 8 | "timestamp": 18027569400920354349, 9 | "network_version": 4294967295, 10 | "base_fee": "172807186586029917247083625690263418461", 11 | "circ_supply": "67710964973056974958929745942806112066", 12 | "chain_id": 0, 13 | "power_scale": 0, 14 | "app_version": 0 15 | }, 16 | "version": 45625102 17 | } -------------------------------------------------------------------------------- /recall/actor_sdk/src/storage.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2022-2024 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use fvm_shared::error::ErrorNumber; 6 | 7 | /// Deletes a blob by hash from backing storage. 8 | pub fn delete_blob(hash: [u8; 32]) -> Result<(), ErrorNumber> { 9 | unsafe { sys::delete_blob(hash.as_ptr()) } 10 | } 11 | 12 | mod sys { 13 | use fvm_sdk::sys::fvm_syscalls; 14 | 15 | fvm_syscalls! { 16 | module = "recall"; 17 | 18 | /// Deletes a blob by hash from backing storage. 19 | pub fn delete_blob(hash_ptr: *const u8) -> Result<()>; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /contracts/contracts/structs/FvmAddress.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | /* 5 | * @dev The corresponding implementation of Fil Address from FVM. 6 | * Currently it supports only f1 addresses. 7 | * See: https://github.com/filecoin-project/ref-fvm/blob/db8c0b12c801f364e87bda6f52d00c6bd0e1b878/shared/src/address/payload.rs#L87 8 | */ 9 | struct FvmAddress { 10 | uint8 addrType; 11 | bytes payload; 12 | } 13 | 14 | /* 15 | * @dev The delegated f4 address in Fil Address from FVM. 16 | */ 17 | struct DelegatedAddress { 18 | uint64 namespace; 19 | uint128 length; 20 | bytes buffer; 21 | } 22 | -------------------------------------------------------------------------------- /deployment/README.md: -------------------------------------------------------------------------------- 1 | # Localnet Scripts 2 | 3 | ## Install nushell 4 | If you do not have nushell installed, you can call `./set-up-nu.sh` that will download the required nushell version to `./.nu`. 5 | You can add `nu` to your `PATH` with `source ./.nu/activate.sh` 6 | 7 | ## Usage 8 | You can run the localnet in two ways: 9 | * `./localnet.nu run` - runs all localnet services on the local docker. See `./localnet.nu run -h` for details. 10 | * `./localnet.nu run-dind` - downloads the latest `textile/recall-localnet` docker image and runs all services inside a single container. This is faster than the previous option. 11 | 12 | See `./localnet.nu -h` for details. 13 | -------------------------------------------------------------------------------- /contracts/ops/compile-abi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Compile contract and output core contracts ABI 3 | set -eu 4 | set -o pipefail 5 | 6 | if [ $# -ne 1 ] 7 | then 8 | echo "Expected a single argument with the output directory for the compiled contracts" 9 | exit 1 10 | fi 11 | 12 | OUTPUT=$1 13 | 14 | echo -e "\033[0;36mRunning a recursive submodule update to ensure build reproducibility with CI. Local uncommitted submodule changes will be overridden.\033[0m" 15 | git submodule update --init --recursive 16 | echo "[*] Compiling contracts and output core contracts ABI in $OUTPUT" 17 | forge build -C ./src/ --lib-paths lib/ --via-ir --sizes --skip test --out=$OUTPUT 18 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/src/state/credit/params.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use fendermint_actor_blobs_shared::credit::Credit; 6 | use fvm_shared::{clock::ChainEpoch, econ::TokenAmount}; 7 | 8 | /// Params for committing capacity. 9 | #[derive(Debug)] 10 | pub struct CommitCapacityParams { 11 | /// Commitment size for caller. 12 | pub size: u64, 13 | /// Commitment cost. 14 | pub cost: Credit, 15 | /// Token amount available to commitment. 16 | pub value: TokenAmount, 17 | /// Commitment chain epoch. 18 | pub epoch: ChainEpoch, 19 | } 20 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/chain/signed.txt: -------------------------------------------------------------------------------- 1 | Signed(SignedMessage { origin_kind: Fvm, message: Message { version: 8249495775453606604, from: Address("f44129971131103666225fhlcujaa6abbqr7yghxwidkoi2yhvjmoq"), to: Address("f3ixzyhgs5qmq24ecn22wgpz3tvhwl5qvobuyovx2anwwlyeegm3wnncjot5xsxfvoweitof6fiuap75gpro5a"), sequence: 9893168610128082988, value: TokenAmount(19025277653743675990.786944316264788929), method_num: 15276557003476009166, params: RawBytes { c207816529fc3600c9 }, gas_limit: 14439872285725719197, gas_fee_cap: TokenAmount(12.46711925700991574), gas_premium: TokenAmount(142555187545638161165.145598869156541298) }, signature: Signature { sig_type: Secp256k1, bytes: [116, 10, 73] } }) -------------------------------------------------------------------------------- /fendermint/vm/snapshot/golden/manifest/cbor/manifest.cbor: -------------------------------------------------------------------------------- 1 | a66c626c6f636b5f6865696768741a3ee2138b6473697a651b56b0fae56d569126666368756e6b731a044970fb68636865636b73756d7840414232393131303030373031413631363530323532334545424232424530413135393244393433333933433931384243443939454632353134433339314537396c73746174655f706172616d73a86a73746174655f726f6f74d82a582300122051aabb4c8515246317f95342c4969e789de70fa94b0dc7456f5be73d963899646974696d657374616d701b5362602c43a502576f6e6574776f726b5f76657273696f6e1affffffff68626173655f666565406b636972635f737570706c795100352433d8306be04f824fc04cf465f38d68636861696e5f69641b00052e46ce0b17f76b706f7765725f7363616c65006b6170705f76657273696f6e006776657273696f6e1a6bc9b812 -------------------------------------------------------------------------------- /ipc/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # Build stage 4 | FROM rust:bookworm as builder 5 | 6 | RUN apt update && \ 7 | apt install -y build-essential libssl-dev mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang hwloc libhwloc-dev wget ca-certificates gnupg 8 | 9 | WORKDIR /app 10 | 11 | COPY . . 12 | 13 | RUN make build 14 | 15 | # Main stage 16 | FROM debian:bookworm-slim 17 | 18 | RUN apt update && \ 19 | apt install -y build-essential libssl-dev curl ca-certificates && \ 20 | rm -rf /var/lib/apt/lists/* 21 | 22 | COPY --from=builder /app/bin/ipc-cli /usr/local/bin/ipc-cli 23 | 24 | ENTRYPOINT ["/usr/local/bin/ipc-cli"] 25 | -------------------------------------------------------------------------------- /fendermint/abci/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_abci" 3 | description = "ABCI++ adapter using tendermint-rs and tower-abci" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | async-trait = { workspace = true } 11 | futures = { workspace = true } 12 | tower = "0.4" 13 | tracing = { workspace = true } 14 | 15 | tower-abci = { workspace = true } 16 | tendermint = { workspace = true } 17 | 18 | 19 | [dev-dependencies] 20 | async-stm = { workspace = true } 21 | im = { workspace = true } 22 | structopt = "0.3" 23 | tokio = { workspace = true } 24 | tracing-subscriber = { workspace = true } 25 | -------------------------------------------------------------------------------- /fendermint/testing/contract-test/tests/staking/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use arbitrary::{Arbitrary, Unstructured}; 5 | use fendermint_testing::arb::ArbTokenAmount; 6 | use fvm_shared::{bigint::Integer, econ::TokenAmount}; 7 | 8 | pub mod machine; 9 | pub mod state; 10 | 11 | fn choose_amount(u: &mut Unstructured<'_>, max: &TokenAmount) -> arbitrary::Result { 12 | if max.is_zero() { 13 | Ok(TokenAmount::from_atto(0)) 14 | } else { 15 | let tokens = ArbTokenAmount::arbitrary(u)?.0; 16 | Ok(TokenAmount::from_atto(tokens.atto().mod_floor(max.atto()))) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ext/merkle-tree-rs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "merkle-tree-rs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | license = "MIT" 6 | rust-version = "1.65.0" 7 | authors = ["Ahiara Ikechukwu Marvellous "] 8 | readme = "README.md" 9 | repository = "https://github.com/literallymarvellous/merkle-tree-rs" 10 | description = "A Rust library to generate merkle trees and merkle proofs." 11 | 12 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 13 | 14 | [dependencies] 15 | serde = "1.0.147" 16 | serde_json = "1.0" 17 | anyhow = "1.0" 18 | thiserror = "1.0.24" 19 | render-tree = "0.1.1" 20 | ethers = "2.0" 21 | -------------------------------------------------------------------------------- /contracts/test/helpers/ERC20Helper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import "@openzeppelin/contracts/access/Ownable.sol"; 6 | 7 | contract DummyERC20 is ERC20, Ownable { 8 | uint256 public currentSupply = 0; 9 | 10 | constructor( 11 | string memory _name, 12 | string memory _symbol, 13 | uint256 _initialSupply 14 | ) Ownable(msg.sender) ERC20(_name, _symbol) { 15 | _mint(owner(), _initialSupply); 16 | } 17 | 18 | function mint(address _to, uint256 _amount) public onlyOwner { 19 | _mint(_to, _amount); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /fendermint/vm/core/src/timestamp.rs: -------------------------------------------------------------------------------- 1 | use std::time::SystemTime; 2 | 3 | // Copyright 2022-2024 Protocol Labs 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | use serde::{Deserialize, Serialize}; 6 | 7 | /// Unix timestamp (in seconds). 8 | #[derive(Clone, Debug, Copy, Serialize, Deserialize, PartialEq, Eq)] 9 | pub struct Timestamp(pub u64); 10 | 11 | impl Timestamp { 12 | pub fn as_secs(&self) -> i64 { 13 | self.0 as i64 14 | } 15 | 16 | pub fn current() -> Self { 17 | let d = std::time::SystemTime::now() 18 | .duration_since(SystemTime::UNIX_EPOCH) 19 | .expect("duration since epoch"); 20 | Self(d.as_secs()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /contracts/.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | cache_hardhat/ 3 | crytic-export/ 4 | .vscode 5 | .idea 6 | .env 7 | broadcast/ 8 | out/ 9 | binding/src 10 | 11 | node_modules 12 | 13 | artifacts 14 | 15 | solidity-files-cache.json 16 | 17 | typechain 18 | 19 | # Deploment assets 20 | deployments/ 21 | deployments.json 22 | scripts/*.out 23 | scripts/deploy-registry.ts 24 | scripts/deploy-gateway.ts 25 | binding/target 26 | subnet.registry.json 27 | subnet.actor.json 28 | 29 | # Coverage tools assets 30 | coverage_report 31 | lcov.info 32 | 33 | # Aderyn scanner 34 | report.md 35 | report.json 36 | 37 | #vim 38 | *.un~ 39 | 40 | ## Licenses are picked up from the root when packing the npm package. 41 | LICENSE-* -------------------------------------------------------------------------------- /ext/libp2p-bitswap/src/compat/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/consensus-shipyard/libp2p-bitswap with assumed MIT license 5 | // as per Cargo.toml: https://github.com/consensus-shipyard/libp2p-bitswap/blob/7dd9cececda3e4a8f6e14c200a4b457159d8db33/Cargo.toml#L7 6 | // 7 | // License headers added post-fork. 8 | mod message; 9 | mod prefix; 10 | mod protocol; 11 | 12 | pub use message::CompatMessage; 13 | pub use protocol::{CompatProtocol, InboundMessage}; 14 | 15 | fn other(e: E) -> std::io::Error { 16 | std::io::Error::new(std::io::ErrorKind::Other, e) 17 | } 18 | -------------------------------------------------------------------------------- /.github/workflows/contracts-pnpm-audit.yaml: -------------------------------------------------------------------------------- 1 | name: 'Contracts: pnpm audit' 2 | 3 | # This workflow is triggered from the main CI workflow. 4 | on: 5 | workflow_call: 6 | 7 | jobs: 8 | pnpm-audit: 9 | name: pnpm audit 10 | runs-on: ubuntu-latest 11 | if: ${{ !github.event.pull_request.draft }} 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v4 15 | - uses: pnpm/action-setup@v2 16 | - name: Setup Node 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: '18.x' 20 | cache: 'pnpm' 21 | - name: NPM Audit 22 | run: | 23 | cd contracts 24 | pnpm audit --audit-level=moderate 25 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/macros/example/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/filecoin-project/actors-utils with assumed MIT license 5 | // as per Cargo.toml: https://github.com/filecoin-project/actors-utils/blob/7628cd8d39dafcc6035f28e350cdb0cccbea5ab4/frc42_dispatch/Cargo.toml#L5 6 | // 7 | // License headers added post-fork. 8 | use frc42_macros::method_hash; 9 | 10 | fn main() { 11 | let str_hash = method_hash!("Method"); 12 | println!("String hash: {str_hash:x}"); 13 | 14 | // this one breaks naming rules and will fail to compile 15 | //println!("error hash: {}", method_hash!("some_function")); 16 | } 17 | -------------------------------------------------------------------------------- /fendermint/testing/materializer/tests/manifests/standalone.yaml: -------------------------------------------------------------------------------- 1 | accounts: 2 | alice: {} 3 | bob: {} 4 | charlie: {} 5 | 6 | rootnet: 7 | type: New 8 | # Balances and collateral are in atto 9 | validators: 10 | alice: '100' 11 | balances: 12 | # 100FIL is 100_000_000_000_000_000_000 13 | alice: '100000000000000000000' 14 | bob: '200000000000000000000' 15 | charlie: '300000000000000000000' 16 | env: 17 | CMT_CONSENSUS_TIMEOUT_COMMIT: 1s 18 | FM_LOG_LEVEL: info,fendermint=debug 19 | 20 | nodes: 21 | # A singleton node. 22 | pangea: 23 | mode: 24 | type: Validator 25 | validator: alice 26 | seed_nodes: [] 27 | ethapi: true 28 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/shared/src/blobs.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use std::collections::HashSet; 6 | 7 | use fvm_shared::address::Address; 8 | 9 | mod blob; 10 | mod params; 11 | mod status; 12 | mod subscription; 13 | 14 | pub use blob::*; 15 | pub use params::*; 16 | pub use status::*; 17 | pub use subscription::*; 18 | 19 | use crate::bytes::B256; 20 | 21 | /// Tuple representing a unique blob source. 22 | pub type BlobSource = (Address, SubscriptionId, B256); 23 | 24 | /// The return type used when fetching "added" or "pending" blobs. 25 | pub type BlobRequest = (B256, u64, HashSet); 26 | -------------------------------------------------------------------------------- /fendermint/vm/resolver/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_vm_resolver" 3 | description = "Resolve IPLD content in messages" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | async-stm = { workspace = true } 13 | im = { workspace = true } 14 | serde = { workspace = true } 15 | tracing = { workspace = true } 16 | tokio = { workspace = true } 17 | 18 | cid = { workspace = true } 19 | ipc-api = { workspace = true } 20 | ipc_ipld_resolver = { workspace = true } 21 | 22 | [dev-dependencies] 23 | tokio = { workspace = true } 24 | -------------------------------------------------------------------------------- /fendermint/testing/materializer/scripts/docker-entry.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # A docker entry point that allows us to source multiple env-var files and kick off a command. 4 | 5 | # Example: 6 | # echo 'a=1' > test1.env 7 | # echo 'b=2' > test2.env 8 | # echo 'echo a=$a b=$b c=$1' > test.sh 9 | # chmod +x test.sh 10 | # fendermint/testing/materializer/scripts/docker-entry.sh "./test.sh 3" test1.env test2.env 11 | 12 | set -e 13 | 14 | COMMAND=$1 15 | shift 16 | 17 | # Export all variables from all environment file args. 18 | while [ ! -z $1 ]; do 19 | set -a 20 | source $1 21 | set +a 22 | shift 23 | done 24 | 25 | # Execute the real command, transfering the PID so it receives signals. 26 | exec $COMMAND 27 | -------------------------------------------------------------------------------- /contracts/test/unit/FvmAddressHelper.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import "forge-std/Test.sol"; 5 | 6 | import {FvmAddress} from "../../contracts/structs/FvmAddress.sol"; 7 | import {FvmAddressHelper} from "../helpers/FvmAddressHelper.sol"; 8 | 9 | contract FvmAddressHelperTest is Test { 10 | using FvmAddressHelper for FvmAddress; 11 | 12 | function test_works() public pure { 13 | address addr = 0xeC2804Dd9B992C10396b5Af176f06923d984D90e; 14 | FvmAddress memory fvmAddr = FvmAddressHelper.from(addr); 15 | 16 | address extracted = fvmAddr.extractEvmAddress(); 17 | require(extracted == addr, "addresses not equal"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /fendermint/vm/genesis/tests/golden.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | /// JSON based test so we can parse data from the disk where it's nice to be human readable. 5 | mod json { 6 | use fendermint_testing::golden_json; 7 | use fendermint_vm_genesis::Genesis; 8 | use quickcheck::Arbitrary; 9 | golden_json! { "genesis/json", genesis, Genesis::arbitrary } 10 | } 11 | 12 | /// CBOR based tests to make sure we can parse data in network format. 13 | mod cbor { 14 | use fendermint_testing::golden_cbor; 15 | use fendermint_vm_genesis::Genesis; 16 | use quickcheck::Arbitrary; 17 | golden_cbor! { "genesis/cbor", genesis, Genesis::arbitrary } 18 | } 19 | -------------------------------------------------------------------------------- /infra/fendermint/scripts/node.toml: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Node helpers 3 | ######################################################################################################################## 4 | 5 | [tasks.node-init] 6 | dependencies = [ 7 | "node-clear", 8 | "node-mkdir", 9 | ] 10 | 11 | [tasks.node-clear] 12 | script = """ 13 | echo clearing all IPC data 14 | rm -rf ${BASE_DIR} 15 | """ 16 | 17 | [tasks.node-mkdir] 18 | script = """ 19 | echo creating directories: $BASE_DIR $FM_DIR $CMT_DIR $KEYS_DIR 20 | mkdir -p $BASE_DIR 21 | mkdir -p $FM_DIR 22 | mkdir -p $CMT_DIR 23 | mkdir -p $KEYS_DIR 24 | touch $ENV_FILE 25 | """ 26 | -------------------------------------------------------------------------------- /recall/iroh_manager/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "iroh_manager" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | anyhow = { workspace = true } 10 | iroh = { workspace = true } 11 | iroh-blobs = { workspace = true } 12 | iroh-quinn = { workspace = true } 13 | iroh-relay = { workspace = true } 14 | n0-future = { workspace = true } 15 | num-traits = { workspace = true } 16 | quic-rpc = { workspace = true, features = ["quinn-transport", "test-utils"] } 17 | tokio = { workspace = true } 18 | tracing = { workspace = true } 19 | url = { workspace = true } 20 | 21 | [dev-dependencies] 22 | tempfile = { workspace = true } 23 | tracing-subscriber = { workspace = true } 24 | -------------------------------------------------------------------------------- /contracts/test/unit/AccountHelper.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import "forge-std/Test.sol"; 5 | 6 | import "fevmate/contracts/utils/FilAddress.sol"; 7 | import "../../contracts/lib/AccountHelper.sol"; 8 | 9 | contract AccountHelperTest is Test { 10 | using AccountHelper for address; 11 | 12 | function test_IsSystemActor_True() public pure { 13 | require(FilAddress.SYSTEM_ACTOR.isSystemActor() == true); 14 | } 15 | 16 | function test_IsSystemActor_False() public pure { 17 | require(vm.addr(1234).isSystemActor() == false); 18 | } 19 | 20 | function activateAccount(address account) internal { 21 | vm.deal(account, 1 ether); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /docs/fendermint/demos/milestone-1/README.md: -------------------------------------------------------------------------------- 1 | # Milestone 1 Demo 2 | 3 | This demo shows that FVM has been integrated into an ABCI application. It doesn't contain anything IPC specific. 4 | 5 | * [Overview slides](./Fendermint_Demo.pdf) 6 | * [Overview video](https://drive.google.com/file/d/1fv1rVp9cbGuQho5jIqUCHSziJpmId57y/view?usp=sharing) 7 | * [Demo video](https://drive.google.com/file/d/1-UvOk0qb3nQQQd2SczW6uWFRIMpBDUyB/view?usp=sharing) 8 | * [Demo script](./fendermint-demo.sh) 9 | 10 | This demo was preformed with [Tendermint Core v0.37.0-rc2](https://github.com/tendermint/tendermint/blob/v0.37.0-rc2/docs/introduction/install.md) (with `git checkout v0.37.0-rc2`), before we switched to CometBFT, so we ran `tendermint` commands, not `cometbft`. 11 | -------------------------------------------------------------------------------- /fendermint/abci/src/util.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | /// Take the first transactions until the first one that would exceed the maximum limit. 5 | /// 6 | /// The function does not skip or reorder transaction even if a later one would stay within the limit. 7 | pub fn take_until_max_size>(txs: Vec, max_tx_bytes: usize) -> (Vec, usize) { 8 | let mut size: usize = 0; 9 | let mut out = Vec::new(); 10 | for tx in txs { 11 | let bz: &[u8] = tx.as_ref(); 12 | if size.saturating_add(bz.len()) > max_tx_bytes { 13 | break; 14 | } 15 | size += bz.len(); 16 | out.push(tx); 17 | } 18 | (out, size) 19 | } 20 | -------------------------------------------------------------------------------- /fendermint/vm/core/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_vm_core" 3 | description = "Core data structures shared between genesis and messages" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | fnv = { workspace = true } 11 | lazy_static = { workspace = true } 12 | regex = { workspace = true } 13 | serde = { workspace = true } 14 | thiserror = { workspace = true } 15 | arbitrary = { workspace = true, optional = true } 16 | quickcheck = { workspace = true, optional = true } 17 | 18 | cid = { workspace = true } 19 | fvm_shared = { workspace = true } 20 | 21 | [dev-dependencies] 22 | quickcheck = { workspace = true } 23 | quickcheck_macros = { workspace = true } 24 | -------------------------------------------------------------------------------- /fendermint/vm/topdown/src/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use crate::{BlockHeight, SequentialAppendError}; 5 | use thiserror::Error; 6 | 7 | /// The errors for top down checkpointing 8 | #[derive(Error, Debug, Eq, PartialEq, Clone)] 9 | pub enum Error { 10 | #[error("Incoming items are not order sequentially")] 11 | NotSequential, 12 | #[error("The parent view update with block height is not sequential: {0:?}")] 13 | NonSequentialParentViewInsert(SequentialAppendError), 14 | #[error("Parent chain reorg detected")] 15 | ParentChainReorgDetected, 16 | #[error("Cannot query parent at height {1}: {0}")] 17 | CannotQueryParent(String, BlockHeight), 18 | } 19 | -------------------------------------------------------------------------------- /.github/workflows/contracts-prettier.yaml: -------------------------------------------------------------------------------- 1 | name: 'Contracts: Prettier' 2 | 3 | # This workflow is triggered from the main CI workflow. 4 | on: 5 | workflow_call: 6 | 7 | jobs: 8 | prettier: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v4 13 | 14 | - uses: pnpm/action-setup@v2 15 | 16 | - name: Set up node.js 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: '21' 20 | cache: 'pnpm' 21 | 22 | - name: Run formatter 23 | run: cd contracts && make fmt 24 | 25 | - name: Check diff clean 26 | run: | 27 | git status 28 | git diff --name-only 29 | git --no-pager diff --quiet 30 | -------------------------------------------------------------------------------- /fendermint/vm/message/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use cid::{multihash, multihash::MultihashDigest, Cid}; 5 | use fvm_ipld_encoding::{to_vec, Error as IpldError, DAG_CBOR}; 6 | use serde::Serialize; 7 | 8 | pub mod chain; 9 | pub mod conv; 10 | pub mod ipc; 11 | pub mod query; 12 | pub mod signed; 13 | 14 | /// Calculate the CID using Blake2b256 digest and DAG_CBOR. 15 | /// 16 | /// This used to be part of the `Cbor` trait, which is deprecated. 17 | pub fn cid(value: &T) -> Result { 18 | let bz = to_vec(value)?; 19 | let digest = multihash::Code::Blake2b256.digest(&bz); 20 | let cid = Cid::new_v1(DAG_CBOR, digest); 21 | Ok(cid) 22 | } 23 | -------------------------------------------------------------------------------- /recall/executor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "recall_executor" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [lib] 9 | crate-type = ["cdylib", "lib"] 10 | 11 | [dependencies] 12 | anyhow = { workspace = true } 13 | cid = { workspace = true } 14 | fvm = { workspace = true } 15 | fvm_ipld_encoding = { workspace = true } 16 | fvm_shared = { workspace = true } 17 | num-traits = { workspace = true } 18 | replace_with = { workspace = true } 19 | tracing = { workspace = true } 20 | 21 | fendermint_actor_blobs_shared = { path = "../../fendermint/actors/blobs/shared" } 22 | fendermint_vm_actor_interface = { path = "../../fendermint/vm/actor_interface" } 23 | 24 | [features] 25 | testing = [] 26 | -------------------------------------------------------------------------------- /fendermint/vm/interpreter/src/fvm/state/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | pub mod fevm; 5 | pub mod ipc; 6 | pub mod snapshot; 7 | 8 | mod check; 9 | mod exec; 10 | mod genesis; 11 | mod priority; 12 | mod query; 13 | 14 | use std::sync::Arc; 15 | 16 | pub use check::FvmCheckState; 17 | pub use exec::{BlockHash, FvmExecState, FvmStateParams, FvmUpdatableParams}; 18 | pub use genesis::{empty_state_tree, FvmGenesisState}; 19 | pub use query::FvmQueryState; 20 | 21 | use super::store::ReadOnlyBlockstore; 22 | 23 | /// We use full state even for checking, to support certain client scenarios. 24 | pub type CheckStateRef = Arc>>>>; 25 | -------------------------------------------------------------------------------- /recall/ipld/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "recall_ipld" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [lib] 9 | crate-type = ["cdylib", "lib"] 10 | 11 | [dependencies] 12 | anyhow = { workspace = true } 13 | cid = { workspace = true } 14 | fil_actors_runtime = { workspace = true } 15 | fvm_ipld_amt = { workspace = true } 16 | fvm_ipld_blockstore = { workspace = true } 17 | fvm_ipld_encoding = { workspace = true } 18 | fvm_ipld_hamt = { workspace = true } 19 | fvm_shared = { workspace = true } 20 | fvm_sdk = { workspace = true } 21 | integer-encoding = { workspace = true } 22 | serde = { workspace = true, features = ["derive"] } 23 | 24 | [features] 25 | fil-actor = ["fil_actors_runtime/fil-actor"] -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "contracts/lib/murky"] 2 | path = contracts/lib/murky 3 | url = https://github.com/dmfxyz/murky 4 | [submodule "contracts/lib/forge-std"] 5 | path = contracts/lib/forge-std 6 | url = https://github.com/foundry-rs/forge-std 7 | [submodule "demos/linked-token/lib/forge-std"] 8 | path = demos/linked-token/lib/forge-std 9 | url = https://github.com/foundry-rs/forge-std 10 | [submodule "demos/axelar-token/lib/forge-std"] 11 | path = demos/axelar-token/lib/forge-std 12 | url = https://github.com/foundry-rs/forge-std 13 | [submodule "builtin-actors"] 14 | path = builtin-actors 15 | url = https://github.com/recallnet/builtin-actors.git 16 | [submodule "recall-contracts"] 17 | path = recall-contracts 18 | url = https://github.com/recallnet/contracts.git 19 | -------------------------------------------------------------------------------- /contracts/contracts/interfaces/IDiamondCut.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import {IDiamond} from "./IDiamond.sol"; 5 | 6 | interface IDiamondCut is IDiamond { 7 | /** 8 | * @notice Add/replace/remove any number of functions and optionally execute a function with delegatecall 9 | * @param _diamondCut Contains the facet addresses and function selectors 10 | * @param _init The address of the contract or facet to execute _calldata 11 | * @param _calldata A function call, including function selector and arguments _calldata is executed with delegatecall on `_init` 12 | */ 13 | function diamondCut(IDiamond.FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external; 14 | } 15 | -------------------------------------------------------------------------------- /fendermint/storage/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_storage" 3 | description = "KV store abstraction for non-blockstore use." 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | im = { version = "15.1.0", optional = true } 13 | quickcheck = { workspace = true, optional = true } 14 | thiserror = { workspace = true } 15 | 16 | [dev-dependencies] 17 | quickcheck_macros = { workspace = true } 18 | serde = { workspace = true } 19 | fvm_ipld_encoding = { workspace = true } 20 | 21 | [features] 22 | default = ["inmem"] 23 | inmem = ["im", "testing"] 24 | testing = ["quickcheck"] 25 | -------------------------------------------------------------------------------- /infra/fendermint/scripts/docker.toml: -------------------------------------------------------------------------------- 1 | [tasks.docker-network-create] 2 | command = "docker" 3 | args = ["network", "create", "${NETWORK_NAME}"] 4 | ignore_errors = true 5 | 6 | [tasks.docker-network-rm] 7 | command = "docker" 8 | args = ["network", "rm", "${NETWORK_NAME}"] 9 | ignore_errors = true 10 | 11 | [tasks.docker-stop] 12 | command = "docker" 13 | args = ["stop", "${CONTAINER_NAME}"] 14 | ignore_errors = true 15 | 16 | [tasks.docker-rm] 17 | command = "docker" 18 | args = ["rm", "--force", "${CONTAINER_NAME}"] 19 | ignore_errors = true 20 | 21 | [tasks.docker-destroy] 22 | run_task = { name = [ 23 | "docker-stop", 24 | "docker-rm", 25 | ] } 26 | 27 | [tasks.docker-logs] 28 | command = "docker" 29 | args = ["logs", "${CONTAINER_NAME}"] 30 | ignore_errors = true 31 | -------------------------------------------------------------------------------- /recall/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all build test clean lint check-fmt check-clippy 2 | 3 | CRATE := recall_actor_sdk recall_kernel recall_kernel_ops recall_syscalls iroh_manager 4 | PACKAGE := $(patsubst %, --package %, $(CRATE)) 5 | 6 | all: test build 7 | 8 | build: 9 | cargo build --locked --release 10 | 11 | test: 12 | cargo test --locked --release $(PACKAGE) 13 | 14 | clean: 15 | cargo clean 16 | 17 | lint: \ 18 | check-fmt \ 19 | check-clippy 20 | 21 | check-fmt: 22 | @# `nightly` is required to support ignore list in rustfmt.toml 23 | rustup install nightly-2024-09-20 24 | rustup component add --toolchain nightly-2024-09-20 rustfmt 25 | cargo +nightly-2024-09-20 fmt $(PACKAGE) --check 26 | 27 | check-clippy: 28 | cargo clippy $(PACKAGE) --tests --no-deps -- -D clippy::all 29 | -------------------------------------------------------------------------------- /fendermint/vm/snapshot/src/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use fendermint_vm_interpreter::fvm::state::snapshot::SnapshotVersion; 5 | 6 | /// Possible errors with snapshots. 7 | #[derive(Debug, thiserror::Error)] 8 | pub enum SnapshotError { 9 | #[error("incompatible snapshot version: {0}")] 10 | IncompatibleVersion(SnapshotVersion), 11 | #[error("IO error: {0}")] 12 | IoError(#[from] std::io::Error), 13 | #[error("there is no ongoing snapshot download")] 14 | NoDownload, 15 | #[error("unexpected chunk index; expected {0}, got {1}")] 16 | UnexpectedChunk(u32, u32), 17 | #[error("wrong checksum; expected {0}, got {1}")] 18 | WrongChecksum(tendermint::Hash, tendermint::Hash), 19 | } 20 | -------------------------------------------------------------------------------- /fendermint/vm/snapshot/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | mod car; 4 | mod client; 5 | mod error; 6 | mod manager; 7 | mod manifest; 8 | mod state; 9 | 10 | /// The file name to export the CAR to. 11 | const SNAPSHOT_FILE_NAME: &str = "snapshot.car"; 12 | 13 | /// The file name in snapshot directories that contains the manifest. 14 | const MANIFEST_FILE_NAME: &str = "manifest.json"; 15 | 16 | /// Name of the subdirectory where `{idx}.part` files are stored within a snapshot. 17 | const PARTS_DIR_NAME: &str = "parts"; 18 | 19 | pub use client::SnapshotClient; 20 | pub use error::SnapshotError; 21 | pub use manager::{SnapshotManager, SnapshotParams}; 22 | pub use manifest::SnapshotManifest; 23 | pub use state::SnapshotItem; 24 | -------------------------------------------------------------------------------- /ipc/wallet/src/fvm/utils.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // Copyright 2019-2023 ChainSafe Systems 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | 6 | use std::fs::File; 7 | use std::io::Result; 8 | 9 | /// Restricts permissions on a file to user-only: 0600 10 | #[cfg(unix)] 11 | pub fn set_user_perm(file: &File) -> Result<()> { 12 | use std::os::unix::fs::PermissionsExt; 13 | 14 | use log::info; 15 | 16 | let mut perm = file.metadata()?.permissions(); 17 | #[allow(clippy::useless_conversion)] // Otherwise it does not build on macos 18 | perm.set_mode((libc::S_IWUSR | libc::S_IRUSR).into()); 19 | file.set_permissions(perm)?; 20 | 21 | info!("Permissions set to 0600 on {:?}", file); 22 | 23 | Ok(()) 24 | } 25 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/scripts/make-manifest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | cat << EOF > $MANIFEST_FILE 6 | accounts: 7 | alice: {} 8 | 9 | rootnet: 10 | type: New 11 | # Balances and collateral are in atto 12 | validators: 13 | alice: '100' 14 | balances: 15 | # 100FIL is 100_000_000_000_000_000_000 16 | alice: '100000000000000000000' 17 | env: 18 | CMT_CONSENSUS_TIMEOUT_COMMIT: 1s 19 | FM_NETWORK: $FM_NETWORK 20 | FM_DB__STATE_HIST_SIZE: "$STATE_HIST_SIZE" 21 | FM_DB__COMPACTION_STYLE: "$COMPACTION_STYLE" 22 | FM_TESTING__PUSH_CHAIN_META: "$PUSH_CHAIN_META" 23 | 24 | nodes: 25 | bench: 26 | mode: 27 | type: Validator 28 | validator: alice 29 | seed_nodes: [] 30 | ethapi: false 31 | EOF 32 | -------------------------------------------------------------------------------- /fendermint/app/src/metrics/prometheus.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | //! Prometheus metrics 4 | 5 | /// Metrics emitted by the Ethereum API facade. 6 | pub mod eth { 7 | // TODO - migrate these metrics to new observability architecture 8 | use fendermint_eth_api::apis::RPC_METHOD_CALL_LATENCY_SECONDS; 9 | 10 | pub fn register_metrics(registry: &prometheus::Registry) -> anyhow::Result<()> { 11 | registry.register(Box::new(RPC_METHOD_CALL_LATENCY_SECONDS.clone()))?; 12 | Ok(()) 13 | } 14 | } 15 | 16 | #[cfg(test)] 17 | mod tests { 18 | #[test] 19 | fn can_register_eth_metrics() { 20 | let r = prometheus::Registry::new(); 21 | super::eth::register_metrics(&r).unwrap(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /fendermint/testing/src/arb/message.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | use fvm_shared::message::Message; 4 | use quickcheck::{Arbitrary, Gen}; 5 | 6 | use super::{ArbAddress, ArbTokenAmount}; 7 | 8 | #[derive(Clone, Debug)] 9 | pub struct ArbMessage(pub Message); 10 | 11 | impl Arbitrary for ArbMessage { 12 | fn arbitrary(g: &mut Gen) -> Self { 13 | let mut message = Message::arbitrary(g); 14 | message.gas_fee_cap = ArbTokenAmount::arbitrary(g).0; 15 | message.gas_premium = ArbTokenAmount::arbitrary(g).0; 16 | message.value = ArbTokenAmount::arbitrary(g).0; 17 | message.to = ArbAddress::arbitrary(g).0; 18 | message.from = ArbAddress::arbitrary(g).0; 19 | Self(message) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ipld/resolver/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | mod behaviour; 4 | mod client; 5 | mod hash; 6 | mod limiter; 7 | mod observe; 8 | mod service; 9 | mod timestamp; 10 | 11 | mod provider_cache; 12 | mod provider_record; 13 | mod signed_record; 14 | mod vote_record; 15 | 16 | #[cfg(any(test, feature = "arb"))] 17 | mod arb; 18 | 19 | #[cfg(feature = "missing_blocks")] 20 | pub mod missing_blocks; 21 | 22 | pub use behaviour::{ContentConfig, DiscoveryConfig, MembershipConfig, NetworkConfig}; 23 | pub use client::{Client, Resolver, ResolverIroh, ResolverIrohReadRequest}; 24 | pub use service::{Config, ConnectionConfig, Event, IrohConfig, NoKnownPeers, Service}; 25 | pub use timestamp::Timestamp; 26 | pub use vote_record::{ValidatorKey, VoteRecord}; 27 | -------------------------------------------------------------------------------- /contracts/test/mocks/SubnetActorMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import {SubnetActorManagerFacet} from "../../contracts/subnet/SubnetActorManagerFacet.sol"; 5 | import {LibStaking} from "../../contracts/lib/LibStaking.sol"; 6 | import {SubnetActorRewardFacet} from "../../contracts/subnet/SubnetActorRewardFacet.sol"; 7 | 8 | contract SubnetActorMock is SubnetActorManagerFacet, SubnetActorRewardFacet { 9 | function confirmChange(uint64 _configurationNumber) external { 10 | LibStaking.confirmChange(_configurationNumber); 11 | } 12 | 13 | function confirmNextChange() external { 14 | (uint64 nextConfigNum, ) = LibStaking.getConfigurationNumbers(); 15 | LibStaking.confirmChange(nextConfigNum - 1); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /fendermint/vm/snapshot/tests/golden.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | /// JSON based test so we can parse data from the disk where it's nice to be human readable. 5 | mod json { 6 | use fendermint_testing::golden_json; 7 | use fendermint_vm_snapshot::SnapshotManifest; 8 | use quickcheck::Arbitrary; 9 | golden_json! { "manifest/json", manifest, SnapshotManifest::arbitrary } 10 | } 11 | 12 | /// CBOR based test to make sure we can parse data in network format and we also cover the state params. 13 | mod cbor { 14 | use fendermint_testing::golden_cbor; 15 | use fendermint_vm_snapshot::SnapshotManifest; 16 | use quickcheck::Arbitrary; 17 | golden_cbor! { "manifest/cbor", manifest, SnapshotManifest::arbitrary } 18 | } 19 | -------------------------------------------------------------------------------- /contracts/test/helpers/ERC20Nil.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.21; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import "@openzeppelin/contracts/access/Ownable.sol"; 6 | 7 | contract ERC20Nil is ERC20, Ownable { 8 | constructor( 9 | string memory name_, 10 | string memory symbol_, 11 | uint256 initialSupply, 12 | address owner 13 | ) ERC20(name_, symbol_) Ownable(owner) { 14 | _mint(owner, initialSupply); 15 | } 16 | 17 | function _update(address from, address to, uint256 value) internal virtual override { 18 | if (from != address(0) && to != address(0)) { 19 | //do nothing "NIL" 20 | } else { 21 | super._update(from, to, value); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /deployment/set-up-nu.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This file downloads the required nushell version to ./.nu folder. 4 | 5 | set -e 6 | 7 | version="0.103.0" 8 | 9 | echo "Installing Nushell..." 10 | nu_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.nu" 11 | 12 | mkdir -p $nu_dir 13 | cd $nu_dir 14 | os=$(uname | sed -e s/darwin/apple-darwin/i -e s/linux/unknown-linux-gnu/i) 15 | arch=$(uname -m | sed -e s/arm64/aarch64/) 16 | curl -Lo nu.tgz https://github.com/nushell/nushell/releases/download/${version}/nu-${version}-${arch}-${os}.tar.gz 17 | tar xf nu.tgz 18 | mv nu-*/nu . 19 | rm -rf nu-* nu.tgz 20 | echo "export PATH=$(pwd):\$PATH" > $nu_dir/activate.sh 21 | source ./activate.sh 22 | 23 | echo "Nushell installed at $(which nu)" 24 | nu -c version 25 | echo "Activate: source $nu_dir/activate.sh" 26 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/shared/src/accounts/params.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use fvm_ipld_encoding::tuple::*; 6 | use fvm_shared::address::Address; 7 | use serde::{Deserialize, Serialize}; 8 | 9 | use super::AccountStatus; 10 | 11 | /// Params for setting account status. 12 | #[derive(Clone, Debug, Serialize_tuple, Deserialize_tuple)] 13 | pub struct SetAccountStatusParams { 14 | /// Address to set the account status for. 15 | pub subscriber: Address, 16 | /// Status to set. 17 | pub status: AccountStatus, 18 | } 19 | 20 | /// Params for getting an account. 21 | #[derive(Clone, Debug, Serialize, Deserialize)] 22 | #[serde(transparent)] 23 | pub struct GetAccountParams(pub Address); 24 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/chain/ipc_bottom_up_resolve.cbor: -------------------------------------------------------------------------------- 1 | a163497063a16f426f74746f6d55705265736f6c7665a2676d657373616765a6676d657373616765a2676d657373616765a4697375626e65745f696482008356040a4e97ff28a2f01784877f570a177165a701178d004200004b00d7fec0b3f0a0bba4b001666865696768741abf77c107756e6578745f76616c696461746f725f7365745f69641b6fa574b062cddf8372626f74746f6d5f75705f6d65737361676573d82a58230012206c02a13d596262a04a4cc921d7c7e5e96e4a57ce11cba9ff377758dce10d3e266b6365727469666963617465a16a7369676e61747572657381a26976616c696461746f725504eb88ffc5d0d2c8d2c501bf5f381e510439feff01697369676e617475726542026e6772656c617965725502d39504f7b42928cc5e86018f52dd9449010147786873657175656e63651be0152d6264f391fc696761735f6c696d69741b46920400b5e5a1176b6761735f6665655f636170406b6761735f7072656d69756d40697369676e61747572654a029197bd47cfaaffdf4f -------------------------------------------------------------------------------- /fendermint/vm/interpreter/tests/golden.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | /// JSON based test in case we want to configure the FvmStateParams by hand. 5 | mod json { 6 | use fendermint_testing::golden_json; 7 | use fendermint_vm_interpreter::fvm::state::FvmStateParams; 8 | use quickcheck::Arbitrary; 9 | golden_json! { "fvmstateparams/json", fvmstateparams, FvmStateParams::arbitrary } 10 | } 11 | 12 | /// CBOR based tests in case we have to grab FvmStateParams from on-chain storage. 13 | mod cbor { 14 | use fendermint_testing::golden_cbor; 15 | use fendermint_vm_interpreter::fvm::state::FvmStateParams; 16 | use quickcheck::Arbitrary; 17 | golden_cbor! { "fvmstateparams/cbor", fvmstateparams, FvmStateParams::arbitrary } 18 | } 19 | -------------------------------------------------------------------------------- /fendermint/app/options/src/run.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use std::net::{SocketAddr, SocketAddrV4, SocketAddrV6}; 5 | use std::path::PathBuf; 6 | 7 | use clap::Args; 8 | 9 | #[derive(Args, Debug)] 10 | pub struct RunArgs { 11 | /// Storage path for the iroh node 12 | #[arg(long, env = "IROH_PATH")] 13 | pub iroh_path: PathBuf, 14 | /// The address to bind the iroh (blobs) RPC to 15 | #[arg(long, env = "IROH_RPC_ADDR")] 16 | pub iroh_rpc_addr: SocketAddr, 17 | /// The ipv4 address iroh will bind on 18 | #[arg(long, env = "IROH_V4_ADDR")] 19 | pub iroh_v4_addr: Option, 20 | /// The ipv6 address iroh will bind on 21 | #[arg(long, env = "IROH_V6_ADDR")] 22 | pub iroh_v6_addr: Option, 23 | } 24 | -------------------------------------------------------------------------------- /ext/frc42_dispatch/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "frc42_dispatch" 3 | description = "Filecoin FRC-0042 calling convention/dispatch support library" 4 | version = "8.0.0" 5 | license = "MIT OR Apache-2.0" 6 | keywords = ["filecoin", "dispatch", "frc-0042"] 7 | repository = "https://github.com/helix-onchain/filecoin/" 8 | edition = "2021" 9 | 10 | 11 | [dependencies] 12 | fvm_ipld_encoding = { workspace = true } 13 | fvm_sdk = { workspace = true, optional = true } 14 | fvm_shared = { workspace = true } 15 | frc42_hasher = { version = "6.0.0", path = "hasher" } 16 | frc42_macros = { version = "6.0.0", path = "macros" } 17 | thiserror = { version = "1.0.31" } 18 | 19 | [features] 20 | # disable default features to avoid dependence on fvm_sdk (for proc macro and similar purposes) 21 | default = ["use_sdk"] 22 | use_sdk = ["dep:fvm_sdk"] 23 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/src/actor/metrics.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use fendermint_actor_blobs_shared::GetStatsReturn; 6 | use fendermint_actor_recall_config_shared::get_config; 7 | use fil_actors_runtime::{runtime::Runtime, ActorError}; 8 | 9 | use crate::{actor::BlobsActor, State}; 10 | 11 | impl BlobsActor { 12 | /// Returns credit and storage usage statistics. 13 | pub fn get_stats(rt: &impl Runtime) -> Result { 14 | rt.validate_immediate_caller_accept_any()?; 15 | 16 | let config = get_config(rt)?; 17 | let stats = rt 18 | .state::()? 19 | .get_stats(&config, rt.current_balance()); 20 | 21 | Ok(stats) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /fendermint/testing/graph-test/subgraph/subgraph.template.yaml: -------------------------------------------------------------------------------- 1 | specVersion: 0.0.4 2 | description: Graph for Greeter contracts 3 | repository: https://github.com/hashgraph/hedera-subgraph-example 4 | schema: 5 | file: ./schema.graphql 6 | dataSources: 7 | - kind: ethereum/contract 8 | name: Greeter 9 | network: testnet 10 | source: 11 | address: '{{address}}' 12 | abi: IGreeter 13 | startBlock: {{deploy_height}} 14 | mapping: 15 | kind: ethereum/events 16 | apiVersion: 0.0.6 17 | language: wasm/assemblyscript 18 | entities: 19 | - Greeting 20 | abis: 21 | - name: IGreeter 22 | file: ./abis/IGreeter.json 23 | eventHandlers: 24 | - event: GreetingSet(string) 25 | handler: handleGreetingSet 26 | file: ./src/mappings.ts 27 | -------------------------------------------------------------------------------- /fendermint/testing/materializer/tests/golden.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | mod json { 5 | use fendermint_materializer::manifest::Manifest; 6 | use fendermint_testing::golden_json; 7 | use quickcheck::Arbitrary; 8 | golden_json! { "manifest/json", manifest, Manifest::arbitrary } 9 | } 10 | 11 | mod yaml { 12 | use fendermint_materializer::manifest::Manifest; 13 | use fendermint_testing::golden_yaml; 14 | use quickcheck::Arbitrary; 15 | golden_yaml! { "manifest/yaml", manifest, Manifest::arbitrary } 16 | } 17 | 18 | mod toml { 19 | use fendermint_materializer::manifest::Manifest; 20 | use fendermint_testing::golden_toml; 21 | use quickcheck::Arbitrary; 22 | golden_toml! { "manifest/toml", manifest, Manifest::arbitrary } 23 | } 24 | -------------------------------------------------------------------------------- /infra/promtail/promtail-config.yaml: -------------------------------------------------------------------------------- 1 | # About promtail: https://grafana.com/docs/loki/latest/send-data/promtail/ 2 | # Configuring promtail: https://grafana.com/docs/loki/latest/send-data/promtail/configuration/ 3 | server: 4 | http_listen_port: 9080 5 | grpc_listen_port: 0 6 | 7 | positions: 8 | filename: /tmp/positions.yaml 9 | 10 | scrape_configs: 11 | - job_name: flog_scrape 12 | docker_sd_configs: 13 | - host: unix:///var/run/docker.sock 14 | relabel_configs: 15 | - action: replace 16 | source_labels: 17 | - __meta_docker_container_name 18 | target_label: docker_container_stdout 19 | - job_name: fendermint 20 | static_configs: 21 | - targets: 22 | - localhost 23 | - labels: 24 | job: fendermint_log 25 | __path__: /var/log/fendermint/*.log 26 | -------------------------------------------------------------------------------- /ext/libp2p-bitswap/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Forked from https://github.com/consensus-shipyard/libp2p-bitswap with assumed MIT license 5 | // as per Cargo.toml: https://github.com/consensus-shipyard/libp2p-bitswap/blob/7dd9cececda3e4a8f6e14c200a4b457159d8db33/Cargo.toml#L7 6 | // 7 | // License headers added post-fork. 8 | //! Bitswap protocol implementation 9 | #![deny(missing_docs)] 10 | #![deny(warnings)] 11 | #![allow(clippy::derive_partial_eq_without_eq)] 12 | 13 | mod behaviour; 14 | #[cfg(feature = "compat")] 15 | mod compat; 16 | mod protocol; 17 | mod query; 18 | mod stats; 19 | 20 | pub use crate::behaviour::{Bitswap, BitswapConfig, BitswapEvent, BitswapStore, Channel}; 21 | pub use crate::protocol::{BitswapRequest, BitswapResponse}; 22 | pub use crate::query::QueryId; 23 | -------------------------------------------------------------------------------- /fendermint/app/settings/src/testing.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use serde::Deserialize; 5 | 6 | #[derive(Debug, Deserialize, Clone)] 7 | pub struct TestingSettings { 8 | /// Indicate whether the chain metadata should be pushed into the ledger. 9 | /// 10 | /// Doing so causes the ledger to change even on empty blocks, which will 11 | /// cause another empty block to be created by CometBFT, perpetuating 12 | /// it even if we don't want them. 13 | /// 14 | /// See 15 | /// 16 | /// This is here for testing purposes only, it should be `true` by default to allow 17 | /// the `evm` actor to execute the `BLOCKHASH` function. 18 | pub push_chain_meta: bool, 19 | } 20 | -------------------------------------------------------------------------------- /contracts/tasks/deploy-libraries.ts: -------------------------------------------------------------------------------- 1 | import { task } from 'hardhat/config' 2 | import { HardhatRuntimeEnvironment } from 'hardhat/types' 3 | import { Deployments } from './lib' 4 | 5 | task( 6 | 'deploy-libraries', 7 | 'Build and deploys all libraries on the selected network', 8 | async (_args, hre: HardhatRuntimeEnvironment): Promise => { 9 | await hre.run('compile') 10 | 11 | const [deployer] = await hre.getUnnamedAccounts() 12 | 13 | const contracts = [ 14 | { name: 'AccountHelper' }, 15 | { name: 'SubnetIDHelper' }, 16 | { name: 'LibStaking' }, 17 | { name: 'LibQuorum' }, 18 | { name: 'CrossMsgHelper', libraries: ['SubnetIDHelper'] }, 19 | ] 20 | 21 | return await Deployments.deploy(hre, deployer, ...contracts) 22 | }, 23 | ) 24 | -------------------------------------------------------------------------------- /fendermint/rpc/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use base64::{ 5 | alphabet, 6 | engine::{DecodePaddingMode, GeneralPurpose, GeneralPurposeConfig}, 7 | }; 8 | 9 | pub mod client; 10 | pub mod message; 11 | pub mod query; 12 | pub mod response; 13 | pub mod tx; 14 | 15 | pub use client::FendermintClient; 16 | pub use query::QueryClient; 17 | pub use tx::TxClient; 18 | 19 | /// A [`base64::Engine`] using the [`alphabet::STANDARD`] base64 alphabet 20 | /// padding bytes when writing but requireing no padding when reading. 21 | const B64_ENGINE: base64::engine::GeneralPurpose = GeneralPurpose::new( 22 | &alphabet::STANDARD, 23 | GeneralPurposeConfig::new() 24 | .with_encode_padding(true) 25 | .with_decode_padding_mode(DecodePaddingMode::Indifferent), 26 | ); 27 | -------------------------------------------------------------------------------- /fendermint/app/src/lib.rs: -------------------------------------------------------------------------------- 1 | extern crate core; 2 | 3 | // Copyright 2022-2024 Protocol Labs 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | mod app; 6 | pub mod ipc; 7 | pub mod metrics; 8 | pub mod observe; 9 | mod store; 10 | mod tmconv; 11 | mod validators; 12 | 13 | pub use app::{App, AppConfig}; 14 | pub use store::{AppStore, BitswapBlockstore}; 15 | 16 | // Different type from `ChainEpoch` just because we might use epoch in a more traditional sense for checkpointing. 17 | pub type BlockHeight = u64; 18 | 19 | pub const VERSION: &str = env!("CARGO_PKG_VERSION"); 20 | 21 | #[derive(Debug)] 22 | pub enum AppExitCode { 23 | /// Fendermint exited normally 24 | Ok = 0, 25 | /// Fendermint exited with an unknown error 26 | UnknownError = 1, 27 | /// Fendermint exited since it reached a block height equal to halt_height 28 | Halt = 2, 29 | } 30 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/src/state/credit.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use fendermint_actor_blobs_shared::credit::Credit; 6 | use fvm_ipld_encoding::tuple::*; 7 | 8 | mod approvals; 9 | mod methods; 10 | mod params; 11 | #[cfg(test)] 12 | mod tests; 13 | 14 | pub use approvals::*; 15 | pub use params::*; 16 | 17 | /// Global credit-related state. 18 | #[derive(Debug, Clone, Default, Serialize_tuple, Deserialize_tuple)] 19 | pub struct Credits { 20 | /// The total number of credits sold in the subnet. 21 | pub credit_sold: Credit, 22 | /// The total number of credits committed to active storage in the subnet. 23 | pub credit_committed: Credit, 24 | /// The total number of credits debited in the subnet. 25 | pub credit_debited: Credit, 26 | } 27 | -------------------------------------------------------------------------------- /docs/fendermint/diagrams/README.md: -------------------------------------------------------------------------------- 1 | # Diagrams 2 | 3 | This directory contains [PlantUML](https://plantuml.com/) diagrams which are turned into images ready to be embedded into docs. 4 | 5 | To render the images, run the following command: 6 | 7 | ```shell 8 | make diagrams 9 | ``` 10 | 11 | ## Automation 12 | 13 | Adding the following script to `.git/hooks/pre-commit` automatically renders and checks in the images when we commit changes to their source diagrams. CI should also check that there are no uncommitted changes. 14 | 15 | ```bash 16 | #!/usr/bin/env bash 17 | 18 | # If any command fails, exit immediately with that command's exit status 19 | set -eo pipefail 20 | 21 | # Redirect output to stderr. 22 | exec 1>&2 23 | 24 | if git diff --cached --name-only --diff-filter=d | grep .puml 25 | then 26 | make diagrams 27 | git add docs/diagrams/*.png 28 | fi 29 | ``` 30 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/shared/src/blobs/blob.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use std::collections::HashMap; 6 | 7 | use fvm_ipld_encoding::tuple::*; 8 | use fvm_shared::clock::ChainEpoch; 9 | 10 | use super::{BlobStatus, SubscriptionId}; 11 | use crate::bytes::B256; 12 | 13 | /// The external (shared) view of a blob. 14 | #[derive(Debug, Serialize_tuple, Deserialize_tuple)] 15 | pub struct Blob { 16 | /// The size of the content. 17 | pub size: u64, 18 | /// Blob metadata that contains information for blob recovery. 19 | pub metadata_hash: B256, 20 | /// Active subscribers (accounts) that are paying for the blob to expiry. 21 | pub subscribers: HashMap, 22 | /// Blob status. 23 | pub status: BlobStatus, 24 | } 25 | -------------------------------------------------------------------------------- /fendermint/actors/recall_config/shared/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_actor_recall_config_shared" 3 | description = "Shared resources for the recall config" 4 | license.workspace = true 5 | edition.workspace = true 6 | authors.workspace = true 7 | version = "0.1.0" 8 | 9 | [lib] 10 | ## lib is necessary for integration tests 11 | ## cdylib is necessary for Wasm build 12 | crate-type = ["cdylib", "lib"] 13 | 14 | [dependencies] 15 | fendermint_actor_blobs_shared = { path = "../../blobs/shared" } 16 | fil_actors_runtime = { workspace = true } 17 | frc42_dispatch = { workspace = true } 18 | fvm_ipld_encoding = { workspace = true } 19 | fvm_shared = { workspace = true } 20 | num-derive = { workspace = true } 21 | num-traits = { workspace = true } 22 | serde = { workspace = true, features = ["derive"] } 23 | 24 | [features] 25 | fil-actor = ["fil_actors_runtime/fil-actor"] 26 | -------------------------------------------------------------------------------- /contracts/contracts/interfaces/IValidatorGater.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import {SubnetID} from "../structs/Subnet.sol"; 5 | 6 | /// @title Validator Gater interface 7 | /// This interface introduces the ability to intercept validator power updates before it's executed. Power updates could 8 | /// come from staking, unstaking, and explicit validator membership adjustments (federated membership). With this interface, 9 | /// it introduces an extra layer of checking to directly allow or deny the action, according to a user-defined policy. 10 | interface IValidatorGater { 11 | /// This intercepts the power update call. 12 | /// @notice This method should revert if the power update is not allowed. 13 | function interceptPowerDelta(SubnetID memory id, address validator, uint256 prevPower, uint256 newPower) external; 14 | } 15 | -------------------------------------------------------------------------------- /contracts/contracts/subnet/SubnetActorPauseFacet.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import {LibDiamond} from "../lib/LibDiamond.sol"; 5 | import {Pausable} from "../lib/LibPausable.sol"; 6 | 7 | contract SubnetActorPauseFacet is Pausable { 8 | /// @notice Pauses all contract functions with the `whenNotPaused` modifier. 9 | function pause() external { 10 | LibDiamond.enforceIsContractOwner(); 11 | _pause(); 12 | } 13 | 14 | /// @notice Unpauses all contract functions with the `whenNotPaused` modifier. 15 | function unpause() external { 16 | LibDiamond.enforceIsContractOwner(); 17 | _unpause(); 18 | } 19 | 20 | /// @notice Returns true if the SubnetActor contract is paused. 21 | function paused() external view returns (bool) { 22 | return _paused(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /infra/prometheus/prometheus.yaml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 30s 3 | evaluation_interval: 25s 4 | 5 | # This config for the three-node single machine deploys. 6 | # Change this for production, where prometheus only watches a single node. 7 | scrape_configs: 8 | - job_name: "prometheus1" 9 | static_configs: 10 | - targets: [ 11 | # note the ports are the container internal values since we are using the network domain resolution 12 | "validator-0-fendermint:9184", 13 | "validator-1-fendermint:9184", 14 | "validator-2-fendermint:9184", 15 | "validator-0-ethapi:9185", 16 | "validator-1-ethapi:9185", 17 | "validator-2-ethapi:9185", 18 | "validator-0-objects:9186", 19 | "validator-1-objects:9186", 20 | "validator-2-objects:9186", 21 | "prometheus:9090", 22 | "relayer:9184" 23 | ] 24 | -------------------------------------------------------------------------------- /fendermint/testing/contracts/Greeter.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.19; 3 | 4 | contract Greeter { 5 | string private greeting; 6 | 7 | event GreetingSet(string greeting); 8 | 9 | //This constructor assigns the initial greeting and emit GreetingSet event 10 | constructor(string memory _greeting) { 11 | greeting = _greeting; 12 | 13 | emit GreetingSet(_greeting); 14 | } 15 | 16 | //This function returns the current value stored in greeting variable 17 | function greet() public view returns (string memory) { 18 | return greeting; 19 | } 20 | 21 | //This function sets the new greeting msg from the one passed down as parameter and emit event 22 | function setGreeting(string memory _greeting) public { 23 | greeting = _greeting; 24 | 25 | emit GreetingSet(_greeting); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /fendermint/testing/Makefile: -------------------------------------------------------------------------------- 1 | TEST_CONTRACTS_DIR = contracts 2 | TEST_CONTRACTS_SOL = $(shell find $(TEST_CONTRACTS_DIR) -type f -name "*.sol") 3 | TEST_CONTRACTS_BIN = $(TEST_CONTRACTS_SOL:.sol=.bin) 4 | 5 | .PHONY: all 6 | all: \ 7 | test-contracts 8 | 9 | # Compile all Solidity test contracts. 10 | # This could also be achieved with https://docs.rs/ethers/latest/ethers/solc/ 11 | .PHONY: test-contracts 12 | test-contracts: $(TEST_CONTRACTS_BIN) 13 | 14 | # Compile a Solidity test contract 15 | $(TEST_CONTRACTS_DIR)/%.bin: $(TEST_CONTRACTS_DIR)/%.sol | solc 16 | solc --bin --bin-runtime --abi --storage-layout --hashes --overwrite $< -o $(TEST_CONTRACTS_DIR) 17 | 18 | # Requirements checks. 19 | 20 | .PHONY: solc 21 | solc: 22 | @if [ -z "$(shell which solc)" ]; then \ 23 | echo "Please install solc, the Solidity compiler. See https://github.com/crytic/solc-select"; \ 24 | exit 1; \ 25 | fi 26 | -------------------------------------------------------------------------------- /ipld/resolver/src/hash.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // Copyright 2019-2022 ChainSafe Systems 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | 6 | use blake2b_simd::Params; 7 | 8 | /// Generates BLAKE2b hash of fixed 32 bytes size. 9 | pub fn blake2b_256(ingest: &[u8]) -> [u8; 32] { 10 | let digest = Params::new() 11 | .hash_length(32) 12 | .to_state() 13 | .update(ingest) 14 | .finalize(); 15 | 16 | let mut ret = [0u8; 32]; 17 | ret.clone_from_slice(digest.as_bytes()); 18 | ret 19 | } 20 | 21 | #[cfg(test)] 22 | mod tests { 23 | use super::*; 24 | 25 | #[test] 26 | fn vector_hashing() { 27 | let ing_vec = vec![1, 2, 3]; 28 | 29 | assert_eq!(blake2b_256(&ing_vec), blake2b_256(&[1, 2, 3])); 30 | assert_ne!(blake2b_256(&ing_vec), blake2b_256(&[1, 2, 3, 4])); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/chain/ipc_bottom_up_resolve.txt: -------------------------------------------------------------------------------- 1 | Ipc(BottomUpResolve(SignedRelayedMessage { message: RelayedMessage { message: CertifiedMessage { message: BottomUpCheckpoint { subnet_id: SubnetID { root: 0, children: [Address("f410fj2l76kfc6alyjb37k4fbo4lfu4arpdiaieivlni"), Address("f00"), Address("f012702663363427057495")] }, height: 3212296455, next_validator_set_id: 8044964610287984515, bottom_up_messages: Cid(QmVcH4pmof5KUXj4bHqhY6RqVzp4uPVFCwiPggGnc34rgu) }, certificate: MultiSig { signatures: [ValidatorSignature { validator: Address("f414241827420121318507fx5ptqhsraq4757yb7j33lfi"), signature: Signature { sig_type: BLS, bytes: [110] } }] } }, relayer: Address("f22okqj55ufeumyxugaghvfxmujeaqcr3ycpu7tnq"), sequence: 16146861939630510588, gas_limit: 5085131330352947479, gas_fee_cap: TokenAmount(0.0), gas_premium: TokenAmount(0.0) }, signature: Signature { sig_type: BLS, bytes: [145, 151, 189, 71, 207, 170, 255, 223, 79] } })) -------------------------------------------------------------------------------- /fendermint/vm/iroh_resolver/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_vm_iroh_resolver" 3 | description = "Resolve iroh content in messages" 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | anyhow = { workspace = true } 11 | async-stm = { workspace = true } 12 | hex = { workspace = true } 13 | im = { workspace = true } 14 | iroh = { workspace = true } 15 | iroh-blobs = { workspace = true } 16 | libp2p = { workspace = true } 17 | prometheus = { workspace = true } 18 | serde = { workspace = true } 19 | tracing = { workspace = true } 20 | tokio = { workspace = true } 21 | 22 | ipc-api = { workspace = true } 23 | ipc_ipld_resolver = { workspace = true } 24 | ipc-observability = { workspace = true } 25 | 26 | fendermint_vm_topdown = { path = "../topdown" } 27 | 28 | [dev-dependencies] 29 | rand = { workspace = true } 30 | tokio = { workspace = true } 31 | -------------------------------------------------------------------------------- /ipc/api/src/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | use thiserror::Error; 4 | 5 | #[derive(Debug, Error, PartialEq, Eq)] 6 | pub enum Error { 7 | #[error("invalid subnet id {0}: {1}")] 8 | InvalidID(String, String), 9 | #[error("invalid IPC address")] 10 | InvalidIPCAddr, 11 | #[error("fvm shared address error")] 12 | FVMAddressError(fvm_shared::address::Error), 13 | 14 | #[cfg(feature = "fil-actor")] 15 | #[error("actor error")] 16 | Actor(fil_actors_runtime::ActorError), 17 | } 18 | 19 | #[cfg(feature = "fil-actor")] 20 | impl From for Error { 21 | fn from(e: fil_actors_runtime::ActorError) -> Self { 22 | Self::Actor(e) 23 | } 24 | } 25 | 26 | impl From for Error { 27 | fn from(e: fvm_shared::address::Error) -> Self { 28 | Error::FVMAddressError(e) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ipc/observability/src/observe.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use crate::{ 5 | impl_traceable, impl_traceables, lazy_static, register_metrics, Recordable, TraceLevel, 6 | Traceable, 7 | }; 8 | use anyhow; 9 | use prometheus::{register_int_counter_vec, IntCounterVec, Registry}; 10 | 11 | register_metrics! { 12 | TRACING_ERRORS: IntCounterVec 13 | = register_int_counter_vec!("tracing_errors", "Number of tracing errors", &["event"]); 14 | } 15 | 16 | impl_traceables!(TraceLevel::Error, "System", TracingError<'a>); 17 | 18 | #[derive(Debug)] 19 | pub struct TracingError<'a> { 20 | pub affected_event: &'a str, 21 | pub reason: String, 22 | } 23 | 24 | impl Recordable for TracingError<'_> { 25 | fn record_metrics(&self) { 26 | TRACING_ERRORS 27 | .with_label_values(&[self.affected_event]) 28 | .inc(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /fendermint/testing/benchmarks/state-size/scripts/make-measurements.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | PORT_RANGES_FROM=$(cat $MATERIALIZER_DIR/materializer-state.json | jq ".port_ranges.\"testnets/$TESTNET_ID/root/nodes/$NODE_ID\".from") 6 | COMETBFT_RPC_PORT=$(($PORT_RANGES_FROM + 57)) 7 | 8 | latest_block_height() { 9 | curl -s http://localhost:30657/status \ 10 | | jq -r ".result.sync_info.latest_block_height" 11 | } 12 | 13 | current_db_size() { 14 | du $ROCKSDB_DIR | awk '{print $1;}' 15 | } 16 | 17 | rm -rf $MEASUREMENTS_FILE 18 | 19 | echo "appending measurements every ${MEASUREMENTS_PERIOD_SECS}s to ${MEASUREMENTS_FILE}; Ctrl+C to exit..." 20 | START_TIME=$(date +%s) 21 | 22 | while true 23 | do 24 | TS=$(date +%s); 25 | LBH=$(latest_block_height); 26 | DBS=$(current_db_size); 27 | echo "{\"timestamp\": $TS, \"block_height\": $LBH, \"db_size_kb\": $DBS}" >> $MEASUREMENTS_FILE; 28 | sleep $MEASUREMENTS_PERIOD_SECS; 29 | done 30 | -------------------------------------------------------------------------------- /infra/fendermint/scripts/grafana.toml: -------------------------------------------------------------------------------- 1 | [tasks.grafana-run] 2 | script = """ 3 | mkdir -p $GRAFANA_DIR 4 | docker run \ 5 | ${FLAGS} \ 6 | --name ${GRAFANA_CONTAINER_NAME} \ 7 | --init \ 8 | --user $(id -u) \ 9 | --network ${NETWORK_NAME} \ 10 | --publish ${GRAFANA_HOST_PORT}:3000 \ 11 | --volume ${GRAFANA_DIR}:/var/lib/grafana \ 12 | ${GRAFANA_DOCKER_IMAGE} 13 | """ 14 | 15 | [tasks.grafana-start] 16 | extend = "grafana-run" 17 | env = { "FLAGS" = "-d" } 18 | 19 | [tasks.grafana-restart] 20 | extend = "grafana-run" 21 | env = { "FLAGS" = "-d" } 22 | dependencies = ["grafana-destroy"] 23 | 24 | [tasks.grafana-stop] 25 | env = { "CONTAINER_NAME" = "${GRAFANA_CONTAINER_NAME}" } 26 | run_task = "docker-stop" 27 | 28 | [tasks.grafana-destroy] 29 | env = { "CONTAINER_NAME" = "${GRAFANA_CONTAINER_NAME}" } 30 | run_task = "docker-destroy" 31 | 32 | [tasks.grafana-logs] 33 | extend = "docker-logs" 34 | env = { "CONTAINER_NAME" = "${GRAFANA_CONTAINER_NAME}" } 35 | -------------------------------------------------------------------------------- /ipc/wallet/src/fvm/errors.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | // Copyright 2019-2023 ChainSafe Systems 4 | // SPDX-License-Identifier: Apache-2.0, MIT 5 | 6 | use std::io; 7 | 8 | use thiserror::Error; 9 | 10 | #[derive(Debug, PartialEq, Eq, Error)] 11 | pub enum Error { 12 | /// info that corresponds to key does not exist 13 | #[error("Key info not found")] 14 | KeyInfo, 15 | /// Key already exists in key store 16 | #[error("Key already exists")] 17 | KeyExists, 18 | #[error("Key does not exist")] 19 | KeyNotExists, 20 | #[error("Key not found")] 21 | NoKey, 22 | #[error("IO Error: {0}")] 23 | IO(String), 24 | #[error("{0}")] 25 | Other(String), 26 | #[error("Could not convert from KeyInfo to Key")] 27 | KeyInfoConversion, 28 | } 29 | 30 | impl From for Error { 31 | fn from(f: io::Error) -> Self { 32 | Error::IO(f.to_string()) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /fendermint/actors/machine/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_actor_machine" 3 | description = "Shared types for ADM machine actors" 4 | license.workspace = true 5 | edition.workspace = true 6 | authors.workspace = true 7 | version = "0.1.0" 8 | 9 | [lib] 10 | crate-type = ["cdylib", "lib"] 11 | 12 | [dependencies] 13 | anyhow = { workspace = true } 14 | fil_actors_runtime = { workspace = true } 15 | fil_actor_adm = { workspace = true } 16 | frc42_dispatch = { workspace = true } 17 | fvm_ipld_blockstore = { workspace = true } 18 | fvm_ipld_encoding = { workspace = true } 19 | fvm_shared = { workspace = true } 20 | recall_sol_facade = { workspace = true, features = ["machine"] } 21 | serde = { workspace = true, features = ["derive"] } 22 | 23 | recall_actor_sdk = { path = "../../../recall/actor_sdk" } 24 | 25 | [dev-dependencies] 26 | fil_actors_runtime = { workspace = true, features = ["test_utils"] } 27 | 28 | [features] 29 | fil-actor = ["fil_actors_runtime/fil-actor"] 30 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/shared/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_actor_blobs_shared" 3 | description = "Shared resources for blobs" 4 | license.workspace = true 5 | edition.workspace = true 6 | authors.workspace = true 7 | version = "0.1.0" 8 | 9 | [lib] 10 | ## lib is necessary for integration tests 11 | ## cdylib is necessary for Wasm build 12 | crate-type = ["cdylib", "lib"] 13 | 14 | [dependencies] 15 | anyhow = { workspace = true } 16 | data-encoding = { workspace = true } 17 | fil_actors_runtime = { workspace = true } 18 | frc42_dispatch = { workspace = true } 19 | fvm_ipld_encoding = { workspace = true } 20 | fvm_shared = { workspace = true } 21 | num-derive = { workspace = true } 22 | num-traits = { workspace = true } 23 | serde = { workspace = true, features = ["derive"] } 24 | 25 | recall_ipld = { path = "../../../../recall/ipld" } 26 | 27 | [dev-dependencies] 28 | blake3 = { workspace = true } 29 | 30 | [features] 31 | fil-actor = ["fil_actors_runtime/fil-actor"] 32 | -------------------------------------------------------------------------------- /ipld/resolver/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all build test lint license check-fmt check-clippy diagrams 2 | 3 | CRATE := ipc_ipld_resolver 4 | PACKAGE := $(patsubst %, --package %, $(CRATE)) 5 | 6 | all: test build 7 | 8 | build: 9 | cargo build -Z unstable-options --release 10 | 11 | test: 12 | cargo test --release $(PACKAGE) 13 | 14 | clean: 15 | cargo clean 16 | 17 | lint: \ 18 | check-fmt \ 19 | check-clippy 20 | 21 | check-fmt: 22 | @# `nightly` is required to support ignore list in rustfmt.toml 23 | rustup install nightly-2024-09-20 24 | rustup component add --toolchain nightly-2024-09-20 rustfmt 25 | cargo +nightly-2024-09-20 fmt $(PACKAGE) --check 26 | 27 | check-clippy: 28 | cargo clippy $(PACKAGE) --tests --no-deps -- -D clippy::all 29 | 30 | diagrams: 31 | $(MAKE) -C docs/diagrams 32 | 33 | check-diagrams: diagrams 34 | if git diff --name-only docs/diagrams | grep .png; then \ 35 | echo "There are uncommitted changes to the diagrams"; \ 36 | exit 1; \ 37 | fi 38 | -------------------------------------------------------------------------------- /fendermint/actors/chainmetadata/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_actor_chainmetadata" 3 | description = "Actor for storing chain metadata" 4 | license.workspace = true 5 | edition.workspace = true 6 | authors.workspace = true 7 | version = "0.1.0" 8 | 9 | [lib] 10 | crate-type = ["cdylib", "lib"] 11 | 12 | [dependencies] 13 | cid = { workspace = true, default-features = false } 14 | fil_actors_runtime = { workspace = true, optional = true, features = [ 15 | "fil-actor", 16 | ] } 17 | fvm_shared = { workspace = true } 18 | fvm_ipld_encoding = { workspace = true } 19 | fvm_ipld_blockstore = { workspace = true } 20 | fvm_ipld_amt = { workspace = true } 21 | num-derive = { workspace = true } 22 | serde = { workspace = true, features = ["derive"] } 23 | serde_tuple = { workspace = true } 24 | num-traits = { workspace = true } 25 | frc42_dispatch = { workspace = true } 26 | anyhow = { workspace = true } 27 | 28 | [features] 29 | default = [] 30 | fil-actor = ["fil_actors_runtime"] 31 | -------------------------------------------------------------------------------- /fendermint/vm/event/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | pub type BlockHeight = u64; 5 | /// Hex encoded block hash. 6 | pub type BlockHashHex<'a> = &'a str; 7 | 8 | #[derive(Debug, Default)] 9 | pub struct ParentFinalityCommitted<'a> { 10 | pub block_height: BlockHeight, 11 | pub block_hash: BlockHashHex<'a>, 12 | } 13 | 14 | #[derive(Debug, Default)] 15 | pub struct NewBottomUpCheckpoint<'a> { 16 | pub block_height: BlockHeight, 17 | pub block_hash: BlockHashHex<'a>, 18 | pub num_msgs: usize, 19 | pub next_configuration_number: u64, 20 | } 21 | 22 | /// This node sees something as final, but it's missing the quorum for it. 23 | /// 24 | /// The opposite does not happen because we only look for quorum for things we see as final. 25 | #[derive(Debug, Default)] 26 | pub struct ParentFinalityMissingQuorum<'a> { 27 | pub block_height: BlockHeight, 28 | pub block_hash: BlockHashHex<'a>, 29 | } 30 | -------------------------------------------------------------------------------- /contracts/ops/chain-id.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | set -o pipefail 4 | 5 | # Check if RPC_URL is set 6 | if [[ -z "$RPC_URL" ]]; then 7 | echo "RPC_URL is not set. Sourcing .env file..." 8 | source .env 9 | fi 10 | 11 | # Make a JSON-RPC call to get the chain ID using curl 12 | response=$(curl -s -X POST -H "Content-Type: application/json" --data '{ 13 | "jsonrpc":"2.0", 14 | "method":"eth_chainId", 15 | "params":[], 16 | "id":1 17 | }' $RPC_URL) 18 | 19 | # Extract the chain ID from the response using jq (ensure jq is installed) 20 | chain_id=$(echo $response | jq -r '.result') 21 | 22 | # Double-check that this is a valid chain-id 23 | if [[ "$chain_id" =~ ^0x[0-9a-fA-F]+$ ]]; then 24 | # Export the chain ID as an environmental variable 25 | export CHAIN_ID=$chain_id 26 | # Print the chain ID for verification (optional) 27 | echo "[*] Target network Chain ID: $CHAIN_ID" 28 | else 29 | echo "[*] Error getting a valid hexadecimal chain ID" 30 | exit 1 31 | fi 32 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/diamond.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | //! Helper data structures to declare diamond pattern contracts. 4 | 5 | // See https://medium.com/@MarqyMarq/how-to-implement-the-diamond-standard-69e87dae44e6 6 | 7 | use std::collections::HashMap; 8 | 9 | use ethers::abi::Abi; 10 | use fvm_shared::ActorID; 11 | 12 | #[derive(Clone, Debug)] 13 | pub struct EthFacet { 14 | pub name: &'static str, 15 | pub abi: Abi, 16 | } 17 | 18 | /// Top level Ethereum contract with a pre-determined ID. 19 | #[derive(Clone, Debug)] 20 | pub struct EthContract { 21 | /// Pre-determined ID for the contract. 22 | /// 23 | /// 0 means the contract will get a dynamic ID. 24 | pub actor_id: ActorID, 25 | pub abi: Abi, 26 | /// List of facets if the contract is using the diamond pattern. 27 | pub facets: Vec, 28 | } 29 | 30 | pub type EthContractMap = HashMap<&'static str, EthContract>; 31 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/system.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | use cid::Cid; 4 | use fvm_ipld_encoding::tuple::*; 5 | use fvm_shared::address::Address; 6 | use lazy_static::lazy_static; 7 | 8 | use crate::eam::EthAddress; 9 | 10 | define_singleton!(SYSTEM { id: 0, code_id: 1 }); 11 | 12 | lazy_static! { 13 | /// The Ethereum null-address 0x00..00 can also be used to identify the system actor. 14 | pub static ref SYSTEM_ACTOR_ETH_ADDR: Address = EthAddress::default().into(); 15 | } 16 | 17 | /// Check whether the address is one of those identifying the system actor. 18 | pub fn is_system_addr(addr: &Address) -> bool { 19 | *addr == SYSTEM_ACTOR_ADDR || *addr == *SYSTEM_ACTOR_ETH_ADDR 20 | } 21 | 22 | /// System actor state. 23 | #[derive(Default, Deserialize_tuple, Serialize_tuple, Debug, Clone)] 24 | pub struct State { 25 | // builtin actor registry: Vec<(String, Cid)> 26 | pub builtin_actors: Cid, 27 | } 28 | -------------------------------------------------------------------------------- /fendermint/vm/interpreter/src/fvm/store/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | use cid::Cid; 4 | use fvm_ipld_blockstore::Blockstore; 5 | use fvm_shared::EMPTY_ARR_CID; 6 | 7 | pub mod memory; 8 | 9 | #[derive(Clone)] 10 | pub struct ReadOnlyBlockstore(DB); 11 | 12 | impl ReadOnlyBlockstore { 13 | pub fn new(store: DB) -> Self { 14 | Self(store) 15 | } 16 | } 17 | 18 | impl Blockstore for ReadOnlyBlockstore 19 | where 20 | DB: Blockstore + Clone, 21 | { 22 | fn get(&self, k: &Cid) -> anyhow::Result>> { 23 | self.0.get(k) 24 | } 25 | 26 | fn put_keyed(&self, k: &Cid, block: &[u8]) -> anyhow::Result<()> { 27 | // The FVM inserts this each time to make sure it exists. 28 | if *k == EMPTY_ARR_CID { 29 | return self.0.put_keyed(k, block); 30 | } 31 | panic!("never intended to use put on the read-only blockstore") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /contracts/test/helpers/FvmAddressHelper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import "forge-std/Test.sol"; 5 | import "forge-std/console.sol"; 6 | 7 | import "../../contracts/lib/FvmAddressHelper.sol"; 8 | import {FvmAddress} from "../../contracts/structs/FvmAddress.sol"; 9 | 10 | contract FvmAddressHelperTest is Test { 11 | using FvmAddressHelper for FvmAddress; 12 | 13 | function iToHex(bytes memory buffer) internal pure returns (string memory) { 14 | // Fixed buffer size for hexadecimal convertion 15 | bytes memory converted = new bytes(buffer.length * 2); 16 | 17 | bytes memory _base = "0123456789abcdef"; 18 | 19 | for (uint256 i = 0; i < buffer.length; i++) { 20 | converted[i * 2] = _base[uint8(buffer[i]) / _base.length]; 21 | converted[i * 2 + 1] = _base[uint8(buffer[i]) % _base.length]; 22 | } 23 | 24 | return string.concat("0x", string(converted)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /infra/fendermint/scripts/loki.toml: -------------------------------------------------------------------------------- 1 | [tasks.loki-run] 2 | script = """ 3 | mkdir -p $LOKI_DIR 4 | docker run \ 5 | ${FLAGS} \ 6 | --name ${LOKI_CONTAINER_NAME} \ 7 | --init \ 8 | --user $(id -u) \ 9 | --network ${NETWORK_NAME} \ 10 | --publish 127.0.0.1:${LOKI_HOST_PORT}:3100 \ 11 | --volume ${LOKI_DIR}:/loki \ 12 | --volume ${LOKI_CONFIG_FOLDER}:/mnt/config \ 13 | ${LOKI_DOCKER_IMAGE} -config.file=/mnt/config/loki-config.yaml 14 | """ 15 | 16 | [tasks.loki-start] 17 | extend = "loki-run" 18 | env = { "FLAGS" = "-d" } 19 | 20 | [tasks.loki-restart] 21 | extend = "loki-run" 22 | env = { "FLAGS" = "-d" } 23 | dependencies = ["loki-destroy"] 24 | 25 | [tasks.loki-stop] 26 | env = { "CONTAINER_NAME" = "${LOKI_CONTAINER_NAME}" } 27 | run_task = "docker-stop" 28 | 29 | [tasks.loki-destroy] 30 | env = { "CONTAINER_NAME" = "${LOKI_CONTAINER_NAME}" } 31 | run_task = "docker-destroy" 32 | 33 | [tasks.loki-logs] 34 | extend = "docker-logs" 35 | env = { "CONTAINER_NAME" = "${LOKI_CONTAINER_NAME}" } 36 | -------------------------------------------------------------------------------- /ipc/types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | description = "The primitive types for fvm" 3 | edition = "2021" 4 | name = "ipc-types" 5 | version = "0.1.0" 6 | 7 | [dependencies] 8 | fvm_ipld_amt = { workspace = true } 9 | fvm_ipld_blockstore = { workspace = true } 10 | fvm_ipld_encoding = { workspace = true } 11 | fvm_ipld_hamt = { workspace = true } 12 | fvm_shared = { workspace = true } 13 | 14 | anyhow = { workspace = true } 15 | cid = { workspace = true, default-features = false, features = ["serde-codec"] } 16 | hex = { workspace = true } 17 | indexmap = { version = "1.8.0", features = ["serde-1"] } 18 | integer-encoding = { workspace = true, default-features = false } 19 | lazy_static = { workspace = true } 20 | log = { workspace = true } 21 | num-derive = { workspace = true } 22 | num-traits = { workspace = true } 23 | serde = { workspace = true, features = ["derive"] } 24 | uint = { version = "0.9.3", default-features = false } 25 | thiserror = { workspace = true } 26 | 27 | [features] 28 | fil-actor = [] 29 | -------------------------------------------------------------------------------- /ipc/api/src/gateway.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | 4 | /// This type definitions are borrowed from 5 | /// https://github.com/consensus-shipyard/ipc-actors/tree/main/gateway 6 | /// to ensure that they are in sync in this project. 7 | /// However, we should either deprecate the native actors, or make 8 | /// them use the types from this sdk directly. 9 | /// 10 | use crate::subnet_id::SubnetID; 11 | use cid::Cid; 12 | use fvm_ipld_encoding::tuple::{Deserialize_tuple, Serialize_tuple}; 13 | use fvm_shared::address::Address; 14 | 15 | #[derive(Serialize_tuple, Deserialize_tuple, Clone)] 16 | pub struct FundParams { 17 | pub subnet: SubnetID, 18 | pub to: Address, 19 | } 20 | 21 | #[derive(Serialize_tuple, Deserialize_tuple, Clone)] 22 | pub struct ReleaseParams { 23 | pub to: Address, 24 | } 25 | 26 | #[derive(Serialize_tuple, Deserialize_tuple, Clone)] 27 | pub struct PropagateParams { 28 | /// The postbox message cid 29 | pub postbox_cid: Cid, 30 | } 31 | -------------------------------------------------------------------------------- /.github/actions/setup-cache/action.yaml: -------------------------------------------------------------------------------- 1 | name: Setup Cache 2 | description: "Setup Rust artifact caching" 3 | inputs: 4 | cache-prefix: 5 | description: "Caching key used for matching caches" 6 | required: true 7 | cache-suffix: 8 | description: "Caching suffix used to make keys unique and force uploads" 9 | required: true 10 | 11 | runs: 12 | using: "composite" 13 | 14 | steps: 15 | - name: Setup sccache 16 | # uses: hanabi1224/sccache-action@v1.2.0 # https://github.com/hanabi1224/sccache-action used by Forest. 17 | uses: consensus-shipyard/sccache-action@fendermint 18 | with: 19 | release-name: v0.3.1 20 | cache-key: ${{ inputs.cache-prefix }} 21 | cache-suffix: ${{ inputs.cache-suffix }} 22 | # We should never have to update a cache as long as we use unique suffixes, it happens automatically. 23 | cache-update: false 24 | # Don't append the date to the cache, the unique suffix should take care of it. 25 | cache-date: false 26 | -------------------------------------------------------------------------------- /ipc/cli/src/commands/config/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | //! This mod triggers a config reload in the IPC-Agent Json RPC server. 4 | 5 | mod init; 6 | 7 | use clap::{Args, Subcommand}; 8 | use std::fmt::Debug; 9 | 10 | use crate::commands::config::init::{InitConfig, InitConfigArgs}; 11 | use crate::{CommandLineHandler, GlobalArguments}; 12 | 13 | #[derive(Debug, Args)] 14 | #[command(name = "config", about = "config related commands")] 15 | #[command(args_conflicts_with_subcommands = true)] 16 | pub(crate) struct ConfigCommandsArgs { 17 | #[command(subcommand)] 18 | command: Commands, 19 | } 20 | 21 | impl ConfigCommandsArgs { 22 | pub async fn handle(&self, global: &GlobalArguments) -> anyhow::Result<()> { 23 | match &self.command { 24 | Commands::Init(args) => InitConfig::handle(global, args).await, 25 | } 26 | } 27 | } 28 | 29 | #[derive(Debug, Subcommand)] 30 | pub(crate) enum Commands { 31 | Init(InitConfigArgs), 32 | } 33 | -------------------------------------------------------------------------------- /fendermint/actors/blobs/shared/src/blobs/status.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Recall Contributors 2 | // Copyright 2021-2023 Protocol Labs 3 | // SPDX-License-Identifier: Apache-2.0, MIT 4 | 5 | use serde::{Deserialize, Serialize}; 6 | 7 | /// The status of a blob. 8 | #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] 9 | pub enum BlobStatus { 10 | /// Blob is added but not resolving. 11 | #[default] 12 | Added, 13 | /// Blob is pending resolve. 14 | Pending, 15 | /// Blob was successfully resolved. 16 | Resolved, 17 | /// Blob resolution failed. 18 | Failed, 19 | } 20 | 21 | impl std::fmt::Display for BlobStatus { 22 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 23 | match self { 24 | BlobStatus::Added => write!(f, "added"), 25 | BlobStatus::Pending => write!(f, "pending"), 26 | BlobStatus::Resolved => write!(f, "resolved"), 27 | BlobStatus::Failed => write!(f, "failed"), 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /fendermint/docker/builder.local.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # Builder 4 | FROM rust:1.81.0-bookworm AS builder 5 | 6 | RUN apt-get update && \ 7 | apt-get install -y build-essential clang cmake protobuf-compiler && \ 8 | rm -rf /var/lib/apt/lists/* 9 | 10 | WORKDIR /app 11 | 12 | COPY . . 13 | 14 | # Mounting speeds up local builds, but it doesn't get cached between builds on CI. 15 | # OTOH it seems like one platform build can be blocked trying to acquire a lock on the build directory, 16 | # so for cross builds this is probably not a good idea. 17 | ARG RUST_VERSION=1.81.0 18 | RUN --mount=type=cache,target=target \ 19 | --mount=type=cache,target=$RUSTUP_HOME,from=rust,source=$RUSTUP_HOME \ 20 | --mount=type=cache,target=$CARGO_HOME,from=rust,source=$CARGO_HOME \ 21 | rustup toolchain install ${RUST_VERSION} --no-self-update &&\ 22 | rustup target add wasm32-unknown-unknown &&\ 23 | cargo install --locked --root output --path fendermint/app &&\ 24 | cargo install --locked --root output --path ipc/cli 25 | -------------------------------------------------------------------------------- /ipc/cli/src/commands/util/f4.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | //! F4 address util 4 | 5 | use async_trait::async_trait; 6 | use clap::Args; 7 | use fvm_shared::address::Address; 8 | use ipc_types::EthAddress; 9 | use std::fmt::Debug; 10 | use std::str::FromStr; 11 | 12 | use crate::{CommandLineHandler, GlobalArguments}; 13 | 14 | pub(crate) struct EthToF4Addr; 15 | 16 | #[async_trait] 17 | impl CommandLineHandler for EthToF4Addr { 18 | type Arguments = EthToF4AddrArgs; 19 | 20 | async fn handle(_global: &GlobalArguments, arguments: &Self::Arguments) -> anyhow::Result<()> { 21 | let eth_addr = EthAddress::from_str(&arguments.addr)?; 22 | log::info!("f4 address: {}", Address::from(eth_addr)); 23 | Ok(()) 24 | } 25 | } 26 | 27 | #[derive(Debug, Args)] 28 | #[command(about = "Get F4 for an Ethereum address")] 29 | pub(crate) struct EthToF4AddrArgs { 30 | #[arg(long, help = "Ethereum address to get the underlying f4 addr from")] 31 | pub addr: String, 32 | } 33 | -------------------------------------------------------------------------------- /ipld/resolver/src/arb.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | use fvm_shared::address::Address; 4 | use ipc_api::subnet_id::SubnetID; 5 | use quickcheck::Arbitrary; 6 | 7 | #[derive(Clone, Debug)] 8 | pub struct ArbSubnetID(pub SubnetID); 9 | 10 | impl Arbitrary for ArbSubnetID { 11 | fn arbitrary(g: &mut quickcheck::Gen) -> Self { 12 | let child_count = usize::arbitrary(g) % 4; 13 | 14 | let children = (0..child_count) 15 | .map(|_| { 16 | if bool::arbitrary(g) { 17 | Address::new_id(u64::arbitrary(g)) 18 | } else { 19 | // Only expectign EAM managed delegated addresses. 20 | let subaddr: [u8; 20] = std::array::from_fn(|_| Arbitrary::arbitrary(g)); 21 | Address::new_delegated(10, &subaddr).unwrap() 22 | } 23 | }) 24 | .collect::>(); 25 | 26 | Self(SubnetID::new(u64::arbitrary(g), children)) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /fendermint/testing/scripts/common.env: -------------------------------------------------------------------------------- 1 | CMT_DOCKER_IMAGE="cometbft/cometbft:v0.37.x" 2 | PROMTAIL_DOCKER_IMAGE="grafana/promtail:latest" 3 | CMT_CONTAINER_NAME="${NETWORK_NAME}-cometbft" 4 | FM_CONTAINER_NAME="${NETWORK_NAME}-fendermint" 5 | ETHAPI_CONTAINER_NAME="${NETWORK_NAME}-ethapi" 6 | PROMTAIL_CONTAINER_NAME="${NETWORK_NAME}-promtail" 7 | FM_NETWORK=main 8 | FM_LOG_LEVEL=info 9 | ETHAPI_LOG_LEVEL=debug 10 | # If this wasn't present, any wait task is skipped. 11 | CARGO_MAKE_WAIT_MILLISECONDS=5000 12 | # This wait time seems to work locally. 13 | CMT_WAIT_MILLIS=10000 14 | # Keep example logs to a minimum. 15 | VERBOSITY="" 16 | ROOT_SCRIPTS_DIR="${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/fendermint/testing/scripts" 17 | TEST_SCRIPTS_DIR="${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/fendermint/testing/${TEST_DIR}/scripts" 18 | TEST_DATA_DIR="${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/fendermint/testing/${TEST_DIR}/test-data" 19 | NODE_NAME=node-0 20 | CMT_DIR=${TEST_DATA_DIR}/${NODE_NAME}/cometbft 21 | BASE_DIR=${TEST_DATA_DIR} 22 | ENV_FILE=${BASE_DIR}/.env 23 | -------------------------------------------------------------------------------- /contracts/contracts/subnet/SubnetActorRewardFacet.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 2 | pragma solidity ^0.8.23; 3 | 4 | import {QuorumObjKind} from "../structs/Quorum.sol"; 5 | import {Pausable} from "../lib/LibPausable.sol"; 6 | import {ReentrancyGuard} from "../lib/LibReentrancyGuard.sol"; 7 | import {SubnetActorModifiers} from "../lib/LibSubnetActorStorage.sol"; 8 | import {LibStaking} from "../lib/LibStaking.sol"; 9 | import {LibSubnetActor} from "../lib/LibSubnetActor.sol"; 10 | import {AssetHelper} from "../lib/AssetHelper.sol"; 11 | import {Asset} from "../structs/Subnet.sol"; 12 | 13 | contract SubnetActorRewardFacet is SubnetActorModifiers, ReentrancyGuard, Pausable { 14 | using AssetHelper for Asset; 15 | 16 | /// @notice Validator claims their released collateral. 17 | function claim() external nonReentrant whenNotPaused { 18 | uint256 amount = LibStaking.claimCollateral(msg.sender); 19 | if (amount > 0) { 20 | s.collateralSource.transferFunds(payable(msg.sender), amount); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /fendermint/actors/activity-tracker/src/types.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021-2023 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use fvm_ipld_encoding::tuple::{Deserialize_tuple, Serialize_tuple}; 5 | use fvm_shared::address::Address; 6 | use std::collections::HashMap; 7 | 8 | #[derive(Deserialize_tuple, Serialize_tuple, Debug, Clone, PartialEq, Eq, Default)] 9 | pub struct AggregatedStats { 10 | pub total_active_validators: u64, 11 | pub total_num_blocks_committed: u64, 12 | } 13 | 14 | #[derive(Deserialize_tuple, Serialize_tuple, Debug, Clone, PartialEq, Eq, Default)] 15 | pub struct FullConsensusSummary { 16 | pub stats: AggregatedStats, 17 | pub data: HashMap, 18 | } 19 | 20 | #[derive(Deserialize_tuple, Serialize_tuple, Debug, Clone, PartialEq, Eq, Default)] 21 | pub struct FullActivityRollup { 22 | pub consensus: FullConsensusSummary, 23 | } 24 | 25 | #[derive(Deserialize_tuple, Serialize_tuple, Debug, Clone, PartialEq, Eq, Default)] 26 | pub struct ValidatorStats { 27 | pub blocks_committed: u64, 28 | } 29 | -------------------------------------------------------------------------------- /fendermint/vm/actor_interface/src/cron.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | use fvm_ipld_encoding::tuple::*; 4 | use fvm_shared::address::Address; 5 | use fvm_shared::MethodNum; 6 | use fvm_shared::METHOD_CONSTRUCTOR; 7 | 8 | define_singleton!(CRON { id: 3, code_id: 3 }); 9 | 10 | /// Cron actor methods available. 11 | #[repr(u64)] 12 | pub enum Method { 13 | Constructor = METHOD_CONSTRUCTOR, 14 | EpochTick = 2, 15 | } 16 | 17 | /// Cron actor state which holds entries to call during epoch tick 18 | #[derive(Default, Serialize_tuple, Deserialize_tuple, Clone, Debug)] 19 | pub struct State { 20 | /// Entries is a set of actors (and corresponding methods) to call during EpochTick. 21 | pub entries: Vec, 22 | } 23 | 24 | #[derive(Clone, PartialEq, Eq, Debug, Serialize_tuple, Deserialize_tuple)] 25 | pub struct Entry { 26 | /// The actor to call (ID address) 27 | pub receiver: Address, 28 | /// The method number to call (must accept empty parameters) 29 | pub method_num: MethodNum, 30 | } 31 | -------------------------------------------------------------------------------- /fendermint/testing/README.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | The `fendermint_testing` crate (ie. the current directory) provides some reusable utilities that can be imported into _other_ tests. These are behind feature flags: 4 | 5 | * `golden`: helper functions for writing tests with golden files 6 | * `arb`: provides `quickcheck::Arbitrary` instances for some things which are problematic in the FVM library, such as `Address` and `TokenAmount`. 7 | * `smt`: small framework for State Machine Testing (a.k.a. Model Testing) 8 | 9 | 10 | # End to end tests 11 | 12 | Beyond this, for no other reason than code organisation, the directory has sub-projects, which contain actual tests. 13 | 14 | For example the [smoke-test](./smoke-test/) is a a crate that uses `cargo make` to start a local stack with Tendermint and Fendermint running in Docker, and run some integration tests, which can be found in the [Makefile.toml](./smoke-test/Makefile.toml). 15 | 16 | To run these, either `cd` into that directory and run them from there, or run all from the root using `make e2e`, which also builds the docker images. 17 | -------------------------------------------------------------------------------- /ipc/wallet/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | 4 | use std::str::FromStr; 5 | 6 | use anyhow::anyhow; 7 | use serde::{Deserialize, Serialize}; 8 | 9 | mod evm; 10 | mod fvm; 11 | 12 | #[cfg(feature = "with-ethers")] 13 | pub use crate::evm::{random_eth_key_info, EthKeyAddress}; 14 | pub use crate::evm::{ 15 | KeyInfo as EvmKeyInfo, KeyStore as EvmKeyStore, PersistentKeyInfo, PersistentKeyStore, 16 | DEFAULT_KEYSTORE_NAME, 17 | }; 18 | pub use crate::fvm::*; 19 | 20 | /// WalletType determines the kind of keys and wallets 21 | /// supported in the keystore 22 | #[derive(Debug, Serialize, Deserialize)] 23 | #[serde(tag = "network_type")] 24 | pub enum WalletType { 25 | Evm, 26 | Fvm, 27 | } 28 | 29 | impl FromStr for WalletType { 30 | type Err = anyhow::Error; 31 | 32 | fn from_str(s: &str) -> Result { 33 | Ok(match s { 34 | "evm" => Self::Evm, 35 | "fvm" => Self::Fvm, 36 | _ => return Err(anyhow!("invalid wallet type")), 37 | }) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ipc/cli/src/commands/util/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | use crate::{CommandLineHandler, GlobalArguments}; 4 | 5 | use clap::{Args, Subcommand}; 6 | 7 | use self::eth::{F4ToEthAddr, F4ToEthAddrArgs}; 8 | use self::f4::{EthToF4Addr, EthToF4AddrArgs}; 9 | 10 | mod eth; 11 | mod f4; 12 | 13 | #[derive(Debug, Args)] 14 | #[command(name = "util", about = "util commands")] 15 | #[command(args_conflicts_with_subcommands = true)] 16 | pub(crate) struct UtilCommandsArgs { 17 | #[command(subcommand)] 18 | command: Commands, 19 | } 20 | 21 | impl UtilCommandsArgs { 22 | pub async fn handle(&self, global: &GlobalArguments) -> anyhow::Result<()> { 23 | match &self.command { 24 | Commands::EthToF4Addr(args) => EthToF4Addr::handle(global, args).await, 25 | Commands::F4ToEthAddr(args) => F4ToEthAddr::handle(global, args).await, 26 | } 27 | } 28 | } 29 | 30 | #[derive(Debug, Subcommand)] 31 | pub(crate) enum Commands { 32 | EthToF4Addr(EthToF4AddrArgs), 33 | F4ToEthAddr(F4ToEthAddrArgs), 34 | } 35 | -------------------------------------------------------------------------------- /deployment/docker/subnet-setup.Dockerfile: -------------------------------------------------------------------------------- 1 | # This image is used to set up a subnet. 2 | # It contains the required ipc-cli and fendermint versions and the foundry tools. 3 | 4 | ARG fendermint_image 5 | 6 | FROM $fendermint_image 7 | 8 | # Install foundry 9 | RUN set -ex; \ 10 | arch=$(uname -m | sed -e s/aarch64/arm64/ -e s/x86_64/amd64/); \ 11 | curl -Lo /tmp/tt.tgz https://github.com/foundry-rs/foundry/releases/download/stable/foundry_stable_linux_${arch}.tar.gz && \ 12 | tar xvf /tmp/tt.tgz -C /bin && \ 13 | rm /tmp/tt.tgz 14 | 15 | 16 | ARG NODE_VERSION=22.14.0 17 | 18 | # Install build tools 19 | RUN set -ex; \ 20 | apt update; \ 21 | apt install -y git make python3 build-essential; \ 22 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash; 23 | 24 | RUN set -ex; \ 25 | \. $HOME/.nvm/nvm.sh; \ 26 | nvm install $NODE_VERSION; \ 27 | nvm use v$NODE_VERSION; \ 28 | nvm alias default v$NODE_VERSION; 29 | 30 | ENV PATH="/fendermint/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" 31 | 32 | RUN npm install -g pnpm 33 | 34 | ENTRYPOINT ["/bin/bash"] 35 | -------------------------------------------------------------------------------- /ipc/cli/src/commands/util/eth.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: MIT 3 | //! Eth address util 4 | 5 | use async_trait::async_trait; 6 | use clap::Args; 7 | use fvm_shared::address::Address; 8 | use ipc_api::evm::payload_to_evm_address; 9 | use std::fmt::Debug; 10 | use std::str::FromStr; 11 | 12 | use crate::{CommandLineHandler, GlobalArguments}; 13 | 14 | pub(crate) struct F4ToEthAddr; 15 | 16 | #[async_trait] 17 | impl CommandLineHandler for F4ToEthAddr { 18 | type Arguments = F4ToEthAddrArgs; 19 | 20 | async fn handle(_global: &GlobalArguments, arguments: &Self::Arguments) -> anyhow::Result<()> { 21 | let addr = Address::from_str(&arguments.addr)?; 22 | let eth_addr = payload_to_evm_address(addr.payload())?; 23 | log::info!("eth address: {:?}", eth_addr); 24 | Ok(()) 25 | } 26 | } 27 | 28 | #[derive(Debug, Args)] 29 | #[command(about = "Get Ethereum address for an F4")] 30 | pub(crate) struct F4ToEthAddrArgs { 31 | #[arg(long, help = "F4 address to get the underlying Ethereum addr from")] 32 | pub addr: String, 33 | } 34 | -------------------------------------------------------------------------------- /.github/workflows/demos.yaml: -------------------------------------------------------------------------------- 1 | name: Demos 2 | 3 | on: 4 | workflow_call: 5 | 6 | env: 7 | FOUNDRY_PROFILE: ci 8 | 9 | jobs: 10 | examples-axelar-token: 11 | name: "Demos: Axelar token" 12 | runs-on: ubuntu-latest 13 | strategy: 14 | fail-fast: true 15 | defaults: 16 | run: 17 | working-directory: ./demos/axelar-token 18 | steps: 19 | - uses: actions/checkout@v4 20 | with: 21 | submodules: recursive 22 | - uses: pnpm/action-setup@v2 23 | - name: Setup Node 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: '18.x' 27 | cache: 'pnpm' 28 | - name: Install Foundry 29 | uses: foundry-rs/foundry-toolchain@v1 30 | with: 31 | version: nightly 32 | - name: pnpm install 33 | run: | 34 | pnpm install 35 | - name: Run Forge build 36 | id: build 37 | run: | 38 | forge --version 39 | forge build --sizes 40 | - name: Run Forge tests 41 | id: test 42 | run: | 43 | forge test -vvvv 44 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /fendermint/vm/interpreter/src/arb.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | use fendermint_testing::arb::{ArbCid, ArbTokenAmount}; 5 | use fendermint_vm_core::{chainid, Timestamp}; 6 | use fvm_shared::version::NetworkVersion; 7 | use quickcheck::{Arbitrary, Gen}; 8 | 9 | use crate::fvm::state::FvmStateParams; 10 | 11 | impl Arbitrary for FvmStateParams { 12 | fn arbitrary(g: &mut Gen) -> Self { 13 | Self { 14 | state_root: ArbCid::arbitrary(g).0, 15 | timestamp: Timestamp(u64::arbitrary(g)), 16 | network_version: NetworkVersion::new(*g.choose(&[21]).unwrap()), 17 | base_fee: ArbTokenAmount::arbitrary(g).0, 18 | circ_supply: ArbTokenAmount::arbitrary(g).0, 19 | chain_id: chainid::from_str_hashed(String::arbitrary(g).as_str()) 20 | .unwrap() 21 | .into(), 22 | power_scale: *g.choose(&[-1, 0, 3]).unwrap(), 23 | app_version: *g.choose(&[0, 1, 2]).unwrap(), 24 | consensus_params: None, 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /infra/fendermint/scripts/prometheus.toml: -------------------------------------------------------------------------------- 1 | [tasks.prometheus-run] 2 | script = """ 3 | mkdir -p $PROMETHEUS_DIR 4 | docker run \ 5 | ${FLAGS} \ 6 | --name ${PROMETHEUS_CONTAINER_NAME} \ 7 | --init \ 8 | --user $(id -u) \ 9 | --network ${NETWORK_NAME} \ 10 | --publish 127.0.0.1:${PROMETHEUS_HOST_PORT}:9090 \ 11 | --volume ${PROMETHEUS_DIR}:/prometheus \ 12 | --volume ${PROMETHEUS_CONFIG_FOLDER}/prometheus.yaml:/etc/prometheus/prometheus.yml \ 13 | ${PROMETHEUS_DOCKER_IMAGE} 14 | """ 15 | 16 | [tasks.prometheus-start] 17 | extend = "prometheus-run" 18 | env = { "FLAGS" = "-d" } 19 | 20 | [tasks.prometheus-restart] 21 | extend = "prometheus-run" 22 | env = { "FLAGS" = "-d" } 23 | dependencies = ["prometheus-destroy"] 24 | 25 | [tasks.prometheus-stop] 26 | env = { "CONTAINER_NAME" = "${PROMETHEUS_CONTAINER_NAME}" } 27 | run_task = "docker-stop" 28 | 29 | [tasks.prometheus-destroy] 30 | env = { "CONTAINER_NAME" = "${PROMETHEUS_CONTAINER_NAME}" } 31 | run_task = "docker-destroy" 32 | 33 | [tasks.prometheus-logs] 34 | extend = "docker-logs" 35 | env = { "CONTAINER_NAME" = "${PROMETHEUS_CONTAINER_NAME}" } 36 | -------------------------------------------------------------------------------- /fendermint/vm/message/golden/chain/ipc_bottom_up_exec.cbor: -------------------------------------------------------------------------------- 1 | a163497063a16c426f74746f6d557045786563a2676d657373616765a4697375626e65745f6964821b8d387787de756df2814a009b8cedd688f5c19a34666865696768741ab27f0fd0756e6578745f76616c696461746f725f7365745f69641b040e0f1f7e5dc20e72626f74746f6d5f75705f6d65737361676573d82a5823001220e632b7095b0bf32c260fa4c539e9fd7b852d0de454e9be26f24d0d6f91d069d36b6365727469666963617465a16a7369676e61747572657385a26976616c696461746f72583304f3be9d93a2a9fa9c7b279e96f32cff250fe42aec2d0179f451c4a4db966f2297e879665c6b890ee000ffa135c6e841148cb8697369676e61747572654901f30911161e3f5901a26976616c696461746f72583604d488f4f580f1feaca2010048437b2fd695a0690aca7222c35f3ae32f939bbb43dbeeddd18b51cf97e4011264e9c11618cf98c7776c697369676e617475726548026bac042a99359fa26976616c696461746f72583103b75a5883fbcb17f5bde4f8a97c00c6103ecf6c8b5d83a1410d55fa14e8cea33a670fdbaea5ff17e74283b1cec8840486697369676e6174757265470101c1ef012f95a26976616c696461746f724b00eaf7bb8e96d3bad6dc01697369676e6174757265440209783ca26976616c696461746f725831037498bc35763cade3574c1e8c716453367ef4577b5a8a09ff58ff8acb297b2156cff7ffc2226720c615eed737c4930c35697369676e6174757265440281b396 -------------------------------------------------------------------------------- /.github/workflows/contracts-storage.yaml: -------------------------------------------------------------------------------- 1 | name: 'Contracts: Storage check' 2 | 3 | # This workflow is triggered from the main CI workflow. 4 | on: 5 | workflow_call: 6 | 7 | env: 8 | RPC_URL: https://filecoin-calibration.chainup.net/rpc/v1 9 | PRIVATE_KEY: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef 10 | 11 | jobs: 12 | storage: 13 | name: Storage layout check 14 | runs-on: ubuntu-latest 15 | if: ${{ !github.event.pull_request.draft }} 16 | steps: 17 | - uses: actions/checkout@v4 18 | with: 19 | submodules: recursive 20 | 21 | - uses: pnpm/action-setup@v2 22 | 23 | - name: Setup Node 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: '18.x' 27 | cache: 'pnpm' 28 | 29 | - name: Install Foundry 30 | uses: foundry-rs/foundry-toolchain@v1 31 | with: 32 | cache: false 33 | 34 | - name: Install Node dependencies 35 | run: cd contracts && pnpm i --unsafe-perm 36 | 37 | - name: Storage check 38 | run: cd contracts && pnpm exec hardhat storage-layout --check 39 | -------------------------------------------------------------------------------- /fendermint/actors/api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_actors_api" 3 | description = "API and interface types for pluggable actors." 4 | license.workspace = true 5 | edition.workspace = true 6 | authors.workspace = true 7 | version = "0.1.0" 8 | 9 | [lib] 10 | ## lib is necessary for integration tests 11 | ## cdylib is necessary for Wasm build 12 | crate-type = ["cdylib", "lib"] 13 | 14 | [dependencies] 15 | anyhow = { workspace = true } 16 | cid = { workspace = true } 17 | fil_actors_runtime = { workspace = true } 18 | fvm_ipld_blockstore = { workspace = true } 19 | fvm_ipld_encoding = { workspace = true } 20 | fvm_shared = { workspace = true } 21 | log = { workspace = true } 22 | multihash = { workspace = true } 23 | num-derive = { workspace = true } 24 | num-traits = { workspace = true } 25 | serde = { workspace = true } 26 | hex-literal = { workspace = true } 27 | frc42_dispatch = { workspace = true } 28 | 29 | [dev-dependencies] 30 | fil_actors_evm_shared = { workspace = true } 31 | fil_actors_runtime = { workspace = true, features = ["test_utils"] } 32 | 33 | [features] 34 | fil-actor = ["fil_actors_runtime/fil-actor"] 35 | -------------------------------------------------------------------------------- /fendermint/rocksdb/src/namespaces.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022-2024 Protocol Labs 2 | // SPDX-License-Identifier: Apache-2.0, MIT 3 | 4 | /// List all column families to help keep them unique. 5 | /// 6 | /// # Example 7 | /// 8 | /// ``` 9 | /// use fendermint_rocksdb::namespaces; 10 | /// 11 | /// namespaces!(MySpace { foo, bar }); 12 | /// 13 | /// let ms = MySpace::default(); 14 | /// let nss = ms.values(); 15 | /// let ns_foo = &ms.foo; 16 | /// ``` 17 | #[macro_export] 18 | macro_rules! namespaces { 19 | ($name:ident { $($col:ident),* }) => { 20 | struct $name { 21 | pub $($col: String),+ 22 | } 23 | 24 | impl Default for $name { 25 | fn default() -> Self { 26 | Self { 27 | $($col: stringify!($col).to_owned()),+ 28 | } 29 | } 30 | } 31 | 32 | impl $name { 33 | /// List column family names, all of which are required for re-opening the databasae. 34 | pub fn values(&self) -> Vec<&str> { 35 | vec![$(self.$col.as_ref()),+] 36 | } 37 | } 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /fendermint/app/config/test.toml: -------------------------------------------------------------------------------- 1 | # These setting are overlayed over `default.toml` in unit tests 2 | # to exercise parsing values that are not viable as defaults. 3 | 4 | [validator_key] 5 | path = "dummy.sk" 6 | kind = "ethereum" 7 | 8 | [ipc] 9 | subnet_id = "/r31415926" 10 | 11 | [resolver.membership] 12 | static_subnets = ["/r31415926/f2xwzbdu7z5sam6hc57xxwkctciuaz7oe5omipwbq"] 13 | 14 | [resolver.discovery] 15 | static_addresses = [ 16 | "/ip4/198.51.100.0/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N", 17 | "/ip6/2604:1380:2000:7a00::1/udp/4001/quic/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb", 18 | "/ip4/192.0.2.0/tcp/5002/p2p/QmdPU7PfRyKehdrP5A3WqmjyD6bhVpU1mLGKppa2FjGDjZ/p2p-circuit/p2p/QmVT6GYwjeeAF5TR485Yc58S3xRF5EFsZ5YAF4VcP3URHt", 19 | ] 20 | 21 | [resolver.connection] 22 | listen_addr = "/ip4/198.51.100.2/tcp/1234" 23 | external_addresses = [ 24 | "/ip4/198.51.100.2/tcp/1234", 25 | "/dns4/my.node.com/tcp/1234", 26 | ] 27 | 28 | 29 | [testing] 30 | push_chain_meta = false 31 | 32 | [tracing.file] 33 | enabled = true 34 | level = "debug" 35 | directory = "logs" 36 | max_log_files = 4 37 | rotation = "minutely" 38 | -------------------------------------------------------------------------------- /infra/fendermint/scripts/anvil.toml: -------------------------------------------------------------------------------- 1 | [tasks.anvil-pull] 2 | # Note: the foundry image doesn't have arm64 support, so we need to pull the 3 | # x86_64 image on arm64 explicitly; otherwise, the dockerpull will fail 4 | script = """ 5 | arch=$(uname -m) 6 | if [ "$arch" = "arm64" ]; then 7 | docker pull --platform linux/x86_64 ${FOUNDRY_DOCKER_IMAGE} 8 | else 9 | docker pull ${FOUNDRY_DOCKER_IMAGE} 10 | fi 11 | """ 12 | 13 | [tasks.anvil-run] 14 | script = """ 15 | docker run \ 16 | ${FLAGS} \ 17 | --name ${ANVIL_CONTAINER_NAME} \ 18 | --network ${NETWORK_NAME} \ 19 | --publish ${ANVIL_HOST_PORT}:8545 \ 20 | ${FOUNDRY_DOCKER_IMAGE} "anvil --host 0.0.0.0" 21 | """ 22 | dependencies = ["docker-network-create"] 23 | 24 | [tasks.anvil-start] 25 | extend = "anvil-run" 26 | env = { "FLAGS" = "-d" } 27 | 28 | [tasks.anvil-restart] 29 | extend = "anvil-run" 30 | env = { "FLAGS" = "-d" } 31 | dependencies = ["anvil-destroy"] 32 | 33 | [tasks.anvil-stop] 34 | env = { "CONTAINER_NAME" = "${ANVIL_CONTAINER_NAME}" } 35 | run_task = "docker-stop" 36 | 37 | [tasks.anvil-destroy] 38 | env = { "CONTAINER_NAME" = "${ANVIL_CONTAINER_NAME}" } 39 | run_task = "docker-destroy" 40 | -------------------------------------------------------------------------------- /fendermint/actors/eam/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fendermint_actor_eam" 3 | description = "Builtin Ethereum address manager actor for IPC" 4 | license.workspace = true 5 | edition.workspace = true 6 | authors.workspace = true 7 | version = "0.1.0" 8 | 9 | [lib] 10 | ## lib is necessary for integration tests 11 | ## cdylib is necessary for Wasm build 12 | crate-type = ["cdylib", "lib"] 13 | 14 | [dependencies] 15 | anyhow = { workspace = true } 16 | cid = { workspace = true } 17 | fil_actor_eam = { workspace = true } 18 | fil_actors_runtime = { workspace = true } 19 | fvm_ipld_blockstore = { workspace = true } 20 | fvm_ipld_encoding = { workspace = true } 21 | fvm_shared = { workspace = true } 22 | log = { workspace = true } 23 | multihash = { workspace = true } 24 | num-derive = { workspace = true } 25 | num-traits = { workspace = true } 26 | serde = { workspace = true } 27 | hex-literal = { workspace = true } 28 | frc42_dispatch = { workspace = true } 29 | 30 | [dev-dependencies] 31 | fil_actors_evm_shared = { workspace = true } 32 | fil_actors_runtime = { workspace = true, features = ["test_utils"] } 33 | 34 | [features] 35 | fil-actor = ["fil_actors_runtime/fil-actor"] 36 | -------------------------------------------------------------------------------- /infra/fendermint/scripts/relayer.toml: -------------------------------------------------------------------------------- 1 | [tasks.relayer-run] 2 | script = """ 3 | docker run \ 4 | ${FLAGS} \ 5 | --name ${RELAYER_CONTAINER_NAME} \ 6 | --init \ 7 | --user $(id -u) \ 8 | --network ${NETWORK_NAME} \ 9 | --volume ${HOME}/.ipc:/fendermint/.ipc \ 10 | --publish 127.0.0.1:${RELAYER_METRICS_HOST_PORT}:9184 \ 11 | --env IPC_CLI_CONFIG_PATH=/fendermint/.ipc/relayer.config.toml \ 12 | --env RUST_BACKTRACE=1 \ 13 | --env RUST_LOG=${RELAYER_LOG_LEVEL} \ 14 | ${FM_DOCKER_IMAGE} \ 15 | ${CMD} \ 16 | checkpoint relayer --max-parallelism 1 --subnet ${SUBNET_ID} --submitter ${RELAYER_SUBMITTER} --metrics-address 0.0.0.0:9184 17 | """ 18 | dependencies = ["docker-network-create"] 19 | 20 | [tasks.relayer-start] 21 | extend = "relayer-run" 22 | env = { "CMD" = "ipc-cli", "FLAGS" = "-d" } 23 | 24 | [tasks.relayer-stop] 25 | env = { "CONTAINER_NAME" = "${RELAYER_CONTAINER_NAME}" } 26 | run_task = "docker-stop" 27 | 28 | [tasks.relayer-destroy] 29 | env = { "CONTAINER_NAME" = "${RELAYER_CONTAINER_NAME}" } 30 | run_task = "docker-destroy" 31 | 32 | [tasks.relayer-logs] 33 | extend = "docker-logs" 34 | env = { "CONTAINER_NAME" = "${RELAYER_CONTAINER_NAME}" } 35 | --------------------------------------------------------------------------------