Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions contracts/HubPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
// slowRelayRoot to a SpokePool. The latter two roots, once published to the SpokePool, contain
// leaves that can be executed on the SpokePool to pay relayers or recipients.
struct RootBundle {
// When root bundle challenge period passes and this root bundle becomes executable.
uint64 requestExpirationTimestamp;
// Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number
// of leaves are executed, a new root bundle can be proposed
uint64 unclaimedPoolRebalanceLeafCount;
// Contains leaves instructing this contract to send funds to SpokePools.
bytes32 poolRebalanceRoot;
// Relayer refund merkle root to be published to a SpokePool.
Expand All @@ -67,6 +62,11 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
address proposer;
// Whether bond has been repaid to successful root bundle proposer.
bool proposerBondRepaid;
// Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number
// of leaves are executed, a new root bundle can be proposed
uint8 unclaimedPoolRebalanceLeafCount;
// When root bundle challenge period passes and this root bundle becomes executable.
uint32 requestExpirationTimestamp;
}

// Only one root bundle can be stored at a time. Once all pool rebalance leaves are executed, a new proposal
Expand Down Expand Up @@ -136,7 +136,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {

// Each root bundle proposal must stay in liveness for this period of time before it can be considered finalized.
// It can be disputed only during this period of time. Defaults to 2 hours, like the rest of the UMA ecosystem.
uint64 public liveness = 7200;
uint32 public liveness = 7200;

event ProtocolFeeCaptureSet(address indexed newProtocolFeeCaptureAddress, uint256 indexed newProtocolFeeCapturePct);

Expand Down Expand Up @@ -174,7 +174,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
);

event ProposeRootBundle(
uint64 requestExpirationTimestamp,
uint32 requestExpirationTimestamp,
uint64 unclaimedPoolRebalanceLeafCount,
uint256[] bundleEvaluationBlockNumbers,
bytes32 indexed poolRebalanceRoot,
Expand Down Expand Up @@ -290,7 +290,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
* @notice Sets root bundle proposal liveness period. Callable only by owner.
* @param newLiveness New liveness period.
*/
function setLiveness(uint64 newLiveness) public override onlyOwner {
function setLiveness(uint32 newLiveness) public override onlyOwner {
require(newLiveness > 10 minutes, "Liveness too short");
liveness = newLiveness;
emit LivenessSet(newLiveness);
Expand Down Expand Up @@ -504,7 +504,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
// technically valid but not useful. This could also potentially be enforced at the UMIP-level.
require(poolRebalanceLeafCount > 0, "Bundle must have at least 1 leaf");

uint64 requestExpirationTimestamp = uint64(getCurrentTime() + liveness);
uint32 requestExpirationTimestamp = uint32(getCurrentTime()) + liveness;

delete rootBundleProposal; // Only one bundle of roots can be executed at a time.

Expand Down
2 changes: 1 addition & 1 deletion contracts/HubPoolInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface HubPoolInterface {

function setBond(IERC20 newBondToken, uint256 newBondAmount) external;

function setLiveness(uint64 newLiveness) external;
function setLiveness(uint32 newLiveness) external;

function setIdentifier(bytes32 newIdentifier) external;

Expand Down
4 changes: 2 additions & 2 deletions test/HubPool.Admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ describe("HubPool Admin functions", function () {
await expect(hubPool.connect(owner).setIdentifier(identifier)).to.be.revertedWith("Identifier not supported");
});
it("Set liveness", async function () {
const newLiveness = "1000000";
const newLiveness = 1000000;
await hubPool.connect(owner).setLiveness(newLiveness);
await expect(await hubPool.liveness()).to.equal(newLiveness);
});
it("Liveness too short", async function () {
await expect(hubPool.connect(owner).setLiveness(599)).to.be.revertedWith("Liveness too short");
});
it("Only owner can set liveness", async function () {
await expect(hubPool.connect(other).setLiveness("1000000")).to.be.reverted;
await expect(hubPool.connect(other).setLiveness(1000000)).to.be.reverted;
});
});