-
Notifications
You must be signed in to change notification settings - Fork 307
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
[CAP-46-02] Updated contract lifecycle CAP. #1315
Conversation
core/cap-0046.md
Outdated
+ union switch (ContractIDType type) | ||
+ { | ||
+ case CONTRACT_ID_FROM_PUBLIC_KEY: | ||
+ struct | ||
+ { | ||
+ union switch (ContractIDPublicKeyType type) | ||
+ { | ||
+ case CONTRACT_ID_PUBLIC_KEY_SOURCE_ACCOUNT: | ||
+ void; | ||
+ case CONTRACT_ID_PUBLIC_KEY_ED25519: | ||
+ struct | ||
+ { | ||
+ uint256 key; | ||
+ Signature signature; | ||
+ } ed25519KeyWithSignature; | ||
+ } keySource; | ||
+ uint256 salt; | ||
+ } publicKey; |
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.
Fyi I have this lurking memory that some of the SDKs don't do well with many nested layers of anonymous types, and we might need to make each layer in this XDR type a named type. We can see how it plays out first, but definitely remember experiencing some pain with structures defined anonymously with more than 2 levels deep in the past.
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.
Sounds good, reduced the nesting. I still left a couple anonymous structs, but as they're no longer nested this shouldn't hopefully be a problem.
The main updates: - Change `InvokeHostFunctionOp` to use XDR for contract creation args, as it's getting quite complex and doesn't ever need to be called from the contracts. - Decouple WASM sources from the contract instances in order to deduplicate contracts that share their code. - Change the contract-from-contract creation to use the code reference instead of the actual code - Removed some outdated parts that don't allow well with the current implementation/vision
f239db8
to
67b8add
Compare
Note: This includes the configuration update commit that belongs to #1291, so the diff from CAP-46-09 commit should be ignored while reviewing this.
The main updates:
InvokeHostFunctionOp
to use XDR for contract creation args, as it's getting quite complex and doesn't ever need to be called from the contracts.Some debatable decisions:
ed25519
key for now. This is not because I necessarily think we should never have those, but because I'd like to make sure it would align with the auth patterns in case if we change them.