-
Notifications
You must be signed in to change notification settings - Fork 290
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
feat: MulticallCairo precompile #1503
base: main
Are you sure you want to change the base?
Conversation
|
||
// Load address and cairo selector called | ||
// Unsafe to assume that the 32 bytes in input do not overflow a felt - responsibility of the caller to format its input correctly | ||
let to_starknet_address = Helpers.bytes32_to_felt(calls); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transform to Uint256 and compare to Prime to ensure this does not overflow ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bytes32_to_uint256 -> ensure not > PRIME -> reconstruct felt from (low, high)?
idk if we should put guard rails around this. @ClementWalter thoughts?
solidity_contracts/src/CairoPrecompiles/MulticallCairoCounterCaller.sol
Outdated
Show resolved
Hide resolved
solidity_contracts/src/CairoPrecompiles/MulticallCairoCounterCaller.sol
Outdated
Show resolved
Hide resolved
solidity_contracts/src/CairoPrecompiles/MulticallCairoCounterCaller.sol
Outdated
Show resolved
Hide resolved
tests/end_to_end/CairoPrecompiles/test_batch_cairo_precompile.py
Outdated
Show resolved
Hide resolved
tests/end_to_end/CairoPrecompiles/test_batch_cairo_precompile.py
Outdated
Show resolved
Hide resolved
tests/end_to_end/CairoPrecompiles/test_batch_cairo_precompile.py
Outdated
Show resolved
Hide resolved
tests/end_to_end/CairoPrecompiles/test_batch_cairo_precompile.py
Outdated
Show resolved
Hide resolved
tests/end_to_end/CairoPrecompiles/test_batch_cairo_precompile.py
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1503 +/- ##
=======================================
- Coverage 61.9% 61.8% -0.2%
=======================================
Files 44 44
Lines 8197 8327 +130
=======================================
+ Hits 5078 5150 +72
- Misses 3119 3177 +58 ☔ View full report in Codecov by Sentry. |
solidity_contracts/src/CairoPrecompiles/MulticallCairoCounterCaller.sol
Outdated
Show resolved
Hide resolved
solidity_contracts/src/CairoPrecompiles/MulticallCairoCounterCaller.sol
Outdated
Show resolved
Hide resolved
tests/end_to_end/CairoPrecompiles/test_batch_cairo_precompile.py
Outdated
Show resolved
Hide resolved
dba5f03
to
4d2d372
Compare
4d2d372
to
c1caa88
Compare
// Input must be at least 4 + 3*32 bytes long. | ||
let is_input_invalid = is_nn(99 - input_len); | ||
// Input must be at least MIN_EVM_ENCODED_STARKNET_CALL_BYTES bytes long to be valid. | ||
let is_call_invalid = is_nn(MIN_EVM_ENCODED_STARKNET_CALL_BYTES - (input_len + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a comment about the fact that because of gas cost, input_len < 2**128
|
||
yield cairo_counter | ||
|
||
tx = await cairo_counter.functions["set_counter"].invoke_v1(0, max_fee=max_fee) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to use our wrapper call
and invoke
as starknet py is not so stable, and so it's easier when we need to update/patch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call and invoke are good for contracts available in artifacts, not so much when passing an address because the calldata is not parsed.
Time spent on this PR: 0.5d
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Resolves #1464
What is the new behavior?
MulticallCairo
precompile - at address0x75003
, that receives an flattened array of cairo calls and executes them sequentially.0x75001
SinglecallCairo
precompile that would be permissionless, and also have delegatecall deactivated ?This change is