Skip to content

Commit

Permalink
added BLS library
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Apr 8, 2024
1 parent e80e607 commit 2cadbe4
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 450 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: test

on: workflow_dispatch
on:
pull_request:
merge_group:
push:
branches: [main]

env:
FOUNDRY_PROFILE: ci
Expand All @@ -27,8 +31,3 @@ jobs:
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
81 changes: 25 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,35 @@
## Foundry
## forge-alphanet

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
Set of solidity utilities to ease deployment and usage of applications on
[AlphaNet].

Foundry consists of:
### BLS library

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
Functions to allow calling each of the BLS precompiles defined in [EIP-2537]
without the low level details.

## Documentation
For example, this is how the library can be used from a solidity smart contract:
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
https://book.getfoundry.sh/
import "/path/to/forge-alphanet/src/libraries/BLS.sol";
## Usage
contract BLSExample {
event OperationResult(bool success, bytes result);
### Build
// Function to perform a BLS12-381 G1 addition with error handling
function performG1Add(bytes memory input) public {
(bool success, bytes memory output) = BLS.G1Add(input);
```shell
$ forge build
if (!success) {
emit OperationResult(false, "");
} else {
emit OperationResult(true, output);
}
}
}
```

### Test

```shell
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
[AlphaNet]: https://github.com/paradigmxyz/alphanet
[EIP-2537]: https://eips.ethereum.org/EIPS/eip-2537
Loading

0 comments on commit 2cadbe4

Please sign in to comment.