-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[CCIP-5233] CCIP: price-only commit report method override. #16422
Conversation
I see you updated files related to
|
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
22d4b5b
to
6dc66cf
Compare
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.
Validated on the e2e testing branch
@@ -23,54 +23,63 @@ type ToCalldataFunc func( | |||
report ocr3types.ReportWithInfo[[]byte], | |||
rs, ss [][32]byte, | |||
vs [32]byte, | |||
) (any, error) | |||
) (string, string, any, error) |
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.
Lets add names to the return vars to self-document
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.
we can return a struct instead
) (any, error) | ||
) (string, string, any, error) | ||
|
||
func NewToCommitCalldata(defaultMethod, priceOnlyMethod string) ToCalldataFunc { |
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.
Godoc on this would be good to have, to explain its existence vs. lack of one for exec.
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.
Also NewToCommitCalldataFunc
seems to be a better name given the ret val
if err != nil { | ||
return nil, err | ||
method := defaultMethod | ||
if len(priceOnlyMethod) > 0 && len(info.MerkleRoots) == 0 && len(info.TokenPrices) > 0 { |
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.
Doing len(string)
seems awkward/non-idiomatic, I feel like priceOnlyMethod != ""
reads better.
Also, if we always require a merkle root then shouldn't len(info.MerkleRoots) == 1
? cc @archseer
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.
Just making a note that you can't tweak this array here since it'll fail the sig check onchain, this has to come from the plugin.
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.
Presumably it's invalid to have a report where len(info.MerkleRoots) == 0 && len(info.TokenPrices) == 0
.
onchain method | HasRoot(s) | HasPrices |
---|---|---|
commit | true | true |
commit | true | false |
price_only_commit | false | true |
N/A | false | false |
I think the report codec should be responsible for detect if the report was invalid not the transmitter. So I'm proposing this code ignores the N/A case above.
if err := c.cw.SubmitTransaction(ctx, c.contractName, c.method, args, fmt.Sprintf("%s-%s-%s", c.contractName, c.offrampAddress, txID.String()), c.offrampAddress, &meta, zero); err != nil { | ||
if err := c.cw.SubmitTransaction(ctx, contract, method, args, fmt.Sprintf("%s-%s-%s", contract, c.offrampAddress, txID.String()), c.offrampAddress, &meta, zero); err != nil { |
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.
Can't comment on the line in this PR but there is still some evm-specific signature splitting above (evmutil.SplitSignature) that may not work for Solana.
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.
ah, damn. Thanks for pointing that out.
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.
On further investigation, evmutil.SplitSignature
is just poorly named. It should be named ecdsautil.SplitSignature
. It's unlikely that we'd use a different signature for OCR reports, so this is not something that would change now or in the future.
@@ -316,7 +317,7 @@ func newTestUniverse(t *testing.T, ks *keyringsAndSigners[[]byte]) *testUniverse | |||
contractName, | |||
methodTransmitWithSignatures, | |||
ocr3HelperAddr.Hex(), | |||
ocrimpls.ToCommitCalldata, | |||
ocrimpls.NewToCommitCalldata(consts.MethodCommit, ""), |
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.
Can we have a test for the Solana transmission?
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.
The Solana e2e test would cover this. I'm not sure how a unit test would work.
// PriceOnlyCommitFn optional method override for price only commit reports. | ||
PriceOnlyCommitFn string |
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.
Where/how would this get set?
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.
It's set a few lines above. Hard coded for the Solana chain family.
@makramkd @dimkouv created a ticket for future refactoring: |
926456a
to
9c75cee
Compare
9c75cee
to
7182d62
Compare
Can you merge in latest develop so the in-memory tests can run as well? There was a hiccup recently #16586 |
|
Adds option to override the commit method for price-only commit reports.
Implemented by extending the
ToExecCalldata
handler to return the contract/method in addition to the args object.