-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: calculate arbitrum block number for start of epoch #71
Conversation
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.
Some quick comments and it's good to go!
@@ -309,10 +313,18 @@ export class ProtocolProvider implements IProtocolProvider { | |||
blockNumber: epochFirstBlockNumber, | |||
}); | |||
|
|||
const startTimestamp = epochFirstBlock.timestamp as UnixTimestamp; |
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.
Let's make the blockNumberService
dependency optional so we don't have to worry about creating a mocked version of it within the recently developed scripts. Let's make it so ProtocolProvider fails if someone tries to get a current epoch without passing a block number service when initializing it.
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.
✅
const expectedAddress = privateKeyToAccount(mockedPrivateKey).address; | ||
const expectedAddress = privateKeyToAccount( | ||
mockedPrivateKey, | ||
mockBlockNumberService, |
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.
Is this ok? 🤔
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.
it is not, it appears my linter is on strike. I removed it
@@ -247,10 +255,15 @@ describe("ProtocolProvider", () => { | |||
const mockEpochBlock = BigInt(12345); | |||
const mockEpochTimestamp = BigInt(Date.UTC(2024, 1, 1, 0, 0, 0, 0)) / 1000n; | |||
|
|||
const mockBlockNumberService = { | |||
getEpochBlockNumber: vi.fn().mockResolvedValue(mockEpochBlock), |
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.
We should differentiate the getEpochBlockNumber from block number service from the block number returned by the epoch manager contract, just to be sure that one is the L1 block number (contract's one) and the BN service response is L2 (which should actually be used in the return value).
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.
✅
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.
good to go after addressing Yaco's comments
…-arbitrum-block-num # Conflicts: # packages/automated-dispute/src/providers/protocolProvider.ts # packages/automated-dispute/tests/services/protocolProvider.spec.ts
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.
One little thing more and it's ready to go
rpcConfig, | ||
contracts, | ||
env.PRIVATE_KEY as Hex, | ||
mockBlockNumberService, |
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.
You should be able to drop this with the new changes! I think you'll need to add the optionality for BlockNumberService
in the ProtocolProvider
constructor
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.
oops this got filtered out in the merge
🤖 Linear
Closes GRT-214
Description