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

Out of Band Reimbursement Daemon #649

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

rauljordan
Copy link
Collaborator

Background

This PR defines a tool that can run a continuous daemon that monitors confirmed challenges and outputs payable addresses and amounts for the purposes of reimbursing their gas fees and service fees from participating as honest validators. All it needs is an Ethereum L1 connection and a BOLD-enabled, Arbitrum rollup addresses to function.

It is based on the specification here

CAVEAT: This implementation is NOT production ready. It is meant to be a working proof of concept, which needs a lot more testing and robust error handling than today.

How it Works

Screenshot 2024-05-23 at 17 50 11

The daemon processes all chain events related to assertion creation, edge creation, assertion confirmation, and edge confirmation from the rollup contract from the latest confirmed assertion block to the latest block, continuously. If it observes an assertion and it is a descendant of the latest confirmed, and is part of a challenge, it gets added to a watchlist set of hashes.

Once an item in the watchlist is confirmed, an executeReimbursement method is called.

If the confirmed item is of assertionType, we compute the protocol graph of edges for that assertion's challenge. Then, we compute the refinement edges at its lower challenge level that are confirmed / unconfirmed. For those that are confirmed, we reimburse gas. For the ones that are unconfirmed, we add to the watchlist and continue listening for events of confirmations.

The output of executeReimbursement is a paymentRequest, which will be forwarded to another goroutine that is listening for these requests. The goroutine will extract the info about the payable address, the amount they are owed based on gas expenditures and service fees, and save a pending payment JSON file to an output directory. Another party can run the same script and reproduce similar payment JSONs to cross-check the computation was correct.

The main entrypoint spawns several goroutines, but the main one to follow is processAssertionConfirmation to understand the full flow.

func (s *service) run(ctx context.Context) {
	go receiveAsync(ctx, s.claimedChallengeAssertions, s.processAssertionsInChallenges)
	go receiveAsync(ctx, s.confirmedAssertionsObserved, s.processAssertionConfirmation)
	go receiveAsync(ctx, s.confirmedEdgesObserved, s.processEdgeConfirmation)
	go receiveAsync(ctx, s.gasPaymentRequests, s.processGasPaymentRequest)
	go receiveAsync(ctx, s.serviceFeePaymentRequests, s.processServiceFeePaymentRequest)
	s.scanChainEvents(ctx)
}

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