Skip to content
New issue

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

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

Already on GitHub? # to your account

Grammar #1

Merged
merged 12 commits into from
Jan 16, 2024
Merged

Grammar #1

merged 12 commits into from
Jan 16, 2024

Conversation

SkymanOne
Copy link
Owner

No description provided.

out < 10000
{
match value {
case 1 -> SimpleState (return value),
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does SimpleState represent here?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Represents no storage state

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok - I did not find the definition though

Copy link
Owner Author

Choose a reason for hiding this comment

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

Oh, right, My bad; I changed the function's signature. Yeah, there should be no state mutation returned.

};

state ExecuteState(ExecuteModel) from RevealState st {
current_block > RevealModel.end_block
Copy link
Collaborator

Choose a reason for hiding this comment

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

Imo we should also check that all voters have revealed their commitment. Otherwise I would trigger an error / invalidate the voting

Copy link
Owner Author

Choose a reason for hiding this comment

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

We can not guarantee that all voters will reveal their voters, otherwise the reveal stage will be stalled forever.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nope we can't. But, we can check that at least a threshold has been reached within a certain time. Otherwise abort the voting.

voter.size <= max_size
}

// Voting model extends `BeginModel` and its guards
Copy link
Collaborator

Choose a reason for hiding this comment

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

“Extends” means that a VotingModel is binded to one specific BeginModel?

Copy link
Owner Author

Choose a reason for hiding this comment

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

No, this is simple OOP concept. "Extends" = "inherits"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it - so if I have an instantiation for a VotingModel it inherits from BeginModel the same proposal, right?

In other terms: proposal looks like an identifier that must be the same for each model.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes, it simply inherits

    start_block: int,
    end_block: int,
    voters: Set<Address>,
    proposal: String,
    max_size: int

fields from the BeginModel. It doesn't mean the values are automatically inherited. It is up to the developer to specify what are the values of the VotingModel fields during state transition: they can be passed from the BeginModel or the new ones can be set.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok but I guess that state transitions must ensure that some values remain consistent from one model to another

start_block > (current_block + 10),
end_block > (start_block + 10),
//voters balance should greater than 1000 tokens
voters.balance > 1000,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Balance of what? E.g. in Algorand account’s balance comprise ALGOs and eventually other tokens.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Okay, this is requires some additional thinking since I assumed that, as in EVM, balance refers to the native token.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In terms of opcodes - balance refers to ALGOs (see here); asset_holding refers to any given asset (see here)

@SkymanOne SkymanOne changed the base branch from main to dev January 16, 2024 22:20
@SkymanOne SkymanOne merged commit 4941b2c into dev Jan 16, 2024
@SkymanOne SkymanOne deleted the grammar branch January 16, 2024 22:20
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants