Skip to content

Commit

Permalink
Add Makefile target for building the AGC binary
Browse files Browse the repository at this point in the history
  • Loading branch information
szemate committed Jan 17, 2025
1 parent c7941f3 commit d254fef
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
VERSION := $(shell cat AUTONITY_VERSION)
AUTONITY := build/autonity
AGC_BINARY := $(AUTONITY)/build/bin/autonity
ABIDIR := $(AUTONITY)/params/generated
SRCDIR := $(AUTONITY)/autonity/solidity/contracts
OUTDIR := autonity/contracts
Expand Down Expand Up @@ -61,6 +62,12 @@ $(ABIDIR)/%.abi $(ABIDIR)/%.docdev $(ABIDIR)/%.docuser: $(AUTONITY) AUTONITY_VER
git checkout $(VERSION) && \
make contracts

$(AGC_BINARY): $(AUTONITY) AUTONITY_VERSION
cd $< && \
git fetch origin && \
git checkout $(VERSION) && \
make autonity

$(AUTONITY):
git clone [email protected]:autonity/autonity.git $@

Expand Down
48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,45 @@ Installed pypy3.10 @ /home/develop/.local/share/hatch/pythons/pypy3.10
⚠️ Hatch will modify your shell configuration to add these directories to your
`$PATH`.

### Updating the contract bindings

To update contract bindings for a new version of the Autonity protocol, add the
new [AGC](https://github.com/autonity/autonity) version (Git tag or commit ID)
to `AUTONITY_VERSION`, then generate the contract bindings with `make`:

```console
echo v0.14.0 > AUTONITY_VERSION
make
```

Contract functions are ordered alphabetically in order to produce deterministic
output. After executing the script against a new version of the code, the diffs
can be reviewed to determine which methods have been modified, removed or added.
The generated Python bindings include the contract ABIs as Python dictionaries.

If there is a new contract to include, add a new target to `Makefile` and a new
factory function to `autonity/factory.py` and `autonity/__init__.py`.

### Building and testing

First build the Autonity Go Client:

```sh
make build/autonity/build/bin/autonity
```

To launch the tests across all supported Python versions, run:

```sh
hatch run test:all
hatch run test:local
```

To limit the tests to a specific Python version, add a
[`hatch run`](https://hatch.pypa.io/latest/cli/reference/#hatch-run) `+`
argument:

```sh
hatch run +py=3.12 test:all
hatch run +py=3.12 test:local
```

To lint the code base, use the command:
Expand All @@ -125,25 +150,6 @@ To lint the code base, use the command:
hatch run lint:check
```

### Updating the contract bindings

To update contract bindings for a new version of the Autonity protocol, add the
new [AGC](https://github.com/autonity/autonity) version (Git tag or commit ID)
to `AUTONITY_VERSION`, then generate the contract bindings with `make`:

```console
echo v0.14.0 > AUTONITY_VERSION
make
```

Contract functions are ordered alphabetically in order to produce deterministic
output. After executing the script against a new version of the code, the diffs
can be reviewed to determine which methods have been modified, removed or added.
The generated Python bindings include the contract ABIs as Python dictionaries.

If there is a new contract to include, add a new target to `Makefile` and a new
factory function to `autonity/factory.py` and `autonity/__init__.py`.

## Contributing

To contribute a non-critical bug fix, please open a pull request against the
Expand Down

0 comments on commit d254fef

Please sign in to comment.