-
Notifications
You must be signed in to change notification settings - Fork 19
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
Custom message handler and decoders #489
Draft
iFrostizz
wants to merge
19
commits into
main
Choose a base branch
from
custom_message_handler
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iFrostizz
commented
Sep 23, 2024
return common.Hash{}, fmt.Errorf("failed to find replica for aggregator: %s", msg.aggregator) | ||
} | ||
subnetClient := destinationClient.Client().(subnetEthclient.Client) | ||
client := reflect.ValueOf(subnetClient).Elem().FieldByName("c").Interface().(ethclient.Client) |
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 looks a bit brittle but how can we do a gas estimation given a subnetevm client ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TBD
Why this should be merged
How this works
Add a new chainlink config parser with the keys:
aggregators-to-replicas
: Expects a key-value format in the form of0xaddress1...
here would be the address of a Chainlink price feed that emitsAnswerUpdated
and0xaddress2...
the contract that is supposed to support theimportEvent
function on the destination blockchain.max-filter-addresses
: Since potentially a lot of aggregators have to be filtered, this variable can be used to bound the maximum of addresses filtered in one iteration and will offload it to the next one. For instance, if you setmax-filter-addresses: 10
, you will never pass more than 10 addresses in one eth_filterLogs call.destination-blockchain-id
: Self explanatoryAdd a new
MessageDecoder
interfaceEvery message handler should be made of a message decoder (which conforms to the
MessageDecoder
interface) as well as the existingMessageHandler
.The
MessageDecoder
has the functionDecode
which takes in the block header and the ethclient and returns an array ofWarpMessageInfo
. It should be enough for most applications since even the logs are up to the implementer to fetch, they don't even have to useeth_filterLogs
.ChainlinkMessageHandler
that implementsMessageHandler
This was quite trivial given that the generation of the proof was already written at https://github.com/ava-labs/event-importer-poc/blob/7993818e0acabbc71d693fa66064235c750f144f/proofs/proof_utils.go. The rest is handed out by the decoder and parsed as a
ChainlinkMessage
.How this was tested
TBD
How is this documented
See "Extending the relayer" at https://docs.google.com/document/d/12MuoEeECCWr3jNgYAZJrSCXv3tkYoFKO_DLHPCLU2EE/edit?usp=sharing