Skip to main content

Maker-checker commands for the Directory access manager

Terminal commands that move the Directory access manager to named people, and request, approve and send each checked step, also from a hardware wallet.

The Directory access manager guards the administrator calls of the global DALP contracts. With maker-checker on, one person requests a guarded call and a different person approves it before it can be sent. The four-eyes:* commands carry out that work from a terminal, one transaction per command. They add and remove people, write the rules, turn maker-checker on and off, open deploy windows and take every role from the key that set the chain up.

Each signing command prints the exact transaction and what it means in plain words, asks you to type yes, sends it, and stops. None of them takes a second step for you. four-eyes:status signs nothing and only reads.

Run the commands from the onchain/evm folder of the DALP release checkout, with bun run four-eyes:<command>.

Who does what

The access manager knows three roles. The commands name them by what they do.

Role on the access manager
Name in the commands
What it does
DEFAULT_ADMIN_ROLE
approver
Approves requests, and administers the access manager
DIRECTORY_ADMIN_ROLE
requester
Requests a guarded call, then sends it once it is approved
RECOVERY_GUARDIAN_ROLE
recovery guardian
Approves wallet recoveries through the platform guardian

A person who holds both roles still cannot approve their own request: four-eyes:approve refuses it before it sends anything, and the access manager refuses it too.

Options every command takes

Option
Meaning
--rpc-url <url>
The chain's RPC endpoint, or RPC_URL. It is never printed.
--chain-id <id>
The chain you mean to sign for. The command stops when the RPC answers with another chain id.
--directory <address>
The Directory. Without it, the command reads the Directory from the committed Ignition record of that chain.
--access-manager <address>
The access manager itself, when there is no Directory to read it from.
--key-ref <op://vault/item/field>
The 1Password field that holds the signing key, or FOUR_EYES_KEY_REF.
--signer ledger or trezor
Signs on a hardware wallet. See Sign with a hardware wallet.
--hd-path <path>
The hardware wallet account to sign with, m/44'/60'/0'/0/0 by default.
--signer env
Signs with FOUR_EYES_PRIVATE_KEY instead. Use it on a local test chain only.
--gas-price <wei or auto>
0 by default, for Besu networks that charge no gas. auto reads the price from the chain.
--from-block <n>
The first block to read events from. A request's block makes approve and cancel faster on a long chain.

Without --signer, the signing commands read the key with op read, the 1Password command-line tool, at the moment they need it. The key never appears in the output: any text that would contain it prints [secret] instead. --help on any command prints its own options.

Sign with a hardware wallet

Every signing command can sign on a Ledger or a Trezor in place of a 1Password key. The private key stays on the device. The commands reach the device through cast, the Foundry tool that the release checkout's development environment installs.

Connect the device and unlock it. On a Ledger, open the Ethereum app, allow blind signing in its settings, and close other wallet apps that use the device. Then replace --key-ref with --signer:

bun run four-eyes:approve --proposal <request id> --from-block <request block> \
  --rpc-url "$RPC_URL" --chain-id 47898 --signer ledger

The command asks the device for the address of the account and signs with that account. To use another account, pass its derivation path with --hd-path. On Ledger Live, the second account is usually m/44'/60'/1'/0/0. Check the from line of the transaction block against the wallet you expect.

After you type yes, the command prints three values before the device asks you to confirm:

Line
What it is
signing hash
The hash of the whole unsigned transaction, chain id included. The device signs this value.
chain
The chain id inside the signed transaction.
short hash
The short hash of the call the device signs, the same one the requester and the approver compare.

If your device shows a transaction hash, compare it with the signing hash, and reject on the device when they differ. A device screen does not show the short hash.

The command also checks what comes back from the device. It sends nothing when the signed transaction has no chain id or another chain id, carries other calldata, changes the target, nonce, gas, gas price or value, or comes from another account.

Read the setup

bun run four-eyes:status --rpc-url "$RPC_URL" --chain-id 47898

four-eyes:status needs no key. It prints one section per check, and each line starts with ok, info or WARN. It exits with 1 when it printed any warning, so a pipeline can stop on it.

Section
What it checks
People and roles
The holders of each role, each named when the people list holds its wallet, against the people the network config lists for this chain, both ways: a listed person who lacks the role, and a role holder who is not listed, other than the old setup key, which the Old key row reports. It also names an approver whose wallet cannot request.
Maker-checker
Whether maker-checker is on and the longest deploy window the access manager allows, each against the chain's entry in the network config.
Directory
That the Directory names this access manager. It then reads the contracts whose calls the rules cover.
Rules
Every guarded function of every covered contract, with its approver role, the number of approvals it needs and how long a request lives. A function with no rule prints NO RULE as a warning.
Approver seats
The number of approvers on chain against the floor and the advised count. The floor is one more than the approvals the access manager's own grantRole, revokeRole or setActionConfig rule needs, and at least one. The advised count is two more than the approvals the strictest rule needs, and at least three: one to request, the approvers that rule needs and one spare.
Deploy window
Whether a deploy window is open, for which key, until when and for which release commit. An open window is a warning.
Code and release
The open window's release commit against the commit of this checkout, and each implementation on chain against this checkout's Ignition record. When both match, the code on chain is that release's code. An implementation the record lacks, or an older one, is a warning.
Account factory guardian
The account factory's platform guardian, with a warning when it is not the DALP guardian.
Old key
Any role the old setup key still holds on the access manager.
Holder accounts guarded by the old key
Every holder account that lists the old setup key as a recovery guardian. Only the account itself can change its guardians, so each one is a warning that no command closes.

Under a warning that one command fixes, four-eyes:status prints close it: and that command, ready to run against the same chain. A listed person who lacks a role, or an approver whose wallet cannot request, gets an add-person line that names the same --people and --networks files you gave four-eyes:status. A role holder the network config does not list, other than the old key, gets a remove-person line, and an old key that still holds a role gets a remove-old-key line. A function with NO RULE gets one set-rules line after the Rules section, a difference between the chain's maker-checker switch and the network config gets an enable-maker-checker or disable-maker-checker line, and an approver seat warning repeats the add-person line for a listed person who lacks the role, or tells you to add a person to the network config when it lists too few. A warning no command closes, such as a longest-window difference or a Directory that names another access manager, stays as it is.

Every step command reads the committed Ignition record of the chain you name with --chain-id, the folder ignition/deployments/chain-<id>, even in the repo's devenv shell where IGNITION_DEPLOYMENT_ID names the local stack. Only the local chain, 31337, follows IGNITION_DEPLOYMENT_ID. --directory and --old-key still override the record.

The seat check also warns when fewer approvers hold the role than one to request, the approvals the strictest rule needs and one spare, and when any role a rule relies on has fewer than two holders, since one lost key would then lock it.

Option
Default
--people <file>
ignition/config/four-eyes/people.json
--networks <file>
ignition/config/four-eyes/networks.json
--old-key <address>
The access manager's first admin in the chain's Ignition record. Pass it on a chain with no record.

Hand the access manager from the setup key to people

On a chain that a single key set up, that key holds the approver, requester and recovery guardian roles on the access manager. These steps give the roles to named people, turn maker-checker on and then take every role from the setup key. Run four-eyes:status between steps: it shows what is left and prints the command for the next step.

  1. Each person adds a signed entry for their own wallet to the people list. bun ignition/config/four-eyes/join.ts --name <name> --address <wallet> --level approver (or --level requester) prints a text to sign in that wallet. The same command with --signature <signature> adds the entry. The change goes in through a pull request and grants nothing on any network.
  2. The network config (ignition/config/four-eyes/networks.json) names the approvers and requesters of each network. Add the people there in the same pull request.
  3. While maker-checker is off, the setup key runs four-eyes:add-person --name <name> for each person. It grants each approver the approver role and each requester the requester role. An approver who also requests gets the requester role from a second run with --role requester. Add at least two approvers, and three to keep a spare.
  4. The setup key runs four-eyes:set-rules to write the standard rule, one approval by an approver, on every guarded function.
  5. The setup key runs four-eyes:enable-maker-checker. From then on every guarded call needs a request and an approval.
  6. Request, approve and open one deploy window, then close it, as described in Open a deploy window. This proves the approvers can work before the setup key loses its roles.
  7. For each role holder other than the setup key that four-eyes:status reports as not listed, request remove-person with its --address and --role, have it approved, then send four-eyes:remove-person with the same options.
  8. Request remove-old-key, have it approved, then send four-eyes:remove-old-key. Each run takes one role from the setup key, the approver role last, and prints the command for the next role. Repeat until four-eyes:status prints the old key <address> holds no role on the access manager.

A holder account that lists the setup key as a recovery guardian keeps it after these steps, because only the account can change its own guardians. four-eyes:status lists each such account under Holder accounts guarded by the old key.

Commands that change people and rules

Each of these commands sends one call to the access manager. While maker-checker is off, the role alone is enough. While it is on, each call needs an approved request for exactly the same options, as in Open a deploy window: four-eyes:request <command> <options>, then four-eyes:approve, then the command itself.

Command
What it sends
four-eyes:add-person --name <name> [--role <role>]
Grants one role to the wallet the people list names. The role is approver, requester or recovery-guardian, and defaults to the person's level.
four-eyes:remove-person --address <wallet> --role <role>
Takes one role from one wallet.
four-eyes:set-rules [--contract <name>]
Writes the standard rule on every guarded function that lacks it, or on one contract's functions.
four-eyes:set-rules --function <contract.function>
Writes the standard rule on one function, such as directory.setInstance.
four-eyes:set-rules --role-only <contract.function>
Writes a rule of zero approvals for one function, such as directory.setInstance, so its role alone calls it.
four-eyes:enable-maker-checker
Turns maker-checker on.
four-eyes:disable-maker-checker
Turns maker-checker off. Every guarded call then goes through on the role alone.
four-eyes:remove-old-key [--old-key <address>]
Takes one role from the setup key, the approver role last, and prints the command for the next one.

four-eyes:request takes open-window, extend-window, add-person, remove-person, set-rules, disable-maker-checker and remove-old-key. Turning maker-checker on needs no request, because the access manager waives approvals while it is off.

The access manager's own grantRole, revokeRole, setActionConfig, disableMakerChecker, upgradeToAndCall, openWindow and extendWindow must each have a rule of at least one approval before maker-checker turns on, and keep one while it is on. Without that, one person could turn the control off or give themselves a second role alone.

When these commands refuse

four-eyes:add-person refuses when:

  • the people list has no entry with that name
  • the entry's signature does not recover to its wallet: the person signs again with join.ts
  • the person is listed as a requester and the role is approver or recovery guardian
  • the network config does not list the person for that role on this network
  • the wallet already holds the role

four-eyes:remove-person and four-eyes:remove-old-key refuse when the wallet holds no such role, and when taking the approver role would leave fewer approvers than the floor. They warn, and ask before going on, when it would leave fewer approvers than the advised count.

four-eyes:set-rules refuses when every rule it would write is already the standard rule, when the access manager has fewer than two approvers, and when --role-only names one of the access manager's own guarded functions.

four-eyes:enable-maker-checker refuses when maker-checker is already on, when it is given --access-manager instead of a Directory, because it then cannot check the next point, when the platform guardian, a factory or a global registry does not answer to this access manager, and when one of the access manager's own guarded functions has no rule of at least one approval. It warns when a guarded function has no rule (once maker-checker is on, every call to such a function is refused), and when the access manager has fewer approvers than the advised count.

four-eyes:disable-maker-checker refuses when maker-checker is already off.

Open a deploy window

A deploy window lets a fresh deploy key act as a requester for a short time, for one release commit. The window key must hold no role of its own, and the window cannot outlast the longest window the access manager allows. With maker-checker on, opening and extending a window each need an approved request for exactly the same arguments.

  1. A requester asks for the window:

    bun run four-eyes:request open-window --key 0xNewDeployKey --duration 4h --release <40-digit commit> \
      --rpc-url "$RPC_URL" --chain-id 47898 --key-ref op://Deploy/requester/private-key

    It prints the propose transaction, the request id and the command to give an approver.

  2. A different approver checks and approves it:

    bun run four-eyes:approve --proposal <request id> --from-block <request block> \
      --rpc-url "$RPC_URL" --chain-id 47898 --key-ref op://Deploy/approver/private-key

    It reads the request's calldata back from the chain, checks it against the stored hash, and shows what the request does and its short hash. Compare that short hash with the one the requester sees: the same call always gives the same short hash, and a different key, duration or commit gives a different one. The short hash is 20 hex digits in groups of four, too long for a requester to search out a different call that shows the same one.

  3. Once the request has its approvals, the requester sends the step:

    bun run four-eyes:open-window --key 0xNewDeployKey --duration 4h --release <40-digit commit> \
      --rpc-url "$RPC_URL" --chain-id 47898 --key-ref op://Deploy/requester/private-key

A duration is a number of seconds, or a number followed by s, m, h or d. 4h and 240m are the same window and give the same short hash.

four-eyes:extend-window --key <address> --duration <1h> adds time to the open window. It follows the same three steps, with extend-window as the request.

Close the window

bun run four-eyes:close-window --rpc-url "$RPC_URL" --chain-id 47898 --key-ref op://Deploy/requester/private-key

Closing needs no approval. The window key, a requester or an approver may close it. Close it as soon as the deploy is done, then run four-eyes:status to see no deploy window is open.

Deploy a release inside a window

Once a chain's Directory links its access manager, a release upgrade (bun run upgrade:<network>) runs inside a deploy window by itself. The run that first installs the access manager still deploys with the deploy key it always used. A redeploy (bun run redeploy:<network>) builds a new system at new addresses and sends nothing to the old Directory, so it deploys with that same deploy key, which becomes the first administrator of the new system.

bun run upgrade:staging --window-vault Deploy --key-ref op://Deploy/requester/private-key

The run:

  1. Makes a fresh deploy key for the release and keeps it in the 1Password vault you name, with the release's commit beside it. A run that stopped halfway resumes with the key it kept, also from a later commit with the same onchain/evm outside ignition/deployments. A kept key made for another release is retired first: the run closes its window, sends its gas back to the gas wallet and deletes it, then makes a new key for this release.
  2. Opens the window for that key and this checkout's commit. With maker-checker off the requester sends it. With maker-checker on the run sends nothing itself: it prints the four-eyes:request open-window command, and goes on once a requester and an approver have opened the window (it waits up to --approval-timeout, 2 hours by default). With maker-checker on it deploys only inside a window a second approver opened after maker-checker was last turned on, for this checkout's commit or for an earlier commit with the same onchain/evm outside ignition/deployments. It refuses any other window before it sends anything, so a window opened while maker-checker was off has to be closed and opened again with approval. The run also refuses a checkout with uncommitted changes in onchain/evm outside ignition/deployments, even with --allow-unmerged-sources, because the window names only the commit.
  3. On a chain that charges gas, tops the key up from the gas wallet (--gas-wallet-ref) to at most --gas-cap wei. The cap must cover at least one transfer's fee, so the key can always send what it holds over the cap back, and the run refuses a smaller cap before it sends anything. A kept key that holds more, for example after --gas-cap was lowered, sends the excess back to the gas wallet instead. The gas wallet must hold no role on the access manager. The run refuses one that does before it sends anything.
  4. Deploys the release from the deploy key. Before each of its transactions it reads the window, and once less than --window-margin (15 minutes by default) is left it stops without sending, so no step fails. The window, the key and its gas stay as they are: extend the window with four-eyes:extend-window and run the same command again. A run that started with maker-checker off also stops this way once maker-checker is turned on, because no second approver opened its window. Close the window with four-eyes:close-window, have a window for the same key requested and approved, and run the same command again. The run also stops before its next transaction when a window is opened, or maker-checker is turned on, after it checked its window, because that check no longer covers the window that is open. Run the same command again: it checks the open window before it sends anything. The transactions the run already sent, up to one batch of steps it sends together, can still be mined after maker-checker turns on, so turn maker-checker on only while four-eyes:status shows no deploy window is open. A rerun from a later main that only adds the journal lines the run wrote keeps the approved window, because the contracts and modules it deploys are unchanged.
  5. Closes the window, sends the key's remaining gas back to the gas wallet, and deletes the key from the vault only once every step of the release has finished. A remainder smaller than one transfer's fee cannot be sent back, so it stays at the key's address and the run prints the amount and the address.
Option
Meaning
--window-vault <vault>
The 1Password vault that keeps the deploy key until the release is deployed.
--key-ref <op://…>
The requester key that opens the window while maker-checker is off.
--gas-wallet-ref <op://…>
The gas wallet that funds the deploy key, on a chain that charges gas.
--gas-cap <wei>
The most the deploy key holds at once, at least one transfer's fee. Required on a chain that charges gas.
--window-duration <4h>
The window the run opens or asks for.
--window-margin <15m>
Stop sending once the window has less than this left.
--approval-timeout <2h>
With maker-checker on, how long the run waits for the approved window.
--yes
Send the requester's and the gas wallet's transactions without asking.

The deploy key can upgrade the access manager itself without a request, so a release that upgrades the access manager also finishes inside the one approved window, with no approver online.

On-prem: the contract-deployment Job

The Helm contract-deployment Job signs with the key in its Conjur variable or Secret. To run a release inside a window:

  1. Make a fresh key that holds no role, and open a window for it with the steps in Open a deploy window. Pass --release the commit the Job's image was built from: the image carries it as GIT_SHA (docker image inspect <image> --format '{{json .Config.Env}}'), and the Job prints it when it starts.
  2. Put the key in the Conjur variable the Job maps to PRIVATE_KEY for this run.
  3. Run the Job. It reads the window first and stops before the window closes, leaving every step unfailed. Extend the window and run the Job again to resume. When maker-checker is turned on while the Job runs, it stops the same way: close the window, have an approved window opened for the same key, and run the Job again. It also stops when a window is opened, or maker-checker is turned on, after it checked its window: run the Job again, and it checks the open window before it sends anything. The transactions the Job already sent, up to one batch of steps it sends together, can still be mined after maker-checker turns on, so turn it on only while no deploy window is open. With maker-checker on, the Job stops before it sends anything when its key holds no open window or when the window was approved for another commit than its image's.
  4. After the Job finishes, close the window and remove the key from Conjur.

Cancel a request

bun run four-eyes:cancel --proposal <request id> --from-block <request block> \
  --rpc-url "$RPC_URL" --chain-id 47898 --key-ref op://Deploy/requester/private-key

The requester or an approver may cancel an open request, an expired one, or one whose rule changed after it was made.

When a command refuses

A refusal prints Refused: with the reason, then Nothing was sent., and exits with 1. four-eyes:approve refuses before asking you to confirm when:

  • you made the request yourself
  • you already approved it
  • the request expired: the requester must request it again
  • the rule changed after the request was made, so the request no longer counts
  • the calldata on chain does not match the request's stored hash
  • you hold none of the approver roles the request needs

Answering anything other than yes prints Not sent. Nothing changed on chain. A sent transaction prints its hash, block and status, then Stopped. This command takes no further step. A transaction that reverts exits with 1.

Was this page helpful?