-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-jrigada-simulation-fail-zero-balance-wit…
…h-paymaster
- Loading branch information
Showing
14 changed files
with
141 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity >=0.8.7 <0.9.0; | ||
|
||
import {UsesFoo} from "../src/WithLibraries.sol"; | ||
import "forge-std/Script.sol"; | ||
|
||
contract DeployUsesFoo is Script { | ||
function run () external { | ||
// should fail because `UsesFoo` is unlinked | ||
bytes memory _code = vm.getCode("UsesFoo"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use foundry_test_utils::{forgetest_async, util, TestProject}; | ||
|
||
use crate::test_helpers::{deploy_zk_contract, run_zk_script_test}; | ||
|
||
// TODO(zk): add test that actually does the deployment | ||
// of the unlinked contract via script, once recursive linking is supported | ||
// and once we also support doing deploy-time linking | ||
|
||
forgetest_async!( | ||
#[should_panic = "no bytecode for contract; is it abstract or unlinked?"] | ||
script_using_unlinked_fails, | ||
|prj, cmd| { | ||
setup_libs_prj(&mut prj); | ||
run_zk_script_test( | ||
prj.root(), | ||
&mut cmd, | ||
"./script/Libraries.s.sol", | ||
"DeployUsesFoo", | ||
None, | ||
1, | ||
Some(&["-vvvvv"]), | ||
); | ||
} | ||
); | ||
|
||
forgetest_async!( | ||
#[should_panic = "Dynamic linking not supported"] | ||
create_using_unlinked_fails, | ||
|prj, cmd| { | ||
setup_libs_prj(&mut prj); | ||
|
||
// we don't really connect to the rpc because | ||
// we expect to fail before that point | ||
let foo_address = deploy_zk_contract( | ||
&mut cmd, | ||
"127.0.0.1:1234", | ||
"0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"./src/WithLibraries.sol:UsesFoo", | ||
) | ||
.expect("Failed to deploy UsesFoo contract"); | ||
|
||
assert!(!foo_address.is_empty(), "Deployed address should not be empty"); | ||
} | ||
); | ||
|
||
fn setup_libs_prj(prj: &mut TestProject) { | ||
util::initialize(prj.root()); | ||
prj.add_script("Libraries.s.sol", include_str!("../../fixtures/zk/Libraries.s.sol")).unwrap(); | ||
prj.add_source( | ||
"WithLibraries.sol", | ||
include_str!("../../../../../testdata/zk/WithLibraries.sol"), | ||
) | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ mod factory_deps; | |
mod fork; | ||
mod fuzz; | ||
mod invariant; | ||
mod linking; | ||
mod logs; | ||
mod nft; | ||
mod ownership; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity >=0.8.7 <0.9.0; | ||
|
||
library Foo { | ||
function add(uint256 a, uint256 b) external pure returns (uint256 c) { | ||
c = a + b; | ||
} | ||
} | ||
|
||
contract UsesFoo { | ||
uint256 number; | ||
|
||
constructor() { | ||
number = Foo.add(42, 0); | ||
} | ||
} |