Commit 00250cb2 authored by clabby's avatar clabby

@maurelian review

parent e07b48c9
......@@ -13,8 +13,26 @@ A lightweight binary for utilities accessed via `forge`'s `ffi` cheatcode in the
To build, run `pnpm build:go-ffi` from this directory or the `contract-bedrock` package.
### In a Forge Test
To use `go-ffi` in a forge test, simply invoke the binary via the `vm.ffi` cheatcode.
```solidity
function myFFITest() public {
string[] memory commands = new string[](3);
commands[0] = "./scripts/go-ffi/go-ffi";
commands[1] = "trie";
commands[2] = "valid";
bytes memory result = vm.ffi(commands);
// Do something with the result of the command
}
```
### Available Modes
There are two modes available in `go-ffi`: `diff` and `trie`. Each are present as a subcommand to the `go-ffi` binary, with their own set of variants.
#### `diff`
> **Note**
......
......@@ -76,13 +76,14 @@ var (
func DiffTestUtils() {
args := os.Args[2:]
variant := args[0]
// This command requires arguments
if len(args) == 0 {
panic("Error: No arguments provided")
}
switch args[0] {
switch variant {
case "decodeVersionedNonce":
// Parse input arguments
input, ok := new(big.Int).SetString(args[1], 10)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment