Skip to content
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

enhancement: Initial stateproofs support #629

Merged
merged 12 commits into from
Aug 29, 2022

Conversation

Eric-Warehime
Copy link
Contributor

Initial support for state proofs APIs in the JS Client.

src/client/v2/algod/models/types.ts was generated using the algorand/generator package.

@Eric-Warehime Eric-Warehime changed the title Initial stateproofs support enhancement: Initial stateproofs support Aug 22, 2022
Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure of the PR looks good. I have neither JS nor StateProof expertise, but I did bring up a couple questions.

Copy link
Contributor

@shiqizng shiqizng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the endpoint /v2/blocks/{round}/transactions/{txid}/proof added in the PR

@@ -462,4 +464,36 @@ export default class AlgodClient extends ServiceClient {
getProof(round: number, txID: string) {
return new Proof(this.c, this.intDecoding, round, txID);
}

/**
* Returns a light block header proof for a given block.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eric-Warehime
Copy link
Contributor Author

I don't see the endpoint /v2/blocks/{round}/transactions/{txid}/proof added in the PR

It was added previously https://github.com/algorand/js-algorand-sdk/blob/develop/src/client/v2/algod/proof.ts#L19

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All my questions have been addressed but I recommend getting approval from people more familiar with state proofs as well.

@Eric-Warehime Eric-Warehime marked this pull request as ready for review August 24, 2022 22:51
Copy link

@id-ms id-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks pretty good.
Need to keep in mind that state proofs introduce a new transaction. Currently, the msgpack decoder would fail if it comes across a state proof transaction. Think we should add basic support for the state proof transaction - load the state proof message and the proof itself into a byte array (similar to what we do on the python sdk)

src/client/v2/algod/algod.ts Outdated Show resolved Hide resolved
src/client/v2/algod/algod.ts Outdated Show resolved Hide resolved
@Eric-Warehime
Copy link
Contributor Author

Overall looks pretty good. Need to keep in mind that state proofs introduce a new transaction. Currently, the msgpack decoder would fail if it comes across a state proof transaction. Think we should add basic support for the state proof transaction - load the state proof message and the proof itself into a byte array (similar to what we do on the python sdk)

Added message, type, and proof to the txn. The python leaves out the added block header fields, so I've done the same here.

src/transaction.ts Show resolved Hide resolved
src/transaction.ts Show resolved Hide resolved
@id-ms
Copy link

id-ms commented Aug 28, 2022

looking at the code, it looks like the js code does define a block header structure (https://github.com/algorand/js-algorand-sdk/blob/develop/src/types/blockHeader.ts)
should we add the state-proof tracking + txn256 to it?

@Eric-Warehime
Copy link
Contributor Author

looking at the code, it looks like the js code does define a block header structure (https://github.com/algorand/js-algorand-sdk/blob/develop/src/types/blockHeader.ts) should we add the state-proof tracking + txn256 to it?

Added.

@Eric-Warehime Eric-Warehime merged commit 5559d71 into algorand:develop Aug 29, 2022
@Eric-Warehime Eric-Warehime deleted the state-proofs branch August 29, 2022 17:17
ahangsu added a commit that referenced this pull request Sep 3, 2022
* bump version and add to changelog

* update README.md for new version

* prettier on CHANGELOG

* Update README.md

Co-authored-by: John Lee <john.lee@algorand.com>

* Update README.md

Co-authored-by: John Lee <john.lee@algorand.com>

* Enhancement: Use sandbox for SDK Testing and remove Indexer v1 steps (#623)

* Add files to enable sandbox sdk testing

* Add some todo comments and formatting

* Update changes to script and env

* Delete indexer v1 test steps

* More changes to cucumber tests

* Change features directory in JS SDK

* Remove more indexer integration tests

* Update test env

* Update test-harness.sh

Co-authored-by: Zeph Grunschlag <tzaffi@users.noreply.github.com>

* Break out cucumber tags into their own files (#625)

* Command to generate input for Unused Steps Analysis Script + Remove those steps (#627)

* command to generate input for Unused Steps Analysis Script + Remove those steps

* remvoe the steps

* In response to CR remark. Update Makefile

* Update .test-env

Co-authored-by: Zeph Grunschlag <tzaffi@users.noreply.github.com>

Co-authored-by: Zeph Grunschlag <tzaffi@users.noreply.github.com>

* Bugfix: Pass verbosity to the harness and sandbox (#630)

* Ignore algorand-sdk-testing test-harness dir (#634)

* Enhancement: Deprecating use of langspec (#632)

* enhancement: Initial stateproofs support (#629)

* Initial stateproofs support

* Some more unused steps (#637)

* dummy push

* revert change of dummy push, ci runs now

Co-authored-by: Barbara Poon <barbara.poon@algorand.com>
Co-authored-by: algobarb <78746954+algobarb@users.noreply.github.com>
Co-authored-by: John Lee <john.lee@algorand.com>
Co-authored-by: algochoi <86622919+algochoi@users.noreply.github.com>
Co-authored-by: Zeph Grunschlag <tzaffi@users.noreply.github.com>
Co-authored-by: Michael Diamant <michaeldiamant@users.noreply.github.com>
Co-authored-by: Eric Warehime <eric.warehime@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants