added test for init and trigger functions and resolve errors#520
added test for init and trigger functions and resolve errors#520devanshi00 wants to merge 2 commits into
Conversation
… encountered in the templates Signed-off-by: “Devanshi <117909426+devanshi00@users.noreply.github.com>
| events: object[]; | ||
| }; | ||
|
|
||
| // Inline types from org.accordproject.time@0.3.0 - generated files may not be available at runtime |
There was a problem hiding this comment.
Can we do the same as the money namespace here?
There was a problem hiding this comment.
Yes, we can align this more closely with the money-namespace approach, but only for type usage. These templates already vendor org.accordproject.time@0.3.0 locally; the reason some logic files still inline TemporalUnit/IDuration is that runtime imports from ./generated/... can break render execution. The safe cleanup is to switch to import type { IDuration } and keep runtime unit checks as string literals/local constants.
| }; | ||
|
|
||
| const InspectionStatus = { | ||
| PASSED_TESTING: 'PASSED_TESTING' as IInspectionResponse['status'], |
There was a problem hiding this comment.
Is there a more idiomatic way to do this?
There was a problem hiding this comment.
You can see the implementation now.
Signed-off-by: “Devanshi <117909426+devanshi00@users.noreply.github.com>
|
@devanshi00 can you see a way to statically determine from the logic if a template is stateful? This solution is good as a first step, but it would be more robust if the library could tell you the statefulness |
https://github.com/accordproject/template-archive/blob/7acd408eb46881072e55b082d3676fd85a922a94/packages/cicero-core/src/template.ts#L495 Let me know how you want me to approach it. |
|
Thanks for sharing those links, I'm glad to see that we're all thinking along the same lines. I would have expected this to throw at build time Instead I expected the definitions to look like: If the existing I'll start a separate thread to investigate why this isn't caught on template compilation. Thanks! |
|
@devanshi00, it looks like this change will fix the issue and force us to patch the templates. |
Summary
accordproject.stateful: truemetadata to the affected templates so the runtime and tests can distinguish stateful contracts from stateless ones.test/render.test.mjsto:initcoverage for stateful templates,triggercoverage for both stateful and stateless execution paths.payment-upon-iotandpayment-upon-signatureso they start from the correctContractSignedflow and use the right model version.import typeusage and local enum/interface constants where needed, reducing runtime/type-generation issues during execution.Impact
Author Checklist
--signoffoption of git commit.masterfromfork:branchname@DianaLease @dselman @mttrbrts