diff --git a/contracts/0.8.9/test_helpers/oracle/AccountingOracleTimeTravellable.sol b/contracts/0.8.9/test_helpers/oracle/AccountingOracleTimeTravellable.sol index 7847b8417..e25ffa93c 100644 --- a/contracts/0.8.9/test_helpers/oracle/AccountingOracleTimeTravellable.sol +++ b/contracts/0.8.9/test_helpers/oracle/AccountingOracleTimeTravellable.sol @@ -30,4 +30,8 @@ contract AccountingOracleTimeTravellable is AccountingOracle, ITimeProvider { address consensus = CONSENSUS_CONTRACT_POSITION.getStorageAddress(); return ITimeProvider(consensus).getTime(); } + + function getExtraDataProcessingState() external view returns (ExtraDataProcessingState memory) { + return _storageExtraDataProcessingState().value; + } } diff --git a/test/0.8.9/oracle/accounting-oracle-submit-report-data.test.js b/test/0.8.9/oracle/accounting-oracle-submit-report-data.test.js index d1a105fd2..ea0c5851a 100644 --- a/test/0.8.9/oracle/accounting-oracle-submit-report-data.test.js +++ b/test/0.8.9/oracle/accounting-oracle-submit-report-data.test.js @@ -12,7 +12,8 @@ const { EXTRA_DATA_FORMAT_LIST, SLOTS_PER_FRAME, SECONDS_PER_SLOT, - GENESIS_TIME + GENESIS_TIME, + ZERO_HASH } = require('./accounting-oracle-deploy.test') contract('AccountingOracle', ([admin, account1, account2, member1, member2, stranger]) => { @@ -491,5 +492,28 @@ contract('AccountingOracle', ([admin, account1, account2, member1, member2, stra ) }) }) + + context('ExtraDataProcessingState', () => { + it('should be empty from start', async () => { + const data = await oracle.getExtraDataProcessingState() + assert.equals(data.refSlot, '0') + assert.equals(data.dataFormat, '0') + assert.equals(data.itemsCount, '0') + assert.equals(data.itemsProcessed, '0') + assert.equals(data.lastSortingKey, '0') + assert.equals(data.dataHash, ZERO_HASH) + }) + + it('should be filled with report data after submitting', async () => { + await oracle.submitReportData(reportItems, oracleVersion, { from: member1 }) + const data = await oracle.getExtraDataProcessingState() + assert.equals(data.refSlot, reportFields.refSlot) + assert.equals(data.dataFormat, reportFields.extraDataFormat) + assert.equals(data.itemsCount, reportFields.extraDataItemsCount) + assert.equals(data.itemsProcessed, '0') + assert.equals(data.lastSortingKey, '0') + assert.equals(data.dataHash, reportFields.extraDataHash) + }) + }) }) })