Skip to content

Commit 117a4cb

Browse files
committed
feat(aptos-verifier): add state proof verification
Signed-off-by: aeryz <[email protected]>
1 parent 3128dc1 commit 117a4cb

File tree

5 files changed

+222
-3
lines changed

5 files changed

+222
-3
lines changed

Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/aptos-verifier/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ hex-literal = { workspace = true }
1717
sha3 = { workspace = true }
1818
thiserror = { workspace = true }
1919
unionlabs = { workspace = true }
20+
21+
[dev-dependencies]
22+
cosmwasm-crypto = { version = "2.1" }
23+
serde = { workspace = true }

lib/aptos-verifier/src/error.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pub enum Error {
1010
MaxSiblingsExceeded(usize),
1111
#[error("storage verification error")]
1212
StorageVerification(#[from] StorageVerificationError),
13+
#[error("the epoch order must be incrementing sequentially and one by one")]
14+
InvalidEpochOrder,
1315
}
1416

1517
#[derive(Debug, Clone, PartialEq, thiserror::Error)]

lib/aptos-verifier/src/lib.rs

+202-3
Large diffs are not rendered by default.

lib/unionlabs/src/aptos/ledger_info.rs

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ pub enum LedgerInfoWithSignatures {
1414
V0(LedgerInfoWithV0),
1515
}
1616

17+
impl LedgerInfoWithSignatures {
18+
pub fn ledger_info(&self) -> &LedgerInfo {
19+
let Self::V0(ledger_info) = self;
20+
&ledger_info.ledger_info
21+
}
22+
23+
pub fn signatures(&self) -> &AggregateSignature {
24+
let Self::V0(ledger_info) = self;
25+
&ledger_info.signatures
26+
}
27+
}
28+
1729
/// The validator node returns this structure which includes signatures
1830
/// from validators that confirm the state. The client needs to only pass back
1931
/// the `LedgerInfo` element since the validator node doesn't need to know the signatures

0 commit comments

Comments
 (0)