diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 0000000..79ebd6c --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,43 @@ +name: examples + +on: + pull_request: + merge_group: + push: + branches: [main] + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Foundry project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - uses: dtolnay/rust-toolchain@stable + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Run Forge build + id: build + run: forge build --root chapter1 + + - name: Rust BLS multisig example + run: cargo run --manifest-path ./chapter1/bls-multisig/rust/Cargo.toml + + - name: Python BLS multisig example + run: | + pip install web3 py_ecc + python ./chapter1/bls-multisig/python/multisig.py diff --git a/chapter1/bls-multisig/python/multisig.py b/chapter1/bls-multisig/python/multisig.py index 1349b48..35f23ea 100644 --- a/chapter1/bls-multisig/python/multisig.py +++ b/chapter1/bls-multisig/python/multisig.py @@ -54,7 +54,7 @@ def sign_operation(sks: list[int], operation: Operation) -> G2Point: async def main(): bls_multisig_artifact = json.load( - open(pathlib.Path(__file__).parent.parent.parent.parent / "out/BLSMultisig.sol/BLSMultisig.json") + open(pathlib.Path(__file__).parent.parent.parent / "contracts/out/BLSMultisig.sol/BLSMultisig.json") ) web3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider("http://localhost:8545")) diff --git a/chapter1/contracts/test/SimpleDelegateContract.t.sol b/chapter1/contracts/test/SimpleDelegateContract.t.sol index fc400e1..c8ffda8 100644 --- a/chapter1/contracts/test/SimpleDelegateContract.t.sol +++ b/chapter1/contracts/test/SimpleDelegateContract.t.sol @@ -13,7 +13,8 @@ contract SimpleDelegateContractTest is Test { // make it forward all calls to the deployed contract vm.etch(ALICE, bytes.concat(hex"ef0100", abi.encodePacked(delegation))); - ALICE.call{value: 1e18}(""); + (bool success,) = ALICE.call{value: 1e18}(""); + require(success); SimpleDelegateContract.Call[] memory calls = new SimpleDelegateContract.Call[](1); calls[0] = SimpleDelegateContract.Call({data: "", to: address(0), value: 1e18});