-
Notifications
You must be signed in to change notification settings - Fork 33
DEVREL-144 : Data Streams billing mechanism #47
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
base: develop
Are you sure you want to change the base?
Conversation
… in DataStreamsLocalSimulator
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.
Pull Request Overview
This PR adds the ability to toggle between on-chain and off-chain billing mechanisms in the DataStreamsLocalSimulator contract to support new chains like Monad that don't have FeeManager contracts deployed.
- Adds
feeManagerEnabled
state variable and toggle functions to switch between billing modes - Maintains backward compatibility by defaulting to on-chain billing
- Updates the configuration method to return the current billing state
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 6 comments.
File | Description |
---|---|
src/data-streams/DataStreamsLocalSimulator.sol | Implements billing mechanism toggle functionality with state tracking and fee manager management |
test/smoke/data-streams/BillingMechanisms.t.sol | Adds comprehensive tests for both billing mechanisms and toggle functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…illing mechanism is used
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.
Pull Request Overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
LGTM
all comments are raised only to prompt thinking to see if there are improvements we should be considering.
LinkToken internal immutable i_linkToken; | ||
|
||
/// @notice Whether fee manager is enabled (can be toggled after deployment) | ||
bool public feeManagerEnabled; |
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.
how can we help newbies make the connection in their minds that feeManager == on chain? right now, the literal wording suggests different things but actually the feemanager is an onchain-only primitive but this may not be obvious to most devs.
bool public feeManagerEnabled; | ||
|
||
constructor() { | ||
// Default to on-chain billing for backward compatibility |
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.
as per previous - note the comment and the var name suggest two different things (we know its connected but the end user cannot be expected to know)
* @dev This simulates chains that don't have FeeManager contracts deployed | ||
*/ | ||
function enableOffChainBilling() external { | ||
if (feeManagerEnabled) { |
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.
the issue may be fixed by renaming feeManagerEnabled to onChainBillingEnabled and then the next line .setFeeManager(...) having a comment to explain the connection That way the boolean var is descriptive.
revert FeeManagerRequired( | ||
"On-chain billing is active but your contract is using off-chain billing mechanism. " | ||
"Either call simulator.enableOffChainBilling() or provide fee token address in parameterPayload. " | ||
"See: https://docs.chain.link/data-streams/tutorials/evm-onchain-report-verification" |
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.
awesome!
if (!hasFeeManager && hasParameterPayload) { | ||
revert FeeManagerNotExpected( | ||
"Off-chain billing is active but your contract is providing parameterPayload for on-chain billing. " | ||
"Either call simulator.enableOnChainBilling() or pass empty bytes as parameterPayload. " |
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.
out of curiosity, would it revert on-chain if they passed an unnecessary parameterPayload?
|
||
// Verify fee manager is deployed by default | ||
assertFalse(address(mockFeeManager_) == address(0), "Fee manager should be deployed by default"); | ||
assertEq(address(mockVerifierProxy_.s_feeManager()), address(mockFeeManager_), "Fee manager should be set on verifier proxy"); |
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.
assertEq(address(mockVerifierProxy_.s_feeManager()), address(mockFeeManager_),
is there any risk that this assertEq could pass incorrectly if both are address(0)s and thats the bug?
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.
Pull Request Overview
Copilot reviewed 14 out of 20 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This PR adds support for toggling between on-chain and off-chain billing mechanisms in the
DataStreamsLocalSimulator
contract.Usage