Skip to content

Commit 0b8c04e

Browse files
authored
Merge pull request #356 from OffchainLabs/develop
chore: merge develop with v3.1.1 to main
2 parents c32af12 + 6fa1575 commit 0b8c04e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+749
-2623
lines changed

.github/workflows/contract-tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
name: Test unit
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
with:
1919
submodules: recursive
2020

@@ -44,7 +44,7 @@ jobs:
4444
shell: bash
4545
steps:
4646
- name: Checkout
47-
uses: actions/checkout@v2
47+
uses: actions/checkout@v4
4848
with:
4949
submodules: recursive
5050

@@ -55,7 +55,7 @@ jobs:
5555
cache: false
5656

5757
- name: Setup nodejs
58-
uses: actions/setup-node@v2
58+
uses: actions/setup-node@v3
5959
with:
6060
node-version: '18'
6161
cache: 'yarn'
@@ -124,7 +124,7 @@ jobs:
124124
name: 4844 tests
125125
runs-on: ubuntu-latest
126126
steps:
127-
- uses: actions/checkout@v3
127+
- uses: actions/checkout@v4
128128
with:
129129
submodules: recursive
130130

@@ -140,7 +140,7 @@ jobs:
140140
no-token-bridge: true
141141

142142
- name: Setup nodejs
143-
uses: actions/setup-node@v2
143+
uses: actions/setup-node@v3
144144
with:
145145
node-version: 18
146146
cache: 'yarn'
@@ -159,7 +159,7 @@ jobs:
159159
name: Test e2e
160160
runs-on: ubuntu-latest
161161
steps:
162-
- uses: actions/checkout@v3
162+
- uses: actions/checkout@v4
163163
with:
164164
submodules: recursive
165165

@@ -191,7 +191,7 @@ jobs:
191191
name: Test e2e custom fee token
192192
runs-on: ubuntu-latest
193193
steps:
194-
- uses: actions/checkout@v3
194+
- uses: actions/checkout@v4
195195
with:
196196
submodules: recursive
197197

@@ -224,7 +224,7 @@ jobs:
224224
name: Test e2e fee token with 6 decimals and pricer
225225
runs-on: ubuntu-latest
226226
steps:
227-
- uses: actions/checkout@v3
227+
- uses: actions/checkout@v4
228228
with:
229229
submodules: recursive
230230

@@ -257,7 +257,7 @@ jobs:
257257
# name: BOLD upgrade test
258258
# runs-on: ubuntu-latest
259259
# steps:
260-
# - uses: actions/checkout@v3
260+
# - uses: actions/checkout@v4
261261
# with:
262262
# submodules: recursive
263263

.github/workflows/slither.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
with:
13+
submodules: recursive
1214

1315
- name: Run Slither
1416
uses: crytic/[email protected]

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "lib/forge-std"]
22
path = lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
4+
[submodule "src/precompiles"]
5+
path = src/precompiles
6+
url = https://github.com/OffchainLabs/nitro-precompile-interfaces.git

audit-ci.jsonc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
// Regular Expression Denial of Service (ReDoS) in cross-spawn
2828
"GHSA-3xgq-45jj-v275",
2929
// axios Requests Vulnerable To Possible SSRF and Credential Leakage via Absolute URL
30-
"GHSA-jr5f-v2jv-69x6"
30+
"GHSA-jr5f-v2jv-69x6",
31+
// Homograph attack allows Unicode lookalike characters to bypass validation
32+
"GHSA-xq7p-g2vc-g82p",
33+
// brace-expansion Regular Expression Denial of Service vulnerability
34+
"GHSA-v6h2-p8h4-qcjw"
3135
]
3236
}

hardhat.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,7 @@ module.exports = {
262262
contractSizer: {
263263
strict: true,
264264
},
265+
sourcify: {
266+
enabled: true,
267+
},
265268
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@arbitrum/nitro-contracts",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
55
"author": "Offchain Labs, Inc.",
66
"license": "BUSL-1.1",

scripts/boldUpgradeCommon.ts

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { BigNumber, providers } from 'ethers'
2-
import { parseEther } from 'ethers/lib/utils'
2+
import { isAddress, parseUnits } from 'ethers/lib/utils'
33
import fs from 'fs'
44

55
import { configs } from './files/configs'
6+
import { ERC20__factory } from '../build/types'
67

78
export interface DeployedContracts {
89
bridge: string
@@ -15,10 +16,6 @@ export interface DeployedContracts {
1516
challengeManager: string
1617
boldAction: string
1718
preImageHashLookup: string
18-
prover0: string
19-
proverMem: string
20-
proverMath: string
21-
proverHostIo: string
2219
osp: string
2320
}
2421

@@ -105,6 +102,7 @@ export const validateConfig = async (
105102
config: Config,
106103
l1Rpc: providers.Provider
107104
) => {
105+
// check all config.contracts
108106
if ((await l1Rpc.getCode(config.contracts.rollup)).length <= 2) {
109107
throw new Error('rollup address is not a contract')
110108
}
@@ -126,11 +124,17 @@ export const validateConfig = async (
126124
if ((await l1Rpc.getCode(config.contracts.upgradeExecutor)).length <= 2) {
127125
throw new Error('upgradeExecutor address is not a contract')
128126
}
127+
if (!isAddress(config.contracts.excessStakeReceiver)) {
128+
throw new Error('excessStakeReceiver is not a valid address')
129+
}
129130

130131
// check all the config.proxyAdmins exist
131132
if ((await l1Rpc.getCode(config.proxyAdmins.outbox)).length <= 2) {
132133
throw new Error('outbox proxy admin address is not a contract')
133134
}
135+
if ((await l1Rpc.getCode(config.proxyAdmins.inbox)).length <= 2) {
136+
throw new Error('inbox proxy admin address is not a contract')
137+
}
134138
if ((await l1Rpc.getCode(config.proxyAdmins.bridge)).length <= 2) {
135139
throw new Error('bridge proxy admin address is not a contract')
136140
}
@@ -142,18 +146,22 @@ export const validateConfig = async (
142146
}
143147

144148
// check all the settings exist
149+
// Note: `challengeGracePeriodBlocks` and `validatorAfkBlocks` can both be 0
145150
if (config.settings.confirmPeriodBlocks === 0) {
146151
throw new Error('confirmPeriodBlocks is 0')
147152
}
148-
if (config.settings.stakeToken.length === 0) {
149-
throw new Error('stakeToken address is empty')
153+
if (config.settings.challengePeriodBlocks === 0) {
154+
throw new Error('challengePeriodBlocks is 0')
150155
}
151156
if ((await l1Rpc.getCode(config.settings.stakeToken)).length <= 2) {
152157
throw new Error('stakeToken address is not a contract')
153158
}
154159
if (config.settings.chainId === 0) {
155160
throw new Error('chainId is 0')
156161
}
162+
if (config.settings.minimumAssertionPeriod === 0) {
163+
throw new Error('minimumAssertionPeriod is 0')
164+
}
157165
if (config.settings.blockLeafSize === 0) {
158166
throw new Error('blockLeafSize is 0')
159167
}
@@ -166,22 +174,45 @@ export const validateConfig = async (
166174
if (config.settings.numBigStepLevel === 0) {
167175
throw new Error('numBigStepLevel is 0')
168176
}
177+
if (config.settings.maxDataSize === 0) {
178+
throw new Error('maxDataSize is 0')
179+
}
169180

181+
// check stake token amount
170182
const stakeAmount = BigNumber.from(config.settings.stakeAmt)
171-
// check it's more than 1 eth
172-
if (stakeAmount.lt(parseEther('1'))) {
173-
throw new Error('stakeAmt is less than 1 eth')
183+
if (stakeAmount.eq(0)) {
184+
throw new Error('stakeAmt is 0')
174185
}
175-
const miniStakeAmounts = config.settings.miniStakeAmounts.map(BigNumber.from)
176186

187+
// check mini stakes
188+
const miniStakeAmounts = config.settings.miniStakeAmounts.map(BigNumber.from)
177189
if (miniStakeAmounts.length !== config.settings.numBigStepLevel + 2) {
178190
throw new Error('miniStakeAmts length is not numBigStepLevel + 2')
179191
}
180192

181-
if (
182-
!config.settings.disableValidatorWhitelist &&
183-
config.validators.length === 0
184-
) {
185-
throw new Error('no validators')
193+
// check validators and whitelist
194+
if (!config.settings.disableValidatorWhitelist) {
195+
if (config.validators.length === 0) {
196+
throw new Error('no validators')
197+
}
198+
199+
for (let i = 0; i < config.validators.length; i++) {
200+
if (!isAddress(config.validators[i])) {
201+
throw new Error(`Invalid address for validator ${i}`)
202+
}
203+
}
204+
}
205+
206+
// check delaybuffer settings
207+
if (config.settings.isDelayBufferable) {
208+
if (config.settings.bufferConfig.max === 0) {
209+
throw new Error('bufferConfig.max is 0')
210+
}
211+
if (config.settings.bufferConfig.threshold === 0) {
212+
throw new Error('bufferConfig.threshold is 0')
213+
}
214+
if (config.settings.bufferConfig.replenishRateInBasis === 0) {
215+
throw new Error('bufferConfig.replenishRateInBasis is 0')
216+
}
186217
}
187218
}

0 commit comments

Comments
 (0)