Skip to content

Fix spec and add spec for supra governance #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 45 commits into
base: dev
Choose a base branch
from
Open

Conversation

axiongsupra
Copy link

No description provided.

@axiongsupra axiongsupra marked this pull request as ready for review September 11, 2024 03:29
aborts_if !table::spec_contains(voting_forum.proposals, proposal_id);
aborts_if is_voting_period_over(proposal);
aborts_if proposal.is_resolved;
aborts_if !exists<timestamp::CurrentTimeMicroseconds>(@supra_framework);

Choose a reason for hiding this comment

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

@axiongsupra not sure why this aborts_if is required and what purpose does it serve.

Copy link
Author

Choose a reason for hiding this comment

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

This is for checking the whether time already started. This is required if we have call to timestamp::now_seconds()

// };
let timestamp_secs_bytes = std::bcs::serialize(timestamp::spec_now_seconds());
let key = std::string::spec_utf8(RESOLVABLE_TIME_METADATA_KEY);
ensures simple_map::spec_get(post_proposal.metadata, key) == timestamp_secs_bytes;

Choose a reason for hiding this comment

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

This property only ensures that time is recorded. Other properties we should aim at adding are

  • vote by the voter is recorded (if not already voted)
  • vote by the voter is recorded (if vote is flipped)
  • total yes/no votes should tally (increase/decrease appropriately)

Copy link
Author

Choose a reason for hiding this comment

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

Added in e65045b

Comment on lines 143 to 144
aborts_if has_multi_step_key && !from_bcs::deserializable<bool>(simple_map::spec_get(proposal.metadata, multi_step_key));
aborts_if has_multi_step_key && from_bcs::deserialize<bool>(simple_map::spec_get(proposal.metadata, multi_step_key));

Choose a reason for hiding this comment

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

Not sure I understand the role of these. @axiongsupra

Copy link
Author

Choose a reason for hiding this comment

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

This looks strange to me. I will take a look and submit a patch.


let post post_voting_forum = global<VotingForum<ProposalType>>(voting_forum_address);
let post post_proposal = table::spec_get(post_voting_forum.proposals, proposal_id);
aborts_if !exists<timestamp::CurrentTimeMicroseconds>(@supra_framework);

Choose a reason for hiding this comment

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

What is the role of this?

Copy link
Author

Choose a reason for hiding this comment

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

This is for checking the whether time already started. This is required if we have call to timestamp::now_seconds()

@axiongsupra
Copy link
Author

The proofs are still valid.

@axiongsupra
Copy link
Author

The spec are still valid

[INFO] 2.222s build, 2.298s trafo, 0.493s gen, 165.846s verify, total 170.858s
{
  "Result": "Success"
}

@axiongsupra
Copy link
Author

axiongsupra commented May 21, 2025

Resolved conflict.

Aptos move prover verify this successfully.

[INFO] 686 verification conditions
[INFO] running solver
[INFO] 109.49s build, 2.64s trafo, 0.62s gen, 285.81s verify, total 398.56s
{
  "Result": "Success"
}

However, supra move prover end with the following error:

Error: General: {
  "Error": "Move Prover failed: [internal] boogie exited with compilation errors:\n/Users/supra/aptos-core/aptos-move/framework/supra-framework/boogie.bpl(103321,288): Error: cannot refer to a global variable in this context: #0_info\n/Users/supra/aptos-core/aptos-move/framework/supra-framework/boogie.bpl(103321,300): Error: cannot refer to a global variable in this context: #0_info\n/Users/supra/aptos-core/aptos-move/framework/supra-framework/boogie.bpl(103321,312): Error: cannot refer to a global variable in this context: #0_info\n/Users/supra/aptos-core/aptos-move/framework/supra-framework/boogie.bpl(103321,462): Error: cannot refer to a global variable in this context: #0_info\n/Users/supra/aptos-core/aptos-move/framework/supra-framework/boogie.bpl(103321,474): Error: cannot refer to a global variable in this context: #0_info\n/Users/supra/aptos-core/aptos-move/framework/supra-framework/boogie.bpl(103321,486): Error: cannot refer to a global variable in this context: #0_info\n6 name resolution errors detected in /Users/supra/aptos-core/aptos-move/framework/supra-framework/boogie.bpl\n"
}

@axiongsupra axiongsupra requested a review from sjoshisupra May 22, 2025 00: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.

2 participants