29 Commits

Author SHA1 Message Date
Michael Vines
b8837c04ec Reformat imports to a consistent style for imports
rustfmt.toml configuration:
  imports_granularity = "One"
  group_imports = "One"
2021-12-03 09:19:13 -08:00
Michael Vines
dd12d90eac Upgrade to Rust 2021 2021-11-30 20:43:46 -08:00
Kirill Fomichev
d8a392c20b
add new macro: pubkey! (#21245)
* add new macro: `pubkey!`

* fmt
2021-11-15 11:22:51 -08:00
Trent Nelson
767f740305 Bump version to 1.9.0 2021-10-06 17:57:41 -07:00
Jack May
eaeeffa5a3
Add macros for deprecacted ids (#18907) 2021-07-26 20:54:46 -07:00
dependabot[bot]
86c07bf785
Bump bs58 from 0.3.1 to 0.4.0 (#17573)
* Bump bs58 from 0.3.1 to 0.4.0

Bumps [bs58](https://github.com/mycorrhiza/bs58-rs) from 0.3.1 to 0.4.0.
- [Release notes](https://github.com/mycorrhiza/bs58-rs/releases)
- [Commits](https://github.com/mycorrhiza/bs58-rs/compare/0.3.1...0.4.0)

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

* Fixup

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-05-28 18:30:34 +00:00
Michael Vines
8eab0e8602
Bump version to v1.8.0 (#17541) 2021-05-27 08:51:53 -07:00
Michael Vines
0c9ca5522c Bump version to v1.7.0 2021-03-13 09:01:21 +00:00
Trent Nelson
24d18b3cf2 docs: add docs links for crates published to crates.io 2021-03-11 08:38:18 +00:00
Michael Vines
1e977ac025 Bump version to v1.6.0 2020-12-15 18:28:04 +00:00
Michael Vines
dd711ab5fb Rename solana-program-sdk to solana-program 2020-10-24 08:37:55 -07:00
Michael Vines
63db324204 Initial population of solana-program-sdk 2020-10-24 08:37:55 -07:00
Michael Vines
11df2e2236 Bump version to v1.5.0 2020-10-08 04:51:36 +00:00
Trent Nelson
e12ab9d0dd Bump version to 1.4.0 2020-08-05 12:04:15 -06:00
Aaron Hill
8bcc8edf47 Remove calls to unwrap() in respan! macro
Previously, `proc_macro2::Span::resolved_at` was gated behind
cfg(procmacro2_semver_exempt). This gate has been removed in the latest
version of proc-macro2, allowing us to avoid using `unwrap()` to use the
underling method on `proc_macro::Span`
2020-08-02 19:15:06 -07:00
Aaron Hill
e7387f60a7 Fix clippy lints 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
Tyera Eulberg
f37d2d5a58
Add docs to declare_id macro (#10671) 2020-06-17 19:57:23 -06:00
R. M. Shea
48febf153b
Change documentation introduction to indicate Foundation IP transfer (#10440) 2020-06-13 14:41:05 -07:00
Michael Vines
9eefb2c929 Bump version to 1.3.0 2020-05-28 15:01:13 -07:00
Tyera Eulberg
3ee702a922
Rpc: Add getCirculatingSupply endpoint, redux (#9953)
* Add Bank.clock() helper

* Add non-circulating calculations

* Plumb getSupply rpc endpoint

* Add docs for getSupply, and remove getTotalSupply from docs

* Add pubkeys! procedural macro

* Use procedural macro in non_circulating_supply
2020-05-09 12:05:29 -06:00
Michael Vines
8dfe0affd4
Add incinerator sysvar (#9815) 2020-04-30 22:04:08 -07:00
Michael Vines
47ae57610a Only build x86_64-unknown-linux-gnu on docs.rs 2020-04-16 19:06:17 -07:00
Michael Vines
d7fa40087c
Bump version to 1.2.0 2020-03-28 09:44:13 -07:00
Dan Albert
2d9d2f1e99
Update cargo versions from 1.0 to 1.1 (#8397) 2020-02-21 23:09:45 -08:00
Michael Vines
48f58a88bc Bump version to 1.0.0 2020-02-20 23:52:19 -07:00
Dan Albert
c324e71768
Bump cargo toml versions to 0.24.0 (#7976) 2020-01-25 11:04:27 -06:00
Dan Albert
ca10cf081f
Update cargo.toml files from 0.22.0 to 0.23.0 (#7596) 2019-12-20 21:45:42 -05:00
Justin Starry
7cfff75c3e Use procedural macro to generate static public keys (#7219)
automerge
2019-12-03 17:55:18 -08:00