Skip to content

Commit

Permalink
Merge branch 'g-handle-decimals' into e2e-decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
gzeoneth authored Jul 3, 2024
2 parents 0f4d8f3 + 870566d commit 34751a7
Show file tree
Hide file tree
Showing 28 changed files with 645 additions and 13,340 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: '18'
node-version: 18
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ jobs:
- uses: actions/checkout@v4

- name: Run Slither
uses: crytic/slither-action@v0.3.1
uses: crytic/slither-action@v0.4.0
id: slither
with:
sarif: results.sarif
fail-on: medium
slither-args: --skip-assembly

- name: Upload SARIF file
if: always()
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ src/lib/abi/**
.nyc_output
out/**
lib/**
src/mocks/MultiCallTest.sol
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ yarn build

## License

Nitro is currently licensed under a [Business Source License](./LICENSE), similar to our friends at Uniswap and Aave, with an "Additional Use Grant" to ensure that everyone can have full comfort using and running nodes on all public Arbitrum chains.
Nitro is currently licensed under a [Business Source License](./LICENSE.md), similar to our friends at Uniswap and Aave, with an "Additional Use Grant" to ensure that everyone can have full comfort using and running nodes on all public Arbitrum chains.

The Additional Use Grant also permits the deployment of the Nitro software, in a permissionless fashion and without cost, as a new blockchain provided that the chain settles to either Arbitrum One or Arbitrum Nova.

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"deploy-factory": "hardhat run scripts/deployment.ts",
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts",
"create-rollup-testnode": "hardhat run scripts/local-deployment/deployCreatorAndCreateRollup.ts"
"create-rollup-testnode": "hardhat run scripts/local-deployment/deployCreatorAndCreateRollup.ts",
"deploy-cachemanager-testnode": "hardhat run scripts/local-deployment/deployCacheManager.ts"
},
"dependencies": {
"@offchainlabs/upgrade-executor": "1.1.0-beta.0",
Expand All @@ -53,7 +54,7 @@
},
"private": false,
"devDependencies": {
"@arbitrum/sdk": "^3.1.3",
"@arbitrum/sdk": "^3.4.1",
"@ethersproject/providers": "^5.7.2",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
Expand Down
53 changes: 51 additions & 2 deletions scripts/deploymentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import {
bytecode as UpgradeExecutorBytecode,
} from '@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json'
import { Toolkit4844 } from '../test/contract/toolkit4844'
import { ArbSys__factory } from '../build/types'
import { ARB_SYS_ADDRESS } from '@arbitrum/sdk/dist/lib/dataEntities/constants'
import {
ArbOwner__factory,
ArbSys__factory,
CacheManager__factory,
} from '../build/types'

const INIT_CACHE_SIZE = 536870912
const INIT_DECAY = 10322197911
const ARB_OWNER_ADDRESS = '0x0000000000000000000000000000000000000070'
const ARB_SYS_ADDRESS = '0x0000000000000000000000000000000000000064'

// Define a verification function
export async function verifyContract(
Expand Down Expand Up @@ -236,6 +244,47 @@ export async function deployAllContracts(
}
}

export async function deployAndSetCacheManager(
chainOwnerWallet: any,
verify: boolean = true
) {
const cacheManagerLogic = await deployContract(
'CacheManager',
chainOwnerWallet,
[],
verify
)

const proxyAdmin = await deployContract(
'ProxyAdmin',
chainOwnerWallet,
[],
verify
)

const cacheManagerProxy = await deployContract(
'TransparentUpgradeableProxy',
chainOwnerWallet,
[cacheManagerLogic.address, proxyAdmin.address, '0x'],
verify
)

const cacheManager = CacheManager__factory.connect(
cacheManagerProxy.address,
chainOwnerWallet
)

await (await cacheManager.initialize(INIT_CACHE_SIZE, INIT_DECAY)).wait()

const arbOwner = ArbOwner__factory.connect(
ARB_OWNER_ADDRESS,
chainOwnerWallet
)
await (await arbOwner.addWasmCacheManager(cacheManagerProxy.address)).wait()

return cacheManagerProxy
}

// Check if we're deploying to an Arbitrum chain
export async function _isRunningOnArbitrum(signer: any): Promise<boolean> {
const arbSys = ArbSys__factory.connect(ARB_SYS_ADDRESS, signer)
Expand Down
32 changes: 32 additions & 0 deletions scripts/local-deployment/deployCacheManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ethers } from 'hardhat'
import '@nomiclabs/hardhat-ethers'
import { deployAndSetCacheManager } from '../deploymentUtils'

async function main() {
/// read env vars needed for deployment
let chainOwnerPrivKey = process.env.CHAIN_OWNER_PRIVKEY as string
if (!chainOwnerPrivKey) {
throw new Error('CHAIN_OWNER_PRIVKEY not set')
}

const childChainRpc = process.env.CHILD_CHAIN_RPC as string
if (!childChainRpc) {
throw new Error('CHILD_CHAIN_RPC not set')
}

const chainOwnerWallet = new ethers.Wallet(
chainOwnerPrivKey,
new ethers.providers.JsonRpcProvider(childChainRpc)
)

// deploy cache manager
const cacheManager = await deployAndSetCacheManager(chainOwnerWallet, false)
console.log('Cache manager deployed at:', cacheManager.address)
}

main()
.then(() => process.exit(0))
.catch((error: Error) => {
console.error(error)
process.exit(1)
})
5 changes: 3 additions & 2 deletions scripts/testSetup.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { JsonRpcProvider } from '@ethersproject/providers'
import { L1Network, L2Network } from '@arbitrum/sdk'
import { execSync } from 'child_process'
import { Bridge__factory } from '@arbitrum/sdk/dist/lib/abi/factories/Bridge__factory'
import { RollupAdminLogic__factory } from '@arbitrum/sdk/dist/lib/abi/factories/RollupAdminLogic__factory'
import { Bridge__factory, RollupAdminLogic__factory } from '../build/types'

export function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms))
Expand Down Expand Up @@ -77,6 +76,8 @@ export const getLocalNetworks = async (
isCustom: true,
name: 'ArbLocal',
partnerChainID: l1NetworkInfo.chainId,
partnerChainIDs: [],
blockTime: 1,
retryableLifetimeSeconds: 7 * 24 * 60 * 60,
nitroGenesisBlock: 0,
nitroGenesisL1Block: 0,
Expand Down
Loading

0 comments on commit 34751a7

Please sign in to comment.