Commit Graph

75 Commits

Author SHA1 Message Date
Michael Vines
9843c3a5cb Restrict transaction fee payers to system accounts (#4198)
automerge
2019-05-24 13:06:55 -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
Rob Walker
431cc82032 add Transaction::partial_sign() (#4333)
* add partial sign

* nits
2019-05-17 18:55:57 -07:00
Greg Fitzgerald
fff1631a8b Return a better error when a program account isn't found (#4310) 2019-05-16 11:32:27 -06:00
Tyera Eulberg
a9cfae486c Revert-revert migrate to ed25519-dalek crate (#3877)
* Revert "Revert "Migrate from ring to ed25519-dalek, take 2 (#3844)" (#3868)"

This reverts commit 6a878602f2.

* Fix Signature::verify method
2019-04-18 14:37:20 -06:00
Tyera Eulberg
6a878602f2 Revert "Migrate from ring to ed25519-dalek, take 2 (#3844)" (#3868)
This reverts commit e9b82bacda.
2019-04-18 11:47:34 -06:00
Tyera Eulberg
e9b82bacda Migrate from ring to ed25519-dalek, take 2 (#3844)
* Migrate from ring to ed25519-dalek

* Move gen_keypair_file test to a more appropriate location

* Fixup bench-exchange and add helper fn for single deterministic keypair

* Update golden
2019-04-18 10:38:32 -06:00
Greg Fitzgerald
80f3568062 Upgrade to Rust 1.34.0 (#3781)
* Upgrade to Rust 1.34.0

* Remove redundant closures

Thanks Clippy!
2019-04-15 15:56:08 -06:00
Tyera Eulberg
90c1300bb6 Plumb TransactionError through Rpc 2019-04-05 22:09:29 -06:00
Greg Fitzgerald
46e6911ec1 Add get_signature_status() to SyncClient
And move bank::Result to transaction module.
2019-04-05 10:22:05 -07:00
Greg Fitzgerald
35298e01a8 Remove Instruction wrapper structs and name functions after enum fields 2019-04-03 13:34:27 -07:00
Greg Fitzgerald
867f6f107b Rename SystemInstruction::Move to SystemInstruction::Transfer 2019-04-03 08:35:57 -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
fcef54d062 Add a constructor to generate random pubkeys 2019-03-31 16:23:18 -06:00
Greg Fitzgerald
5646daa820 Delete lots of fee parameters
So many zeros!
2019-03-29 19:21:51 -06:00
Greg Fitzgerald
7896e8288d Replace Transaction::fee with a FeeCalculator 2019-03-29 19:21:51 -06:00
Greg Fitzgerald
8e04fadb05 Cleanup magic numbers
Rename `num_signatures` to `num_required_signatures` to
disambiguate it from `tx.signatures.len()`.
2019-03-29 13:03:29 -07:00
Greg Fitzgerald
31f8b6d352 Integrate Message into Transaction 2019-03-29 13:03:29 -07:00
Greg Fitzgerald
98d60e6124 Expose a method for getting the Message from a Transaction
This currently constructs the message, but when message
is integrated, it can return a `&Message`.
2019-03-29 13:03:29 -07: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
2ab50cbae8 Move untested code out of SDK
verify_signature() was only used in a test that was testing
binary layout. It only worked because the test transaction only
had one signature.

from() was only used by verify_signature() and that's something
we'd typically called `pubkey()`.

hash() didn't return the hash of the Transaction, as you might
guess. It's only used for PoH, so move it into Entry.
2019-03-28 14:24:59 -06:00
Greg Fitzgerald
054ae3a3e3 Document current transaction size awkwardness 2019-03-27 14:27:20 -06:00
Greg Fitzgerald
5ce31168ef Remove Transaction::new_signed 2019-03-26 19:51:16 -07:00
Greg Fitzgerald
b9ff70c8ab pub Transaction::new_unsigned
Offer an incremental path off Transaction::new_unsigned_instructions().
2019-03-26 20:06:05 -06:00
Greg Fitzgerald
77498c6efe Expose Message via the new default Transaction constructor 2019-03-26 20:06:05 -06:00
Greg Fitzgerald
8c69c40834 Make space for a new Transaction::new 2019-03-26 20:06:05 -06:00
Greg Fitzgerald
ca2ac1e5ea Remove a mostly unused Transaction constructor 2019-03-26 15:46:58 -07:00
Greg Fitzgerald
4efa144916 Generate a Message instead of a Transaction 2019-03-25 12:08:27 -06:00
Greg Fitzgerald
f3936c21a3 Add message 2019-03-25 12:08:27 -06:00
Greg Fitzgerald
b53cbdd9e6 Punt on the Script abstraction
Low ROI
2019-03-24 14:52:06 -06:00
Greg Fitzgerald
acedf4ca5a Move Instruction into its own module 2019-03-23 20:31:55 -07:00
Jack May
6505221629 Add exchange program (#3444) 2019-03-22 21:07:36 -07:00
Greg Fitzgerald
58f071b7a0 Migrate loader to high-level instructions 2019-03-21 09:19:24 -06:00
Michael Vines
0dc364c17a Relocate transaction reference verification to join the other validity checks 2019-03-20 07:46:01 -07:00
Greg Fitzgerald
94b5835738 Make AccountMeta a traditional struct instead of a tuple struct 2019-03-19 17:22:39 -06:00
Greg Fitzgerald
a4652a9aaf Label tuple with AccountMeta 2019-03-19 17:22:39 -06:00
Greg Fitzgerald
8d032aba9d Merge InstructionError and ProgramError
From the user's perspective, it's just an instruction error.
For program-specific errors, we still have
InstructionError::CustomError.
2019-03-18 10:39:20 -06:00
Greg Fitzgerald
122c7bc2ef Rename TransactionCompiler to Script and use it to replace the type alias 2019-03-18 08:22:54 -07:00
Greg Fitzgerald
ae4d14a2ad Introducing Scripts
A sequence of instructions. A client compiles the script and then uses
the compiled script to construction a transaction. Then it adds a
adds a blockhash, signs the transaction, and sends it off for
processing.
2019-03-18 08:22:54 -07:00
Greg Fitzgerald
a88b36d718 Rename TransactionBuilder to TransactionCompiler 2019-03-15 14:46:44 -06:00
Greg Fitzgerald
24d9138067 Abandon Builder pattern 2019-03-15 14:46:44 -06:00
Greg Fitzgerald
aca739b800 Boot fees from TransactionBuilder 2019-03-15 14:46:44 -06:00
Greg Fitzgerald
e091aa87ea More precise constructor names 2019-03-15 14:46:44 -06:00
Greg Fitzgerald
968022a1b0 Instruction name swap
* Instruction -> GenericInstruction
* Instruction<u8, u8> -> CompiledInstruction
* Instruction<Pubkey, (Pubkey, bool)> -> Instruction
2019-03-15 14:46:44 -06:00
Greg Fitzgerald
36fb0a0aef Add new preferred transaction constructors 2019-03-15 09:06:54 -06:00
Greg Fitzgerald
4d53be8350 Make it unappealing to build and sign transactions at the same time
Use a client to sign transactions. It'll need that keypair anyway
to resign new blockhashes on retries.
2019-03-15 09:06:54 -06:00
Greg Fitzgerald
f8bf9ca218 Make safe transaction signing the default 2019-03-15 09:06:54 -06:00
Greg Fitzgerald
7b4568b9bf Migrate to sign_checked() 2019-03-15 09:06:54 -06:00