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

Consider non-zero default nonce #248

Open
ggwpez opened this issue Mar 19, 2024 · 7 comments
Open

Consider non-zero default nonce #248

ggwpez opened this issue Mar 19, 2024 · 7 comments

Comments

@ggwpez
Copy link
Member

ggwpez commented Mar 19, 2024

New or resurrected accounts use Nonce::default() that returns 0 in the Polkadot runtime.
We could change this to return the current block number, to avoid replay of immortal transactions.

Any downsides? Yea, its slower but nothing else i think.

@bkchr
Copy link
Contributor

bkchr commented Mar 25, 2024

Yeah sounds good. We can include it in 1.3.0.

@bkchr bkchr mentioned this issue Mar 25, 2024
9 tasks
@kianenigma
Copy link
Contributor

and once paritytech/polkadot-sdk#1557 is merged and release I suppose?

@ggwpez
Copy link
Member Author

ggwpez commented Apr 1, 2024

and once paritytech/polkadot-sdk#1557 is merged and release I suppose?

We can do it without that actually.

@kianenigma
Copy link
Contributor

New or resurrected accounts use Nonce::default() that returns 0 in the Polkadot runtime.
We could change this to return the current block number, to avoid replay of immortal transactions.

Ah so you are suggesting a newtype for nonce with custom Default impl? yes, makes sense.

@xlc
Copy link
Contributor

xlc commented Apr 12, 2024

This will confuse block explorer and indexer

@bkchr
Copy link
Contributor

bkchr commented Apr 12, 2024

This will confuse block explorer and indexer

Why? I think the problem is bigger for wallets.

github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this issue May 6, 2024
Needed for: polkadot-fellows/runtimes#248

This PR introduces a new type `TypeWithDefault<T, D: Get<T>>` to be able
to provide a custom default for any type. This can, then, be used to
provide the nonce type that returns the current block number as the
default, to avoid replay of immortal transactions.

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
hitchhooker pushed a commit to ibp-network/polkadot-sdk that referenced this issue Jun 5, 2024
Needed for: polkadot-fellows/runtimes#248

This PR introduces a new type `TypeWithDefault<T, D: Get<T>>` to be able
to provide a custom default for any type. This can, then, be used to
provide the nonce type that returns the current block number as the
default, to avoid replay of immortal transactions.

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@bkchr
Copy link
Contributor

bkchr commented Jul 26, 2024

@ggwpez do you still want to tackle this?

TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this issue Aug 2, 2024
Needed for: polkadot-fellows/runtimes#248

This PR introduces a new type `TypeWithDefault<T, D: Get<T>>` to be able
to provide a custom default for any type. This can, then, be used to
provide the nonce type that returns the current block number as the
default, to avoid replay of immortal transactions.

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
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

No branches or pull requests

4 participants