Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

DRAFT: Privacy e2e #232

Draft
wants to merge 88 commits into
base: main
Choose a base branch
from
Draft

DRAFT: Privacy e2e #232

wants to merge 88 commits into from

Conversation

Mikelle
Copy link
Member

@Mikelle Mikelle commented Apr 5, 2024

No description provided.

@Mikelle Mikelle self-assigned this Apr 5, 2024
events := l.subscribers[log.Topics[0]]
for _, event := range events {
ev := event
go func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Check the updated change

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated according to the changes in mev-oracle/events

pkg/allowancemanager/allowance.go Outdated Show resolved Hide resolved
}

func (a *AllowanceManager) CheckAllowance(ctx context.Context, address common.Address) error {
if a.blocksPerWindow == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This would need to be synchronized no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed this var to atomic

logger *slog.Logger
}

func NewAllowanceManager(
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be another API which would be called after preconfirmation is sent to 'deduct' balance from the window balance. This can be done by having 1 function like CheckAndAllocateAllowance(ctx, address, amount) where you pass in the amount of the bid to check if user has enough balance considering the initial deposit and then the deductions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added deduction/refund logic that tracks the balance of each bidder for a specific block, allowing multiple bids on the same block as long as they do not exceed the allowed amount.

return nil
}

func (a *AllowanceManager) subscribeBidderRegistered(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

All these handlers need to be synchronized. If you dont want to synchronize, you can have 1 worker reading different events from the channel and then performing the updates. In which case your handlers would just write something into this channel. The worker would be the only one doing the updates. But still you need to synchronize the Check function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated this by adding events update from mev-oracle. Internally it's using store, which has Mutex functionality, so it should be synchronized

p.logger.Debug("commitment not found", "commitmentDigest", ec.CommitmentDigest)
return nil
}
commitment.EncryptedPreConfirmation.CommitmentIndex = ec.CommitmentIndex[:]
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes an assumption that the store is inmemory and you only need to update the inmem entry. Either we should have a separate function to update or have the update in the same function we called earlier.

Copy link
Member Author

Choose a reason for hiding this comment

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

Introduced new function for this case

pkg/rpc/bidder/service.go Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants