-
Notifications
You must be signed in to change notification settings - Fork 117
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
base: main
Are you sure you want to change the base?
Conversation
I know the eventual goal is to use simulate, but I wonder if we add in optional per-method hints for things like:
And also:
Are there other things that have come up in the past worth considering while we are looking at this? |
My rationale for not including a field for these sort of things is that they can be dynamic which can be hard to describe in JSON and they could be network dependent. It also is not easy for a HLL to autogenerate these sorts of things and if the dev is required to manually write them out might as well just have them write a standardized readonly method that returns this information so they have the full power of the language and contract state/methods at their disposal (see ARC51).
Yes good call. |
Co-authored-by: Rob Moore (MakerX) <robertmooreweb@gmail.com>
This is why I think just having a completely seperate key in each SourceInfo is nice. Clients can look for |
I do like putting |
Exactly, the thing is the same treatment will apply to all items so it makes more sense to have a key at the top level than change the key at the lower levels. Then, for optimisation purposes it should be possible (default even?) to indicate there is no offset and they are absolute vs it's a cBlock offset. The worst case of a client not supporting the offset type isn't a huge deal it just means the debugging info will be off, but if the mechanism to specify the type of offset exists on day 1 clients can read that value and act base don it (including opting out of debugging if it's a value they don't understand). I think that's way cleaner and less confusing than needing to read individual items and look for different keys. It's more efficient and more explicit. On reflection, we also probably don't need the teal line offset since we can calculate that from source map if we have it and if we don't have it we can calculate it from the program bytes! |
i.e. sourceInfo: {
approval: {
pcOffset: 'cBlock' | 'none',
mappings: [{pc: 4, ...}, ...]
}
} |
Unfortunately source map on it's own isn't enough to know which line has the constant blocks as it only has line -> pc mappings So if we are going to have the tealOffset option then that would need to be in the spec. But if we are going to support parsing bytecode anyway for the |
Ahh yeah that was my mistake. I think it would be good to have an optional |
@robdmoore @joe-p here you can find the ARC about AVM run time error in program bytecode I was mentioning in previous comments: #315 (cc: @nullun) |
@daniel-makerx @robdmoore In 35a19b3 I added
Depending on consistency in decompiled output makes me a bit nervous. I think it's unlikely to change but I also think it's relatively easy to parse the cblocks if they are at the top of the program. |
}; | ||
/** The scratch variables used during runtime */ | ||
scratchVariables?: { | ||
[name: string]: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume name is meant to be a variable name?
Wondering if this should be an array with an optional name (and maybe description?) as scratch slots might be used without an associated name? Or perhaps the key should be the slot number since that is required and unique?
Additionally I also assume this is just for documenting scratch variables intended to be read by other applications, not necessarily every scratch slot used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally I also assume this is just for documenting scratch variables intended to be read by other applications, not necessarily every scratch slot used?
Yeah exactly. The main purpose of having this field is so other contracts can easily access scratch variables. For example, TEALScript compiler uses scratch but this is only populated by user-defined scratch slots. I think forcing a name to be defined is fine because that's how it would be defined in the HLL. You can't have a property that is just a number so a name needs to be defined. I definitely like adding a desc though
Co-authored-by: Daniel McGregor <daniel.mcgregor@makerx.com.au>
}; | ||
}; | ||
/** Named structs use by the application. Each struct field appears in the same order as ABI encoding. */ | ||
structs: { [structName: StructName]: StructField[] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing, noticed both StructField
and this mapping don't have any sort of desc
property, might be useful to have?
In 19c6269 I removed |
* 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. A key containing the human-readable name of the network MAY be | ||
* included, but the corresponding genesis hash key MUST also be define |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* included, but the corresponding genesis hash key MUST also be define | |
* included, but the corresponding genesis hash key MUST also be defined |
appID: number; | ||
}; | ||
}; | ||
/** Named structs use by the application. Each struct field appears in the same order as ABI encoding. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** Named structs use by the application. Each struct field appears in the same order as ABI encoding. */ | |
/** Named structs used by the application. Each struct field appears in the same order as ABI encoding. */ |
}; | ||
/** ARC-28 events that MAY be emitted by this contract */ | ||
events?: Array<Event>; | ||
/** A mapping of template variable names as they appear in the teal (not including TMPL_ prefix) to their respective types and values (if applicable) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** A mapping of template variable names as they appear in the teal (not including TMPL_ prefix) to their respective types and values (if applicable) */ | |
/** A mapping of template variable names as they appear in the TEAL (not including TMPL_ prefix) to their respective types and values (if applicable) */ |
[name: string]: { | ||
/** The type of the template variable */ | ||
type: ABIType | AVMType | StructName; | ||
/** If given, the the base64 encoded value used for the given app/program */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** If given, the the base64 encoded value used for the given app/program */ | |
/** If given, the base64 encoded value used for the given app/program */ |
Basically takes most of the ideas in ARC32 and reorgs it in a way that is backwards compatible with ARC4 clients. Main benefit of this is HLLs can simply generate one JSON artifact.