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

Release PRT smart contract artifacts #87

Open
guidanoli opened this issue Dec 6, 2024 · 4 comments
Open

Release PRT smart contract artifacts #87

guidanoli opened this issue Dec 6, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@guidanoli
Copy link
Contributor

Currently, regarding the PRT smart contracts, we provide the following artifacts:

  • The source code of all PRT smart contracts
  • A script that deploys a top tournament contract for a custom initial machine state hash
  • Unit tests for the PRT smart contracts

In addition to those, we would like to also provide:

  • The compilation artifacts of all PRT smart contracts
  • Deployment scripts for all shared PRT smart contracts
  • The deployment addresses of each shared PRT smart contract, per network

In order to provide these artifacts, we need to have a way to deploy smart contracts to different networks and have a way to distribute their addresses to other projects that might need them. Forge has support for Solidity scripts, which can do pretty much anything, but therefore don't have a defined deployment artifact format. Meanwhile, Hardhat Deploy has a defined format, and can be used to reutilize deployed contracts from other projects without redeployment.

To avoid friction with the Cartesi Rollups contracts, we can use Hardhat Deploy to deploy the PRT smart contracts and distribute their deployment artifacts. In order to do so, we will need to make prt/contracts an npm package, and add hardhat-deploy (among other packages) as dependencies. The deployment scripts will be written in TypeScript. The release process can be later made automatic through GitHub workflows. The npm package would have a structure similar to that of @cartesi/rollups.

Later, we can make the same thing for the PRT smart contracts for Cartesi Rollups. To do so, we can make the whole dave repo an npm workspace, with two packages (PRT "core", and PRT for Cartesi Rollups).

@guidanoli guidanoli added the enhancement New feature or request label Dec 6, 2024
@guidanoli guidanoli self-assigned this Dec 6, 2024
@miltonjonat
Copy link

@guidanoli can you clarify the difference between PRT "core" and PRT "for Cartesi Rollups"? Are these contracts today all under prt/contracts? The code under cartesi-rollups/contracts is Dave or PRT? (it says "DaveConsensus" so I was unsure)

@pedroargento
Copy link

Cant we release the deployment artifacts compressed as artifacts for the release just like we added for rollups-contracts? Then we can wait to see if other projects are demanding some specific package repository before adding a bunch of npm dependencies to our code base.

@guidanoli
Copy link
Contributor Author

@guidanoli can you clarify the difference between PRT "core" and PRT "for Cartesi Rollups"? Are these contracts today all under prt/contracts? The code under cartesi-rollups/contracts is Dave or PRT? (it says "DaveConsensus" so I was unsure)

So, I'm calling PRT "core" all the contracts under prt/contracts (which includes the tournament factories), and PRT "for Cartesi Rollups" all the contracts under cartesi-rollups/contracts (which includes the consensus contract that uses PRT "core" and implements the IConsensus interface from the Cartesi Rollups contracts codebase).

The question about whether cartesi-rollups/contracts is Dave or PRT is a great one. From what I've talked with @GCdePaula, the interface of the "core" arbitration contracts will not change from PRT to Dave. So, we can already call it DaveConsensus for PRT and stick to it once Dave is out. Or we could give it a different name to avoid confusion.

@guidanoli
Copy link
Contributor Author

guidanoli commented Dec 6, 2024

Cant we release the deployment artifacts compressed as artifacts for the release just like we added for rollups-contracts? Then we can wait to see if other projects are demanding some specific package repository before adding a bunch of npm dependencies to our code base.

We are currently distributing two different compressed artifacts for cartesi/rollups-contracts through GitHub Releases:

  • rollups-contracts-<version>-artifacts.tar.gz: Hardhat compilation artifacts
  • rollups-contracts-<version>-anvil-<foundry-tag>.tar.gz: Contract ABIs (generated by Hardhat) and post-deployment Anvil devnet state (generated by Hardhat script)

For either artifact, we need Hardhat, and therefore to set up a npm package under prt/contracts (and later another under cartesi-rollups/contracts). It doesn't have to be published to npmjs.org, but we need it to manage npm dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants