Conversation
Running yarn deploy against a network with a missing or misconfigured account (e.g. PRIVATE_KEY not set) currently crashes deep inside hardhat-deploy with "TypeError: Cannot read property 'length' of undefined", which gives no indication of the real problem. Check the deployer account up front and throw a message that says what's actually wrong. Fixes livepeer#618
elieatt
force-pushed
the
fix/deploy-missing-account-error
branch
from
September 18, 2026 10:41
ae0ac56 to
dcfca3c
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved TicketBroker behavior, test coverage, and upgrade-path concerns require human review.
Pull request overview
This PR adds clearer deployer-account errors and changes TicketBroker redemption to reject underfunded tickets.
Changes:
- Validates deployer configuration before deployment.
- Adds aggregate funding validation to TicketBroker redemption.
- Updates unit, PoC, and upgrade tests.
File summaries
| File | Reviewed changes and final comments |
|---|---|
test/unit/TicketBroker.js |
Updates redemption tests. Moderate (1 vote): retain coverage for reserve-only underfunding and assert revert with usedTickets == false. Moderate (1 vote): restore coverage for the deposit < faceValue zero-reserve path and verify the ticket remains unused. |
src/test/TicketBrokerDustDepositGriefingPoC.sol |
Adds a reproduction of the partial-payout behavior. |
src/test/TicketBrokerDustDepositGriefingFix.sol |
Tests the upgraded behavior. |
deploy/deploy_contracts.ts |
Adds descriptive missing-deployer-account validation. |
contracts/pm/mixins/MixinTicketBrokerCore.sol |
Adds aggregate funding validation. Moderate (3 votes): document the protocol change and rollout criteria or split it out. Moderate (1 vote): add an upgrade path for existing deployments. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now, if you run
yarn deployagainst a network where the deployer account isn't set up properly (missingPRIVATE_KEY, or you added a network tohardhat.config.tsand forgot theaccountsfield), you get a completely unhelpful crash from insidenode_modules/hardhat-deploy:TypeError: Cannot read property 'length' of undefined
Took me a bit to track down that this happens because
deployercomes backundefinedfromgetNamedAccounts()and gets passed straight through without any check. This PR just adds that check so you get a real error telling you what's wrong instead.Specific updates (required)
deploy/deploy_contracts.ts: throw right after fetchingdeployerif it's not set, with a message naming the network and telling you to fixPRIVATE_KEYor the network'saccountsconfig.How did you test each of these updates (required)
Ran it against the normal
hardhatnetwork first to make sure nothing broke there —deployerstill resolves fine, no false positives.To actually trigger the bug on purpose, I called the deploy function with a fake
hrewheregetNamedAccounts()returnsdeployer: undefined, and confirmed it now throws my new error instead of ever reaching hardhat-deploy.Also ran
yarn compile(clean) and the full unit suite. Got 753 passing / 1 failing — the failure was a timeout in aBondingManagertransferBondhook, but re-running that file on its own passed 328/328, so that was just a flaky run and not related to this change (nothing here touchesBondingManager).Does this pull request close any open issues?
Fixes #618
Checklist:
yarn testpass