Skip to content

Commit

Permalink
[Feat] optimize blob submission data (#209)
Browse files Browse the repository at this point in the history
* smart-contract: small tweak on validation and consistent naming on params

* use currentL2BlockNumber vs. memory

* cache blobFirstBlockNumber

* optimize blob number validation

* cache snarkhash and finalStateRootHash

* remove redundant checks

* remove block numbers from blob submits

* remove extra space

* address naming considerations

* use updated ABI for V6 LineaRollup

* Use NatSpec for ITokenBridge events and errors (#202)

* Use NatSpec for ITokenBridge events and errors

* pass 1 of NatSpec cleanup

* natspec pass 2

* correct wording on NatSpec

* use correct indexed keyword location

---------

Signed-off-by: The Dark Jester <thedarkjester@users.noreply.github.com>
Co-authored-by: Pedro Novais <1478752+jpnovais@users.noreply.github.com>
  • Loading branch information
thedarkjester and jpnovais authored Oct 18, 2024
1 parent 086e0ad commit 017df93
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 661 deletions.
3 changes: 2 additions & 1 deletion config/common/smart-contract-errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"b1504a5f" = "BlobSubmissionDataIsMissing"
"c0e41e1d" = "EmptyBlobDataAtIndex"
"fb4cd6ef" = "FinalBlockDoesNotMatchShnarfFinalBlock"
"2526F108 " = "ShnarfAndFinalBlockNumberLengthsMismatched"
"2526F108" = "ShnarfAndFinalBlockNumberLengthsMismatched"
"d3664fb3" = "FinalShnarfWrong"
"4e686675" = "L2MerkleRootDoesNotExist"
"e5d14425" = "L2MerkleRootAlreadyAnchored"
Expand All @@ -46,3 +46,4 @@
"d39e75f9" = "L1MessageNumberSynchronizationWrong"
"7557a60a" = "L1RollingHashSynchronizationWrong"
"36a4bb94" = "FinalRollingHashIsZero"
"42ab979d" = "ParentBlobNotSubmitted"
208 changes: 45 additions & 163 deletions contracts/abi/LineaRollupV6.0.abi
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,6 @@
"name": "DataAlreadySubmitted",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "expected",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "actual",
"type": "uint256"
}
],
"name": "DataStartingBlockDoesNotMatch",
"type": "error"
},
{
"inputs": [],
"name": "EmptyBlobData",
"type": "error"
},
{
"inputs": [
{
Expand Down Expand Up @@ -174,38 +153,6 @@
"name": "FinalizationStateIncorrect",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "firstBlockNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "finalBlockNumber",
"type": "uint256"
}
],
"name": "FirstBlockGreaterThanFinalBlock",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "firstBlockNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "lastFinalizedBlock",
"type": "uint256"
}
],
"name": "FirstBlockLessThanOrEqualToLastFinalizedBlock",
"type": "error"
},
{
"inputs": [],
"name": "FirstByteIsNotZero",
Expand Down Expand Up @@ -296,22 +243,6 @@
"name": "LastFinalizationTimeNotLapsed",
"type": "error"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "expected",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "actual",
"type": "bytes32"
}
],
"name": "LastFinalizedShnarfWrong",
"type": "error"
},
{
"inputs": [
{
Expand Down Expand Up @@ -388,6 +319,17 @@
"name": "MissingRollingHashForMessageNumber",
"type": "error"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "shnarf",
"type": "bytes32"
}
],
"name": "ParentBlobNotSubmitted",
"type": "error"
},
{
"inputs": [],
"name": "PeriodIsZero",
Expand Down Expand Up @@ -461,27 +403,6 @@
"name": "ReentrantCall",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "shnarfsLength",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "finalBlockNumbers",
"type": "uint256"
}
],
"name": "ShnarfAndFinalBlockNumberLengthsMismatched",
"type": "error"
},
{
"inputs": [],
"name": "SnarkHashIsZeroHash",
"type": "error"
},
{
"inputs": [],
"name": "StartingRootHashDoesNotMatch",
Expand Down Expand Up @@ -555,18 +476,6 @@
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "startBlock",
"type": "uint256"
},
{
"indexed": true,
"internalType": "uint256",
"name": "endBlock",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes32",
Expand Down Expand Up @@ -1315,6 +1224,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "shnarf",
"type": "bytes32"
}
],
"name": "blobShnarfExists",
"outputs": [
{
"internalType": "uint256",
"name": "exists",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -1656,7 +1584,7 @@
},
{
"internalType": "uint256",
"name": "finalBlockInData",
"name": "endBlockNumber",
"type": "uint256"
},
{
Expand Down Expand Up @@ -2296,25 +2224,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "shnarf",
"type": "bytes32"
}
],
"name": "shnarfFinalBlockNumbers",
"outputs": [
{
"internalType": "uint256",
"name": "finalBlockNumber",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand All @@ -2338,33 +2247,6 @@
"inputs": [
{
"components": [
{
"components": [
{
"internalType": "bytes32",
"name": "finalStateRootHash",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "firstBlockInData",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "finalBlockInData",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "snarkHash",
"type": "bytes32"
}
],
"internalType": "struct ILineaRollup.SupportingSubmissionDataV2",
"name": "submissionData",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "dataEvaluationClaim",
Expand All @@ -2379,10 +2261,20 @@
"internalType": "bytes",
"name": "kzgProof",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "finalStateRootHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "snarkHash",
"type": "bytes32"
}
],
"internalType": "struct ILineaRollup.BlobSubmissionData[]",
"name": "_blobSubmissionData",
"internalType": "struct ILineaRollup.BlobSubmission[]",
"name": "_blobSubmissions",
"type": "tuple[]"
},
{
Expand Down Expand Up @@ -2410,16 +2302,6 @@
"name": "finalStateRootHash",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "firstBlockInData",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "finalBlockInData",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "snarkHash",
Expand All @@ -2431,8 +2313,8 @@
"type": "bytes"
}
],
"internalType": "struct ILineaRollup.SubmissionDataV2",
"name": "_submissionData",
"internalType": "struct ILineaRollup.CompressedCalldataSubmission",
"name": "_submission",
"type": "tuple"
},
{
Expand Down
Loading

0 comments on commit 017df93

Please sign in to comment.