-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat(ao): use IO/AO contract from ar.io/sdk #40
Conversation
This includes fetching prescribed names directly from the contract rather than computing them internally.
…oosen names, update implementations to use the sdk
… block height from contract
…ntion to avoid collisions. This is to be consistent with previous naming conventions for report filenames, but it is important to note the epochStartHeight is provided by the contract for the epoch and not computed by the observer
GatewayAssessments, | ||
GatewayHostsSource, | ||
ObserverReport, | ||
OwnershipAssessment, | ||
} from './types.js'; | ||
|
||
const REPORT_FORMAT_VERSION = 1; | ||
export const REPORT_FORMAT_VERSION = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djwhitt - is the report format intended to reflect just the assessments
? I've changed the top level attributes to include epochStartTimestamp
and epochEndTimestamp
. We can revert it back to 1 if the bump is not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're doing the right thing. We should bump the version for this.
…contract Since we are not computing epochs ourselves, we need to fetch the epoch information from the contract when we run a new report. This moves that logic to a class that fetches epoch information on every execution of running a report. It will cache the result until the epoch is over, based on network time rather than local system time.
The newer release of arweave 2.7+ shortened the max fork depth to 18 blocks.
It is used for both prescribed and chosen names so keeping it general makes sense.
We were not passing the height around so the choseNames kept returning an empty array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Not much to complain about here. 🙂
} | ||
|
||
async getName(height: number, index: number): Promise<string> { | ||
const names = await this.getAllNames(height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine for now (basically what we did before I think), but we'll need a more efficient way to do this in a future.
This includes fetching prescribed names and epoch information directly from the contract rather than computing them internally (PE-6259).
Logs:
Report
Contract:
Using
networkContract.getEpoch({ epochIndex: 19885 })