relayer: use @beamer-bridge/deployments package#1804
Conversation
2817558 to
bd8f266
Compare
GabrielBuragev
left a comment
There was a problem hiding this comment.
Looks good. Happy to see we are eliminating the static contract address strings!
|
Can we also address this https://github.com/beamer-bridge/beamer/pull/1804/files#diff-c3b8b667ddcfc5e232f930bbbc100cced3368cad34183f87aa58d856122841b5R32 ? This line in the |
b6ac66c to
ecae5a4
Compare
|
@GabrielBuragev please re-review. I've changed the PR slightly. So instead of directly using the package where necessary, I kind of re-export the variables from it inside a single deployments file. This should make it easier to update if the structure of the abis/deployments changes again. Please also pay special attention to the modifications I've done to the ethereum file. |
manuelwedler
left a comment
There was a problem hiding this comment.
Just adding two things I noticed because I integrated the package into the frontend
relayer/package.json
Outdated
| "test:unit": "jest unit", | ||
| "test:coverage": "jest --collect-coverage", | ||
| "generate-types": "typechain --target=ethers-v5 ./src/assets/abi/**.json --out-dir=./types-gen/contracts/", | ||
| "generate-types": "typechain --target=ethers-v5 ./node_modules/@beamer-bridge/deployments/dist/abis/mainnet/**.json --out-dir=./types-gen/contracts/", |
There was a problem hiding this comment.
Is it really fine to just use the mainnet abis here? Couldn't there be the case when the goerli and mainnet versions diverge in one package and the relayer should be compatible with both?
There was a problem hiding this comment.
I am a little bit worried about this as well. This also means that we will not be able to integrate the relayer in our local e2e tests with the local ABIs.
I am trying to think of ways to avoid this. We could have a prepare or configure script for generating the contract types / ABIs based on a provided --path-to-deployments argument. So, before running the relayer, one would have to run this script (yarn process?) which will generate the types and dump them in the current types-gen/contracts folder.
Same goes for the build process.
With this in place, we could then easily apply your suggestion below:
The ABI can be easily accessed by FillManager__factory.abi. I think it is not necessary to reexport and would also be more consistent with how the contracts are used in the other places.
There was a problem hiding this comment.
The reason why i am proposing such a solution with an argument --path-to-deployments is because the e2e tests are storing the deployment artifacts outside of the project directory (temporary folders) which makes it trickier to automate this process by only using the @beamer-bridge/deployments package ..
There was a problem hiding this comment.
While trying this approach out, i figured out that we can even do this right now by passing --glob='...pathToAbis' when invoking the yarn generate-types script as this will effectively overwrite the --glob that is already defined in the generate-types yarn command.
This will enable us to specify different set of ABIs for the type generation process. If we follow this approach, then we have to adjust the code to only use the contract types & factories that are auto-generated by TypeChain (basically what you proposed below).
By default, the yarn generate-types will only use the mainnet ABIs. What do you guys think of this?
There was a problem hiding this comment.
Tested this out, but unfortunately it only extends the glob patterns instead of overwriting the argument value.
|
|
||
| export const parseFillInvalidatedEvent = (logs: Log[]): FillInvalidatedEventData | null => { | ||
| const iface = new Interface(FillManagerABI); | ||
| const iface = new Interface(abis.FillManager); |
There was a problem hiding this comment.
The ABI can be easily accessed by FillManager__factory.abi. I think it is not necessary to reexport and would also be more consistent with how the contracts are used in the other places.
ecae5a4 to
2188936
Compare
The abis and contract addresses are now taken out of the @beamer-bridge/deployments package. From now on, when we have a new deployment we need to update the package and then create a new build of the relayer.
b459360 to
8cddef7
Compare
Getting the right ABI versions@GabrielBuragev and me had a long session about the ABI versions and how to use the right one for each use case. The issue is that we used to just have one ABI version for the relayer that was changed by copy-paste whenever we needed to. Now we want to use the ABIs from the deployments package and the package provides separate versions for goerli and mainnet. I would like to split the issue into two separate layers where the ABIs come to effect:
Transactions / EventsThe relayer is build into one image with the agent. This image is supposed to run on any network a deployment configuration is provided for. This means the relayer needs to be bundled with both ABIs, goerli and mainnet, in order to ensure it works properly. This can be solved easily by dynamically choosing the correct ABI during runtime. For example like this: It might often be the case that we need to provide different ABIs than the ones from the package. For example, we have a new version of the contracts that has not been deployed yet (only locally) and we want to integrate this new version into the relayer. TypingWith the typing things get tricky now. There can always only be one version of the ABIs that is used for the typing. And the linting uses the typing, so the CI may fail if the relayer changes in a PR do not fit the ABI used for typing. A solution that still has its problems is the following: Whenever we change the contracts, we publish the new ABIs in a new folder inside the deployments package. The issue is now we tie the contracts ABI to one version of the deployments, because they are published in the same package. We lose flexibility by this. Different solutions we had in mind (didn't fully think through all of them):
|
|
Hey guys, Thanks for researching this and the summary! I do have some questions as I don't fully understand.
If we have a different version of the contracts we will have either a dev release or a new major release of the npm package. The relayer needs to be updated to use the new version of the abi package. Why do we need to provide a folder here? Why is typing a problem if we are updating the package used in the relayer? If we point the relayer to a new version, we adjust the types as needed? |
The npm package has two folders for the ABIs: goerli and mainnet. Where would the version of the ABIs we need be located? Or are both the same? The question of the typing also arises by these two folders. Which one should be used for typing? At the moment we don't have different releases of the relayer for mainnet / goerli btw. Also see my questions from which this discussion originated from: #1804 (comment) |
93aa1c1 to
1ec78d7
Compare
|
@compojoom @GabrielBuragev @manuelwedler what's the state of this? |
|
We decided the following in our last meeting: Due to priorities this wasn't finished yet. |
The abis and contract addresses are now taken out of the @beamer-bridge/deployments package.