-
Notifications
You must be signed in to change notification settings - Fork 2
Fix faucet #983
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
Fix faucet #983
Conversation
Deploying happychain with
|
| Latest commit: |
79781af
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6e6d3c71.happychain.pages.dev |
| Branch Preview URL: | https://gabriel-fix-faucet.happychain.pages.dev |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
| export FUND_THRESHOLD=10000000000000000 | ||
| export MONITOR_ADDRESSES=0x10EBe5E4E8b4B5413D8e1f91A21cE4143B6bd8F5,0x3cBD2130C2D4D6aDAA9c9054360C29e00d99f0BA,0xBAc858b1AD51527F3c4A22f146246c9913e97cFd,0x84dcb507875af1786bb6623a625d3f9aae9fda4f,0xAE45fD410bf09f27DA574D3EF547567A479F4594,0x71E30C67d58015293f452468E4754b18bAFFd807,0xE55b09F1b78B72515ff1d1a0E3C14AD5D707fdE8,0x634de6fbFfE60EE6D1257f6be3E8AF4CfefEf697,0xe8bD127b013600E5c6f864e5C07E918fa80BFF89 | ||
| export FUND_THRESHOLD=100000000000000000 | ||
| export FUNDS_TO_SEND=10000000000000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| export FUNDS_TO_SEND=10000000000000000 | |
| export FUNDS_TO_SEND=100000000000000000 |
Let's also increase the funds to send to 0.1 HAPPY — this will avoid topping up the faucet every time someone pulls from it (the faucet sents 0.01 HAPPY), instead topping up once every 10 pulls.
packages/txm/lib/TxMonitor.ts
Outdated
| if (transaction.collectionBlock && transaction.collectionBlock > block.number - 5n) { | ||
| // Skip transactions collected in the last 5 blocks to prevent race conditions between | ||
| // the transaction collector and monitor processing the same transaction simultaneously | ||
| span.addEvent("txm.tx-monitor.handle-not-attempted-transaction.skip-transaction", { | ||
| transactionIntentId: transaction.intentId, | ||
| collectionBlock: Number(transaction.collectionBlock), | ||
| blockNumber: Number(block.number), | ||
| }) | ||
| return | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting 5 blocks might introduce a lot of lag in our retries.
I'm retooling this so that we mark transaction that haven't gone through the initial submission as a new TransactionStatus.NotAttempted and we filter to not process these transactions in the TxMonitor.
9d2cfcf to
2a4bb9f
Compare
…hang as we hoped)

Description
This PR solves multiple issues in the faucet:
The first issue was that the faucet wasn't being monitored by the monitor service, so ironically it ran out of funds.
Another issue fixed was that the faucet was limiting usage based on both successful and failed transactions. Now it only considers successful transactions.
The threshold in the monitor service was increased because it was previously equal to the amount of tokens sent per request. This could cause problems if multiple users requested funds at the same time.
A race condition was fixed in the transaction manager (TXM) where the same transaction was sent multiple times. This caused the faucet to occasionally send duplicate transactions for a single request. The issue occurred because the transaction was being monitored in the TXM before the collection process had fully completed.
TXM traces are now exported from the faucet to allow debugging in case of issues.
Toggle Checklist
Checklist
Basics
norswap/build-system-caching).Reminder: PR review guidelines
Correctness
testnet, mainnet, standalone wallet, ...).
< INDICATE BROWSER, DEMO APP & OTHER ENV DETAILS USED FOR TESTING HERE >
< INDICATE TESTED SCENARIOS (USER INTERFACE INTERACTION, CODE FLOWS) HERE >
and have updated the code & comments accordingly.
Architecture & Documentation
(2) commenting these boundaries correctly, (3) adding inline comments for context when needed.
Public APIS and meaningful (non-local) internal APIs are properly documented in code comments.
in a Markdown document.
make changesetforbreaking and meaningful changes in packages (not required for cleanups & refactors).