@arbitrum/nitro-contracts 1.0.0-beta.1 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/package.json +12 -8
- package/src/bridge/IInbox.sol +9 -0
- package/src/bridge/Inbox.sol +19 -39
- package/src/libraries/AdminFallbackProxy.sol +5 -5
- package/src/libraries/MessageTypes.sol +1 -0
- package/src/mocks/InboxStub.sol +4 -0
- package/src/mocks/Simple.sol +30 -0
- package/src/node-interface/NodeInterface.sol +18 -1
- package/src/node-interface/NodeInterfaceDebug.sol +30 -0
- package/src/osp/OneStepProver0.sol +14 -0
- package/src/osp/OneStepProverMath.sol +2 -2
- package/src/precompiles/ArbOwner.sol +3 -0
- package/src/rollup/IRollupCore.sol +26 -2
- package/src/rollup/IRollupEventBridge.sol +17 -0
- package/src/rollup/IRollupLogic.sol +34 -2
- package/src/rollup/RollupCore.sol +2 -2
- package/src/rollup/RollupCreator.sol +5 -15
- package/src/rollup/RollupEventBridge.sol +2 -3
- package/src/rollup/RollupLib.sol +2 -2
- package/src/rollup/RollupUserLogic.sol +7 -3
- package/src/rollup/ValidatorUtils.sol +0 -1
- package/src/rollup/ValidatorWallet.sol +0 -1
- package/src/state/Instructions.sol +2 -0
- package/.prettierrc +0 -5
- package/.solhint.json +0 -18
- package/deploy/BridgeStubCreator.js +0 -10
- package/deploy/HashProofHelper.js +0 -13
- package/deploy/InboxStubCreator.js +0 -17
- package/deploy/OneStepProofEntryCreator.js +0 -19
- package/deploy/OneStepProver0Creator.js +0 -14
- package/deploy/OneStepProverHostIoCreator.js +0 -14
- package/deploy/OneStepProverMathCreator.js +0 -14
- package/deploy/OneStepProverMemoryCreator.js +0 -14
- package/deploy/SequencerInboxStubCreator.js +0 -13
- package/deploy/ValueArrayTesterCreator.js +0 -13
- package/hardhat.config.ts +0 -47
- package/src/mocks/Counter.sol +0 -13
- package/test/contract/arbRollup.spec.ts +0 -869
- package/test/contract/common/challengeLib.ts +0 -43
- package/test/contract/common/globalStateLib.ts +0 -17
- package/test/contract/common/rolluplib.ts +0 -259
- package/test/contract/cryptographyPrimitives.spec.ts +0 -82
- package/test/contract/sequencerInboxForceInclude.spec.ts +0 -516
- package/test/contract/utils.ts +0 -40
- package/test/prover/hash-proofs.ts +0 -75
- package/test/prover/one-step-proof.ts +0 -93
- package/test/prover/proofs/.gitkeep +0 -0
- package/test/prover/value-arrays.ts +0 -11
- package/tsconfig.json +0 -13
@@ -1,93 +0,0 @@
|
|
1
|
-
import { ethers, run, getNamedAccounts } from "hardhat"
|
2
|
-
import fs from "fs";
|
3
|
-
import assert from "assert";
|
4
|
-
import readline from 'readline';
|
5
|
-
|
6
|
-
const PARALLEL = 128;
|
7
|
-
|
8
|
-
async function sendTestMessages() {
|
9
|
-
const { deployer } = await getNamedAccounts();
|
10
|
-
const inbox = await ethers.getContract("InboxStub", deployer);
|
11
|
-
const seqInbox = await ethers.getContract("SequencerInboxStub", deployer);
|
12
|
-
const msgRoot = "../arbitrator/prover/test-cases/rust/data/";
|
13
|
-
const gasOpts = { gasLimit: ethers.utils.hexlify(250000), gasPrice: ethers.utils.parseUnits('5', "gwei") };
|
14
|
-
for (let msgNum = 0; msgNum < 2; msgNum++) {
|
15
|
-
const path = msgRoot + "msg" + String(msgNum) + ".bin";
|
16
|
-
const buf = fs.readFileSync(path);
|
17
|
-
await inbox.sendL2MessageFromOrigin(buf, gasOpts);
|
18
|
-
await seqInbox.addSequencerL2BatchFromOrigin(msgNum, buf, 0, ethers.constants.AddressZero, gasOpts);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
describe("OneStepProof", function () {
|
23
|
-
const root = "./test/prover/proofs/";
|
24
|
-
const dir = fs.readdirSync(root);
|
25
|
-
|
26
|
-
before(async function () {
|
27
|
-
await run("deploy", { "tags": "OneStepProofEntry" });
|
28
|
-
await run("deploy", { "tags": "SequencerInboxStub" });
|
29
|
-
await run("deploy", { "tags": "InboxStub" });
|
30
|
-
await sendTestMessages();
|
31
|
-
})
|
32
|
-
|
33
|
-
it("should deploy test harness", function() {})
|
34
|
-
|
35
|
-
for (let file of dir) {
|
36
|
-
if (!file.endsWith(".json")) continue;
|
37
|
-
it("Should pass " + file + " proofs", async function () {
|
38
|
-
let path = root + file;
|
39
|
-
let proofs = JSON.parse(fs.readFileSync(path).toString('utf8'));
|
40
|
-
const osp = await ethers.getContract("OneStepProofEntry");
|
41
|
-
const seqInbox = await ethers.getContract("SequencerInboxStub");
|
42
|
-
const bridge = await ethers.getContract("BridgeStub");
|
43
|
-
|
44
|
-
const promises = [];
|
45
|
-
const isdone = [];
|
46
|
-
for (let i = 0; i < proofs.length; i++) {
|
47
|
-
process.stdout.write("\rTesting " + file + " proof " + i + "/" + proofs.length + " ");
|
48
|
-
const proof = proofs[i];
|
49
|
-
isdone.push(false);
|
50
|
-
const inboxLimit = 1000000;
|
51
|
-
const promise = osp.proveOneStep([inboxLimit, seqInbox.address, bridge.address], i, [...Buffer.from(proof.before, "hex")], [...Buffer.from(proof.proof, "hex")])
|
52
|
-
.catch((err: any) => {
|
53
|
-
console.error("Error executing proof " + i);
|
54
|
-
throw err;
|
55
|
-
})
|
56
|
-
.then((after: any) => assert.equal(after, "0x" + proof.after, "After state doesn't match after proof " + i))
|
57
|
-
.finally((_: any) => {isdone[i] = true});
|
58
|
-
if (promises.length < PARALLEL) {
|
59
|
-
promises.push(promise);
|
60
|
-
} else {
|
61
|
-
const finished: any = await Promise.race(promises.map((p, k) => p.then((_: any) => k)));
|
62
|
-
promises[finished] = promise;
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
let stillWaiting = []
|
67
|
-
do {
|
68
|
-
const finished: any = await Promise.race(promises.map((p, k) => p.then((_: any) => k)));
|
69
|
-
if (finished == promises.length - 1) {
|
70
|
-
promises.pop()
|
71
|
-
} else {
|
72
|
-
promises[finished] = promises.pop()
|
73
|
-
}
|
74
|
-
stillWaiting = [];
|
75
|
-
for (let i = 0; i < isdone.length; i++) {
|
76
|
-
if (!isdone[i]) {
|
77
|
-
stillWaiting.push(i)
|
78
|
-
}
|
79
|
-
}
|
80
|
-
readline.clearLine(process.stdout, 0);
|
81
|
-
process.stdout.write("\rTesting " + file + " Waiting for: " + String(stillWaiting.length) + "/" + String(isdone.length));
|
82
|
-
if (stillWaiting.length < 10) {
|
83
|
-
process.stdout.write(": ")
|
84
|
-
for (let i = 0; i < stillWaiting.length; i++) {
|
85
|
-
process.stdout.write(String(stillWaiting[i]) + ",");
|
86
|
-
}
|
87
|
-
}
|
88
|
-
} while (stillWaiting.length > 0);
|
89
|
-
await Promise.all(promises);
|
90
|
-
process.stdout.write("\r");
|
91
|
-
});
|
92
|
-
}
|
93
|
-
});
|
File without changes
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { ethers, run } from "hardhat";
|
2
|
-
|
3
|
-
describe("ValueArray", function () {
|
4
|
-
it("Should pass ValueArrayTester", async function () {
|
5
|
-
await run("deploy", { tags: "ValueArrayTester" });
|
6
|
-
|
7
|
-
const valueArrayTester = await ethers.getContract("ValueArrayTester");
|
8
|
-
|
9
|
-
await valueArrayTester.test();
|
10
|
-
});
|
11
|
-
});
|
package/tsconfig.json
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"target": "es2018",
|
4
|
-
"module": "commonjs",
|
5
|
-
"strict": true,
|
6
|
-
"esModuleInterop": true,
|
7
|
-
"outDir": "dist",
|
8
|
-
"resolveJsonModule": true,
|
9
|
-
"allowJs": true
|
10
|
-
},
|
11
|
-
"include": ["./scripts", "./test", "./typechain-types"],
|
12
|
-
"files": ["./hardhat.config.ts"]
|
13
|
-
}
|