-
Notifications
You must be signed in to change notification settings - Fork 0
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: SelfSign trait #14
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0fa0566
feat(wip): shared proof and signing creation
gluax 71ebfeb
chore: split types
gluax 6e7e9aa
chore: comment on how overlay handles amount
gluax 9960439
fix: stake methods don't take height for signing...
gluax e3e237d
fix: trait handles differences
gluax ce45874
refactor: change non contract u128 type
gluax 3a622a1
fix: fix sign self methods after testing them
gluax e63a0db
feat: global vrf instance
gluax e8c1ef3
fix: cfg debug and testing
gluax 645c496
refactor: suggested changes
gluax d54b3eb
chore: clean up cfg amount
gluax 348f63d
refactor: factory pattern
gluax 170b86e
refactor: rename file
gluax 95b17e3
refactor: fix spelling mistake
gluax ebe5722
refactor: move VRF to crypto module
gluax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
#[cfg(cosmwasm)] | ||
use serde_json::to_string; | ||
use serde_json::to_value; | ||
//! assert that the msg M serializes to the expected json J | ||
//! if cosmwasm feature is enabled, also assert that we can deserialize the json back to the msg | ||
|
||
// assert that the msg M serializes to the expected json J | ||
// if cosmwasm feature is enabled, also assert that we can deserialize the json back to the msg | ||
pub fn assert_json_ok<M, J>(msg: &M, json: &J) | ||
#[track_caller] | ||
#[cfg(not(feature = "cosmwasm"))] | ||
pub fn assert_json_ok<M>(msg: M, expected_json: serde_json::Value) | ||
where | ||
M: serde::Serialize, | ||
J: serde::Serialize, | ||
M: serde::Serialize + std::fmt::Debug + PartialEq, | ||
{ | ||
let msg_json = to_value(msg).unwrap(); | ||
let expected_json = to_value(json).unwrap(); | ||
let msg_json = serde_json::to_value(&msg).unwrap(); | ||
assert_eq!(msg_json, expected_json); | ||
} | ||
|
||
#[track_caller] | ||
#[cfg(feature = "cosmwasm")] | ||
pub fn assert_json_ok<M>(msg: M, expected_json: serde_json::Value) | ||
where | ||
M: serde::Serialize + std::fmt::Debug + PartialEq + serde::de::DeserializeOwned, | ||
{ | ||
let msg_json = serde_json::to_value(&msg).unwrap(); | ||
assert_eq!(msg_json, expected_json); | ||
|
||
#[cfg(cosmwasm)] | ||
{ | ||
let msg_str = to_string(msg).unwrap(); | ||
let serialized = to_string(msg_str).unwrap(); | ||
let deserialized: QueryMsg = serde_json::from_str(&serialized).unwrap(); | ||
assert_eq!(msg, deserialized); | ||
} | ||
let msg_str = serde_json::to_string(&msg).unwrap(); | ||
let deserialized: M = serde_json::from_str(&msg_str).unwrap(); | ||
assert_eq!(msg, deserialized); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 was wondering if there should be any consideration not including these 2 fields in the signature. Any thoughts?
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.
The concern is about replaying the reveal transaction... but let's think about this.
Maybe they could be included as a sort of hash but inside of the reveal body.
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 you want to merge the PR without this, we should create an issue. :)