-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to create filtering policy rules by conditional order id or tra…
…nsaction hashes (#146) # Description It's possible that we need to quickly ignore one specific order, but we don't want to neither ignore the whole handler (i.e. all TWAP orders), nor a whole user. For this reason, I included in this PR support for creating rules to ignore or drop orders by ID. ## Test One way to test this is to check how, current version of watch tower shows a ton of errors and can't process blocks in Sepolia with this config: ```json { "networks": [ { "name": "sepolia", "rpc": "wss://eth-sepolia.g.alchemy.com/v2/bUZqvmR5GCbUsE1meSoBNVlN-IqQs-_r", "deploymentBlock": 5072748, "filterPolicy": { "defaultAction": "DROP", "handlers": { "0x44569Cbd4E10dd5e97293337964Eff32d58ed352": "ACCEPT", "0x519BA24e959E33b3B6220CA98bd353d8c2D89920": "ACCEPT", "0x6cF1e9cA41f7611dEf408122793c358a3d11E5a5": "ACCEPT", "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "ACCEPT", "0xE8212F30C28B4AAB467DF3725C14d6e89C2eB967": "ACCEPT" } }, "watchdogTimeout": 120 } ] } ``` However, with this config it works: ```json { "networks": [ { "name": "sepolia", "rpc": "wss://eth-sepolia.g.alchemy.com/v2/bUZqvmR5GCbUsE1meSoBNVlN-IqQs-_r", "deploymentBlock": 5072748, "filterPolicy": { "defaultAction": "DROP", "conditionalOrderIds": { "0x5b3cdb6ffa3c95507cbfc459162609007865c2e87340312d3cd469c4ffbfae81": "SKIP" }, "handlers": { "0x44569Cbd4E10dd5e97293337964Eff32d58ed352": "ACCEPT", "0x519BA24e959E33b3B6220CA98bd353d8c2D89920": "ACCEPT", "0x6cF1e9cA41f7611dEf408122793c358a3d11E5a5": "ACCEPT", "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "ACCEPT", "0xE8212F30C28B4AAB467DF3725C14d6e89C2eB967": "ACCEPT" } }, "watchdogTimeout": 120 } ] } ``` <img width="1091" alt="image" src="https://github.com/cowprotocol/watch-tower/assets/2352112/e735e77d-a1e4-445f-9a2c-2ef0d0d06faf">
- Loading branch information
Showing
5 changed files
with
119 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,78 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"properties": { | ||
"networks": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"rpc": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"deploymentBlock": { | ||
"type": "integer" | ||
}, | ||
"watchdogTimeout": { | ||
"type": "integer" | ||
}, | ||
"orderBookApi": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"pageSize": { | ||
"type": "integer" | ||
}, | ||
"filterPolicy": { | ||
"type": "object", | ||
"properties": { | ||
"defaultAction": { | ||
"$ref": "#/$defs/filterAction" | ||
}, | ||
"owners": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/$defs/filterAction" | ||
} | ||
}, | ||
"handlers": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/$defs/filterAction" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"defaultAction" | ||
], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"rpc", | ||
"deploymentBlock", | ||
"filterPolicy" | ||
], | ||
"additionalProperties": false | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"networks" | ||
], | ||
"additionalProperties": false, | ||
"$defs": { | ||
"filterAction": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"properties": { | ||
"networks": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"rpc": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"deploymentBlock": { | ||
"type": "integer" | ||
}, | ||
"watchdogTimeout": { | ||
"type": "integer" | ||
}, | ||
"orderBookApi": { | ||
"type": "string", | ||
"enum": [ | ||
"ACCEPT", | ||
"DROP", | ||
"SKIP" | ||
] | ||
} | ||
"format": "uri" | ||
}, | ||
"pageSize": { | ||
"type": "integer" | ||
}, | ||
"filterPolicy": { | ||
"type": "object", | ||
"properties": { | ||
"defaultAction": { | ||
"$ref": "#/$defs/filterAction" | ||
}, | ||
"conditionalOrderIds": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/$defs/filterAction" | ||
} | ||
}, | ||
"transactions": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/$defs/filterAction" | ||
} | ||
}, | ||
"owners": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/$defs/filterAction" | ||
} | ||
}, | ||
"handlers": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/$defs/filterAction" | ||
} | ||
} | ||
}, | ||
"required": ["defaultAction"], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"required": ["name", "rpc", "deploymentBlock", "filterPolicy"], | ||
"additionalProperties": false | ||
} | ||
} | ||
}, | ||
"required": ["networks"], | ||
"additionalProperties": false, | ||
"$defs": { | ||
"filterAction": { | ||
"type": "string", | ||
"enum": ["ACCEPT", "DROP", "SKIP"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters