262 Commits

Author SHA1 Message Date
476fd40948 Add program-test tests to bpf programs (#16407) 2021-04-07 01:47:15 -07:00
92f4018b07 Cleanup unsupported sysvars (#16390)
* Cleanup unsupported sysvars

* fix ser description
2021-04-06 00:08:03 -07:00
1359bceb5d Bump bpf-tools to version v1.5 (#16331)
The new version of bpf-tools eliminates the separate
rust-bpf-sysroot. The Rust standard libraries for the BPF target are
built in tree when the compiler is built.  The standard libraries code
is slightly more optimized and some reduction of compute budget can be
expected with this version of bpf-tools.
2021-04-04 13:04:22 +00:00
3f63ed9a72 removes OrderedIterator and transaction batch iteration order (#16153)
In TransactionBatch,
https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/transaction_batch.rs#L4-L11
lock_results[i] is aligned with transactions[iteration_order[i]]:
https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/bank.rs#L2414-L2424
https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/accounts.rs#L788-L817

However load_and_execute_transactions is iterating over
  lock_results[iteration_order[i]]
https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/bank.rs#L2878-L2889
and then returning i as for the index of the retryable transaction.

If iteratorion_order is [1, 2, 0], and i is 0, then:
  lock_results[iteration_order[i]] = lock_results[1]
which corresponds to
  transactions[iteration_order[1]] = transactions[2]
so neither i = 0, nor iteration_order[i] = 1 gives the correct index for the
corresponding transaction (which is 2).

This commit removes OrderedIterator and transaction batch iteration order
entirely. There is only one place in blockstore processor which the
iteration order is not ordinal:
https://github.com/solana-labs/solana/blob/e50f59844/ledger/src/blockstore_processor.rs#L269-L271
It seems like, instead of using an iteration order, that can shuffle entry
transactions in-place.
2021-03-31 23:59:19 +00:00
f84e88f0a2 Cleanup nits (#16211) 2021-03-30 12:16:21 -07:00
54c68ea83f Drop write lock on sysvars (#15497)
* Drop write lock on sysvars

* adds env var for demoting sysvar write lock demotion

* moves demote logic to is_writable

* feature gates sysvar write lock demotion

* adds builtins to write lock demotion

* adds system program id to builtins

* adds Feature111...

* adds an abi-freeze test

* mvines set of builtin program keys

Co-authored-by: Michael Vines <mvines@gmail.com>

* update tests

* adds bpf loader keys

* Add test sysvar

* Plumb demote_sysvar to is_writable

* more plumbing of demote_sysvar_write_locks to is_writable

* patches test_program_bpf_instruction_introspection

* hard codes demote_sysvar_write_locks to false for serialization/encoding methods

* Revert "hard codes demote_sysvar_write_locks to false for serialization/encoding methods"

This reverts commit ae3e2d2e777437bddd753933097a210dcbc1b1fc.

* change the hardcoded ones to demote_sysvar_write_locks=true

* Use data_as_mut_slice

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
Co-authored-by: Michael Vines <mvines@gmail.com>
2021-03-30 10:05:09 -07:00
e817a6db00 Add timeout for local cluster partition tests (#16123)
* Add timeout for local cluster partition tests

* fix optimistic conf test logs

* Bump instruction count assertions
2021-03-25 13:27:07 -06:00
66c42f62d8 make AccountSharedData.data private to abstract storage (#16091)
* format

* 2 more tests

* use
2021-03-25 11:04:20 -05:00
664ed76523 Bump bpf-tools to version v1.3 (#16068)
* Bump bpf-tools to version v1.3

This brings in the fix for increased compute budget that wasn't caught
when bpf-tools v1.2 were released.

* Adjust BPF test programs instruction counts
2021-03-24 07:16:38 +00:00
cc38ae72e7 Skip deserialization of readonly accounts (#15813) 2021-03-11 19:28:21 -08:00
c5a5d7457e Bump bpf-tools to v1.1 (#15776) 2021-03-10 18:13:38 +01:00
8a3135d17b Account->AccountSharedData (#15691) 2021-03-09 15:06:07 -06:00
efcb58092e Add more duplicate account tests (#15746) 2021-03-05 20:36:27 -08:00
fb3837260c Add BPf loader finalize test via inner instruction (#15708) 2021-03-04 20:34:36 +00:00
b53cb8eb2d Deprecate Instruction::new (#15695) 2021-03-04 05:46:48 +00:00
d521dfe63c Implement OutputFormat for confirm in Cli and ledger-tool bigtable (#15528)
* Add CliTransaction struct

* Impl DisplayFormat for decode-transaction

* Add block-time to transaction println, writeln

* Impl DisplayFormat for confirm

* Use DisplayFormat in ledger-tool bigtable confirm
2021-02-25 14:15:52 -07:00
48785b507b Bump Rust-BPF to v1.46 (#15273) 2021-02-18 11:30:08 -08:00
02432a548f Cleanup old features (#15391) 2021-02-18 09:56:11 -08:00
0f6f6080f3 sdk: Add Borsh support for types and utilities (#15290)
* sdk: Add Borsh to Pubkey

* Add serialization error for easier borsh integration

* Add Borsh usage to banks-client and sdk

* Rename SerializationError -> IOError

* Add new errors to proto

* Update Cargo lock

* Update Cargo.lock based on CI

* Clippy

* Update ABI on bank

* Address review feedback

* Update sanity program instruction count test
2021-02-18 11:14:56 +01:00
02a5f7104a Fix which shared object the test uses (#15060) 2021-02-03 13:31:55 -08:00
a2aea0ca33 cli-output: Add option sigverify status to println_transaction() output 2021-02-02 18:44:22 +00:00
07cef5a557 Buffer authority must match upgrade authority for deploys and upgrades (#14923) 2021-01-29 12:43:42 -08:00
d026da4a1b Ignore syscalls which are not registered in cached rbpf executable. (#14898) 2021-01-29 12:30:10 +01:00
0b1015f7d3 Richer runtime failure logging (#14875) 2021-01-28 10:04:54 -08:00
63429507b2 Add syscall feature activation test (#14890) 2021-01-27 17:21:25 -08:00
e57b9c3b02 Add more upgradeable tests (#14846) 2021-01-25 21:04:59 -08:00
77572a7c53 Track account writable deescalation (#14626) 2021-01-22 15:28:01 -08:00
d52c94a366 adds missing block_time field (#14743) 2021-01-21 18:29:48 +00:00
aa96ad042b Add signer/writable de/escalation tests (#14726) 2021-01-21 09:19:46 +00:00
e3bd9e5300 Prevent the invoke and upgrade of programs in the same tx batch (#14653)
* Prevent the invoke and upgrade of programs in the same tx batch

* Pass program address as writable in the upgrade instruction
2021-01-19 16:24:44 -08:00
907f518f6d Add load/execute/store timings (#14561) 2021-01-14 14:14:16 -08:00
6e8a1ba7de Load executable accounts from invoke context (#14574) 2021-01-14 00:19:22 -08:00
ec48631fc5 Bail on all CPI errors (#14500)
* Bail on all CPI errors

* whitespace
2021-01-09 02:27:39 +00:00
5eacc5d08d Enable program upgrades via CPI (#14449) 2021-01-06 14:31:14 -08:00
0619805806 Upgradeable programs needs program account's address as program id (#14417) 2021-01-04 21:45:05 +00:00
5524938a50 Limit CPI instruction size (#14317) 2020-12-29 01:14:17 +00:00
ee0a80a092 Prevent bpf loader impersonators (#14278) 2020-12-24 03:04:48 +00:00
b1d702a618 Don't use caller passed executable account (#14276) 2020-12-23 14:34:14 -08:00
0b479ab180 Limit CPI from calling loader or native programs (#14252) 2020-12-23 10:44:34 -08:00
ab205b682a Upgradeable programs called same as non-upgradeable (#14239)
* Upgradeable programs called same as non-upgradeable

* nudge
2020-12-22 09:26:55 -08:00
e8cc0bef6c Add CPI support for upgradeable loader (#14193) 2020-12-17 15:39:49 -08:00
593ad80954 Fix program account rent exemption (#14176) 2020-12-17 09:02:31 +00:00
025f886e10 check for resize access violations (#14142) 2020-12-15 23:21:08 -08:00
d513b0c4ca Add Program loader/environment instruction errors (#14120) 2020-12-15 09:54:07 -08:00
9e90394583 Upgradeable loader (#13689) 2020-12-14 15:35:10 -08:00
5ea80e673f Fix priv escalation test (#14046) 2020-12-10 22:36:33 +00:00
e1a4251b07 Cap CPI signers (#14021) 2020-12-09 02:14:53 -08:00
882d033233 Don't use stale executor cache (#13966) 2020-12-05 05:54:42 +00:00
661ca52135 Cap seeds not signers (#13941) 2020-12-03 09:58:25 -08:00
1c51711c75 Invoke with empty account slice (#13931) 2020-12-03 07:06:26 -08:00