-
Notifications
You must be signed in to change notification settings - Fork 4
feat(relayer): ccip provider and contract transmitter #81
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
Conversation
pkg/ccip/ocr/contract_transmitter.go
Outdated
| return fmt.Errorf("failed to generate ed25519 call data: %w", err) | ||
| } | ||
| } else { | ||
| return errors.New("no calldata function") |
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.
Add a constructor and check this there?
pkg/ccip/ocr/contract_transmitter.go
Outdated
| Mode: wallet.PayGasSeparately, | ||
| FromWallet: *c.fromWallet, | ||
| ContractAddress: *address.MustParseAddr(contract), | ||
| // Body: , fill me |
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.
I think the report will be encoded as BOC, we'll likely need to decode it, then pack it together with other args (signatures)
pkg/ccip/ocr/contract_transmitter.go
Outdated
| } | ||
| var sigBytes [96]byte | ||
| copy(sigBytes[:], sig) | ||
| signatures = append(signatures, sigBytes) |
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.
You you should construct types from the bindings, so the payload can be serialized: https://github.com/smartcontractkit/chainlink-ton/blob/main/pkg/ccip/bindings/plugin/commitreport.go
I think we're still missing the top level type for Commit/Execute that will hold report+signatures
37e39c6 to
8003f24
Compare
156bf07 to
f187dc0
Compare
8265c71 to
b780161
Compare
b780161 to
ba10142
Compare
| cp := &Provider{ | ||
| lggr: logger.Named(lggr, CCIPProviderName), | ||
| ct: ct, | ||
| } |
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.
nit: want to toss a TODO: implement in here for chain accessor ca?
| } | ||
|
|
||
| func NewCCIPProvider(lggr logger.Logger, txm txm.TxManager) (*Provider, error) { | ||
| ct, err := ocr.NewCCIPTransmitter(txm, lggr) |
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 still a little unclear to me how we're going to split between commit vs exec ToEd25519CalldataFunc if we're only creating one transmitter and we're not passing it in here or during Transmit(). 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.
I guess we can define some type inside of contract_transmitter.go to distinguish them? But we'd still need to set that somehow
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.
Probably we'll need to have ton_contract_transmitter_factory.go in https://github.com/smartcontractkit/chainlink/tree/develop/core/capabilities/ccip/ocrimpls ?
| FromWallet: w, | ||
| ContractAddress: *address.MustParseAddr(c.offrampAddress), | ||
| Body: body, | ||
| Amount: tlb.MustFromTON("0.05"), |
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.
Would we want to have an ability to configure this?
| } | ||
|
|
||
| func NewCCIPProvider(lggr logger.Logger, txm txm.TxManager) (*Provider, error) { | ||
| ct, err := ocr.NewCCIPTransmitter(txm, lggr) |
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.
Probably we'll need to have ton_contract_transmitter_factory.go in https://github.com/smartcontractkit/chainlink/tree/develop/core/capabilities/ccip/ocrimpls ?
| services.StateMachine | ||
| } | ||
|
|
||
| func NewCCIPProvider(lggr logger.Logger, txm txm.TxManager) (*Provider, 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.
iirc, do we also need to initialize TON accessor here as well?
| type ccipTransmitter struct { | ||
| txm txm.TxManager | ||
| offrampAddress string | ||
| toEd25519CalldataFn ToEd25519CalldataFunc |
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.
When is this 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.
Also why do we need this fn? Why don't we just configure the transmitter with the address and method, and encode input args ourselves as this is a TON-CCIP-specific transmitter?
NONEVM-2205
CCIPProvider and ContractTransmitter implementation