Skip to content

Conversation

@DSharifi
Copy link
Contributor

closes #1629

@DSharifi DSharifi linked an issue Dec 15, 2025 that may be closed by this pull request
3 tasks
Copy link
Contributor

@barakeinav1 barakeinav1 left a comment

Choose a reason for hiding this comment

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

overall look good,
I requested some changes (mainly nits, typo name etc..) ,
I also think you should add another test: (I didn't see something like it)

#[test]
fn re_verify_fails_after_allowed_hash_is_cleaned_up() {
// 1. Add allowed MPC hash H1 at time T0
// 2. Add participant attested with H1
// 3. Add new MPC hash H2 (upgrade)
// 4. Advance time > tee_upgrade_deadline_duration
// 5. cleanup_expired_hashes removes H1
// 6. re_verify_tee_participant fails
}

barakeinav1
barakeinav1 previously approved these changes Dec 16, 2025
Copy link
Contributor

@barakeinav1 barakeinav1 left a comment

Choose a reason for hiding this comment

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

approving with some comments to be address

@DSharifi
Copy link
Contributor Author

overall look good, I requested some changes (mainly nits, typo name etc..) , I also think you should add another test: (I didn't see something like it)

#[test] fn re_verify_fails_after_allowed_hash_is_cleaned_up() { // 1. Add allowed MPC hash H1 at time T0 // 2. Add participant attested with H1 // 3. Add new MPC hash H2 (upgrade) // 4. Advance time > tee_upgrade_deadline_duration // 5. cleanup_expired_hashes removes H1 // 6. re_verify_tee_participant fails }

We already have integration tests in place.

@DSharifi DSharifi marked this pull request as ready for review December 17, 2025 21:56
Copy link
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

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

A few blockers. We should understand better what's costing so much gas. Beyond this, we need to figure out how to introduce this change in a compatible way.

@DSharifi
Copy link
Contributor Author

Carved out flaky test fix into #1695

@DSharifi DSharifi force-pushed the 1629-contract-should-not-store-full-attestation-submission branch from 669c61c to ee42690 Compare January 12, 2026 09:03
@netrome netrome requested a review from Copilot January 14, 2026 13:10
netrome
netrome previously approved these changes Jan 14, 2026
Copy link
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

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

Good stuff, love all the tests!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes contract storage by storing only verified attestation metadata instead of full attestation submissions. When an attestation is verified, only the extracted hash values and expiration timestamp are stored on-chain as VerifiedAttestation, reducing storage costs significantly.

Changes:

  • Introduced VerifiedAttestation type to store compact verification results instead of full Attestation objects
  • Added re_verify() method to validate stored attestations without requiring full attestation data
  • Migrated from IterableMap to BTreeMap for attestation storage with lazy cleanup pattern via StaleData

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
crates/mpc-attestation/src/attestation.rs Added VerifiedAttestation enum and re_verify method, refactored verify to return VerifiedAttestation
crates/contract/src/tee/tee_state.rs Changed storage from IterableMap to BTreeMap, updated verification methods to use VerifiedAttestation
crates/contract/src/lib.rs Added StaleData container and migrate_clear_tee for lazy cleanup of old attestations
crates/contract-interface/src/types/attestation.rs Added VerifiedAttestation and VerifiedDstackAttestation DTOs
crates/node/src/indexer/tx_sender.rs Updated attestation comparison logic to work with VerifiedAttestation using freshness heuristics
crates/contract/src/v3_0_2_state.rs Migration logic from v3.0.2 with mock attestation assignment
crates/contract/src/v3_2_0_state.rs Migration logic from v3.2.0 with mock attestation assignment
crates/mpc-attestation/tests/test_attestation_verification.rs Comprehensive test coverage for verify and re_verify functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

contract should not store full Attestation submission

5 participants