# Confirmationで定期の行動を進める

> 反対が出ないと見込める定期の行動を、SVのconfirmationを集めて実行する道と、投票の行動と自動の行動の分かれ方を、表と2つの図で追います。

- URL: https://cardene.dev/diagrams/canton-dso-confirm
- 公開日: 2026-11-21
- 更新日: 2026-11-21
- トピック: Blockchain
- タグ: Canton
- 親の図解: [DSOの投票とConfirmation](https://cardene.dev/diagrams/canton-dso-governance.md): DSOがSVの投票とconfirmationで行動を決めて実行する仕組みを、章の中の図解で追います。

DSOの行動には、各SVのノードのconfirmationを集めて進める道もあります。
そこで、この頁では、反対が出ないと見込める定期の行動を、confirmationを集めてどう実行するかと、どの行動が投票で動き、どの行動が自動で動くかを追います。

前の頁「SVの投票でDSOの行動を決める」では、投票の依頼が票と時刻で閉じて、行動が実行される道を見ました。

https://cardene.dev/diagrams/canton-dso-vote

`dso`は、分散したSynchronizerの運用を表すpartyです。
signatoryとchoiceとcontrollerは、Damlでコントラクトと操作の認可を表す語で、「誰が変更を頼めるかを決める」の頁で見ました。

https://cardene.dev/diagrams/canton-ledger-authorization

Optionalは、値がある時と無い時を分ける型で、値が無い時はNoneです。
`DsoRules`は、DSOの規則のコントラクトです。

## confirmationが要る行動の2つの道

`ActionRequiringConfirmation`は、実行する前にSVのノードのconfirmationを要する行動を表す型です。
confirmationが要る行動を実行する手順は、2つあります。

1つ目の手順は、どのSVも投票を求め、ほかのSVが実行を受け入れるかを投票で答える手順です。
この手順は、行動を確定とみなすのに全てのSVの3分の2の投票を要し、confirmationが要る全ての行動に使えます。

2つ目の手順は、台帳とSVのノードの壁時計が決まった状態になった時に自動で実行すべき行動のためのものです。
前提が満たされると、各SVのノードが自動でconfirmationを作ります。
全てのSVの3分の2のconfirmationがDSOの代表に見えると、代表がその行動を実行します。
この3分の2は、わかりやすくするための簡略で、正確な式は`requiredNumVotes`が持ちます。

2つ目の手順は、行動に反対が出ないと見込める場合のための、1つ目の手順の最適化です。
正直なSVのノードは前提を満たす行動にだけconfirmationを作ると想定し、要る数より多いconfirmationが作られうるため、行動の実行が冪等であることに頼ります。
冪等は、何度行っても1度行った時と同じ結果になることです。
手順を2つ持つことで、手動で始めた臨時の投票と、標準のDSOの間に要る定期のconfirmationを見分けやすくなります。

## Confirmationのコントラクトとchoice

`Confirmation`は、標準のDSOの一部としてSVが行動を取るためのconfirmationで、自動の行動を短い手順で実行するのに使います。
signatoryは`dso`です。
次の表が、欄ごとの型です。

| 欄 | 型 |
|---|---|
| `dso` | `Party` |
| `confirmer` | `Party` |
| `action` | `ActionRequiringConfirmation` |
| `expiresAt` | `Time` |

`Confirmation`のchoiceは、次の表の2つです。

| choice | controller | 受け取る物 | 返す物 |
|---|---|---|---|
| `Archive` | `dso` | なし | `()` |
| `Confirmation_Expire` | `dso` | なし | `Confirmation_ExpireResult`。欄を持たない |

`DsoRules`のchoiceのうち、confirmationを作るchoiceと、confirmationを集めて行動を実行するchoiceと、古いconfirmationを扱うchoiceを、次の表に並べます。

| choice | controller | 受け取る物 | 返す物 |
|---|---|---|---|
| `DsoRules_ConfirmAction` | `confirmer` | `confirmer`と、型が`ActionRequiringConfirmation`の`action` | `DsoRules_ConfirmActionResult`。作った`Confirmation`を指す欄`confirmation` |
| `DsoRules_ExecuteConfirmedAction` | `sv` | `action`と、Optionalの`amuletRulesCid`と、`Confirmation`のリストの`confirmationCids`と、Optionalの`sv` | `DsoRules_ExecuteConfirmedActionResult`。欄を持たない |
| `DsoRules_ExpireStaleConfirmation` | `sv` | `staleConfirmationCid`と、Optionalの`sv` | `DsoRules_ExpireStaleConfirmationResult` |

## confirmationを集めて実行する道

次の図Aでは、前提が満たされた行動が、confirmationを集めて実行されるまでを追います。
この図では、箱を、SVのノードとConfirmationとDSOの代表の3つで描き、線は、SVのノードがconfirmationを作る場面と、DSOの代表がconfirmationを見る場面にだけ引きます。
段1と段4は、線を置かず、前提と実行の回数を言う段です。

```dragon
sequence confirmationを集めて行動を実行する道

box N as SVのノード [note: 各SVが動かす, color: blue, icon: server]
box C as Confirmation [note: SVが作る, color: rose, icon: layers]
box R as DSOの代表 [note: 行動を実行する, color: slate, icon: user]

step 前提が満たされる
  say 台帳とSVのノードの壁時計が決まった状態になり、行動の前提が満たされます。
  act N: 行動の前提が満たされる
  source CantonのSplice.DsoRules [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-dso-governance/splice-dsorules]

step confirmationを作る
  say 前提が満たされると、各SVのノードが自動でconfirmationを作ります。
  N -> C: 作る
  source CantonのSplice.DsoRules [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-dso-governance/splice-dsorules]

step confirmationが見える
  say 全てのSVの3分の2のconfirmationがDSOの代表に見えると、代表がその行動を実行します。
  R -> C: 見る
  source CantonのSplice.DsoRules [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-dso-governance/splice-dsorules]

step 行動を実行する
  say confirmationが集まった行動は、どれも多くとも1回しか実行できません。
  act R: 1回だけ実行する
  source CantonのSplice.DsoRules [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-dso-governance/splice-dsorules]
```

行動を実行する関数は、`executeActionRequiringConfirmation`です。
この関数は、party、`DsoRules`、Optionalの`AmuletRules`、`ActionRequiringConfirmation`を受け取り、SVの決まった数のconfirmationを要する行動を実行します。

## confirmationが要る行動の型

`ActionRequiringConfirmation`のコンストラクタは、次の表の4つです。

| コンストラクタ | 欄 |
|---|---|
| `ARC_DsoRules` | `dsoAction` |
| `ARC_AmuletRules` | `amuletRulesAction` |
| `ARC_AnsEntryContext` | `ansEntryContextCid`と`ansEntryContextAction` |
| `ExtActionRequiringConformation` | `dummyUnitField`。型は`()` |

`ExtActionRequiringConformation`は、Daml 3.0でバリアントをアップグレードできないことを回避し、個別のバリアントを拡張できるようにする、拡張のコンストラクタです。

次の表が、区分ごとの行動です。

| 区分 | 行動 | 中身 |
|---|---|---|
| `ARC_DsoRules` | `SRARC_AddSv` | SVを直接足す投票の行動 |
| `ARC_DsoRules` | `SRARC_OffboardSv` | SVを外す投票の行動 |
| `ARC_DsoRules` | `SRARC_ConfirmSvOnboarding` | あるpartyがSVになれることを確かめる自動の行動 |
| `ARC_DsoRules` | `SRARC_GrantFeaturedAppRight` | featuredアプリの資格を与える投票の行動で、冪等ではない |
| `ARC_DsoRules` | `SRARC_RevokeFeaturedAppRight` | 特定のfeaturedアプリの資格を取り消す |
| `ARC_DsoRules` | `SRARC_SetConfig` | `DsoRulesConfig`を変える投票の行動で、冪等ではない |
| `ARC_DsoRules` | `SRARC_UpdateSvRewardWeight` | SVの報酬の重みを更新する投票の行動 |
| `ARC_DsoRules` | `SRARC_CreateExternalPartyAmuletRules` | ネットワークの初期化で作られていない時に、`ExternalPartyAmuletRules`を作る |
| `ARC_DsoRules` | `SRARC_CreateTransferCommandCounter` | 指定した送り手の`TransferCommandCounter`がまだ無い時に作る |
| `ARC_DsoRules` | `SRARC_CreateUnallocatedUnclaimedActivityRecord` | `UnallocatedUnclaimedActivityRecord`を作る投票の行動 |
| `ARC_DsoRules` | `SRARC_CreateBootstrapExternalPartyConfigStateInstruction` | `BootstrapExternalPartyConfigStateInstruction`を作る行動 |
| `ARC_AmuletRules` | `CRARC_MiningRound_StartIssuing` | 報酬の引換券であるreward couponの合計を計算し終えた後に、issuing roundを始める自動の行動 |
| `ARC_AmuletRules` | `CRARC_MiningRound_Archive` | 期限切れのreward couponが残っていない、閉じたmining roundをアーカイブする自動の行動 |
| `ARC_AmuletRules` | `CRARC_SetConfig` | `AmuletConfig`を変える投票の行動で、冪等ではない |
| `ARC_AnsEntryContext` | `ANSRARC_CollectInitialEntryPayment` | CNSの名前の最初の支払いを受け取る自動の行動 |
| `ARC_AnsEntryContext` | `ANSRARC_RejectEntryInitialPayment` | CNSの名前の最初の支払いを拒む自動の行動 |

CNSは、Canton Name Serviceの略で、partyが人が読める名前を買い、自分のpartyに結び付けられるようにする名前の登録簿のサービスです。

## 投票の行動と自動の行動

次の図Bでは、confirmationが要る行動のうち、投票の行動と自動の行動が、それぞれどの行動かを追います。
この図では、confirmationが要る行動を根に、投票の行動と自動の行動を枝、行動を葉にして、枝は、行動がどちらの道で動くかにだけ引きます。
段2と段3は、道ごとに追う段で、起きる順を示しません。

```dragon
mind 行動が動く2つの道

step 行動の2つの道
  say confirmationが要る行動には、投票の行動と、自動の行動があります。
  idea root as confirmationが要る行動 [color: coin]
  source CantonのSplice.DsoRules [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-dso-governance/splice-dsorules]

step 投票の行動
  say 投票の行動は、SVを足す行動と外す行動、featuredアプリの資格を与える行動、DSOの設定とAmuletの設定を変える行動、SVの報酬の重みを更新する行動、未割り当ての活動の記録を作る行動です。
  idea v as "投票の行動" of root [color: blue]
  idea v1 as "SVを足す" of v
  idea v2 as "SVを外す" of v
  idea v3 as "featuredの資格を与える" of v
  idea v4 as "DSOの設定を変える" of v
  idea v5 as "Amuletの設定を変える" of v
  idea v6 as "SVの報酬の重みを更新" of v
  idea v7 as "未割り当ての活動の記録を作る" of v
  source CantonのSplice.DsoRules [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-dso-governance/splice-dsorules]

step 自動の行動
  say 自動の行動は、issuing roundを始める行動、mining roundをアーカイブする行動、CNSの名前の最初の支払いを受け取る行動と拒む行動、partyがSVになれることを確かめる行動です。
  idea u as "自動の行動" of root [color: rose]
  idea u1 as "issuing roundを始める" of u
  idea u2 as "mining roundをアーカイブ" of u
  idea u3 as "最初の支払いを受け取る" of u
  idea u4 as "最初の支払いを拒む" of u
  idea u5 as "SVになれるか確かめる" of u
  source CantonのSplice.DsoRules [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-dso-governance/splice-dsorules]
```

## 行動を作るコントラクトの指示

`BootstrapExternalPartyConfigStateInstruction`は、external partyの設定の状態を初期化する指示のtemplateです。
signatoryは`dso`で、欄は`dso`だけを持ち、choiceは`Archive`だけを持ちます。
この指示をtemplateとして置くのは、これに対する`ActionRequiringConfirmation`を今のroundから切り離し、自動処理が行動のハッシュで重複を除けるようにするためです。

次の表は、これらの指示とコントラクトを扱う`DsoRules`のchoiceです。

| choice | controller | 受け取る物 | 返す物 |
|---|---|---|---|
| `DsoRules_BootstrapExternalPartyConfigState` | `sv` | `amuletRulesCid`と`instructionCid`と`openMiningRoundTriple`と`sv` | `DsoRules_BootstrapExternalPartyConfigStateResult` |
| `DsoRules_CreateBootstrapExternalPartyConfigStateInstruction` | `dso` | なし | 名前に`Result`を付けた型 |
| `DsoRules_CreateExternalPartyAmuletRules` | `dso` | なし | 名前に`Result`を付けた型 |
| `DsoRules_CreateTransferCommandCounter` | `dso` | `sender` | `DsoRules_CreateTransferCommandCounterResult` |
| `DsoRules_GrantFeaturedAppRight` | `dso` | `provider` | 名前に`Result`を付けた型 |
| `DsoRules_RevokeFeaturedAppRight` | `dso` | 型が`FeaturedAppRight`の`rightCid` | 名前に`Result`を付けた型 |
| `DsoRules_UpdateExternalPartyConfigStates` | `sv` | `amuletRulesCid`と`externalPartyConfigStateCid0`と`externalPartyConfigStateCid1`と`openMiningRoundTriple`と`sv` | `DsoRules_UpdateExternalPartyConfigStatesResult` |

結果の型は、次の表の欄を持ちます。

| 結果の型 | 欄 |
|---|---|
| `DsoRules_CreateBootstrapExternalPartyConfigStateInstructionResult` | `instructionCid` |
| `DsoRules_CreateExternalPartyAmuletRulesResult` | `externalPartyAmuletRulesCid` |
| `DsoRules_CreateTransferCommandCounterResult` | `transferCommandCounterCid` |
| `DsoRules_GrantFeaturedAppRightResult` | `featuredAppRight`。与えた`FeaturedAppRight`を指す |
| `DsoRules_UpdateExternalPartyConfigStatesResult` | `newExternalPartyConfigStateCid`。新しい`ExternalPartyConfigState`を指す |

`Splice.DsoRules`のモジュールは、`HasCheckedFetch FeaturedAppRight ForDso`のインスタンスを持ちます。

## 次に読む頁

次の頁「期限切れと重複を片付ける」は、期限切れと重複を片付けるchoiceが、どのコントラクトを受け取り、重複した価格の投票をどう片付けるかを追います。

https://cardene.dev/diagrams/canton-dso-housekeeping

## 出典

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-dso-governance/splice-dsorules
