-
Notifications
You must be signed in to change notification settings - Fork 219
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
feat(wallet): new command to publish a contract definition transaction #4133
Conversation
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.
Looks good - approved with few minor comments
base_layer/core/src/transactions/transaction_components/contract_definition_features.rs
Outdated
Show resolved
Hide resolved
base_layer/core/src/transactions/transaction_components/contract_definition_features.rs
Outdated
Show resolved
Hide resolved
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.
This looks good.
I just have an issue with the derive(Hash)
And a question about the one type
// Fixed lenght of all string fields in the contract definition | ||
const STR_LEN: usize = 32; | ||
|
||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, Hash)] |
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.
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, Hash)] | |
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)] |
This is not the same Hash trait we use, this is the rust one std::hash
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 did it because output_features.rs
(which is the "parent" struct) derives the standard that Hash trait, so it makes it required to do it here as well
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.
mmm, wonder why it has it...
It looks like it could be removed, but I think that's for another PR
} | ||
} | ||
|
||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, Hash)] |
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.
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, Hash)] | |
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)] |
} | ||
} | ||
|
||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, Hash)] |
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.
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, Hash)] | |
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)] |
} | ||
} | ||
|
||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, Hash)] |
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.
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, Hash)] | |
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)] |
…ct_definition_features.rs Co-authored-by: Stan Bondi <sdbondi@users.noreply.github.com>
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.
+1
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.
Nice. I want to note that the public functions may not look like that in the final form, but this is fine for a start
Description
contract_id
is calculated as a hash of the contents of the contract definition, in the line of what is described in the RFCs. I usedConsensusHashWriter
to make it totally consistent.publish-contract-definition
):base_layer/wallet/src/assets/contract_definition.rs
) to decouple the file format from the output features.CONTRACT_DEFNITION
flag and the new Contract Definition output features.Motivation and Context
As a user, I want to be able to publish a new contract definition into the network through the console wallet.
How Has This Been Tested?