Skip to content

Conversation

@drozdziak1
Copy link
Contributor

Motivation

The legacy pythd config scheme, using individual files for storing program/mapping/accumulator public keys, is inconvenient and its defaults are misleading. This change replaces the key store root path and individual files with inlined base-58 pubkeys and a single path to reach the publishing keypair. Additionally, the inlined string keys make it much more convenient to distribute complete sample configs to publishers.

Summary of changes

  • Bumped package version to v2.0.0 - this is a breaking change that will prevent users from running the service without updating their config for the new schema.
  • solana.rs: Changed KeyStore options to use base58 strings instead of file paths
  • src/bin/agent_migrate_config.rs - Implemented a small migration tool that will find and inline the file-based pubkeys in an existing config, making it work with the breaking change.
  • README.md: Provided migration instructions for both agent-migrate-config and updating by hand.
  • integration-tests/ - Updated the test fixtures to prepare an up-to-date config, added a test confirming that agent-migrate-config works
  • config/ - Updated default and sample configs

Review Highlights

  • I've manually updated the sample configs to contain pubkeys relevant to each network. It is important that they are correct.
  • I wrote a section about keystore migration in README.md. It is important that the description is easy to follow.

Testing

  • Tests continue to pass after updating them to build a config with the new schema
  • agent-migrate-config is tested by converting a legacy config and using it to perform the simple test case

This **breaking** change improves on the legacy file-based keystore
appoach to program/mapping public keys. With it, the user can name the
public keys in-line, e.g.:
'key_store.program_key_path = "program_key.json"'
is now expressed as:
'key_store.program_key = "FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH"'

This change is accompanied with a small tool to inline the public keys
from an older file-based config, named "agent-migrate-config".

The sample configs are rewritten to use the new format and name the
appropriate pubkeys out-of-the-box.

Tests include a sanity-check for the migration tool.
This is necessary to provide the agent with an altered migrated
config.
Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

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

very nicely done

}
}

// Helper methods for strinigified SOL addresses
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: stringified

@drozdziak1 drozdziak1 merged commit aeaaaf5 into main Jul 17, 2023
@drozdziak1 drozdziak1 deleted the drozdziak1/inlined-pubkeys-in-config branch July 17, 2023 14:35
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