From 1d9d5ab18ac30a0a0298bf3f8f8fcc1e2b29f286 Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Fri, 7 Jun 2024 11:36:12 -0700 Subject: [PATCH] docs: Address PR feedback --- .../architecture-decisions}/2024-06-06_arc4-types.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename {architecture-decisions => docs/architecture-decisions}/2024-06-06_arc4-types.md (89%) diff --git a/architecture-decisions/2024-06-06_arc4-types.md b/docs/architecture-decisions/2024-06-06_arc4-types.md similarity index 89% rename from architecture-decisions/2024-06-06_arc4-types.md rename to docs/architecture-decisions/2024-06-06_arc4-types.md index 45653fc6..004e568a 100644 --- a/architecture-decisions/2024-06-06_arc4-types.md +++ b/docs/architecture-decisions/2024-06-06_arc4-types.md @@ -31,7 +31,7 @@ Algorand TypeScript defines all types specified by ARC4 and their in memory repr Pros: - Zero cost decoding of ABI args (other than packed args for methods using more than 15 arguments) - - When storing a value in global/local/box storage - the binary format is already well defined by arc4 + - When storing a value in global/local/box storage - the binary format is already well-defined by arc4 Cons: - Contracts that frequently mutate dynamic structs will consume a large op code budget @@ -47,8 +47,8 @@ Pros: - In memory representation can be optimised Cons: - - If Algo TS adds a new type not in ARC4, will it surprise users to see this not work? - - In some scenarios a value may be unnecessarily decoded and re-encoded when it could have been passed through untouched. + - In some scenarios a value may be unnecessarily decoded and re-encoded when it could have been passed through untouched. + - A number of types defined by ARC4 do not make sense to implement natively (eg. UFixedNxM) as the avm has no support for decimal math. ### Option 3 - Implement 'native' types which make sense + implement a full set of ARC4 types @@ -60,11 +60,12 @@ Pros: - Zero cost decoding of ABI args available as an option. (by opting to use the arc4 type) - "native" types can be used in ABI args and the compiler will automatically decode them - Arc4 types can optionally be used as a serialization format for box/global/local storage + - Developer has control to choose the solution which works best for their scenario rather than having one prescribed by the compiler Cons: - Several types will exist twice (string/uint64/bool etc) and this could be confusing to new developers who aren't fully across arc4 - - + - Developer will need to be aware of arc4 encoding/decoding and the implications of it. ## Preferred options