Skip to content

Commit

Permalink
chore: revert drop of allocation_nonce from users table
Browse files Browse the repository at this point in the history
  • Loading branch information
pik694 committed Mar 27, 2024
1 parent e04c1bc commit 6c617af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
5 changes: 5 additions & 0 deletions backend/app/infrastructure/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class User(BaseModel):

id = Column(db.Integer, primary_key=True)
address = Column(db.String(42), unique=True, nullable=False)
allocation_nonce = Column(
db.Integer,
nullable=True,
comment="Allocations signing nonce, last used value. Range [0..inf)",
)

def get_effective_deposit(self, epoch: int) -> Optional[int]:
effective_deposit = None
Expand Down
3 changes: 3 additions & 0 deletions backend/app/modules/user/allocations/service/pending.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def allocate(
)

self.revoke_previous_allocation(context, user_address)

user = database.user.get_by_address(user_address)
user.allocation_nonce = expected_nonce
database.allocations.store_allocation_request(
user_address, context.epoch_details.epoch_num, payload, **kwargs
)
Expand Down

This file was deleted.

0 comments on commit 6c617af

Please sign in to comment.