Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARC56: Extended App Description #258

Merged
merged 60 commits into from
Nov 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
ef5f338
extended app description draft
joe-p Nov 15, 2023
6beb9f9
apply rob's suggestions
joe-p Nov 15, 2023
a18a968
feedback based on rob's suggestions
joe-p Nov 15, 2023
1265709
add comments to types
joe-p Nov 15, 2023
1b19b76
Assign number + fix linting
SudoWeezy Nov 16, 2023
45a4f6a
add errors key
joe-p Nov 21, 2023
96bf578
add defaultValue, fix typos
joe-p Mar 29, 2024
8c983a1
ARC28, formatting
joe-p Mar 29, 2024
a4c523e
add sourceInfo
joe-p Mar 29, 2024
f6a62f0
reorg spec
joe-p Mar 29, 2024
358a65b
add arcs key
joe-p Mar 29, 2024
d9046e1
network names
joe-p Mar 29, 2024
9a5e445
fix arc format
joe-p Mar 29, 2024
ef47b89
require ARC28
joe-p Apr 24, 2024
8e3499b
add Method.recommendations, Contract.templateVariables
joe-p Apr 24, 2024
b02c3c1
add template vars to spec
joe-p Apr 24, 2024
2a5eb6f
requires order
joe-p Apr 24, 2024
cebfc7d
minor updates
joe-p Apr 26, 2024
e6115f0
pushint/pushbyte opcdes, formatting
joe-p Apr 29, 2024
fd8fe2a
add @robdmoore as author
joe-p Apr 29, 2024
89a6c0c
error -> errorMessage
joe-p Apr 29, 2024
35fd3fc
Storage interface update
joe-p May 6, 2024
8572596
use names as keys for template variables and state keys/maps
joe-p May 8, 2024
ac0a9b1
make readonly optional
joe-p May 8, 2024
05cd0d5
add scratchVariables
joe-p May 20, 2024
ab956a7
add value? to templateVariables
joe-p May 20, 2024
22372b2
add btyeCode
joe-p May 20, 2024
8ee7866
make teal optional
joe-p May 20, 2024
f82a2fa
make scratchVariables optional
joe-p May 20, 2024
ad5d033
add compilerVersion
joe-p May 21, 2024
e540d92
compilerInfo
joe-p May 21, 2024
7b3982b
add disassembledTeal to Sourceinfo
joe-p Jul 28, 2024
f30b5f6
base64 prefix
joe-p Aug 6, 2024
59edfa8
add approval/clear keys to sourceInfo
joe-p Sep 4, 2024
7f5816a
commit -> commitHash
joe-p Sep 11, 2024
9908f86
pushbytes for TMPL
joe-p Sep 11, 2024
faf5f4b
move networks tsdoc
joe-p Sep 18, 2024
506acbd
state default values
joe-p Sep 18, 2024
d8d4c46
type/struct tsdoc
joe-p Sep 18, 2024
6bc830c
StructFields -> StructField[]
joe-p Sep 18, 2024
da85edf
AVMString
joe-p Sep 18, 2024
3ef93fc
StructField[]
joe-p Sep 25, 2024
e577cfb
specify utf-8
joe-p Sep 25, 2024
58a133d
AVMUint64 and AVMType
joe-p Sep 25, 2024
aa79e86
Apply suggestions from code review
joe-p Oct 2, 2024
35a19b3
ProgramSourceInfo
joe-p Oct 10, 2024
3476dad
added method as default arg source
joe-p Oct 10, 2024
1e31ba0
update template variables spec
joe-p Oct 10, 2024
19c6269
only inlcude pc and errorMessage in SourceInfo
joe-p Oct 11, 2024
017c6e3
Apply suggestions from code review
joe-p Oct 16, 2024
d58be41
fix typo
joe-p Oct 16, 2024
9ba13f1
remove ClearState
joe-p Oct 16, 2024
20369ed
defaultValue fields
joe-p Oct 16, 2024
027462f
make errorMessage optional, add optional teal and source to SourceInfo
joe-p Oct 23, 2024
12e3a53
teal string -> number
joe-p Oct 23, 2024
8e2db8d
expand cblocks reference
joe-p Oct 23, 2024
9a3f705
fix typo
joe-p Oct 23, 2024
1cde499
last call 32-56
SudoWeezy Nov 22, 2024
9b0205c
fix Wording
SudoWeezy Nov 22, 2024
1eccf65
Merge branch 'main' into extended_app_description
SudoWeezy Nov 22, 2024
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
160 changes: 160 additions & 0 deletions ARCs/arc-draft_extended_desc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
---
arc: <to be assigned>
title: Extended App Description
description: Adds more information to the ARC4 JSON description
author: Joe Polny (@joe-p)
discussions-to: <URL>
status: Draft
type: Standards Track
category: ARC
created: 2023-11-14
requires: 4
---


## Abstract
This ARC takes the existing JSON description of a contract as described in ARC4 and adds more fields for the purpose of client interaction

## Motivation
The description provided by ARC4 is missing a lot of critical information that clients should know when interaction with an app.
joe-p marked this conversation as resolved.
Show resolved Hide resolved

## Specification
```ts
/** Mapping of named structs to the ABI type of their fields */
interface StructFields {
joe-p marked this conversation as resolved.
Show resolved Hide resolved
[name: string]: string | StructFields;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
}

/** Describes a single key in app storage */
interface StorageKey {
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** The type of the key. Can be ABI type or named struct */
keyType: string;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** The type of the value. Can be ABI type or named struct */
valueType: string;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** The key itself, as a byte array */
key: number[];
joe-p marked this conversation as resolved.
Show resolved Hide resolved
}

interface StorageMap {
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** The type of the key. Can be ABI type or named struct */
keyType: string;
/** The type of the value. Can be ABI type or named struct */
valueType: string;
/** The prefix of the map, as a string */
prefix: string;
}

interface Method {
/** The name of the method */
name: string;
/** Optional, user-friendly description for the method */
desc?: string;
/** The arguments of the method, in order */
args: Array<{
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** The type of the argument */
type: string;
/** If the type is a struct, the name of the struct */
struct?: string;
/** Optional, user-friendly name for the argument */
name?: string;
/** Optional, user-friendly description for the argument */
desc?: string;
}>;
/** Information about the method's return value */
returns: {
/** The type of the return value, or "void" to indicate no return value. */
type: string;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** If the type is a struct, the name of the struct */
struct?: string;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** Optional, user-friendly description for the return value */
desc?: string;
};
/** an action is a combination of call/create and an OnComplete */
actions: {
/** OnCompeltes this method allows when appID === 0 */
create: ('NoOp' | 'OptIn' | 'DeleteApplication')[];
/** OnCompeltes this method allows when appID !== 0 */
call: ('NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication')[];
};
readonly: boolean;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
}

interface Contract {
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** A user-friendly name for the contract */
name: string;
/** Optional, user-friendly description for the interface */
desc?: string;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/**
* Optional object listing the contract instances across different networks
*/
networks?: {
/**
* The key is the base64 genesis hash of the network, and the value contains
* information about the deployed contract in the network indicated by the
* key
*/
[network: string]: {
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** The app ID of the deployed contract in this network */
appID: number;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
};
};
/** Named structs use by the application */
structs: StructFields;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
/** All of the methods that the contract implements */
methods: Method[];
state: {
joe-p marked this conversation as resolved.
Show resolved Hide resolved
schema: {
global: {
ints: number;
joe-p marked this conversation as resolved.
Show resolved Hide resolved
bytes: number;
};
local: {
ints: number;
bytes: number;
};
};
/** Describes single key-value pairs in the application's state */
keys: {
joe-p marked this conversation as resolved.
Show resolved Hide resolved
global: StorageKey[];
local: StorageKey[];
box: StorageKey[];
};
/** Describes key-value maps in the application's state */
maps: {
global: StorageMap[];
local: StorageMap[];
box: StorageMap[];
};
};
}
joe-p marked this conversation as resolved.
Show resolved Hide resolved
```

## Rationale
joe-p marked this conversation as resolved.
Show resolved Hide resolved
ARC32 essentially addresses the samr problem, but it requires the generation of two seperate JSON files (and ARC32 contains entirely redundant information). The goal of this ARC is to create one JSON schema that is backwards compatible with ARC4 clients.
joe-p marked this conversation as resolved.
Show resolved Hide resolved

### State

Describes all of the state that MAY exist in the app and how one should decode values. The schema provides the required schema when creating the app.

### Named Structs

It is common for high-level languages to support named structs, which gives names to the indexes of elements in an ABI tuple. The same structs should be useable on the client-side just as they are used in the contract.

### Action

This is one of the biggest deviation from ARC32, but provides a much simpler interface to describe and understand what any given method can do.

## Backwards Compatibility
The JSON schema defined in this ARC should be compatible with all ARC4 clients, provided they don't do any strict schema checking for extraneous fields.

## Test Cases
NA

## Reference Implementation
TODO

## Security Considerations
The type values used in methods are guranteed to be correct, because if they were not then the method would not be callable. For state, however, it is possible to have an incorrect type encoding defined. Any significant security concern from this possibility is not immediately evident, but it is worth considering.

## Copyright
Copyright and related rights waived via <a href="https://creativecommons.org/publicdomain/zero/1.0/">CCO</a>.
Loading