Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ contract BrokerPool is Initializable, ERC2771ContextUpgradeable, IERC677Receiver
event QueuedDataPayout(address user, uint amountPoolTokenWei);
event QueueUpdated(address user, uint amountPoolTokenWei);
event NodesSet(address[] nodes);
event Heartbeat(address indexed nodeAddress, string jsonData);

event ReviewRequest(Bounty indexed bounty, address indexed targetBroker);

Expand Down Expand Up @@ -357,6 +358,11 @@ contract BrokerPool is Initializable, ERC2771ContextUpgradeable, IERC677Receiver
bounty.voteOnFlag(targetBroker, voteData);
}

/** Nodes announce their ID and other connectivity metadata */
function heartbeat(string calldata jsonData) external onlyNodes {
emit Heartbeat(_msgSender(), jsonData);
}

// TODO delete in ETH-480
function setReviewRewardsBeneficiary(address newBeneficiary) external onlyBroker {
reviewRewardsBeneficiary = newBeneficiary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,5 +893,12 @@ describe("BrokerPool", (): void => {
await expect(voter.voteOnFlag(bounty.address, target.address, VOTE_KICK))
.to.emit(target, "Unstaked").withArgs(bounty.address, "0", "0")
})

it("can call heartbeat", async function(): Promise<void> {
const pool = await deployBrokerPool(sharedContracts, broker)
await expect(pool.heartbeat("{}")).to.be.rejectedWith("error_onlyNodes")
await (await pool.setNodeAddresses([delegator2.address])).wait()
await expect(pool.connect(delegator2).heartbeat("{}")).to.emit(pool, "Heartbeat").withArgs(delegator2.address, "{}")
})
})
})