By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Study Guide – Forks (Soft Fork vs Hard Fork) & Governance Target audience: software engineers & finance professionals moving into crypto
A fork is a coordinated change to a blockchain’s protocol rules. It lets the network adopt new features, fix bugs, or shift economic parameters without shutting down. In a soft fork the new rules are a strict subset of the old ones, so non‑upgraded nodes still see the chain as valid; in a hard fork the new rules are incompatible, creating a split where upgraded nodes follow a different chain. Governance is the process (on‑chain or off‑chain) that decides when and why a fork happens—think of a DAO voting to upgrade Uniswap’s fee model or a token‑holder vote to migrate an ERC‑20 token to a new contract.
UNI
COMP
```solidity // Minimal DAO proposal execution (simplified) contract SimpleDAO { mapping(address => uint256) public votes; uint256 public totalVotes; address public pendingImplementation;
function propose(address _newImpl) external { pendingImplementation = _newImpl; } function vote(uint256 _weight) external { votes[msg.sender] += _weight; totalVotes += _weight; } function execute() external { require(totalVotes > 1e6, "quorum not met"); // upgrade logic would go here }
} ```
solidity // Transparent proxy snippet contract Proxy { address public implementation; fallback() external payable { (bool success, ) = implementation.delegatecall(msg.data); require(success); } }
vote(uint256)
bash npx hardhat run scripts/deploy.js --network goerli 5. Activate the Fork on Mainnet – Once the testnet passes, schedule the upgrade with a Timelock (e.g., 48‑hour delay) and broadcast the transaction using Ethers.js:
bash npx hardhat run scripts/deploy.js --network goerli
js const tx = await timelock.schedule( proxy.address, 0, ethers.utils.id("upgrade(address)"), [newImpl], 0, 48 * 60 * 60 ); await tx.wait(); 6. Monitor the Network – After the block containing the upgrade is mined, verify that all nodes have upgraded; watch for chain split warnings and replay‑attack mitigations.
js const tx = await timelock.schedule( proxy.address, 0, ethers.utils.id("upgrade(address)"), [newImpl], 0, 48 * 60 * 60 ); await tx.wait();
Mistake: Assuming a soft fork will never cause a chain split. Correction: Even soft forks can create temporary forks if a majority of miners reject the new rule; always test on a public testnet first.
Mistake: Forgetting to update the chain ID after a hard fork, leading to replayable transactions. Correction: Increment the chainId in the genesis file and embed it in every signed transaction (EIP‑155).
chainId
Mistake: Using a single‑owner upgrade proxy for a community‑driven fork. Correction: Deploy a multisig or DAO‑controlled proxy so governance, not a single key, decides the upgrade.
Mistake: Skipping the timelock and executing upgrades instantly. Correction: Timelocks give token holders a window to exit or challenge the change, reducing governance risk.
Mistake: Ignoring EIP‑2718 (typed transaction) compatibility, causing nodes that don’t support the new transaction type to reject blocks. Correction: Ensure all client software (Geth, OpenEthereum, Besu) is upgraded to the version that implements the new EIP.
Scenario: A contract uses tx.origin to restrict withdrawals to the contract creator. Answer: Dangerous – tx.origin can be spoofed through a malicious contract that forwards a call, allowing an attacker to bypass the check.
tx.origin
Scenario: After a hard fork, a user’s ERC‑20 token balance appears on both chains. Answer: The fork created two independent ledgers; the token contract must be upgraded on each chain or a migration script must be run to reconcile balances.
Scenario: A DAO proposal passes, but the upgrade transaction fails because the network is still on the old fork. Answer: The upgrade must be scheduled after the fork block height; otherwise the new logic is rejected by nodes that haven’t adopted the new rules.
unchecked {}
You now have a project‑ready cheat sheet to design, implement, and audit fork‑related governance mechanisms. Happy coding!
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.