Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release/v2.x] Bridge testnet #449

Merged
merged 1 commit into from
Nov 24, 2024
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
30 changes: 0 additions & 30 deletions evm/contracts/bridge/BlobstreamO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ contract BlobstreamO is ECDSA {
uint256 public validatorTimestamp; /// Timestamp of the block where validator set is updated.
address public deployer; /// Address that deployed the contract.
bool public initialized; /// True if the contract is initialized.
bool public isTestnet = true; /// True if the contract is on testnet.

/*Events*/
event ValidatorSetUpdated(uint256 _powerThreshold, uint256 _validatorTimestamp, bytes32 _validatorSetHash);
Expand All @@ -59,7 +58,6 @@ contract BlobstreamO is ECDSA {
error NotConsensusValue();
error NotDeployer();
error NotGuardian();
error NotTestnet();
error StaleValidatorSet();
error SuppliedValidatorSetInvalid();
error ValidatorSetNotStale();
Expand Down Expand Up @@ -120,34 +118,6 @@ contract BlobstreamO is ECDSA {
lastValidatorSetCheckpoint = _validatorSetCheckpoint;
}

/// @notice This function is called by the guardian to reset the validator set
/// on testnet. Not to be used on mainnet.
/// @param _powerThreshold Amount of voting power needed to approve operations.
/// @param _validatorTimestamp The timestamp of the block where validator set is updated.
/// @param _validatorSetCheckpoint The hash of the validator set.
function guardianResetValidatorSetTestnet(
uint256 _powerThreshold,
uint256 _validatorTimestamp,
bytes32 _validatorSetCheckpoint
) external {
if (msg.sender != guardian) {
revert NotGuardian();
}
if (!isTestnet) {
revert NotTestnet();
}
powerThreshold = _powerThreshold;
validatorTimestamp = _validatorTimestamp;
lastValidatorSetCheckpoint = _validatorSetCheckpoint;
}

function guardianThrowAwayReset() external {
if (msg.sender != guardian) {
revert NotGuardian();
}
isTestnet = false;
}

/// @notice This updates the validator set by checking that the validators
/// in the current validator set have signed off on the new validator set.
/// @param _newValidatorSetHash The hash of the new validator set.
Expand Down
26 changes: 26 additions & 0 deletions evm/contracts/testing/BlobstreamOTestnet.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../bridge/BlobstreamO.sol";

contract BlobstreamOTestnet is BlobstreamO {
constructor(address _guardian) BlobstreamO(_guardian) {}

/// @notice This function is called by the guardian to reset the validator set
/// on testnet. Not to be used on mainnet.
/// @param _powerThreshold Amount of voting power needed to approve operations.
/// @param _validatorTimestamp The timestamp of the block where validator set is updated.
/// @param _validatorSetCheckpoint The hash of the validator set.
function guardianResetValidatorSetTestnet(
uint256 _powerThreshold,
uint256 _validatorTimestamp,
bytes32 _validatorSetCheckpoint
) external {
if (msg.sender != guardian) {
revert NotGuardian();
}
powerThreshold = _powerThreshold;
validatorTimestamp = _validatorTimestamp;
lastValidatorSetCheckpoint = _validatorSetCheckpoint;
}
}
5 changes: 5 additions & 0 deletions evm/contracts/testing/TellorPlayground.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ contract TellorPlayground {
oracleMintRecipient = _oracle;
}

function resetTotalSupply(uint256 totalSupply_) external {
require(msg.sender == deployer, "only deployer can reset total supply");
_totalSupply = totalSupply_;
}

/**
* @dev A mock function to submit a value to be read without reporter staking needed
* @param _queryId the ID to associate the value to
Expand Down
Loading