Skip to content

perf(contract): contract should not store full attestation submission - #1663

Merged
DSharifi merged 18 commits into
mainfrom
1629-contract-should-not-store-full-attestation-submission
Jan 15, 2026
Merged

DSharifi merged 18 commits into
mainfrom
1629-contract-should-not-store-full-attestation-submission

Conversation

@DSharifi

Copy link
Copy Markdown
Contributor

closes #1629

@DSharifi DSharifi linked an issue Dec 15, 2025 that may be closed by this pull request
3 tasks
Comment thread crates/contract-interface/src/types/attestation.rs Outdated
Comment thread crates/contract-interface/src/types/config.rs Outdated
Comment thread crates/contract-interface/src/types/attestation.rs Outdated
Comment thread crates/contract/src/tee/tee_state.rs Outdated
Comment thread crates/contract/src/tee/tee_state.rs Outdated

@barakeinav1 barakeinav1 left a comment

Copy link
Copy Markdown
Contributor

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

@barakeinav1 barakeinav1 left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

Comment thread crates/contract/src/tee/tee_state.rs Outdated
@DSharifi
DSharifi marked this pull request as ready for review December 17, 2025 21:56
Comment thread crates/contract/tests/snapshots/abi__abi_has_not_changed.snap Outdated
Comment thread crates/contract/tests/sandbox/common.rs Outdated
Comment thread crates/contract/src/lib.rs
Comment thread crates/contract/src/v3_0_2_state.rs
Comment thread crates/contract/Cargo.toml

@netrome netrome left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread crates/contract/src/v3_0_2_state.rs
Comment thread crates/mpc-attestation/src/attestation.rs Outdated
Comment thread crates/contract/tests/snapshots/abi__abi_has_not_changed.snap
@DSharifi

Copy link
Copy Markdown
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
Comment thread crates/mpc-attestation/src/attestation.rs Outdated
@netrome
netrome requested a review from Copilot January 14, 2026 13:10
Comment thread libs/nearcore
@barakeinav1

Copy link
Copy Markdown
Contributor

I open a bug for the issue I found:
Bug: MPC node crashes if attestation submission happens before the node keys are added to the near account#1763

@barakeinav1

Copy link
Copy Markdown
Contributor

We already have integration tests in place.
can you point me to that test?
I'm just concerned that we are adding a new behaviour that is not covered before (but hopefully I'm wrong)

Comment thread crates/contract-interface/src/types/attestation.rs Outdated
Comment thread crates/contract/src/dto_mapping.rs Outdated
Comment thread crates/contract/tests/snapshots/abi__abi_has_not_changed.snap Outdated
Comment thread crates/contract/tests/snapshots/abi__abi_has_not_changed.snap Outdated
Comment thread crates/node/src/indexer/tx_sender.rs Outdated
Comment thread crates/contract/src/tee/tee_state.rs
Comment thread crates/contract/src/v3_0_2_state.rs

@barakeinav1 barakeinav1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

overall look good.
2 blocking issue:

  1. I added some small typo fixes,
  2. Can you confirm that we have test coverage about expiration flows.

testing:
3 nodes setup is working, and gas cost is down !!!.

Also I opened a Bug: MPC node crashes if attestation submission happens before the node keys are added to the near account#1763.
so it can be handle separately if you prefer.

@DSharifi

Copy link
Copy Markdown
Contributor Author
  1. I added some small typo fixes,

Thanks for spotting, fixed now.

  1. Can you confirm that we have test coverage about expiration flows.

Here:

@barakeinav1 barakeinav1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks

@DSharifi
DSharifi added this pull request to the merge queue Jan 15, 2026
Merged via the queue into main with commit 5157c11 Jan 15, 2026
16 checks passed
@DSharifi
DSharifi deleted the 1629-contract-should-not-store-full-attestation-submission branch January 15, 2026 16:19
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