Commit Graph

1258 Commits

Author SHA1 Message Date
ab871ed4b7 Bump bpf-tools version to 1.8 2021-05-18 08:10:57 +02:00
e02b4e1192 Fix a bug in input deserialization in the C SDK (#17217)
When the input contains more accounts than the user has requested to be deserialized, and one of the excess ones is a dup, the input pointer is not adjusted correctly.

Compare the lines added by this commit to line 401: "input += 7; // padding". Since the input data layout does not depend on the number of accounts the user wants to deserialize, this adjustment by 7 bytes must happen in both branches.
2021-05-14 16:41:55 -06:00
b437b0a49d Add bip32 support to solana-keygen recover (#17180)
* Fix spelling

* Add validator for  SignerSources

* Add helper to generate Keypair from supporting SignerSources

* Add bip32 support to solana-keygen recover

* Make SignerSourceKind const strs, use for Debug impl and URI schemes
2021-05-12 19:33:11 +00:00
88626b2945 Bump bpf-tools version to 1.7 (#17176) 2021-05-11 19:51:20 +00:00
dbac38702a sdk: keypair - drop superfluous iter() 2021-05-11 13:07:58 -06:00
967840aed6 sdk: Move signers module into signer module 2021-05-11 13:07:58 -06:00
b71e4bdc61 sdk: Move NullSigner to signer module 2021-05-11 13:07:58 -06:00
12bf6c06c3 sdk: Move Presigner to signer module 2021-05-11 13:07:58 -06:00
0eba6eb401 sdk: Move Keypair to signer module 2021-05-11 13:07:58 -06:00
af6f3d776e sdk: Move Signer trait to own module 2021-05-11 13:07:58 -06:00
77272a17b3 Fix dump postprocessing in cargo-build-bpf (#17165) 2021-05-11 09:24:12 +00:00
a5ec3a0547 SignerSource: rename input scheme to prompt, default to bip44 solana base key (#17154)
* Rename ask to prompt

* Default to Solana bip44 base if no derivation-path

* Add SignerSource legacy field, support legacy ASK

* Update docs

* Fix docs: validator current doesn't support uri SignerSources
2021-05-10 19:28:47 -06:00
8eb05d6ed4 Add Keccak256 syscall and sdk support (#16498) 2021-05-10 16:16:58 -07:00
82fb6712e7 fix c program deploy help (#17152) 2021-05-10 15:38:01 -07:00
4b60b2863e sdk: Add get_instance_packed_len for variable-size types (#17092)
* sdk: Add get_instance_packed_len for variable-size types

* Add comment for get_packed_len

* Add more tests
2021-05-10 23:31:02 +02:00
ff95e2aaa6 Add a make target to run the readelf utility on a compiled program
The readelf utility (already shipped with the solana tools) shows meta-information about ELF files, such as symbol tables. It is useful for investigating "unresolved symbol" errors that crop up at runtime.

This commit also fixes the objdump flags (two dashes are required and there is no "color" option) as well as a few typos.
2021-05-08 18:49:14 -07:00
6927d0c77e Fix syscalls in the C SDK failing at runtime when compiled as C++ (#17124)
Some syscalls are wrongly declared "static" in solana_sdk.h, which makes clang++ assume they are local to the compilation unit. It therefore ignores the extern "C" {} block and mangles their names. While that doesn't break C++ compilation, the syscall fails at runtime with something along the lines of "ELF error: Unresolved symbol (_ZL26sol_create_program_addressPK13SolSignerSeediPK9SolPubkeyS4_)".
2021-05-08 16:31:50 +00:00
9abfa65920 Document that Transaction::sign might panic (#17026) 2021-05-04 08:32:21 -07:00
694c674aa6 Implement Bip32 for seed-phrase/passphrase signing (#16942)
* Add Keypair helpers for bip32 derivation

* Plumb bip32 for SignerSourceKind::Ask

* Support full-path querystring

* Use as_ref

* Add public wrappers for from_uri cases

* Support master root derivations (and fix too-deep print

* Add ask:// HD documentation

* Update ASK elsewhere in docs
2021-05-03 19:58:56 -06:00
92b8b20ca5 AccountSharedData.lamports private (#16985) 2021-05-03 17:25:31 +00:00
ac87bc40ca tests: .lamports -> .lamports() (#16976) 2021-04-30 18:16:58 +00:00
3f982fcf65 account.rent_epoch private (#16974) 2021-04-30 12:16:44 -05:00
d6f30b7537 Refactor SignerSource to expose DerivationPath to other kinds of signers (#16933)
* One use statement

* Add stdin uri scheme

* Convert parse_signer_source to return Result

* A-Z deps

* Convert Usb data to Locator

* Pull DerivationPath out of Locator

* Wrap SignerSource to share derivation_path

* Review comments

* Check Filepath existence, readability in parse_signer_source
2021-04-29 01:42:21 -06:00
cfc1cb1aee SDK: Factor out pubkey on-curve test to a helper 2021-04-28 20:10:19 -06:00
f533d3be77 Write account path impl ReadableAccount (#16779) 2021-04-28 15:29:22 -05:00
9218b51de7 accountshareddata.executable is private (#16882) 2021-04-28 12:01:31 -05:00
da3342759b private AccountSharedData.rent_epoch (#16877) 2021-04-28 08:52:20 -05:00
4ce4f04c58 remote-wallet: derivation-path crate doesn't like empty trailing child indexes 2021-04-27 17:54:02 -06:00
722de942ca SDK: More conversion for DerivationPath 2021-04-27 17:54:02 -06:00
9b7120bf73 SDK: More conversions for Pubkey 2021-04-27 17:54:02 -06:00
9b3a59f030 Retain alloc'd and updated data in cpi (#16850) 2021-04-27 13:36:42 -07:00
998cba74b5 AccountSharedData.executable() (#16835) 2021-04-27 09:12:17 -05:00
603872685d private AccountSharedData.owner (#16760)
* private AccountSharedData.owner

* fix perf test
2021-04-26 14:59:17 -05:00
9706512115 removes old runtime feature gates in gossip and turbine (#16633) 2021-04-26 17:12:02 +00:00
f2ab0384e4 owner -> owner() (#16783) 2021-04-26 17:06:40 +00:00
8ce4a8d6ab Annotate clock constants with computed values for quick refeerence (#16812) 2021-04-25 22:05:00 +08:00
1a4a7059af owner -> owner() (#16785) 2021-04-23 15:59:13 -05:00
1500011fc6 get_packed_len() now correctly handles u32/i32 types 2021-04-23 13:39:42 -07:00
48c07d32f0 WritableAccount.add/subtract_lamports (#16750)
* add/sub lamports

* make add/sub return Result

* sample replacements

* cleanup

* fix up a few tests as examples

* move enum, cleanup, impl from

* fmt

* cleanup

* add lamports.rs
2021-04-23 20:20:48 +00:00
87e2e07d34 AccountSharedData.copy_into_owner_from_slice (#16755) 2021-04-23 09:34:08 -05:00
fc12841d95 Readonlyaccounts (#16743)
* lamports -> lamports()

* format
2021-04-22 20:04:55 +00:00
8a6b80095e Set lamports (#16747)
* lamports = -> set_lamports()

* .lamports = X -> .set_lamports(X)
2021-04-22 13:53:06 -05:00
be4df39a4c Remove unactivated ristretto syscall (#16727) 2021-04-22 09:29:42 -07:00
b8b54567b1 Clean up "APR" language around inflation rewards 2021-04-21 19:02:03 -07:00
1a658c7f31 Allow SetUpgradeAuthority instruction in CPI calls (#16676)
* feat: allow SetAuthority in CLI calls

* chore: clippy match_like_matches_macro

* chore: clippy match_like_matches_macro

* chore: rename CLI to CPI

* chore: move check for cpi authorised instruction to syscalls

* chore: add set_upgrade_authority cpi test

* chore: assert upgrade authority was changed

* feat: gate set_upgrade_authority via cpi with a feature

* chore: move feature to the end of the list

* chore: remove white spaces

* chore: remove white spaces

* chore: update comment to rerun build
2021-04-22 00:06:59 +01:00
03f7b251b8 ReadableAccount.data returns slice (#16686)
* ReadAbleAccount.data returns slice

* more slice fixup

* more slice

* slice
2021-04-20 16:41:16 -05:00
08d5253651 Enforce host aligned memory for program regions (#16590) 2021-04-20 11:07:30 -07:00
01786f684e Remove unwrap (#16652) 2021-04-19 20:17:56 -07:00
185bbf2db5 Wrap derivation_path::DerivationPath (#16609)
* Replace custom DerivationPath impl

* Add method to parse full-path from str with hardening

* Convert Bip44 to trait

* Hoist more work on derivation-path

* Privatize Bip44 trait
2021-04-19 20:57:43 +00:00
9dfcb921cf Refactoring: Move KeyedAccounts to InvokeContext (#15410)
Collects all parametric occurrences and the construction of keyed_accounts and puts them into InvokeContext.
2021-04-19 18:48:48 +02:00