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

Add a programs version #1045

Merged
merged 14 commits into from
Sep 16, 2024
Merged

Add a programs version #1045

merged 14 commits into from
Sep 16, 2024

Conversation

JesseAbram
Copy link
Member

@JesseAbram JesseAbram commented Sep 11, 2024

Adds a version number to programs

Closes #688

Paired with entropyxyz/programs#91

@JesseAbram JesseAbram changed the title Programs version Add a programs version Sep 11, 2024
@JesseAbram JesseAbram marked this pull request as ready for review September 11, 2024 20:40
@JesseAbram JesseAbram requested review from HCastano and ameba23 and removed request for HCastano September 11, 2024 20:41
Copy link
Contributor

@ameba23 ameba23 left a comment

Choose a reason for hiding this comment

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

+1 for everything here.

As i mentioned in the programs PR, the only thing i am unsure about would be to maybe make the version number actually be the major/minor version number of entropy-programs-runtime. So the current version would be 0.10 rather than 0.

@@ -14,6 +14,7 @@ tagged as the final release.
- [ ] If an existing call/extrinsic has changed (new pallet index, new call index, parameter changes,
etc.), bump `transaction_version` and bump `spec_version`
- [ ] If you're confused about what to bump, read [this](https://paritytech.github.io/polkadot-sdk/master/sp_version/struct.RuntimeVersion.html)
- [ ] If the programs runtime has been updated increment ```PROGRAM_VERSION_NUMBER``` in ```shared``` crate
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -109,6 +112,8 @@ enum CliCommand {
/// interface. If no such file exists, it is assumed the program has no configuration
/// interface.
programs: Vec<String>,
/// Option of version numbers to go with the programs, will default to 0 if None
program_version_numbers: Option<Vec<u8>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm this is not going to be very nice to use, but i can't think of a better suggestion

Copy link
Member Author

Choose a reason for hiding this comment

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

ya this took me a bit, was easy until I realized launch a program was possible in all these calls, this was my best solution, we can play with it in the future and change it if it sucks

crates/test-cli/src/lib.rs Outdated Show resolved Hide resolved
pallets/programs/src/lib.rs Outdated Show resolved Hide resolved
pallets/programs/src/lib.rs Outdated Show resolved Hide resolved
@@ -76,3 +76,6 @@ pub const SIGNER_THRESHOLD: u8 = 2;

/// For testing to line up chain mock data and reshare_test
pub const TEST_RESHARE_BLOCK_NUMBER: u32 = 5;

/// Program version number, must be incremented if version number changes
pub const PROGRAM_VERSION_NUMBER: u8 = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't yet have a check for this when evaluating the program, but when we do, i think it might make sense for this constant to be exported by entropy-programs-runtime so that it will always match the runtime version(s) which are actually used.

The argument not to would be if we need this constant in the program's pallet, so that we can refuse to accept programs with an unsupported version number.

Copy link
Member Author

Choose a reason for hiding this comment

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

I struggled with this decision a little, I came to this for a few reasons, one was it is a PITA the way we are pulling stuff into the templates to make a change and see it reflected. Also we would also have any changes need to be reflected in core before it is usable, and this keeps our updates for releases to core

Copy link
Member Author

Choose a reason for hiding this comment

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

#1056 opened this

Copy link
Collaborator

@HCastano HCastano left a comment

Choose a reason for hiding this comment

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

I think there's a better way to manage versions probably leaning into using the programs-runtime a bit more, but this is fine for now.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
RELEASE_CHECKLIST.md Outdated Show resolved Hide resolved
@@ -196,6 +196,7 @@ pub async fn sign(
}

/// Store a program on chain and return it's hash
#[allow(clippy::too_many_arguments)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe time to couple the input data

crates/test-cli/src/lib.rs Show resolved Hide resolved
crates/test-cli/src/lib.rs Outdated Show resolved Hide resolved
crates/test-cli/src/lib.rs Outdated Show resolved Hide resolved
crates/test-cli/src/lib.rs Outdated Show resolved Hide resolved
pallets/programs/src/benchmarking.rs Outdated Show resolved Hide resolved
@JesseAbram JesseAbram merged commit cc86177 into master Sep 16, 2024
8 checks passed
@JesseAbram JesseAbram deleted the programs-version branch September 16, 2024 19:43
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.

Add a version number to program Info
3 participants