Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adds missing allowFailureMap parameter to IDAO.Executed event #351

Merged
merged 14 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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