Skip to content

Commit

Permalink
feat(protocol): reserve 2 slots for TaikoData.Transition (#15716)
Browse files Browse the repository at this point in the history
Co-authored-by: Keszey Dániel <keszeyd@MacBook-Pro.local>
Co-authored-by: Brecht Devos <Brechtp.Devos@gmail.com>
  • Loading branch information
3 people committed Feb 11, 2024
1 parent 4013e97 commit 8099bd1
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 23 deletions.
1 change: 1 addition & 0 deletions packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ library TaikoData {
bytes32 blockHash;
bytes32 stateRoot;
bytes32 graffiti;
bytes32[2] __reserved;
}

/// @dev Struct representing state transition data.
Expand Down
3 changes: 1 addition & 2 deletions packages/protocol/contracts/signal/SignalService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ contract SignalService is EssentialContract, ISignalService {
// If a signal is sent from chainA -> chainB -> chainC (this chain), we verify the proofs in
// the following order:
// 1. using chainC's latest parent's stateRoot to verify that chainB's TaikoL1/TaikoL2
// contract has
// sent a given hop stateRoot on chainB using its own signal service.
// contract has sent a given hop stateRoot on chainB using its own signal service.
// 2. using the verified hop stateRoot to verify that the source app on chainA has sent a
// signal using its own signal service.
// We always verify the proofs in the reversed order (top to bottom).
Expand Down
3 changes: 2 additions & 1 deletion packages/protocol/test/L1/TaikoL1LibProvingWithTiers.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase {
parentHash: parentHash,
blockHash: blockHash,
stateRoot: stateRoot,
graffiti: 0x0
graffiti: 0x0,
__reserved: [bytes32(0), bytes32(0)]
});

TaikoData.TierProof memory proof;
Expand Down
3 changes: 2 additions & 1 deletion packages/protocol/test/L1/TaikoL1TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ abstract contract TaikoL1TestBase is TaikoTest {
parentHash: parentHash,
blockHash: blockHash,
stateRoot: stateRoot,
graffiti: 0x0
graffiti: 0x0,
__reserved: [bytes32(0), bytes32(0)]
});

bytes32 instance =
Expand Down
6 changes: 4 additions & 2 deletions packages/protocol/test/verifiers/GuardianVerifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ contract TestGuardianVerifier is TaikoL1TestBase {
parentHash: bytes32(0),
blockHash: bytes32(0),
stateRoot: bytes32(0),
graffiti: bytes32(0)
graffiti: bytes32(0),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand All @@ -59,7 +60,8 @@ contract TestGuardianVerifier is TaikoL1TestBase {
parentHash: bytes32(0),
blockHash: bytes32(0),
stateRoot: bytes32(0),
graffiti: bytes32(0)
graffiti: bytes32(0),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down
33 changes: 22 additions & 11 deletions packages/protocol/test/verifiers/PseZkVerifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32(0),
blockHash: bytes32(0),
stateRoot: bytes32(0),
graffiti: bytes32(0)
graffiti: bytes32(0),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand All @@ -77,7 +78,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32(0),
blockHash: bytes32(0),
stateRoot: bytes32(0),
graffiti: bytes32(0)
graffiti: bytes32(0),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -128,7 +130,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -165,7 +168,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -194,7 +198,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -232,7 +237,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -269,7 +275,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -303,7 +310,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -344,7 +352,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -385,7 +394,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -423,7 +433,8 @@ contract TestPseZkVerifier is TaikoL1TestBase {
parentHash: bytes32("12"),
blockHash: bytes32("23"),
stateRoot: bytes32("34"),
graffiti: bytes32("1234")
graffiti: bytes32("1234"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down
18 changes: 12 additions & 6 deletions packages/protocol/test/verifiers/SgxVerifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ contract TestSgxVerifier is TaikoL1TestBase, AttestationBase {
parentHash: bytes32("12"),
blockHash: bytes32("34"),
stateRoot: bytes32("56"),
graffiti: bytes32("78")
graffiti: bytes32("78"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -243,7 +244,8 @@ contract TestSgxVerifier is TaikoL1TestBase, AttestationBase {
parentHash: bytes32("12"),
blockHash: bytes32("34"),
stateRoot: bytes32("56"),
graffiti: bytes32("78")
graffiti: bytes32("78"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -274,7 +276,8 @@ contract TestSgxVerifier is TaikoL1TestBase, AttestationBase {
parentHash: bytes32("12"),
blockHash: bytes32("34"),
stateRoot: bytes32("56"),
graffiti: bytes32("78")
graffiti: bytes32("78"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -307,7 +310,8 @@ contract TestSgxVerifier is TaikoL1TestBase, AttestationBase {
parentHash: bytes32("12"),
blockHash: bytes32("34"),
stateRoot: bytes32("56"),
graffiti: bytes32("78")
graffiti: bytes32("78"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -345,7 +349,8 @@ contract TestSgxVerifier is TaikoL1TestBase, AttestationBase {
parentHash: bytes32("12"),
blockHash: bytes32("34"),
stateRoot: bytes32("56"),
graffiti: bytes32("78")
graffiti: bytes32("78"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down Expand Up @@ -384,7 +389,8 @@ contract TestSgxVerifier is TaikoL1TestBase, AttestationBase {
parentHash: bytes32("12"),
blockHash: bytes32("34"),
stateRoot: bytes32("56"),
graffiti: bytes32("78")
graffiti: bytes32("78"),
__reserved: [bytes32(0), bytes32(0)]
});

// TierProof
Expand Down

0 comments on commit 8099bd1

Please sign in to comment.