874 Commits

Author SHA1 Message Date
Ryo Onodera
de4a613610
Check bank capitalization (#11927)
* Check bank capitalization

* Simplify and unify capitalization calculation

* Improve and add tests

* Avoid overflow and inhibit automatic restart

* Fix test

* Tweak checked sum for cap. and add tests

* Fix broken build after merge conflicts..

* Rename to ClusterType

* Rename confusing method

* Clarify comment

* Verify cap. in rent and inflation tests

Co-authored-by: Stephen Akridge <sakridge@gmail.com>
2020-09-12 01:48:06 +09:00
Ryo Onodera
53b8ea4464
Rename to ClusterType and restore devnet compat. (#12068)
* Rename to ClusterType and restore devnet compat.

* De-duplicate parse code and add comments

* Adjust default Devnet genesis & reduce it in tests
2020-09-08 23:55:09 +09:00
Ryo Onodera
89bca6110a
Clarify comments and names in inflation code (#11977) 2020-09-03 14:15:12 +09:00
Michael Vines
29cfbce21d Revert "Remove ::solana_sdk hack (#11326)"
This reverts commit c099b29b36eca0d9f59818ecc28b4d9694a5b99f.
2020-09-02 15:24:38 -07:00
carllin
af08221aec
Switch account hashing to blake3 (#11969)
* Switch account hashing to blake3

Co-authored-by: Carl <carl@solana.com>
2020-09-02 00:37:36 -07:00
Jack May
0ed360b5e5
fix program test stubs (#11956)
* fix program tset stubs

* nudge
2020-08-31 21:48:16 -07:00
Jack May
ae0fd3043a
Add support for deprecated loader (#11946) 2020-08-31 14:06:58 -07:00
Jack May
ea179ad762
Bump compute budget (#11864)
* Bump compute budget

* nudge
2020-08-26 21:48:51 +00:00
Jack May
db4bbb3569
Switch programs activation to whole-set based gating (#11750)
* Implement Debug for MessageProcessor

* Switch from delta-based gating to whole-set gating

* Remove dbg!

* Fix clippy

* Clippy

* Add test

* add loader to stable operating mode at proper epoch

* refresh_programs_and_inflation after ancestor setup

* Callback via snapshot; avoid account re-add; Debug

* Fix test

* Fix test and fix the past history

* Make callback management stricter and cleaner

* Fix test

* Test overwrite and frozen for native programs

* Test epoch callback with genesis-programs

* Add assertions for parent bank

* Add tests and some minor cleaning

* Remove unsteady assertion...

* Fix test...

* Fix DOS

* Skip ensuring account by dual (whole/delta) gating

* Fix frozen abi implementation...

* Move compute budget constatnt init back into bank

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2020-08-26 01:49:15 +09:00
Jon Cinque
9a366281d3
sdk: Make PubKey::create_program_address available in program unit tests (#11745)
* sdk: Make PubKey::create_program_address available in program unit tests

This finishes the work started in #11604 to have
`create_program_address` available when `target_arch` is not `bpf` and
`program` is enabled.  Otherwise, there is an undefined reference error
to `sol_create_program_address`, which is only defined in `bpf`.

A small test to simply call the function has been added in order to catch
the problem in the future.

The default dependency to `solana-sdk/default` doesn't cause a problem with
existing programs since `build.sh` always specifies
`--no-default-features`, and programs in `solana-program-library` all
use it too.

* Add `default-features = false` for inter-program dependencies

Fix the build error found during CI.  The `--no-default-features` flag
only applies to the top-level package, and not to dependencies.  A program that
depends on another program, i.e. `128bit` which depends on `128bit_dep`,
must specify `default-features = false` when including that package,
otherwise the `bpf` build will try to pull in default packages, which
includes `std`.
2020-08-24 19:28:36 +02:00
Jack May
8d362f682b
The constraints on compute power a program can consume is limited only to its instruction count (#11717) 2020-08-21 15:31:19 -07:00
Greg Fitzgerald
f02a78d8ff
Add StakeInstruction::AuthorizeWithSeed (#11700)
* Add StakeInstruction::AuthorizeWithSeed

* chore: add authorize-with-seed to web.js

* fix: add address_owner

* Add SystemInstruction::TransferWithSeed

* Update ABI hash

* chore: better variable names

* Add AuthorizeWithSeedArgs

* Reorder and rename arguments for clarity
2020-08-21 18:28:01 +00:00
Aaron Hill
c099b29b36
Remove ::solana_sdk hack (#11326)
Fixes #10933

Now that https://github.com/rust-lang/rust/pull/72121 has been merged,
using a `$crate` path from a nested `macro_rules!` will work properly
across multiple crates. This allows us to stop using `::solana_sdk`
to reference to the `respan!` macro.
2020-08-18 17:59:41 +00:00
Michael Vines
d15173ad9d Address latest nightly clippy lints, but globally disable stable_sort_primitive 2020-08-17 22:36:10 -07:00
Jack May
e9b610b8df
Add SystemInstruction::CreateAccount support to CPI (#11649) 2020-08-17 13:38:42 -07:00
Jack May
f1ba2387d3
More efficient padding (#11656) 2020-08-17 10:24:34 -07:00
Jack May
768b386f0a
fix region checks (#11651) 2020-08-16 23:11:52 -07:00
Jack May
7c736f71fe
Make BPF Loader static (#11516) 2020-08-14 12:32:45 -07:00
Trent Nelson
30dbe257cf Reimplement decode_len() with ShortU16 vistor helper 2020-08-14 08:17:52 -06:00
Trent Nelson
6222fbcc66 Factor out ShortU16 deser vistor logic to helper 2020-08-14 08:17:52 -06:00
Trent Nelson
338f66f9aa Add failing test for decoding ShortU16 alias values 2020-08-14 08:17:52 -06:00
Jack May
9290e561e1
Align host addresses (#11384)
* Align host addresses

* support new program abi

* update epoch rollout

* Enforce aligned pointers in cross-program invocations
2020-08-11 16:11:52 -07:00
Ryo Onodera
6c242f3fec
Fix bad rent in Bank::deposit as if since epoch 0 (#10468)
* Fix bad rent in Bank::deposit as if since epoch 0

* Remove redundant predicate

* Rename

* Start to add tests with some cleanup

* Forgot to add refactor code...

* Enchance test

* Really fix rent timing in deposit with robust test

* Simplify new behavior by disabling rent altogether
2020-08-12 00:04:32 +09:00
Jack May
140b2392f6
Unified signature for create_program_address (#11460) 2020-08-10 10:24:11 -07:00
Jack May
5a7e99f283
Fix cbindgen compatibility (#11455) 2020-08-07 15:13:48 -07:00
Greg Fitzgerald
bad486823c
Add a client for BankForks (#10728)
Also:
* Use BanksClient in solana-tokens
2020-08-07 08:45:17 -06:00
Greg Fitzgerald
3fdd8ffdf0
Remove circular dep between InstructionError and SystemError (#11427) 2020-08-06 22:04:43 +00:00
Jack May
03263c850a
Force program address off the curve (#11323) 2020-08-05 16:35:54 -07:00
Trent Nelson
3f73affb2e Add From for SanitizeError > TransactionError 2020-08-05 06:06:57 +00:00
Trent Nelson
c421d7f1b8 Test that off-curve pubkeys fail signature verify 2020-07-31 14:21:03 -06:00
Trent Nelson
251f974b50 Allow inspection of signature verification failures 2020-07-31 14:21:03 -06:00
Jack May
2dbed80e48
Disable cross-program invocations for OperatingMode::Stable (#11272) 2020-07-29 15:29:52 -07:00
Jack May
16ecce353f
Revert "Land program addresses on the curve (#11174)" (#11253)
This reverts commit f317c362a8932b4dbb3f8683729dfd72e3991fef.
2020-07-29 11:33:45 -07:00
Jack May
f317c362a8
Land program addresses on the curve (#11174) 2020-07-27 10:45:59 -07:00
Greg Fitzgerald
8ccce1e543
Upgrade ed25519-dalek (#11183) 2020-07-23 17:23:51 -06:00
Greg Fitzgerald
8b1b392be9
Remove move_loader and librapay (#11184)
* Remove move_loader and librapay

* Remove Embedding Move from implemented proposals

* Remove Move variant from CI

* Remove move_loader ID
2020-07-23 15:08:59 -06:00
Tyera Eulberg
6de8da05e3
Skip entrypoint in programs (#11176) 2020-07-23 19:44:59 +00:00
Michael Vines
a5dd848702 getEpochInfo RPC endpoint now includes the current block height 2020-07-21 17:24:07 -07:00
Tyera Eulberg
231e2387db
Program feature-flag entrypoint (#11144) 2020-07-21 14:36:28 -06:00
Ryo Onodera
3db246f596
Add --warp-epoch and --force-inflation to ledger-tool cap. (#11107)
* Add --warp-epoch and --force-inflation to ledger-tool cap.

* Add more arguments

* Address review comments

* Fix message

* Fix various typos...
2020-07-20 19:09:38 +09:00
Michael Vines
e5d8c4383f Add Bank support for "upgrade epochs" where all non-vote transactions will be rejected 2020-07-17 08:48:42 -07:00
Aaron Hill
95490ff56e Apply #![feature(proc_macro_hygiene)] when needed
This allows the rust-bpf-builder toolchain to build the sdk
2020-07-14 14:40:02 -07:00
Aaron Hill
fed69e96a9 Split comment over multiple lines
Due to https://github.com/rust-lang/rustfmt/issues/4325, leaving this as
one line causes rustfmt to add extra indentation to the surrounding
code.
2020-07-14 14:40:02 -07:00
Aaron Hill
b0cb2b0106 Replace FIXME with an issue link 2020-07-14 14:40:02 -07:00
Aaron Hill
05445c718e Fix hygiene issues in declare_program! and declare_loader!
The `declare_program!` and `declare_loader!` macros both expand to
new macro definitions (based on the `$name` argument). These 'inner'
macros make use of the special `$crate` metavariable to access items in
the crate where the 'inner' macros is defined.

However, this only works due to a bug in rustc. When a macro is
expanded, all `$crate` tokens in its output are 'marked' as being
resolved in the defining crate of that macro. An inner macro (including
the body of its arms) is 'just' another set of tokens that appears in
the body of the outer macro, so any `$crate` identifiers used there are
resolved relative to the 'outer' macro.

For example, consider the following code:

```rust
macro_rules! outer {
    () => {
        macro_rules! inner {
            () => {
                $crate::Foo
            }
        }
    }
}
```

The path `$crate::Foo` will be resolved relative to the crate that defines `outer`,
**not** the crate which defines `inner`.

However, rustc currently loses this extra resolution information
(referred to as 'hygiene' information) when a crate is serialized.
In the above example, this means that the macro `inner` (which gets
defined in whatever crate invokes `outer!`) will behave differently
depending on which crate it is invoked from:

When `inner` is invoked from the same crate in which it is defined,
the hygiene information will still be available,
which will cause `$crate::Foo` to be resolved in the crate which defines 'outer'.

When `inner` is invoked from a different crate, it will be loaded from
the metadata of the crate which defines 'inner'. Since the hygiene
information is currently lost, rust will 'forget' that `$crate::Foo` is
supposed to be resolved in the context of 'outer'. Instead, it will be
resolved relative to the crate which defines 'inner', which can cause
incorrect code to compile.

This bug will soon be fixed in rust (see https://github.com/rust-lang/rust/pull/72121),
which will break `declare_program!` and `declare_loader!`. Fortunately,
it's possible to obtain the desired behavior (`$crate` resolving in the
context of the 'inner' macro) by use of a procedural macro.

This commit adds a `respan!` proc-macro to the `sdk/macro` crate.
Using the newly-stabilized (on Nightly) `Span::resolved_at` method,
the `$crate` identifier can be made to be resolved in the context of the
proper crate.

Since `Span::resolved_at` is only stable on the latest nightly,
referencing it on an earlier version of Rust will cause a compilation error.
This requires the `rustversion` crate to be used, which allows conditionally
compiling code epending on the Rust compiler version in use. Since this method is already
stabilized in the latest nightly, there will never be a situation where
the hygiene bug is fixed (e.g. https://github.com/rust-lang/rust/pull/72121)
is merged but we are unable to call `Span::resolved_at`.
2020-07-14 14:40:02 -07:00
Ryo Onodera
de379a8cd6
Ensure to digest non-empty snapshot_storages and add asserts (#11021)
* Add asserts to detect not-digestable example data

* Ensure to digest non-empty snapshot_storages
2020-07-13 15:58:34 +00:00
Jack May
f0b22b1b23
spl memo linking windows (#11000)
* Update spl-memo to fix windows linking error

* Only programs need the stubs

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2020-07-10 18:39:52 -07:00
dependabot-preview[bot]
841ecfd927
chore(deps): bump bincode from 1.2.1 to 1.3.1 (#10867)
* chore(deps): bump bincode from 1.2.1 to 1.3.1

Bumps [bincode](https://github.com/servo/bincode) from 1.2.1 to 1.3.1.
- [Release notes](https://github.com/servo/bincode/releases)
- [Commits](https://github.com/servo/bincode/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* [auto-commit] Update all Cargo lock files

* Switch from deprecated method

* Add options to maintain behavior with bincode::options()

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2020-07-09 00:08:05 +00:00
Tyera Eulberg
1a6bbd2867
Limited Deserialize isn't limiting anything (#10952)
* Add failing test

* Use deserialize_from to enable limit
2020-07-08 15:54:42 -06:00
Greg Fitzgerald
119949d4d8
Add a default commitment-level (#10935) 2020-07-07 03:05:55 +00:00