Skip to content

Commit

Permalink
feat(aptos-verifier): add state proof verification
Browse files Browse the repository at this point in the history
Signed-off-by: aeryz <[email protected]>
  • Loading branch information
aeryz committed Mar 1, 2025
1 parent 3128dc1 commit 117a4cb
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/aptos-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ hex-literal = { workspace = true }
sha3 = { workspace = true }
thiserror = { workspace = true }
unionlabs = { workspace = true }

[dev-dependencies]
cosmwasm-crypto = { version = "2.1" }
serde = { workspace = true }
2 changes: 2 additions & 0 deletions lib/aptos-verifier/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pub enum Error {
MaxSiblingsExceeded(usize),
#[error("storage verification error")]
StorageVerification(#[from] StorageVerificationError),
#[error("the epoch order must be incrementing sequentially and one by one")]
InvalidEpochOrder,
}

#[derive(Debug, Clone, PartialEq, thiserror::Error)]
Expand Down
205 changes: 202 additions & 3 deletions lib/aptos-verifier/src/lib.rs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions lib/unionlabs/src/aptos/ledger_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ pub enum LedgerInfoWithSignatures {
V0(LedgerInfoWithV0),
}

impl LedgerInfoWithSignatures {
pub fn ledger_info(&self) -> &LedgerInfo {
let Self::V0(ledger_info) = self;
&ledger_info.ledger_info
}

pub fn signatures(&self) -> &AggregateSignature {
let Self::V0(ledger_info) = self;
&ledger_info.signatures
}
}

/// The validator node returns this structure which includes signatures
/// from validators that confirm the state. The client needs to only pass back
/// the `LedgerInfo` element since the validator node doesn't need to know the signatures
Expand Down

0 comments on commit 117a4cb

Please sign in to comment.