Skip to content

fix: SignedPhase is removed from metadata#803

Merged
niklasad1 merged 7 commits intomainfrom
fix-borked-polkadot
Apr 5, 2024
Merged

fix: SignedPhase is removed from metadata#803
niklasad1 merged 7 commits intomainfrom
fix-borked-polkadot

Conversation

@niklasad1
Copy link
Copy Markdown
Contributor

@niklasad1 niklasad1 commented Apr 3, 2024

Because the constant SignedPhase is removed from the metadata we have no good alternative than to hardcode it for now.

The sign phase length is only used to configure the mortality of the submit solution transaction so not super critical if it's slighty off.

In addition I fetched the updated metadata from polkadot master in order to indicate that the signed phase is not exposed in the metadata anymore and updated some polkadot-sdk deps. (this will not break compatibility with older versions)

Because the `SignedPhase` is removed from the metadata we have no good
alternativ than to hardcode this constants for now.
@niklasad1 niklasad1 requested review from gpestana and jsdw April 3, 2024 16:16
Default::default(),
)?;
let params = DefaultExtrinsicParamsBuilder::new().nonce(nonce).build();
let xt = client.chain_api().tx().create_signed(&tx, &*signer, params).await?;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed API in subxt

}

/// Runs until the RPC connection fails or updating the metadata failed.
async fn runtime_upgrade_task(client: Client, tx: oneshot::Sender<Error>, mut spec_version: u32) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this bug has been fixed in subxt and we can rely on that now :)

/// Access to chain APIs such as storage, events etc.
chain_api: ChainClient,
/// Raw RPC client.
raw_rpc: RawRpcClient,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not needed anymore

//
// The extrinsic mortality length is static and doesn't know when the
// signed phase ends.
let signed_phase_len = client
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just to double check: Instead of fetching the signed phase constant from the chain, we define our own signed phase in the static types.rs. And this is because the constant from the chain wasn't what we'd expect?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

from the PR description: its because the SignedPhase is removed from westend in preparation for the merkalized metadata.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the SignedPhase is removed from the metadata and it will impact the other chains as well when they update the EPM pallet

Copy link
Copy Markdown

@lexnv lexnv left a comment

Choose a reason for hiding this comment

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

LGTM!

>(16)
);

// SYNC https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/westend/src/lib.rs#L451-#L453.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A crazy idea would be to have a macro which keeps this in sync at compile time or a CI job that fetches that value, but it sounds a bit too complicated since the signed phase depends on multiple constants defined in substrate 🤔

Copy link
Copy Markdown
Contributor

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

Looks sensible!

);

// SYNC https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/westend/src/lib.rs#L451-#L453.
pub const SIGNED_PHASE_LENGTH: u64 = 150;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a temp fix but I wonder if there are any ideas to make sure this value is up to date throughout all chains? or should we just keep a sensible upper bound since this is just used for the tx mortality?

If we leave it as is, I'd suggest us to rename SIGNED_PHASE_LENGTH to SIGNED_PHASE_LENGTH_ESTIMATE or something similar so that the const is now mistakenly used in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's removed now and I changed it to use babe::epoch_duration as upper bound/tx mortality ok?

@niklasad1 niklasad1 merged commit 7b0dc3d into main Apr 5, 2024
@niklasad1 niklasad1 deleted the fix-borked-polkadot branch April 5, 2024 13:25
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.

4 participants