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 nonemergency council monitor #226

Merged
merged 4 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"coverage:report": "yarn coverage:filtered-report && yarn coverage:htmlreport && yarn coverage:open-report",
"coverage:refresh": "yarn coverage:filtered-report && yarn coverage:htmlreport",
"propmon:ui": "cd src-ts && http-server . -p 8080",
"propmon:service": "ts-node ./src-ts/proposalMonitorCli.ts --jsonOutputLocation ./src-ts/propMonUi/proposalState.json --l1RpcUrl $ETH_RPC --govChainRpcUrl https://arb1.arbitrum.io/rpc --novaRpcUrl https://nova.arbitrum.io/rpc --coreGovernorAddress 0xf07DeD9dC292157749B6Fd268E37DF6EA38395B9 --treasuryGovernorAddress 0x789fC99093B09aD01C34DC7251D0C89ce743e5a4 --sevenTwelveCouncil 0x895c9fc6bcf06e553b54A9fE11D948D67a9B76FA --nomineeElectionGovernorAddress 0x8a1cDA8dee421cD06023470608605934c16A05a0 --pollingIntervalSeconds 5",
"propmon:service": "ts-node ./src-ts/proposalMonitorCli.ts --jsonOutputLocation ./src-ts/propMonUi/proposalState.json --l1RpcUrl $ETH_RPC --govChainRpcUrl https://arb1.arbitrum.io/rpc --novaRpcUrl https://nova.arbitrum.io/rpc --coreGovernorAddress 0xf07DeD9dC292157749B6Fd268E37DF6EA38395B9 --treasuryGovernorAddress 0x789fC99093B09aD01C34DC7251D0C89ce743e5a4 --sevenTwelveCouncilAddress 0xADd68bCb0f66878aB9D37a447C7b9067C5dfa941 --nomineeElectionGovernorAddress 0x8a1cDA8dee421cD06023470608605934c16A05a0 --pollingIntervalSeconds 5",
"propmon": "yarn propmon:service & yarn propmon:ui"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions src-ts/propMonUi/propMonUi.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ <h1>Proposal States</h1>
return 'Treasury Governor';
case '0x8a1cDA8dee421cD06023470608605934c16A05a0'.toLowerCase():
return 'Election Governor'
case '0xADd68bCb0f66878aB9D37a447C7b9067C5dfa941'.toLowerCase():
return 'Non-emergency Security Council'
default:
return 'Unknown Governor';;
}
Expand Down
46 changes: 46 additions & 0 deletions src-ts/proposalStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ export class L2TimelockExecutionBatchStage extends L2TimelockExecutionStage {
): Promise<L2TimelockExecutionBatchStage[]> {
const govInterface = L2ArbitrumGovernor__factory.createInterface();
const proposalStages: L2TimelockExecutionBatchStage[] = [];
const timelockInterface = ArbitrumTimelock__factory.createInterface();

for (const log of receipt.logs) {
if (log.topics.find((t) => t === govInterface.getEventTopic("ProposalQueued"))) {
const propQueuedObj = govInterface.parseLog(log)
Expand Down Expand Up @@ -594,6 +596,50 @@ export class L2TimelockExecutionBatchStage extends L2TimelockExecutionStage {
arbOneSignerOrProvider
);
proposalStages.push(executeBatch);
} else if (log.topics[0] === timelockInterface.getEventTopic("CallScheduled")){
try {
const callScheduledArgs = timelockInterface.parseLog(log)
.args as CallScheduledEvent["args"];

const { data } = ArbSys__factory.createInterface().decodeFunctionData(
"sendTxToL1",
callScheduledArgs.data
);

const { salt } = this.decodeScheduleBatch(data);

// calculate the id and check if that operation exists
const operationId = this.hashOperationBatch(
DZGoldman marked this conversation as resolved.
Show resolved Hide resolved
[callScheduledArgs.target],
[callScheduledArgs[3]], // cant use .value as ethers fails with this
[callScheduledArgs.data],
callScheduledArgs.predecessor,
salt
);

if (operationId !== callScheduledArgs.id) {
throw new Error("Invalid operation id");
}

const timelockAddress = log.address;
const executeTimelock = new L2TimelockExecutionBatchStage(
[callScheduledArgs.target],
[callScheduledArgs[3]],
[callScheduledArgs.data],
callScheduledArgs.predecessor,
salt,
timelockAddress,
arbOneSignerOrProvider
);
if (
proposalStages.filter((s) => s.identifier === executeTimelock.identifier).length === 0
) {
proposalStages.push(executeTimelock);
}
} catch (err) {
// there are expected errors since the calldata may not be of the expected form for decoding
continue;
}
}
}

Expand Down