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

Operator attestation policy #10721

Merged
merged 7 commits into from
Dec 18, 2024
Merged

Operator attestation policy #10721

merged 7 commits into from
Dec 18, 2024

Conversation

turadg
Copy link
Member

@turadg turadg commented Dec 17, 2024

TODO in code

Description

Update TransactionFeed to publish when a majority of operators to attest (previous required unanimous). Conflicts log a loud error and don't publish.

Also updates the contract test to have 3 operators (per Mainnet policy) and rely on unit tests for the other values.

Security Considerations

Adds assertions to the deploy-config to help ensure that Mainnet has three unique operators, per security policy.

Scaling Considerations

Each new attestation iterates over three stores for matching values.

Documentation Considerations

Nothing end-user. OCW is documented elsewhere.

Testing Considerations

CI

Upgrade Considerations

not yet deployed.

contract is upgradable but changing the settlementAccountAddress will require creating a new TransactionFeed (as is the case for the Settler object.

Copy link

cloudflare-workers-and-pages bot commented Dec 17, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: cd2a40c
Status: ✅  Deploy successful!
Preview URL: https://8ea94c46.agoric-sdk.pages.dev
Branch Preview URL: https://ta-attestation-policy.agoric-sdk.pages.dev

View logs

@turadg turadg force-pushed the ta/attestation-policy branch from 186dd94 to cd2a40c Compare December 17, 2024 22:22
@turadg turadg requested review from dckc and heavypackets December 17, 2024 22:22
@turadg turadg marked this pull request as ready for review December 17, 2024 22:27
@turadg turadg requested a review from a team as a code owner December 17, 2024 22:27
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good

this review is a bit rushed, so you may want to get more eyes.
or let me know if you want me to look more closely.

@@ -79,6 +79,21 @@ test('happy aggregation', async t => {
});
});

test('disabled operator', async t => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good; the "unknown transaction" test mixed in testing this, and I wondered about reducing coverage.

@@ -118,10 +118,12 @@ export const prepareTransactionFeedKit = (zone, zcf) => {
/**
* Add evidence from an operator.
*
* NB: the operatorKit is responsible for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for... what?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have gotten a Slack notification!

The operatorKit is responsible for preventing a disabled kit from attesting.

I'll get that in before merge. I'll probably wait for another reviewer's comments before pushing again.

minAttestations,
'necessary attestations',
);
if (found.length < minAttestations) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to be the gist of it.

Comment on lines -158 to +166
for (const pendingStore of pending.values()) {
pendingStore.delete(txHash);
// sufficient agreement, so remove from pending and publish
for (const store of found) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change from pending.values() to found... I had to think a bit to convince myself that make no difference.

// but this time the third is different
op3.operator.submitEvidence(MockCctpTxEvidences.AGORIC_PLUS_DYDX());

// Now third operator catches up with same evidence already published
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't thought carefully about whether this is sufficient test coverage.

lastEvidence = next;
} else {
trace(
'🚨 conflicting evidence for',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a red-alert situation? It seems like we recover: we don't act on inconsistent evidence.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it deserves immediate operational attention if two oracles are disagreeing. At least one is unreliable and may require immediate action.

Comment on lines +176 to +178
lastEvidence,
'!=',
next,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have to use this in anger, I expect we'll want to see which operator submitted which evidence.

is that already traced?


// it's simply ignored
t.notThrows(() => op3.operator.submitEvidence(e1bad));
t.like(await evidenceSubscriber.getUpdateSince(0), {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ask for updates since 0 again? isn't the n+1th call supposed to pass in the updateCount from the nth call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a handy way to ask for the latest without risk of a hanging await while writing tests

updateCount: 1n,
});

// now another op repeats the bad evidence, so it's published to the stream.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh. tricky.


// Constraints on the configurations
const MAINNET_EXPECTED_ORACLES = 3;
assert(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Dec 18, 2024
@mergify mergify bot merged commit 9e5f628 into master Dec 18, 2024
102 checks passed
@mergify mergify bot deleted the ta/attestation-policy branch December 18, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants