Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gzeoneth committed Jan 17, 2024
1 parent 7f6aa37 commit 229eb59
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
9 changes: 5 additions & 4 deletions src/bridge/ISequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ interface ISequencerInbox is IDelayedMessageProvider {
uint64 creationBlock;
}

/// @dev returns 4 uint256 to be compatible with older version
function maxTimeVariation()
external
view
returns (
uint256,
uint256,
uint256,
uint256
uint256 delayBlocks,
uint256 futureBlocks,
uint256 delaySeconds,
uint256 futureSeconds
);

function dasKeySetInfo(bytes32) external view returns (bool, uint64);
Expand Down
62 changes: 34 additions & 28 deletions test/contract/sequencerInbox.spec.4844.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ describe('SequencerInbox', async () => {
await rollupOwner.getAddress()
)

const dataHashReader = await Toolkit4844.deployDataHashReader(fundingWallet)
const blobBasefeeReader = await Toolkit4844.deployBlobBasefeeReader(fundingWallet)
const sequencerInboxFac = (await ethers.getContractFactory(
'SequencerInbox'
)) as SequencerInbox__factory
const seqInboxTemplate = await sequencerInboxFac.deploy(
117964,
dataHashReader.address,
blobBasefeeReader.address
)
const inboxFac = new Inbox__factory(deployer)
const inboxTemplate = await inboxFac.deploy(117964)

Expand All @@ -289,40 +299,34 @@ describe('SequencerInbox', async () => {
adminAddr,
'0x'
)

const sequencerInboxProxy = await transparentUpgradeableProxyFac.deploy(
seqInboxTemplate.address,
adminAddr,
'0x'
)
const inboxProxy = await transparentUpgradeableProxyFac.deploy(
inboxTemplate.address,
adminAddr,
'0x'
)
await bridgeProxy.deployed()
await inboxProxy.deployed()
const dataHashReader = await Toolkit4844.deployDataHashReader(fundingWallet)
const blobBasefeeReader = await Toolkit4844.deployBlobBasefeeReader(
fundingWallet
)
await sequencerInboxProxy.deployed()

const bridge = await bridgeFac.attach(bridgeProxy.address).connect(user)
const bridgeAdmin = await bridgeFac
.attach(bridgeProxy.address)
.connect(rollupOwner)
const sequencerInbox = await sequencerInboxFac
.attach(sequencerInboxProxy.address)
.connect(user)
await (await bridgeAdmin.initialize(rollupMock.address)).wait()

const sequencerInboxFac = new SequencerInbox__factory(deployer)
const sequencerInbox = await sequencerInboxFac.deploy(
bridge.address,
{
delayBlocks: maxDelayBlocks,
futureBlocks: 10,
delaySeconds: maxDelayTime,
futureSeconds: 3000,
},
117964,
dataHashReader.address,
blobBasefeeReader.address,
{ gasLimit: 15000000 }
)
await sequencerInbox.deployed()
await sequencerInbox.initialize(bridgeProxy.address, {
delayBlocks: maxDelayBlocks,
delaySeconds: maxDelayTime,
futureBlocks: 10,
futureSeconds: 3000,
})

const inbox = await inboxFac.attach(inboxProxy.address).connect(user)

Expand Down Expand Up @@ -381,7 +385,9 @@ describe('SequencerInbox', async () => {
const subMessageCount = await bridge.sequencerReportedSubMessageCount()
const batchSendTx = await sequencerInbox
.connect(batchPoster)
.functions.addSequencerL2BatchFromOrigin(
.functions[
'addSequencerL2BatchFromOrigin(uint256,bytes,uint256,address,uint256,uint256)'
](
await bridge.sequencerMessageCount(),
'0x0042',
await bridge.delayedMessageCount(),
Expand Down Expand Up @@ -542,15 +548,15 @@ describe('SequencerInbox', async () => {
const maxTimeVariation = await sequencerInbox.maxTimeVariation()
return {
minBlocks:
blockNumber > maxTimeVariation.delayBlocks.toNumber()
? blockNumber - maxTimeVariation.delayBlocks.toNumber()
blockNumber > maxTimeVariation[0].toNumber()
? blockNumber - maxTimeVariation[0].toNumber()
: 0,
maxBlock: blockNumber + maxTimeVariation.futureBlocks.toNumber(),
maxBlock: blockNumber + maxTimeVariation[1].toNumber(),
minTimestamp:
blockTimestamp > maxTimeVariation.delaySeconds.toNumber()
? blockTimestamp - maxTimeVariation.delaySeconds.toNumber()
blockTimestamp > maxTimeVariation[2].toNumber()
? blockTimestamp - maxTimeVariation[2].toNumber()
: 0,
maxTimestamp: blockTimestamp + maxTimeVariation.futureSeconds.toNumber(),
maxTimestamp: blockTimestamp + maxTimeVariation[3].toNumber(),
}
}

Expand Down

0 comments on commit 229eb59

Please sign in to comment.