タイムロックと実行
安全なアップグレード
「タイムロックと実行」はCoddyKit上の無料Web3 & DApp Development Fundamentalsレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはWeb3 & DApp Development Fundamentals学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Web3 & DApp Development Fundamentalsコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Why Timelocks Exist
A timelock is a mandatory delay between when a proposal passes and when it executes.
It protects users by giving them time to react to changes they disagree with — for example, withdrawing funds before a risky upgrade.
The TimelockController
OpenZeppelin's TimelockController is a contract that schedules, delays, and then executes operations.
The Governor proposes and queues actions into the timelock, which actually owns the protocol's admin rights.
contract Timelock is TimelockController {
constructor(uint minDelay, address[] proposers, address[] executors)
TimelockController(minDelay, proposers, executors, msg.sender) {}
}Schedule, Wait, Execute
Operations flow through three steps:
- schedule — queue the action with a delay
- wait — the minDelay must elapse
- execute — run the action after the delay
timelock.schedule(target, value, data, predecessor, salt, delay);
// ... wait minDelay ...
timelock.execute(target, value, data, predecessor, salt);The minDelay Parameter
The minDelay sets how long every scheduled operation must wait. Common values range from 1 to 7 days.
Longer delays mean more safety but slower governance — a deliberate trade-off each DAO must tune.
Roles in the Timelock
The timelock uses access roles:
- PROPOSER — can schedule operations (the Governor)
- EXECUTOR — can run them after the delay
- ADMIN — manages roles (often renounced)
Timelock Owns the Protocol
For governance to be meaningful, the timelock contract should hold the protocol's admin and ownership rights — not any individual.
This ensures every privileged change must pass through the full govern-then-delay pipeline.
protocol.transferOwnership(
address(timelock)
);Defense Against Malicious Proposals
If an attacker sneaks a harmful proposal through voting, the timelock delay is the last line of defense.
The community can spot the queued action and exit or coordinate a response before it executes.
Predecessor and Salt
Each scheduled operation can specify a predecessor (an operation that must run first) and a salt to make its identifier unique.
These let DAOs order dependent operations and avoid hash collisions between similar actions.
Cancelling Operations
A scheduled operation can be cancelled before execution by an address with the canceller role.
This provides an emergency brake if a queued action is found to be dangerous during the delay window.
timelock.cancel(operationId);Upgrades Done Safely
Combining Governor + Timelock + a proxy pattern lets DAOs upgrade contracts safely: vote, queue, delay, then execute the upgrade.
Every step is transparent and reversible up until execution, balancing flexibility with security.
Putting It Together
The timelock enforces a delay between approval and execution, owns the protocol's privileges, and uses roles plus cancellation to keep upgrades safe.
It is the crucial buffer that makes on-chain governance trustworthy.
Quick Check
Test your timelock understanding.
Recap: Timelocks and Execution
You learned that:
- A timelock delays execution after a proposal passes
- TimelockController schedules, waits, then executes
- minDelay tunes the safety vs speed trade-off
- The timelock should own the protocol; roles control access
- Operations can be cancelled during the delay
Course complete! Next course: Layer 2 and Scaling.
よくある質問
「タイムロックと実行」レッスンは無料ですか?
はい。「タイムロックと実行」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Web3 & DApp Development Fundamentalsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Web3 & DApp Development Fundamentalsコースには全4レッスンが含まれています。
「タイムロックと実行」で何を学びますか?
安全なアップグレード ブラウザで直接実行するハンズオンコードでWeb3 & DApp Development Fundamentalsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Web3 & DApp Development Fundamentalsを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのWeb3 & DApp Development Fundamentalsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「タイムロックと実行」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このWeb3 & DApp Development Fundamentalsレッスンでコードを書いて実行できますか?
はい。すべてのWeb3 & DApp Development Fundamentalsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。