Skip to content

Commit c37b879

Browse files
authored
Add Confidential HTTP Action to the simulator (#191)
* Add Confidential HTTP Action to the simulator * Go mod tidy * Modify tests to test conf http capability
1 parent 08b827c commit c37b879

File tree

7 files changed

+93
-32
lines changed

7 files changed

+93
-32
lines changed

cmd/workflow/simulate/capabilities.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/ethereum/go-ethereum/common"
88
"github.com/ethereum/go-ethereum/ethclient"
99

10+
confhttpserver "github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/actions/confidentialhttp/server"
1011
httpserver "github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/actions/http/server"
1112
evmserver "github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/evm/server"
1213
consensusserver "github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/consensus/server"
@@ -155,5 +156,13 @@ func NewFakeActionCapabilities(ctx context.Context, lggr logger.Logger, registry
155156
}
156157
caps = append(caps, httpActionServer)
157158

159+
// Conf HTTP Action
160+
confHTTPAction := fakes.NewDirectConfidentialHTTPAction(lggr)
161+
confHTTPActionServer := confhttpserver.NewClientServer(confHTTPAction)
162+
if err := registry.Add(ctx, confHTTPActionServer); err != nil {
163+
return nil, err
164+
}
165+
caps = append(caps, confHTTPActionServer)
166+
158167
return caps, nil
159168
}

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ require (
2323
github.com/manifoldco/promptui v0.9.0
2424
github.com/pkg/errors v0.9.1
2525
github.com/rs/zerolog v1.33.0
26-
github.com/smartcontractkit/chain-selectors v1.0.78
27-
github.com/smartcontractkit/chainlink-common v0.9.6-0.20251104231304-6cbcde243424
26+
github.com/smartcontractkit/chain-selectors v1.0.82
27+
github.com/smartcontractkit/chainlink-common v0.9.6-0.20251118164938-731e805e0a2f
2828
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20251022075638-49d961001d1b
2929
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20251021010742-3f8d3dba17d8
3030
github.com/smartcontractkit/chainlink-protos/workflows/go v0.0.0-20251025021331-aa7746850cc4
3131
github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.3
32-
github.com/smartcontractkit/chainlink/v2 v2.29.1-cre-beta.0.0.20251105185833-fd628ed29848
32+
github.com/smartcontractkit/chainlink/v2 v2.29.1-cre-beta.0.0.20251119193110-917049d99750
3333
github.com/smartcontractkit/cre-sdk-go v1.0.0
3434
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0
3535
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20251120172354-e8ec0386b06c
@@ -108,7 +108,7 @@ require (
108108
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
109109
github.com/cometbft/cometbft v0.38.17 // indirect
110110
github.com/cometbft/cometbft-db v1.0.1 // indirect
111-
github.com/consensys/gnark-crypto v0.18.0 // indirect
111+
github.com/consensys/gnark-crypto v0.18.1 // indirect
112112
github.com/cosmos/btcutil v1.0.5 // indirect
113113
github.com/cosmos/cosmos-db v1.1.1 // indirect
114114
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
@@ -282,7 +282,7 @@ require (
282282
github.com/shopspring/decimal v1.4.0 // indirect
283283
github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3 // indirect
284284
github.com/smartcontractkit/chainlink-automation v0.8.1 // indirect
285-
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20251024142759-093ed1b4017f // indirect
285+
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20251105200616-e158f436aa95 // indirect
286286
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250912190424-fd2e35d7deb5 // indirect
287287
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20250912190424-fd2e35d7deb5 // indirect
288288
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 // indirect
@@ -296,7 +296,7 @@ require (
296296
github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b // indirect
297297
github.com/smartcontractkit/chainlink-protos/storage-service v0.3.0 // indirect
298298
github.com/smartcontractkit/chainlink-protos/svr v1.1.0 // indirect
299-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20251020193713-b63bc17bfeb1 // indirect
299+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20251105160343-b77843a1daf4 // indirect
300300
github.com/smartcontractkit/chainlink-tron/relayer v0.0.11-0.20251014143056-a0c6328c91e9 // indirect
301301
github.com/smartcontractkit/freeport v0.1.3-0.20250716200817-cb5dfd0e369e // indirect
302302
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect

go.sum

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ github.com/cometbft/cometbft-db v1.0.1 h1:SylKuLseMLQKw3+i8y8KozZyJcQSL98qEe2CGM
224224
github.com/cometbft/cometbft-db v1.0.1/go.mod h1:EBrFs1GDRiTqrWXYi4v90Awf/gcdD5ExzdPbg4X8+mk=
225225
github.com/confluentinc/confluent-kafka-go/v2 v2.3.0 h1:icCHutJouWlQREayFwCc7lxDAhws08td+W3/gdqgZts=
226226
github.com/confluentinc/confluent-kafka-go/v2 v2.3.0/go.mod h1:/VTy8iEpe6mD9pkCH5BhijlUl8ulUXymKv1Qig5Rgb8=
227-
github.com/consensys/gnark-crypto v0.18.0 h1:vIye/FqI50VeAr0B3dx+YjeIvmc3LWz4yEfbWBpTUf0=
228-
github.com/consensys/gnark-crypto v0.18.0/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c=
227+
github.com/consensys/gnark-crypto v0.18.1 h1:RyLV6UhPRoYYzaFnPQA4qK3DyuDgkTgskDdoGqFt3fI=
228+
github.com/consensys/gnark-crypto v0.18.1/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c=
229229
github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI=
230230
github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0=
231231
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
@@ -968,20 +968,20 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
968968
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
969969
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
970970
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
971-
github.com/smartcontractkit/chain-selectors v1.0.78 h1:TCnekPLzCux1lKsrygX8+n1iMO1N330GrykbCYiR0FM=
972-
github.com/smartcontractkit/chain-selectors v1.0.78/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8=
971+
github.com/smartcontractkit/chain-selectors v1.0.82 h1:YCBn0HquAhH2jNVai32zQDFyC3XkrMHrBqWhH8W1hzo=
972+
github.com/smartcontractkit/chain-selectors v1.0.82/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8=
973973
github.com/smartcontractkit/chainlink-aptos v0.0.0-20251027153600-2b072ff3618e h1:HIgcJV/CyhBntE5gK/8WitVzqD0k8PkuYj+lhfa6B6U=
974974
github.com/smartcontractkit/chainlink-aptos v0.0.0-20251027153600-2b072ff3618e/go.mod h1:iteU0WORHkArACVh/HoY/1bipV4TcNcJdTmom9uIT0E=
975975
github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU=
976976
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
977-
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20251024142759-093ed1b4017f h1:jP2BHA7+QSp5IzWykT8KunThNbSwEM9j6lCXwEoxTIc=
978-
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20251024142759-093ed1b4017f/go.mod h1:pETrvAF8uvkZgtDgI/oRllZZaC4IpPO26tMxh1u9LC4=
977+
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20251105200616-e158f436aa95 h1:PGtlfYOFXCyq3DegkBMeZED09HIVZDYhSTnc0t8oVAM=
978+
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20251105200616-e158f436aa95/go.mod h1:pETrvAF8uvkZgtDgI/oRllZZaC4IpPO26tMxh1u9LC4=
979979
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250912190424-fd2e35d7deb5 h1:f8ak6g6P2KT4HjUbleU+Bh0gUJXMoGuoriMSyGxxD4M=
980980
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250912190424-fd2e35d7deb5/go.mod h1:Ve1xD71bl193YIZQEoJMmBqLGQJdNs29bwbuObwvbhQ=
981981
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20250912190424-fd2e35d7deb5 h1:Z4t2ZY+ZyGWxtcXvPr11y4o3CGqhg3frJB5jXkCSvWA=
982982
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20250912190424-fd2e35d7deb5/go.mod h1:xtZNi6pOKdC3sLvokDvXOhgHzT+cyBqH/gWwvxTxqrg=
983-
github.com/smartcontractkit/chainlink-common v0.9.6-0.20251104231304-6cbcde243424 h1:hBwTReAElITu5uRvPEPy5vac2Kjr9ieByWD5lE9hp5U=
984-
github.com/smartcontractkit/chainlink-common v0.9.6-0.20251104231304-6cbcde243424/go.mod h1:AgiJcndCiWnUOVmCBX/K3PdST/fvrY1uCqSF65j960w=
983+
github.com/smartcontractkit/chainlink-common v0.9.6-0.20251118164938-731e805e0a2f h1:8yOwe2R/JhZz3en46ddZjzVjrDmAh2qwBXxCfZzw5QQ=
984+
github.com/smartcontractkit/chainlink-common v0.9.6-0.20251118164938-731e805e0a2f/go.mod h1:AgiJcndCiWnUOVmCBX/K3PdST/fvrY1uCqSF65j960w=
985985
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 h1:FJAFgXS9oqASnkS03RE1HQwYQQxrO4l46O5JSzxqLgg=
986986
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10/go.mod h1:oiDa54M0FwxevWwyAX773lwdWvFYYlYHHQV1LQ5HpWY=
987987
github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20250415235644-8703639403c7 h1:9wh1G+WbXwPVqf0cfSRSgwIcaXTQgvYezylEAfwmrbw=
@@ -1018,20 +1018,20 @@ github.com/smartcontractkit/chainlink-protos/svr v1.1.0 h1:79Z9N9dMbMVRGaLoDPAQ+
10181018
github.com/smartcontractkit/chainlink-protos/svr v1.1.0/go.mod h1:TcOliTQU6r59DwG4lo3U+mFM9WWyBHGuFkkxQpvSujo=
10191019
github.com/smartcontractkit/chainlink-protos/workflows/go v0.0.0-20251025021331-aa7746850cc4 h1:ZISmdiYAU0qXt2kC8/qxdIs4zg2PLRriatNDw6fANpo=
10201020
github.com/smartcontractkit/chainlink-protos/workflows/go v0.0.0-20251025021331-aa7746850cc4/go.mod h1:HIpGvF6nKCdtZ30xhdkKWGM9+4Z4CVqJH8ZBL1FTEiY=
1021-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20251020193713-b63bc17bfeb1 h1:aQj7qbQpRUMqTpYqlMaSuY+iMUYV4bU5/Hs8ocrrF9k=
1022-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20251020193713-b63bc17bfeb1/go.mod h1:BqK7sKZUfX4sVkDSEMnj1Vnagiqh+bt1nARpEFruP40=
1023-
github.com/smartcontractkit/chainlink-sui v0.0.0-20251102155039-60906355b420 h1:GNTB3rzRNbQTo7n4/AfTWu1zqIcnT7EFe1ABN6gGtoM=
1024-
github.com/smartcontractkit/chainlink-sui v0.0.0-20251102155039-60906355b420/go.mod h1:VlyZhVw+a93Sk8rVHOIH6tpiXrMzuWLZrjs1eTIExW8=
1021+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20251105160343-b77843a1daf4 h1:XYuSAv2hVwAegkJQsrnsQgl3eMHEFSYkA6+lyd7UdWU=
1022+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20251105160343-b77843a1daf4/go.mod h1:BqK7sKZUfX4sVkDSEMnj1Vnagiqh+bt1nARpEFruP40=
1023+
github.com/smartcontractkit/chainlink-sui v0.0.0-20251117202410-65d1d60c95af h1:DpoE/J54Ja7+efkeuvhwv3hx0zd96B0JCCgm8uSEKI8=
1024+
github.com/smartcontractkit/chainlink-sui v0.0.0-20251117202410-65d1d60c95af/go.mod h1:qSxg5KpKoLfiF52qcBTfJtoiRh0jYrpSlDVpHDN7Kmo=
10251025
github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.3 h1:TZ0Yk+vjAJpoWnfsPdftWkq/NwZTrk734a/H4RHKnY8=
10261026
github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.3/go.mod h1:kHYJnZUqiPF7/xN5273prV+srrLJkS77GbBXHLKQpx0=
1027-
github.com/smartcontractkit/chainlink-ton v0.0.0-20251031142050-8d1f83814966 h1:728FKEOr8E3DhUsD+/3IY6+tU4tEugN4cnTEfWGZBDQ=
1028-
github.com/smartcontractkit/chainlink-ton v0.0.0-20251031142050-8d1f83814966/go.mod h1:DWz7Zysn/QBf6dnzFYt4UsDXbclglPUum8FnCJQvleg=
1027+
github.com/smartcontractkit/chainlink-ton v0.0.0-20251117043516-cfda0f691147 h1:9Z7YbHAwFzGhKeCPaVnLgWzAlUG1sKvQrYafBMfJeg0=
1028+
github.com/smartcontractkit/chainlink-ton v0.0.0-20251117043516-cfda0f691147/go.mod h1:rxekiaWnJnFFfklae1OvO6T7xHJtsEldDvW/e5+b/qg=
10291029
github.com/smartcontractkit/chainlink-tron/relayer v0.0.11-0.20251014143056-a0c6328c91e9 h1:7Ut0g+Pdm+gcu2J/Xv8OpQOVf7uLGErMX8yhC4b4tIA=
10301030
github.com/smartcontractkit/chainlink-tron/relayer v0.0.11-0.20251014143056-a0c6328c91e9/go.mod h1:h9hMs6K4hT1+mjYnJD3/SW1o7yC/sKjNi0Qh8hLfiCE=
10311031
github.com/smartcontractkit/chainlink-tron/relayer/gotron-sdk v0.0.5-0.20251014143056-a0c6328c91e9 h1:/Q1gD5gI0glBMztVH9XUVci3aOy8h+qTDV6o42MsqMM=
10321032
github.com/smartcontractkit/chainlink-tron/relayer/gotron-sdk v0.0.5-0.20251014143056-a0c6328c91e9/go.mod h1:ea1LESxlSSOgc2zZBqf1RTkXTMthHaspdqUHd7W4lF0=
1033-
github.com/smartcontractkit/chainlink/v2 v2.29.1-cre-beta.0.0.20251105185833-fd628ed29848 h1:b0/eg42/Cx3VUtrIQsliBaW5oYkZW3hh6z9dAH3Id4o=
1034-
github.com/smartcontractkit/chainlink/v2 v2.29.1-cre-beta.0.0.20251105185833-fd628ed29848/go.mod h1:Z15GtBxzhwkzzRBluQ1/WMFoxLL4gOM2Pc1Z91YPf5o=
1033+
github.com/smartcontractkit/chainlink/v2 v2.29.1-cre-beta.0.0.20251119193110-917049d99750 h1:4hEOJjDVX0Mk7RKSENGoPXK5Y4V6BScsjqswRNEA2iM=
1034+
github.com/smartcontractkit/chainlink/v2 v2.29.1-cre-beta.0.0.20251119193110-917049d99750/go.mod h1:xllB1+6Qv6HZvdutfq1ZE2I4V+0UK33St6RRAZ/yzI8=
10351035
github.com/smartcontractkit/cre-sdk-go v1.0.0 h1:O52/QDmw/W8SJ7HQ9ASlVx7alSMGsewjL0Y8WZmgf5w=
10361036
github.com/smartcontractkit/cre-sdk-go v1.0.0/go.mod h1:CQY8hCISjctPmt8ViDVgFm4vMGLs5fYI198QhkBS++Y=
10371037
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0 h1:t2bzRHnqkyxvcrJKSsKPmCGLMjGO97ESgrtLCnTIEQw=

test/multi_command_flows/workflow_simulator_path.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ func RunSimulationHappyPath(t *testing.T, tc TestConfig, projectDir string) {
143143
require.Contains(t, out, "[SIMULATION] Simulator Initialized", "expected workflow to initialize.\nCLI OUTPUT:\n%s", out)
144144
require.Contains(t, out, "Getting native balances", "expected workflow to read from balance reader.\nCLI OUTPUT:\n%s", out)
145145
require.Contains(t, out, "fetching por", "expected http capability success.\nCLI OUTPUT:\n%s", out)
146+
require.Contains(t, out, "Conf POR response", "expected confidential http capability success.\nCLI OUTPUT:\n%s", out)
146147
require.Contains(t, out, "totalSupply=", "expected ERC20 chain reader success.\nCLI OUTPUT:\n%s", out)
147148
require.Contains(t, out, "Write report succeeded", "expected chain writer success.\nCLI OUTPUT:\n%s", out)
148149

test/test_project/por_workflow/go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
module por_workflow
22

3-
go 1.24.5
3+
go 1.25.3
44

55
require (
66
github.com/ethereum/go-ethereum v1.16.4
77
github.com/shopspring/decimal v1.4.0
8-
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250918131840-564fe2776a35
9-
github.com/smartcontractkit/cre-sdk-go v1.0.0
8+
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20251021010742-3f8d3dba17d8
9+
github.com/smartcontractkit/cre-sdk-go v1.0.1-0.20251113102311-429c91cd0f85
1010
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0
11+
github.com/smartcontractkit/cre-sdk-go/capabilities/networking/confidentialhttp v0.0.0-20251125171021-cf44e313fc9e
1112
github.com/smartcontractkit/cre-sdk-go/capabilities/networking/http v1.0.0-beta.0
1213
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v1.0.0-beta.0
13-
google.golang.org/protobuf v1.36.7
14+
google.golang.org/protobuf v1.36.8
1415
)
1516

1617
require (

test/test_project/por_workflow/go.sum

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,14 @@ github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1
173173
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
174174
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
175175
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
176-
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250918131840-564fe2776a35 h1:hhKdzgNZT+TnohlmJODtaxlSk+jyEO79YNe8zLFtp78=
177-
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250918131840-564fe2776a35/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
178-
github.com/smartcontractkit/cre-sdk-go v1.0.0 h1:O52/QDmw/W8SJ7HQ9ASlVx7alSMGsewjL0Y8WZmgf5w=
179-
github.com/smartcontractkit/cre-sdk-go v1.0.0/go.mod h1:CQY8hCISjctPmt8ViDVgFm4vMGLs5fYI198QhkBS++Y=
176+
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20251021010742-3f8d3dba17d8 h1:hPeEwcvRVtwhyNXH45qbzqmscqlbygu94cROwbjyzNQ=
177+
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20251021010742-3f8d3dba17d8/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
178+
github.com/smartcontractkit/cre-sdk-go v1.0.1-0.20251113102311-429c91cd0f85 h1:ZwqDDgKiZUFerYcBakTXAfD9sEEfuHm6kwfTuOU5r+I=
179+
github.com/smartcontractkit/cre-sdk-go v1.0.1-0.20251113102311-429c91cd0f85/go.mod h1:sgiRyHUiPcxp1e/EMnaJ+ddMFL4MbE3UMZ2MORAAS9U=
180180
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0 h1:t2bzRHnqkyxvcrJKSsKPmCGLMjGO97ESgrtLCnTIEQw=
181181
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0/go.mod h1:VVJ4mvA7wOU1Ic5b/vTaBMHEUysyxd0gdPPXkAu8CmY=
182+
github.com/smartcontractkit/cre-sdk-go/capabilities/networking/confidentialhttp v0.0.0-20251125171021-cf44e313fc9e h1:/9C+Z82+sY9AUBWtHydJEIlnt0vWiFj3LBY70YRyTm0=
183+
github.com/smartcontractkit/cre-sdk-go/capabilities/networking/confidentialhttp v0.0.0-20251125171021-cf44e313fc9e/go.mod h1:5F4judMwXORkrOJbmxnsug1BG0WkuamO8ebto5NW80g=
182184
github.com/smartcontractkit/cre-sdk-go/capabilities/networking/http v1.0.0-beta.0 h1:E3S3Uk4O2/cEJtgh+mDhakK3HFcDI2zeqJIsTxUWeS8=
183185
github.com/smartcontractkit/cre-sdk-go/capabilities/networking/http v1.0.0-beta.0/go.mod h1:M83m3FsM1uqVu06OO58mKUSZJjjH8OGJsmvFpFlRDxI=
184186
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v1.0.0-beta.0 h1:Tui4xQVln7Qtk3CgjBRgDfihgEaAJy2t2MofghiGIDA=
@@ -216,8 +218,8 @@ golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
216218
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
217219
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
218220
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
219-
google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A=
220-
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
221+
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
222+
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
221223
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
222224
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
223225
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

test/test_project/por_workflow/main.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/shopspring/decimal"
2020

2121
"github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm"
22+
"github.com/smartcontractkit/cre-sdk-go/capabilities/networking/confidentialhttp"
2223
"github.com/smartcontractkit/cre-sdk-go/capabilities/networking/http"
2324
"github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron"
2425
"github.com/smartcontractkit/cre-sdk-go/cre"
@@ -104,6 +105,39 @@ func doPOR(config *Config, runtime cre.Runtime, runTime time.Time) (string, erro
104105

105106
logger.Info("ReserveInfo", "reserveInfo", reserveInfo)
106107

108+
confHttpClient := &confidentialhttp.Client{}
109+
confOutput, err := confidentialhttp.SendRequests(
110+
config,
111+
runtime,
112+
confHttpClient,
113+
fetchPORConfidential,
114+
cre.ConsensusIdenticalAggregation[*confidentialhttp.HTTPEnclaveResponseData](),
115+
).Await()
116+
if err != nil {
117+
logger.Error("error fetching conf por", "err", err)
118+
return "", err
119+
}
120+
logger.Info("Conf POR response", "response", confOutput)
121+
122+
// Compare responses
123+
porResp := &PORResponse{}
124+
if err = json.Unmarshal(confOutput.Responses[0].Body, porResp); err != nil {
125+
return "", err
126+
}
127+
128+
if porResp.Ripcord {
129+
return "", errors.New("ripcord is true")
130+
}
131+
132+
confReserveInfo := &ReserveInfo{
133+
LastUpdated: porResp.UpdatedAt.UTC(),
134+
TotalReserve: decimal.NewFromFloat(porResp.TotalToken),
135+
}
136+
137+
if !confReserveInfo.TotalReserve.Equal(reserveInfo.TotalReserve) || !confReserveInfo.LastUpdated.Equal(reserveInfo.LastUpdated) {
138+
logger.Error("Mismatch between confidential and regular POR responses")
139+
}
140+
107141
totalSupply, err := getTotalSupply(config, runtime)
108142
if err != nil {
109143
return "", err
@@ -238,6 +272,20 @@ func updateReserves(config *Config, runtime cre.Runtime, totalSupply *big.Int, t
238272
return nil
239273
}
240274

275+
func fetchPORConfidential(config *Config, logger *slog.Logger, sendRequester *confidentialhttp.SendRequestser) (*confidentialhttp.HTTPEnclaveResponseData, error) {
276+
return sendRequester.SendRequests(&confidentialhttp.EnclaveActionInput{
277+
Input: &confidentialhttp.HTTPEnclaveRequestData{
278+
Requests: []*confidentialhttp.Request{
279+
{
280+
Url: config.URL,
281+
Method: "GET",
282+
},
283+
},
284+
},
285+
// No Vault DON Secrets in this example
286+
}).Await()
287+
}
288+
241289
func fetchPOR(config *Config, logger *slog.Logger, sendRequester *http.SendRequester) (*ReserveInfo, error) {
242290
httpActionOut, err := sendRequester.SendRequest(&http.Request{
243291
Method: "GET",

0 commit comments

Comments
 (0)