Skip to content

Commit

Permalink
fix(protocol): hash L1 chain id to assignment hook (#15490)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Jan 13, 2024
1 parent bea1787 commit 1f02544
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/protocol/contracts/L1/ITaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ interface ITaikoL1 {
/// @notice Verifies up to a certain number of blocks.
/// @param maxBlocksToVerify Max number of blocks to verify.
function verifyBlocks(uint64 maxBlocksToVerify) external;

/// @notice Gets the configuration of the TaikoL1 contract.
/// @return Config struct containing configuration parameters.
function getConfig() external view returns (TaikoData.Config memory);
}
5 changes: 2 additions & 3 deletions packages/protocol/contracts/L1/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,8 @@ contract TaikoL1 is
return ITierProvider(resolve("tier_provider", false)).getMinTier(rand);
}

/// @notice Gets the configuration of the TaikoL1 contract.
/// @return Config struct containing configuration parameters.
function getConfig() public view virtual returns (TaikoData.Config memory) {
/// @inheritdoc ITaikoL1
function getConfig() public view virtual override returns (TaikoData.Config memory) {
// All hard-coded configurations:
// - treasury: the actual TaikoL2 address.
// - blockMaxTxs: 150 (limited by the PSE zkEVM circuits)
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/L1/hooks/AssignmentHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../common/EssentialContract.sol";
import "../../libs/LibAddress.sol";
import "../ITaikoL1.sol";
import "../TaikoData.sol";
import "./IHook.sol";

Expand All @@ -29,7 +30,6 @@ contract AssignmentHook is EssentialContract, IHook {

struct ProverAssignment {
address feeToken;
uint64 chainId;
uint64 expiry;
uint64 maxBlockId;
uint64 maxProposedIn;
Expand Down Expand Up @@ -158,7 +158,7 @@ contract AssignmentHook is EssentialContract, IHook {
return keccak256(
abi.encode(
"PROVER_ASSIGNMENT",
assignment.chainId,
ITaikoL1(taikoL1Address).getConfig().chainId,
taikoL1Address,
address(this),
assignment.metaHash,
Expand Down
1 change: 0 additions & 1 deletion packages/protocol/test/L1/TaikoL1TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ abstract contract TaikoL1TestBase is TaikoTest {

AssignmentHook.ProverAssignment memory assignment = AssignmentHook.ProverAssignment({
feeToken: address(0),
chainId: uint64(block.chainid),
tierFees: tierFees,
expiry: uint64(block.timestamp + 60 minutes),
maxBlockId: 0,
Expand Down

0 comments on commit 1f02544

Please sign in to comment.