Skip to content

Commit

Permalink
Fix packed encoding of espresso L1 block values
Browse files Browse the repository at this point in the history
  • Loading branch information
jbearer committed Jan 31, 2024
1 parent e920aa3 commit e42292e
Show file tree
Hide file tree
Showing 14 changed files with 458 additions and 313 deletions.
20 changes: 10 additions & 10 deletions op-bindings/bindings/l1block.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions op-bindings/bindings/l1block_more.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions op-node/rollup/derive/l1_block_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ func (info *L1BlockInfo) unmarshalBinaryBedrock(data []byte) error {
// | 32 | BlobBaseFee |
// | 32 | BlockHash |
// | 32 | BatcherHash |
// | 8 | Espresso |
// | 8 | EspressoL1ConfDepth |
// | 8 | Espresso |
// | variable| Justification |
// +---------+--------------------------+

Expand Down Expand Up @@ -286,6 +286,9 @@ func (info *L1BlockInfo) marshalBinaryEcotone() ([]byte, error) {
if err := solabi.WriteAddress(w, info.BatcherAddr); err != nil {
return nil, err
}
if err := binary.Write(w, binary.BigEndian, info.EspressoL1ConfDepth); err != nil {
return nil, err
}
if info.Espresso {
if err := binary.Write(w, binary.BigEndian, uint64(1)); err != nil {
return nil, err
Expand All @@ -295,9 +298,6 @@ func (info *L1BlockInfo) marshalBinaryEcotone() ([]byte, error) {
return nil, err
}
}
if err := binary.Write(w, binary.BigEndian, info.EspressoL1ConfDepth); err != nil {
return nil, err
}
rlpBytes, err := rlp.EncodeToBytes(info.Justification)
if err != nil {
return nil, err
Expand Down Expand Up @@ -343,14 +343,14 @@ func (info *L1BlockInfo) unmarshalBinaryEcotone(data []byte) error {
if info.BatcherAddr, err = solabi.ReadAddress(r); err != nil {
return err
}
if err := binary.Read(r, binary.BigEndian, &info.EspressoL1ConfDepth); err != nil {
return fmt.Errorf("invalid ecotone l1 block info format: %w", err)
}
var espresso uint64
if err := binary.Read(r, binary.BigEndian, &espresso); err != nil {
return fmt.Errorf("invalid ecotone l1 block info format: %w", err)
}
info.Espresso = espresso != 0
if err := binary.Read(r, binary.BigEndian, &info.EspressoL1ConfDepth); err != nil {
return fmt.Errorf("invalid ecotone l1 block info format: %w", err)
}
rlpBytes, err := io.ReadAll(r)
if err != nil {
return fmt.Errorf("invalid ecotone l1 block info format: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build": "forge build",
"build:go-ffi": "(cd scripts/go-ffi && go build)",
"autogen:invariant-docs": "npx tsx scripts/invariant-doc-gen.ts",
"test": "pnpm build:go-ffi && forge test",
"test": "pnpm build:go-ffi && forge test -vvv",
"test:kontrol": "./test/kontrol/scripts/run-kontrol.sh",
"genesis": "./scripts/generate-l2-genesis.sh",
"coverage": "pnpm build:go-ffi && forge coverage",
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"sourceCodeHash": "0xde06becce9514f46ba78b4cb0732c7a714d49ba8f131258d56a5f5b22b51be7e"
},
"src/L2/L1Block.sol": {
"initCodeHash": "0xf039cf5c5f0787d2e76feead9206fbc36bd27ca2a58b853df4e0a64f8b065e23",
"sourceCodeHash": "0x8f318ea1f16af6ccf7bed5cdaacd8d31bdaf485f072a746b8a88eec35054ed55"
"initCodeHash": "0x4b17c70695f872a8f68a8be4c2971481b9fc4827a397076f7e5e8c61aa4c2993",
"sourceCodeHash": "0x72e6257fc5fec28b56865d2e1f8627944e9f9f06b91bb63e24d98ce3ecd680c9"
},
"src/L2/L1FeeVault.sol": {
"initCodeHash": "0x2744d34573be83206d1b75d049d18a7bb37f9058e68c0803e5008c46b0dc2474",
Expand Down
88 changes: 44 additions & 44 deletions packages/contracts-bedrock/snapshots/abi/AddressManager.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,4 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "string",
"name": "name",
"type": "string"
},
{
"indexed": false,
"internalType": "address",
"name": "newAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "oldAddress",
"type": "address"
}
],
"name": "AddressSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [
{
Expand Down Expand Up @@ -112,5 +68,49 @@
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "string",
"name": "name",
"type": "string"
},
{
"indexed": false,
"internalType": "address",
"name": "newAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "oldAddress",
"type": "address"
}
],
"name": "AddressSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
}
]
Loading

0 comments on commit e42292e

Please sign in to comment.