Skip to content

[DO NOT MERGE] [MEL] Changes to Rollup and OSP contracts#427

Draft
TucksonDev wants to merge 4 commits intodevelopfrom
feat/mel-validation-changes
Draft

[DO NOT MERGE] [MEL] Changes to Rollup and OSP contracts#427
TucksonDev wants to merge 4 commits intodevelopfrom
feat/mel-validation-changes

Conversation

@TucksonDev
Copy link
Copy Markdown
Contributor

@TucksonDev TucksonDev commented Apr 22, 2026

!! WIP - DO NOT MERGE !!

Note

This is a preliminary version, and can completely change, based on changes in the design or the implementation of the feature in nitro.

This PR contains changes to support MEL in the Rollup and OSP contracts.

Key changes

  • The target of the next assertion to create is not an Inbox position anymore. We now use the hash of the block previous to where the current assertion is created
  • Onchain inbox accumulators are not used anymore, so now assertions are hashed only using the previous assertion hash and the current assertion data
  • GlobalState contains now 4 new fields:
    • MELState hash
    • Next message hash
    • Msg count
    • Executed Msg count
  • Setting a new MELConfig in the Rollup config allow it to set a new Inbox and SequencerInbox

Pending work

  • Overflowing assertions
  • nextParentChainBlockHash to use on initialization
  • Rollup update process
  • OSP contracts

Nitro reference PRs

Comment thread src/rollup/IRollupAdmin.sol Outdated

/// @dev MELConfig was set
event MELConfigSet(
uint64 indexed melVersion, address indexed inbox, address indexed sequencerInbox, uint64 activationBlock
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't melVersion be uint16? as defined in MELState.sol?

Comment on lines +466 to +494
function setMELConfig(
uint16 _melVersion,
address _inbox,
address _sequencerInbox
) external {
// MEL versions can only be increased
require(_melVersion > melVersion, "INVALID_MEL_VERSION");

// Setting the contracts
setInbox(IInboxBase(_inbox));
setSequencerInbox(_sequencerInbox);

// Set the new MEL version
melVersion = _melVersion;

// Save the new MELConfig
MELConfig memory _melConfig = MELConfig({
melVersion: _melVersion,
inbox: _inbox,
sequencerInbox: _sequencerInbox,
activationBlockNumber: uint64(block.number)
});

bytes32 melConfigHash = keccak256(abi.encode(_melConfig));
melConfig[melConfigHash] = _melConfig;

// Emit event to signal the update to nitro
emit MELConfigSet(_melVersion, _inbox, _sequencerInbox, uint64(block.number));
}
Comment thread src/state/Deserialize.sol
// using constant ints for array size requires newer solidity
bytes32[2] memory bytes32Vals;
uint64[2] memory u64Vals;
bytes32[2] memory melBytes32Vals;
Comment thread src/state/Deserialize.sol
bytes32[2] memory bytes32Vals;
uint64[2] memory u64Vals;
bytes32[2] memory melBytes32Vals;
uint64[2] memory melU64Vals;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants