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

WIP ValidatorsExitBus Oracle tests #638

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b57fbb2
test: validatorsExitBus oracle: access control: minor fix
DiRaiks Feb 20, 2023
22f0430
test: ValidatorsExitBusOracle._handleConsensusReportData enforces dat…
manneredboor Feb 20, 2023
d213e0e
test: ValidatorsExitBusOracle._handleConsensusReportData enforces dat…
manneredboor Feb 20, 2023
8872c37
test: ValidatorsExitBusOracle._handleConsensusReportData invokes sani…
manneredboor Feb 20, 2023
c44e0f7
feat: parent contract internal checks test
Jeday Feb 20, 2023
4e69de7
chore: abi
Jeday Feb 20, 2023
d1477f8
Merge branch 'feature/shapella-upgrade-tests-validators-exit-bus-orac…
Jeday Feb 20, 2023
6c129c6
feat: getTotalRequestsProcessed tests
Jeday Feb 20, 2023
bd17933
test: ValidatorsExitBusOracle._handleConsensusReportData validates re…
manneredboor Feb 20, 2023
2e9d69c
test: ValidatorsExitBusOracle._handleConsensusReportData updates proc…
manneredboor Feb 20, 2023
8a42e43
feat: getProcessingState tests
Jeday Feb 20, 2023
19cf415
Merge branch 'feature/shapella-upgrade-tests-validators-exit-bus-orac…
Jeday Feb 20, 2023
7690377
test: ValidatorsExitBusOracle._handleConsensusReportData updates tota…
manneredboor Feb 20, 2023
eb19d96
test: ValidatorsExitBusOracle._handleConsensusReportData checks that …
manneredboor Feb 20, 2023
90b526f
test: ValidatorsExitBusOracle._handleConsensusReportData emits Valida…
manneredboor Feb 20, 2023
41d2413
test: remove unrelevant testcase
manneredboor Feb 20, 2023
dc90118
feat: pause tests and clean up
Jeday Feb 20, 2023
b90b6f9
chore: abi
Jeday Feb 20, 2023
2d67863
Merge branch 'feature/shapella-upgrade-tests-validators-exit-bus-orac…
Jeday Feb 20, 2023
044951f
Merge branch 'feature/shapella-upgrade-followups' of github.com:lidof…
Jeday Feb 20, 2023
4472dfb
fix: snapshot variable not defined
Jeday Feb 20, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ contract ValidatorsExitBusTimeTravellable is ValidatorsExitBusOracle, ITimeProvi
address consensus = CONSENSUS_CONTRACT_POSITION.getStorageAddress();
return ITimeProvider(consensus).getTime();
}

function getDataProcessingState() external view returns (DataProcessingState memory) {
return _storageDataProcessingState().value;
}
}
1 change: 1 addition & 0 deletions test/0.8.9/oracle/hash-consensus-access-control.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const MockReportProcessor = artifacts.require('MockReportProcessor')
contract('HashConsensus', ([admin, account1, account2, member1, member2]) => {
let consensus = null
let reportProcessor = null
let snapshot = null
const manageMembersAndQuorumRoleKeccak156 = web3.utils.keccak256('MANAGE_MEMBERS_AND_QUORUM_ROLE')
const disableConsensusRoleKeccak156 = web3.utils.keccak256('DISABLE_CONSENSUS_ROLE')
const manageFrameConfigRoleKeccak156 = web3.utils.keccak256('MANAGE_FRAME_CONFIG_ROLE')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const {
const PUBKEYS = [
'0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
'0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
'0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd',
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
'0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'
]

contract('ValidatorsExitBusOracle', ([admin, member1, member2, member3, account1, stranger]) => {
Expand Down
40 changes: 24 additions & 16 deletions test/0.8.9/oracle/validators-exit-bus-oracle-deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ function getReportDataItems(r) {

function calcReportDataHash(reportItems) {
const data = web3.eth.abi.encodeParameters(['(uint256,uint256,uint256,uint256,bytes)'], [reportItems])
// const toS = x => Array.isArray(x) ? `[${x.map(toS)}]` : `${x}`
// console.log(toS(reportItems))
// console.log(data)
return web3.utils.keccak256(data)
}

Expand Down Expand Up @@ -84,7 +81,7 @@ module.exports = {
async function deployOracleReportSanityCheckerForExitBus(lidoLocator, admin) {
const maxValidatorExitRequestsPerReport = 2000
const limitsList = [0, 0, 0, 0, maxValidatorExitRequestsPerReport, 0, 0, 0, 0]
const managersRoster = [[admin], [], [], [], [], [], [], [], [], []]
const managersRoster = [[admin], [admin], [admin], [admin], [admin], [admin], [admin], [admin], [admin], [admin]]

const OracleReportSanityChecker = artifacts.require('OracleReportSanityChecker')

Expand All @@ -97,16 +94,19 @@ async function deployOracleReportSanityCheckerForExitBus(lidoLocator, admin) {
from: admin
}
)
return oracleReportSanityChecker.address
return oracleReportSanityChecker
}

async function deployExitBusOracle(admin, {
dataSubmitter = null,
lastProcessingRefSlot = 0,
resumeAfterDeploy = false,
pauser = ZERO_ADDRESS,
resumer = ZERO_ADDRESS,
} = {}) {
async function deployExitBusOracle(
admin,
{
dataSubmitter = null,
lastProcessingRefSlot = 0,
resumeAfterDeploy = false,
pauser = ZERO_ADDRESS,
resumer = ZERO_ADDRESS
} = {}
) {
const locator = (await deployLocatorWithDummyAddressesImplementation(admin)).address

const oracle = await ValidatorsExitBusOracle.new(SECONDS_PER_SLOT, GENESIS_TIME, locator, { from: admin })
Expand All @@ -119,7 +119,7 @@ async function deployExitBusOracle(admin, {
const oracleReportSanityChecker = await deployOracleReportSanityCheckerForExitBus(locator, admin)
await updateLocatorImplementation(locator, admin, {
validatorsExitBusOracle: oracle.address,
oracleReportSanityChecker: oracleReportSanityChecker
oracleReportSanityChecker: oracleReportSanityChecker.address
})

const initTx = await oracle.initialize(
Expand All @@ -129,7 +129,7 @@ async function deployExitBusOracle(admin, {
consensus.address,
CONSENSUS_VERSION,
lastProcessingRefSlot,
{from: admin}
{ from: admin }
)

assert.emits(initTx, 'ContractVersionSet', { version: 1 })
Expand Down Expand Up @@ -162,8 +162,9 @@ async function deployExitBusOracle(admin, {
await oracle.resume({ from: admin })
}

return { consensus, oracle, locator, initTx }
return { consensus, oracle, oracleReportSanityChecker, locator, initTx }
}

contract('ValidatorsExitBusOracle', ([admin, member1]) => {
let consensus
let oracle
Expand All @@ -180,7 +181,6 @@ contract('ValidatorsExitBusOracle', ([admin, member1]) => {
assert.equal(+(await oracle.getTime()), time1)

await consensus.advanceTimeBy(SECONDS_PER_SLOT)

const time2 = +(await consensus.getTime())
assert.equal(time2, time1 + SECONDS_PER_SLOT)
assert.equal(+(await oracle.getTime()), time2)
Expand All @@ -192,5 +192,13 @@ contract('ValidatorsExitBusOracle', ([admin, member1]) => {
assert.equal(+(await oracle.SECONDS_PER_SLOT()), SECONDS_PER_SLOT)
assert.equal(await oracle.isPaused(), true)
})

it('pause/resume operations work', async () => {
assert.equal(await oracle.isPaused(), true)
await oracle.resume()
assert.equal(await oracle.isPaused(), false)
await oracle.pause(123)
assert.equal(await oracle.isPaused(), true)
})
})
})
Loading