Skip to content

JPYC.updateBlocklister_unauthorized

名称・種別

  • 名称: JPYC.updateBlocklister_unauthorized
  • 種別: theorem
  • モジュール: JpycFormalVerification.AccessControlTheorems
  • ソース: JpycFormalVerification/AccessControlTheorems.lean:794-797
  • 概要: owner でない呼び出し元は updateBlocklister を notOwner で revert する(権限・revert形)。
  • 仕様: 対象

型シグネチャ

lean
∀ {s : JPYC.State} {ctx : JPYC.CallContext} {newBlocklister : JPYC.Address}, Ne s.owner ctx.sender → Eq (JPYC.updateBlocklister s ctx newBlocklister) (Except.error JPYC.Error.notOwner)

呼び出し元がオーナーでなければ、updateBlocklisternotOwner で revert する、という認可(revert 形)定理です。

和訳 docstring

認可(revert)。 オーナー以外の呼び出しは updateBlocklisternotOwner で revert する。

解説

何を述べているか。 updateBlocklister(blocklister ロールの付け替え)の onlyOwner 検査が 最初のガード であるため、呼び出し元がオーナーでないとき、関数は本体に一切触れずに Except.error .notOwner を返します。証明はガードの if を偽側(if_neg)に倒すだけです。

直感。 updateBlocklister_auth(成功 ⇒ 呼び出し元 = オーナー)の対偶を、具体的なエラー名つきで述べたものです。transferOwnership_unauthorized と同型のロール回転・負側定理です。

なぜ安全性に効くか。 権限のない呼び出しが「正しい理由(notOwner)で失敗する」ことまで固定します。オーナーだけが blocklister を付け替えられることの裏付けです。

図解

Lean ソースコード

lean
/-- **Authorization (revert).** A non-owner caller reverts `updateBlocklister` with `notOwner`. -/
theorem updateBlocklister_unauthorized {s : State} {ctx : CallContext} {newBlocklister : Address}
    (h : s.owner ≠ ctx.sender) : updateBlocklister s ctx newBlocklister = .error .notOwner := by
  unfold updateBlocklister onlyOwner req; rw [if_neg h]; rfl

依存