Skip to content

Update EIP-6551: Preventing circular lock situation with initialize #15

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 1 commit into
base: main
Choose a base branch
from

Conversation

Abhijaypaliwal
Copy link

Description

This pull request adds the initialize function for EIP-6551 as described in the guidelines. The initialize function can be called by the owner after ownership change to set the currOwner and prevOwner variables. Additionally, the unlockCircularLock function is introduced to handle situations of circular lock, allowing the previous owner to unlock it.

Changes

Added Functions

  • initialize(uint256 tokenId) external : Initializes the currOwner and prevOwner variables after ownership change.

  • unlockCircularLock(uint256 tokenId) external : Allows the previous owner to unlock the circular lock situation by calling this function.

Modifications

  • Modified the ERC6551Account contract to include the new variables currOwner and prevOwner.

Tests

  • Added comprehensive tests to cover the new functionalities, including the initialize and unlockCircularLock functions.

Motivation

This enhancement is in line with the objectives of EIP-6551 and provides additional functionalities for handling ownership transitions and circular lock scenarios.

Usage

  1. After ownership change, the new owner can call the initialize function to set the current owner (currOwner) and previous owner (prevOwner) variables.

  2. In cases of circular lock, the previous owner can use the unlockCircularLock function to release the lock.

Issues

The initialize function could only be used to change previousOwner. and this value could only be used for account recovery. however if new owner of Token transfer it to another owner without initialization, the previousOwner is not changed, hence the recovery can be done by third last owner and he can call it without any restriction, which could be malicious.

Checklist

  • Code follows the EIP-6551 guidelines.
  • Added appropriate tests for the new functionalities.
  • Documentation has been updated to reflect the changes.

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.

1 participant