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

Upgrade script to use usecs after timestamp upgrading timestamp logic #1075

Merged
merged 155 commits into from
Mar 4, 2025

Conversation

l-monninger
Copy link
Collaborator

Summary

  • RFCs: Link to RFC, Link to RFC, or $\emptyset$.
  • Categories: any of protocol-units, networks, scripts, util, cicd, or misc.

#1067 changes fixes a bug that emerged from the unsuccessful marshaling of secs and usecs across upgrades. This is a downstream response to that change.

Changelog

Testing

just movement-full-node native build.setup.eth-local.celestia-local.test-bring-up-elsa-to-biarritz-rc1

Outstanding issues

l-monninger and others added 30 commits December 17, 2024 10:38
Provide From conversion impls to construct
PrivateKey and Signature from byte arrays.
The conversions into PrivateKey are fallible, while
a Signature is allowed to be constructed from any
64 bytes.
Add TestSigner providing an in-process Signing
implementation for tests.
TryFromBytes is not needed, neither is the public key
as a member of HashiCorpVault state.
Comment on lines +83 to +106

impl<C> TryFrom<block::Id> for InnerSignedBlobV1Data<C>
where
C: Curve + Verify<C> + Digester<C>,
{
type Error = anyhow::Error;

fn try_from(id: block::Id) -> Result<Self, Self::Error> {
let blob = id.as_bytes().to_vec();
Ok(Self::now(blob))
}
}

impl<C> TryFrom<Vec<block::Id>> for InnerSignedBlobV1Data<C>
where
C: Curve + Verify<C> + Digester<C>,
{
type Error = anyhow::Error;

fn try_from(ids: Vec<block::Id>) -> Result<Self, Self::Error> {
let blob = bcs::to_bytes(&ids)?;
Ok(Self::now(blob))
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

These conversions look suspicious next to TryFrom<Block>, and they were previously removed. Is it really so that a blob can encode a block, a single ID, or an array of IDs, with nothing to discriminate?
The change also does not seem to belong with the rest of the PR. A stray checkout, perhaps?

@@ -162,7 +162,7 @@ where
let now_u64 = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map_err(|e| ReleaseBundleError::Build(e.into()))?
.as_secs();
.as_micros() as u64;
let expiration_timestamp_secs = now_u64 + expiration_timestamp_sec_offset;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This value seems wrongly computed now, if expiration_timestamp_sec_offset is still in seconds.

We could benefit from a Timestamp domain type with controlled conversions.

@mzabaluev mzabaluev requested a review from andygolay March 3, 2025 14:24
Copy link
Contributor

@andygolay andygolay left a comment

Choose a reason for hiding this comment

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

@mzabaluev @l-monninger is the test command correct? When I run

 nix develop --extra-experimental-features nix-command --extra-experimental-features flakes --command bash  -c "just movement-full-node native build.setup.eth-local.celestia-local.test-bring-up-elsa-to-biarritz-rc1"

I get error: Recipe movement-full-node failed on line 6 with exit code 101

@andygolay
Copy link
Contributor

@l-monninger @mzabaluev @0xmovses as far as I can tell, this is incorrect, because:

In maptos/framework/releases/elsa/src/bin/release.rs main function we have

	elsa.release(
		&local_account_release_signer,
		2_000_000,
		100,
		// 60 seconds from now as u64
		60,
		&rest_client,
	)

fn release is clearly taking as seconds for its expiration_timestamp_sec_offset param:

	fn release(
		&self,
		signer: &impl ReleaseSigner,
		max_gas_amount: u64,
		gas_unit_price: u64,
		expiration_timestamp_sec_offset: u64,
		client: &Client,

Same with in this function:

	pub async fn migrate_framework_from_elsa_to_biarritz_rc1(
		&self,
		client: &aptos_sdk::rest_client::Client,
		signer: &impl ReleaseSigner,
	) -> Result<(), ElsaToBiarritzRc1Error> {
		// todo: validate that the current release is Elsa

		// upgrade to Biarritz RC1 with the gas upgrade
		let biarritz_rc1 = BiarritzRc1::new();
		biarritz_rc1
			.release(signer, 2_000_000, 100, 60_000, client)
			.await
			.map_err(|e| ElsaToBiarritzRc1Error::MigrationFailed(e.into()))?;

		Ok(())
	}

60,000 seconds is 16.7 hours, whihc makes sense for allowing votes on the migration, if I understand it correctly.

release calls propose_release with the same params, so don't we need to change all calls of release so microseconds are passed in for expiration_timestamp_sec_offset?

I might be misunderstanding it, but yeah I seem to be resonating with Mikhail's comment: #1075 (comment)

Still looking into the details for greater certainty and best solutions. I'm not sure how easy it would be to implement the Timestamp domain type but it does seem like a good idea at face value.

@radupopa369 radupopa369 merged commit 9cedb2a into main Mar 4, 2025
123 of 127 checks passed
mcmillennick pushed a commit that referenced this pull request Mar 9, 2025
…logic (#1075)

Co-authored-by: Andy Golay <andygolay@gmail.com>
Co-authored-by: musitdev <philippe.delrieu@free.fr>
Co-authored-by: Mikhail Zabaluev <mikhail.zabaluev@movementlabs.xyz>
Co-authored-by: Richard Melkonian <35300528+0xmovses@users.noreply.github.com>
Co-authored-by: Icarus131 <anirudhprasad131@protonmail.com>
Co-authored-by: primata <primata@movementlabs.xyz>
Co-authored-by: Icarus131 <anirudhprasad131@gmail.com>
Co-authored-by: Richard Melkonian <r.v.melkonian@gmail.com>
Co-authored-by: Radu Popa <radupopa21be@gmail.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.

5 participants