Commit Graph

954 Commits

Author SHA1 Message Date
338f66f9aa Add failing test for decoding ShortU16 alias values 2020-08-14 08:17:52 -06:00
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
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
140b2392f6 Unified signature for create_program_address (#11460) 2020-08-10 10:24:11 -07:00
5a7e99f283 Fix cbindgen compatibility (#11455) 2020-08-07 15:13:48 -07:00
bad486823c Add a client for BankForks (#10728)
Also:
* Use BanksClient in solana-tokens
2020-08-07 08:45:17 -06:00
3fdd8ffdf0 Remove circular dep between InstructionError and SystemError (#11427) 2020-08-06 22:04:43 +00:00
03263c850a Force program address off the curve (#11323) 2020-08-05 16:35:54 -07:00
3f73affb2e Add From for SanitizeError > TransactionError 2020-08-05 06:06:57 +00:00
c421d7f1b8 Test that off-curve pubkeys fail signature verify 2020-07-31 14:21:03 -06:00
251f974b50 Allow inspection of signature verification failures 2020-07-31 14:21:03 -06:00
2dbed80e48 Disable cross-program invocations for OperatingMode::Stable (#11272) 2020-07-29 15:29:52 -07:00
16ecce353f Revert "Land program addresses on the curve (#11174)" (#11253)
This reverts commit f317c362a8.
2020-07-29 11:33:45 -07:00
f317c362a8 Land program addresses on the curve (#11174) 2020-07-27 10:45:59 -07:00
8ccce1e543 Upgrade ed25519-dalek (#11183) 2020-07-23 17:23:51 -06:00
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
6de8da05e3 Skip entrypoint in programs (#11176) 2020-07-23 19:44:59 +00:00
a5dd848702 getEpochInfo RPC endpoint now includes the current block height 2020-07-21 17:24:07 -07:00
231e2387db Program feature-flag entrypoint (#11144) 2020-07-21 14:36:28 -06:00
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
e5d8c4383f Add Bank support for "upgrade epochs" where all non-vote transactions will be rejected 2020-07-17 08:48:42 -07:00
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
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
b0cb2b0106 Replace FIXME with an issue link 2020-07-14 14:40:02 -07:00
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
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
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
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
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
119949d4d8 Add a default commitment-level (#10935) 2020-07-07 03:05:55 +00:00
39b3ac6a8d Introduce automatic ABI maintenance mechanism (2/2; rollout) (#8012)
* Introduce automatic ABI maintenance mechanism (2/2; rollout)

* Fix stable clippy

* Change to symlink

* Freeze abi of Tower

* fmt...

* Improve dev-experience!

* Update BankSlotDelta

$ diff -u /tmp/abi8/*7dg6BreYxTuxiVz6aLvk3p2Z7GQk2cJqfGvC9h4FAoSj* /tmp/abi8/*9chBcbXVJ4fK7uGgydQzam5aHipaAKFw6V4LDFpjbE4w*
--- /tmp/abi8/bank__BankSlotDelta_frozen_abi__test_abi_digest_7dg6BreYxTuxiVz6aLvk3p2Z7GQk2cJqfGvC9h4FAoSj      2020-06-18 18:01:22.831228087 +0900
+++ /tmp/abi8/bank__BankSlotDelta_frozen_abi__test_abi_digest_9chBcbXVJ4fK7uGgydQzam5aHipaAKFw6V4LDFpjbE4w      2020-07-03 15:59:58.430695244 +0900
@@ -140,7 +140,7 @@
                                                         field u8
                                                             primitive u8
                                                         field solana_sdk::instruction::InstructionError
-                                                            enum InstructionError (variants = 34)
+                                                            enum InstructionError (variants = 35)
                                                                 variant(0) GenericError (unit)
                                                                 variant(1) InvalidArgument (unit)
                                                                 variant(2) InvalidInstructionData (unit)
@@ -176,6 +176,7 @@
                                                                 variant(31) CallDepth (unit)
                                                                 variant(32) MissingAccount (unit)
                                                                 variant(33) ReentrancyNotAllowed (unit)
+                                                                variant(34) MaxSeedLengthExceeded (unit)
                                                     variant(9) CallChainTooDeep (unit)
                                                     variant(10) MissingSignatureForFee (unit)
                                                     variant(11) InvalidAccountIndex (unit)

* Fix some merge conflicts...
2020-07-06 20:22:23 +09:00
52526a9bc2 Prevent stub inclusion when building shared objects (#10875) 2020-07-01 13:15:30 -07:00
36f436c760 genesis subcommand now displays ticks per slot 2020-07-01 17:32:35 +00:00
9f5bd5fe81 Expose SlotHistory::oldest() -> Slot (#10799) 2020-06-25 18:23:31 +09:00
7ade330b23 Rename Client methods to match proposed BanksClient (#10793) 2020-06-25 03:35:38 +00:00
1c498369b5 Remove fee-payer guesswork from Message and Transaction (#10776)
* Make Message::new_with_payer the default constructor

* Remove Transaction::new_[un]signed_instructions

These guess the fee-payer instead of stating it explicitly
2020-06-24 14:52:38 -06:00
db4a18ada4 Add PubkeyError for ProgramError (#10748) 2020-06-23 11:19:27 -07:00
73586c1aad Use &[u8] for program address seeds rather then &str (#10744) 2020-06-22 16:51:43 -07:00
d77818c18b Pull program stubs into SDK (#10704) 2020-06-18 23:23:28 -07:00
0550b893b0 Fix typos (#10675)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-06-17 20:54:52 -07:00
dac7dc2f10 Move types to more appropriate files (#10638) 2020-06-17 10:39:14 -07:00
40ccade5cc Update to rust 1.44.0 (#10585)
* Update rust 1.44.0

* Update rust nightly 1.46.0

* Update docs

* Fix clippy errors

* Compile all source code with stable and nightly

* Add another note

* script tweaks

* Fix a test...

* Add another workaround

* Add hack

* Increase timeout...

* Revert "Add hack"

This reverts commit 5960f087203be8792ec0728a6755288c317a2788.

* Revert "Add another workaround"

This reverts commit e14300d01ffd1b8e86e676662177545549b45c13.

* Require nightly rustfmt and use older nightly a bit

* Improve document a bit

* Revert now not-existing clippy check...
2020-06-17 01:32:16 +09:00
b6a9573748 Route all loader messages to log collector (#10528) 2020-06-13 13:20:08 -07:00
b03a347803 Document InvokeContext trait (#10514) 2020-06-11 15:31:13 -07:00
4131eee94d Expose last-valid-slot to BankClient and ThinClient users (#10478)
automerge
2020-06-09 17:07:32 -07:00
8e2745c2a2 Clean up delinquency slot distance computation 2020-06-09 11:27:30 -07:00
e23340d89e Clippy cleanup for all targets and nighly rust (also support 1.44.0) (#10445)
* address warnings from 'rustup run beta cargo clippy --workspace'

minor refactoring in:
- cli/src/cli.rs
- cli/src/offline/blockhash_query.rs
- logger/src/lib.rs
- runtime/src/accounts_db.rs

expect some performance improvement AccountsDB::clean_accounts()

* address warnings from 'rustup run beta cargo clippy --workspace --tests'

* address warnings from 'rustup run nightly cargo clippy --workspace --all-targets'

* rustfmt

* fix warning stragglers

* properly fix clippy warnings test_vote_subscribe()
replace ref-to-arc with ref parameters where arc not cloned

* Remove lock around JsonRpcRequestProcessor (#10417)

automerge

* make ancestors parameter optional to avoid forcing construction of empty hash maps

Co-authored-by: Greg Fitzgerald <greg@solana.com>
2020-06-09 09:38:14 +09:00
7e2651ca51 RPC simulateTransaction endpoint now returns program log output (#10432) 2020-06-06 10:18:28 -07:00
a4cd96609c Add built-in programs to InvokeContext (#10383)
automerge
2020-06-03 12:48:19 -07:00
e63e7937cb Introduce automatic ABI maintenance mechanism (1/2; prepare) (#10335)
* Introduce automatic ABI maintenance mechanism

* Compile fix...

* Docs fix...

* Programs compilation fix...

* Simplify source credit

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

* Cargo.lock...

Co-authored-by: Michael Vines <mvines@gmail.com>
2020-06-03 20:51:56 +09:00