Conversation
|
Hello, thank you for your contribution! This change touches a critical component of Canton and as such must be carefully examined through multiple perspectives: determinism, liveness, security, testing, etc. This is why we would kindly ask that you capture all of these aspects in a design doc that we can then comment on and over which we can iterate together. To give you a sense of why such a document is needed, we’ve compiled below a starter list of potential issues or points to clarify that come to mind. More of them will certainly arise as you iterate on the design. We would like to share with you a design doc template that you can use as a starting point. This template is currently a google doc that we cannot easily make world readable. We will convert it into a markdown document or issue template in due time. In the meantime, would you mind sharing a google address we could share the google doc with?
|
|
@paulbrauner-da Thank you for your detailed feedback, I'm happy to work on a design doc together for this. You can use tino@gevulot.com for sharing the doc. I'm also in the cf-global-syncronizer-appdev slack channel if you want to reach out directly. I'm happy to address all issues :) |
|
Thanks @trusch, I have shared a read-only copy of the template with you. |
|
Hi @paulbrauner-da ! Based on the conversations and the feedback received, we will:
We have been working on the design document as well, and will share it along with the PR revision soon. |
The upstream removed CantonConfigValidator and related types in commit 448b5f8. This commit updates our code to not use these types anymore. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1205fd1 to
fbdb45f
Compare
|
Hi @paulbrauner-da ! Based on the feedback received from you and your team earlier, we've implemented the changes, and @trusch has pushed all updates to the PR, including the support for multiple external services, as well as the replayability for observers without re-running the external call. As requested, we've also created a design document for the external_call primitive which I am sharing attached as a PDF. Separately, I've also shared a link to the Google doc version of the design document with you. Thank you very much for your review and feedback. |
Add External Call Functionality to DAML
Summary
This PR introduces a new builtin primitive
BEExternalCallthat enables DAML contracts to make deterministic HTTP calls to external services. This feature allows integration with external systems (oracles, price feeds, computation services) while maintaining DAML's deterministic execution guarantees required for distributed ledger consensus.This is part of the implementation of CIP-0091.
Key Features
1. New
DA.ExternalModuleexternalCall: High-level function for making external HTTP callsfunctionId,configHex, andinputHexparametersisHexandisBytesHex: Validation helpers for hex-encoded dataBytesHex: Type alias for hex-encoded byte strings2. Production-Ready HTTP Client (
ExternalHttpClient)3. Deterministic Execution Model
configHexparameter ensures all participants use the same service version4. Cost Model Integration
DAML_EXTERNAL_CALL_COST_<FUNCTION_ID>(env) ordaml.external.call.cost.<functionId>(sys prop)5. Comprehensive Error Handling
Technical Changes
Language & Compiler Changes
BEExternalCallbuiltin to DAML-LF AST and proto definitionsRuntime Changes
SBExternalCallin Speedy interpreterExternalHttpClientwith production-grade HTTP client implementationDocumentation
DA-External.rstTesting
ExternalCall.damlConfiguration
The external call functionality can be configured via environment variables or system properties:
DAML_EXTERNAL_CALL_ENDPOINTdaml.external.call.endpointhttp://127.0.0.1:1606/api/v1/external-callDAML_EXTERNAL_CALL_JWT_TOKENdaml.external.call.jwt.tokenDAML_EXTERNAL_CALL_JWT_TOKEN_FILEdaml.external.call.jwt.token.fileDAML_EXTERNAL_CALL_TLS_INSECUREdaml.external.call.tls.insecurefalseDAML_EXTERNAL_CALL_CONNECT_TIMEOUT_MSdaml.external.call.connect.timeout.ms500DAML_EXTERNAL_CALL_REQUEST_TIMEOUT_MSdaml.external.call.request.timeout.ms8000DAML_EXTERNAL_CALL_MAX_TOTAL_TIMEOUT_MSdaml.external.call.max.total.timeout.ms25000DAML_EXTERNAL_CALL_MAX_RETRIESdaml.external.call.max.retries3DAML_EXTERNAL_CALL_COST_<FUNCTION_ID>daml.external.call.cost.<functionId>0Example Usage
Security Considerations
Breaking Changes
None. This is a new feature that does not affect existing DAML code.
Testing