Skip to content
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

FIP-40 establish permissions, integrate register_address_on_domain. #297

Merged
merged 16 commits into from
May 4, 2023

Conversation

edrotthoff
Copy link
Contributor

@edrotthoff edrotthoff commented Mar 19, 2023

This FIP establishes the notion of permissions on the fio protocol, and integrates a new permission which is defined in FIP-40, register_address_on_domain

please see the project info on the wiki at
https://fioprotocol.atlassian.net/wiki/spaces/FD/pages/555253761/FIP-40+Register+addresses+on+private+domains+access+control

FIP-40 skeletal contract for fio.perms
@edrotthoff edrotthoff marked this pull request as draft March 19, 2023 16:30
Ed Rotthoff added 8 commits March 22, 2023 11:20
FIP-40 fio.perms initial integration into contracts
FIP-40 flush out error handling for add perm
FIP-40 implement parameter validation and tests
FIP-40 implement action logic for add and remove permission
FIP-40 table name change to plural
FIP-40 alittle code reformatting.
FIP-40 integrate register address with permissions.
FIP-40 integrate transfer domain and burn expired.
auto domains_iter = domainsbyname.find(domainHash);

fio_400_assert(domains_iter != domainsbyname.end(), "domnotfound object_name", object_name,
"Invalid object name",
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this error is specific to the domain object, I recommend we use a clearer error like "FIO Domain not found"

const uint32_t domain_expiration = get_time_plus_seconds(domains_iter->expiration, SECONDS30DAYS);

const uint32_t present_time = now();
fio_400_assert(present_time <= domain_expiration, "domexpired object_name", object_name, "Invalid object name",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Domain expired: unable to set permission"

ErrorInvalidObjectName);

//check domain owner is actor
fio_400_assert((actor.value == domains_iter->account), "actornotowner object_name", object_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

"Only domain owner can set permissions" (or something like that)

"grantee account is invalid", ErrorInvalidGranteeAccount);

fio_400_assert((grantee_account.value != actor.value), "grantee_account", grantee_account.to_string(),
"grantee account is invalid", ErrorInvalidGranteeAccount);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a check that ensures that the actor is not granting themselves permission? If so, we should have a clearer error like "Cannot grant permissions to self"


// error if object name is not * or is not in the domains table
fio_400_assert(object_name.size() > 0, "object_name", object_name,
"Object name is invalid", ErrorInvalidObjectName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Generic "object name invalid" errors should be replaced with messages that will make it clear what is wrong with the transaction.

Ed Rotthoff added 2 commits April 13, 2023 16:10
FIP-40 code review action items
FIP-40 add getters
edrotthoff and others added 5 commits April 24, 2023 14:07
FIP-40 merge develop up to dev branch of fio.contracts
FIP-40 implement wildcard for domain name option
FIP-40 final prep for merge
FIP-40 final merge prep
FIP-40 perp for merge into develop

namespace fioio {

class [[eosio::contract("FioPermissions")]] FioPermissions : public eosio::contract {
Copy link
Member

Choose a reason for hiding this comment

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

Recommend using the contract name (should be used for all new contracts moving forward):
class [[eosio::contract("fio.perms")]] FioPermissions : public eosio::contract {
This will help alleviate issues with the abigen

@edrotthoff edrotthoff marked this pull request as ready for review May 4, 2023 19:06
@edrotthoff edrotthoff merged commit 5ecc1f3 into develop May 4, 2023
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.

3 participants