Smart Contract Design Flashcards
7 cards from real CBSA practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Smart Contract Design flashcards as text
Which design pattern separates a smart contract's logic from its data storage to enable upgradability?
Answer: Proxy pattern
The proxy pattern delegates calls to a logic contract while keeping state in a separate storage contract, allowing logic upgrades without migrating data.
What is a primary security risk of using 'tx.origin' for authorization in a Solidity smart contract?
Answer: It exposes the contract to phishing attacks via malicious intermediary contracts
A malicious contract can trick the original sender into calling it, and tx.origin still returns that user's address, bypassing intended authorization checks.
In smart contract design, what does the 'check-effects-interactions' pattern primarily prevent?
Answer: Reentrancy attacks
By updating internal state (effects) before calling external contracts (interactions), the pattern prevents reentrant calls from exploiting stale state.
Which Ethereum opcode is used internally when a contract sends Ether using the 'transfer' function, and what is its gas stipend?
Answer: CALL with 2300 gas
The 'transfer' function uses the CALL opcode but forwards only 2300 gas, which is enough for a log event but prevents most reentrancy.
What is the purpose of the 'circuit breaker' (emergency stop) pattern in smart contract design?
Answer: To pause contract functionality when a vulnerability is detected
A circuit breaker allows an authorized admin to halt critical functions so funds can be protected while a vulnerability is investigated and fixed.
When designing a smart contract that accepts ERC-20 token payments, why must you call 'approve' before 'transferFrom'?
Answer: Because transferFrom requires prior owner authorization via the allowance mechanism
The ERC-20 allowance mechanism requires the token owner to first approve a spender's address for a specific amount before transferFrom can pull those tokens.
What is 'storage collision' in the context of upgradeable smart contracts using the proxy pattern?
Answer: When a proxy and its logic contract use the same storage slot for different variables
If a proxy contract's admin variable occupies the same storage slot as a variable in the logic contract, one will overwrite the other causing data corruption.
How this page was made: written with AI tools. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- blockchaintrainingalliance.com — Test delivery, renewal, retake policy, score validity, passing score, test dates · verified Oct 2026