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

Lockdrop Precompile Fix #1208

Merged
merged 6 commits into from
Mar 27, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions precompiles/dispatch-lockdrop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use frame_system::Config;
use pallet_evm::GasWeightMapping;
use pallet_evm_precompile_dispatch::DispatchValidateT;
use parity_scale_codec::DecodeLimit;
use precompile_utils::prelude::{revert, BoundedBytes, RuntimeHelper, UnboundedBytes};
use precompile_utils::prelude::{revert, BoundedBytes, RuntimeHelper};
use precompile_utils::EvmResult;
use sp_core::{crypto::AccountId32, H160, H256};
use sp_io::hashing::keccak_256;
Expand All @@ -57,6 +57,8 @@ pub struct DispatchLockdrop<Runtime, DispatchValidator, DecodeLimit = ConstU32<8
PhantomData<(Runtime, DispatchValidator, DecodeLimit)>,
);

type CallLengthLimit = ConstU32<{ 2u32.pow(12) }>;
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick comment - perhaps it's just me, but I'd find 4 * 1024 more readable 🙃

Copy link
Member Author

Choose a reason for hiding this comment

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

So maybe 4096 directly then


#[precompile_utils::precompile]
impl<Runtime, DispatchValidator, DecodeLimit>
DispatchLockdrop<Runtime, DispatchValidator, DecodeLimit>
Expand All @@ -73,7 +75,7 @@ where
#[precompile::public("dispatch_lockdrop_call(bytes,bytes)")]
fn dispatch_lockdrop_call(
handle: &mut impl PrecompileHandle,
call: UnboundedBytes,
call: BoundedBytes<CallLengthLimit>,
pubkey: BoundedBytes<ECDSAPublic>,
) -> EvmResult<bool> {
log::trace!(
Expand Down
Loading