Commit Graph

33 Commits

Author SHA1 Message Date
Trent Nelson
4a42cfc42a Cli error cleanup 1.0 (#8834)
* Don't use move semantics if not needed (#8793)

* SDK: Deboilerplate `TransportError` with thiserror

* Enable interchange between `TransportError` and `ClientError`

* SDK: Retval consistency between `Client` and `AsyncClient` traits

* Client: Introduce/use `Result` type

* Client: Remove unused `RpcResponseIn` type

* Client: Rename `RpcResponse` to more appropriate `RpcResult`

* Client: Death to `io::Result` return types

* Client: Struct-ify `ClientError`

* Client: Add optional `command` parameter to `ClientError`

* RpcClient: Stop abusing `io::Error` (low-fruit)

* ClientError: Use `thiserror`'s `Display` impl

* Extend `RpcError`'s utility

* RpcClient: Stop abusing `io::Error` (the rest)

* CLI: Shim `main()` so we can `Display` format errors

* claputils: format input validator errors with `Display`

They are intended to be displayed to users

* SDK: `thiserror` for hash and sig parse erros

* Keygen: Shim main to format errors with `Display`

* SDK: `thiserror` for `InstructionError`

* CLI: `thiserror` for `CliError`

* CLI: Format user messages with `Display`

* Client: Tweak `Display` for `ClientError`

* RpcClient: Improve messaging when TX cannot be confirmed

* fu death io res retval

* CLI/Keygen - fix shell return value on error

* Tweak `InstructionError` `Display` messages as per review

* Cleanup hackjob return code fix

* Embrace that which you hate most

* Too much...

Co-authored-by: Jack May <jack@solana.com>
2020-03-13 07:42:25 -06:00
Michael Vines
f42aa34ab6 Reorder InstructionError to remain compatible with v0.23
(cherry picked from commit 7dac8e2dde)
2020-02-27 18:07:00 -07:00
Jack May
a0bcbf70d5 Cleanup new_result_with_negative_lamports (#8286) 2020-02-14 13:58:33 -08:00
Jack May
0fd795a676 Remove program error footgun and cleaner developer experience (#8042) 2020-01-31 10:58:07 -08:00
Jack May
2226c1b75c Add Rust BPF RefCell borrow helpers (#8047) 2020-01-30 20:40:27 -08:00
Jack May
dd276138c2 Add support for idiomatic error handling to BPF instruction processors (#7968) 2020-01-30 09:47:22 -08:00
Jack May
12eff5a2f9 Cleanup SDK use syntax (#8004) 2020-01-28 16:11:22 -08:00
Jack May
023074650f Allow the same account to be passed multiple times to a single instruction (#7795) 2020-01-22 09:11:56 -08:00
Jack May
52bc4a3598 nudge (#7887) 2020-01-20 15:27:36 -08:00
Jack May
88cb0c6ae3 Add offline signing support to CLI (#7104) 2019-11-25 21:09:57 -08:00
Tyera Eulberg
716caeb17c Use camelCase (#7050)
automerge
2019-11-19 14:55:32 -08:00
Justin Starry
3acd84d9c0 Allow creating an vote program ix where the withdrawer is also the "to" account (#6992)
automerge
2019-11-18 12:43:47 -08:00
Jack May
cd5ec8cd35 Fix blind keyed_account indexing in BPF and Move loader (#6810) 2019-11-08 09:19:19 -08:00
Tyera Eulberg
c6931dcb07 Remove credit-only account handling (#6726)
* Renaming
- credit-only/credit-debit to read-only/read-write
- debitable to writable

* Remove credit handling, making credit-only accounts read-only

* Update programs to remove deprecated credit-only account designation

* Use readonly and writable instead of underscored types
2019-11-05 09:38:35 -07:00
Jack May
1fd84cb52b Enforce only system program can allocate accounts (#6386) 2019-10-16 10:47:45 -07:00
Greg Fitzgerald
eca56eb87d Add next_keyed_account() to instruction_processor_utils (#6309)
* Cleanup KeyedArguments traversal

* Better error message

* Fix clippy warning

* Rename next_arg to next_keyed_account

* Fix clippy warning

* Shorter
2019-10-10 06:30:42 -06:00
Justin Starry
81c36699c4 Add support for BPF program custom errors (#5743)
* Add support for BPF program custom errors

* Rename SOL_SUCCESS -> SUCCESS
2019-09-06 16:05:01 -07:00
Rob Walker
e2ecacc141 runtime checks for rent_epoch (#5629)
* runtime checks for rent_epoch

* add actual test

* bigger timeout

* backout 90 min timeout

* new noop
2019-08-26 11:04:20 -07:00
Rob Walker
50a991fdf9 add executable checks to verify_instruction (#5326) 2019-07-29 15:29:20 -07:00
TristanDebrunner
091999a17e fix Instruction and CompiledInstruction field names (#4895)
* s/program_ids_index/program_id for Instruction

* s/program_ids_index/program_id_index for CompiledInstruction
2019-07-01 18:34:22 -06:00
Tyera Eulberg
807c69d97c Slimmer implementation of credit-only accounts (#4592)
* Add credit-only debit/data check to verify_instruction

* Store credits and pass to accounts_db

* Add InstructionErrors and tests

* Relax account locks for credit-only accounts

* Collect credit-only account credits before passing to accounts_db to store properly

* Convert System Transfer  accounts to credit-only, and fixup test

* Functionalize collect_accounts to unit test

* Review comments

* Rebase
2019-06-10 20:50:02 -06:00
Rob Walker
a18c0e34f4 add activate_stake to stake_api (#4600) 2019-06-10 12:17:29 -07:00
Tyera Eulberg
943cd0a24a Add credit-only info to AccountMetadata (#4405)
* Add credit-only flag to AccountMeta, default to false

* Sort keys by is_credit_only within signed/unsigned groupings

* Process and de-dupe program keys along with other account keys

* Add message helper functions

* Fix test

* Improve comment

* s/is_credit_only/is_debitable

* Add InstructionKeys helper struct, and simplify program_position method
2019-05-23 18:19:53 -04:00
Tyera Eulberg
99d2428041 Transaction format changes toward Credit-Only accounts (#4386)
* Add num_readonly_accounts slice

* Impl programs in account_keys

* Emulate current account-loading functionality using program-account_keys (breaks exchange_program_api tests)

* Fix test

* Add temporary exchange faucet id

* Update chacha golden

* Split num_credit_only_accounts into separate fields

* Improve readability

* Move message field constants into Message

* Add MessageHeader struct and fixup comments
2019-05-22 18:23:16 -04:00
Tyera Eulberg
d31989f878 CustomError from Vec->u32 2019-04-11 13:59:48 -07:00
Tyera Eulberg
90c1300bb6 Plumb TransactionError through Rpc 2019-04-05 22:09:29 -06:00
Greg Fitzgerald
4c0bc1fd88 Add program_ids() methods
Added CompiledInstruction::program_id() so that we don't need to pass
around instruction indexes just for Message::program_id().

Also added Message.program_ids() that returns a slice so that we
can move those pubkeys into Message::account_keys.
2019-04-02 19:00:35 -06:00
Greg Fitzgerald
7896e8288d Replace Transaction::fee with a FeeCalculator 2019-03-29 19:21:51 -06:00
Greg Fitzgerald
c4bc710d3a Use Serde's with attribute to shorten length encodings in Transaction 2019-03-29 08:25:56 -06:00
Sathish Ambley
857dc2ba47 Remove custom serialization 2019-03-29 08:25:56 -06:00
Greg Fitzgerald
4bca60861e Specialize GenericInstruction 2019-03-28 05:45:46 -06:00
Greg Fitzgerald
df333e8b6e Move new_move_many to SystemInstruction 2019-03-26 09:22:29 -07:00
Greg Fitzgerald
acedf4ca5a Move Instruction into its own module 2019-03-23 20:31:55 -07:00