Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slimy-owls-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink-deployments-framework": patch
---

fix(mcms): render proposal parameters in collapsible code blocks
60 changes: 34 additions & 26 deletions engine/cld/mcms/proposalanalysis/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,32 +277,40 @@ func TestAnalyzerEngineE2E_RunAndRenderMarkdown(t *testing.T) {
}, analyzed)
require.NoError(t, err)

expected := `## Proposal — mcms (staging)



_Annotations:_
- proposal.note: generated by analyzer

<details>
<summary><h3>Batch 1 — ethereum-testnet-sepolia (<code>16015286601757825753</code>)</h3></summary>


#### Call 1

- [ ] ` + "`native_transfer`" + `

**Target:** ` + "`0x1234567890123456789012345678901234567890`" + `

**Inputs:**

- **` + "`recipient`" + `** (` + "`AddressField`" + `): 0x1234567890123456789012345678901234567890
- **` + "`amount_wei`" + `** (` + "`SimpleField`" + `): 1000000000000000000
- **` + "`amount_eth`" + `** (` + "`SimpleField`" + `): 1.000000000000000000


</details>
`
expected := "## Proposal — mcms (staging)\n\n\n\n" +
"_Annotations:_\n" +
"- proposal.note: generated by analyzer\n\n" +
"<details>\n" +
"<summary><h3>Batch 1 — ethereum-testnet-sepolia (<code>16015286601757825753</code>)</h3></summary>\n\n\n" +
"#### Call 1\n\n" +
"- [ ] `native_transfer`\n\n" +
"**Target:** `0x1234567890123456789012345678901234567890`\n\n" +
"**Inputs:**\n\n" +
"- **`recipient`** (`AddressField`):\n" +
" <details open>\n" +
" <summary>Value</summary>\n" +
"\n" +
" ```text\n" +
" 0x1234567890123456789012345678901234567890\n" +
" ```\n" +
" </details>\n" +
"- **`amount_wei`** (`SimpleField`):\n" +
" <details open>\n" +
" <summary>Value</summary>\n" +
"\n" +
" ```text\n" +
" 1000000000000000000\n" +
" ```\n" +
" </details>\n" +
"- **`amount_eth`** (`SimpleField`):\n" +
" <details open>\n" +
" <summary>Value</summary>\n" +
"\n" +
" ```text\n" +
" 1.000000000000000000\n" +
" ```\n" +
" </details>\n\n\n" +
"</details>\n"
require.Equal(t, expected, out.String())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,22 @@

**Inputs:**

- **`remoteChainSelectorsToRemove`** (`uint64[]`): <nil>
- **`chainsToAdd`** (`tuple[]`): (decoded)
- **`remoteChainSelectorsToRemove`** (`uint64[]`):
<details open>
<summary>Value</summary>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<summary>Value</summary>

Maybe we could remove these value summary? I think it is repetitive and and users will know it is a value because the code block.

Copy link
Collaborator Author

@graham-chainlink graham-chainlink Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha i know, but it is there so they can click on the collapsible code block , if i remove it, by default markdown will add Details, so you prefer Details or Value ?
Screenshot 2026-03-26 at 1 18 30 pm


```text
<nil>
```
</details>
- **`chainsToAdd`** (`tuple[]`):
<details open>
<summary>Value</summary>

```text
(decoded)
```
</details>


**Changes:**
Expand All @@ -41,8 +55,22 @@ _Annotations:_

**Inputs:**

- **`remoteChainSelectorsToRemove`** (`uint64[]`): [ 3734025351759498498 ]
- **`chainsToAdd`** (`tuple[]`): <nil>
- **`remoteChainSelectorsToRemove`** (`uint64[]`):
<details open>
<summary>Value</summary>

```text
[ 3734025351759498498 ]
```
</details>
- **`chainsToAdd`** (`tuple[]`):
<details open>
<summary>Value</summary>

```text
<nil>
```
</details>


_Annotations:_
Expand Down
5 changes: 0 additions & 5 deletions engine/cld/mcms/proposalanalysis/renderer/funcmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func defaultFuncMap() template.FuncMap {
"diffAnnotations": diffAnnotations,
"renderDiff": renderDiff,
"formatParam": formatParam,
"hasNewline": hasNewline,
"indentLines": indentLines,
"formatAnnotationValue": formatAnnotationValue,
"resolveChainSelector": resolveChainSelector,
Expand Down Expand Up @@ -87,10 +86,6 @@ func formatParam(param analyzer.AnalyzedParameter) string {
return v
}

func hasNewline(s string) bool {
return strings.Contains(s, "\n")
}

func indentLines(s, prefix string) string {
if s == "" {
return ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{- define "parameter" -}}
{{- $formatted := formatParam . -}}
{{- if hasNewline $formatted -}}
- **`{{ .Name }}`** (`{{ .Type }}`):
<details open>
<summary>Value</summary>

```text
{{ indentLines $formatted " " }}
```
{{- else -}}
- **`{{ .Name }}`** (`{{ .Type }}`): {{ $formatted }}
{{- end -}}
</details>
{{- if hasDisplayAnnotations .Annotations -}}
{{- range .Annotations -}}
{{- if not (isFrameworkAnnotation .Name) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,43 @@ _Annotations:_

**Inputs:**

- **`target`** (`address`): 0xAbCdEf1234567890abcdef1234567890abcdef12
- **`target`** (`address`):
<details open>
<summary>Value</summary>

```text
0xAbCdEf1234567890abcdef1234567890abcdef12
```
</details>
- _label: destination contract_
- **`amount`** (`uint256`): 1,000,000,000,000,000,000
- **`enabled`** (`bool`): true
- **`proof`** (`bytes`): 0xdeadbeef
- **`amount`** (`uint256`):
<details open>
<summary>Value</summary>

```text
1,000,000,000,000,000,000
```
</details>
- **`enabled`** (`bool`):
<details open>
<summary>Value</summary>

```text
true
```
</details>
- **`proof`** (`bytes`):
<details open>
<summary>Value</summary>

```text
0xdeadbeef
```
</details>
- **`destChainConfigArgs`** (`((uint64,(bool,uint16,uint32,uint32,uint32,uint8,uint8,uint16,uint32,uint16,uint16,bytes4,bool,uint16,uint32,uint32,uint64,uint32,uint32))[])`):
<details open>
<summary>Value</summary>

```text
[
{
Expand Down Expand Up @@ -51,6 +82,7 @@ _Annotations:_
}
]
```
</details>
- _note: multi-chain destination configuration_


Expand All @@ -71,8 +103,22 @@ _Annotations:_

**Inputs:**

- **`to`** (`address`): 0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef
- **`value`** (`uint256`): 500
- **`to`** (`address`):
<details open>
<summary>Value</summary>

```text
0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef
```
</details>
- **`value`** (`uint256`):
<details open>
<summary>Value</summary>

```text
500
```
</details>


</details>
Expand Down
Loading