Skip to content

Fix/deploy missing account error - #665

Open
elieatt wants to merge 1 commit into
livepeer:deltafrom
elieatt:fix/deploy-missing-account-error
Open

elieatt wants to merge 1 commit into
livepeer:deltafrom
elieatt:fix/deploy-missing-account-error

Conversation

@elieatt

@elieatt elieatt commented Sep 18, 2026

Copy link
Copy Markdown

Right now, if you run yarn deploy against a network where the deployer account isn't set up properly (missing PRIVATE_KEY, or you added a network to hardhat.config.ts and forgot the accounts field), you get a completely unhelpful crash from inside node_modules/hardhat-deploy:

TypeError: Cannot read property 'length' of undefined

Took me a bit to track down that this happens because deployer comes back undefined from getNamedAccounts() 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 fetching deployer if it's not set, with a message naming the network and telling you to fix PRIVATE_KEY or the network's accounts config.

How did you test each of these updates (required)
Ran it against the normal hardhat network first to make sure nothing broke there — deployer still resolves fine, no false positives.

To actually trigger the bug on purpose, I called the deploy function with a fake hre where getNamedAccounts() returns deployer: 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 a BondingManager transferBond hook, 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 touches BondingManager).

Does this pull request close any open issues?

Fixes #618

Checklist:

  • README and other documentation updated
  • All tests using yarn test pass

Copilot AI lite review requested due to automatic review settings September 18, 2026 10:36
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
elieatt force-pushed the fix/deploy-missing-account-error branch from ae0ac56 to dcfca3c Compare September 18, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 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.

Copilot AI review requested due to automatic review settings September 18, 2026 10:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused validation change has no unresolved blocking issues.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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.

Running yarn deploy gives TypeError: Cannot read property 'length' of undefined

2 participants