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

refactor(precompile): make use of padding utilities, simplify secp256k1 #1073

Merged
merged 2 commits into from Feb 11, 2024

Conversation

DaniPopes
Copy link
Collaborator

@DaniPopes DaniPopes commented Feb 10, 2024

... and some other minor refactors.

In secp256k1 both backends expect a 64-byte signature and the recovery ID in two separate arguments, therefor there is no point in packing them into a 65-byte array only to unpack them right after.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

changes lgtm

defer to @rakita re function arg changes


let mut output = [0u8; 32];
hasher.finalize_into((&mut output[12..]).into());
Ok((gas_used, output.to_vec()))
Copy link
Member

Choose a reason for hiding this comment

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

The previous version seems better

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

::digest returns a new array so this avoids the copy_from_slice by directly using the output buffer

@@ -181,8 +181,8 @@ impl Precompiles {

/// Returns the precompile for the given address.
#[inline]
pub fn get(&self, address: &Address) -> Option<Precompile> {
self.inner.get(address).cloned()
pub fn get(&self, address: &Address) -> Option<&Precompile> {
Copy link
Member

Choose a reason for hiding this comment

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

Precompile is just a function, as we know concrete type, it is okay to clone it

} else {
gas.as_limbs()[0]
}
gas.saturating_to()
Copy link
Member

Choose a reason for hiding this comment

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

Liking this a lot!

@rakita rakita merged commit 9fd79fb into bluealloy:main Feb 11, 2024
25 checks passed
@DaniPopes DaniPopes deleted the precompiles-1 branch February 11, 2024 19:42
CeciliaZ030 added a commit to CeciliaZ030/revm that referenced this pull request Feb 22, 2024
CeciliaZ030 added a commit to CeciliaZ030/revm that referenced this pull request Mar 27, 2024
commit b960c3f
Merge: 983db4b 70ab8b6
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:28:32 2024 +0800

    Merge remote-tracking branch 'cecilia/main' into sync-taiko-v3.5

commit 983db4b
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:21:10 2024 +0800

    non exclusive op & taiko flags

commit 115d5fe
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:11:48 2024 +0800

    cleanup

commit 7b0065b
Merge: c306f98 9d655c4
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:06:29 2024 +0800

    Merge remote-tracking branch 'cecilia/main' into sync-taiko-v3.5

commit c306f98
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:02:19 2024 +0800

    handler register

commit 72a085e
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 16:02:07 2024 +0800

    fix specs and conditional op/taiko flags, todo: taiko handlers

commit 3ec69ee
Merge: a983b13 9a03c7e
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 16:01:11 2024 +0800

    Merge remote-tracking branch 'cecilia/serde-no-std' into sync-taiko-v3.5

commit 9a03c7e
Merge: cf4da2f 0629883
Author: CeciliaZ030 <45245961+CeciliaZ030@users.noreply.github.com>
Date:   Thu Jan 18 14:44:30 2024 +0800

    Merge branch 'main' into serde-no-std

commit cf4da2f
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 14:35:37 2024 +0800

    "preserve_order"

commit 6f95113
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 14:33:28 2024 +0800

    delete comment #"std"

commit 15c51fa
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 13:30:33 2024 +0800

    optional serde std

commit a983b13
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 13:30:33 2024 +0800

    optional serde std

commit 546cb51
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 12:47:50 2024 +0800

    update

commit f0d6806
Author: Leo Alt <leo@ethereum.org>
Date:   Fri Nov 24 16:32:08 2023 +0100

    use serde as no-std

commit 0546172
Merge: c7aee3a 327dc05
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Wed Jan 17 03:46:52 2024 +0800

    Merge remote-tracking branch 'john/feat/taiko' into cecilia-taiko

commit c7aee3a
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Wed Jan 17 03:11:35 2024 +0800

    init

commit 327dc05
Author: john xu <john@taiko.xyz>
Date:   Mon Dec 18 06:58:08 2023 +0000

    Refactor handler functions in EVM implementation

commit 2e96144
Author: john xu <john@taiko.xyz>
Date:   Sat Dec 9 07:59:10 2023 +0000

    Add condition to disable gas refund for anchor transactions

commit 13c2272
Author: john xu <john@taiko.xyz>
Date:   Sat Dec 9 07:21:01 2023 +0000

    Remove once_cell dependency

commit 6c6b061
Author: john xu <john@taiko.xyz>
Date:   Sat Dec 9 07:13:20 2023 +0000

    Add taiko module and handler

commit cbbfe9c
Author: Leo Alt <leo@ethereum.org>
Date:   Fri Nov 24 16:32:08 2023 +0100

    use serde as no-std

commit 0e7d779
Author: john xu <john@taiko.xyz>
Date:   Thu Oct 19 12:28:10 2023 +0000

    feat: anchor check in zeth

commit daf73ee
Author: john xu <john@taiko.xyz>
Date:   Tue Oct 17 13:18:20 2023 +0000

    feat: support taiko protocol

taiko reimburse_caller & reward_beneficiary

KATLA is before CANCUN, aka does not have 4844

--features taiko

more registers

update

pub mod handler_register

Update Cargo.toml

manual pick: bluealloy/pull/1073 & succinct/john/v5.0.0-patched

update c-kzg 1.0.0

latest bump compiled
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.

None yet

3 participants