├── .editorconfig
├── .gitignore
├── Cargo.lock
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── file_header.txt
├── frontier
├── .editorconfig
├── .github
│ ├── CODEOWNERS
│ ├── dependabot.yml
│ └── workflows
│ │ ├── cancel.yml
│ │ ├── docs.yml
│ │ ├── editorconfig.yml
│ │ └── rust.yml
├── .gitignore
├── .maintain
│ ├── frame-weight-template.hbs
│ ├── node-template-release.sh
│ ├── node-template-release
│ │ ├── Cargo.lock
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ └── release-polkadot-branch.sh
├── Cargo.lock
├── Cargo.toml
├── HEADER-APACHE2
├── LICENSE-APACHE2
├── LICENSE-GPL3
├── client
│ ├── cli
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── frontier_db_cmd
│ │ │ ├── mapping_db.rs
│ │ │ ├── meta_db.rs
│ │ │ ├── mod.rs
│ │ │ ├── tests.rs
│ │ │ └── utils.rs
│ │ │ └── lib.rs
│ ├── consensus
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ ├── db
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── kv
│ │ │ ├── mod.rs
│ │ │ ├── parity_db_adapter.rs
│ │ │ ├── upgrade.rs
│ │ │ └── utils.rs
│ │ │ ├── lib.rs
│ │ │ └── sql
│ │ │ └── mod.rs
│ ├── mapping-sync
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── kv
│ │ │ ├── mod.rs
│ │ │ └── worker.rs
│ │ │ ├── lib.rs
│ │ │ └── sql
│ │ │ └── mod.rs
│ ├── rpc-core
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── eth.rs
│ │ │ ├── eth_pubsub.rs
│ │ │ ├── lib.rs
│ │ │ ├── net.rs
│ │ │ ├── txpool.rs
│ │ │ ├── types
│ │ │ ├── account_info.rs
│ │ │ ├── block.rs
│ │ │ ├── block_number.rs
│ │ │ ├── bytes.rs
│ │ │ ├── call_request.rs
│ │ │ ├── fee.rs
│ │ │ ├── filter.rs
│ │ │ ├── index.rs
│ │ │ ├── log.rs
│ │ │ ├── mod.rs
│ │ │ ├── pubsub.rs
│ │ │ ├── receipt.rs
│ │ │ ├── sync.rs
│ │ │ ├── transaction.rs
│ │ │ ├── transaction_request.rs
│ │ │ ├── txpool.rs
│ │ │ └── work.rs
│ │ │ └── web3.rs
│ ├── rpc
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── eth
│ │ │ ├── block.rs
│ │ │ ├── cache
│ │ │ │ ├── lru_cache.rs
│ │ │ │ └── mod.rs
│ │ │ ├── client.rs
│ │ │ ├── execute.rs
│ │ │ ├── fee.rs
│ │ │ ├── filter.rs
│ │ │ ├── format.rs
│ │ │ ├── mining.rs
│ │ │ ├── mod.rs
│ │ │ ├── state.rs
│ │ │ ├── submit.rs
│ │ │ └── transaction.rs
│ │ │ ├── eth_pubsub.rs
│ │ │ ├── lib.rs
│ │ │ ├── net.rs
│ │ │ ├── signer.rs
│ │ │ ├── txpool.rs
│ │ │ └── web3.rs
│ └── storage
│ │ ├── Cargo.toml
│ │ └── src
│ │ ├── lib.rs
│ │ └── overrides
│ │ ├── mod.rs
│ │ ├── schema_v1_override.rs
│ │ ├── schema_v2_override.rs
│ │ └── schema_v3_override.rs
├── docs
│ ├── .gitignore
│ ├── .vuepress
│ │ ├── config.js
│ │ └── styles
│ │ │ ├── index.styl
│ │ │ └── palette.styl
│ ├── package.json
│ └── yarn.lock
├── frame
│ ├── base-fee
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── tests.rs
│ ├── dynamic-fee
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── tests.rs
│ ├── ethereum
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── lib.rs
│ │ │ ├── mock.rs
│ │ │ └── tests
│ │ │ ├── eip1559.rs
│ │ │ ├── eip2930.rs
│ │ │ ├── legacy.rs
│ │ │ ├── mod.rs
│ │ │ └── res
│ │ │ └── erc20_contract_bytecode.txt
│ ├── evm-chain-id
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ ├── evm
│ │ ├── Cargo.toml
│ │ ├── precompile
│ │ │ ├── blake2
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ ├── eip_152.rs
│ │ │ │ │ └── lib.rs
│ │ │ ├── bls12377
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ ├── lib.rs
│ │ │ │ │ └── tests.rs
│ │ │ ├── bn128
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ └── lib.rs
│ │ │ ├── bw6761
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ ├── lib.rs
│ │ │ │ │ └── tests.rs
│ │ │ ├── curve25519
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ └── lib.rs
│ │ │ ├── dispatch
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ ├── lib.rs
│ │ │ │ │ ├── mock.rs
│ │ │ │ │ └── tests.rs
│ │ │ ├── ed25519
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ └── lib.rs
│ │ │ ├── modexp
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ └── lib.rs
│ │ │ ├── sha3fips
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ └── lib.rs
│ │ │ ├── simple
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── src
│ │ │ │ │ └── lib.rs
│ │ │ └── testdata
│ │ │ │ ├── blake2F.json
│ │ │ │ ├── bls12377G1Add.json
│ │ │ │ ├── bls12377G1Mul.json
│ │ │ │ ├── bls12377G1MultiExp.json
│ │ │ │ ├── bls12377G2Add.json
│ │ │ │ ├── bls12377G2Mul.json
│ │ │ │ ├── bls12377G2MultiExp.json
│ │ │ │ ├── bls12377Pairing.json
│ │ │ │ ├── bw6761G1Add.json
│ │ │ │ ├── bw6761G1Mul.json
│ │ │ │ ├── bw6761G1MultiExp.json
│ │ │ │ ├── bw6761G2Add.json
│ │ │ │ ├── bw6761G2Mul.json
│ │ │ │ ├── bw6761G2MultiExp.json
│ │ │ │ ├── bw6761Pairing.json
│ │ │ │ ├── common_bnadd.json
│ │ │ │ ├── common_bnmul.json
│ │ │ │ ├── common_bnpair.json
│ │ │ │ ├── common_ripemd.json
│ │ │ │ ├── common_sha256.json
│ │ │ │ ├── ecRecover.json
│ │ │ │ ├── fail-bls12377G1Add.json
│ │ │ │ ├── fail-bls12377G1Mul.json
│ │ │ │ ├── fail-bls12377G1MultiExp.json
│ │ │ │ ├── fail-bls12377G2Add.json
│ │ │ │ ├── fail-bls12377G2Mul.json
│ │ │ │ ├── fail-bls12377G2Mul_Fail.json
│ │ │ │ ├── fail-bls12377G2MultiExp.json
│ │ │ │ ├── fail-bls12377Pairing.json
│ │ │ │ ├── fail-bw6761G1Add.json
│ │ │ │ ├── fail-bw6761G1Mul.json
│ │ │ │ ├── fail-bw6761G1MultiExp.json
│ │ │ │ ├── fail-bw6761G2Add.json
│ │ │ │ ├── fail-bw6761G2Mul.json
│ │ │ │ ├── fail-bw6761G2MultiExp.json
│ │ │ │ ├── fail-bw6761Pairing.json
│ │ │ │ └── modexp_eip2565.json
│ │ ├── src
│ │ │ ├── benchmarking.rs
│ │ │ ├── lib.rs
│ │ │ ├── mock.rs
│ │ │ ├── res
│ │ │ │ ├── proof_size_test_callee_contract_bytecode.txt
│ │ │ │ └── proof_size_test_contract_bytecode.txt
│ │ │ ├── runner
│ │ │ │ ├── mod.rs
│ │ │ │ └── stack.rs
│ │ │ ├── tests.rs
│ │ │ └── weights.rs
│ │ └── test-vector-support
│ │ │ ├── Cargo.toml
│ │ │ └── src
│ │ │ └── lib.rs
│ └── hotfix-sufficients
│ │ ├── Cargo.toml
│ │ └── src
│ │ ├── benchmarking.rs
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ ├── tests.rs
│ │ └── weights.rs
├── primitives
│ ├── account
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ ├── consensus
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ ├── dynamic-fee
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ ├── ethereum
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ ├── evm
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── lib.rs
│ │ │ ├── precompile.rs
│ │ │ └── validation.rs
│ ├── rpc
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ ├── self-contained
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── checked_extrinsic.rs
│ │ │ ├── lib.rs
│ │ │ └── unchecked_extrinsic.rs
│ └── storage
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── lib.rs
├── rust-toolchain
├── rustfmt.toml
├── scripts
│ └── benchmark.sh
├── shell.nix
├── taplo.toml
├── template
│ ├── .dockerignore
│ ├── Dockerfile
│ ├── LICENSE
│ ├── examples
│ │ ├── contract-erc20
│ │ │ ├── .gitignore
│ │ │ ├── create-erc20-rpc.ts
│ │ │ ├── create-erc20.ts
│ │ │ ├── package-lock.json
│ │ │ ├── package.json
│ │ │ ├── truffle
│ │ │ │ ├── .gitignore
│ │ │ │ ├── contracts
│ │ │ │ │ ├── MyToken.json
│ │ │ │ │ └── MyToken.sol
│ │ │ │ ├── package-lock.json
│ │ │ │ ├── package.json
│ │ │ │ └── truffle-config.js
│ │ │ └── tsconfig.json
│ │ └── contract-hello
│ │ │ ├── .gitignore
│ │ │ ├── Hello.sol
│ │ │ ├── index.js
│ │ │ ├── package-lock.json
│ │ │ └── package.json
│ ├── node
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ └── src
│ │ │ ├── benchmarking.rs
│ │ │ ├── chain_spec.rs
│ │ │ ├── cli.rs
│ │ │ ├── client.rs
│ │ │ ├── command.rs
│ │ │ ├── eth.rs
│ │ │ ├── main.rs
│ │ │ ├── rpc
│ │ │ ├── eth.rs
│ │ │ └── mod.rs
│ │ │ └── service.rs
│ ├── runtime
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── precompiles.rs
│ └── utils
│ │ ├── .gitignore
│ │ ├── erc20-slot.js
│ │ ├── evm-address.js
│ │ ├── index.js
│ │ ├── package-lock.json
│ │ └── package.json
└── ts-tests
│ ├── .gitignore
│ ├── .prettierrc.js
│ ├── contracts
│ ├── ECRecoverTests.sol
│ ├── ExplicitRevertReason.sol
│ ├── ForceGasLimit.sol
│ ├── InvalidOpcode.sol
│ ├── StateOverrideTest.sol
│ ├── Storage.sol
│ ├── StorageLoop.sol
│ └── Test.sol
│ ├── package-lock.json
│ ├── package.json
│ ├── tests
│ ├── config.ts
│ ├── test-balance.ts
│ ├── test-block-tags.ts
│ ├── test-block.ts
│ ├── test-bloom.ts
│ ├── test-contract-methods.ts
│ ├── test-contract-storage.ts
│ ├── test-contract.ts
│ ├── test-deprecated.ts
│ ├── test-execute.ts
│ ├── test-fee-history.ts
│ ├── test-filter-api.ts
│ ├── test-gas.ts
│ ├── test-log-filtering.ts
│ ├── test-log-tags.ts
│ ├── test-max-priority-fee-per-gas-rpc.ts
│ ├── test-netapi.ts
│ ├── test-nonce.ts
│ ├── test-pending-pool.ts
│ ├── test-precompiles.ts
│ ├── test-revert-reason.ts
│ ├── test-revert-receipt.ts
│ ├── test-rpc-constants.ts
│ ├── test-state-override.ts
│ ├── test-state-root.ts
│ ├── test-subscription.ts
│ ├── test-transaction-cost.ts
│ ├── test-transaction-priority.ts
│ ├── test-transaction-version.ts
│ ├── test-web3api.ts
│ ├── txpool.ts
│ └── util.ts
│ ├── truffle-config.js
│ └── tsconfig.json
├── node
├── Cargo.toml
├── bin
│ └── main.rs
├── build.rs
├── res
│ ├── Raw.json
│ └── gpu.json
└── src
│ ├── benchmarking.rs
│ ├── chain_spec.rs
│ ├── cli.rs
│ ├── command.rs
│ ├── eth.rs
│ ├── lib.rs
│ └── service.rs
├── pallets
├── custom-signatures
│ ├── Cargo.toml
│ └── src
│ │ ├── ethereum.rs
│ │ ├── lib.rs
│ │ └── tests.rs
└── precompiles
│ ├── assets-erc20
│ ├── Cargo.toml
│ ├── ERC20.sol
│ └── src
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ └── tests.rs
│ ├── batch
│ ├── Batch.sol
│ ├── Cargo.toml
│ └── src
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ └── tests.rs
│ ├── sr25519
│ ├── Cargo.toml
│ ├── SR25519.sol
│ └── src
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ └── tests.rs
│ ├── substrate-ecdsa
│ ├── Cargo.toml
│ ├── SubstrateEcdsa.sol
│ └── src
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ └── tests.rs
│ └── utils
│ ├── Cargo.toml
│ ├── macro
│ ├── Cargo.toml
│ ├── src
│ │ └── lib.rs
│ └── tests
│ │ └── tests.rs
│ └── src
│ ├── bytes.rs
│ ├── data.rs
│ ├── lib.rs
│ ├── testing
│ ├── account.rs
│ ├── execution.rs
│ ├── handle.rs
│ └── mod.rs
│ └── tests.rs
├── primitives
├── Cargo.toml
└── src
│ ├── assets.rs
│ └── lib.rs
├── rpc
├── Cargo.toml
└── src
│ ├── eth.rs
│ └── lib.rs
├── runtime
├── common
│ ├── Cargo.toml
│ └── src
│ │ ├── elections.rs
│ │ ├── impls.rs
│ │ └── lib.rs
└── gpu
│ ├── Cargo.toml
│ ├── build.rs
│ ├── constants
│ ├── Cargo.toml
│ └── src
│ │ ├── lib.rs
│ │ └── weights
│ │ ├── block_weights.rs
│ │ ├── extrinsic_weights.rs
│ │ ├── mod.rs
│ │ ├── paritydb_weights.rs
│ │ └── rocksdb_weights.rs
│ └── src
│ ├── bag_thresholds.rs
│ ├── evm
│ ├── mod.rs
│ └── precompiles.rs
│ ├── governance
│ ├── mod.rs
│ ├── origins.rs
│ └── tracks.rs
│ ├── lib.rs
│ ├── proxy_config.rs
│ └── weights
│ ├── frame_benchmarking_baseline.rs
│ ├── frame_election_provider_support.rs
│ ├── frame_system.rs
│ ├── mod.rs
│ ├── pallet_bags_list.rs
│ ├── pallet_balances.rs
│ ├── pallet_bounties.rs
│ ├── pallet_child_bounties.rs
│ ├── pallet_contracts.rs
│ ├── pallet_conviction_voting.rs
│ ├── pallet_election_provider_multi_phase.rs
│ ├── pallet_fast_unstake.rs
│ ├── pallet_identity.rs
│ ├── pallet_im_online.rs
│ ├── pallet_indices.rs
│ ├── pallet_membership.rs
│ ├── pallet_multisig.rs
│ ├── pallet_offences.rs
│ ├── pallet_preimage.rs
│ ├── pallet_proxy.rs
│ ├── pallet_referenda.rs
│ ├── pallet_scheduler.rs
│ ├── pallet_session.rs
│ ├── pallet_staking.rs
│ ├── pallet_timestamp.rs
│ ├── pallet_treasury.rs
│ ├── pallet_utility.rs
│ ├── pallet_vesting.rs
│ └── pallet_whitelist.rs
├── rust-toolchain
├── rustfmt.toml
├── scripts
├── build_with_docker.sh
├── cargo_test.sh
├── dockerfiles
│ └── selendra
│ │ ├── build.sh
│ │ └── selendra_builder.Dockerfile
├── get_selendra.sh
├── init.sh
├── packaging
│ └── selendra.service
├── prepare-testnet.sh
├── run_benches_for_runtime.sh
├── sessions
│ ├── audi1
│ ├── audi2
│ ├── audi3
│ ├── audi4
│ ├── babe1
│ ├── babe2
│ ├── babe3
│ ├── babe4
│ ├── gran1
│ ├── gran2
│ ├── gran3
│ ├── gran4
│ ├── imol1
│ ├── imol2
│ ├── imol3
│ ├── imol4
│ ├── run.sh
│ ├── run1.sh
│ └── run2.sh
└── srtool_with_docker.sh
└── utils
├── generate-bags
├── Cargo.toml
└── src
│ └── main.rs
└── staking-miner
├── .gitignore
├── Cargo.lock
├── Cargo.toml
├── src
├── dry_run.rs
├── emergency_solution.rs
├── main.rs
├── monitor.rs
├── opts.rs
├── prelude.rs
├── rpc.rs
├── runtime_versions.rs
└── signer.rs
└── tests
└── cli.rs
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style=space
5 | indent_size=2
6 | tab_width=2
7 | end_of_line=lf
8 | charset=utf-8
9 | trim_trailing_whitespace=true
10 | insert_final_newline = true
11 |
12 | [*.{rs,toml}]
13 | indent_style=tab
14 | indent_size=tab
15 | tab_width=4
16 | max_line_length=100
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # will have compiled files and executables
3 | **/target/
4 | # These are backup files generated by rustfmt
5 | **/*.rs.bk
6 |
7 | .DS_Store
8 |
9 | # The cache for docker container dependency
10 | .cargo
11 |
12 | # The cache for chain data in container
13 | .local
14 | local
15 |
16 | # direnv cache
17 | .direnv
18 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = [
3 | "rpc",
4 | "node",
5 | "primitives",
6 | "runtime/common",
7 | "runtime/gpu",
8 | "runtime/gpu/constants",
9 | "pallets/precompiles/*",
10 | "pallets/custom-signatures"
11 | ]
12 |
13 | exclude = [
14 | "frontier"
15 | ]
16 |
17 | [profile.release]
18 | # gpu runtime requires unwinding.
19 | panic = "unwind"
20 | opt-level = 3
21 |
22 | # make sure dev builds with backtrace do
23 | # not slow us down
24 | [profile.dev.package.backtrace]
25 | inherits = "release"
26 |
27 | [profile.production]
28 | inherits = "release"
29 | lto = true
30 | codegen-units = 1
31 |
32 | [profile.testnet]
33 | inherits = "release"
34 | debug = 1 # debug symbols are useful for profilers
35 | debug-assertions = true
36 | overflow-checks = true
37 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # Start from the Ubuntu base image
2 | FROM ubuntu:latest
3 |
4 | # Install necessary packages
5 | RUN apt-get update && apt-get install -y wget && apt-get install -y curl
6 |
7 | # Set the working directory
8 | WORKDIR /app
9 |
10 | # Download the binary file from GitHub
11 | RUN wget -O binary-file https://github.com/brahmGAN/ganchain-v2/releases/download/v2.0.0/gpu
12 |
13 | # Give execute permission to the binary
14 | RUN chmod +x binary-file
15 |
16 | #Get name from env
17 | ENV NAME="GANValidator"
18 |
19 | # Command to run the binary
20 | CMD ./binary-file --base-path chaindata/GanValidator --chain gpu --port 30333 --rpc-port 9933 --validator --name ${NAME} --bootnodes /ip4/3.64.87.46/tcp/30335/ws/p2p/12D3KooWDnsUzPhi6Dra6wRLooM9BSwDS4QmrfmzkTz6YW5nGVcm
--------------------------------------------------------------------------------
/file_header.txt:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021-2022 gpu.
2 | // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
3 |
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 |
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 |
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
--------------------------------------------------------------------------------
/frontier/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*.rs]
4 | indent_style=tab
5 | indent_size=tab
6 | tab_width=4
7 | end_of_line=lf
8 | charset=utf-8
9 | trim_trailing_whitespace=true
10 | insert_final_newline=true
11 |
12 | [*.toml]
13 | indent_style=tab
14 | indent_size=tab
15 | tab_width=4
16 |
17 | [*.ts]
18 | indent_style=tab
19 | indent_size=tab
20 | tab_width=4
--------------------------------------------------------------------------------
/frontier/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # A codeowner just oversees some part of the codebase. If an owned file is changed then the
2 | # corresponding codeowner receives a review request. An approval of the codeowner is
3 | # not required for merging a PR.
4 |
5 | * @sorpaas
6 |
--------------------------------------------------------------------------------
/frontier/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 |
3 | updates:
4 | - package-ecosystem: github-actions
5 | directory: "/"
6 | schedule:
7 | interval: daily
8 | time: "03:00"
9 | timezone: Europe/Berlin
10 | - package-ecosystem: npm
11 | directory: "/docs"
12 | schedule:
13 | interval: "daily"
14 | - package-ecosystem: cargo
15 | directory: "/"
16 | # Handle updates for crates from github.com/paritytech/substrate manually.
17 | ignore:
18 | - dependency-name: "sc-*"
19 | - dependency-name: "sp-*"
20 | - dependency-name: "frame-*"
21 | - dependency-name: "pallet-*"
22 | - dependency-name: "substrate-*"
23 | - dependency-name: "beefy-*"
24 | - dependency-name: "fork-tree"
25 | schedule:
26 | interval: "daily"
27 |
--------------------------------------------------------------------------------
/frontier/.github/workflows/cancel.yml:
--------------------------------------------------------------------------------
1 | name: Cancel
2 |
3 | on:
4 | push:
5 | branches:
6 | - '**'
7 | - '!master'
8 | - '!polkadot-v**'
9 |
10 | jobs:
11 | cancel:
12 | name: 'Cancel previous runs'
13 | runs-on: ubuntu-latest
14 | timeout-minutes: 3
15 | steps:
16 | - uses: styfle/cancel-workflow-action@0.11.0
17 | with:
18 | workflow_id: 1303397
19 | access_token: ${{ github.token }}
20 |
--------------------------------------------------------------------------------
/frontier/.github/workflows/docs.yml:
--------------------------------------------------------------------------------
1 | name: Docs
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 |
7 | jobs:
8 | release:
9 | name: Deploy docs
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Checkout repository
14 | uses: actions/checkout@v3
15 | - name: Rust Setup
16 | uses: actions-rs/toolchain@v1
17 | with:
18 | profile: minimal
19 | toolchain: nightly-2023-05-23
20 | target: wasm32-unknown-unknown
21 | override: true
22 | components: rust-docs
23 | - name: Install protoc
24 | uses: arduino/setup-protoc@v1
25 | with:
26 | repo-token: ${{ secrets.GITHUB_TOKEN }}
27 |
28 | - name: Build website
29 | run: |
30 | cd docs
31 | yarn install
32 | yarn run build
33 |
34 | - name: Build rustdocs
35 | uses: actions-rs/cargo@v1
36 | with:
37 | command: doc
38 | args: --all --no-deps
39 |
40 | - name: Copy rustdocs
41 | run: |
42 | cp -r ./target/doc docs/.vuepress/dist/rustdocs
43 |
44 | - name: Deploy documentation
45 | uses: peaceiris/actions-gh-pages@v3
46 | with:
47 | deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
48 | publish_branch: gh-pages
49 | publish_dir: ./docs/.vuepress/dist
50 | keep_files: true
51 |
--------------------------------------------------------------------------------
/frontier/.github/workflows/editorconfig.yml:
--------------------------------------------------------------------------------
1 | name: Editorconfig
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | - 'polkadot-v**'
8 | pull_request:
9 | branches:
10 | - master
11 | - 'polkadot-v**'
12 |
13 | jobs:
14 | check:
15 | name: 'Check editorconfig'
16 | runs-on: ubuntu-latest
17 | steps:
18 | - uses: actions/checkout@v3
19 | - name: Submodules
20 | run: git submodule update --init --recursive
21 | - name: Init
22 | run: |
23 | wget https://github.com/editorconfig-checker/editorconfig-checker/releases/download/2.1.0/ec-linux-amd64.tar.gz
24 | tar xvf ec-linux-amd64.tar.gz
25 | chmod +x bin/ec-linux-amd64
26 | - name: Check
27 | run: bin/ec-linux-amd64
28 |
--------------------------------------------------------------------------------
/frontier/.gitignore:
--------------------------------------------------------------------------------
1 | **/target/
2 | **/node_modules/
3 | **/*.rs.bk
4 | *.swp
5 | .wasm-binaries
6 | polkadot/runtime/wasm/target/
7 | core/executor/wasm/target/
8 | core/test-runtime/wasm/target/
9 | pwasm-alloc/target/
10 | pwasm-libc/target/
11 | pwasm-alloc/Cargo.lock
12 | pwasm-libc/Cargo.lock
13 | node/runtime/wasm/target/
14 | **/._*
15 | **/.criterion/
16 | .vscode
17 | polkadot.*
18 | .DS_Store
19 | .idea/
20 | .cargo-remote.toml
21 |
22 | # Added by cargo
23 | /target
24 |
25 | # NixOS development environment
26 | .envrc
27 |
--------------------------------------------------------------------------------
/frontier/.maintain/node-template-release.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 |
5 | export TERM=xterm
6 | PROJECT_ROOT=`git rev-parse --show-toplevel`
7 |
8 | if [ "$#" -ne 1 ]; then
9 | echo "node-template-release.sh path_to_target_archive"
10 | exit 1
11 | fi
12 |
13 | PATH_TO_ARCHIVE=$1
14 | cd $PROJECT_ROOT/.maintain/node-template-release
15 |
16 | cargo run $PROJECT_ROOT/template $PROJECT_ROOT/$PATH_TO_ARCHIVE
17 |
--------------------------------------------------------------------------------
/frontier/.maintain/node-template-release/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "node-template-release"
3 | version = "3.0.0"
4 | authors = ["Parity Technologies "]
5 | edition = "2018"
6 | license = "GPL-3.0"
7 |
8 | [dependencies]
9 | toml = "0.4"
10 | tar = "0.4"
11 | glob = "0.2"
12 | structopt = "0.3"
13 | tempfile = "3"
14 | fs_extra = "1"
15 | git2 = "0.16"
16 | flate2 = "1.0"
17 |
18 | [workspace]
19 |
20 | [package.metadata.docs.rs]
21 | targets = ["x86_64-unknown-linux-gnu"]
22 |
--------------------------------------------------------------------------------
/frontier/.maintain/release-polkadot-branch.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # This script can be used for releasing polkadot branch.
4 |
5 | if [[ $# -eq 1 && "${1}" == "--help" ]]; then
6 | echo "USAGE:"
7 | echo " ${0} [] , like master or polkadot-v0.9.27"
8 | elif [[ $# -ne 2 ]]; then
9 | to_branch=${1}
10 | rg "https://github.com/brahmGAN/substrate" -t toml -T lock -l | xargs sed -i "s/master/$to_branch/g"
11 | else
12 | from_branch=${1}
13 | to_branch=${2}
14 | rg "https://github.com/brahmGAN/substrate" -t toml -T lock -l | xargs sed -i "s/$from_branch/$to_branch/g"
15 | fi
16 |
--------------------------------------------------------------------------------
/frontier/HEADER-APACHE2:
--------------------------------------------------------------------------------
1 | // This file is part of Frontier.
2 |
3 | // Copyright (C) Parity Technologies (UK) Ltd.
4 | // SPDX-License-Identifier: Apache-2.0
5 |
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 |
--------------------------------------------------------------------------------
/frontier/client/cli/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "fc-cli"
3 | version = "1.0.0-dev"
4 | license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
5 | description = "Frontier CLI interface"
6 | authors = { workspace = true }
7 | edition = { workspace = true }
8 | repository = { workspace = true }
9 |
10 | [package.metadata.docs.rs]
11 | targets = ["x86_64-unknown-linux-gnu"]
12 |
13 | [dependencies]
14 | clap = { workspace = true }
15 | ethereum-types = { workspace = true }
16 | serde = { workspace = true }
17 | serde_json = { workspace = true }
18 | # Substrate
19 | sc-cli = { workspace = true }
20 | sp-api = { workspace = true }
21 | sp-blockchain = { workspace = true }
22 | sp-runtime = { workspace = true }
23 | # Frontier
24 | fc-db = { workspace = true }
25 | fp-rpc = { workspace = true, features = ["default"] }
26 | fp-storage = { workspace = true, features = ["default"] }
27 |
28 | [dev-dependencies]
29 | futures = { workspace = true }
30 | scale-codec = { package = "parity-scale-codec", workspace = true }
31 | tempfile = "3.3.0"
32 | # Substrate
33 | sc-block-builder = { workspace = true }
34 | sc-client-db = { workspace = true, features = ["rocksdb"] }
35 | sp-consensus = { workspace = true }
36 | sp-io = { workspace = true }
37 | substrate-test-runtime-client = { workspace = true }
38 | # Frontier
39 | fc-db = { workspace = true, features = ["rocksdb"] }
40 | frontier-template-runtime = { workspace = true, features = ["default"] }
41 |
42 | [features]
43 | default = ["rocksdb"]
44 | rocksdb = [
45 | "sc-cli/rocksdb",
46 | "fc-db/rocksdb",
47 | ]
48 |
--------------------------------------------------------------------------------
/frontier/client/cli/src/lib.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
2 | // This file is part of Frontier.
3 | //
4 | // Copyright (c) 2021-2022 Parity Technologies (UK) Ltd.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #![deny(unused_crate_dependencies)]
20 |
21 | mod frontier_db_cmd;
22 |
23 | pub use self::frontier_db_cmd::FrontierDbCmd;
24 |
--------------------------------------------------------------------------------
/frontier/client/consensus/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "fc-consensus"
3 | version = "2.0.0-dev"
4 | license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
5 | description = "Frontier consensus for substrate."
6 | authors = { workspace = true }
7 | edition = { workspace = true }
8 | repository = { workspace = true }
9 |
10 | [package.metadata.docs.rs]
11 | targets = ["x86_64-unknown-linux-gnu"]
12 |
13 | [dependencies]
14 | async-trait = { workspace = true }
15 | thiserror = { workspace = true }
16 | # Substrate
17 | sc-consensus = { workspace = true }
18 | sp-api = { workspace = true }
19 | sp-block-builder = { workspace = true, features = ["default"] }
20 | sp-consensus = { workspace = true }
21 | sp-runtime = { workspace = true }
22 | # Frontier
23 | fp-consensus = { workspace = true, features = ["default"] }
24 | fp-rpc = { workspace = true, features = ["default"] }
25 |
--------------------------------------------------------------------------------
/frontier/client/db/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "fc-db"
3 | version = "2.0.0-dev"
4 | license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
5 | description = "Frontier database backend"
6 | authors = { workspace = true }
7 | edition = { workspace = true }
8 | repository = { workspace = true }
9 |
10 | [package.metadata.docs.rs]
11 | targets = ["x86_64-unknown-linux-gnu"]
12 |
13 | [dependencies]
14 | async-trait = { workspace = true }
15 | ethereum = { workspace = true, features = ["with-codec"], optional = true }
16 | futures = { workspace = true, optional = true }
17 | kvdb-rocksdb = { workspace = true, optional = true }
18 | log = { workspace = true }
19 | parity-db = { workspace = true }
20 | parking_lot = { workspace = true }
21 | scale-codec = { package = "parity-scale-codec", workspace = true }
22 | smallvec = { version = "1.10", optional = true }
23 | sqlx = { workspace = true, features = ["runtime-tokio-native-tls", "sqlite"], optional = true }
24 | tokio = { workspace = true, features = ["macros", "sync"], optional = true }
25 | # Substrate
26 | sc-client-api = { workspace = true, optional = true }
27 | sc-client-db = { workspace = true }
28 | sp-api = { workspace = true, optional = true }
29 | sp-blockchain = { workspace = true }
30 | sp-core = { workspace = true }
31 | sp-database = { workspace = true }
32 | sp-runtime = { workspace = true }
33 | sp-storage = { workspace = true, optional = true }
34 | # Frontier
35 | fc-storage = { workspace = true, optional = true }
36 | fp-consensus = { workspace = true, features = ["default"], optional = true }
37 | fp-rpc = { workspace = true, features = ["default"], optional = true }
38 | fp-storage = { workspace = true, features = ["default"] }
39 |
40 | [dev-dependencies]
41 | futures = { workspace = true }
42 | maplit = "1.0.2"
43 | tempfile = "3.3.0"
44 | # Substrate
45 | sc-block-builder = { workspace = true }
46 | sp-consensus = { workspace = true }
47 | substrate-test-runtime-client = { workspace = true }
48 |
49 | [features]
50 | default = ["rocksdb"]
51 | rocksdb = [
52 | "kvdb-rocksdb",
53 | "sc-client-db/rocksdb",
54 | "smallvec",
55 | ]
56 | sql = [
57 | "ethereum",
58 | "futures",
59 | "sqlx",
60 | "tokio",
61 | "sc-client-api",
62 | "sp-api",
63 | "sp-storage",
64 | "fc-storage",
65 | "fp-consensus",
66 | "fp-rpc",
67 | ]
68 |
--------------------------------------------------------------------------------
/frontier/client/db/src/kv/parity_db_adapter.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
2 | // This file is part of Frontier.
3 | //
4 | // Copyright (c) 2022 Parity Technologies (UK) Ltd.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | // Substrate
20 | use sp_database::{error::DatabaseError, Change, ColumnId, Database, Transaction};
21 |
22 | fn handle_err(result: parity_db::Result) -> T {
23 | match result {
24 | Ok(r) => r,
25 | Err(e) => {
26 | panic!("Critical database error: {:?}", e);
27 | }
28 | }
29 | }
30 |
31 | pub struct DbAdapter(pub parity_db::Db);
32 |
33 | impl> Database for DbAdapter {
34 | fn commit(&self, transaction: Transaction) -> Result<(), DatabaseError> {
35 | handle_err(
36 | self.0
37 | .commit(transaction.0.into_iter().map(|change| match change {
38 | Change::Set(col, key, value) => (col as u8, key, Some(value)),
39 | Change::Remove(col, key) => (col as u8, key, None),
40 | _ => unimplemented!(),
41 | })),
42 | );
43 |
44 | Ok(())
45 | }
46 |
47 | fn get(&self, col: ColumnId, key: &[u8]) -> Option> {
48 | handle_err(self.0.get(col as u8, key))
49 | }
50 |
51 | fn contains(&self, col: ColumnId, key: &[u8]) -> bool {
52 | handle_err(self.0.get_size(col as u8, key)).is_some()
53 | }
54 |
55 | fn value_size(&self, col: ColumnId, key: &[u8]) -> Option {
56 | handle_err(self.0.get_size(col as u8, key)).map(|s| s as usize)
57 | }
58 |
59 | fn supports_ref_counting(&self) -> bool {
60 | true
61 | }
62 |
63 | fn sanitize_key(&self, key: &mut Vec) {
64 | let _prefix = key.drain(0..key.len() - super::DB_HASH_LEN);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/frontier/client/db/src/lib.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
2 | // This file is part of Frontier.
3 | //
4 | // Copyright (c) 2020-2022 Parity Technologies (UK) Ltd.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #![deny(unused_crate_dependencies)]
20 |
21 | use scale_codec::{Decode, Encode};
22 | // Substrate
23 | pub use sc_client_db::DatabaseSource;
24 | use sp_core::H256;
25 | use sp_runtime::traits::Block as BlockT;
26 |
27 | pub mod kv;
28 | use kv::{columns, static_keys};
29 |
30 | #[cfg(feature = "sql")]
31 | pub mod sql;
32 |
33 | #[derive(Clone)]
34 | pub enum Backend {
35 | KeyValue(kv::Backend),
36 | #[cfg(feature = "sql")]
37 | Sql(sql::Backend),
38 | }
39 |
40 | #[derive(Clone, Encode, Debug, Decode, Eq, PartialEq)]
41 | pub struct TransactionMetadata {
42 | pub block_hash: Block::Hash,
43 | pub ethereum_block_hash: H256,
44 | pub ethereum_index: u32,
45 | }
46 |
47 | #[derive(Debug, Eq, PartialEq)]
48 | pub struct FilteredLog {
49 | pub substrate_block_hash: Block::Hash,
50 | pub ethereum_block_hash: H256,
51 | pub block_number: u32,
52 | pub ethereum_storage_schema: fp_storage::EthereumStorageSchema,
53 | pub transaction_index: u32,
54 | pub log_index: u32,
55 | }
56 |
57 | #[async_trait::async_trait]
58 | pub trait BackendReader {
59 | async fn block_hash(
60 | &self,
61 | ethereum_block_hash: &H256,
62 | ) -> Result