-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
750 additions
and
1,230 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Configs for testing repo download: | ||
SDK_TESTING_URL="https://github.com/algorand/algorand-sdk-testing" | ||
SDK_TESTING_BRANCH="master" | ||
SDK_TESTING_HARNESS="test-harness" | ||
|
||
VERBOSE_HARNESS=0 | ||
|
||
# WARNING: If set to 1, new features will be LOST when downloading the test harness. | ||
# REGARDLESS: modified features are ALWAYS overwritten. | ||
REMOVE_LOCAL_FEATURES=0 | ||
|
||
# WARNING: Be careful when turning on the next variable. | ||
# In that case you'll need to provide all variables expected by `algorand-sdk-testing`'s `.env` | ||
OVERWRITE_TESTING_ENVIRONMENT=0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package algod | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/algorand/go-algorand-sdk/client/v2/common" | ||
"github.com/algorand/go-algorand-sdk/client/v2/common/models" | ||
) | ||
|
||
// GetLightBlockHeaderProof gets a proof for a given light block header inside a | ||
// state proof commitment | ||
type GetLightBlockHeaderProof struct { | ||
c *Client | ||
|
||
round uint64 | ||
} | ||
|
||
// Do performs the HTTP request | ||
func (s *GetLightBlockHeaderProof) Do(ctx context.Context, headers ...*common.Header) (response models.LightBlockHeaderProof, err error) { | ||
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/blocks/%s/lightheader/proof", common.EscapeParams(s.round)...), nil, headers) | ||
return | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package algod | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/algorand/go-algorand-sdk/client/v2/common" | ||
"github.com/algorand/go-algorand-sdk/client/v2/common/models" | ||
) | ||
|
||
// GetStateProof get a state proof that covers a given round | ||
type GetStateProof struct { | ||
c *Client | ||
|
||
round uint64 | ||
} | ||
|
||
// Do performs the HTTP request | ||
func (s *GetStateProof) Do(ctx context.Context, headers ...*common.Header) (response models.StateProof, err error) { | ||
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/stateproofs/%s", common.EscapeParams(s.round)...), nil, headers) | ||
return | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package models | ||
|
||
// HashFactory defines a model for HashFactory. | ||
type HashFactory struct { | ||
// HashType (t) | ||
HashType uint64 `json:"hash-type,omitempty"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package models | ||
|
||
// IndexerStateProofMessage defines a model for IndexerStateProofMessage. | ||
type IndexerStateProofMessage struct { | ||
// BlockHeadersCommitment (b) | ||
BlockHeadersCommitment []byte `json:"block-headers-commitment,omitempty"` | ||
|
||
// FirstAttestedRound (f) | ||
FirstAttestedRound uint64 `json:"first-attested-round,omitempty"` | ||
|
||
// LatestAttestedRound (l) | ||
LatestAttestedRound uint64 `json:"latest-attested-round,omitempty"` | ||
|
||
// LnProvenWeight (P) | ||
LnProvenWeight uint64 `json:"ln-proven-weight,omitempty"` | ||
|
||
// VotersCommitment (v) | ||
VotersCommitment []byte `json:"voters-commitment,omitempty"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package models | ||
|
||
// LightBlockHeaderProof proof of membership and position of a light block header. | ||
type LightBlockHeaderProof struct { | ||
// Index the index of the light block header in the vector commitment tree | ||
Index uint64 `json:"index"` | ||
|
||
// Proof the encoded proof. | ||
Proof []byte `json:"proof"` | ||
|
||
// Treedepth represents the depth of the tree that is being proven, i.e. the number | ||
// of edges from a leaf to the root. | ||
Treedepth uint64 `json:"treedepth"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package models | ||
|
||
// MerkleArrayProof defines a model for MerkleArrayProof. | ||
type MerkleArrayProof struct { | ||
// HashFactory | ||
HashFactory HashFactory `json:"hash-factory,omitempty"` | ||
|
||
// Path (pth) | ||
Path [][]byte `json:"path,omitempty"` | ||
|
||
// TreeDepth (td) | ||
TreeDepth uint64 `json:"tree-depth,omitempty"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package models | ||
|
||
// StateProof represents a state proof and its corresponding message | ||
type StateProof struct { | ||
// Message represents the message that the state proofs are attesting to. | ||
Message StateProofMessage `json:"Message"` | ||
|
||
// Stateproof the encoded StateProof for the message. | ||
Stateproof []byte `json:"StateProof"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package models | ||
|
||
// StateProofFields (sp) represents a state proof. | ||
// Definition: | ||
// crypto/stateproof/structs.go : StateProof | ||
type StateProofFields struct { | ||
// PartProofs (P) | ||
PartProofs MerkleArrayProof `json:"part-proofs,omitempty"` | ||
|
||
// PositionsToReveal (pr) Sequence of reveal positions. | ||
PositionsToReveal []uint64 `json:"positions-to-reveal,omitempty"` | ||
|
||
// Reveals (r) Note that this is actually stored as a map[uint64] - Reveal in the | ||
// actual msgp | ||
Reveals []StateProofReveal `json:"reveals,omitempty"` | ||
|
||
// SaltVersion (v) Salt version of the merkle signature. | ||
SaltVersion uint64 `json:"salt-version,omitempty"` | ||
|
||
// SigCommit (c) | ||
SigCommit []byte `json:"sig-commit,omitempty"` | ||
|
||
// SigProofs (S) | ||
SigProofs MerkleArrayProof `json:"sig-proofs,omitempty"` | ||
|
||
// SignedWeight (w) | ||
SignedWeight uint64 `json:"signed-weight,omitempty"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package models | ||
|
||
// StateProofMessage represents the message that the state proofs are attesting to. | ||
type StateProofMessage struct { | ||
// Blockheaderscommitment the vector commitment root on all light block headers | ||
// within a state proof interval. | ||
Blockheaderscommitment []byte `json:"BlockHeadersCommitment"` | ||
|
||
// Firstattestedround the first round the message attests to. | ||
Firstattestedround uint64 `json:"FirstAttestedRound"` | ||
|
||
// Lastattestedround the last round the message attests to. | ||
Lastattestedround uint64 `json:"LastAttestedRound"` | ||
|
||
// Lnprovenweight an integer value representing the natural log of the proven | ||
// weight with 16 bits of precision. This value would be used to verify the next | ||
// state proof. | ||
Lnprovenweight uint64 `json:"LnProvenWeight"` | ||
|
||
// Voterscommitment the vector commitment root of the top N accounts to sign the | ||
// next StateProof. | ||
Voterscommitment []byte `json:"VotersCommitment"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package models | ||
|
||
// StateProofParticipant defines a model for StateProofParticipant. | ||
type StateProofParticipant struct { | ||
// Verifier (p) | ||
Verifier StateProofVerifier `json:"verifier,omitempty"` | ||
|
||
// Weight (w) | ||
Weight uint64 `json:"weight,omitempty"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package models | ||
|
||
// StateProofReveal defines a model for StateProofReveal. | ||
type StateProofReveal struct { | ||
// Participant (p) | ||
Participant StateProofParticipant `json:"participant,omitempty"` | ||
|
||
// Position the position in the signature and participants arrays corresponding to | ||
// this entry. | ||
Position uint64 `json:"position,omitempty"` | ||
|
||
// SigSlot (s) | ||
SigSlot StateProofSigSlot `json:"sig-slot,omitempty"` | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package models | ||
|
||
// StateProofSigSlot defines a model for StateProofSigSlot. | ||
type StateProofSigSlot struct { | ||
// LowerSigWeight (l) The total weight of signatures in the lower-numbered slots. | ||
LowerSigWeight uint64 `json:"lower-sig-weight,omitempty"` | ||
|
||
// Signature | ||
Signature StateProofSignature `json:"signature,omitempty"` | ||
} |
Oops, something went wrong.