-
Notifications
You must be signed in to change notification settings - Fork 660
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/dkg contract interaction #3989
Conversation
1d9592f
to
26c60e2
Compare
Codecov Report
@@ Coverage Diff @@
## develop #3989 +/- ##
===========================================
- Coverage 0.16% 0.16% -0.01%
===========================================
Files 337 337
Lines 286814 287084 +270
===========================================
Hits 469 469
- Misses 286345 286615 +270
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
c950efd
to
4167979
Compare
stacks-signer/src/stacks_client.rs
Outdated
) | ||
} | ||
|
||
fn submit_tx(http_origin: &str, tx: &Vec<u8>) -> 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 don't know if this is ever going to be a concern, but if you're registering a BNS name, then you'd also need to supply an Attachment
which contains the name's zonefile data.
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 am not entirely sure what this means XD Forgive me...
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.
Ah, so there's this storage system in the Stacks node called Atlas It's a hold-over from the Blockstack / Stacks 1.0 days. Basically, a smart contract can emit specially-crafted Atlas events which contain the hash of a chunk of data. The Atlas system tracks these hash announcements, and then communicates with other Stacks nodes to see if they have a chunk of data which hashes to it. Eventually, all nodes get a copy of this "attached" data. We use it in BNS to tie a BNS name to a zone file, as well as other off-chain data like Nostr public keys and such.
I don't think the signer is ever going to use Atlas, so it's not a big deal if you're not going to support attachments. However, if this module becomes more generic and gets spun off into its own crate, it might become important later to add support.
47ef10a
to
12124ad
Compare
Pulled out the ureq suggestions into a separate issue - #3995 |
12124ad
to
0124b22
Compare
0124b22
to
2f95194
Compare
stacks-signer/src/stacks_client.rs
Outdated
fn read_only_contract_call( | ||
&self, | ||
contract_addr: &StacksAddress, | ||
contract_name: &str, |
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.
We have specific containers for contract names, function names, and function arguments, since they have to use limited character sets and since not all strings are valid. You should use ContractName
and ClarityName
here instead of a bare &str
. Also, function_args
should be &[clarity::vm::Value]
in both cases.
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.
Quick note, can you create a valid "StacksAddress" from the pox contract address? My initial attempts have failed. The reason I changed this to String was to accommodate this. However, perhaps I am just doing it wrong? Attempts to convert ""ST000000000000000000002AMW42H.pox-3" to a QualifiedContractID fail. Further attempts to split the string and then convert the first half to a StacksAddress also fails.
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.
Sure -- QualifiedContractIdentifier::parse("ST000000000000000000002AMW42H.pox-3").unwrap()
should work.
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.
Sorry, I was not clear. This is what I already tried and it results in
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Runtime(ParseError("Invalid principal literal: base58ck checksum 0x51104e95 does not match expected 0x31287a31"), None)', stacks-signer/src/stacks_client.rs:315:83
This is the same result as trying to parse ST000000000000000000002AMW42H as a StacksAddress.
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 PR is on the right track, but it needs a few changes:
- It needs to use
ContractName
,ClarityName
, andclarity::vm::Value
instead of bare&str
s - The
StacksContractCallable
trait may not need to exist
9f74772
to
52259a0
Compare
Signed-off-by: Jacinta Ferrant <jacinta@trustmachines.co>
Signed-off-by: Jacinta Ferrant <jacinta@trustmachines.co>
…wise return err Signed-off-by: Jacinta Ferrant <jacinta@trustmachines.co>
e29466a
to
0dd83c7
Compare
Signed-off-by: Jacinta Ferrant <jacinta@trustmachines.co>
d19ffed
to
c9b6528
Compare
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.
LGTM
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.
LGTM. More tests would be nice, especially if they weren't mocked, but this is fine for now.
Description
This PR adds the ability for the Signer to interact with Clarity contracts
Applicable issues
Checklist