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

Mini v0 #14

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

Mini v0 #14

wants to merge 35 commits into from

Conversation

johnwhitton
Copy link
Collaborator

Version 0 work based on #13

@johnwhitton johnwhitton mentioned this pull request Sep 5, 2022
4 tasks
from: deployer,
proxy: {
owner: deployer,
proxyContract: 'EIP173Proxy',
Copy link
Owner

Choose a reason for hiding this comment

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

where is EIP173Proxy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a simple proxy used by hardhat-deploy. We have update this now to use ERC1967Proxy.sol which is UUPS compatible and is held under the deployments folder

}

console.log('operators:', JSON.stringify(initialOperators))
const deployedContract = await deploy('MiniWallet', {
Copy link
Owner

Choose a reason for hiding this comment

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

Where can we control and store deployed proxy address, storage address, and logic contract address?

console.log('MiniID Name : ', await miniID.name())
console.log('MiniID Symbol : ', await miniID.symbol())
// Mint test tokens
if (chainId !== '1666600000,') {
Copy link
Owner

Choose a reason for hiding this comment

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

extra ,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored approach and commit are here

let contractUri

console.log(`chainId: ${chainId}`)
if (chainId === '1666600000,') {
Copy link
Owner

Choose a reason for hiding this comment

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

same issue

Copy link
Owner

Choose a reason for hiding this comment

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

and no hard coding

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored approach and commit are here

console.log('Mini721 Symbol : ', await mini721.symbol())

// Mint test tokens
if (chainId !== '1666600000,') {
Copy link
Owner

Choose a reason for hiding this comment

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

same

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored approach and commit are here


const deployedMini721 = await deploy('Mini721', {
from: deployer,
gasLimit: 4000000,
Copy link
Owner

Choose a reason for hiding this comment

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

why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed 🙏
Was initially put in as was getting unexpected gas limit, but this was due to errors in deploy logic

let contractUri

console.log(`chainId: ${chainId}`)
if (chainId === '1666600000,') {
Copy link
Owner

@polymorpher polymorpher Sep 12, 2022

Choose a reason for hiding this comment

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

same issues

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored approach and commit are here

console.log('Mini1155 Symbol : ', await mini1155.symbol())

// Mint test tokens
if (chainId !== '1666600000,') {
Copy link
Owner

Choose a reason for hiding this comment

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

same issues

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored approach and commit are here

from: deployer,
proxy: {
owner: deployer,
proxyContract: 'EIP173Proxy'
Copy link
Owner

Choose a reason for hiding this comment

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

same issue here, not sure where eip173proxy is and whether it is safe and how it can be controlled

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a simple proxy used by hardhat-deploy. We have update this now to use ERC1967Proxy.sol which is UUPS compatible and is held under the deployments folder

@polymorpher
Copy link
Owner

Can you gitignore everything under /deployment? No auto-generated code or local-environment specific stuff should be checked in

@polymorpher
Copy link
Owner

Can all Mini1155 and 721 related deployment and testing stuff be removed? They are launch templates other developers may use, and have nothing to do with SMS Wallet features. The contract themselves may be moved to separate places as well

@polymorpher
Copy link
Owner

Can you move all work-in-progress and MiniID related items to separate PR? Let's make one thing perfectly good, solid for production, and as minimal as possible in code, before moving on to the next.

@polymorpher
Copy link
Owner

There is still the issue unresolved, related to recording proxy, logic, and storage addresses for those hardhat deployed contracts, and fine-control on these contract's upgrade process. We can't just use deploy or upgrade without knowing or controlling each and every step what it is doing. Are they using factories and create2? Using EOA and create op code? In some situations we also need to control the address which the contracts are deployed to. We need to know all these. In other situations when we upgrade the contracts, the storage slots may mess up because of storage layout issues, and we need to test ahead of time. We cannot do this without complete visibility and fine-control over the deploy and upgrade process

@@ -0,0 +1,489 @@
import { expect } from 'chai'
Copy link
Owner

Choose a reason for hiding this comment

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

Is there any way we can continue the review of these files in the other PR where they were originally reviewed? Several hours were spent reviewing the files, so it would be nice to continue from existing reviewing checkpoint, rather than starting from scratch

Copy link
Owner

Choose a reason for hiding this comment

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

I went through the code again this time. Let's keep reviewed PRs open in the future

})
}

export async function communityMint721 (testEnvironment, owner, numTokens) {
Copy link
Owner

Choose a reason for hiding this comment

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

is this needed?

@@ -0,0 +1,39 @@
import { ethers } from 'hardhat'

export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'
Copy link
Owner

@polymorpher polymorpher Sep 12, 2022

Choose a reason for hiding this comment

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

this is in server config, it can be moved to a constant in a single place

@polymorpher
Copy link
Owner

Let's also move development notes to miniwallet/devlog/ with a README stating they are development notes for internal discussions, not meant for documentation or guiding users or developers.

We can polish and move things out to component-root folder after they are ready for production and presentable for external audience

expect(await this.mini1155.balanceOf(owner, c1.s.tokenId)).to.equal(0)
expect((await this.mini1155.balanceOfBatch([owner, owner], [1, 2])).map(x => x.toString())).to.deep.equal(['0', '0'])
expect(await this.mini1155.baseUri()).to.equal('ipfs://QmPcY4yVQu4J2z3ztHWziWkoUEugpzdfftbGH8xD49DvRx/')
expect(await this.mini1155.contractURI()).to.equal('ipfs://QmdKB6d1zT7R8dNmEQzc6N1m5p2LDJZ66Hzu8F4fGhdVrq')
Copy link
Owner

Choose a reason for hiding this comment

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

these specific project urls all need to be sanitized and removed from tests and default config parameters

@polymorpher
Copy link
Owner

polymorpher commented Sep 12, 2022

I have two more files to read: NFTID.md and PROXY.md. I went through other files.

Let's break down this PR into multiple parts (each has its own PR):

  1. core mini-wallet (server, contract, tests) - these are ready for merge
  2. mini-wallet deployment and upgrade scripts - these needs some improvement on fine-control over deploy and upgrade process (most likely can't just use simple hardhat calls / plugins anymore) and storing (not just logging) the addresses of proxy, logic, and storage
  3. mini1155, 721, and related deployment scripts and tests - these need some sanitization and maybe some simplification on tests. They are pretty much ready for merge
  4. miniID related and other WIP stuff - these are incomplete
  5. documentations (NFTID.md, PROXY.md) - these need further review and some revision - I can also edit on the branch itself

The PRs can be made in chains (each PR's branch merge into the branch of previous PR) rather than all pointing to the base (main) branch, since each may be dependent on some of the work in previous PR

@polymorpher
Copy link
Owner

On a second thought - I think (2) can be merged in after using a better proxy, so we can get it up and running ASAP. We can improve this process in a later PR

let config
if (fs.existsSync(configPath)) {
configPath = configPath.substring(0, configPath.length - 3)
const { default: configNetwork } = await import(configPath)
Copy link
Owner

Choose a reason for hiding this comment

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

could be used to executed malicious script in temporary / mounted / remote folders

return res.status(StatusCodes.BAD_REQUEST).json({ error: `phone number not registered: ${phoneNumber}` })
}
}
console.log(`u: ${JSON.stringify(u)}`)
Copy link
Owner

Choose a reason for hiding this comment

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

need to remove - leaking user info in console

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed 🙏

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