From adb5cf3ec0e92f2f415558c04b5cf4e9e2e31fac Mon Sep 17 00:00:00 2001 From: S29 Date: Fri, 22 Nov 2024 21:53:31 +0100 Subject: [PATCH 1/2] Refactor Anvil to improve cleanup handling. Closes #205, fixes #205 --- anvil/anvil.go | 25 ++- mn.txt | 366 ++++++++++++++++++++++++++++++++++++++++++ tryfile/anvil-900.log | 153 ++++++++++++++++++ tryfile/anvil-901.log | 258 +++++++++++++++++++++++++++++ tryfile/anvil-902.log | 258 +++++++++++++++++++++++++++++ 5 files changed, 1056 insertions(+), 4 deletions(-) create mode 100644 mn.txt create mode 100644 tryfile/anvil-900.log create mode 100644 tryfile/anvil-901.log create mode 100644 tryfile/anvil-902.log diff --git a/anvil/anvil.go b/anvil/anvil.go index 96b83c42..50acbf83 100644 --- a/anvil/anvil.go +++ b/anvil/anvil.go @@ -56,6 +56,8 @@ type Anvil struct { stopped atomic.Bool stoppedCh chan struct{} + + cleanupTasks []func() } func New(log log.Logger, closeApp context.CancelCauseFunc, cfg *config.ChainConfig) *Anvil { @@ -94,7 +96,6 @@ func (a *Anvil) Start(ctx context.Context) error { if len(a.cfg.GenesisJSON) > 0 && a.cfg.ForkConfig == nil { tempFile, err := os.CreateTemp("", "genesis-*.json") - defer a.removeFile(tempFile) if err != nil { return fmt.Errorf("error creating temporary genesis file: %w", err) @@ -103,6 +104,10 @@ func (a *Anvil) Start(ctx context.Context) error { return fmt.Errorf("error writing to genesis file: %w", err) } args = append(args, "--init", tempFile.Name()) + + a.registerCleanupTask(func() { + a.removeFile(tempFile) + }) } if a.cfg.ForkConfig != nil { args = append(args, @@ -133,9 +138,10 @@ func (a *Anvil) Start(ctx context.Context) error { } logFile = tempLogFile - // Clean up the temp log file - // TODO (https://github.com/ethereum-optimism/supersim/issues/205) This results in the temp file being deleted right away instead of after shutdown. - defer a.removeFile(logFile) + + a.registerCleanupTask(func() { + a.removeFile(logFile) + }) } else { // Expand the path to the log file absFilePath, err := filepath.Abs(fmt.Sprintf("%s/anvil-%d.log", a.cfg.LogsDirectory, a.cfg.ChainID)) @@ -235,6 +241,7 @@ func (a *Anvil) Stop(_ context.Context) error { a.rpcClient.Close() a.resourceCancel() + a.executeCleanup() <-a.stoppedCh return nil } @@ -333,3 +340,13 @@ func (a *Anvil) removeFile(file *os.File) { a.log.Warn("failed to remove temp genesis file", "file.path", file.Name(), "err", err) } } + +func (a *Anvil) executeCleanup() { + for _, task := range a.cleanupTasks { + task() + } +} + +func (a *Anvil) registerCleanupTask(task func()) { + a.cleanupTasks = append(a.cleanupTasks, task) +} diff --git a/mn.txt b/mn.txt new file mode 100644 index 00000000..751b5e42 --- /dev/null +++ b/mn.txt @@ -0,0 +1,366 @@ +package anvil + +import ( + "bufio" + "context" + "errors" + "fmt" + "io" + "math/big" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" + "sync" + "sync/atomic" + + "github.com/ethereum-optimism/supersim/config" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/rpc" +) + +var ( + _ config.Chain = &Anvil{} + + logTracerParams = map[string]interface{}{ + "tracer": "callTracer", + "tracerConfig": map[string]interface{}{ + "withLog": true, + }, + } +) + +const ( + anvilListeningLogStr = "Listening on" +) + +type Anvil struct { + rpcClient *rpc.Client + + ethClient *ethclient.Client + + log log.Logger + logFilePath string + + cfg *config.ChainConfig + cmd *exec.Cmd + + resourceCtx context.Context + resourceCancel context.CancelFunc + closeApp context.CancelCauseFunc + + stopped atomic.Bool + stoppedCh chan struct{} + + cleanupCh chan struct{} + wg sync.WaitGroup +} + +func New(log log.Logger, closeApp context.CancelCauseFunc, cfg *config.ChainConfig) *Anvil { + resCtx, resCancel := context.WithCancel(context.Background()) + return &Anvil{ + log: log, + cfg: cfg, + resourceCtx: resCtx, + resourceCancel: resCancel, + closeApp: closeApp, + stoppedCh: make(chan struct{}, 1), + cleanupCh: make(chan struct{}), + } +} + +func (a *Anvil) StartCleanupListener() { + go func() { + <-a.cleanupCh + a.wg.Wait() + }() +} + +func (a *Anvil) SignalCleanup() { + close(a.cleanupCh) +} + +func (a *Anvil) RegisterCleanupTask(task func()) { + a.wg.Add(1) + go func() { + defer a.wg.Done() + task() + }() +} + +func (a *Anvil) Start(ctx context.Context) error { + if a.cmd != nil { + return errors.New("anvil already started") + } + + a.StartCleanupListener() + + args := []string{ + "--host", a.cfg.Host, + "--accounts", fmt.Sprintf("%d", a.cfg.SecretsConfig.Accounts), + "--mnemonic", a.cfg.SecretsConfig.Mnemonic, + "--derivation-path", a.cfg.SecretsConfig.DerivationPath.String(), + "--chain-id", fmt.Sprintf("%d", a.cfg.ChainID), + "--port", fmt.Sprintf("%d", a.cfg.Port), + "--max-persisted-states", "5", + } + + if a.cfg.L2Config != nil { + args = append(args, "--optimism") + } + if a.cfg.StartingTimestamp > 0 { + args = append(args, "--timestamp", fmt.Sprintf("%d", a.cfg.StartingTimestamp)) + } + + if len(a.cfg.GenesisJSON) > 0 && a.cfg.ForkConfig == nil { + tempGenesisFile, err := os.CreateTemp("", "genesis-*.json") + + if err != nil { + return fmt.Errorf("error creating temporary genesis file: %w", err) + } + if _, err = tempGenesisFile.Write(a.cfg.GenesisJSON); err != nil { + return fmt.Errorf("error writing to genesis file: %w", err) + } + args = append(args, "--init", tempGenesisFile.Name()) + + a.RegisterCleanupTask(func() { + a.removeFile(tempGenesisFile) + }) + } + if a.cfg.ForkConfig != nil { + args = append(args, + "--fork-url", a.cfg.ForkConfig.RPCUrl, + "--fork-block-number", fmt.Sprintf("%d", a.cfg.ForkConfig.BlockNumber)) + } + + anvilLog := a.log.New("role", "anvil", "name", a.cfg.Name, "chain.id", a.cfg.ChainID) + anvilLog.Debug("generated cmd arguments", "args", args) + + a.cmd = exec.CommandContext(a.resourceCtx, "anvil", args...) + go func() { + <-ctx.Done() + a.resourceCancel() + }() + + // In the event anvil is started with port 0, we'll need to block + // and see what port anvil eventually binds to when started + anvilPortCh := make(chan uint64) + + var logFile *os.File + + // Empty LogsDirectory defaults to temp file + if a.cfg.LogsDirectory == "" { + tempLogFile, err := os.CreateTemp("", fmt.Sprintf("anvil-chain-%d-", a.cfg.ChainID)) + + if err != nil { + return fmt.Errorf("failed to create temp log file: %w", err) + } + + logFile = tempLogFiley + a.RegisterCleanupTask(func() { + a.removeFile(logFile) + }) + } else { + // Expand the path to the log file + absFilePath, err := filepath.Abs(fmt.Sprintf("%s/anvil-%d.log", a.cfg.LogsDirectory, a.cfg.ChainID)) + if err != nil { + return fmt.Errorf("failed to expand path: %w", err) + } + + // Handle logs in the specified directory + specifiedLogFile, err := os.Create(absFilePath) + if err != nil { + return fmt.Errorf("failed to create log file: %w", err) + } + logFile = specifiedLogFile + // Don't delete the log file if directory is specified + } + + a.logFilePath = logFile.Name() + anvilLog.Debug("piping logs to file", "file.path", a.logFilePath) + + stdout, err := a.cmd.StdoutPipe() + if err != nil { + return fmt.Errorf("failed to get handle on stdout: %w", err) + } + stderr, err := a.cmd.StderrPipe() + if err != nil { + return fmt.Errorf("failed to get handle on stderr: %w", err) + } + go func() { + scanner := bufio.NewScanner(stdout) + for scanner.Scan() { + txt := scanner.Text() + if _, err := fmt.Fprintln(logFile, txt); err != nil { + anvilLog.Warn("err piping stdout to log file", "err", err) + } + + // extract the port from the log + if strings.HasPrefix(txt, anvilListeningLogStr) { + port, err := strconv.ParseInt(strings.Split(txt, ":")[1], 10, 64) + if err != nil { + panic(fmt.Errorf("unexpected anvil listening port log: %w", err)) + } + anvilPortCh <- uint64(port) + } + } + }() + go func() { + if _, err := io.Copy(logFile, stderr); err != nil { + anvilLog.Warn("err piping stderr to log file", "err", err) + } + }() + + // Start anvil + anvilLog.Debug("starting anvil") + if err := a.cmd.Start(); err != nil { + return fmt.Errorf("failed to start anvil: %w", err) + } + + go func() { + if err := a.cmd.Wait(); err != nil { + anvilLog.Error("anvil terminated with an error", "error", err) + } else { + anvilLog.Debug("anvil terminated") + } + + // If anvil stops, signal that the entire app should be closed + a.closeApp(nil) + a.stoppedCh <- struct{}{} + }() + + // wait & update the port. Since we're in the same routine to which `Start` is called, + // we're safe to overrwrite the `Port` field which the caller can observe. The update + // should be a no-op if bound to an explicit non-zero port + done := ctx.Done() + select { + case a.cfg.Port = <-anvilPortCh: + case <-done: + return ctx.Err() + } + + rpcClient, err := rpc.Dial(a.wsEndpoint()) + if err != nil { + return fmt.Errorf("failed to create RPC client: %w", err) + } + + a.rpcClient = rpcClient + a.ethClient = ethclient.NewClient(rpcClient) + return nil +} + +func (a *Anvil) Stop(_ context.Context) error { + if a.stopped.Load() { + return errors.New("already stopped") + } + if !a.stopped.CompareAndSwap(false, true) { + return nil // someone else stopped + } + + a.rpcClient.Close() + a.resourceCancel() + a.SignalCleanup() + <-a.stoppedCh + return nil +} + +func (a *Anvil) Endpoint() string { + return fmt.Sprintf("http://%s:%d", a.cfg.Host, a.cfg.Port) +} + +func (a *Anvil) wsEndpoint() string { + return fmt.Sprintf("ws://%s:%d", a.cfg.Host, a.cfg.Port) +} + +func (a *Anvil) Name() string { + return a.cfg.Name +} + +func (a *Anvil) ChainID() uint64 { + return a.cfg.ChainID +} + +func (a *Anvil) LogPath() string { + return a.logFilePath +} + +func (a *Anvil) Config() *config.ChainConfig { + return a.cfg +} + +func (a *Anvil) EthClient() *ethclient.Client { + return a.ethClient +} + +func (a *Anvil) SetCode(ctx context.Context, result interface{}, address common.Address, code string) error { + return a.rpcClient.CallContext(ctx, result, "anvil_setCode", address.Hex(), code) +} + +func (a *Anvil) SetStorageAt(ctx context.Context, result interface{}, address common.Address, storageSlot string, storageValue string) error { + return a.rpcClient.CallContext(ctx, result, "anvil_setStorageAt", address.Hex(), storageSlot, storageValue) +} + +func (a *Anvil) SetBalance(ctx context.Context, result interface{}, address common.Address, value *big.Int) error { + return a.rpcClient.CallContext(ctx, result, "anvil_setBalance", address.Hex(), hexutil.EncodeBig(value)) +} + +func (a *Anvil) SetIntervalMining(ctx context.Context, result interface{}, interval int64) error { + return a.rpcClient.CallContext(ctx, result, "evm_setIntervalMining", interval) +} + +// DebugTraceCall internal types +type txArgs struct { + From common.Address `json:"from"` + To *common.Address `json:"to"` + Gas hexutil.Uint64 `json:"gas"` + GasPrice *hexutil.Big `json:"gasPrice"` + Data hexutil.Bytes `json:"data"` + Value *hexutil.Big `json:"value"` +} +type callFrame struct { + Logs []callLog `json:"logs"` + Calls []callFrame `json:"calls"` +} +type callLog struct { + Address common.Address `json:"address"` + Topics []common.Hash `json:"topics"` + Data hexutil.Bytes `json:"data"` +} + +func (a *Anvil) SimulatedLogs(ctx context.Context, tx *types.Transaction) ([]types.Log, error) { + from, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx) + if err != nil { + return nil, fmt.Errorf("failed to retrieve tx sender: %w", err) + } + + txArgs := txArgs{From: from, To: tx.To(), Gas: hexutil.Uint64(tx.Gas()), GasPrice: (*hexutil.Big)(tx.GasPrice()), Data: tx.Data(), Value: (*hexutil.Big)(tx.Value())} + result := callFrame{} + if err := a.rpcClient.CallContext(ctx, &result, "debug_traceCall", txArgs, "pending", logTracerParams); err != nil { + return nil, err + } + + // aggregate all logs from the top-level and nested calls + logs, stack := []types.Log{}, []callFrame{result} + for len(stack) > 0 { + call := stack[0] + stack = stack[1:] + for _, log := range call.Logs { + logs = append(logs, types.Log{Address: log.Address, Topics: log.Topics, Data: log.Data}) + } + stack = append(stack, call.Calls...) + } + + return logs, err +} + +func (a *Anvil) removeFile(file *os.File) { + if err := os.Remove(file.Name()); err != nil { + a.log.Warn("failed to remove temp genesis file", "file.path", file.Name(), "err", err) + } +} diff --git a/tryfile/anvil-900.log b/tryfile/anvil-900.log new file mode 100644 index 00000000..3574d972 --- /dev/null +++ b/tryfile/anvil-900.log @@ -0,0 +1,153 @@ + + + _ _ + (_) | | + __ _ _ __ __ __ _ | | + / _` | | '_ \ \ \ / / | | | | + | (_| | | | | | \ V / | | | | + \__,_| |_| |_| \_/ |_| |_| + + 0.2.0 (2559899 2024-10-25T00:22:15.633229410Z) + https://github.com/foundry-rs/foundry + +Available Accounts +================== + +(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH) +(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000.000000000000000000 ETH) +(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000.000000000000000000 ETH) +(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000.000000000000000000 ETH) +(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000.000000000000000000 ETH) +(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000.000000000000000000 ETH) +(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000.000000000000000000 ETH) +(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000.000000000000000000 ETH) +(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000.000000000000000000 ETH) +(9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (10000.000000000000000000 ETH) + +Private Keys +================== + +(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 +(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d +(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a +(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 +(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a +(5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba +(6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e +(7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 +(8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 +(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 + +Wallet +================== +Mnemonic: test test test test test test test test test test test junk +Derivation path: m/44'/60'/0'/0/ + + +Chain ID +================== + +900 + +Base Fee +================== + +1000000000 + +Gas Limit +================== + +30000000 + +Genesis Timestamp +================== + +1732215287 + +Listening on 127.0.0.1:8545 +evm_setIntervalMining + + Block Number: 1 + Block Hash: 0xd07ea42c4dbe7aff804862c7ca064dcd8abbfdd9adfe4708c535ec374f0ce149 + Block Time: "Thu, 21 Nov 2024 18:54:50 +0000" + + + Block Number: 2 + Block Hash: 0xb9de1d2f9d1f1c5a98f61c98343f986ba44b743f468ea93a3da0ba29b01bc89f + Block Time: "Thu, 21 Nov 2024 18:54:52 +0000" + + + Block Number: 3 + Block Hash: 0x029f4c5f0648d4e6f7d2cbce4ab6d831d5b4016cf3358dc524e5e91807c7dd80 + Block Time: "Thu, 21 Nov 2024 18:54:54 +0000" + + + Block Number: 4 + Block Hash: 0x68a86bb6ebf46edd416a3bf6e68e6e3417a580ec802471ce03762069e1f8de11 + Block Time: "Thu, 21 Nov 2024 18:54:56 +0000" + + + Block Number: 5 + Block Hash: 0x53b060236bc3c3e8aad752bdd795a6ec1f0ac05ed6e15bed99c09fee544e94de + Block Time: "Thu, 21 Nov 2024 18:54:58 +0000" + + + Block Number: 6 + Block Hash: 0xc8a8a967f858283e31e15c1478c5c1a4117e44b722baa7eead3adcd658167dc8 + Block Time: "Thu, 21 Nov 2024 18:55:00 +0000" + + + Block Number: 7 + Block Hash: 0xbe9de78ec3ab3e532143d2f48c9b5ee36adce0314168de597e5d65e884eac039 + Block Time: "Thu, 21 Nov 2024 18:55:02 +0000" + + + Block Number: 8 + Block Hash: 0x0d6239b90aced84b2ab5cd2ea4485affc0ccff8ff13979526a357c31ac7a00ad + Block Time: "Thu, 21 Nov 2024 18:55:04 +0000" + + + Block Number: 9 + Block Hash: 0xaefae7d8df4934a0a8a71b3a791d7b0d4336e06e778eee9d371236916f98d753 + Block Time: "Thu, 21 Nov 2024 18:55:06 +0000" + + + Block Number: 10 + Block Hash: 0xe096f146252da28997d77c587dcc4b9dc33723118b2084b7b58d75ab76fad973 + Block Time: "Thu, 21 Nov 2024 18:55:08 +0000" + + + Block Number: 11 + Block Hash: 0xf619e92827ac223bd4df5a7b531bf3512c120b066021fcf681822a304562a195 + Block Time: "Thu, 21 Nov 2024 18:55:10 +0000" + + + Block Number: 12 + Block Hash: 0x4c768222fd583c2c081b3b9abb4a962bfbe01d40efcb2e04e3c20c2b4b5bbdb9 + Block Time: "Thu, 21 Nov 2024 18:55:12 +0000" + + + Block Number: 13 + Block Hash: 0x216907d2ac7fdcbf566d31540e0e9374ea4a7361fdf7803c84cb5d23a9ea55d3 + Block Time: "Thu, 21 Nov 2024 18:55:14 +0000" + + + Block Number: 14 + Block Hash: 0x5c87ff7e327b247d5fd21b0aa094b0a37850f0985ace71502b1f7a57e3409bdd + Block Time: "Thu, 21 Nov 2024 18:55:16 +0000" + + + Block Number: 15 + Block Hash: 0xf289c69653893c058517ac0d5306ee9dc58c5cdf6f02fbc2ac4c46caee3e51d1 + Block Time: "Thu, 21 Nov 2024 18:55:18 +0000" + + + Block Number: 16 + Block Hash: 0xbff8c8fdc41cd05492605db655cf11ddea627048ccf537b4d56c26556fdb7f13 + Block Time: "Thu, 21 Nov 2024 18:55:20 +0000" + + + Block Number: 17 + Block Hash: 0x00573f3735d36f3452f4518527f2835c88006d61b1a903606ec14efbe46cd58c + Block Time: "Thu, 21 Nov 2024 18:55:22 +0000" + diff --git a/tryfile/anvil-901.log b/tryfile/anvil-901.log new file mode 100644 index 00000000..08fcb6b5 --- /dev/null +++ b/tryfile/anvil-901.log @@ -0,0 +1,258 @@ + + + _ _ + (_) | | + __ _ _ __ __ __ _ | | + / _` | | '_ \ \ \ / / | | | | + | (_| | | | | | \ V / | | | | + \__,_| |_| |_| \_/ |_| |_| + + 0.2.0 (2559899 2024-10-25T00:22:15.633229410Z) + https://github.com/foundry-rs/foundry + +Available Accounts +================== + +(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH) +(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000.000000000000000000 ETH) +(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000.000000000000000000 ETH) +(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000.000000000000000000 ETH) +(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000.000000000000000000 ETH) +(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000.000000000000000000 ETH) +(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000.000000000000000000 ETH) +(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000.000000000000000000 ETH) +(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000.000000000000000000 ETH) +(9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (10000.000000000000000000 ETH) + +Private Keys +================== + +(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 +(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d +(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a +(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 +(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a +(5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba +(6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e +(7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 +(8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 +(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 + +Wallet +================== +Mnemonic: test test test test test test test test test test test junk +Derivation path: m/44'/60'/0'/0/ + + +Chain ID +================== + +901 + +Base Fee +================== + +1000000000 + +Gas Limit +================== + +30000000 + +Genesis Timestamp +================== + +1732215287 + +Listening on 127.0.0.1:45067 +evm_setIntervalMining +debug_traceCall +eth_sendRawTransaction +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt + +eth_getTransactionReceipt + Transaction: 0x145c7481b308c57a8d7fceeb3dd98e0663cf973443d75cbae7f2a718aaf2df53 + Gas used: 95774 + + Block Number: 1 + Block Hash: 0x8971452bb5e1dcee6697c67b0e9ee9bf98f0b6ff5212f2d6a9cb3d3d00ea2b1d + Block Time: "Thu, 21 Nov 2024 18:54:50 +0000" + +eth_getTransactionReceipt + + Block Number: 2 + Block Hash: 0x7cfdb47b52b9e63d82b6d7f8b0d1f1111d463d9fe6e774bd5280adc3bd06fc54 + Block Time: "Thu, 21 Nov 2024 18:54:52 +0000" + + + Block Number: 3 + Block Hash: 0x70807ed64a0c7bd3022124082a4b8eede16ee36456a6c2e7196ade7ce528a304 + Block Time: "Thu, 21 Nov 2024 18:54:54 +0000" + + + Block Number: 4 + Block Hash: 0x2744622ad5fd325ccc044581ed18eea22fb7fdc77dd62b477b1268c291c26bb9 + Block Time: "Thu, 21 Nov 2024 18:54:56 +0000" + + + Block Number: 5 + Block Hash: 0xce760be8c3f6d1ef62fb0feec8ff912b8a461f6ac1325bea6a597a0b865f6e99 + Block Time: "Thu, 21 Nov 2024 18:54:58 +0000" + + + Block Number: 6 + Block Hash: 0x5c5284c250e7e68ccbd30022f2599a5e79887e4662b61a6a4b4c6734d2b6eed9 + Block Time: "Thu, 21 Nov 2024 18:55:00 +0000" + + + Block Number: 7 + Block Hash: 0x5d7dc890d9cf2c227a9dfcabdc46fa2c1468cb65a6d53ad58eec1d957d4855e1 + Block Time: "Thu, 21 Nov 2024 18:55:02 +0000" + + + Block Number: 8 + Block Hash: 0xe83782da2707c62b518231d174798efb37d51508a928434365efe0f8a3a357e8 + Block Time: "Thu, 21 Nov 2024 18:55:04 +0000" + + + Block Number: 9 + Block Hash: 0x422aee9776fc7ad32457ab4a8526868b2223945dbd2f1a14a22ea1bf476e6647 + Block Time: "Thu, 21 Nov 2024 18:55:06 +0000" + + + Block Number: 10 + Block Hash: 0xed338b4786eb0a7db096b79a27e8fd4b0880625a1fee2e27e9ee97ecf8cf2154 + Block Time: "Thu, 21 Nov 2024 18:55:08 +0000" + + + Block Number: 11 + Block Hash: 0x5cfe5be68a2b4d101fa9b28c5c0f2bef9808779c1a52a3d5e750417c8be7517b + Block Time: "Thu, 21 Nov 2024 18:55:10 +0000" + + + Block Number: 12 + Block Hash: 0x032c5e23f47b79d1f903e541bcc62ecf38d73fc9e54493ee545e8c92ffe398ec + Block Time: "Thu, 21 Nov 2024 18:55:12 +0000" + + + Block Number: 13 + Block Hash: 0xb6b55dd9fce95d56935feca85ac93b0638596d431d38d166cfcf479c50c2746c + Block Time: "Thu, 21 Nov 2024 18:55:14 +0000" + + + Block Number: 14 + Block Hash: 0xef8a59ac36bae37e15acb44886355bb529e87267ef71d529144430fbde2b98a1 + Block Time: "Thu, 21 Nov 2024 18:55:16 +0000" + + + Block Number: 15 + Block Hash: 0xbdb3cd58a3d2bcfc4793517e88f82a892c4e8a4da06c4a5c89c0377999a855c5 + Block Time: "Thu, 21 Nov 2024 18:55:18 +0000" + + + Block Number: 16 + Block Hash: 0x6cae14e47150731426ef26c2394d1011d25fe54cf98f3ba10e215c8841b4a482 + Block Time: "Thu, 21 Nov 2024 18:55:20 +0000" + + + Block Number: 17 + Block Hash: 0x5b6e9926b66e47eeb381c108a9b0673f19c79e6a52fb0db8533871b864531e11 + Block Time: "Thu, 21 Nov 2024 18:55:22 +0000" + diff --git a/tryfile/anvil-902.log b/tryfile/anvil-902.log new file mode 100644 index 00000000..c8504e5a --- /dev/null +++ b/tryfile/anvil-902.log @@ -0,0 +1,258 @@ + + + _ _ + (_) | | + __ _ _ __ __ __ _ | | + / _` | | '_ \ \ \ / / | | | | + | (_| | | | | | \ V / | | | | + \__,_| |_| |_| \_/ |_| |_| + + 0.2.0 (2559899 2024-10-25T00:22:15.633229410Z) + https://github.com/foundry-rs/foundry + +Available Accounts +================== + +(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH) +(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000.000000000000000000 ETH) +(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000.000000000000000000 ETH) +(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000.000000000000000000 ETH) +(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000.000000000000000000 ETH) +(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000.000000000000000000 ETH) +(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000.000000000000000000 ETH) +(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000.000000000000000000 ETH) +(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000.000000000000000000 ETH) +(9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (10000.000000000000000000 ETH) + +Private Keys +================== + +(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 +(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d +(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a +(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 +(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a +(5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba +(6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e +(7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 +(8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 +(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 + +Wallet +================== +Mnemonic: test test test test test test test test test test test junk +Derivation path: m/44'/60'/0'/0/ + + +Chain ID +================== + +902 + +Base Fee +================== + +1000000000 + +Gas Limit +================== + +30000000 + +Genesis Timestamp +================== + +1732215287 + +Listening on 127.0.0.1:32933 +evm_setIntervalMining +debug_traceCall +eth_sendRawTransaction +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt +eth_getTransactionReceipt + + Transaction: 0x547050910192478cdbeda0875d62f4f44ce28b42bc3adcd5663b1ebe4f01d755 + Gas used: 95774 + + Block Number: 1 + Block Hash: 0x53faae1d7488094da452e1cf444dd446ad5722c57f8e274ac01c7e4bdf55af75 + Block Time: "Thu, 21 Nov 2024 18:54:49 +0000" + +eth_getTransactionReceipt + + Block Number: 2 + Block Hash: 0x77db502e9ef0629d85d14bd602f45c67dad13994adfe95aa48cf95ad21aa0e54 + Block Time: "Thu, 21 Nov 2024 18:54:51 +0000" + + + Block Number: 3 + Block Hash: 0x4c8b6774459c4da75588bd626adb0205681916f23aab347c804b6d3dd0954b10 + Block Time: "Thu, 21 Nov 2024 18:54:53 +0000" + + + Block Number: 4 + Block Hash: 0x20b34df39b688eb947ab155d9403c9c46b5a2119738be0a5bfc080357dd0b685 + Block Time: "Thu, 21 Nov 2024 18:54:55 +0000" + + + Block Number: 5 + Block Hash: 0x22ec08402c74e8a834d65316302ee8866e6e8f3eb9a35a5aae7a39c3fa7d8cc9 + Block Time: "Thu, 21 Nov 2024 18:54:57 +0000" + + + Block Number: 6 + Block Hash: 0x375a3e311869c186e559806af3b485463433c814e073b2851de227ffc0dcb7f0 + Block Time: "Thu, 21 Nov 2024 18:54:59 +0000" + + + Block Number: 7 + Block Hash: 0xaa5640f7acaacf687c0284c24fcd0e12f571e2acc3c2d5e138ff488772b4f4a6 + Block Time: "Thu, 21 Nov 2024 18:55:01 +0000" + + + Block Number: 8 + Block Hash: 0x6917c4cdecc5988b55d4c4f45b7bbe59b66383349f40eaf117dd62df64da3351 + Block Time: "Thu, 21 Nov 2024 18:55:03 +0000" + + + Block Number: 9 + Block Hash: 0x7f8fb2b917c4f3877ba8a0c4bfd20af3445c0957d9d1a56dc9b1c9ce6d65c507 + Block Time: "Thu, 21 Nov 2024 18:55:05 +0000" + + + Block Number: 10 + Block Hash: 0x81c0ee99bcc1ef77dbe4de201abb85743525ca5eef1a2e5a8562548a0e9c3291 + Block Time: "Thu, 21 Nov 2024 18:55:07 +0000" + + + Block Number: 11 + Block Hash: 0x388729f247a182d6ab8f987d47467ac411519fad61308354e5b453545e7ce498 + Block Time: "Thu, 21 Nov 2024 18:55:09 +0000" + + + Block Number: 12 + Block Hash: 0x06248f44f5e56e90e6b84c629dbd323de7a78647e67a055a4d57a8e620f23850 + Block Time: "Thu, 21 Nov 2024 18:55:11 +0000" + + + Block Number: 13 + Block Hash: 0x5cd7d579cf4e37b00d1166d62b500338b6fd884fcb05fe5e4222d3038899d575 + Block Time: "Thu, 21 Nov 2024 18:55:13 +0000" + + + Block Number: 14 + Block Hash: 0x53d5f6de58e1f6ff68ba0b743ed26b687e160ef40107a56ff6fe04e301e58338 + Block Time: "Thu, 21 Nov 2024 18:55:15 +0000" + + + Block Number: 15 + Block Hash: 0x6e694868e2d19db961895f45fb67c9347447b0232c0d566e35228cd6a8f02fb1 + Block Time: "Thu, 21 Nov 2024 18:55:17 +0000" + + + Block Number: 16 + Block Hash: 0xb7ff762701f204eb71f634a24a217aec188cdac468873197078290b68c11d2d7 + Block Time: "Thu, 21 Nov 2024 18:55:19 +0000" + + + Block Number: 17 + Block Hash: 0x9844ad39ec9da8fd2dca88fcd447bf6ee8d43b45d78866c81f2b2af8832963cd + Block Time: "Thu, 21 Nov 2024 18:55:21 +0000" + From fff8ec32c6a40ffe1d5bc4053ffe94ac3d305b65 Mon Sep 17 00:00:00 2001 From: S29 Date: Fri, 22 Nov 2024 23:06:40 +0100 Subject: [PATCH 2/2] Refactor Anvil to improve cleanup handling. Closes #205, fixes #205 --- mn.txt | 366 ------------------------------------------ tryfile/anvil-900.log | 153 ------------------ tryfile/anvil-901.log | 258 ----------------------------- tryfile/anvil-902.log | 258 ----------------------------- 4 files changed, 1035 deletions(-) delete mode 100644 mn.txt delete mode 100644 tryfile/anvil-900.log delete mode 100644 tryfile/anvil-901.log delete mode 100644 tryfile/anvil-902.log diff --git a/mn.txt b/mn.txt deleted file mode 100644 index 751b5e42..00000000 --- a/mn.txt +++ /dev/null @@ -1,366 +0,0 @@ -package anvil - -import ( - "bufio" - "context" - "errors" - "fmt" - "io" - "math/big" - "os" - "os/exec" - "path/filepath" - "strconv" - "strings" - "sync" - "sync/atomic" - - "github.com/ethereum-optimism/supersim/config" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" -) - -var ( - _ config.Chain = &Anvil{} - - logTracerParams = map[string]interface{}{ - "tracer": "callTracer", - "tracerConfig": map[string]interface{}{ - "withLog": true, - }, - } -) - -const ( - anvilListeningLogStr = "Listening on" -) - -type Anvil struct { - rpcClient *rpc.Client - - ethClient *ethclient.Client - - log log.Logger - logFilePath string - - cfg *config.ChainConfig - cmd *exec.Cmd - - resourceCtx context.Context - resourceCancel context.CancelFunc - closeApp context.CancelCauseFunc - - stopped atomic.Bool - stoppedCh chan struct{} - - cleanupCh chan struct{} - wg sync.WaitGroup -} - -func New(log log.Logger, closeApp context.CancelCauseFunc, cfg *config.ChainConfig) *Anvil { - resCtx, resCancel := context.WithCancel(context.Background()) - return &Anvil{ - log: log, - cfg: cfg, - resourceCtx: resCtx, - resourceCancel: resCancel, - closeApp: closeApp, - stoppedCh: make(chan struct{}, 1), - cleanupCh: make(chan struct{}), - } -} - -func (a *Anvil) StartCleanupListener() { - go func() { - <-a.cleanupCh - a.wg.Wait() - }() -} - -func (a *Anvil) SignalCleanup() { - close(a.cleanupCh) -} - -func (a *Anvil) RegisterCleanupTask(task func()) { - a.wg.Add(1) - go func() { - defer a.wg.Done() - task() - }() -} - -func (a *Anvil) Start(ctx context.Context) error { - if a.cmd != nil { - return errors.New("anvil already started") - } - - a.StartCleanupListener() - - args := []string{ - "--host", a.cfg.Host, - "--accounts", fmt.Sprintf("%d", a.cfg.SecretsConfig.Accounts), - "--mnemonic", a.cfg.SecretsConfig.Mnemonic, - "--derivation-path", a.cfg.SecretsConfig.DerivationPath.String(), - "--chain-id", fmt.Sprintf("%d", a.cfg.ChainID), - "--port", fmt.Sprintf("%d", a.cfg.Port), - "--max-persisted-states", "5", - } - - if a.cfg.L2Config != nil { - args = append(args, "--optimism") - } - if a.cfg.StartingTimestamp > 0 { - args = append(args, "--timestamp", fmt.Sprintf("%d", a.cfg.StartingTimestamp)) - } - - if len(a.cfg.GenesisJSON) > 0 && a.cfg.ForkConfig == nil { - tempGenesisFile, err := os.CreateTemp("", "genesis-*.json") - - if err != nil { - return fmt.Errorf("error creating temporary genesis file: %w", err) - } - if _, err = tempGenesisFile.Write(a.cfg.GenesisJSON); err != nil { - return fmt.Errorf("error writing to genesis file: %w", err) - } - args = append(args, "--init", tempGenesisFile.Name()) - - a.RegisterCleanupTask(func() { - a.removeFile(tempGenesisFile) - }) - } - if a.cfg.ForkConfig != nil { - args = append(args, - "--fork-url", a.cfg.ForkConfig.RPCUrl, - "--fork-block-number", fmt.Sprintf("%d", a.cfg.ForkConfig.BlockNumber)) - } - - anvilLog := a.log.New("role", "anvil", "name", a.cfg.Name, "chain.id", a.cfg.ChainID) - anvilLog.Debug("generated cmd arguments", "args", args) - - a.cmd = exec.CommandContext(a.resourceCtx, "anvil", args...) - go func() { - <-ctx.Done() - a.resourceCancel() - }() - - // In the event anvil is started with port 0, we'll need to block - // and see what port anvil eventually binds to when started - anvilPortCh := make(chan uint64) - - var logFile *os.File - - // Empty LogsDirectory defaults to temp file - if a.cfg.LogsDirectory == "" { - tempLogFile, err := os.CreateTemp("", fmt.Sprintf("anvil-chain-%d-", a.cfg.ChainID)) - - if err != nil { - return fmt.Errorf("failed to create temp log file: %w", err) - } - - logFile = tempLogFiley - a.RegisterCleanupTask(func() { - a.removeFile(logFile) - }) - } else { - // Expand the path to the log file - absFilePath, err := filepath.Abs(fmt.Sprintf("%s/anvil-%d.log", a.cfg.LogsDirectory, a.cfg.ChainID)) - if err != nil { - return fmt.Errorf("failed to expand path: %w", err) - } - - // Handle logs in the specified directory - specifiedLogFile, err := os.Create(absFilePath) - if err != nil { - return fmt.Errorf("failed to create log file: %w", err) - } - logFile = specifiedLogFile - // Don't delete the log file if directory is specified - } - - a.logFilePath = logFile.Name() - anvilLog.Debug("piping logs to file", "file.path", a.logFilePath) - - stdout, err := a.cmd.StdoutPipe() - if err != nil { - return fmt.Errorf("failed to get handle on stdout: %w", err) - } - stderr, err := a.cmd.StderrPipe() - if err != nil { - return fmt.Errorf("failed to get handle on stderr: %w", err) - } - go func() { - scanner := bufio.NewScanner(stdout) - for scanner.Scan() { - txt := scanner.Text() - if _, err := fmt.Fprintln(logFile, txt); err != nil { - anvilLog.Warn("err piping stdout to log file", "err", err) - } - - // extract the port from the log - if strings.HasPrefix(txt, anvilListeningLogStr) { - port, err := strconv.ParseInt(strings.Split(txt, ":")[1], 10, 64) - if err != nil { - panic(fmt.Errorf("unexpected anvil listening port log: %w", err)) - } - anvilPortCh <- uint64(port) - } - } - }() - go func() { - if _, err := io.Copy(logFile, stderr); err != nil { - anvilLog.Warn("err piping stderr to log file", "err", err) - } - }() - - // Start anvil - anvilLog.Debug("starting anvil") - if err := a.cmd.Start(); err != nil { - return fmt.Errorf("failed to start anvil: %w", err) - } - - go func() { - if err := a.cmd.Wait(); err != nil { - anvilLog.Error("anvil terminated with an error", "error", err) - } else { - anvilLog.Debug("anvil terminated") - } - - // If anvil stops, signal that the entire app should be closed - a.closeApp(nil) - a.stoppedCh <- struct{}{} - }() - - // wait & update the port. Since we're in the same routine to which `Start` is called, - // we're safe to overrwrite the `Port` field which the caller can observe. The update - // should be a no-op if bound to an explicit non-zero port - done := ctx.Done() - select { - case a.cfg.Port = <-anvilPortCh: - case <-done: - return ctx.Err() - } - - rpcClient, err := rpc.Dial(a.wsEndpoint()) - if err != nil { - return fmt.Errorf("failed to create RPC client: %w", err) - } - - a.rpcClient = rpcClient - a.ethClient = ethclient.NewClient(rpcClient) - return nil -} - -func (a *Anvil) Stop(_ context.Context) error { - if a.stopped.Load() { - return errors.New("already stopped") - } - if !a.stopped.CompareAndSwap(false, true) { - return nil // someone else stopped - } - - a.rpcClient.Close() - a.resourceCancel() - a.SignalCleanup() - <-a.stoppedCh - return nil -} - -func (a *Anvil) Endpoint() string { - return fmt.Sprintf("http://%s:%d", a.cfg.Host, a.cfg.Port) -} - -func (a *Anvil) wsEndpoint() string { - return fmt.Sprintf("ws://%s:%d", a.cfg.Host, a.cfg.Port) -} - -func (a *Anvil) Name() string { - return a.cfg.Name -} - -func (a *Anvil) ChainID() uint64 { - return a.cfg.ChainID -} - -func (a *Anvil) LogPath() string { - return a.logFilePath -} - -func (a *Anvil) Config() *config.ChainConfig { - return a.cfg -} - -func (a *Anvil) EthClient() *ethclient.Client { - return a.ethClient -} - -func (a *Anvil) SetCode(ctx context.Context, result interface{}, address common.Address, code string) error { - return a.rpcClient.CallContext(ctx, result, "anvil_setCode", address.Hex(), code) -} - -func (a *Anvil) SetStorageAt(ctx context.Context, result interface{}, address common.Address, storageSlot string, storageValue string) error { - return a.rpcClient.CallContext(ctx, result, "anvil_setStorageAt", address.Hex(), storageSlot, storageValue) -} - -func (a *Anvil) SetBalance(ctx context.Context, result interface{}, address common.Address, value *big.Int) error { - return a.rpcClient.CallContext(ctx, result, "anvil_setBalance", address.Hex(), hexutil.EncodeBig(value)) -} - -func (a *Anvil) SetIntervalMining(ctx context.Context, result interface{}, interval int64) error { - return a.rpcClient.CallContext(ctx, result, "evm_setIntervalMining", interval) -} - -// DebugTraceCall internal types -type txArgs struct { - From common.Address `json:"from"` - To *common.Address `json:"to"` - Gas hexutil.Uint64 `json:"gas"` - GasPrice *hexutil.Big `json:"gasPrice"` - Data hexutil.Bytes `json:"data"` - Value *hexutil.Big `json:"value"` -} -type callFrame struct { - Logs []callLog `json:"logs"` - Calls []callFrame `json:"calls"` -} -type callLog struct { - Address common.Address `json:"address"` - Topics []common.Hash `json:"topics"` - Data hexutil.Bytes `json:"data"` -} - -func (a *Anvil) SimulatedLogs(ctx context.Context, tx *types.Transaction) ([]types.Log, error) { - from, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx) - if err != nil { - return nil, fmt.Errorf("failed to retrieve tx sender: %w", err) - } - - txArgs := txArgs{From: from, To: tx.To(), Gas: hexutil.Uint64(tx.Gas()), GasPrice: (*hexutil.Big)(tx.GasPrice()), Data: tx.Data(), Value: (*hexutil.Big)(tx.Value())} - result := callFrame{} - if err := a.rpcClient.CallContext(ctx, &result, "debug_traceCall", txArgs, "pending", logTracerParams); err != nil { - return nil, err - } - - // aggregate all logs from the top-level and nested calls - logs, stack := []types.Log{}, []callFrame{result} - for len(stack) > 0 { - call := stack[0] - stack = stack[1:] - for _, log := range call.Logs { - logs = append(logs, types.Log{Address: log.Address, Topics: log.Topics, Data: log.Data}) - } - stack = append(stack, call.Calls...) - } - - return logs, err -} - -func (a *Anvil) removeFile(file *os.File) { - if err := os.Remove(file.Name()); err != nil { - a.log.Warn("failed to remove temp genesis file", "file.path", file.Name(), "err", err) - } -} diff --git a/tryfile/anvil-900.log b/tryfile/anvil-900.log deleted file mode 100644 index 3574d972..00000000 --- a/tryfile/anvil-900.log +++ /dev/null @@ -1,153 +0,0 @@ - - - _ _ - (_) | | - __ _ _ __ __ __ _ | | - / _` | | '_ \ \ \ / / | | | | - | (_| | | | | | \ V / | | | | - \__,_| |_| |_| \_/ |_| |_| - - 0.2.0 (2559899 2024-10-25T00:22:15.633229410Z) - https://github.com/foundry-rs/foundry - -Available Accounts -================== - -(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH) -(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000.000000000000000000 ETH) -(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000.000000000000000000 ETH) -(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000.000000000000000000 ETH) -(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000.000000000000000000 ETH) -(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000.000000000000000000 ETH) -(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000.000000000000000000 ETH) -(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000.000000000000000000 ETH) -(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000.000000000000000000 ETH) -(9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (10000.000000000000000000 ETH) - -Private Keys -================== - -(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 -(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d -(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a -(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 -(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a -(5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba -(6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e -(7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 -(8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 -(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 - -Wallet -================== -Mnemonic: test test test test test test test test test test test junk -Derivation path: m/44'/60'/0'/0/ - - -Chain ID -================== - -900 - -Base Fee -================== - -1000000000 - -Gas Limit -================== - -30000000 - -Genesis Timestamp -================== - -1732215287 - -Listening on 127.0.0.1:8545 -evm_setIntervalMining - - Block Number: 1 - Block Hash: 0xd07ea42c4dbe7aff804862c7ca064dcd8abbfdd9adfe4708c535ec374f0ce149 - Block Time: "Thu, 21 Nov 2024 18:54:50 +0000" - - - Block Number: 2 - Block Hash: 0xb9de1d2f9d1f1c5a98f61c98343f986ba44b743f468ea93a3da0ba29b01bc89f - Block Time: "Thu, 21 Nov 2024 18:54:52 +0000" - - - Block Number: 3 - Block Hash: 0x029f4c5f0648d4e6f7d2cbce4ab6d831d5b4016cf3358dc524e5e91807c7dd80 - Block Time: "Thu, 21 Nov 2024 18:54:54 +0000" - - - Block Number: 4 - Block Hash: 0x68a86bb6ebf46edd416a3bf6e68e6e3417a580ec802471ce03762069e1f8de11 - Block Time: "Thu, 21 Nov 2024 18:54:56 +0000" - - - Block Number: 5 - Block Hash: 0x53b060236bc3c3e8aad752bdd795a6ec1f0ac05ed6e15bed99c09fee544e94de - Block Time: "Thu, 21 Nov 2024 18:54:58 +0000" - - - Block Number: 6 - Block Hash: 0xc8a8a967f858283e31e15c1478c5c1a4117e44b722baa7eead3adcd658167dc8 - Block Time: "Thu, 21 Nov 2024 18:55:00 +0000" - - - Block Number: 7 - Block Hash: 0xbe9de78ec3ab3e532143d2f48c9b5ee36adce0314168de597e5d65e884eac039 - Block Time: "Thu, 21 Nov 2024 18:55:02 +0000" - - - Block Number: 8 - Block Hash: 0x0d6239b90aced84b2ab5cd2ea4485affc0ccff8ff13979526a357c31ac7a00ad - Block Time: "Thu, 21 Nov 2024 18:55:04 +0000" - - - Block Number: 9 - Block Hash: 0xaefae7d8df4934a0a8a71b3a791d7b0d4336e06e778eee9d371236916f98d753 - Block Time: "Thu, 21 Nov 2024 18:55:06 +0000" - - - Block Number: 10 - Block Hash: 0xe096f146252da28997d77c587dcc4b9dc33723118b2084b7b58d75ab76fad973 - Block Time: "Thu, 21 Nov 2024 18:55:08 +0000" - - - Block Number: 11 - Block Hash: 0xf619e92827ac223bd4df5a7b531bf3512c120b066021fcf681822a304562a195 - Block Time: "Thu, 21 Nov 2024 18:55:10 +0000" - - - Block Number: 12 - Block Hash: 0x4c768222fd583c2c081b3b9abb4a962bfbe01d40efcb2e04e3c20c2b4b5bbdb9 - Block Time: "Thu, 21 Nov 2024 18:55:12 +0000" - - - Block Number: 13 - Block Hash: 0x216907d2ac7fdcbf566d31540e0e9374ea4a7361fdf7803c84cb5d23a9ea55d3 - Block Time: "Thu, 21 Nov 2024 18:55:14 +0000" - - - Block Number: 14 - Block Hash: 0x5c87ff7e327b247d5fd21b0aa094b0a37850f0985ace71502b1f7a57e3409bdd - Block Time: "Thu, 21 Nov 2024 18:55:16 +0000" - - - Block Number: 15 - Block Hash: 0xf289c69653893c058517ac0d5306ee9dc58c5cdf6f02fbc2ac4c46caee3e51d1 - Block Time: "Thu, 21 Nov 2024 18:55:18 +0000" - - - Block Number: 16 - Block Hash: 0xbff8c8fdc41cd05492605db655cf11ddea627048ccf537b4d56c26556fdb7f13 - Block Time: "Thu, 21 Nov 2024 18:55:20 +0000" - - - Block Number: 17 - Block Hash: 0x00573f3735d36f3452f4518527f2835c88006d61b1a903606ec14efbe46cd58c - Block Time: "Thu, 21 Nov 2024 18:55:22 +0000" - diff --git a/tryfile/anvil-901.log b/tryfile/anvil-901.log deleted file mode 100644 index 08fcb6b5..00000000 --- a/tryfile/anvil-901.log +++ /dev/null @@ -1,258 +0,0 @@ - - - _ _ - (_) | | - __ _ _ __ __ __ _ | | - / _` | | '_ \ \ \ / / | | | | - | (_| | | | | | \ V / | | | | - \__,_| |_| |_| \_/ |_| |_| - - 0.2.0 (2559899 2024-10-25T00:22:15.633229410Z) - https://github.com/foundry-rs/foundry - -Available Accounts -================== - -(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH) -(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000.000000000000000000 ETH) -(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000.000000000000000000 ETH) -(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000.000000000000000000 ETH) -(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000.000000000000000000 ETH) -(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000.000000000000000000 ETH) -(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000.000000000000000000 ETH) -(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000.000000000000000000 ETH) -(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000.000000000000000000 ETH) -(9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (10000.000000000000000000 ETH) - -Private Keys -================== - -(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 -(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d -(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a -(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 -(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a -(5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba -(6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e -(7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 -(8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 -(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 - -Wallet -================== -Mnemonic: test test test test test test test test test test test junk -Derivation path: m/44'/60'/0'/0/ - - -Chain ID -================== - -901 - -Base Fee -================== - -1000000000 - -Gas Limit -================== - -30000000 - -Genesis Timestamp -================== - -1732215287 - -Listening on 127.0.0.1:45067 -evm_setIntervalMining -debug_traceCall -eth_sendRawTransaction -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt - -eth_getTransactionReceipt - Transaction: 0x145c7481b308c57a8d7fceeb3dd98e0663cf973443d75cbae7f2a718aaf2df53 - Gas used: 95774 - - Block Number: 1 - Block Hash: 0x8971452bb5e1dcee6697c67b0e9ee9bf98f0b6ff5212f2d6a9cb3d3d00ea2b1d - Block Time: "Thu, 21 Nov 2024 18:54:50 +0000" - -eth_getTransactionReceipt - - Block Number: 2 - Block Hash: 0x7cfdb47b52b9e63d82b6d7f8b0d1f1111d463d9fe6e774bd5280adc3bd06fc54 - Block Time: "Thu, 21 Nov 2024 18:54:52 +0000" - - - Block Number: 3 - Block Hash: 0x70807ed64a0c7bd3022124082a4b8eede16ee36456a6c2e7196ade7ce528a304 - Block Time: "Thu, 21 Nov 2024 18:54:54 +0000" - - - Block Number: 4 - Block Hash: 0x2744622ad5fd325ccc044581ed18eea22fb7fdc77dd62b477b1268c291c26bb9 - Block Time: "Thu, 21 Nov 2024 18:54:56 +0000" - - - Block Number: 5 - Block Hash: 0xce760be8c3f6d1ef62fb0feec8ff912b8a461f6ac1325bea6a597a0b865f6e99 - Block Time: "Thu, 21 Nov 2024 18:54:58 +0000" - - - Block Number: 6 - Block Hash: 0x5c5284c250e7e68ccbd30022f2599a5e79887e4662b61a6a4b4c6734d2b6eed9 - Block Time: "Thu, 21 Nov 2024 18:55:00 +0000" - - - Block Number: 7 - Block Hash: 0x5d7dc890d9cf2c227a9dfcabdc46fa2c1468cb65a6d53ad58eec1d957d4855e1 - Block Time: "Thu, 21 Nov 2024 18:55:02 +0000" - - - Block Number: 8 - Block Hash: 0xe83782da2707c62b518231d174798efb37d51508a928434365efe0f8a3a357e8 - Block Time: "Thu, 21 Nov 2024 18:55:04 +0000" - - - Block Number: 9 - Block Hash: 0x422aee9776fc7ad32457ab4a8526868b2223945dbd2f1a14a22ea1bf476e6647 - Block Time: "Thu, 21 Nov 2024 18:55:06 +0000" - - - Block Number: 10 - Block Hash: 0xed338b4786eb0a7db096b79a27e8fd4b0880625a1fee2e27e9ee97ecf8cf2154 - Block Time: "Thu, 21 Nov 2024 18:55:08 +0000" - - - Block Number: 11 - Block Hash: 0x5cfe5be68a2b4d101fa9b28c5c0f2bef9808779c1a52a3d5e750417c8be7517b - Block Time: "Thu, 21 Nov 2024 18:55:10 +0000" - - - Block Number: 12 - Block Hash: 0x032c5e23f47b79d1f903e541bcc62ecf38d73fc9e54493ee545e8c92ffe398ec - Block Time: "Thu, 21 Nov 2024 18:55:12 +0000" - - - Block Number: 13 - Block Hash: 0xb6b55dd9fce95d56935feca85ac93b0638596d431d38d166cfcf479c50c2746c - Block Time: "Thu, 21 Nov 2024 18:55:14 +0000" - - - Block Number: 14 - Block Hash: 0xef8a59ac36bae37e15acb44886355bb529e87267ef71d529144430fbde2b98a1 - Block Time: "Thu, 21 Nov 2024 18:55:16 +0000" - - - Block Number: 15 - Block Hash: 0xbdb3cd58a3d2bcfc4793517e88f82a892c4e8a4da06c4a5c89c0377999a855c5 - Block Time: "Thu, 21 Nov 2024 18:55:18 +0000" - - - Block Number: 16 - Block Hash: 0x6cae14e47150731426ef26c2394d1011d25fe54cf98f3ba10e215c8841b4a482 - Block Time: "Thu, 21 Nov 2024 18:55:20 +0000" - - - Block Number: 17 - Block Hash: 0x5b6e9926b66e47eeb381c108a9b0673f19c79e6a52fb0db8533871b864531e11 - Block Time: "Thu, 21 Nov 2024 18:55:22 +0000" - diff --git a/tryfile/anvil-902.log b/tryfile/anvil-902.log deleted file mode 100644 index c8504e5a..00000000 --- a/tryfile/anvil-902.log +++ /dev/null @@ -1,258 +0,0 @@ - - - _ _ - (_) | | - __ _ _ __ __ __ _ | | - / _` | | '_ \ \ \ / / | | | | - | (_| | | | | | \ V / | | | | - \__,_| |_| |_| \_/ |_| |_| - - 0.2.0 (2559899 2024-10-25T00:22:15.633229410Z) - https://github.com/foundry-rs/foundry - -Available Accounts -================== - -(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH) -(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000.000000000000000000 ETH) -(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000.000000000000000000 ETH) -(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000.000000000000000000 ETH) -(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000.000000000000000000 ETH) -(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000.000000000000000000 ETH) -(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000.000000000000000000 ETH) -(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000.000000000000000000 ETH) -(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000.000000000000000000 ETH) -(9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (10000.000000000000000000 ETH) - -Private Keys -================== - -(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 -(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d -(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a -(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 -(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a -(5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba -(6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e -(7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 -(8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 -(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 - -Wallet -================== -Mnemonic: test test test test test test test test test test test junk -Derivation path: m/44'/60'/0'/0/ - - -Chain ID -================== - -902 - -Base Fee -================== - -1000000000 - -Gas Limit -================== - -30000000 - -Genesis Timestamp -================== - -1732215287 - -Listening on 127.0.0.1:32933 -evm_setIntervalMining -debug_traceCall -eth_sendRawTransaction -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt -eth_getTransactionReceipt - - Transaction: 0x547050910192478cdbeda0875d62f4f44ce28b42bc3adcd5663b1ebe4f01d755 - Gas used: 95774 - - Block Number: 1 - Block Hash: 0x53faae1d7488094da452e1cf444dd446ad5722c57f8e274ac01c7e4bdf55af75 - Block Time: "Thu, 21 Nov 2024 18:54:49 +0000" - -eth_getTransactionReceipt - - Block Number: 2 - Block Hash: 0x77db502e9ef0629d85d14bd602f45c67dad13994adfe95aa48cf95ad21aa0e54 - Block Time: "Thu, 21 Nov 2024 18:54:51 +0000" - - - Block Number: 3 - Block Hash: 0x4c8b6774459c4da75588bd626adb0205681916f23aab347c804b6d3dd0954b10 - Block Time: "Thu, 21 Nov 2024 18:54:53 +0000" - - - Block Number: 4 - Block Hash: 0x20b34df39b688eb947ab155d9403c9c46b5a2119738be0a5bfc080357dd0b685 - Block Time: "Thu, 21 Nov 2024 18:54:55 +0000" - - - Block Number: 5 - Block Hash: 0x22ec08402c74e8a834d65316302ee8866e6e8f3eb9a35a5aae7a39c3fa7d8cc9 - Block Time: "Thu, 21 Nov 2024 18:54:57 +0000" - - - Block Number: 6 - Block Hash: 0x375a3e311869c186e559806af3b485463433c814e073b2851de227ffc0dcb7f0 - Block Time: "Thu, 21 Nov 2024 18:54:59 +0000" - - - Block Number: 7 - Block Hash: 0xaa5640f7acaacf687c0284c24fcd0e12f571e2acc3c2d5e138ff488772b4f4a6 - Block Time: "Thu, 21 Nov 2024 18:55:01 +0000" - - - Block Number: 8 - Block Hash: 0x6917c4cdecc5988b55d4c4f45b7bbe59b66383349f40eaf117dd62df64da3351 - Block Time: "Thu, 21 Nov 2024 18:55:03 +0000" - - - Block Number: 9 - Block Hash: 0x7f8fb2b917c4f3877ba8a0c4bfd20af3445c0957d9d1a56dc9b1c9ce6d65c507 - Block Time: "Thu, 21 Nov 2024 18:55:05 +0000" - - - Block Number: 10 - Block Hash: 0x81c0ee99bcc1ef77dbe4de201abb85743525ca5eef1a2e5a8562548a0e9c3291 - Block Time: "Thu, 21 Nov 2024 18:55:07 +0000" - - - Block Number: 11 - Block Hash: 0x388729f247a182d6ab8f987d47467ac411519fad61308354e5b453545e7ce498 - Block Time: "Thu, 21 Nov 2024 18:55:09 +0000" - - - Block Number: 12 - Block Hash: 0x06248f44f5e56e90e6b84c629dbd323de7a78647e67a055a4d57a8e620f23850 - Block Time: "Thu, 21 Nov 2024 18:55:11 +0000" - - - Block Number: 13 - Block Hash: 0x5cd7d579cf4e37b00d1166d62b500338b6fd884fcb05fe5e4222d3038899d575 - Block Time: "Thu, 21 Nov 2024 18:55:13 +0000" - - - Block Number: 14 - Block Hash: 0x53d5f6de58e1f6ff68ba0b743ed26b687e160ef40107a56ff6fe04e301e58338 - Block Time: "Thu, 21 Nov 2024 18:55:15 +0000" - - - Block Number: 15 - Block Hash: 0x6e694868e2d19db961895f45fb67c9347447b0232c0d566e35228cd6a8f02fb1 - Block Time: "Thu, 21 Nov 2024 18:55:17 +0000" - - - Block Number: 16 - Block Hash: 0xb7ff762701f204eb71f634a24a217aec188cdac468873197078290b68c11d2d7 - Block Time: "Thu, 21 Nov 2024 18:55:19 +0000" - - - Block Number: 17 - Block Hash: 0x9844ad39ec9da8fd2dca88fcd447bf6ee8d43b45d78866c81f2b2af8832963cd - Block Time: "Thu, 21 Nov 2024 18:55:21 +0000" -