-
Notifications
You must be signed in to change notification settings - Fork 47
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
Support generic challenge signing. Introduce ABI deserialization. #361
base: main
Are you sure you want to change the base?
Conversation
9835f19
to
6be06b2
Compare
ce814c6
to
273ce91
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.
Could the DevX be simpler here if createProofChallenge
took two Account
instead?
const account1 = new Account();
const account2 = new Account()
const proofChallenge = createProofChallenge({currentAccount: account1, newAccount: account2})
Seems like having to pass in all these different keys could be mistake-prone.
}); | ||
|
||
const challenge = await aptos.createProofChallenge({ | ||
struct: "0x1::account::RotationProofChallenge", |
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.
are there other structs that are valid here?
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.
wdym? it is a generic implementation so any struct serves as a proof challenge is valid here
tests/e2e/api/proofChallenge.test.ts
Outdated
|
||
const response = await aptos.signAndSubmitTransaction({ signer: fromAccount, transaction }); | ||
const executedTransaction = await aptos.waitForTransaction({ transactionHash: response.hash }); | ||
expect(executedTransaction.success).toBeTruthy(); |
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.
should we check if the on-chain public key has also changed?
It is very specific - not sure all proof challenges require 2 signatures. Also, it can be tricky from a wallet perspective when there is only one signer/wallet |
e1d32ca
to
8d0fe99
Compare
Description
Following a community and a foundation request, adding support for generic challenge signing.
With the new generic challenge signing support this PR also introduces deserialization process with the types coming from a remote abi.
There are some limitation to the deserialization process
vector<u8>
can be a serialization representative to some types such as: public keys (ed25519, secp256k1, etc), string, etc. Since we can't really know anything about the value type other than it is avector of u8
, deserializing it is a bit challenging. Therefore, the sdk would try to deserialize it as a ed25519 public key type and if it fails it would return the array of u8 itself.Generic
orOption
types are not supported by the SDK as thedeserializer
class in the SDK can only handle a single class, i.e not a class with generics.Future work
To not overload this work, will follow with next PRs to
remoteAbi.ts
file needs to be refactoredTest Plan
added a new test for generic challenge
added tests for abi deserialization
tests are passing
Related Links