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

precompile-utils refactor #2165

Merged
merged 27 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
458d5fc
refactor EvmData (now solidity::Codec)
nanocryk Mar 13, 2023
f2ff299
feature for xcm codec
nanocryk Mar 14, 2023
05e2325
refactor revert mod
nanocryk Mar 14, 2023
b7e45ef
refactor revert mod
nanocryk Mar 14, 2023
92777d3
move hand and costs in evm mod
nanocryk Mar 14, 2023
f21e487
move logs mod in evm mod
nanocryk Mar 15, 2023
7c0c01c
typo
nanocryk Mar 16, 2023
1509bb4
Merge remote-tracking branch 'origin/master' into jeremy-precompile-u…
nanocryk Mar 16, 2023
83abd06
fix revert encoding
nanocryk Mar 16, 2023
ef4d90a
update macro ui tests
nanocryk Mar 16, 2023
43b9d02
update error messages
nanocryk Mar 16, 2023
c1dd2be
remove generate_function_selector
nanocryk Mar 20, 2023
ed13f37
unused imports
nanocryk Mar 22, 2023
e1bb319
Merge remote-tracking branch 'origin/master' into jeremy-precompile-u…
nanocryk Mar 22, 2023
00bde9b
Merge remote-tracking branch 'origin/master' into jeremy-precompile-u…
nanocryk Mar 28, 2023
7178e7c
Merge remote-tracking branch 'origin/master' into jeremy-precompile-u…
nanocryk Mar 29, 2023
ac98f6f
Merge remote-tracking branch 'origin/master' into jeremy-precompile-u…
nanocryk Apr 13, 2023
0176e45
update ui macro tests
nanocryk Apr 13, 2023
d3fa68c
remove direct usage of Reader/Writer
nanocryk Apr 13, 2023
07715bb
Use absolute path in macro
nanocryk Apr 14, 2023
aba68fa
refactor interface test
nanocryk Apr 14, 2023
a602714
rename execute_returns/execute_returns_encoded
nanocryk Apr 14, 2023
429e1d4
fmt
nanocryk Apr 17, 2023
f1673e3
improve SubcallOutput usage
nanocryk Apr 17, 2023
f029edc
rm unused imports
nanocryk Apr 17, 2023
2e7c0f9
update macro stderr
nanocryk Apr 17, 2023
519aa3c
Merge remote-tracking branch 'origin/master' into jeremy-precompile-u…
nanocryk Apr 18, 2023
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
34 changes: 17 additions & 17 deletions precompiles/assets-erc20/src/eip2612.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ where
Runtime::RuntimeCall: Dispatchable<PostInfo = PostDispatchInfo> + GetDispatchInfo,
Runtime::RuntimeCall: From<pallet_assets::Call<Runtime, Instance>>,
<Runtime::RuntimeCall as Dispatchable>::RuntimeOrigin: From<Option<Runtime::AccountId>>,
BalanceOf<Runtime, Instance>: TryFrom<U256> + Into<U256> + EvmData,
BalanceOf<Runtime, Instance>: TryFrom<U256> + Into<U256> + solidity::Codec,
Runtime: AccountIdAssetIdConversion<Runtime::AccountId, AssetIdOf<Runtime, Instance>>,
<<Runtime as frame_system::Config>::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait,
IsLocal: Get<bool>,
Expand All @@ -145,13 +145,13 @@ where
let version: H256 = keccak256!("1").into();
let chain_id: U256 = Runtime::ChainId::get().into();

let domain_separator_inner = EvmDataWriter::new()
.write(H256::from(PERMIT_DOMAIN))
.write(name)
.write(version)
.write(chain_id)
.write(Address(address))
.build();
let domain_separator_inner = solidity::encode_arguments((
H256::from(PERMIT_DOMAIN),
name,
version,
chain_id,
Address(address),
));

keccak_256(&domain_separator_inner).into()
}
Expand All @@ -167,14 +167,14 @@ where
) -> [u8; 32] {
let domain_separator = Self::compute_domain_separator(address, asset_id);

let permit_content = EvmDataWriter::new()
.write(H256::from(PERMIT_TYPEHASH))
.write(Address(owner))
.write(Address(spender))
.write(value)
.write(nonce)
.write(deadline)
.build();
let permit_content = solidity::encode_arguments((
H256::from(PERMIT_TYPEHASH),
Address(owner),
Address(spender),
value,
nonce,
deadline,
));
let permit_content = keccak_256(&permit_content);

let mut pre_digest = Vec::with_capacity(2 + 32 + 32);
Expand Down Expand Up @@ -239,7 +239,7 @@ where
SELECTOR_LOG_APPROVAL,
owner,
spender,
EvmDataWriter::new().write(value).build(),
solidity::encode_event_data(value),
)
.record(handle)?;

Expand Down
12 changes: 6 additions & 6 deletions precompiles/assets-erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ where
Runtime::RuntimeCall: Dispatchable<PostInfo = PostDispatchInfo> + GetDispatchInfo,
Runtime::RuntimeCall: From<pallet_assets::Call<Runtime, Instance>>,
<Runtime::RuntimeCall as Dispatchable>::RuntimeOrigin: From<Option<Runtime::AccountId>>,
BalanceOf<Runtime, Instance>: TryFrom<U256> + Into<U256> + EvmData,
BalanceOf<Runtime, Instance>: TryFrom<U256> + Into<U256> + solidity::Codec,
Runtime: AccountIdAssetIdConversion<Runtime::AccountId, AssetIdOf<Runtime, Instance>>,
<<Runtime as frame_system::Config>::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait,
IsLocal: Get<bool>,
Expand Down Expand Up @@ -226,7 +226,7 @@ where
SELECTOR_LOG_APPROVAL,
handle.context().caller,
spender,
EvmDataWriter::new().write(value).build(),
solidity::encode_event_data(value),
)
.record(handle)?;

Expand Down Expand Up @@ -311,7 +311,7 @@ where
SELECTOR_LOG_TRANSFER,
handle.context().caller,
to,
EvmDataWriter::new().write(value).build(),
solidity::encode_event_data(value),
)
.record(handle)?;

Expand Down Expand Up @@ -370,7 +370,7 @@ where
SELECTOR_LOG_TRANSFER,
from,
to,
EvmDataWriter::new().write(value).build(),
solidity::encode_event_data(value),
)
.record(handle)?;

Expand Down Expand Up @@ -520,7 +520,7 @@ where
SELECTOR_LOG_TRANSFER,
H160::default(),
to,
EvmDataWriter::new().write(value).build(),
solidity::encode_event_data(value),
)
.record(handle)?;

Expand Down Expand Up @@ -565,7 +565,7 @@ where
SELECTOR_LOG_TRANSFER,
from,
H160::default(),
EvmDataWriter::new().write(value).build(),
solidity::encode_event_data(value),
)
.record(handle)?;

Expand Down
Loading