-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[KS-182] keystone: Refactor write_capability + add ChainWriter #13259
Conversation
archseer
commented
May 20, 2024
•
edited
Loading
edited
- Use chainwriter
- Move evm specific init under the evm relayer
- Check if report already delivered via chainreader
573aaf0
to
7c17dc2
Compare
cr.Bind(ctx, []commontypes.BoundContract{{ | ||
Address: config.ForwarderAddress().String(), | ||
Name: "forwarder", | ||
// Pending: false, // ??? |
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.
@nolag I couldn't find any documentation on what this flag does
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.
If you are reading a contract method it doesn't really do anything.
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.
If you are reading a log event it translated to confirmations Finalized/Unfinalized, will be changed soon to make more sense
117a932
to
7546304
Compare
7546304
to
1a66e05
Compare
1a66e05
to
bf6d0ee
Compare
bf6d0ee
to
86ed2b2
Compare
…tegy Move chain writer send strategy to be config driven
0668ae4
to
17b34f1
Compare
Quality Gate passedIssues Measures |
// SignalCallback: true, TODO: add code that checks if a workflow id is present, if so, route callback to chainwriter rather than pipeline | ||
} | ||
tx, err := txm.CreateTransaction(ctx, req) | ||
txID, err := uuid.NewUUID() // TODO(archseer): it seems odd that CW expects us to generate an ID, rather than return one |
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.
This TODO is not really actionable, I'd remove it.
if err != nil { | ||
// Check whether value was already transmitted on chain | ||
queryInputs := struct { | ||
Receiver 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.
You might need to add ReportID here but let's merge this PR first and then handle new meta fields separately.
txm := cap.chain.TxManager() | ||
func success() <-chan capabilities.CapabilityResponse { | ||
callback := make(chan capabilities.CapabilityResponse) | ||
go func() { |
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 can create a channel with size 1 and avoid this goroutine.
func success() <-chan capabilities.CapabilityResponse { | ||
callback := make(chan capabilities.CapabilityResponse) | ||
go func() { | ||
callback <- capabilities.CapabilityResponse{} |
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.
Don't we want to put some info in the response? For example whether we attempted transmission or not. Maybe not important atm but let's consider it in the future.
_, cancel := context.WithTimeout(context.Background(), time.Second) | ||
defer cancel() | ||
|
||
// TODO(nickcorin): Add shutdown steps here. |
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.
are there any?
} | ||
|
||
// Initialize write target capability if configuration is defined | ||
if chain.Config().EVM().ChainWriter().ForwarderAddress() != 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.
We should probably rename this to "KeystoneForwarderAddress" to not be confused with Operator Forwarders.
} | ||
cw := NewChainWriterService(lggr.Named("ChainWriter"), chain.Client(), chain.TxManager(), chainWriterConfig) | ||
|
||
return targets.NewWriteTarget(lggr, name, cr, cw, config.ForwarderAddress().String()), 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 we avoid having two objects with the same name "WriteTarget"?
ChainSpecificName: "report", | ||
Checker: "simulate", | ||
FromAddress: config.FromAddress().Address(), | ||
GasLimit: 200_000, |
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.
This should be in TOML config (separate PR)