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

feat: add table creator script contract #287

Merged
merged 5 commits into from
Oct 9, 2024
Merged

Conversation

andreivladbrg
Copy link
Member

@andreivladbrg andreivladbrg commented Oct 4, 2024

Similar to: sablier-labs/v2-core#1049

I couldn't find a better name for the contract, so I named it TableCreator (if you better suggestions lmk). I also didn’t think it was appropriate to include all the logic in the Base_Script contract.

Other changes

build: add more chains in foundry toml
build: add etherscan config

build: add more chains in foundry toml
build: add etherscan config
Copy link
Member

@smol-ninja smol-ninja left a comment

Choose a reason for hiding this comment

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

Question:

  1. What do we do when chain details are not found in these tables? Do we re-deploy the contracts by adding these chain details such as explorer and chain name or let it go like that? IMO we should revert the deployment.

  2. Have you tested these scripts? I think admin addresses are not being populated anywhere. Thus, not sure if it would work as expected.

script/Base.s.sol Outdated Show resolved Hide resolved
script/Base.s.sol Outdated Show resolved Hide resolved
script/TableCreator.s.sol Outdated Show resolved Hide resolved
script/TableCreator.s.sol Outdated Show resolved Hide resolved
script/Base.s.sol Outdated Show resolved Hide resolved
script/TableCreator.s.sol Outdated Show resolved Hide resolved
script/TableCreator.s.sol Outdated Show resolved Hide resolved
script/Base.s.sol Outdated Show resolved Hide resolved
script/TableCreator.s.sol Outdated Show resolved Hide resolved
script/TableCreator.s.sol Outdated Show resolved Hide resolved
@andreivladbrg
Copy link
Member Author

andreivladbrg commented Oct 8, 2024

What do we do when chain details are not found in these tables? Do we re-deploy the contracts by adding these chain details such as explorer and chain name or let it go like that? IMO we should revert the deployment.

i am not sure i understand completely what you mean? if the chain is not found, it will use the DEFAUL DEPLOYER as the admin and then on the table, it would simply print the chain Id (number) and with the missing explorer. why would you want to revert? it would still log the relevant informations in the terminal

2. Have you tested these scripts?

yes, i have, running the CLI forge script script/DeployFlow.s.sol --rpc-url sepolia it creates the file not-deterministic.md:

## Sepolia

| Contract          | Address                                                                                                                       | Deployment                                                          |
| :---------------- | :---------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------ |
| SablierFlow       | [0x83dd52fca44e069020b58155b761a590f12b59d3](https://sepolia.etherscan.io/address/0x83dd52fca44e069020b58155b761a590f12b59d3) | [v1.0.0](https://github.com/sablier-labs/v2-deployments/tree/main/) |
| FlowNFTDescriptor | [0x8224eb5d7d76b2d7df43b868d875e79b11500ea8](https://sepolia.etherscan.io/address/0x8224eb5d7d76b2d7df43b868d875e79b11500ea8) | [v1.0.0](https://github.com/sablier-labs/v2-deployments/tree/main/) |

and if you simply run it multiple times, the previous deployment won't be delated


i have pushed a new commit to address your feedback, lmk if it looks good

@smol-ninja
Copy link
Member

There should be deployments/ folder as as a part of this PR. Otherwise the forge script script/DeployFlow.s.sol throws execution reverted: vm.writeLine: No such file or directory (os error 2) (gas: 3111719)

I suppose an empty folder won't be allowed by the git. In that case, we should document is in the contributing guideline or readme. Any other ideas?

Copy link
Member

@smol-ninja smol-ninja left a comment

Choose a reason for hiding this comment

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

Last suggestions. Then all good.

script/Base.s.sol Outdated Show resolved Hide resolved
script/Base.s.sol Outdated Show resolved Hide resolved
script/DeployDeterministicFlow.s.sol Show resolved Hide resolved
script/DeploymentLogger.s.sol Show resolved Hide resolved
@smol-ninja
Copy link
Member

There should be deployments/ folder as as a part of this PR. Otherwise the forge script script/DeployFlow.s.sol throws execution reverted: vm.writeLine: No such file or directory (os error 2) (gas: 3111719)
I suppose an empty folder won't be allowed by the git. In that case, we should document is in the contributing guideline or readme. Any other ideas?

Regarding this, how about putting these markdown files in the script folder itself and add them into gitignore.

@andreivladbrg
Copy link
Member Author

andreivladbrg commented Oct 9, 2024

There should be deployments/ folder as as a part of this PR. Otherwise the forge script script/DeployFlow.s.sol throws execution reverted: vm.writeLine: No such file or directory (os error 2) (gas: 3111719)

my bad, should have also mentioned in this PR as well, please see the OP in the lockup repo: sablier-labs/v2-core#1049 (comment)

also the natspec in the contract should say this

Regarding this, how about putting these markdown files in the script folder itself and add them into gitignore

hmm, what if we use appendToFileDeployedAddresses only on the run() script functions, which is meant to be executed by us (sablier team) which should know that deploying a contract means we should update the documentation as well with the new contracts and the it requires a specific table format. wdyt?

@smol-ninja
Copy link
Member

what if we use appendToFileDeployedAddresses only on the run() script functions

Works both ways to me (you can decide). But even if its meant to be executed by us, given that its a public repo, any information required to run any command (such as forge script) should be a part of the contributing guidelines. Else a user jump into our discord and ask that why this particular command not working and we end up answering that he needs to create deployments folder first.

which is meant to be executed by us (sablier team) which should know that deploying a contract means we should update the documentation as well with the new contracts and the it requires a specific table format

Secondly, even if we expect ourselves to be aware of these things, we should also document it for future reference or external developer.

@andreivladbrg andreivladbrg force-pushed the feat/deployement-table branch from 3c37a8e to d39ac75 Compare October 9, 2024 13:22
@andreivladbrg
Copy link
Member Author

andreivladbrg commented Oct 9, 2024

fair enough, let's move them into scripts dir

a18a624

@andreivladbrg
Copy link
Member Author

i have addressed eveything now, thanks for the feedback

does it look good to be merged? @smol-ninja

Copy link
Member

@smol-ninja smol-ninja left a comment

Choose a reason for hiding this comment

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

Removed deployments from .gitignore: 27a845c

@andreivladbrg andreivladbrg merged commit fbf6ff5 into main Oct 9, 2024
7 checks passed
@andreivladbrg andreivladbrg deleted the feat/deployement-table branch October 9, 2024 14:57
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.

2 participants