-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add auxiliary data to ProgramInfo
#681
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…aux-data-to-program-info
…aux-data-to-program-info
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 like that this does just one thing
crates/test-cli/src/main.rs
Outdated
hash, | ||
program_info.deployer, | ||
program_info.ref_counter, | ||
program_info.bytecode.len(), | ||
!program_info.interface_description.is_empty(), | ||
!program_info.config_description.is_empty(), | ||
!program_info.aux_description.is_empty(), |
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 guess if adding this here we should also add a heading in the println!
above, eg: 'Has auxiliary?'
@@ -68,14 +73,15 @@ fn set_program() { | |||
"Program gets set to owner" | |||
); | |||
// deposit taken | |||
assert_eq!(Balances::free_balance(PROGRAM_MODIFICATION_ACCOUNT), 85, "Deposit charged"); | |||
assert_eq!(Balances::free_balance(PROGRAM_MODIFICATION_ACCOUNT), 80, "Deposit charged"); |
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 don't understand how or why this ends up being 80, but im guessing its not too important
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.
oh ya we charge a deposit based on the size of the program + config and now also + aux data, I added aux data on here so the total size got a little bigger so the deposit amount got bigger
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.
One question about the flow of using the schema vs. concrete types, but otherwise LGTM
pallets/programs/src/lib.rs
Outdated
/// Deployer of the program | ||
pub deployer: AccountId, | ||
/// Accounts that use this program | ||
pub ref_counter: u128, | ||
} | ||
|
||
/// Stores the program info for a given program hash. | ||
/// A program hash is a combination of the bytecode and interface_description | ||
/// A program hash is a combination of the bytecode and config_description |
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.
When we do the actual hashing we also include the auxiliary data. This comment should probably be updated to reflect that.
pallets/programs/src/lib.rs
Outdated
/// An interface description for the program config following https://json-schema.org/ spec | ||
pub config_description: Vec<u8>, | ||
/// An interface description for the program aux data following https://json-schema.org/ spec | ||
pub aux_description: Vec<u8>, |
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'm not totally following something here.
I guess it makes sense that we'd store the schemas for the config and auxiliary data alongside the program, but where do the "concrete" configuration and auxiliary data JSON objects actually get passed in and used?
Is this something that's being done purely off-chain? In which case the flow would be that, for example, the SDK would pull the program, get the schema, use it to build requests, and then fire those back?
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.
yes pretty much exactly the last sentence of this
pallets/programs/src/lib.rs
Outdated
config_description: Vec<u8>, | ||
aux_description: Vec<u8>, |
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.
Same naming suggestion here. I'd rather be explicit 😄
ProgramInfo
This splits up config data and aux data into two seperate slots so it can follow https://json-schema.org/ spec