Skip to content

Commit

Permalink
fix: adds missing allowFailureMap parameter to IDAO.Executed event (#351
Browse files Browse the repository at this point in the history
)

* fix: adds missing allowFailureMap parameter to IDAO.Executed event

* fix: adds missing natspec comment

* fix: tests with gas limit in execution

* fix: removes only from test

* feat: reorders IDAO.Executed event parameters

* chore: fix formatting issues

* feat: allows subgraph multiple datasources to be present
fix: some typos
fix: wrong imports in subgraph files

* feat: adds DAO v1.2 and splits out DAO v1

* fix: wrong imports in subgraph tests

* feat: splitting subgraph dao tests into v1 and v1.2

* chore: updates subgraph changelog

* fix: adapting subgraphs template versioning to use semver

* fix: revert subgraph manifest looping for upgradable contracts

* fix: also changes goerli subgraph manifest to use single addresses for upgradable contracts
  • Loading branch information
mathewmeconry authored Apr 4, 2023
1 parent cc14643 commit 39ffa73
Show file tree
Hide file tree
Showing 32 changed files with 2,053 additions and 201 deletions.
6 changes: 6 additions & 0 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## UPCOMING

### Added

- Added `allowFailureMap` to `IDAO.Executed` event.

## v1.2.0

### Added
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/src/core/dao/DAO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ contract DAO is
actor: msg.sender,
callId: _callId,
actions: _actions,
allowFailureMap: _allowFailureMap,
failureMap: failureMap,
execResults: execResults
});
Expand Down
2 changes: 2 additions & 0 deletions packages/contracts/src/core/dao/IDAO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ interface IDAO {
/// @param actor The address of the caller.
/// @param callId The ID of the call.
/// @param actions The array of actions executed.
/// @param allowFailureMap The allow failure map encoding which actions are allowed to fail.
/// @param failureMap The failure map encoding which actions have failed.
/// @param execResults The array with the results of the executed actions.
/// @dev The value of `callId` is defined by the component/contract calling the execute function. A `Plugin` implementation can use it, for example, as a nonce.
event Executed(
address indexed actor,
bytes32 callId,
Action[] actions,
uint256 allowFailureMap,
uint256 failureMap,
bytes[] execResults
);
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/test/dao/DAOMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contract DAOMock is IDAO, PermissionManager {
uint256 allowFailureMap
) external override returns (bytes[] memory execResults, uint256 failureMap) {
(allowFailureMap);
emit Executed(msg.sender, callId, _actions, failureMap, execResults);
emit Executed(msg.sender, callId, _actions, allowFailureMap, failureMap, execResults);
}

function deposit(
Expand Down
8 changes: 5 additions & 3 deletions packages/contracts/test/core/dao/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,15 @@ describe('DAO', function () {

expect(event.args.actor).to.equal(ownerAddress);
expect(event.args.callId).to.equal(ZERO_BYTES32);
expect(event.args.allowFailureMap).to.equal(allowFailureMap);

// construct the failureMap which only has those
// bits set at indexes where actions failed
let failureMap = ethers.BigNumber.from(0);
for (let i = 0; i < 3; i++) {
failureMap = flipBit(i, failureMap);
}
// Check that dao crrectly generated failureMap
// Check that dao correctly generated failureMap
expect(event.args.failureMap).to.equal(failureMap);

// Check that execResult emitted correctly stores action results.
Expand Down Expand Up @@ -372,6 +373,7 @@ describe('DAO', function () {
expect(event.args.actions[0].value).to.equal(data.succeedAction.value);
expect(event.args.actions[0].data).to.equal(data.succeedAction.data);
expect(event.args.execResults[0]).to.equal(data.successActionResult);
expect(event.args.allowFailureMap).to.equal(0);
});

it('reverts if failure is allowed but not enough gas is provided', async () => {
Expand All @@ -392,11 +394,11 @@ describe('DAO', function () {
[gasConsumingAction],
allowFailureMap
); // exact gas required: 495453
// Providing less gas causes the `to.call` of the `gasConsumingAction` to fail, but is still enough for the overall `dao.execute` call to finish successfully.

// Providing less gas causes the `to.call` of the `gasConsumingAction` to fail, but is still enough for the overall `dao.execute` call to finish successfully.
await expect(
dao.execute(ZERO_BYTES32, [gasConsumingAction], allowFailureMap, {
gasLimit: expectedGas.sub(500),
gasLimit: expectedGas.sub(800),
})
).to.be.revertedWithCustomError(dao, 'InsufficientGas');

Expand Down
6 changes: 6 additions & 0 deletions packages/subgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UPCOMING]

### Changed

- Supports now multiple `DAORegistries`, `PluginRepoRegistries` and `PluginSetupProcessors` as datasources.
- Splits `DAO` into multiple versions.
- Fixes typing issues in tests and subgraph manifest.

## [1.1.0]

### Added
Expand Down
Loading

0 comments on commit 39ffa73

Please sign in to comment.