Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default programs static #9717

Merged
merged 7 commits into from
Apr 28, 2020

Conversation

jackcmay
Copy link
Contributor

Problem

Default programs are currently dynamic and dynamic programs run into this issue when Solana validators are used outside the Solana repo: #5966

Summary of Changes

  • Pull the default programs in statically
  • Cleanup bank's program registration functions

Fixes #

garious
garious previously approved these changes Apr 25, 2020
Copy link
Contributor

@garious garious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we don't need the config program in there too?

@jackcmay
Copy link
Contributor Author

@garious I don't really see any reason not to include config as well. Your hello-rpc test passes without it :-)

@garious
Copy link
Contributor

garious commented Apr 25, 2020

@mvines, config too?

@jackcmay
Copy link
Contributor Author

@mvines Aware of any issues with genesis or backward compatibility

@mergify mergify bot dismissed garious’s stale review April 25, 2020 01:27

Pull request has been modified.

solana_vote_program::id(),
solana_vote_program::vote_instruction::process_instruction,
);

// Add additional native programs specified in the genesis config
for (name, program_id) in &genesis_config.native_instruction_processors {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The genesis_config for mainnet-beta, testnet, and devnet all have the now static programs in native_instruction_processors, so I think if one tried to start from genesis again then we'd get a conflict here. This generally shouldn't matter but I think we could probably avoid the conflict if add_native_program did nothing should an account at program_id already exist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I removed that assert

@mvines
Copy link
Member

mvines commented Apr 25, 2020

@mvines Aware of any issues with genesis or backward compatibility

Only that one comment I made. However it'd be a worthwhile test to confirm that solana-validator with this PR can connect to and observe activity on mainnet-beta

@jackcmay
Copy link
Contributor Author

@mvines What is the current prescribed process for me to try this out on mainnet-beta?

@mvines
Copy link
Member

mvines commented Apr 27, 2020

@mvines What is the current prescribed process for me to try this out on mainnet-beta?

Boot your own validator and see if it can keep up. Sample validator arguments at (but don't bother giving a --vote-account):
https://docs.solana.com/clusters#example-solana-validator-command-line-2

garious added a commit to solana-labs/solana-tokens that referenced this pull request Apr 27, 2020
Won't work until this lands and is released:

solana-labs/solana#9717
@jackcmay
Copy link
Contributor Author

@mvines
Validator is 1007 slots away (us:79447978 them: 7945786) and falling behind at -1.2 slots/second

@mvines
Copy link
Member

mvines commented Apr 28, 2020

@mvines
Validator is 1007 slots away (us:79447978 them: 7945786) and falling behind at -1.2 slots/second

That may or may not be a problem. (1) if you let it run longer does it make progress, (2) is the behaviour same/different without this PR?

@jackcmay
Copy link
Contributor Author

@mvines Ran a validator with both my branch and master, both fall behind at a similar rate. Don't see anything weird in the logs afaict

@codecov
Copy link

codecov bot commented Apr 28, 2020

Codecov Report

Merging #9717 into master will increase coverage by 0.0%.
The diff coverage is 95.6%.

@@          Coverage Diff           @@
##           master   #9717   +/-   ##
======================================
  Coverage    80.5%   80.6%           
======================================
  Files         279     280    +1     
  Lines       63869   63836   -33     
======================================
+ Hits        51465   51496   +31     
+ Misses      12404   12340   -64     

@jackcmay jackcmay merged commit efad193 into solana-labs:master Apr 28, 2020
@jackcmay jackcmay deleted the static-default-programs branch April 28, 2020 04:05
@garious
Copy link
Contributor

garious commented Apr 28, 2020

Thanks @jackcmay!

@jackcmay jackcmay added the v1.1 label Apr 30, 2020
mergify bot pushed a commit that referenced this pull request Apr 30, 2020
(cherry picked from commit efad193)

# Conflicts:
#	Cargo.lock
#	genesis-programs/Cargo.toml
#	programs/bpf/Cargo.lock
#	programs/librapay/Cargo.lock
#	programs/librapay/src/librapay_transaction.rs
#	runtime/Cargo.toml
#	runtime/src/genesis_utils.rs
#	runtime/src/message_processor.rs
solana-grimes pushed a commit that referenced this pull request Apr 30, 2020
garious added a commit that referenced this pull request May 13, 2020
* Initial commit

* Execute transfers

* Refactor for testing

* Cleanup readme

* Rewrite

* Cleanup

* Cleanup

* Cleanup client

* Use a Null Client to move prints closer to where messages are sent

* Upgrade Solana

* Move core functionality into its own module

* Handle transaction errors

* Merge allocations

* Fixes

* Cleanup readme

* Fix markdown

* Add example input

* Add integration test - currently fails

* Add integration test

* Add metrics

* Use RpcClient in dry-run, just don't send messages

* More metrics

* Fix dry run with no keys

* Only require one approval if fee-payer is the sender keypair

* Fix bugs

* Don't create the transaction log if nothing to put into it;
  otherwise the next innvocation won't add the header

* Apply previous transactions to allocations with matching recipients

* Bail out of any account already has a balance

* Polish

* Add new 'balances' command

* 9 decimal places

* Add missing file

* Better dry-run; keypair options now optional

* Change field name from 'bid' to 'accepted'

Also, tolerate precision change from 2 decimal places to 4

* Write to transaction log immediately

* Rename allocations_csv to bids_csv

So that we can bypass bids_csv with an allocations CSV file

* Upgrade Solana

* Remove faucet from integration test

* Cleaner integration test

Won't work until this lands and is released:

#9717

* Update README

* Add TravicCI script to build and test (#1)

* Add distribute-stake command (#2)

* Distribute -> DistributeTokens (#3)

* Cache cargo deps (#4)

* Add docs (#5)

* Switch to latest Solana 1.1 release (#7)

* distribute -> distribute-tokens (#9)

* Switch from CSV to a pickledb database (#8)

* Switch from CSV to a pickledb database

* Allow PickleDb errors to bubble up

* Dedup

* Hoist db

* Add finalized field to TransactionInfo

* Don't allow RPC client to resign transactions

* Remove dead code

* Use transport::Result

* Record unconfirmed transaction

* Fix: separate stake account per allocation

* Catch transport errors

* Panic if we attempt to replay a transaction that hasn't been finalized

* Attempt to fix CI

PickleDb isn't calling flush() or close() after writing to files.
No issue on MacOS, but looks racy in CI.

* Revert "Attempt to fix CI"

This reverts commit 1632394f636c54402b3578120e8817dd1660e19b.

* Poll for signature before returning

* Add --sol-for-fees option for stake distributions

* Add --allocations-csv option (#14)

* Add allocations-csv option

* Add tests or GTFO

* Apply review feedback

* apply feedback

* Add read_allocations function

* Update arg_parser.rs

* Fix balances command (#17)

* Fix balances command

* Fix readme

* Add --force to transfer to non-empty accounts (#18)

* Add --no-wait (#16)

* Add ThinClient methods to implement --no-wait

* Plumb --no-wait through

No tests yet

* Check transaction status on startup

* Easier to test

* Wait until transaction is finalized before checking if it failed with an error

It's possible that a minority fork thinks it failed.

* Add unit tests

* Remove dead code and rustfmt

* Don't flush database to file if doing a dry-run

* Continue when transactions not yet finalized (#20)

If those transactions are dropped, the next run will execute them.

* Return the number of confirmations (#21)

* Add read_allocations() unit-test (#22)

Delete the copy-pasted top-level test.

Fixes #19

* Add a CSV printer (#23)

* Remove all the copypasta (#24)

* Move resolve_distribute_stake_args into its own function

* Add stake args to token args

* Unify option names

* Move Command::DistributeStake into DistributeTokens

* Remove process_distribute_stake

* Only unique signers

* Use sender keypair to fund new fee-payer accounts

* Unify distribute_tokens and distribute_stake

* Rename print-database command to transaction-log (#25)

* Send all transactions as quickly as possible, then wait (#26)

* Send all transactions as quickly as possible, then wait

* Exit when finalized or blockhashes have expired

* Don't need blockhash in the CSV output

* Better types

CSV library was choking on Pubkey as a type. PickleDb doesn't have that problem.

* Resend if blockhash has not expired

* Attempt to fix CI

* Move log to stderr

* Add constructor, tuck away client (#30)

* Add constructor, tuck away client

* Fix unwrap() caught by CI

* Fix optional option flagged as required

* Bunch of cleanup (#31)

* Remove untested --no-wait feature

* Make --transactions-db an option, not an arg

So that in the future, we can make it optional

* Remove more untested features

Too many false positives in that santity check.  Use --dry-run
instead.

* Add dry-run mode to ThinClient

* Cleaner dry-run

* Make key parameters required

Just don't use them in --dry-run

* Add option to write the transaction log

--dry-run doesn't write to the database. Use this option if you
want a copy of the transaction log before the final run.

* Revert --transaction-log addition

Implement #27 first

* Fix CI

* Update readme

* Fix CI in copypasta

* Sort transaction log by finalized date (#33)

* Make --transaction-db option implicit (#34)

* Move db functionality into its own module (#35)

* Move db functionality into its own module

* Rename tokens module to commands

* Version bump

* Upgrade Solana

* Add solana-tokens to build

* Remove Cargo.lock

* Remove vscode file

* Remove TravisCI build script

* Install solana-tokens

Co-authored-by: Dan Albert <dan@solana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants