3

Obviously, I shouldn't upload my private key or personal infura credentials to my repo, but I was wondering what was the best way to track main net truffle artifacts.

Generally speaking, for test nets I upload my test artifacts, would be a good idea to deploy to mainnet in a separate repo? What are the current best practises?

Edit The json file produced from running truffle migrate are what I am calling truffle artifacts.

  • Could you clarify meaning of artifact in your question? Is it truffle config? – Aquila Oct 16 '18 at 13:57
  • The json file produced from running truffle migrate. – GrandFleet Oct 16 '18 at 15:50
0

For our Truffle based projects we use the tool truffle-deploy-registry.

The library allows you to store your deployed contract addresses in a networks config file separately from the Truffle artifacts. You can commit the network configs to Git, and just re-generate the Truffle artifacts when you need to.

Full disclosure: I'm one of the authors of the library ;)

0

truffle migrate does couple of steps:

  1. compile - generates (non-specific for network) artifacts and put those in build directory
  2. deploy - takes artifacts and deploys to specific network

Would be a good idea to deploy to mainnet in a separate repo?

No. There are no differences in artifacts for different networks.

What are the current best practices?

Do not store artifacts at all. Artifact is result of project's building. Usually the process is automated (CI/CD). Artifact should be built in pipeline. Code coverage should be 100% and all tests should be green.

  • I disagree with building artifacts in pipeline because it costs eth to deploy contracts and tracking artifacts in the repo allows you to deploy/test previous versions of the smart contracts. It can be really annoying to deal with. And getting 100% code coverage does not indicate that the smart contract is secure. – GrandFleet Oct 16 '18 at 17:31
  • How often you re-deploy your contracts on mainnet? I think when you need to do, it starts smell, you simple loose trust if you change the contract permanently. truffle migrate is suitable for development, when you need to change contract often, but not on mainnet. – Aquila Oct 16 '18 at 17:44
  • I would rarely re-deploy contract, but oftentimes my smart contracts are in the same repo as the front-end, so it is kinda annoying to figure out how to only conditionally deploy smart contracts in a CI pipeline. – GrandFleet Oct 16 '18 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.