Skip to content
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

Use 0x50 as the header byte for 4844 batches #118

Merged
merged 2 commits into from
Jan 23, 2024
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
6 changes: 6 additions & 0 deletions src/bridge/ISequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ interface ISequencerInbox is IDelayedMessageProvider {
// solhint-disable-next-line func-name-mixedcase
function HEADER_LENGTH() external view returns (uint256);

/// @dev If the first batch data byte after the header has this bit set,
/// the sequencer inbox has authenticated the data. Currently only used for 4844 blob support.
/// See: https://github.com/OffchainLabs/nitro/blob/69de0603abf6f900a4128cab7933df60cad54ded/arbstate/das_reader.go
// solhint-disable-next-line func-name-mixedcase
function DATA_AUTHENTICATED_FLAG() external view returns (bytes1);

/// @dev If the first data byte after the header has this bit set,
/// then the batch data is to be found in 4844 data blobs
/// See: https://github.com/OffchainLabs/nitro/blob/69de0603abf6f900a4128cab7933df60cad54ded/arbstate/das_reader.go
Expand Down
7 changes: 5 additions & 2 deletions src/bridge/SequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
uint256 public constant HEADER_LENGTH = 40;

/// @inheritdoc ISequencerInbox
bytes1 public constant DATA_BLOB_HEADER_FLAG = 0x40;
bytes1 public constant DATA_AUTHENTICATED_FLAG = 0x40;

/// @inheritdoc ISequencerInbox
bytes1 public constant DATA_BLOB_HEADER_FLAG = DATA_AUTHENTICATED_FLAG | 0x10;

/// @inheritdoc ISequencerInbox
bytes1 public constant DAS_MESSAGE_HEADER_FLAG = 0x80;
Expand Down Expand Up @@ -406,7 +409,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
);
}

function addSequencerL2BatchFromBlob(
function addSequencerL2BatchFromBlobs(
uint256 sequenceNumber,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
Expand Down
2 changes: 1 addition & 1 deletion test/contract/sequencerInbox.spec.4844.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import { InboxMessageDeliveredEvent } from '../../build/types/src/bridge/AbsInbox'
import { SequencerBatchDeliveredEvent } from '../../build/types/src/bridge/ISequencerInbox'

const mineBlocks = async (

Check warning on line 58 in test/contract/sequencerInbox.spec.4844.ts

View workflow job for this annotation

GitHub Actions / Contract tests

'mineBlocks' is assigned a value but never used. Allowed unused vars must match /^_/u
wallet: Wallet,
count: number,
timeDiffPerBlock = 14
Expand Down Expand Up @@ -218,7 +218,7 @@
return wallets
}

const connectAddreses = (

Check warning on line 221 in test/contract/sequencerInbox.spec.4844.ts

View workflow job for this annotation

GitHub Actions / Contract tests

'connectAddreses' is assigned a value but never used. Allowed unused vars must match /^_/u
user: Wallet,
deployer: Wallet,
batchPoster: Wallet,
Expand Down Expand Up @@ -472,7 +472,7 @@
sequencerInbox.address,
['0x0142', '0x0143'],
sequencerInbox.interface.encodeFunctionData(
'addSequencerL2BatchFromBlob',
'addSequencerL2BatchFromBlobs',
[
sequenceNumber,
afterDelayedMessagesRead,
Expand Down
2 changes: 1 addition & 1 deletion test/contract/toolkit4844.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { execSync } from 'child_process'
import { ContractFactory, Signer, Wallet, ethers } from 'ethers'

Check warning on line 2 in test/contract/toolkit4844.ts

View workflow job for this annotation

GitHub Actions / Contract tests

'Wallet' is defined but never used. Allowed unused vars must match /^_/u
import * as http from 'http'
import { IReader4844, IReader4844__factory } from '../../build/types'
import { JsonRpcProvider } from '@ethersproject/providers'
import { bytecode as Reader4844Bytecode } from '../../out/yul/Reader4844.yul/Reader4844.json'

const wait = async (ms: number) =>
new Promise((res, rej) => {

Check warning on line 9 in test/contract/toolkit4844.ts

View workflow job for this annotation

GitHub Actions / Contract tests

'rej' is defined but never used. Allowed unused args must match /^_/u
setTimeout(res, ms)
})

export class Toolkit4844 {
public static DATA_BLOB_HEADER_FLAG = '0x40'
public static DATA_BLOB_HEADER_FLAG = '0x50' // 0x40 | 0x10

public static postDataToGeth(body: any): Promise<any> {
return new Promise((resolve, reject) => {
Expand Down
Loading