Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Support Accounts in Pending State #467

Open
YaronWittenstein opened this issue Dec 21, 2021 · 0 comments
Open

Support Accounts in Pending State #467

YaronWittenstein opened this issue Dec 21, 2021 · 0 comments
Assignees
Labels
AA Related to the Accounts Abstraction simple-coin-iteration-4 svm svm-core SVM core change

Comments

@YaronWittenstein
Copy link
Contributor

YaronWittenstein commented Dec 21, 2021

This issue is preparation work for the Self-Spawn.
We want SVM to support having an Account in a Pending State (i.e., inactive).

That Account won't have any Template attached to it, and therefore it can't run any code.
That said, it can have a non-negative balance and be part of the Global State.
To stay efficient, looking up an Account should work the same regardless of whether it's active or not.

This issue turns the current Account into ActiveAccount, creates a new PendingAccount, and adds a new enum called Account.

That enum will enforce giving attention throughout the codebase of whether any Account would work or whether we expect it to be active or pending.

I think it's safer than just having a new is_active boolean added to the current Account.

Implementation Proposal

pub enum Account {
  Active(ActiveAccount),
  Pending(PendingAccount)
}

impl Account {
  pub is_active(&self) -> bool {
     //
  }

  pub is_pending(&self) -> bool {
    !(self.is_active())
  }
  
  pub addr(&self) -> &Address {
    //
  }

  pub balance(&self) -> u64 {
    //
  }

  pub name(&self) -> &str {
    //
  }

  pub counter(&self) -> u128 {
    //
  }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AA Related to the Accounts Abstraction simple-coin-iteration-4 svm svm-core SVM core change
Projects
None yet
Development

No branches or pull requests

2 participants