The older I get the more I learn I don’t know. This is my personal log of things I pick up each day.
How to write a commit message
How to sync your fork with the original repo
Learning Git
Pro Git book (open source):
https://git-scm.com/book/en/v2
I used to use SVN and am still learning how to use Git beyond the basics.
Multifile verification
Multifile verification on Etherscan is awesome and really straightforward with: https://github.com/nomiclabs/buidler/tree/development/packages/buidler-etherscan
OpenZeppelin Test Helpers in a Truffle console
I hadn’t tried this until a community member asked: Time manipulation in truffle console
$ npx truffle console
truffle(development)> const {time} = require('@openzeppelin/test-helpers');
undefined
truffle(development)> (await time.latest()).toString()
'1600151667'
truffle(development)> await time.increase(time.duration.minutes(2));
undefined
truffle(development)> await time.advanceBlock()
{ id: 1600151532744, jsonrpc: '2.0', result: '0x0' }
truffle(development)> (await time.latest()).toString()
'1600151892'
Crypto Trends
I have been writing Crypto Trends for nearly six months.
Writing is hard so it has been great to do this on a weekly basis.
https://forum.openzeppelin.com/tag/crypto-trends
Starting out
One of my friends is starting out in the space.
I recommended that they subscribe to Week in Ethereum News.
Read Crypto Trends.
Watch Webinar Series: Introduction to Backrunning.
Sign up for: EthOnline.
They should also play Ethernaut.
Read Audits: https://blog.openzeppelin.com/security-audits/
If they haven’t already, create a GitHub account (version control) and a Twitter account (for Crypto Twitter). Ideally with the same username and profile pic. My preference is that the username is based on your name and that the profile pic shows your face (even if it is stylized). I use @abcoathup everywhere (github.com/abcoathup, twitter.com/abcoathup and of course the forum.)
Anything else you would recommend?
Emoji
I using Emoji in social media posts.
I search for the best Emoji to use with emojipedia:
Job hunting
A friend is wanting to get into the space. I sent them the following wiki post I wrote:
PS OpenZeppelin are hiring: https://openzeppelin.com/jobs/
Internet
Pretty much everything I do in my role requires the internet.
Currently our 5G internet is down whilst they work on the mobile tower. Our mobile phones are with the same company, so we can’t use those either.
Normally I would go to a library or a cafe but Covid lockdown means they are all closed.
Instead I am using an old phone with a long life data sim on a separate (premium) network to keep the lights on.
Verification
I am really keen on multi-file verification. Flattening strips imports, strips license identifiers and is overall harder to read, identify and reproduce.
I have been using Builder Etherscan plugin but ran into the following issue:
For verification, until this is fixed I need to clean out any contracts and artifacts that I don’t want included in the verification.
Verification
Multi-file verification is coming to Truffle
Healthy Workstyle
One of the core values of OpenZeppelin is Healthy Workstyle:
We are conscious of our individual work styles and achieve our goals calmly, while enjoying the journey.
I just had a few days vacation and am very grateful for that.
(Melbourne is still in lockdown. Whilst we can only go out for 2 hours exercise a day within 5km of home, I still managed to swim in the sea a couple of times).
Thanks to @martriay for supporting the community whilst I was away.
P.S. OpenZeppelin are hiring:
asciinema
Sometimes a text based tutorial isn’t enough. This is where asciinema can step in.
Nicks method
How to deploy a contract with the same address on any chain (not using CREATE2)
Deployment Method
This contract is going to be deployed using the keyless deployment method—also known as Nick’s method—which relies on a single-use address. (See Nick’s article for more details). This method works as follows:
- Generate a transaction which deploys the contract from a new random account.
- This transaction MUST NOT use EIP-155 in order to work on any chain.
- This transaction MUST have a relatively high gas price to be deployed on any chain. In this case, it is going to be 100 Gwei.
- Set the
v
,r
,s
of the transaction signature to the following values:v: 27, r: 0x1820182018201820182018201820182018201820182018201820182018201820' s: 0x1820182018201820182018201820182018201820182018201820182018201820'
Those
r
ands
values—made of a repeating pattern of1820
’s—are predictable “random numbers” generated deterministically by a human.
3. We recover the sender of this transaction, i.e., the single-use deployment account.
Thus we obtain an account that can broadcast that transaction, but we also have the warranty that nobody knows the private key of that account.
- Send exactly 0.08 ether to this single-use deployment account.
- Broadcast the deployment transaction.
This operation can be done on any chain, guaranteeing that the contract address is always the same and nobody can use that address with a different contract.
Event naming
Events should be emitted immediately after the state change that they represent, and consequently they should be named in past tense.
From: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/GUIDELINES.md#solidity-code
Finding an email address
Including mine fortunately/unfortunately
Truffle Migrations don’t deploy new contract in testing
Setting overwrite: false
when calling deploy
in our migrations scripts means that we don’t deploy a new contract when testing.
See Truffle documentation for details: https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations#deployer-deploy-contract-args-options-
Discovered this in: Truffle Tests not being run against contract deployed to Ganache instead uses another contract address
Verification is still hard
To get the ABI encoded constructor/initialize we can use the following:
Hat tip @jeffthebaker
I struggled to verify a proxy, it was due to having OpenZeppelin Contracts 3.1 as a dependency rather than OpenZeppelin Contracts 3.2: Error verifying proxy with plugin @nomiclabs/hardhat-etherscan