New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dd-tool-package

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dd-tool-package - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

41

index.js

@@ -45,3 +45,2 @@ "use strict";

// And we always revert back to state X
// No rpc means new ganache without fork
function run(rpcUrl, folder, fileName) {

@@ -57,18 +56,6 @@ return __awaiter(this, void 0, void 0, function* () {

: {}; // Nothing if no rpc
const server = ganache_1.default.server(options);
(() => __awaiter(this, void 0, void 0, function* () {
const PORT = 0; // 0 means any available port
server.listen(PORT, (err) => __awaiter(this, void 0, void 0, function* () {
if (err)
throw err;
console.log(`ganache listening on port ${server.address().port}...`);
const ganache = server.provider;
// TODO: Here you'd pass the global function expecting a ganache provider
// TODO: Expect issues with snapshotting
// We prob need to have a snapshot -> Execute setup if server doesn't stop
// A single huge function which handles the whole thing
// Receives ganache and the sequence of functions
yield (0, globalLoop_1.parseFileAndRunGlobalLoop)(ganache, folder, fileName);
}));
}))();
const server = ganache_1.default.provider(options);
// A single huge function which handles the whole thing
// Receives ganache and the sequence of functions
yield (0, globalLoop_1.parseFileAndRunGlobalLoop)(server, folder, fileName);
});

@@ -89,20 +76,8 @@ }

: {}; // Nothing if no rpc
const server = ganache_1.default.server(options);
(() => __awaiter(this, void 0, void 0, function* () {
const PORT = 0; // 0 means any available port
server.listen(PORT, (err) => __awaiter(this, void 0, void 0, function* () {
if (err)
throw err;
console.log(`ganache listening on port ${server.address().port}...`);
const ganache = server.provider;
// TODO: Here you'd pass the global function expecting a ganache provider
// TODO: Expect issues with snapshotting
// We prob need to have a snapshot -> Execute setup if server doesn't stop
// A single huge function which handles the whole thing
// Receives ganache and the sequence of functions
yield (0, globalLoop_1.default)(ganache, sequence, settings ? settings : { alwaysFundCaller: true });
}));
}))();
const server = ganache_1.default.provider(options);
// A single huge function which handles the whole thing
// Receives ganache and the sequence of functions
yield (0, globalLoop_1.default)(server, sequence, settings ? settings : { alwaysFundCaller: true });
});
}
exports.runWithoutFile = runWithoutFile;

2

package.json

@@ -9,3 +9,3 @@ {

},
"version": "1.1.0",
"version": "1.2.0",
"main": "lib/index.js",

@@ -12,0 +12,0 @@ "license": "MIT",

# DD Tool Package
Check `theGlobalLoop` for execution
This is the TS CLI implementation of a tool that would allow to replicate a sequence of TXs
## Why
To share DD (e.g. How many emissions this week?)
To share POCs (e.g. How do I repro a potential attack?)
## Internals
- Usual TS for Code
- Ganache for Forking and Execution
- Ethers for Encoding and Decoding (human readable side)
## How to use
Check `/task/steps.json`
This is an example of how to get started
The globalLoop would receive a `DDSequence` to execute
Input and Output mappings are available to create variables
## Variables
Variables can be `concrete` or a `stateMapping`
Concrete is a real value (e.g your address)
StateMapping is a mapping to the `GlobalState`
With this system you can store intermediary results or pass hardcoded values
## Cheat-like basic implementation
Ganache offers Storage Rewrite and ETH Minting
Some global options in `AdditionalSettings` allow to use them (MOSTLY TODO)
## Architecture
`theGlobalLoop` is the entire global logic
`executeOne` is the function that uses ganache, hidden away as it's a low level implementation
Ganache expects `ExecutableContract`s these are the low level version used internally and returns string/bytes as responses
This means the "Low level" / execution is at the lowest level
The interpretation happens in the loop
## Study Guide
Understand `theLoop` and the `types`
Once you read these, everything should be more clear
## Contributing
Looking for help with tests
Help in writing the ERC20 Cheats
See TODO for more or reach out on twitter
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc