Skip to content

Commit

Permalink
refactor: TransactionFeed attest
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Dec 17, 2024
1 parent 01713ed commit f7f6e10
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/fast-usdc/src/exos/operator-kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const trace = makeTracer('TxOperator');

/**
* @typedef {object} OperatorPowers
* @property {(evidence: CctpTxEvidence, operatorKit: OperatorKit) => void} submitEvidence
* @property {(evidence: CctpTxEvidence, operatorKit: OperatorKit) => void} attest
*/

/**
Expand Down Expand Up @@ -102,7 +102,7 @@ export const prepareOperatorKit = (zone, staticPowers) =>
async submitEvidence(evidence) {
const { state } = this;
!state.disabled || Fail`submitEvidence for disabled operator`;
const result = state.powers.submitEvidence(evidence, this.facets);
const result = state.powers.attest(evidence, this.facets);
return result;
},
/** @returns {OperatorStatus} */
Expand Down
6 changes: 4 additions & 2 deletions packages/fast-usdc/src/exos/transaction-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const INVITATION_MAKERS_DESC = 'oracle operator invitation';

const TransactionFeedKitI = harden({
operatorPowers: M.interface('Transaction Feed Admin', {
submitEvidence: M.call(CctpTxEvidenceShape, M.any()).returns(),
attest: M.call(CctpTxEvidenceShape, M.any()).returns(),
}),
creator: M.interface('Transaction Feed Creator', {
// TODO narrow the return shape to OperatorKit
Expand Down Expand Up @@ -118,10 +118,12 @@ export const prepareTransactionFeedKit = (zone, zcf) => {
/**
* Add evidence from an operator.
*
* NB: the operatorKit is responsible for
*
* @param {CctpTxEvidence} evidence
* @param {OperatorKit} operatorKit
*/
submitEvidence(evidence, operatorKit) {
attest(evidence, operatorKit) {
const { pending } = this.state;
trace(
'submitEvidence',
Expand Down
2 changes: 1 addition & 1 deletion packages/fast-usdc/test/exos/transaction-feed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ test.skip('forged source', async t => {

// op1 is different than the facets object the evidence must come from
t.throws(() =>
feedKit.operatorPowers.submitEvidence(
feedKit.operatorPowers.attest(
evidence,
// @ts-expect-error XXX Types of property '[GET_INTERFACE_GUARD]' are incompatible.
op1,
Expand Down

0 comments on commit f7f6e10

Please sign in to comment.