dmap-testing

所属分类:单片机开发
开发工具:Solidity
文件大小:0KB
下载次数:0
上传日期:2022-05-27 19:40:26
上 传 者sh-1993
说明:  针对主网DMAP的测试,
(Tests against mainnet DMAP,)

文件列表:
disassembly/ (0, 2022-05-27)
disassembly/deployed_bytecode.txt (4004, 2022-05-27)
disassembly/dmap-bytecode-disassembly.md (20025, 2022-05-27)
disassembly/opcode-stepping/ (0, 2022-05-27)
disassembly/opcode-stepping/2022-05-complected/ (0, 2022-05-27)
disassembly/opcode-stepping/2022-05-complected/basic-set/ (0, 2022-05-27)
disassembly/opcode-stepping/2022-05-complected/basic-set/DebuggerStepping.t.sol (749, 2022-05-27)
disassembly/opcode-stepping/2022-05-complected/basic-set/basic-set-report.md (34529, 2022-05-27)
foundry.toml (147, 2022-05-27)
lib/ (0, 2022-05-27)
lib/forge-std/ (0, 2022-05-27)
src/ (0, 2022-05-27)
src/test/ (0, 2022-05-27)
src/test/Dmap.t.sol (3977, 2022-05-27)

## Assembly Walkthroughs and Fuzz Tests against deployed dmap object ### What does this repo do? **The more interesting part of this repo is a collection of various stepthroughs of the dmap object's deployed bytecode. Stepthroughs are from a number of contributors. See [Dissassembly](https://github.com/dmfxyz/dmap-testing/blob/master/./disassembly)**. This less interesting part of this repo is designed to fork the mainnet deploy of [dmap](https://github.com/dmfxyz/dmap-testing/blob/master/https://github.com/dapphub/dmap) and run various fuzzed tests against it. For example * It tests that the `get` and `set` functions of dmap work as expected * It further verifies the `set` function using storage inspection within our fork * It tests that entries with locked metadata (LSB of meta set to `0x1`) revert on 2nd write and data is not changed There are more tests to be written. ### How to run tests in this repo This repo uses [Foundry](https://github.com/dmfxyz/dmap-testing/blob/master/https://github.com/foundry-rs/foundry). Look in that repo for install instructions. To run them, go to the root of the repo and do: ``` $> forge install ``` Then do ``` $> forge test -f test ``` optionally pass `-vvvv` to see fork and call details. If you don't have an ethereum node running for the rpc url and really don't want to run one, you can look at the Ethereum Foundation's [Node as a service](https://github.com/dmfxyz/dmap-testing/blob/master/https://ethereum.org/en/developers/docs/nodes-and-clients/nodes-as-a-service/) article. ### Example Output Here's the example output with high verbosity. In this example we run each fuzzed test 10,000 times with different inputs. By default 256 runs are used as 10,000 takes some time. I do not recommend running it 10,000 times by default. For reference, running 256 iterations for all tests only takes about 10 seconds. 10,000 times takes 7+ minutes depending on your machine. ```sh $> FOUNDRY_FUZZ_RUNS=10000 forge test -f $ETH_RPC_URL -vvvv [] Compiling... [] Compiling 1 files with 0.8.14 [] Solc 0.8.14 finished in 1.72s Compiler run successful Running 5 tests for src/test/Dmap.t.sol:ContractTest [PASS] testBasicSetAndGet() (gas: 57097) Traces: [57097] ContractTest::testBasicSetAndGet() ├─ [46266] 0x9094…dd96::00000000(6e616d65000000000000000000000000000000000000000000000000000000006d657461000000000000000000000000000000000000000000000000000000006461746131000000000000000000000000000000000000000000000000000000) │ ├─ emit topic 0: 0x000000000000000000000000b4c79dab8f259c7aee6e5b2aa729821864227e84 │ │ topic 1: 0x6e616d6500000000000000000000000000000000000000000000000000000000 │ │ topic 2: 0x6d65746100000000000000000000000000000000000000000000000000000000 │ │ topic 3: 0x6461746131000000000000000000000000000000000000000000000000000000 │ │ data: 0x │ └─ ← () ├─ [275] 0x9094…dd96::00000000(e5ea0e2e475545ad8f17dc5c8715fbe19059cd94087d116068caa6cbaf092175) │ └─ ← 0x6d657461000000000000000000000000000000000000000000000000000000006461746131000000000000000000000000000000000000000000000000000000 ├─ [2275] 0x9094…dd96::00000000(e5ea0e2e475545ad8f17dc5c8715fbe19059cd94087d116068caa6cbaf092176) │ └─ ← 0x64617461310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 └─ ← () [PASS] testBasicSetAndGetFuzzed(bytes32,bytes32,bytes32) (runs: 10000, μ: 57128, ~: 57128) [PASS] testLockedSlot(bytes32,bytes32,bytes32) (runs: 10000, μ: 62143, ~: 62143) [PASS] testSetAndGetStorageInspection() (gas: 56207) Traces: [56207] ContractTest::testSetAndGetStorageInspection() ├─ [46266] 0x9094…dd96::00000000(6e616d65000000000000000000000000000000000000000000000000000000006d657461000000000000000000000000000000000000000000000000000000006461746131000000000000000000000000000000000000000000000000000000) │ ├─ emit topic 0: 0x000000000000000000000000b4c79dab8f259c7aee6e5b2aa729821864227e84 │ │ topic 1: 0x6e616d6500000000000000000000000000000000000000000000000000000000 │ │ topic 2: 0x6d65746100000000000000000000000000000000000000000000000000000000 │ │ topic 3: 0x6461746131000000000000000000000000000000000000000000000000000000 │ │ data: 0x │ └─ ← () ├─ [0] VM::load(0x90949c9937a11ba943c7a72c3fa073a37e3fdd96, 0xe5ea0e2e475545ad8f17dc5c8715fbe19059cd94087d116068caa6cbaf092175) │ └─ ← 0x6d65746100000000000000000000000000000000000000000000000000000000 ├─ [0] VM::load(0x90949c9937a11ba943c7a72c3fa073a37e3fdd96, 0xe5ea0e2e475545ad8f17dc5c8715fbe19059cd94087d116068caa6cbaf092176) │ └─ ← 0x6461746131000000000000000000000000000000000000000000000000000000 └─ ← () [PASS] testSetAndGetStorageInspectionFuzzed(bytes32,bytes32,bytes32) (runs: 10000, μ: 56368, ~: 56368) Test result: ok. 5 passed; 0 failed; finished in 487.97s ```

近期下载者

相关文件


收藏者