Skip to content

Commit

Permalink
backport: crates 0.20.1 had two important fixes that has to be in 1.3…
Browse files Browse the repository at this point in the history
…7.x release (#10754)

* #10476
* #10481

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Simonas Kazlauskas <git@kazlauskas.me>
  • Loading branch information
3 people authored Mar 11, 2024
1 parent 77f40fa commit 9a1a010
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions core/primitives/src/action/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,13 @@ pub enum Action {
DeleteAccount(DeleteAccountAction),
Delegate(Box<delegate::SignedDelegateAction>),
}
// Note: If this number ever goes down, please adjust the equality accordingly. Otherwise,
// we would get used to better performance and would be subject to a performance loss should
// we come back up to 32 bytes later on.
// If compiling with nightly, this check may fail due to new optimizations introduced by
// rustc. So, cfg-them out, as our production system only runs with stable.
#[cfg(not(fuzz))]

const _: () = assert!(
cfg!(not(target_pointer_width = "64")) || std::mem::size_of::<Action>() == 32,
"Action is 32 bytes for performance reasons, see #9451"
// 1 word for tag plus the largest variant `DeployContractAction` which is a 3-word `Vec`.
// The `<=` check covers platforms that have pointers smaller than 8 bytes as well as random
// freak nightlies that somehow find a way to pack everything into one less word.
std::mem::size_of::<Action>() <= 32,
"Action <= 32 bytes for performance reasons, see #9451"
);

impl Action {
Expand Down

0 comments on commit 9a1a010

Please sign in to comment.