From cfb5e6e2ee497f953ab1ef7013e5fe2b501d7c72 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Mon, 16 Dec 2024 19:47:00 -0500 Subject: [PATCH] chifra state --call converted to chifra state --call --calldata --- docs | 2 +- sdk | 2 +- src/apps/chifra/cmd/state.go | 19 +- src/apps/chifra/internal/state/README.md | 13 +- src/apps/chifra/internal/state/handle_call.go | 9 +- .../chifra/internal/state/handle_decache.go | 4 +- src/apps/chifra/internal/state/handle_send.go | 20 + src/apps/chifra/internal/state/options.go | 28 +- src/apps/chifra/internal/state/output.go | 4 +- src/apps/chifra/internal/state/validate.go | 93 ++-- src/apps/chifra/pkg/call/call.go | 4 +- .../chifra/pkg/configtypes/chain_group.go | 2 +- src/apps/chifra/pkg/configtypes/config.go | 4 - src/apps/chifra/pkg/index/checkVersion.go | 4 +- src/apps/chifra/pkg/logger/colored.go | 10 +- src/apps/chifra/pkg/logger/timer.go | 3 +- src/apps/chifra/pkg/manifest/download.go | 2 +- src/apps/chifra/pkg/pricing/maker.go | 2 +- src/apps/chifra/pkg/pricing/uniswap.go | 4 +- src/apps/chifra/pkg/types/types_abi.go | 4 + src/apps/chifra/pkg/types/types_chunkstats.go | 4 + src/apps/chifra/pkg/types/types_manifest.go | 8 + src/apps/chifra/pkg/types/types_session.go | 442 ------------------ src/apps/chifra/pkg/types/types_status.go | 1 + src/apps/chifra/pkg/utils/paths.go | 6 + .../goMaker/templates/cmd-line-options.csv | 16 +- src/dev_tools/sdkFuzzer/state.go | 13 +- src/dev_tools/testRunner/testCases/status.csv | 6 +- tests | 2 +- 29 files changed, 204 insertions(+), 527 deletions(-) create mode 100644 src/apps/chifra/internal/state/handle_send.go delete mode 100644 src/apps/chifra/pkg/types/types_session.go diff --git a/docs b/docs index 8245e24678..c8e75b7c4a 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8245e246781f38facf36814c50f6ee36e02364d7 +Subproject commit c8e75b7c4a52cf5edcaf63088c42ee5fa3adb16a diff --git a/sdk b/sdk index 2a0f9d3fa6..4ef6dee065 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 2a0f9d3fa60b510513279299256e1a689f4c5f21 +Subproject commit 4ef6dee065664631c16d2dc298b1e3f9a2c511c4 diff --git a/src/apps/chifra/cmd/state.go b/src/apps/chifra/cmd/state.go index 6f7891055e..0ad6a946ed 100644 --- a/src/apps/chifra/cmd/state.go +++ b/src/apps/chifra/cmd/state.go @@ -52,9 +52,13 @@ Notes: - If the queried node does not store historical state, the results are undefined. - Special blocks are detailed under chifra when --list. - Balance is the default mode. To select a single mode use none first, followed by that mode. - - Valid parameters for --call include Solidity-like syntax: balanceOf(0x316b...183d), a four-byte followed by parameters: 0x70a08231(0x316b...183d), or encoded input data. + - Valid parameters for --calldata include Solidity-like syntax: balanceOf(0x316b...), a four-byte followed by parameters: 0x70a08231(0x316b...), or encoded input data. - You may specify multiple parts on a single line. - - In the --call string, you may separate multiple calls with a colon.` + - In the --call string, you may separate multiple calls with a colon. + - Your use of the unaudited --send option legally absolves TrueBlocks, LLC or any associated parties from liability or loss related to such use. + - The --send option does not validate its input before sending your transaction to the network. If you provide invalid data, you may lose your funds. Be warned. + - As of version 4.0.0, use --call --calldata to provide your command. + - --calldata may be one or more colon-seperated solidity calls, four-byte plus parameters, or encoded call data strings.` func init() { var capabilities caps.Capability // capabilities for chifra state @@ -69,9 +73,14 @@ func init() { One or more of [ balance | nonce | code | proxy | deployed | accttype | some | all ]`) stateCmd.Flags().BoolVarP(&statePkg.GetOptions().Changes, "changes", "c", false, `only report a balance when it changes from one block to the next`) stateCmd.Flags().BoolVarP(&statePkg.GetOptions().NoZero, "no_zero", "z", false, `suppress the display of zero balance accounts`) - stateCmd.Flags().StringVarP(&statePkg.GetOptions().Call, "call", "l", "", `call a smart contract with one or more solidity calls, four-byte plus parameters, or encoded call data strings`) - stateCmd.Flags().BoolVarP(&statePkg.GetOptions().Articulate, "articulate", "a", false, `for the --call option only, articulate the retrieved data if ABIs can be found`) - stateCmd.Flags().StringVarP(&statePkg.GetOptions().ProxyFor, "proxy_for", "r", "", `for the --call option only, redirects calls to this implementation`) + stateCmd.Flags().BoolVarP(&statePkg.GetOptions().Call, "call", "l", false, `write-only call (a query) to a smart contract`) + stateCmd.Flags().BoolVarP(&statePkg.GetOptions().Send, "send", "s", false, `writes a transaction to an address (see docs for more information) (hidden)`) + stateCmd.Flags().StringVarP(&statePkg.GetOptions().Calldata, "calldata", "d", "", `for commands (--call or --send), provides the call data (in various forms) for the command (may be empty for --send)`) + stateCmd.Flags().BoolVarP(&statePkg.GetOptions().Articulate, "articulate", "a", false, `for commands only, articulate the retrieved data if ABIs can be found`) + stateCmd.Flags().StringVarP(&statePkg.GetOptions().ProxyFor, "proxy_for", "r", "", `for commands only, redirects calls to this implementation`) + if os.Getenv("TEST_MODE") != "true" { + _ = stateCmd.Flags().MarkHidden("send") + } globals.InitGlobals("state", stateCmd, &statePkg.GetOptions().Globals, capabilities) stateCmd.SetUsageTemplate(UsageWithNotes(notesState)) diff --git a/src/apps/chifra/internal/state/README.md b/src/apps/chifra/internal/state/README.md index bed61b8c45..955ab3fb9f 100644 --- a/src/apps/chifra/internal/state/README.md +++ b/src/apps/chifra/internal/state/README.md @@ -23,9 +23,10 @@ Flags: One or more of [ balance | nonce | code | proxy | deployed | accttype | some | all ] -c, --changes only report a balance when it changes from one block to the next -z, --no_zero suppress the display of zero balance accounts - -l, --call string call a smart contract with one or more solidity calls, four-byte plus parameters, or encoded call data strings - -a, --articulate for the --call option only, articulate the retrieved data if ABIs can be found - -r, --proxy_for string for the --call option only, redirects calls to this implementation + -l, --call write-only call (a query) to a smart contract + -d, --calldata string for commands (--call or --send), provides the call data (in various forms) for the command (may be empty for --send) + -a, --articulate for commands only, articulate the retrieved data if ABIs can be found + -r, --proxy_for string for commands only, redirects calls to this implementation -H, --ether specify value in ether -o, --cache force the results of the query into the cache -D, --decache removes related items from the cache @@ -39,9 +40,13 @@ Notes: - If the queried node does not store historical state, the results are undefined. - Special blocks are detailed under chifra when --list. - Balance is the default mode. To select a single mode use none first, followed by that mode. - - Valid parameters for --call include Solidity-like syntax: balanceOf(0x316b...183d), a four-byte followed by parameters: 0x70a08231(0x316b...183d), or encoded input data. + - Valid parameters for --calldata include Solidity-like syntax: balanceOf(0x316b...), a four-byte followed by parameters: 0x70a08231(0x316b...), or encoded input data. - You may specify multiple parts on a single line. - In the --call string, you may separate multiple calls with a colon. + - Your use of the unaudited --send option legally absolves TrueBlocks, LLC or any associated parties from liability or loss related to such use. + - The --send option does not validate its input before sending your transaction to the network. If you provide invalid data, you may lose your funds. Be warned. + - As of version 4.0.0, use --call --calldata to provide your command. + - --calldata may be one or more colon-seperated solidity calls, four-byte plus parameters, or encoded call data strings. ``` Data models produced by this tool: diff --git a/src/apps/chifra/internal/state/handle_call.go b/src/apps/chifra/internal/state/handle_call.go index 1f65b7b90c..a2a3c32616 100644 --- a/src/apps/chifra/internal/state/handle_call.go +++ b/src/apps/chifra/internal/state/handle_call.go @@ -28,7 +28,7 @@ func (opts *StateOptions) HandleCall(rCtx *output.RenderCtx) error { return articulate.ArticulateFunction(function, "", str[2:]) } - callAddress := opts.GetCallAddress() + callAddress := opts.GetAddressOrProxy() fetchData := func(modelChan chan types.Modeler, errorChan chan error) { apps, _, err := identifiers.IdsToApps(chain, opts.BlockIds) if err != nil { @@ -65,7 +65,7 @@ func (opts *StateOptions) HandleCall(rCtx *output.RenderCtx) error { for _, c := range opts.Calls { if contractCall, _, err := call.NewContractCall(opts.Conn, callAddress, c); err != nil { delete(thisMap, app) - return fmt.Errorf("the --call value provided (%s) was not found: %s", c, err) + return fmt.Errorf("the --calldata value provided (%s) was not found: %s", c, err) } else { contractCall.BlockNumber = bn @@ -117,9 +117,8 @@ func (opts *StateOptions) HandleCall(rCtx *output.RenderCtx) error { return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOptsWithExtra(extraOpts)) } -func (opts *StateOptions) GetCallAddress() base.Address { - // Note that the validator precludes the possibility of having more than one address - // if the call option is present. +func (opts *StateOptions) GetAddressOrProxy() base.Address { + // Note that validtor makes sure there's exactly one address for --call or --send. callAddress := base.HexToAddress(opts.Addrs[0]) proxy := base.HexToAddress(opts.ProxyFor) if !proxy.IsZero() { diff --git a/src/apps/chifra/internal/state/handle_decache.go b/src/apps/chifra/internal/state/handle_decache.go index 80a6dabfc8..59645224e0 100644 --- a/src/apps/chifra/internal/state/handle_decache.go +++ b/src/apps/chifra/internal/state/handle_decache.go @@ -56,9 +56,9 @@ func (opts *StateOptions) getItemsToRemove() ([]cache.Locator, error) { for _, c := range opts.Calls { if len(c) > 0 { - callAddress := opts.GetCallAddress() + callAddress := opts.GetAddressOrProxy() if contractCall, _, err := call.NewContractCall(opts.Conn, callAddress, c); err != nil { - wrapped := fmt.Errorf("the --call value provided (%s) was not found: %s", c, err) + wrapped := fmt.Errorf("the --calldata value provided (%s) was not found: %s", c, err) return []cache.Locator{}, wrapped } else { diff --git a/src/apps/chifra/internal/state/handle_send.go b/src/apps/chifra/internal/state/handle_send.go new file mode 100644 index 0000000000..ea2974cbe3 --- /dev/null +++ b/src/apps/chifra/internal/state/handle_send.go @@ -0,0 +1,20 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package statePkg + +import ( + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" +) + +func (opts *StateOptions) HandleSend(rCtx *output.RenderCtx) error { + fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + modelChan <- &types.Result{ + Name: "I am not right", + } + } + + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) +} diff --git a/src/apps/chifra/internal/state/options.go b/src/apps/chifra/internal/state/options.go index 62803230cc..7ce2bc1fab 100644 --- a/src/apps/chifra/internal/state/options.go +++ b/src/apps/chifra/internal/state/options.go @@ -35,9 +35,11 @@ type StateOptions struct { Parts []string `json:"parts,omitempty"` // Control which state to export Changes bool `json:"changes,omitempty"` // Only report a balance when it changes from one block to the next NoZero bool `json:"noZero,omitempty"` // Suppress the display of zero balance accounts - Call string `json:"call,omitempty"` // Call a smart contract with one or more solidity calls, four-byte plus parameters, or encoded call data strings - Articulate bool `json:"articulate,omitempty"` // For the --call option only, articulate the retrieved data if ABIs can be found - ProxyFor string `json:"proxyFor,omitempty"` // For the --call option only, redirects calls to this implementation + Call bool `json:"call,omitempty"` // Write-only call (a query) to a smart contract + Send bool `json:"send,omitempty"` // Writes a transaction to an address (see docs for more information) + Calldata string `json:"calldata,omitempty"` // For commands (--call or --send), provides the call data (in various forms) for the command (may be empty for --send) + Articulate bool `json:"articulate,omitempty"` // For commands only, articulate the retrieved data if ABIs can be found + ProxyFor string `json:"proxyFor,omitempty"` // For commands only, redirects calls to this implementation Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server BadFlag error `json:"badFlag,omitempty"` // An error flag if needed @@ -55,7 +57,9 @@ func (opts *StateOptions) testLog() { logger.TestLog(len(opts.Parts) > 0, "Parts: ", opts.Parts) logger.TestLog(opts.Changes, "Changes: ", opts.Changes) logger.TestLog(opts.NoZero, "NoZero: ", opts.NoZero) - logger.TestLog(len(opts.Call) > 0, "Call: ", opts.Call) + logger.TestLog(opts.Call, "Call: ", opts.Call) + logger.TestLog(opts.Send, "Send: ", opts.Send) + logger.TestLog(len(opts.Calldata) > 0, "Calldata: ", opts.Calldata) logger.TestLog(opts.Articulate, "Articulate: ", opts.Articulate) logger.TestLog(len(opts.ProxyFor) > 0, "ProxyFor: ", opts.ProxyFor) opts.Conn.TestLog(opts.getCaches()) @@ -103,7 +107,11 @@ func StateFinishParseInternal(w io.Writer, values url.Values) *StateOptions { case "noZero": opts.NoZero = true case "call": - opts.Call = value[0] + opts.Call = true + case "send": + opts.Send = true + case "calldata": + opts.Calldata = value[0] case "articulate": opts.Articulate = true case "proxyFor": @@ -120,8 +128,8 @@ func StateFinishParseInternal(w io.Writer, values url.Values) *StateOptions { opts.Conn = opts.Globals.FinishParseApi(w, values, opts.getCaches()) // EXISTING_CODE - opts.Call = strings.Replace(strings.Trim(opts.Call, "'"), "'", "\"", -1) - opts.Calls = strings.Split(opts.Call, ":") + opts.Calldata = strings.Replace(strings.Trim(opts.Calldata, "'"), "'", "\"", -1) + opts.Calls = strings.Split(opts.Calldata, ":") if len(opts.Blocks) == 0 { if opts.Globals.TestMode { opts.Blocks = []string{"17000000"} @@ -163,8 +171,8 @@ func stateFinishParse(args []string) *StateOptions { opts.Blocks = append(opts.Blocks, arg) } } - opts.Call = strings.Replace(strings.Trim(opts.Call, "'"), "'", "\"", -1) - opts.Calls = strings.Split(opts.Call, ":") + opts.Calldata = strings.Replace(strings.Trim(opts.Calldata, "'"), "'", "\"", -1) + opts.Calls = strings.Split(opts.Calldata, ":") if len(opts.Blocks) == 0 { if opts.Globals.TestMode { opts.Blocks = []string{"17000000"} @@ -214,7 +222,7 @@ func (opts *StateOptions) getCaches() (caches map[walk.CacheType]bool) { // EXISTING_CODE caches = map[walk.CacheType]bool{ walk.Cache_State: true, - walk.Cache_Results: len(opts.Call) > 0, + walk.Cache_Results: opts.Call || opts.Send, } // EXISTING_CODE return diff --git a/src/apps/chifra/internal/state/output.go b/src/apps/chifra/internal/state/output.go index 90c015cd4d..1dbef5f2ef 100644 --- a/src/apps/chifra/internal/state/output.go +++ b/src/apps/chifra/internal/state/output.go @@ -56,8 +56,10 @@ func (opts *StateOptions) StateInternal(rCtx *output.RenderCtx) error { // EXISTING_CODE if opts.Globals.Decache { err = opts.HandleDecache(rCtx) - } else if len(opts.Call) > 0 { + } else if opts.Call { err = opts.HandleCall(rCtx) + } else if opts.Send { + err = opts.HandleSend(rCtx) } else { err = opts.HandleShow(rCtx) } diff --git a/src/apps/chifra/internal/state/validate.go b/src/apps/chifra/internal/state/validate.go index a93a384e0d..273609eb0f 100644 --- a/src/apps/chifra/internal/state/validate.go +++ b/src/apps/chifra/internal/state/validate.go @@ -37,59 +37,70 @@ func (opts *StateOptions) validateState() error { // do nothing for now } else { - if len(opts.Call) > 0 { + if opts.Call && opts.Send { + return validate.Usage("The {0} and {1} options are mutually exclusive.", "--call", "--send") + } + + if opts.Call || opts.Send { + if len(opts.Calldata) == 0 { + return validate.Usage("The {0} option requires at least one {1} command.", "--call", "--calldata") + } + if len(opts.Parts) > 0 { - return validate.Usage("The {0} option is not available{1}.", "--parts", " with the --call option") + return validate.Usage("The {0} option is not available{1}.", "--parts", " with the --call or --send option") } if opts.Changes { - return validate.Usage("The {0} option is not available{1}.", "--changes", " with the --call option") + return validate.Usage("The {0} option is not available{1}.", "--changes", " with the --call or --send option") } if opts.NoZero { - return validate.Usage("The {0} option is not available{1}.", "--no_zero", " with the --call option") + return validate.Usage("The {0} option is not available{1}.", "--no_zero", " with the --call or --send option") } if len(opts.Addrs) != 1 { - return validate.Usage("Exactly one address is required for the {0} option.", "--call") + return validate.Usage("Exactly one address is required for the {0} option.", "--call or --send") } - callAddress := opts.GetCallAddress() - err := opts.Conn.IsContractAtLatest(base.HexToAddress(callAddress.Hex())) - if err != nil { - if errors.Is(err, rpc.ErrNotAContract) { - return validate.Usage("The address for the --call option must be a smart contract.") - } - return err + callAddress := opts.GetAddressOrProxy() + isContract := false + if err = opts.Conn.IsContractAtLatest(base.HexToAddress(callAddress.Hex())); err == nil { + isContract = true } - // Before we do anythinng, let's just make sure we have a valid four-byte - for _, c := range opts.Calls { - if _, suggestions, err := call.NewContractCall(opts.Conn, callAddress, c); err != nil { - message := fmt.Sprintf("the --call value provided (%s) was not found: %s", c, err) - if len(suggestions) > 0 { - if len(suggestions) > 0 { - message += " Suggestions: " - for index, suggestion := range suggestions { - if index > 0 { - message += " " - } - message += fmt.Sprintf("%d: %s.", index+1, suggestion) - } - } + if opts.Send { + // Sends with no call data are okay to either smart contracts or regular accounts. + if isContract { + if err := opts.checkCommands(callAddress, opts.Send); err != nil { + return err + } + } + + } else if opts.Call { + if isContract { + if err := opts.checkCommands(callAddress, opts.Send); err != nil { + return err + } + } else { + if errors.Is(err, rpc.ErrNotAContract) { + return validate.Usage("The address for the --call option must be a smart contract.") } - return errors.New(message) + return err } } } else { + if len(opts.Calldata) > 0 { + return validate.Usage("The {0} option is only available with the {1} option.", "--calldata", "--call or --send") + } + if opts.Articulate { - return validate.Usage("The {0} option is only available with the {1} option.", "--articulate", "--call") + return validate.Usage("The {0} option is only available with the {1} option.", "--articulate", "--call or --send") } proxy := base.HexToAddress(opts.ProxyFor) if !proxy.IsZero() { - return validate.Usage("The {0} option is only available with the {1} option.", "--proxy_for", "--call") + return validate.Usage("The {0} option is only available with the {1} option.", "--proxy_for", "--call or --send") } err := validate.ValidateAtLeastOneAddr(opts.Addrs) @@ -134,3 +145,27 @@ func (opts *StateOptions) validateState() error { return opts.Globals.Validate() } + +func (opts *StateOptions) checkCommands(callAddress base.Address, isSend bool) error { + if len(opts.Calldata) == 0 && !isSend { + return validate.Usage("The {0} option requires at least one command.", "--call") + } + + // an empty list of commands is okay... + for _, cmd := range opts.Calls { + if _, suggestions, err := call.NewContractCall(opts.Conn, callAddress, cmd); err != nil { + message := fmt.Sprintf("the --calldata value provided (%s) was not found: %s", cmd, err) + if len(suggestions) > 0 { + message += " Suggestions: " + for index, suggestion := range suggestions { + if index > 0 { + message += " " + } + message += fmt.Sprintf("%d: %s.", index+1, suggestion) + } + } + return errors.New(message) + } + } + return nil +} diff --git a/src/apps/chifra/pkg/call/call.go b/src/apps/chifra/pkg/call/call.go index 4ecda3f30d..b52d19121d 100644 --- a/src/apps/chifra/pkg/call/call.go +++ b/src/apps/chifra/pkg/call/call.go @@ -28,7 +28,7 @@ type ContractCall struct { func NewContractCallWithAbi(conn *rpc.Connection, callAddress base.Address, theCall string, abiMap *abi.SelectorSyncMap) (*ContractCall, []string, error) { parsed, err := parser.ParseCall(theCall) if err != nil { - err = fmt.Errorf("the value provided --call (%s) is invalid", theCall) + err = fmt.Errorf("the value provided (%s) is invalid", theCall) return nil, []string{}, err } @@ -100,7 +100,7 @@ func NewContractCall(conn *rpc.Connection, callAddress base.Address, theCall str parsed, err := parser.ParseCall(theCall) if err != nil { - err = fmt.Errorf("the value provided --call (%s) is invalid", theCall) + err = fmt.Errorf("the value provided (%s) is invalid", theCall) return nil, []string{}, err } diff --git a/src/apps/chifra/pkg/configtypes/chain_group.go b/src/apps/chifra/pkg/configtypes/chain_group.go index 8090e95a8a..e99add6df8 100644 --- a/src/apps/chifra/pkg/configtypes/chain_group.go +++ b/src/apps/chifra/pkg/configtypes/chain_group.go @@ -8,7 +8,7 @@ type ChainGroup struct { IpfsGateway string `json:"ipfsGateway" toml:"ipfsGateway,omitempty"` KeyEndpoint string `json:"keyEndpoint" toml:"keyEndpoint,omitempty"` LocalExplorer string `json:"localExplorer" toml:"localExplorer,omitempty"` - RemoteExplorer string `json:"removeExplorer" toml:"remoteExplorer,omitempty"` + RemoteExplorer string `json:"remoteExplorer" toml:"remoteExplorer,omitempty"` RpcProvider string `json:"rpcProvider" toml:"rpcProvider"` Symbol string `json:"symbol" toml:"symbol"` Scrape ScrapeSettings `json:"scrape" toml:"scrape"` diff --git a/src/apps/chifra/pkg/configtypes/config.go b/src/apps/chifra/pkg/configtypes/config.go index 55704a1230..74c2ac4e85 100644 --- a/src/apps/chifra/pkg/configtypes/config.go +++ b/src/apps/chifra/pkg/configtypes/config.go @@ -24,10 +24,6 @@ func (s *Config) String() string { return string(bytes) } -func (s *Config) ShallowCopy() Config { - return *s -} - func NewConfig(cachePath, indexPath, defaultIpfs string) Config { ret := defaultConfig ret.Settings.CachePath = cachePath diff --git a/src/apps/chifra/pkg/index/checkVersion.go b/src/apps/chifra/pkg/index/checkVersion.go index f91acd1dbf..205140f642 100644 --- a/src/apps/chifra/pkg/index/checkVersion.go +++ b/src/apps/chifra/pkg/index/checkVersion.go @@ -27,9 +27,11 @@ func IsInitialized(chain, required string) error { (and allow it to complete) or 'chifra scrape' before using this command. Error: %w + Chain: %s + Path: %s ` - return fmt.Errorf(indexNotInitialized, ErrNotInitialized) + return fmt.Errorf(indexNotInitialized, ErrNotInitialized, chain, fileName) } var err error diff --git a/src/apps/chifra/pkg/logger/colored.go b/src/apps/chifra/pkg/logger/colored.go index 5d5fd16cfc..1d16aa6c57 100644 --- a/src/apps/chifra/pkg/logger/colored.go +++ b/src/apps/chifra/pkg/logger/colored.go @@ -5,9 +5,13 @@ import ( ) func toColored(s severity, color string, v ...any) { - args := append([]interface{}{color}, v...) - args = append(args, colors.Off) - toLog(s, args...) + if firstElement, ok := v[0].(string); ok { + v[0] = color + firstElement + } else { + v = append([]interface{}{color}, v...) + } + v = append(v, colors.Off) + toLog(s, v...) } func InfoR(v ...any) { diff --git a/src/apps/chifra/pkg/logger/timer.go b/src/apps/chifra/pkg/logger/timer.go index 005f3b9dc9..846f32ae15 100644 --- a/src/apps/chifra/pkg/logger/timer.go +++ b/src/apps/chifra/pkg/logger/timer.go @@ -69,8 +69,7 @@ func (t *Timer) Report(msg string) { return y } - // nItems := 0 - fmt.Printf("PERF,%s%s,%d,%d\n", strings.Repeat("_", t.level), msg, max(1, since.Milliseconds()), max(1, diff.Milliseconds())) + Info(fmt.Sprintf("PERF,%s%s,%d,%d\n", strings.Repeat("_", t.level), msg, max(1, since.Milliseconds()), max(1, diff.Milliseconds()))) t.lastReport = time.Now() } diff --git a/src/apps/chifra/pkg/manifest/download.go b/src/apps/chifra/pkg/manifest/download.go index b3f4e24b6c..58e7ebaa2c 100644 --- a/src/apps/chifra/pkg/manifest/download.go +++ b/src/apps/chifra/pkg/manifest/download.go @@ -46,7 +46,7 @@ func ReadUnchainedIndex(chain string, publisher base.Address, database string) ( theCall := fmt.Sprintf("manifestHashMap(%s, \"%s\")", publisher, database) if contractCall, _, err := call.NewContractCallWithAbi(conn, callAddress, theCall, abiMap); err != nil { - wrapped := fmt.Errorf("the --call value provided (%s) was not found: %s", theCall, err) + wrapped := fmt.Errorf("the --calldata value provided (%s) was not found: %s", theCall, err) return "", wrapped } else { contractCall.BlockNumber = conn.GetLatestBlockNumber() diff --git a/src/apps/chifra/pkg/pricing/maker.go b/src/apps/chifra/pkg/pricing/maker.go index 3ec7f1b7d5..c15a2d680b 100644 --- a/src/apps/chifra/pkg/pricing/maker.go +++ b/src/apps/chifra/pkg/pricing/maker.go @@ -30,7 +30,7 @@ func priceUsdMaker(conn *rpc.Connection, statement *types.Statement) (price base contractCall, _, err := call.NewContractCall(conn, makerMedianizer, theCall) if err != nil { - wrapped := fmt.Errorf("the --call value provided (%s) was not found: %s", theCall, err) + wrapped := fmt.Errorf("the --calldata value provided (%s) was not found: %s", theCall, err) return 0.0, "not-priced", wrapped } diff --git a/src/apps/chifra/pkg/pricing/uniswap.go b/src/apps/chifra/pkg/pricing/uniswap.go index f05a562d2b..b6c9b32ee9 100644 --- a/src/apps/chifra/pkg/pricing/uniswap.go +++ b/src/apps/chifra/pkg/pricing/uniswap.go @@ -50,7 +50,7 @@ func priceUsdUniswap(conn *rpc.Connection, statement *types.Statement) (price ba theCall1 := fmt.Sprintf("getPair(%s, %s)", first.Hex(), second.Hex()) contractCall, _, err := call.NewContractCall(conn, uniswapFactoryV2, theCall1) if err != nil { - wrapped := fmt.Errorf("the --call value provided (%s) was not found: %s", theCall1, err) + wrapped := fmt.Errorf("the --calldata value provided (%s) was not found: %s", theCall1, err) return 0.0, "not-priced", wrapped } contractCall.BlockNumber = statement.BlockNumber @@ -70,7 +70,7 @@ func priceUsdUniswap(conn *rpc.Connection, statement *types.Statement) (price ba theCall2 := "getReserves()" contractCall, _, err = call.NewContractCall(conn, pairAddress, theCall2) if err != nil { - wrapped := fmt.Errorf("the --call value provided (%s) was not found: %s", theCall2, err) + wrapped := fmt.Errorf("the --calldata value provided (%s) was not found: %s", theCall2, err) return 0.0, "not-priced", wrapped } contractCall.BlockNumber = statement.BlockNumber diff --git a/src/apps/chifra/pkg/types/types_abi.go b/src/apps/chifra/pkg/types/types_abi.go index 79948b17fc..05c46b79c1 100644 --- a/src/apps/chifra/pkg/types/types_abi.go +++ b/src/apps/chifra/pkg/types/types_abi.go @@ -130,4 +130,8 @@ func (s *Abi) FinishUnmarshal() { } // EXISTING_CODE +func (s *Abi) ShallowCopy() Abi { + return *s +} + // EXISTING_CODE diff --git a/src/apps/chifra/pkg/types/types_chunkstats.go b/src/apps/chifra/pkg/types/types_chunkstats.go index 4cf21fd106..828c20c3ce 100644 --- a/src/apps/chifra/pkg/types/types_chunkstats.go +++ b/src/apps/chifra/pkg/types/types_chunkstats.go @@ -98,4 +98,8 @@ func (s *ChunkStats) FinishUnmarshal() { } // EXISTING_CODE +func (s *ChunkStats) ShallowCopy() ChunkStats { + return *s +} + // EXISTING_CODE diff --git a/src/apps/chifra/pkg/types/types_manifest.go b/src/apps/chifra/pkg/types/types_manifest.go index 7631e71a67..cb6ebf9d42 100644 --- a/src/apps/chifra/pkg/types/types_manifest.go +++ b/src/apps/chifra/pkg/types/types_manifest.go @@ -65,4 +65,12 @@ func (s *Manifest) FinishUnmarshal() { } // EXISTING_CODE +func (s *Manifest) ShallowCopy() Manifest { + return Manifest{ + Chain: s.Chain, + Specification: s.Specification, + Version: s.Version, + } +} + // EXISTING_CODE diff --git a/src/apps/chifra/pkg/types/types_session.go b/src/apps/chifra/pkg/types/types_session.go deleted file mode 100644 index 6d98ecd184..0000000000 --- a/src/apps/chifra/pkg/types/types_session.go +++ /dev/null @@ -1,442 +0,0 @@ -package types - -import ( - "context" - "encoding/json" - "errors" - "fmt" - - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" - "github.com/wailsapp/wails/v2/pkg/runtime" -) - -// Session stores ephemeral things such as last window position, -// last view, and recent file list. -type Session struct { - LastChain string `json:"lastChain"` - LastFile string `json:"lastFile"` - LastFolder string `json:"lastFolder"` - LastRoute string `json:"lastRoute"` - LastSub map[string]string `json:"lastSub"` - Window Window `json:"window"` - Wizard Wizard `json:"wizard"` - Toggles Toggles `json:"toggles"` - Chain string `json:"-"` -} - -func (s Session) String() string { - bytes, _ := json.Marshal(s) - return string(bytes) -} - -func (s *Session) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { - var model = map[string]any{} - var order = []string{} - - model = map[string]any{ - "lastChain": s.LastChain, - "lastFile": s.LastFile, - "lastFolder": s.LastFolder, - "lastRoute": s.LastRoute, - "window": s.Window, - "wizard": s.Wizard, - "toggles": s.Toggles, - } - order = []string{ - "lastChain", - "lastFile", - "lastFolder", - "lastRoute", - "window", - "wizard", - "toggles", - } - - return Model{model, order} -} - -func (s *Session) FinishUnmarshal() { - // EXISTING_CODE - // EXISTING_CODE -} - -func (s *Session) ShallowCopy() Session { - return *s -} - -const theTitle = "Browse by TrueBlocks" - -var defLayout = Layout{ - Header: true, - Menu: true, - Help: true, - Footer: true, -} - -var defHeader = Headers{ - Project: false, - History: true, - Monitors: false, - Names: false, - Abis: false, - Indexes: false, - Manifests: false, - Status: true, - Settings: true, -} - -var defDaemons = Daemons{ - Freshen: true, -} - -var defaultSession = Session{ - LastChain: "mainnet", - LastFile: "Untitled.tbx", - LastRoute: "/wizard", - LastSub: map[string]string{"/history": "0xf503017d7baf7fbc0fff7492b751025c6a78179b"}, - Window: Window{ - X: 0, - Y: 0, - Width: 0, - Height: 0, - Title: theTitle, - }, - Wizard: Wizard{State: Welcome}, - Toggles: Toggles{ - Layout: defLayout, - Headers: defHeader, - Daemons: defDaemons, - }, -} - -// Save saves the session to the configuration folder. -func (s *Session) Save() error { - if fn, err := utils.GetConfigFn("browse", "session.json"); err != nil { - return err - } else { - if contents, _ := json.MarshalIndent(s, "", " "); len(contents) > 0 { - _ = file.StringToAsciiFile(fn, string(contents)) - } - return nil - } -} - -var ErrLoadingSession = errors.New("error loading session") - -// Load loads the session from the configuration folder. If the file contains -// data, we return true. False otherwise. -func (s *Session) Load() error { - loaded := false - defer func() { - if !loaded { - *s = defaultSession - } else { - // Ensure a valid file (if for example the user edited it) - if s.Wizard.State == Okay && s.LastRoute == "/wizard" { - s.LastRoute = "/" - } - if s.LastChain == "" { - s.LastChain = "mainnet" - } - if s.LastFile == "" { - s.LastFile = "Untitled.tbx" - } - } - _ = s.Save() // creates the session file if it doesn't already exist - }() - - fn, err := utils.GetConfigFn("browse", "session.json") - if err != nil { - return fmt.Errorf("%w: %v", ErrLoadingSession, err) - } - - contents := file.AsciiFileToString(fn) - if len(contents) == 0 { - // This is not an error (the default session will be used) - return nil - } - - if err = json.Unmarshal([]byte(contents), s); err != nil { - return fmt.Errorf("%w: %v", ErrLoadingSession, err) - } - - loaded = true - return nil -} - -func (s *Session) SetRoute(route, subRoute string) { - s.LastRoute = route - if len(subRoute) > 0 { - s.LastSub[route] = subRoute - } - _ = s.Save() -} - -var ErrScreenNotFound = errors.New("screen not found") - -// CleanWindowSize ensures a valid window size. (If the app has never run before -// or the session fails to load its width or height will be zero.) This function -// always returns a valid window size, but it may also return an error. -func (s *Session) CleanWindowSize(ctx context.Context) (Window, error) { - // Any window size other than 0,0 is already okay. - if s.Window.Width != 0 && s.Window.Height != 0 { - return s.Window, nil - } - - ret := Window{X: 30, Y: 30, Width: 1024, Height: 768} - defer func() { - _ = s.Save() - }() - - if screens, err := runtime.ScreenGetAll(ctx); err != nil { - return ret, fmt.Errorf("error getting screens %w", err) - - } else { - var fullScreen *Window = nil - for _, screen := range screens { - if screen.IsCurrent || screen.IsPrimary { - fullScreen = &Window{ - Width: screen.Size.Width, - Height: screen.Size.Height, - } - break - } - } - if fullScreen != nil { - // We found the screen, so we can set a reasonable window size. - s.Window.X = fullScreen.Width / 6 - s.Window.Y = fullScreen.Width / 6 - s.Window.Width = (5 * fullScreen.Width) / 6 - s.Window.Height = (5 * fullScreen.Width) / 6 - } - } - return s.Window, nil -} - -type Layout struct { - Header bool `json:"header"` - Menu bool `json:"menu"` - Help bool `json:"help"` - Footer bool `json:"footer"` -} - -type Headers struct { - Project bool `json:"project"` - History bool `json:"history"` - Monitors bool `json:"monitors"` - Names bool `json:"names"` - Abis bool `json:"abis"` - Indexes bool `json:"indexes"` - Manifests bool `json:"manifests"` - Status bool `json:"status"` - Settings bool `json:"settings"` -} - -type Daemons struct { - Freshen bool `json:"freshen"` - Scraper bool `json:"scraper"` - Ipfs bool `json:"ipfs"` -} - -type Toggles struct { - Layout Layout `json:"layout"` - Headers Headers `json:"headers"` - Daemons Daemons `json:"daemons"` -} - -func (t *Toggles) IsOn(which string) bool { - if which == "" { - which = "project" - } - switch which { - case "header": - return t.Layout.Header - case "menu": - return t.Layout.Menu - case "help": - return t.Layout.Help - case "footer": - return t.Layout.Footer - case "project": - return t.Headers.Project - case "history": - return t.Headers.History - case "monitors": - return t.Headers.Monitors - case "names": - return t.Headers.Names - case "abis": - return t.Headers.Abis - case "indexes": - return t.Headers.Indexes - case "manifests": - return t.Headers.Manifests - case "status": - return t.Headers.Status - case "settings": - return t.Headers.Settings - case "freshen": - return t.Daemons.Freshen - case "scraper": - return t.Daemons.Scraper - case "ipfs": - return t.Daemons.Ipfs - } - return false -} - -func (t *Toggles) SetState(which string, onOff bool) { - if which == "" { - which = "project" - } - switch which { - case "header": - t.Layout.Header = onOff - case "menu": - t.Layout.Menu = onOff - case "help": - t.Layout.Help = onOff - case "footer": - t.Layout.Footer = onOff - case "project": - t.Headers.Project = onOff - case "history": - t.Headers.History = onOff - case "monitors": - t.Headers.Monitors = onOff - case "names": - t.Headers.Names = onOff - case "abis": - t.Headers.Abis = onOff - case "indexes": - t.Headers.Indexes = onOff - case "manifests": - t.Headers.Manifests = onOff - case "status": - t.Headers.Status = onOff - case "settings": - t.Headers.Settings = onOff - case "freshen": - t.Daemons.Freshen = onOff - case "scraper": - t.Daemons.Scraper = onOff - case "ipfs": - t.Daemons.Ipfs = onOff - } -} - -// Window stores the last position and title of the window -type Window struct { - X int `json:"x"` - Y int `json:"y"` - Width int `json:"width"` - Height int `json:"height"` - Title string `json:"title"` -} - -func (w *Window) String() string { - bytes, _ := json.Marshal(w) - return string(bytes) -} - -type Wizard struct { - State WizState `json:"state"` -} - -var stateOrder = []WizState{ - Welcome, - Error, - TomlOkay, - RpcOkay, - BloomsOkay, - IndexOkay, - Okay, -} - -func (w *Wizard) Step(step WizStep) { - switch step { - case Reset: - w.State = Error - case Previous: - if w.State == TomlOkay { - w.State = Welcome - } else { - for i := range stateOrder { - if stateOrder[i] == w.State && i > 0 { - w.State = stateOrder[i-1] - break - } - } - } - case Next: - if w.State == Welcome { - w.State = TomlOkay - } else { - for i := range stateOrder { - if stateOrder[i] == w.State && i < len(stateOrder)-1 { - w.State = stateOrder[i+1] - break - } - } - } - case Finish: - w.State = Okay - } -} - -type WizState string - -const ( - Welcome WizState = "welcome" - TomlOkay WizState = "tomlOkay" - RpcOkay WizState = "rpcOkay" - BloomsOkay WizState = "bloomsOkay" - IndexOkay WizState = "indexOkay" - Error WizState = "error" - Okay WizState = "okay" -) - -// String returns the string representation of the WizState. -func (s WizState) String() string { - return string(s) -} - -// AllStates - all possible WizStates for the frontend codegen -var AllStates = []struct { - Value WizState `json:"value"` - TSName string `json:"tsName"` -}{ - {Welcome, "WELCOME"}, - {TomlOkay, "TOMLOKAY"}, - {RpcOkay, "RPCOKAY"}, - {BloomsOkay, "BLOOMSOKAY"}, - {IndexOkay, "INDEXOKAY"}, - {Error, "ERROR"}, - {Okay, "OKAY"}, -} - -type WizStep string - -const ( - Reset WizStep = "Reset" - Previous WizStep = "Previous" - Next WizStep = "Next" - Finish WizStep = "Finish" -) - -// String returns the string representation of the Step. -func (s WizStep) String() string { - return string(s) -} - -// AllSteps - all possible steps for the frontend codegen -var AllSteps = []struct { - Value WizStep `json:"value"` - TSName string `json:"tsName"` -}{ - {Reset, "RESET"}, - {Previous, "PREVIOUS"}, - {Next, "NEXT"}, - {Finish, "FINISH"}, -} diff --git a/src/apps/chifra/pkg/types/types_status.go b/src/apps/chifra/pkg/types/types_status.go index e4bc105b9f..34ff54a13f 100644 --- a/src/apps/chifra/pkg/types/types_status.go +++ b/src/apps/chifra/pkg/types/types_status.go @@ -157,6 +157,7 @@ func (s *Status) ShallowCopy() Status { s.Caches = nil ret := *s s.Caches = caches + ret.Chain = s.Chain return ret } diff --git a/src/apps/chifra/pkg/utils/paths.go b/src/apps/chifra/pkg/utils/paths.go index 3910fdcd3f..2f8da195f0 100644 --- a/src/apps/chifra/pkg/utils/paths.go +++ b/src/apps/chifra/pkg/utils/paths.go @@ -8,6 +8,12 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" ) +// MustGetConfigFn ignore errors on GetConfigFn +func MustGetConfigFn(appDir, fn string) string { + ret, _ := GetConfigFn(appDir, fn) + return ret +} + // GetConfigFn returns the user's (OS-specific) configuration folder. If the folder // is not found, an error is returned. If appDir is not empty, it is appended to // the configDir and if the resulting folder does not exist, it is created. diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index afa16d0a25..fdc096c085 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -201,22 +201,28 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 31000,,Chain State,,,,,,,,group,,,,,,Access to account and token state # 32000,tools,Chain State,state,getState,,,,visible|docs,,command,,,Get balance(s),[flags]
[address...] [block...],default|caching|ether|names|,Retrieve account balance(s) for one or more addresses at given block(s). -32020,tools,Chain State,state,getState,addrs,,,required|visible|docs,2,positional,list,state,,,,one or more addresses (0x...) from which to retrieve balances +32020,tools,Chain State,state,getState,addrs,,,required|visible|docs,3,positional,list,state,,,,one or more addresses (0x...) from which to retrieve balances 32030,tools,Chain State,state,getState,blocks,,,visible|docs,,positional,list,,,,,an optional list of one or more blocks at which to report balances, defaults to 'latest' 32040,tools,Chain State,state,getState,parts,p,,visible|docs,,flag,list,,,,,control which state to export 32050,tools,Chain State,state,getState,changes,c,,visible|docs,,switch,,,,,,only report a balance when it changes from one block to the next 32060,tools,Chain State,state,getState,no_zero,z,,visible|docs,,switch,,,,,,suppress the display of zero balance accounts -32070,tools,Chain State,state,getState,call,l,,visible|docs,1,flag,,result,,,,call a smart contract with one or more solidity calls, four-byte plus parameters, or encoded call data strings -32080,tools,Chain State,state,getState,articulate,a,,visible|docs,,switch,,,,,,for the --call option only, articulate the retrieved data if ABIs can be found -32090,tools,Chain State,state,getState,proxy_for,r,,visible|docs,,flag,
,,,,,for the --call option only, redirects calls to this implementation +32070,tools,Chain State,state,getState,call,l,,visible|docs,1,switch,,result,,,,write-only call (a query) to a smart contract +32073,tools,Chain State,state,getState,send,s,,,2,switch,,result,,,,writes a transaction to an address (see docs for more information) +32087,tools,Chain State,state,getState,calldata,d,,visible|docs,,flag,,,,,,for commands (--call or --send), provides the call data (in various forms) for the command (may be empty for --send) +32080,tools,Chain State,state,getState,articulate,a,,visible|docs,,switch,,,,,,for commands only, articulate the retrieved data if ABIs can be found +32090,tools,Chain State,state,getState,proxy_for,r,,visible|docs,,flag,
,,,,,for commands only, redirects calls to this implementation 32100,tools,Chain State,state,getState,n1,,,,,note,,,,,,An `address` must be either an ENS name or start with '0x' and be forty-two characters long. 32110,tools,Chain State,state,getState,n2,,,,,note,,,,,,`Blocks` is a space-separated list of values, a start-end range, a `special`, or any combination. 32120,tools,Chain State,state,getState,n3,,,,,note,,,,,,If the queried node does not store historical state, the results are undefined. 32130,tools,Chain State,state,getState,n4,,,,,note,,,,,,`Special` blocks are detailed under `chifra when --list`. 32140,tools,Chain State,state,getState,n5,,,,,note,,,,,,`Balance` is the default mode. To select a single mode use `none` first, followed by that mode. -32150,tools,Chain State,state,getState,n6,,,,,note,,,,,,Valid parameters for --call include Solidity-like syntax: balanceOf(0x316b...183d), a four-byte followed by parameters: 0x70a08231(0x316b...183d), or encoded input data. +32150,tools,Chain State,state,getState,n6,,,,,note,,,,,,Valid parameters for --calldata include Solidity-like syntax: balanceOf(0x316b...), a four-byte followed by parameters: 0x70a08231(0x316b...), or encoded input data. 32160,tools,Chain State,state,getState,n7,,,,,note,,,,,,You may specify multiple `parts` on a single line. 32170,tools,Chain State,state,getState,n8,,,,,note,,,,,,In the --call string, you may separate multiple calls with a colon. +32180,tools,Chain State,state,getState,n9,,,,,note,,,,,,Your use of the unaudited --send option legally absolves TrueBlocks, LLC or any associated parties from liability or loss related to such use. +32185,tools,Chain State,state,getState,n10,,,,,note,,,,,,The --send option does not validate its input before sending your transaction to the network. If you provide invalid data, you may lose your funds. Be warned. +32190,tools,Chain State,state,getState,n11,,,,,note,,,,,,As of version 4.0.0, use `--call --calldata ` to provide your command. +32195,tools,Chain State,state,getState,n12,,,,,note,,,,,,--calldata may be one or more colon-seperated solidity calls, four-byte plus parameters, or encoded call data strings. # 33000,tools,Chain State,tokens,getTokens,,,,visible|docs,,command,,,Get token balance(s),[flags]
[address...] [block...],default|caching|names|,Retrieve token balance(s) for one or more addresses at given block(s). 33020,tools,Chain State,tokens,getTokens,addrs,,,required|visible|docs,2,positional,list,token,,,,two or more addresses (0x...), the first is an ERC20 token, balances for the rest are reported diff --git a/src/dev_tools/sdkFuzzer/state.go b/src/dev_tools/sdkFuzzer/state.go index f43400dbde..c769b566a6 100644 --- a/src/dev_tools/sdkFuzzer/state.go +++ b/src/dev_tools/sdkFuzzer/state.go @@ -33,6 +33,7 @@ func DoState() { noZero := []bool{false, true} articulate := []bool{false, true} proxyFor := fuzzProxyFors + // calldata is a --other // blocks is not fuzzed // Fuzz Loop // EXISTING_CODE @@ -136,7 +137,7 @@ func TestState(which, value, fn string, opts *sdk.StateOptions) { } } case "call": - if call, _, err := opts.StateCall(value); err != nil { + if call, _, err := opts.StateCall(); err != nil { ReportError(fn, opts, err) } else { if err := SaveToFile[types.Result](fn, call); err != nil { @@ -145,6 +146,16 @@ func TestState(which, value, fn string, opts *sdk.StateOptions) { ReportOkay(fn) } } + case "send": + if send, _, err := opts.StateSend(); err != nil { + ReportError(fn, opts, err) + } else { + if err := SaveToFile[types.Result](fn, send); err != nil { + ReportError2(fn, err) + } else { + ReportOkay(fn) + } + } default: ReportError(fn, opts, fmt.Errorf("unknown which: %s", which)) logger.Fatal("Quitting...") diff --git a/src/dev_tools/testRunner/testCases/status.csv b/src/dev_tools/testRunner/testCases/status.csv index 5112c086d8..acd1a5d094 100644 --- a/src/dev_tools/testRunner/testCases/status.csv +++ b/src/dev_tools/testRunner/testCases/status.csv @@ -21,7 +21,7 @@ on ,both ,fast ,status ,apps ,cacheStatus ,items_blocks_dup ,y ,mode on ,both ,fast ,status ,apps ,cacheStatus ,items_logs ,y ,modes = logs & max_records = 100 on ,both ,fast ,status ,apps ,cacheStatus ,items_slurps ,y ,modes = slurps & max_records = 100 on ,both ,fast ,status ,apps ,cacheStatus ,items_state ,y ,modes = state & max_records = 100 -off ,both ,fast ,status ,apps ,cacheStatus ,items_statements ,y ,modes = statements & max_records = 100 +on ,both ,fast ,status ,apps ,cacheStatus ,items_statements ,y ,modes = statements & max_records = 100 on ,both ,fast ,status ,apps ,cacheStatus ,items_tokens ,y ,modes = tokens & max_records = 100 on ,both ,fast ,status ,apps ,cacheStatus ,items_traces ,y ,modes = traces & max_records = 100 on ,both ,fast ,status ,apps ,cacheStatus ,items_txs ,y ,modes = transactions & max_records = 100 @@ -56,7 +56,7 @@ on ,both ,fast ,status ,apps ,cacheStatus ,mode_blocks_dup ,y ,mode on ,both ,fast ,status ,apps ,cacheStatus ,mode_logs ,y ,modes = logs & verbose & max_records = 2 on ,both ,fast ,status ,apps ,cacheStatus ,mode_slurps ,y ,modes = slurps & verbose & max_records = 2 on ,both ,fast ,status ,apps ,cacheStatus ,mode_state ,y ,modes = state & verbose & max_records = 2 -off ,both ,fast ,status ,apps ,cacheStatus ,mode_statements ,y ,modes = statements & verbose & max_records = 2 +on ,both ,fast ,status ,apps ,cacheStatus ,mode_statements ,y ,modes = statements & verbose & max_records = 2 on ,both ,fast ,status ,apps ,cacheStatus ,mode_tokens ,y ,modes = tokens & verbose & max_records = 2 on ,both ,fast ,status ,apps ,cacheStatus ,mode_traces ,y ,modes = traces & verbose & max_records = 2 on ,both ,fast ,status ,apps ,cacheStatus ,mode_txs ,y ,modes = transactions & verbose & max_records = 2 @@ -70,7 +70,7 @@ on ,both ,fast ,status ,apps ,cacheStatus ,mode_unripe ,y ,mode on ,both ,fast ,status ,apps ,cacheStatus ,mode_maps ,y ,modes = maps & verbose & max_records = 2 on ,both ,fast ,status ,apps ,cacheStatus ,mode_some ,y ,modes = some & verbose & max_records = 2 -off ,both ,fast ,status ,apps ,cacheStatus ,mode_all ,y ,modes = all & verbose & max_records = 2 +on ,both ,fast ,status ,apps ,cacheStatus ,mode_all ,y ,modes = all & verbose & max_records = 2 on ,both ,fast ,status ,apps ,cacheStatus ,mode_three ,y ,modes = abis & modes = monitors & modes = transactions & verbose & max_records = 2 on ,both ,fast ,status ,apps ,cacheStatus ,explorer_1 ,y ,fmt = json & verbose & max_records = 2 diff --git a/tests b/tests index 30d9d0188a..6985aca134 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 30d9d0188a6c669954117c1c29b63323f6128e5c +Subproject commit 6985aca1344b1f16053a7c2eacf6ef069a52e183