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

SNO-565: Make parachain relayers use Gateway contract #888

Merged
merged 16 commits into from
Jul 20, 2023

Conversation

doubledup
Copy link
Contributor

@doubledup doubledup commented Jul 18, 2023

Opening as a PR into Vincent's branch as I need those changes as a base.

Fixed the parachain build failures on the base branch in #889.

We don't have an extrinsic that sends messages yet, so can't fully test this yet. I've made sure that the relayer compiles and launches without crashing. The execution relayer still crashes on startup for comparison.

SNO-565

@doubledup doubledup requested review from vgeddes and yrong July 18, 2023 15:47
@doubledup doubledup self-assigned this Jul 18, 2023
@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.68 🎉

Comparison is base (d43b5ad) 66.33% compared to head (9500630) 67.02%.

❗ Current head 9500630 differs from pull request most recent head 8f25c46. Consider uploading reports for the commit 8f25c46 to get more accurate results

Additional details and impacted files
@@                 Coverage Diff                 @@
##           proxy-contracts     #888      +/-   ##
===================================================
+ Coverage            66.33%   67.02%   +0.68%     
===================================================
  Files                   43       42       -1     
  Lines                 1732     1592     -140     
  Branches                70       70              
===================================================
- Hits                  1149     1067      -82     
+ Misses                 564      506      -58     
  Partials                19       19              
Flag Coverage Δ
solidity 71.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 13 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -1,6 +1,5 @@
//go:generate bash -c "jq .abi ../../core/packages/contracts/out/OpaqueProof.sol/OpaqueProof.json | abigen --abi - --type OpaqueProof --pkg contracts --out opaque_proof.go"
//go:generate bash -c "jq .abi ../../core/packages/contracts/out/BeefyClient.sol/BeefyClient.json | abigen --abi - --type BeefyClient --pkg contracts --out beefy_client.go"
//go:generate bash -c "jq .abi ../../core/packages/contracts/out/InboundQueue.sol/InboundQueue.json | abigen --abi - --type InboundQueue --pkg contracts --out inbound_queue.go"
//go:generate bash -c "jq .abi ../../core/packages/contracts/out/OutboundQueue.sol/OutboundQueue.json | abigen --abi - --type OutboundQueue --pkg contracts --out outbound_queue.go"
//go:generate bash -c "jq .abi ../../core/packages/contracts/out/Gateway.sol/Gateway.json | abigen --abi - --type Gateway --pkg contracts --out gateway.go"
Copy link
Collaborator

@vgeddes vgeddes Jul 19, 2023

Choose a reason for hiding this comment

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

Actually, we should be generating bindings for contracts/src/interfaces/IGateway.sol.

This is how GatewayProxy.sol, Gateway.sol, and IGateway.sol all relate to each other:

  • GatewayProxy.sol: The contract at the "front of the house" that users interact with. This is the proxy contract.
  • Gateway.sol: GatewayProxy.sol forwards messages to this implementation or "logic" contract.
  • IGateway.sol: The public API exposed by the proxy & implementation contract.

When configuring the relayer, make sure to use the address of GatewayProxy.sol as the gateway's address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, will use the interface. We're using the proxy address here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've kept the name Gateway for the Go bindings, even though they're generated from the IGateway interface. Seems sensible as the interface is the only thing we'll use from the relayers.

relayer/contracts/generate.go Outdated Show resolved Hide resolved
relayer/relays/parachain/ethereum-writer.go Outdated Show resolved Hide resolved
@@ -9,17 +9,18 @@ type Config struct {
Sink SinkConfig `mapstructure:"sink"`
}

// TODO: check whether ChannelID should be uint32 (as in the parachain) or big.Int (uint256, as in the Gateway contract)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vgeddes How big are the channelIDs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Guess uint32 as ParaId should be enough. But remember Aidan mentioned last time we'll probably allow multiple channels for each Parachain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah right, we can expand the channel id on Polkadot to get multiple channels per parachain

@doubledup doubledup marked this pull request as ready for review July 19, 2023 18:35
Copy link
Contributor

@yrong yrong left a comment

Choose a reason for hiding this comment

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

LGTM!

@doubledup doubledup merged commit 4ca8d80 into proxy-contracts Jul 20, 2023
1 check passed
@doubledup doubledup deleted the david/sno-565 branch July 20, 2023 11:56
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.

3 participants