Documentation

Errors

Both contracts use custom errors for gas-efficient reverts. This reference lists all errors, their parameters, and when they are thrown.

EnergyRegistry Errors

Solidity
error WatcherNotRegistered(uint64 watcherId);
error UnauthorizedWatcherOwner(address caller, uint64 watcherId);
error ProjectNotRegistered(uint64 projectId);
error AttesterAlreadyAuthorized(address attester, uint64 projectId);
error AttesterNotAuthorized(address attester, uint64 projectId);
error EmptyAttesterArray();
error UnauthorizedResolver(address caller);
error PeriodAlreadyAttested(uint64 projectId, uint64 fromTimestamp, uint64 toTimestamp);
error PeriodStartAlreadyAttested(uint64 projectId, uint64 fromTimestamp);
error NonSequentialAttestation(uint64 projectId, uint64 expectedFrom, uint64 actualFrom);
error InvalidEnergyType(uint8 energyType);
error UnauthorizedEnergyTypeAdmin(address caller);
error EnergyTypeNotRegistered(uint8 id);
error DirectRevocationBlocked(uint64 projectId);
error ReplacementPeriodMismatch(uint64 projectId, uint64 expectedFrom, uint64 actualFrom, uint64 expectedTo, uint64 actualTo);
error AttestationNotFound(bytes32 uid);
error AttestationAlreadyReplaced(bytes32 uid);

EnergyAttestationResolver Errors

Solidity
error UnauthorizedAttester(address attester);
error ProjectNotRegistered(uint64 projectId);
error InvalidTimestamps();
error InvalidReadingCount();
error InvalidReadingInterval();
error InvalidReadingsLength(uint32 readingCount, uint256 readingsLength);
error TimestampOverflow();
error InvalidMethod();
error ReplacementPeriodMismatch();
error ReplacementProjectMismatch();
error DirectRevocationBlocked();

Common Causes

ErrorCommon Cause
UnauthorizedAttesterThe signing wallet is not whitelisted for this project or watcher
PeriodAlreadyAttestedThis time window was already attested — use replacement to correct
PeriodStartAlreadyAttestedAnother attestation already starts at this fromTimestamp
NonSequentialAttestationThe attestation's fromTimestamp doesn't match the project's last toTimestamp
InvalidReadingsLengthreadings array length does not match readingCount
TimestampOverflowDerived toTimestamp exceeds uint64 max value
ProjectNotRegisteredThe project ID does not exist or has been deregistered
InvalidEnergyTypeEnergy type ID is not registered (generators only)
DirectRevocationBlockedDirect revocations are not allowed — use replacement attestations instead
ReplacementPeriodMismatchReplacement attestation must cover the same time period as the original
ReplacementProjectMismatchReplacement attestation must reference the same project as the original
AttestationNotFoundThe referenced attestation UID does not exist in the registry
AttestationAlreadyReplacedThe attestation has already been replaced by another attestation