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

Keystone: Forwarder contract updates #12962

Merged
merged 3 commits into from
May 13, 2024
Merged

Conversation

archseer
Copy link
Contributor

No description provided.

(uint8 v, bytes32 r, bytes32 s) = vm.sign(s_signers[i].mockPrivateKey, hash);
// rs[i] = r;
// ss[i] = s;
// vs[i] = bytes1(v - 27);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

OCR2Base seems to do this - 27 subtraction but the signature doesn't validate for me then

Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

Copy link
Contributor

github-actions bot commented May 1, 2024

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

Copy link
Contributor

github-actions bot commented May 1, 2024

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

1 similar comment
Copy link
Contributor

github-actions bot commented May 1, 2024

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

// TODO: we probably need some type of f value config?
(/* bytes32 workflowId */, bytes4 donId, bytes32 workflowExecutionId) = Utils._splitReport(rawReport);

if (signatures.length != s_configs[donId].f + 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (signatures.length != s_configs[donId].f + 1) {
if (signatures.length < s_configs[donId].f + 1) {

We could get more than f+1 signatures, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

libocr's version is strict in the number of signatures expected, though mostly so we don't reimburse gas costs for redundant signature verifications

if (signers.length > MAX_ORACLES) revert ExcessSigners(signers.length, MAX_ORACLES);
if (signers.length <= 3 * f) revert InsufficientSigners(signers.length, 3 * f + 1);

// TODO: how does setConfig handle expiration? e.g. if the signer set changes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: I typically expect to see a link to the Jira ticket if you leave the TODO in the code. Otherwise, these aren't visible in Jira.

Copy link
Contributor

Choose a reason for hiding this comment

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

@archseer what do you mean by expiration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In OCR2Aggregator changing the config also expires any past in-flight transmissions since the config digest will change (and needs to match on transmit).

Copy link
Contributor

Choose a reason for hiding this comment

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

We're not sending the digest alongside our reports are we? I thought we will only rely purely on signature validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't but the question is do we want something equivalent for expiration?

Copy link
Collaborator

Choose a reason for hiding this comment

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


// NOTE: we don't inherit OCR2Base since unlike aggregator we only care about signers, not transmitters
// and the signers don't fetch their config from the forwarder
function setConfig(bytes4 donId, uint8 f, address[] calldata signers) external nonReentrant {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that we control this and will need to build tools anyways, wouldn't it be cheaper for us to expose a getSigners function so we can calculate the diff off-chain and then provide address[] calldata signersToRemove, address[] calldata signersToAdd arguments? This way, we wouldn't need to iterate through all the signers 🤷‍♂️ just a thought

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's do this as part of the code golf optimizations later, it requires slightly more work on the tooling side than a single idempotent call

cds95
cds95 previously approved these changes May 10, 2024
@DeividasK DeividasK changed the title keystone: Forwarder v2 Keystone: Forwarder contract updates May 10, 2024
cds95
cds95 previously approved these changes May 13, 2024
@DeividasK DeividasK enabled auto-merge May 13, 2024 06:25
DeividasK
DeividasK previously approved these changes May 13, 2024
…signers

# Conflicts:
#	core/gethwrappers/keystone/generation/generated-wrapper-dependency-versions-do-not-edit.txt
@DeividasK DeividasK dismissed stale reviews from cds95 and themself via 56a4c11 May 13, 2024 11:37
@DeividasK DeividasK added this pull request to the merge queue May 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 13, 2024
@DeividasK DeividasK added this pull request to the merge queue May 13, 2024
Merged via the queue into develop with commit 62d31d0 May 13, 2024
106 of 111 checks passed
@DeividasK DeividasK deleted the keystone-validate-signers branch May 13, 2024 15:50
protoc-gen-go
protoc-gen-go-grpc

foundry-bin
Copy link
Contributor

Choose a reason for hiding this comment

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

These appear to have broken the nix shell for me:

error: builder for '/nix/store/g9g5kmnv6hs4bv0hgzf0jv9nnr4k0n3l-source.drv' failed with exit code 1;
       last 7 log lines:
       >
       > trying https://github.com/foundry-rs/foundry/releases/download/nightly-bfc6549f0d50fe31cd2fae875c2c7233db98bde9/foundry_nightly_darwin_amd64.tar.gz
       >   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
       >                                  Dload  Upload   Total   Spent    Left  Speed
       >   0     9    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
       > curl: (22) The requested URL returned error: 404
       > error: cannot download source from any mirror
       For full logs, run 'nix-store -l /nix/store/g9g5kmnv6hs4bv0hgzf0jv9nnr4k0n3l-source.drv'.
error: 1 dependencies of derivation '/nix/store/yvwz6v83vxqi2razmmdd4lrd0552fsf9-foundry-0.0.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/g4c68z4l24vpgcsgrhqkjx1ki7vb0ii2-nix-shell-env.drv' failed to build

https://github.com/foundry-rs/foundry/releases/tag/nightly-bfc6549f0d50fe31cd2fae875c2c7233db98bde9 does not exist. There is no tag for this so it can't download it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants