Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does CI/CD stand for in the context of smart contracts?
CI/CD stands for Continuous Integration and Continuous Delivery. It means automatically testing and deploying smart contracts to make sure they work well and reach users quickly.
Click to reveal answer
beginner
Why is automated testing important for smart contracts in CI/CD?
Automated testing checks smart contracts for errors before they are deployed. This helps avoid costly mistakes since smart contracts cannot be changed easily once live.
Click to reveal answer
intermediate
Name a common tool used for smart contract testing in CI/CD pipelines.
Truffle and Hardhat are popular tools that help write and run tests for smart contracts automatically.
Click to reveal answer
intermediate
What is a deployment script in smart contract CI/CD?
A deployment script is a set of instructions that automatically sends the smart contract code to the blockchain network during the delivery phase.
Click to reveal answer
beginner
How does version control help in CI/CD for smart contracts?
Version control keeps track of all changes to smart contract code. It helps teams work together and roll back to earlier versions if needed.
Click to reveal answer
What is the main goal of Continuous Integration in smart contract development?
ADeploy contracts without testing
BManually review code before deployment
CAutomatically test code changes to catch errors early
DWrite contracts without version control
✗ Incorrect
Continuous Integration means automatically testing code changes to find problems early.
Which tool is commonly used to write and test Ethereum smart contracts?
ATruffle
BDocker
CKubernetes
DJenkins
✗ Incorrect
Truffle is a popular framework for developing and testing Ethereum smart contracts.
Why is deploying smart contracts manually risky?
AIt can cause human errors and delays
BIt is faster than automation
CIt does not require testing
DIt is cheaper
✗ Incorrect
Manual deployment can lead to mistakes and slow down the release process.
What does Continuous Delivery ensure in smart contract pipelines?
AContracts are never deployed
BSmart contracts are ready to deploy anytime
CContracts are only tested locally
DContracts are deleted after testing
✗ Incorrect
Continuous Delivery means smart contracts are always in a deployable state.
Which blockchain network is commonly used for deploying smart contracts in CI/CD examples?
ALitecoin
BBitcoin
CRipple
DEthereum
✗ Incorrect
Ethereum is the most popular blockchain for smart contracts.
Explain the steps involved in a CI/CD pipeline for smart contracts.
Think about how code moves from writing to live on the blockchain.
You got /5 concepts.
Describe why automation is critical in smart contract deployment.
Consider the risks of manual deployment and benefits of automation.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of using CI/CD pipelines for smart contracts?
easy
A. To manually write smart contract code faster
B. To avoid writing tests for smart contracts
C. To store smart contracts on a local machine only
D. To automate compiling, testing, and deploying smart contracts
Solution
Step 1: Understand CI/CD role in smart contracts
CI/CD pipelines automate repetitive tasks like compiling, testing, and deploying smart contracts to reduce errors and save time.
Step 2: Compare options with CI/CD purpose
Only To automate compiling, testing, and deploying smart contracts describes automation of compile, test, and deploy steps, which is the core of CI/CD.
Final Answer:
To automate compiling, testing, and deploying smart contracts -> Option D
Quick Check:
CI/CD automates smart contract lifecycle steps = B [OK]
Hint: CI/CD means automate build, test, deploy steps [OK]
Common Mistakes:
Thinking CI/CD is for manual coding
Confusing storage with deployment
Skipping testing in CI/CD
2. Which of the following is the correct syntax to trigger a GitHub Actions workflow on every push to the main branch for smart contract CI/CD?
C. Compile MyContract.sol and output binary files to build/ directory
D. Delete build/ directory
Solution
Step 1: Understand solc compile command
The command 'solc --bin MyContract.sol -o build/' compiles the Solidity file and outputs binary files to the specified build directory.
Step 2: Match command purpose to options
Only Compile MyContract.sol and output binary files to build/ directory correctly describes compiling and outputting binaries, while others describe unrelated actions.
Final Answer:
Compile MyContract.sol and output binary files to build/ directory -> Option C
Quick Check:
solc --bin compiles and outputs binaries = C [OK]
Hint: solc --bin compiles Solidity to binary output [OK]
Common Mistakes:
Confusing compile with deploy
Assuming tests run automatically
Thinking it deletes files
4. You have this GitHub Actions step to deploy a smart contract:
But the deployment fails with an error about missing network configuration. What is the likely cause?
medium
A. The 'truffle migrate' command is misspelled
B. The 'mainnet' network is not defined in truffle-config.js
C. The GitHub Actions runner lacks internet access
D. The smart contract code has syntax errors
Solution
Step 1: Analyze error about missing network configuration
The error indicates the deployment tool cannot find the 'mainnet' network settings in the configuration file.
Step 2: Identify cause of missing network config
If 'mainnet' is not defined in truffle-config.js, deployment fails. Syntax errors or internet issues cause different errors, and the command spelling is correct.
Final Answer:
The 'mainnet' network is not defined in truffle-config.js -> Option B
Quick Check:
Missing network config causes deployment failure = D [OK]
Hint: Check truffle-config.js for network definitions first [OK]
Common Mistakes:
Blaming code syntax for network config errors
Ignoring configuration files
Assuming internet issues without checking config
5. You want to ensure your smart contract CI/CD pipeline only deploys contracts after all tests pass and on the 'release' branch. Which GitHub Actions workflow snippet correctly enforces this?
hard
A. on:
push:
branches: [release]
jobs:
build:
steps:
- run: npm test
deploy:
needs: build
if: success()
steps:
- run: truffle migrate --network mainnet
B. on:
push:
branches: [main]
jobs:
deploy:
steps:
- run: truffle migrate --network mainnet
C. on:
pull_request:
branches: [release]
jobs:
test:
steps:
- run: npm test
deploy:
steps:
- run: truffle migrate --network mainnet
D. on:
push:
branches: [release]
jobs:
deploy:
steps:
- run: truffle migrate --network mainnet
Solution
Step 1: Identify branch trigger and job dependencies
The pipeline triggers on push to 'release' branch. It runs tests first in 'build' job, then deploys only if tests succeed using 'needs: build' and 'if: success()'.
Step 2: Compare options for correct workflow logic
on:
push:
branches: [release]
jobs:
build:
steps:
- run: npm test
deploy:
needs: build
if: success()
steps:
- run: truffle migrate --network mainnet correctly sequences test then deploy with condition and branch filter. Others miss test step, branch, or job dependency.
Final Answer:
on:
push:
branches: [release]
jobs:
build:
steps:
- run: npm test
deploy:
needs: build
if: success()
steps:
- run: truffle migrate --network mainnet -> Option A
Quick Check:
Test before deploy on release branch = A [OK]
Hint: Use job dependencies and branch filters in workflow [OK]